Outliner: Fix "Unlink" not working for parented objects
How to reproduce it: * Parent an object to another in the same collection. * RMB the child object and try to "unlink" it.
This commit is contained in:
parent
910b886747
commit
b7277aac72
|
@ -283,7 +283,7 @@ static void unlink_collection_cb(bContext *C,
|
|||
static void unlink_object_cb(bContext *C,
|
||||
ReportList *UNUSED(reports),
|
||||
Scene *UNUSED(scene),
|
||||
TreeElement *UNUSED(te),
|
||||
TreeElement *te,
|
||||
TreeStoreElem *tsep,
|
||||
TreeStoreElem *tselem,
|
||||
void *UNUSED(user_data))
|
||||
|
@ -291,6 +291,15 @@ static void unlink_object_cb(bContext *C,
|
|||
Main *bmain = CTX_data_main(C);
|
||||
Object *ob = (Object *)tselem->id;
|
||||
|
||||
if (GS(tsep->id->name) == ID_OB) {
|
||||
/* Parented objects need to find which collection to unlink from. */
|
||||
TreeElement *te_parent = te->parent;
|
||||
while (tsep && GS(tsep->id->name) == ID_OB) {
|
||||
te_parent = te_parent->parent;
|
||||
tsep = te_parent ? TREESTORE(te_parent) : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (tsep) {
|
||||
if (GS(tsep->id->name) == ID_GR) {
|
||||
Collection *parent = (Collection *)tsep->id;
|
||||
|
|
Loading…
Reference in New Issue