Commit: 8db12b1f951852a4d2a556441c019520e90d5e0a Author: Julian Eisel Date: Thu Oct 8 15:49:46 2020 +0200 Branches: asset-browser https://developer.blender.org/rB8db12b1f951852a4d2a556441c019520e90d5e0a
Fix issues with browsing repository .blend file The file selection in the Preferences wasn't working well at all. Should now work fine. =================================================================== M source/blender/editors/interface/interface_handlers.c M source/blender/editors/space_buttons/buttons_ops.c M source/blender/editors/space_file/filesel.c M source/blender/makesrna/RNA_access.h M source/blender/makesrna/intern/rna_userdef.c =================================================================== diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 24ca50edfec..c0b4f5dfd40 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -630,7 +630,11 @@ static bool ui_rna_is_userdef(PointerRNA *ptr, PropertyRNA *prop) if (base == NULL) { base = ptr->type; } - if (ELEM(base, &RNA_AddonPreferences, &RNA_KeyConfigPreferences, &RNA_KeyMapItem)) { + if (ELEM(base, + &RNA_AddonPreferences, + &RNA_KeyConfigPreferences, + &RNA_KeyMapItem, + &RNA_UserAssetRepository)) { tag = true; } } diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 87cf8507dd4..0c98d4de987 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -338,7 +338,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event) is_relative = BLI_path_is_rel(str); } - if (UNLIKELY(ptr.data == &U)) { + if (UNLIKELY(ptr.data == &U || is_userdef)) { is_relative = false; } diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 5aaea095051..492ac2a258d 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -78,9 +78,9 @@ #define VERTLIST_MAJORCOLUMN_WIDTH (25 * UI_UNIT_X) -static eFileSelectType fileselect_type_from_params_get(const FileSelectParams *params) +static eFileSelectType fileselect_type_from_asset_params_get(const FileSelectParams *params) { - + BLI_assert(ED_fileselect_is_asset_browser(params)); return (params->asset_repository.type == FILE_ASSET_REPO_LOCAL) ? FILE_MAIN_ASSET : FILE_LOADLIB; } @@ -99,13 +99,14 @@ static bool fileselect_needs_refresh(const SpaceFile *sfile) (sfile->params->type != FILE_UNIX)) { return true; } - if (sfile->files && - !filelist_matches_type(sfile->files, fileselect_type_from_params_get(sfile->params))) { - return true; - } - if (sfile->files && - !filelist_matches_asset_repository(sfile->files, &sfile->params->asset_repository)) { - return true; + if (sfile->files && ED_fileselect_is_asset_browser(sfile->params)) { + if (!filelist_matches_type(sfile->files, + fileselect_type_from_asset_params_get(sfile->params))) { + return true; + } + if (!filelist_matches_asset_repository(sfile->files, &sfile->params->asset_repository)) { + return true; + } } return false; @@ -363,7 +364,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) params->file[0] = '\0'; params->asset_repository.type = repo_type; - params->type = fileselect_type_from_params_get(params); + params->type = fileselect_type_from_asset_params_get(params); /* TODO this way of using filters to realize categories is noticably slower than * specifying a "group" to read. That's because all types are read and filtering is applied * after the fact. */ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 385e31d3c80..78407e8f7ea 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -696,6 +696,7 @@ extern StructRNA RNA_UVProjector; extern StructRNA RNA_UVWarpModifier; extern StructRNA RNA_UnitSettings; extern StructRNA RNA_UnknownType; +extern StructRNA RNA_UserAssetRepository; extern StructRNA RNA_UserSolidLight; extern StructRNA RNA_VertexcolorGpencilModifier; extern StructRNA RNA_VectorFont; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 89335bb4293..18ebae508b4 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -5961,7 +5961,7 @@ static void rna_def_userdef_filepaths_asset_repository(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna = RNA_def_struct(brna, "PreferencesAssetRepository", NULL); + srna = RNA_def_struct(brna, "UserAssetRepository", NULL); RNA_def_struct_sdna(srna, "bUserAssetRepository"); RNA_def_struct_clear_flag(srna, STRUCT_UNDO); RNA_def_struct_ui_text(srna, @@ -6155,7 +6155,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) rna_def_userdef_filepaths_asset_repository(brna); prop = RNA_def_property(srna, "asset_repositories", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_type(prop, "PreferencesAssetRepository"); + RNA_def_property_struct_type(prop, "UserAssetRepository"); RNA_def_property_ui_text(prop, "Asset Repositories", ""); } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs