Newer
Older
apply_to_children(view_layer.layer_collection, save_visibility_state)
# save current rto history
for rto, history, in rto_history.items():
if history.get(view_layer.name, None):
phantom_history[rto+"_history"] = deepcopy(history[view_layer.name])
else: # return to normal mode
def restore_visibility_state(layer_collection):
phantom_laycol = phantom_history["initial_state"][layer_collection.name]
layer_collection.exclude = phantom_laycol["exclude"]
layer_collection.collection.hide_select = phantom_laycol["select"]
layer_collection.hide_viewport = phantom_laycol["hide"]
layer_collection.collection.hide_viewport = phantom_laycol["disable"]
layer_collection.collection.hide_render = phantom_laycol["render"]
apply_to_children(view_layer.layer_collection, restore_visibility_state)
# restore previous rto history
for rto, history, in rto_history.items():
if view_layer.name in history:
del history[view_layer.name]
if phantom_history[rto+"_history"]:
history[view_layer.name] = deepcopy(phantom_history[rto+"_history"])
phantom_history[rto+"_history"].clear()