Revert "feat: node sanitize on collection and scene update"

This reverts commit fb1c985f31.
This commit is contained in:
Swann
2021-05-18 11:00:05 +02:00
parent 4eeb80350e
commit cfb1afdd72
3 changed files with 20 additions and 18 deletions

View File

@ -133,16 +133,20 @@ class BlDatablock(ReplicatedDatablock):
if not datablock_ref: if not datablock_ref:
try: try:
datablock_ref = datablock_root[self.data['name']] datablock_ref = datablock_root[self.data['name']]
except KeyError as e: except Exception:
if construct: pass
name = self.data.get('name')
logging.debug(f"Constructing {name}") if construct and not datablock_ref:
datablock_ref = self._construct(data=self.data) name = self.data.get('name')
setattr(datablock_ref, 'uuid', self.uuid) logging.debug(f"Constructing {name}")
else: datablock_ref = self._construct(data=self.data)
return False
self.instance = datablock_ref if datablock_ref is not None:
return True setattr(datablock_ref, 'uuid', self.uuid)
self.instance = datablock_ref
return True
else:
return False
def remove_instance(self): def remove_instance(self):

View File

@ -946,8 +946,7 @@ def sanitize_deps_graph(remove_nodes: bool = False):
rm_cpt += 1 rm_cpt += 1
except NonAuthorizedOperationError: except NonAuthorizedOperationError:
continue continue
if rm_cpt: logging.info(f"Sanitize took { utils.current_milli_time()-start} ms, removed {rm_cpt} nodes")
logging.info(f"Sanitize took { utils.current_milli_time()-start} ms, removed {rm_cpt} nodes")
@persistent @persistent
@ -1014,15 +1013,14 @@ def depsgraph_evaluation(scene):
# A new scene is created # A new scene is created
elif isinstance(update.id, bpy.types.Scene): elif isinstance(update.id, bpy.types.Scene):
ref = session.repository.get_node_by_datablock(update.id) ref = session.repository.get_node_by_datablock(update.id)
if ref and ref.resolve(construct=False): if ref:
sanitize_deps_graph(remove_nodes=True) ref.resolve()
else: else:
scn_uuid = porcelain.add(session.repository, update.id) scn_uuid = porcelain.add(session.repository, update.id)
porcelain.commit(session.node_id, scn_uuid) porcelain.commit(session.node_id, scn_uuid)
session.push(scn_uuid, check_data=False) session.push(scn_uuid, check_data=False)
if isinstance(update.id, bpy.types.Collection): elif isinstance(update.id, bpy.types.Collection):
sanitize_deps_graph(remove_nodes=True) sanitize_deps_graph()
def register(): def register():
from bpy.utils import register_class from bpy.utils import register_class

View File

@ -248,7 +248,7 @@ class DynamicRightSelectTimer(Timer):
key, key,
RP_COMMON, RP_COMMON,
ignore_warnings=True, ignore_warnings=True,
affect_dependencies=True) affect_dependencies=recursive)
except NonAuthorizedOperationError: except NonAuthorizedOperationError:
logging.warning( logging.warning(
f"Not authorized to change {key} owner") f"Not authorized to change {key} owner")