diff options
author | Ryan Inch <mythologylover75@gmail.com> | 2019-12-18 10:35:20 +0300 |
---|---|---|
committer | Ryan Inch <mythologylover75@gmail.com> | 2019-12-18 10:35:20 +0300 |
commit | 9f12957bf2a3b9a7f5cb7d78a26d53c1d0aceb13 (patch) | |
tree | f6028ccb23ae272c2d55bd20973eabfa0680d421 | |
parent | 95e98889aba926cebcb63160a7f9f27955527140 (diff) |
Collection Manager: Fix Phantom Mode bugs. Task: T69577
Fix rto toggles not working after leaving Phantom Mode.
Fix rto history not being properly restored after leaving Phantom Mode.
-rw-r--r-- | object_collection_manager/__init__.py | 2 | ||||
-rw-r--r-- | object_collection_manager/operators.py | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py index 5f41598a..828682a5 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,1), + "version": (1,8,2), "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 43427efd..57e1c537 100644 --- a/object_collection_manager/operators.py +++ b/object_collection_manager/operators.py @@ -20,6 +20,8 @@ import bpy +from copy import deepcopy + from bpy.types import ( Operator, ) @@ -1193,7 +1195,8 @@ class CMPhantomModeOperator(Operator): # save current rto history for rto, history, in rto_history.items(): - phantom_history[rto+"_history"] = history.get(view_layer, [] if rto[-3:] == "all" else {}).copy() + if history.get(view_layer, None): + phantom_history[rto+"_history"] = deepcopy(history[view_layer]) # return to normal mode @@ -1229,7 +1232,13 @@ class CMPhantomModeOperator(Operator): # restore previous rto history for rto, history, in rto_history.items(): - history[view_layer] = phantom_history[rto+"_history"].copy() + if view_layer in history: + del history[view_layer] + + if phantom_history[rto+"_history"]: + history[view_layer] = deepcopy(phantom_history[rto+"_history"]) + + phantom_history[rto+"_history"].clear() scn.CM_Phantom_Mode = False |