Merge branch 'blender-v3.3-release'

This commit is contained in:
Bastien Montagne 2022-08-18 17:26:54 +02:00
commit b375019ebc
2 changed files with 22 additions and 11 deletions

View File

@ -823,13 +823,19 @@ static int override_idtemplate_create_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
PointerRNA idptr;
/* `idptr` is re-assigned to owner property to ensure proper updates etc. Here we also use it to
* ensure remapping of the owner property from the linked data to the newly created liboverride
* (note that in theory this remapping has already been done by code above). */
RNA_id_pointer_create(id_override, &idptr);
RNA_property_pointer_set(&owner_ptr, prop, idptr, NULL);
RNA_property_update(C, &owner_ptr, prop);
if (ID_IS_OVERRIDE_LIBRARY_REAL(owner_id)) {
PointerRNA idptr;
/* `idptr` is re-assigned to owner property to ensure proper updates etc. Here we also use it
* to ensure remapping of the owner property from the linked data to the newly created
* liboverride (note that in theory this remapping has already been done by code above), but
* only in case owner ID was already an existing liboverride.
*
* Otherwise, owner ID will also have been overridden, and remapped already to use itsoverride
* of the data too. */
RNA_id_pointer_create(id_override, &idptr);
RNA_property_pointer_set(&owner_ptr, prop, idptr, NULL);
RNA_property_update(C, &owner_ptr, prop);
}
return OPERATOR_FINISHED;
}

View File

@ -796,6 +796,7 @@ 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:
@ -862,9 +863,8 @@ ID *ui_template_id_liboverride_hierarchy_create(
* 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);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
}
return id_override;
}
@ -885,8 +885,13 @@ static void template_id_liboverride_hierarchy_create(bContext *C,
/* Given `idptr` is re-assigned to owner property by caller to ensure proper updates etc. Here
* we also use it to ensure remapping of the owner property from the linked data to the newly
* created liboverride (note that in theory this remapping has already been done by code
* above). */
RNA_id_pointer_create(id_override, idptr);
* above), but only in case owner ID was already an existing liboverride.
*
* Otherwise, owner ID will also have been overridden, and remapped already to use itsoverride
* of the data too. */
if (ID_IS_OVERRIDE_LIBRARY_REAL(owner_id)) {
RNA_id_pointer_create(id_override, idptr);
}
}
else {
RNA_warning("The data-block %s could not be overridden", id->name);