mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix #162713: Crash in Add Modifer menu for Nurb Surface
`OBJECT_MT_modifier_add_edit` (triggered for curves via `OBJECT_MT_modifier_add`) would use `template_modifier_asset_menu_items()` to add asset items to the modifier add menu. So it doesn't go the usual `OBJECT_MT_modifier_add_root_catalogs` that ensures the catalog data is up-to-date. That means it may dangle if a file was unloaded before, which frees asset libraries. Pull Request: https://projects.blender.org/blender/blender/pulls/163387
This commit is contained in:
parent
64bcb05742
commit
99b03abec1
3 changed files with 12 additions and 3 deletions
|
|
@ -611,7 +611,8 @@ void data_xform_by_mat4(XFormObjectData &xod, const float4x4 &transform);
|
|||
void data_xform_restore(XFormObjectData &xod);
|
||||
void data_xform_tag_update(XFormObjectData &xod);
|
||||
|
||||
void ui_template_modifier_asset_menu_items(ui::Layout &layout,
|
||||
void ui_template_modifier_asset_menu_items(const bContext &C,
|
||||
ui::Layout &layout,
|
||||
StringRef catalog_path,
|
||||
bool skip_essentials);
|
||||
|
||||
|
|
|
|||
|
|
@ -413,11 +413,17 @@ void object_modifier_add_asset_register()
|
|||
WM_operatortype_append(OBJECT_OT_modifier_add_node_group);
|
||||
}
|
||||
|
||||
void ui_template_modifier_asset_menu_items(ui::Layout &layout,
|
||||
void ui_template_modifier_asset_menu_items(const bContext &C,
|
||||
ui::Layout &layout,
|
||||
const StringRef catalog_path,
|
||||
const bool skip_essentials)
|
||||
{
|
||||
asset::AssetItemTree &tree = *get_static_item_tree();
|
||||
tree = build_catalog_tree(C);
|
||||
if (tree.catalogs.is_empty() && all_loading_finished()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const asset_system::AssetCatalogTreeItem *item = tree.catalogs.find_root_item(catalog_path);
|
||||
if (!item) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1091,11 +1091,12 @@ static void rna_uiLayout_template_node_operator_asset_menu_items(Layout *layout,
|
|||
}
|
||||
|
||||
static void rna_uiLayout_template_modifier_asset_menu_items(Layout *layout,
|
||||
bContext *C,
|
||||
const char *catalog_path,
|
||||
const bool skip_essentials)
|
||||
{
|
||||
ed::object::ui_template_modifier_asset_menu_items(
|
||||
*layout, StringRef(catalog_path), skip_essentials);
|
||||
*C, *layout, StringRef(catalog_path), skip_essentials);
|
||||
}
|
||||
|
||||
static void rna_uiLayout_template_node_operator_root_items(Layout *layout, bContext *C)
|
||||
|
|
@ -2477,6 +2478,7 @@ void RNA_api_ui_layout(StructRNA *srna)
|
|||
func = RNA_def_function(srna,
|
||||
"template_modifier_asset_menu_items",
|
||||
"rna_uiLayout_template_modifier_asset_menu_items");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
parm = RNA_def_string(func, "catalog_path", nullptr, 0, "", "");
|
||||
parm = RNA_def_boolean(func, "skip_essentials", false, "", "");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue