diff options
author | Bastien Montagne <bastien@blender.org> | 2022-08-18 16:01:41 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-08-18 16:49:50 +0300 |
commit | a149c4aaeee2d4ad5a2b094b0a3860585d8af88b (patch) | |
tree | b1795bc8800b8b98166c838147cc62e4967a1c97 /source | |
parent | 8a799b00f8fa28433ba44cfec09757f77a46ae0d (diff) |
LibOverride: Fix more crashes when creating overrides from IDTemplates.
Assigning to RNA ID pointer properties will not _always_ trigger a
rebuild of the outliner tree, so try to enforce this when actually
creating overrides.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index bec4506ca41..94a7296d558 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -796,7 +796,6 @@ ID *ui_template_id_liboverride_hierarchy_create( BKE_lib_override_library_create( bmain, scene, view_layer, NULL, id, NULL, NULL, &id_override, false); BKE_scene_collections_object_remove(bmain, scene, (Object *)id, true); - WM_event_add_notifier(C, NC_ID | NA_REMOVED, NULL); } break; case ID_ME: @@ -854,6 +853,18 @@ ID *ui_template_id_liboverride_hierarchy_create( if (id_override != NULL) { id_override->override_library->flag &= ~IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED; *r_undo_push_label = "Make Library Override Hierarchy"; + + /* In theory we could rely on setting/updating the RNA ID pointer property (as done by calling + * code) to be enough. + * + * However, some rare ID pointers properties (like the 'active object in viewlayer' one used + * for the Object templateID in the Object properties) use notifiers that do not enforce a + * rebuild of outliner trees, leading to crashes. + * + * So for now, add some extra notifiers here. */ + WM_event_add_notifier(C, NC_ID | NA_REMOVED, NULL); + WM_event_add_notifier(C, NC_ID | NA_ADDED, NULL); + WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); } return id_override; } |