[Bf-extensions-cvs] [583a8139] master: Collection Manager: Expander fix. Task T69577
Ryan Inch
noreply at git.blender.org
Sat Apr 18 09:05:25 CEST 2020
Commit: 583a81397e1f45542c7264eb7f29c6253912e8d7
Author: Ryan Inch
Date: Sat Apr 18 02:43:46 2020 -0400
Branches: master
https://developer.blender.org/rBA583a81397e1f45542c7264eb7f29c6253912e8d7
Collection Manager: Expander fix. Task T69577
Fix expanded and expand history not getting updated
on collection removal.
===================================================================
M object_collection_manager/__init__.py
M object_collection_manager/operators.py
M object_collection_manager/ui.py
===================================================================
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index dde8aebe..f386c36e 100644
--- a/object_collection_manager/__init__.py
+++ b/object_collection_manager/__init__.py
@@ -22,12 +22,7 @@ bl_info = {
"name": "Collection Manager",
"description": "Manage collections and their objects",
"author": "Ryan Inch",
-<<<<<<< HEAD
"version": (2,7,11),
-=======
- "version": (2,7,10),
->>>>>>> Collection Manager: Expander fixes. Task: T69577
- "blender": (2, 80, 0),
"location": "View3D - Object Mode (Shortcut - M)",
"warning": '', # used for warning icon and text in addons panel
"doc_url": "{BLENDER_MANUAL_URL}/addons/interface/collection_manager.html",
diff --git a/object_collection_manager/operators.py b/object_collection_manager/operators.py
index b1d4d4ca..c1259acd 100644
--- a/object_collection_manager/operators.py
+++ b/object_collection_manager/operators.py
@@ -851,6 +851,7 @@ class CMRemoveCollectionOperator(Operator):
def execute(self, context):
global rto_history
+ global expand_history
global qcd_slots
cm = context.scene.collection_manager
@@ -872,8 +873,16 @@ class CMRemoveCollectionOperator(Operator):
parent_collection.children.link(subcollection)
- # remove collection and update tree view
+ # remove collection, update expanded, and update tree view
bpy.data.collections.remove(collection)
+ expanded.discard(self.collection_name)
+
+ if expand_history["target"] == self.collection_name:
+ expand_history["target"] = ""
+
+ if self.collection_name in expand_history["history"]:
+ expand_history["history"].remove(self.collection_name)
+
update_property_group(context)
diff --git a/object_collection_manager/ui.py b/object_collection_manager/ui.py
index d4a4f49e..61c44a5b 100644
--- a/object_collection_manager/ui.py
+++ b/object_collection_manager/ui.py
@@ -331,7 +331,7 @@ class CollectionManager(Operator):
except KeyError: # Master Collection is special and not part of regular collections
cm.cm_list_index = -1
- # check if history/buffer state still correct
+ # check if expanded & history/buffer state still correct
if collection_state:
new_state = generate_state()
@@ -344,6 +344,16 @@ class CollectionManager(Operator):
swap_buffer["B"]["RTO"] = ""
swap_buffer["B"]["values"].clear()
+ for name in list(expanded):
+ laycol = layer_collections.get(name)
+ if not laycol or not laycol["has_children"]:
+ expanded.remove(name)
+
+ for name in list(expand_history["history"]):
+ laycol = layer_collections.get(name)
+ if not laycol or not laycol["has_children"]:
+ expand_history["history"].remove(name)
+
for rto, history in rto_history.items():
if view_layer.name in history:
del history[view_layer.name]
More information about the Bf-extensions-cvs
mailing list