Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2019-05-01 01:15:11 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-05-01 01:20:53 +0300
commitb7277aac728c262a570a79abbfdc1d2cba80684f (patch)
treeb0d90a5a8c379da865921d5c203436e690509285
parent910b88674763899c189b694aa306e03055fe33bf (diff)
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.
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 68688b64b3e..a620af798d7 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -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;