Collection Manager: Fix remove issue. Task: T69577

Fix error when removing a collection with a child that is already
linked to the parent collection.
This commit is contained in:
Ryan Inch 2020-07-18 00:48:13 -04:00
parent 52edc5f41f
commit 0657e99e1f
2 changed files with 3 additions and 2 deletions

View File

@ -22,7 +22,7 @@ bl_info = {
"name": "Collection Manager",
"description": "Manage collections and their objects",
"author": "Ryan Inch",
"version": (2, 9, 3),
"version": (2, 9, 4),
"blender": (2, 80, 0),
"location": "View3D - Object Mode (Shortcut - M)",
"warning": '', # used for warning icon and text in addons panel

View File

@ -897,7 +897,8 @@ class CMRemoveCollectionOperator(Operator):
# link any subcollections of the to be deleted collection to it's parent
for subcollection in collection.children:
parent_collection.children.link(subcollection)
if not subcollection.name in parent_collection.children:
parent_collection.children.link(subcollection)
# apply the stored view layer RTOs to the newly linked collections and their
# children