From a67204338504cb7113e455fea36eb7975726eacc Mon Sep 17 00:00:00 2001 From: Nicolas Predella Date: Sat, 16 May 2026 19:18:03 +0300 Subject: [PATCH] fix recursion error --- core/nodeslicer/bpy_ns_types.py | 2 ++ core/nodeslicer/tree.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/nodeslicer/bpy_ns_types.py b/core/nodeslicer/bpy_ns_types.py index 3c60785..2d71c9e 100644 --- a/core/nodeslicer/bpy_ns_types.py +++ b/core/nodeslicer/bpy_ns_types.py @@ -5,6 +5,8 @@ from . import tree def notify_tree_changed(self, context): from . import tree + if tree._is_updating: + return tree._tree_changed = True node = None diff --git a/core/nodeslicer/tree.py b/core/nodeslicer/tree.py index 7fe42ef..b0ed536 100644 --- a/core/nodeslicer/tree.py +++ b/core/nodeslicer/tree.py @@ -12,9 +12,11 @@ if TYPE_CHECKING: def get_referenced_objects(node, visited=None): if visited is None: visited = set() - if node in visited: + + ptr = node.as_pointer() + if ptr in visited: return set() - visited.add(node) + visited.add(ptr) objs = set() # Check all input sockets for objects @@ -42,7 +44,7 @@ _is_updating = False _tree_changed = False def tree_update_handler(scene, depsgraph): - global _tree_changed + global _tree_changed, _is_updating # Names of objects that have changed updated_object_names = {update.id.name for update in depsgraph.updates if isinstance(update.id, bpy.types.Object)} @@ -51,7 +53,7 @@ def tree_update_handler(scene, depsgraph): updated_meshes = {update.id.name for update in depsgraph.updates if isinstance(update.id, bpy.types.Mesh)} if updated_meshes: for obj in bpy.data.objects: - if obj.type == 'MESH' and obj.data in updated_meshes: + if obj.type == 'MESH' and obj.data.name in updated_meshes: updated_object_names.add(obj.name) # Note: custom NodeTree updates often don't appear in depsgraph.updates