Fix #147098: No Default Import method being set on new asset library path
`append and reuse` is chosen as default in DNA but this enumpropertyitem isn't added to the array when `Non data block packing` is disabled in Developer tools (see `rna_preference_asset_libray_import_method_itemf`). To fix this, change default in DNA to `ASSET_IMPORT_PACK`. In case of "non packing", change import_method inside `asset_library_add()` function. Also introduce `rna_preference_asset_libray_import_method_default` so that "reset to default value" operator works correctly. Pull Request: https://projects.blender.org/blender/blender/pulls/147104
This commit is contained in:
committed by
Pratik Borhade
parent
b9b52472f3
commit
a48bb36588
@@ -63,7 +63,9 @@ bUserAssetLibrary *BKE_preferences_asset_library_add(UserDef *userdef,
|
||||
bUserAssetLibrary *library = DNA_struct_default_alloc(bUserAssetLibrary);
|
||||
|
||||
BLI_addtail(&userdef->asset_libraries, library);
|
||||
|
||||
if (userdef->experimental.no_data_block_packing) {
|
||||
library->import_method = ASSET_IMPORT_APPEND_REUSE;
|
||||
}
|
||||
if (name) {
|
||||
BKE_preferences_asset_library_name_set(userdef, library, name);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#define _DNA_DEFAULT_bUserAssetLibrary \
|
||||
{ \
|
||||
.import_method = ASSET_IMPORT_APPEND_REUSE, \
|
||||
.import_method = ASSET_IMPORT_PACK, \
|
||||
.flag = ASSET_LIBRARY_RELATIVE_PATH, \
|
||||
}
|
||||
|
||||
|
||||
@@ -1541,6 +1541,11 @@ static const EnumPropertyItem *rna_preference_asset_libray_import_method_itemf(
|
||||
return items;
|
||||
}
|
||||
|
||||
int rna_preference_asset_libray_import_method_default(PointerRNA * /*ptr*/, PropertyRNA * /*prop*/)
|
||||
{
|
||||
return U.experimental.no_data_block_packing ? ASSET_IMPORT_APPEND_REUSE : ASSET_IMPORT_PACK;
|
||||
}
|
||||
|
||||
static void rna_experimental_no_data_block_packing_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
@@ -6750,6 +6755,7 @@ static void rna_def_userdef_filepaths_asset_library(BlenderRNA *brna)
|
||||
RNA_def_property_enum_items(prop, rna_enum_preferences_asset_import_method_items);
|
||||
RNA_def_property_enum_funcs(
|
||||
prop, nullptr, nullptr, "rna_preference_asset_libray_import_method_itemf");
|
||||
RNA_def_property_enum_default_func(prop, "rna_preference_asset_libray_import_method_default");
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Default Import Method",
|
||||
|
||||
Reference in New Issue
Block a user