refactor: only apply node when it is necessary (skip for host)
This commit is contained in:
@ -78,12 +78,13 @@ def session_callback(name):
|
|||||||
def initialize_session():
|
def initialize_session():
|
||||||
"""Session connection init hander
|
"""Session connection init hander
|
||||||
"""
|
"""
|
||||||
logging.info("Intializing the scene")
|
|
||||||
settings = utils.get_preferences()
|
settings = utils.get_preferences()
|
||||||
runtime_settings = bpy.context.window_manager.session
|
runtime_settings = bpy.context.window_manager.session
|
||||||
|
|
||||||
|
if not runtime_settings.is_host:
|
||||||
|
logging.info("Intializing the scene")
|
||||||
# Step 1: Constrect nodes
|
# Step 1: Constrect nodes
|
||||||
logging.info("Constructing nodes")
|
logging.info("Instantiating nodes")
|
||||||
for node in session.repository.list_ordered():
|
for node in session.repository.list_ordered():
|
||||||
node_ref = session.repository.get_node(node)
|
node_ref = session.repository.get_node(node)
|
||||||
if node_ref is None:
|
if node_ref is None:
|
||||||
@ -95,7 +96,7 @@ def initialize_session():
|
|||||||
node_ref.instance.uuid = node_ref.uuid
|
node_ref.instance.uuid = node_ref.uuid
|
||||||
|
|
||||||
# Step 2: Load nodes
|
# Step 2: Load nodes
|
||||||
logging.info("Loading nodes")
|
logging.info("Applying nodes")
|
||||||
for node in session.repository.list_ordered():
|
for node in session.repository.list_ordered():
|
||||||
porcelain.apply(session.repository, node)
|
porcelain.apply(session.repository, node)
|
||||||
|
|
||||||
@ -284,10 +285,6 @@ class SessionStartOperator(bpy.types.Operator):
|
|||||||
deleyables.append(session_user_sync)
|
deleyables.append(session_user_sync)
|
||||||
deleyables.append(session_listen)
|
deleyables.append(session_listen)
|
||||||
|
|
||||||
|
|
||||||
self.report(
|
|
||||||
{'INFO'},
|
|
||||||
f"connecting to tcp://{settings.ip}:{settings.port}")
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@ -326,6 +323,7 @@ class SessionInitOperator(bpy.types.Operator):
|
|||||||
porcelain.add(session.repository, scene)
|
porcelain.add(session.repository, scene)
|
||||||
|
|
||||||
session.init()
|
session.init()
|
||||||
|
context.window_manager.session.is_host = True
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user