[Bf-blender-cvs] [a86f32d219a] blender-v3.3-release: Fix T102797: Unlinking an Orphan Action crashes
Philipp Oeser
noreply at git.blender.org
Thu Jan 12 15:31:55 CET 2023
Commit: a86f32d219a5ba0745307d0a4a009b854dcdba99
Author: Philipp Oeser
Date: Mon Nov 28 10:44:19 2022 +0100
Branches: blender-v3.3-release
https://developer.blender.org/rBa86f32d219a5ba0745307d0a4a009b854dcdba99
Fix T102797: Unlinking an Orphan Action crashes
In `Orphan Data` (or `Blender File`) view, the ID pointer of the
actions's parent tree-element wasn't actually pointing to an ID, but to
the list-base containing the IDs.
Early out (with a warning) if the object or object-data to unlink the
action from is not clear.
Caused by rBb4a2096415d9.
Similar to rBe772087ed664.
Maniphest Tasks: T102797
Differential Revision: https://developer.blender.org/D16635
===================================================================
M source/blender/editors/space_outliner/outliner_tools.cc
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc
index f79866c97bd..e5184fe9466 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -214,13 +214,25 @@ static bool outliner_operation_tree_element_poll(bContext *C)
}
static void unlink_action_fn(bContext *C,
- ReportList *UNUSED(reports),
+ ReportList *reports,
Scene *UNUSED(scene),
TreeElement *UNUSED(te),
TreeStoreElem *tsep,
- TreeStoreElem *UNUSED(tselem),
+ TreeStoreElem *tselem,
void *UNUSED(user_data))
{
+ if (!tsep || !TSE_IS_REAL_ID(tsep)) {
+ /* Valid case, no parent element of the action or it is not an ID (could be a #TSE_ID_BASE
+ * for example) so there's no data to unlink from. */
+ BKE_reportf(reports,
+ RPT_WARNING,
+ "Cannot unlink action '%s'. It's not clear which object or object-data it "
+ "should be unlinked from, there's no object or object-data as parent in the "
+ "Outliner tree",
+ tselem->id->name + 2);
+ return;
+ }
+
/* just set action to nullptr */
BKE_animdata_set_action(CTX_wm_reports(C), tsep->id, nullptr);
DEG_id_tag_update(tsep->id, ID_RECALC_ANIMATION);
More information about the Bf-blender-cvs
mailing list