[Bf-extensions-cvs] [88c3fc87] master: Collection Manager: Fix bug in name update. Task: T69577

Ryan Inch noreply at git.blender.org
Wed Apr 15 07:11:20 CEST 2020


Commit: 88c3fc87b2bb1b6bac51672ef16840478e273e5d
Author: Ryan Inch
Date:   Wed Apr 15 01:03:40 2020 -0400
Branches: master
https://developer.blender.org/rBA88c3fc87b2bb1b6bac51672ef16840478e273e5d

Collection Manager: Fix bug in name update. Task: T69577

Fix rto_history not getting updated on collection name change.

===================================================================

M	object_collection_manager/__init__.py
M	object_collection_manager/internals.py

===================================================================

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)



More information about the Bf-extensions-cvs mailing list