Asset Browser: Add debug option to disable asset indexing

Adds an "Asset Indexing" option (enabled by default) to Preferences >
Experimental > Debugging. This is useful when working on the asset
library loading.
This commit is contained in:
Julian Eisel 2022-01-19 20:02:23 +01:00
parent 9a2d1cd5b7
commit 293aab2253
4 changed files with 15 additions and 2 deletions

View File

@ -2320,6 +2320,7 @@ class USERPREF_PT_experimental_debugging(ExperimentalPanel, Panel):
({"property": "use_cycles_debug"}, None),
({"property": "use_geometry_nodes_legacy"}, "T91274"),
({"property": "show_asset_debug_info"}, None),
({"property": "use_asset_indexing"}, None),
),
)

View File

@ -57,6 +57,7 @@
#include "UI_view2d.h"
#include "GPU_framebuffer.h"
#include "file_indexer.h"
#include "file_intern.h" /* own include */
#include "filelist.h"
#include "fsmenu.h"
@ -356,7 +357,9 @@ static void file_refresh(const bContext *C, ScrArea *area)
}
if (ED_fileselect_is_asset_browser(sfile)) {
filelist_setindexer(sfile->files, &file_indexer_asset);
const bool use_asset_indexer = !USER_EXPERIMENTAL_TEST(&U, no_asset_indexing);
filelist_setindexer(sfile->files,
use_asset_indexer ? &file_indexer_asset : &file_indexer_noop);
}
/* Update the active indices of bookmarks & co. */

View File

@ -655,6 +655,7 @@ typedef struct UserDef_Experimental {
char use_cycles_debug;
char use_geometry_nodes_legacy;
char show_asset_debug_info;
char no_asset_indexing;
char SANITIZE_AFTER_HERE;
/* The following options are automatically sanitized (set to 0)
* when the release cycle is not alpha. */
@ -665,7 +666,7 @@ typedef struct UserDef_Experimental {
char use_sculpt_tools_tilt;
char use_extended_asset_browser;
char use_override_templates;
char _pad[2];
char _pad[1];
/** `makesdna` does not allow empty structs. */
} UserDef_Experimental;

View File

@ -6437,6 +6437,14 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
"Enable some extra fields in the Asset Browser to aid in debugging");
RNA_def_property_update(prop, 0, "rna_userdef_ui_update");
prop = RNA_def_property(srna, "use_asset_indexing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "no_asset_indexing", 1);
RNA_def_property_ui_text(prop,
"Asset Indexing",
"Disabling the asset indexer forces every asset library refresh to "
"completely reread assets from disk");
RNA_def_property_update(prop, 0, "rna_userdef_ui_update");
prop = RNA_def_property(srna, "use_override_templates", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "use_override_templates", 1);
RNA_def_property_ui_text(