fix: ReferenceError in update_external dependency by removing orphan nodes.

This commit is contained in:
Swann 2021-07-23 19:35:56 +02:00
parent a4f9f6e051
commit 4bc0feb3a5
3 changed files with 6 additions and 4 deletions

View File

@ -79,8 +79,6 @@ def on_scene_update(scene):
logging.debug(f"Ignoring distant update of {dependency_updates[0].id.name}") logging.debug(f"Ignoring distant update of {dependency_updates[0].id.name}")
return return
update_external_dependencies()
# NOTE: maybe we don't need to check each update but only the first # NOTE: maybe we don't need to check each update but only the first
for update in reversed(dependency_updates): for update in reversed(dependency_updates):
update_uuid = getattr(update.id, 'uuid', None) update_uuid = getattr(update.id, 'uuid', None)
@ -109,6 +107,11 @@ def on_scene_update(scene):
porcelain.commit(session.repository, scn_uuid) porcelain.commit(session.repository, scn_uuid)
porcelain.push(session.repository, 'origin', scn_uuid) porcelain.push(session.repository, 'origin', scn_uuid)
scene_graph_changed = [u for u in reversed(dependency_updates) if getattr(u.id, 'uuid', None) and isinstance(u.id,(bpy.types.Scene,bpy.types.Collection))]
if scene_graph_changed:
porcelain.purge_orphan_nodes(session.repository)
update_external_dependencies()
@persistent @persistent
def resolve_deps_graph(dummy): def resolve_deps_graph(dummy):

@ -1 +1 @@
Subproject commit a44313e6473bfb514bb2fb79fce5e1abf172dc87 Subproject commit 15dc5c62c07a3e0025a82d87022f5073c019e7e9

View File

@ -689,7 +689,6 @@ class SessionPurgeOperator(bpy.types.Operator):
def execute(self, context): def execute(self, context):
try: try:
sanitize_deps_graph(remove_nodes=True)
porcelain.purge_orphan_nodes(session.repository) porcelain.purge_orphan_nodes(session.repository)
except Exception as e: except Exception as e:
self.report({'ERROR'}, repr(e)) self.report({'ERROR'}, repr(e))