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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Inch <mythologylover75@gmail.com>2020-04-15 08:03:40 +0300
committerRyan Inch <mythologylover75@gmail.com>2020-04-15 08:03:40 +0300
commit88c3fc87b2bb1b6bac51672ef16840478e273e5d (patch)
tree8441d051f8865acfe19c7f8218c80d8fefdd71c0 /object_collection_manager
parent3c181d7e5c0dc4058fe971848407227b4fcf582e (diff)
Collection Manager: Fix bug in name update. Task: T69577
Fix rto_history not getting updated on collection name change.
Diffstat (limited to 'object_collection_manager')
-rw-r--r--object_collection_manager/__init__.py2
-rw-r--r--object_collection_manager/internals.py36
2 files changed, 34 insertions, 4 deletions
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index ac818811..47dc183e 100644
--- a/object_collection_manager/__init__.py
+++ b/object_collection_manager/__init__.py
@@ -22,7 +22,7 @@ bl_info = {
"name": "Collection Manager",
"description": "Manage collections and their objects",
"author": "Ryan Inch",
- "version": (2,7,3),
+ "version": (2,7,4),
"blender": (2, 80, 0),
"location": "View3D - Object Mode (Shortcut - M)",
"warning": '', # used for warning icon and text in addons panel
diff --git a/object_collection_manager/internals.py b/object_collection_manager/internals.py
index 05432ab6..0b5b4333 100644
--- a/object_collection_manager/internals.py
+++ b/object_collection_manager/internals.py
@@ -227,6 +227,7 @@ qcd_slots = QCDSlots()
def update_col_name(self, context):
global layer_collections
global qcd_slots
+ global rto_history
if self.name != self.last_name:
if self.name == '':
@@ -235,6 +236,8 @@ def update_col_name(self, context):
# if statement prevents update on list creation
if self.last_name != '':
+ view_layer_name = context.view_layer.name
+
# update collection name
layer_collections[self.last_name]["ptr"].collection.name = self.name
@@ -253,10 +256,30 @@ def update_col_name(self, context):
qcd_slots.overrides.remove(self.last_name)
qcd_slots.overrides.add(self.name)
+ # update history
+ rtos = [
+ "exclude",
+ "select",
+ "hide",
+ "disable",
+ "render"
+ ]
+
+ orig_targets = {
+ rto: rto_history[rto][view_layer_name]["target"]
+ for rto in rtos
+ if rto_history[rto].get(view_layer_name)
+ }
+
+ for rto in rtos:
+ history = rto_history[rto].get(view_layer_name)
+
+ if history and orig_targets[rto] == self.last_name:
+ history["target"] = self.name
+
+ # update names in expanded, qcd slots, and rto_history for any other
+ # collection names that changed as a result of this name change
cm_list_collection = context.scene.collection_manager.cm_list_collection
-
- # update names in expanded and qcd slots for any other collection names
- # that changed as a result of this name change
count = 0
laycol_iter_list = list(context.view_layer.layer_collection.children)
@@ -284,6 +307,13 @@ def update_col_name(self, context):
qcd_slots.overrides.add(layer_collection.name)
+ # update history
+ for rto in rtos:
+ history = rto_history[rto].get(view_layer_name)
+
+ if history and orig_targets[rto] == cm_list_item.last_name:
+ history["target"] = layer_collection.name
+
if layer_collection.children:
laycol_iter_list[0:0] = list(layer_collection.children)