Merge branch '163-support-adding-scene-during-the-session' into '132-fix-undo-edit-last-operation-redo-handling-2'
Resolve "Support adding scene during the session" See merge request slumber/multi-user!95
This commit is contained in:
@ -281,13 +281,9 @@ class BlScene(BlDatablock):
|
|||||||
bl_icon = 'SCENE_DATA'
|
bl_icon = 'SCENE_DATA'
|
||||||
bl_reload_parent = False
|
bl_reload_parent = False
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super().__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
self.diff_method = DIFF_JSON
|
|
||||||
|
|
||||||
def _construct(self, data):
|
def _construct(self, data):
|
||||||
instance = bpy.data.scenes.new(data["name"])
|
instance = bpy.data.scenes.new(data["name"])
|
||||||
|
instance.uuid = self.uuid
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
def _load_implementation(self, data, target):
|
def _load_implementation(self, data, target):
|
||||||
|
@ -960,16 +960,13 @@ def sanitize_deps_graph(dummy):
|
|||||||
rm_cpt = 0
|
rm_cpt = 0
|
||||||
for node_key in session.list():
|
for node_key in session.list():
|
||||||
node = session.get(node_key)
|
node = session.get(node_key)
|
||||||
if not node.resolve(construct=False):
|
if node is None or not node.resolve(construct=False):
|
||||||
try:
|
try:
|
||||||
session.remove(node.uuid)
|
session.remove(node.uuid)
|
||||||
rm_cpt+=1
|
rm_cpt+=1
|
||||||
except NonAuthorizedOperationError:
|
except NonAuthorizedOperationError:
|
||||||
continue
|
continue
|
||||||
|
logging.debug(f"Sanitize took { utils.current_milli_time()-start}ms, Removed {rm_cpt} nodes")
|
||||||
logging.debug(f"Sanitize took { utils.current_milli_time()-start}ms")
|
|
||||||
logging.info(f"Removed {rm_cpt} nodes")
|
|
||||||
|
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
def load_pre_handler(dummy):
|
def load_pre_handler(dummy):
|
||||||
@ -1025,8 +1022,15 @@ def depsgraph_evaluation(scene):
|
|||||||
logging.error(e)
|
logging.error(e)
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
# A new scene is created
|
||||||
|
elif isinstance(update.id, bpy.types.Scene):
|
||||||
|
ref = session.get(reference=update.id)
|
||||||
|
if ref:
|
||||||
|
ref.resolve()
|
||||||
|
else:
|
||||||
|
scn_uuid = session.add(update.id)
|
||||||
|
session.commit(scn_uuid)
|
||||||
|
session.push(scn_uuid, check_data=False)
|
||||||
def register():
|
def register():
|
||||||
from bpy.utils import register_class
|
from bpy.utils import register_class
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user