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-02 09:45:32 +0300
committerRyan Inch <mythologylover75@gmail.com>2020-04-02 09:45:32 +0300
commit507c04aa727e8f3399a99fbf89ccd2891c016b2d (patch)
treeaa96cfb75a1d0a07633ad940e8a630d2a032071f /object_collection_manager/ui.py
parent9a32e84135f73e5cd4e6e24874420869f9b4bdc3 (diff)
Collection Manager: Prevent invalid states. Task: T69577
Fixed bug with Phantom Mode state checking. Fixed bug with copy/swap buffers getting stuck if state invalidated. Add checks on collection manager popup to verify RTO history and copy/swap buffer states.
Diffstat (limited to 'object_collection_manager/ui.py')
-rw-r--r--object_collection_manager/ui.py45
1 files changed, 44 insertions, 1 deletions
diff --git a/object_collection_manager/ui.py b/object_collection_manager/ui.py
index 7928e757..5561da26 100644
--- a/object_collection_manager/ui.py
+++ b/object_collection_manager/ui.py
@@ -28,12 +28,14 @@ from bpy.props import BoolProperty
from .internals import (
collection_tree,
+ collection_state,
expanded,
get_max_lvl,
layer_collections,
qcd_slots,
update_collection_tree,
update_property_group,
+ generate_state,
)
from .operators import (
@@ -260,14 +262,49 @@ class CollectionManager(Operator):
except KeyError: # Master Collection isn't supported
cm.cm_list_index = -1
+ # check if history/buffer state still correct
+ if collection_state:
+ new_state = generate_state()
+
+ if new_state["name"] != collection_state["name"]:
+ copy_buffer["RTO"] = ""
+ copy_buffer["values"].clear()
+
+ swap_buffer["A"]["RTO"] = ""
+ swap_buffer["A"]["values"].clear()
+ swap_buffer["B"]["RTO"] = ""
+ swap_buffer["B"]["values"].clear()
+
+ for rto, history in rto_history.items():
+ if view_layer.name in history:
+ del history[view_layer.name]
+
+
+ else:
+ for rto in ["exclude", "select", "hide", "disable", "render"]:
+ if new_state[rto] != collection_state[rto]:
+ if view_layer.name in rto_history[rto]:
+ del rto_history[rto][view_layer.name]
+
+ if view_layer.name in rto_history[rto+"_all"]:
+ del rto_history[rto+"_all"][view_layer.name]
+
# check if in phantom mode and if it's still viable
if cm.in_phantom_mode:
- if set(layer_collections.keys()) != set(phantom_history["initial_state"].keys()):
+ if layer_collections.keys() != phantom_history["initial_state"].keys():
cm.in_phantom_mode = False
if view_layer.name != phantom_history["view_layer"]:
cm.in_phantom_mode = False
+ if not cm.in_phantom_mode:
+ for key, value in phantom_history.items():
+ try:
+ value.clear()
+ except AttributeError:
+ if key == "view_layer":
+ phantom_history["view_layer"] = ""
+
# handle window sizing
max_width = 960
min_width = 456
@@ -285,6 +322,12 @@ class CollectionManager(Operator):
return wm.invoke_popup(self, width=width)
+ def __del__(self):
+ global collection_state
+
+ collection_state.clear()
+ collection_state.update(generate_state())
+
class CM_UL_items(UIList):
last_filter_value = ""