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
This commit is contained in:
parent
2bbabbc739
commit
a86f32d219
Notes:
blender-bot
2023-02-14 04:07:50 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3 Referenced by issue #102797, Regression: Unlinking an Orphan Action Crashes Blender
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue