feat: explicit state loading error

This commit is contained in:
Swann 2021-02-09 14:20:08 +01:00
parent 1f0f44fdbf
commit c00b2a2d7d
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
2 changed files with 13 additions and 5 deletions

View File

@ -135,6 +135,10 @@ class BlObject(BlDatablock):
data_uuid,
find_data_from_name(data_id),
ignore=['images']) # TODO: use resolve_from_id
if object_data is None and data_uuid:
raise Exception(f"Fail to load object {data['name']}({self.uuid})")
instance = bpy.data.objects.new(object_name, object_data)
instance.uuid = self.uuid

View File

@ -78,19 +78,23 @@ def initialize_session():
settings = utils.get_preferences()
runtime_settings = bpy.context.window_manager.session
logging.info("Constructing nodes")
# Step 1: Constrect nodes
logging.info("Constructing nodes")
for node in session._graph.list_ordered():
node_ref = session.get(uuid=node)
if node_ref.state == FETCHED:
if node_ref and node_ref.state == FETCHED:
node_ref.resolve()
logging.info("Loading nodes")
else:
logging.error(f"Can't construct node {node}")
# Step 2: Load nodes
logging.info("Loading nodes")
for node in session._graph.list_ordered():
node_ref = session.get(uuid=node)
if node_ref.state == FETCHED:
if node_ref and node_ref.state == FETCHED:
node_ref.apply()
else:
logging.error(f"Can't load node {node}")
logging.info("Registering timers")
# Step 4: Register blender timers