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 /object_collection_manager/operators.py | |
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.
Diffstat (limited to 'object_collection_manager/operators.py')
-rw-r--r-- | object_collection_manager/operators.py | 13 |
1 files changed, 11 insertions, 2 deletions
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 |