[Bf-extensions-cvs] [0ef0b203] blender-v2.82-release: Collection Manager: Fix isolation when history has only one. Task: T69577

Ryan Inch noreply at git.blender.org
Fri Jan 24 08:11:37 CET 2020


Commit: 0ef0b20339cf95d4872e1cdcee36532f49c97dfb
Author: Ryan Inch
Date:   Fri Jan 24 02:09:21 2020 -0500
Branches: blender-v2.82-release
https://developer.blender.org/rBA0ef0b20339cf95d4872e1cdcee36532f49c97dfb

Collection Manager: Fix isolation when history has only one. Task: T69577

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

M	object_collection_manager/__init__.py
M	object_collection_manager/operators.py

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

diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index 16917fff..15a488cf 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": (1,8,8),
+    "version": (1,8,9),
     "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/operators.py b/object_collection_manager/operators.py
index ae1d7295..f69b4bf2 100644
--- a/object_collection_manager/operators.py
+++ b/object_collection_manager/operators.py
@@ -192,7 +192,7 @@ class CMExcludeOperator(Operator):
 
             # check if collection isolated
             if len(active_layer_collections) == 1 and active_layer_collections[0]["name"] == self.name:
-                if len(exclude_history) > 1:
+                if len(exclude_history) > 0:
                     # restore previous state
                     for x, item in enumerate(layer_collections.values()):
                         item["ptr"].exclude = exclude_history[x]
@@ -212,17 +212,9 @@ class CMExcludeOperator(Operator):
                 exclude_history.clear()
 
                 # save state
-                keep_history = -1
                 for item in layer_collections.values():
                     exclude_history.append(item["ptr"].exclude)
 
-                    if item["ptr"].exclude == False:
-                        keep_history += 1
-
-                if not keep_history:
-                    del rto_history["exclude"][view_layer]
-
-
                 # isolate collection
                 for item in layer_collections.values():
                     if item["name"] != laycol_ptr.name:
@@ -378,7 +370,7 @@ class CMRestrictSelectOperator(Operator):
 
             # check if reversed layerchain matches active collections
             if layerchain[::-1] == active_layer_collections:
-                if len(select_history) > 1:
+                if len(select_history) > 0:
                     # restore previous state
                     for x, item in enumerate(layer_collections.values()):
                         item["ptr"].collection.hide_select = select_history[x]
@@ -396,16 +388,9 @@ class CMRestrictSelectOperator(Operator):
                 select_history.clear()
 
                 # save state
-                keep_history = -1
                 for item in layer_collections.values():
                     select_history.append(item["ptr"].collection.hide_select)
 
-                    if item["ptr"].collection.hide_select == False:
-                        keep_history += 1
-
-                if not keep_history:
-                    del rto_history["select"][view_layer]
-
                 # make all collections unselectable
                 for item in layer_collections.values():
                     item["ptr"].collection.hide_select = True
@@ -538,7 +523,7 @@ class CMHideOperator(Operator):
 
             # check if reversed layerchain matches active collections
             if layerchain[::-1] == active_layer_collections:
-                if len(hide_history) > 1:
+                if len(hide_history) > 0:
                     # restore previous state
                     for x, item in enumerate(layer_collections.values()):
                         item["ptr"].hide_viewport = hide_history[x]
@@ -556,16 +541,9 @@ class CMHideOperator(Operator):
                 hide_history.clear()
 
                 # save state
-                keep_history = -1
                 for item in layer_collections.values():
                     hide_history.append(item["ptr"].hide_viewport)
 
-                    if item["ptr"].hide_viewport == False:
-                        keep_history += 1
-
-                if not keep_history:
-                    del rto_history["hide"][view_layer]
-
                 # hide all collections
                 for laycol in layer_collections.values():
                     laycol["ptr"].hide_viewport = True
@@ -697,7 +675,7 @@ class CMDisableViewportOperator(Operator):
 
             # check if reversed layerchain matches active collections
             if layerchain[::-1] == active_layer_collections:
-                if len(disable_history) > 1:
+                if len(disable_history) > 0:
                     # restore previous state
                     for x, item in enumerate(layer_collections.values()):
                         item["ptr"].collection.hide_viewport = disable_history[x]
@@ -715,16 +693,9 @@ class CMDisableViewportOperator(Operator):
                 disable_history.clear()
 
                 # save state
-                keep_history = -1
                 for item in layer_collections.values():
                     disable_history.append(item["ptr"].collection.hide_viewport)
 
-                    if item["ptr"].collection.hide_viewport == False:
-                        keep_history += 1
-
-                if not keep_history:
-                    del rto_history["disable"][view_layer]
-
                 # disable all collections in viewport
                 for laycol in layer_collections.values():
                     laycol["ptr"].collection.hide_viewport = True
@@ -857,7 +828,7 @@ class CMDisableRenderOperator(Operator):
 
             # check if reversed layerchain matches active collections
             if layerchain[::-1] == active_layer_collections:
-                if len(render_history) > 1:
+                if len(render_history) > 0:
                     # restore previous state
                     for x, item in enumerate(layer_collections.values()):
                         item["ptr"].collection.hide_render = render_history[x]
@@ -875,16 +846,9 @@ class CMDisableRenderOperator(Operator):
                 render_history.clear()
 
                 # save state
-                keep_history = -1
                 for item in layer_collections.values():
                     render_history.append(item["ptr"].collection.hide_render)
 
-                    if item["ptr"].collection.hide_render == False:
-                        keep_history += 1
-
-                if not keep_history:
-                    del rto_history["render"][view_layer]
-
                 # disallow render of all collections
                 for laycol in layer_collections.values():
                     laycol["ptr"].collection.hide_render = True



More information about the Bf-extensions-cvs mailing list