diff --git a/core/nodeslicer/nodes/system.py b/core/nodeslicer/nodes/system.py index 69c9329..97904a2 100644 --- a/core/nodeslicer/nodes/system.py +++ b/core/nodeslicer/nodes/system.py @@ -183,14 +183,9 @@ class SLICENODE_Executor(ExecSliceNode, SliceNodeJoiner): def evaluate(self, operator=None): from ....infra.blender.blender_slice_nodes_generic import ( - node_execution_feedback, - feedback_disabled, execution_cache, resolve_input ) - - # If auto_refresh is on, we don't want highlighting/redraws for upstream nodes either - maybe_disabled = feedback_disabled if self.auto_refresh else lambda: execution_cache() for i, job in enumerate(self.inputs): # Resolve the input to get the connected node(s) @@ -209,11 +204,10 @@ class SLICENODE_Executor(ExecSliceNode, SliceNodeJoiner): operator.report({'INFO'}, f"Executing: {upstream_node.bl_label}") try: - with maybe_disabled(): - with node_execution_feedback(upstream_node): - exec_res = upstream_node.evaluate(operator=operator) - if exec_res != 'ok' and exec_res is not None: - if operator: operator.report({'WARNING'}, f"Node {upstream_node.bl_label} returned {exec_res}") + with execution_cache(): + exec_res = upstream_node.evaluate(operator=operator) + if exec_res != 'ok' and exec_res is not None: + if operator: operator.report({'WARNING'}, f"Node {upstream_node.bl_label} returned {exec_res}") except Exception as e: if operator: operator.report({'ERROR'}, f"Failed executing {upstream_node.bl_label}: {str(e)}") return 'error' diff --git a/core/nodeslicer/tree.py b/core/nodeslicer/tree.py index 887fd07..66a0c0d 100644 --- a/core/nodeslicer/tree.py +++ b/core/nodeslicer/tree.py @@ -3,7 +3,7 @@ import bpy from bpy.types import NodeTree, Operator, Menu from bpy.app.handlers import persistent -from ...infra.blender.blender_slice_nodes_generic import node_execution_feedback, resolve_input +from ...infra.blender.blender_slice_nodes_generic import execution_cache, resolve_input from ...registry import register_class if TYPE_CHECKING: @@ -102,10 +102,8 @@ def tree_update_handler(scene, depsgraph): if should_refresh: _is_updating = True try: - from ...infra.blender.blender_slice_nodes_generic import feedback_disabled - with feedback_disabled(): - with node_execution_feedback(node): - node.evaluate() + with execution_cache(): + node.evaluate() except Exception as e: print(f"Auto-refresh failed: {e}") import traceback @@ -454,7 +452,7 @@ class SLICENODE_OT_Execute(Operator): node = node_tree.nodes[self.node_name] try: - with node_execution_feedback(node): + with execution_cache(): res = node.evaluate(operator=self) if res == 'ok': self.report({"INFO"}, f"Execution Successful") diff --git a/infra/blender/blender_slice_nodes_generic.py b/infra/blender/blender_slice_nodes_generic.py index 24de382..7819824 100644 --- a/infra/blender/blender_slice_nodes_generic.py +++ b/infra/blender/blender_slice_nodes_generic.py @@ -225,7 +225,6 @@ class SliceNode(Node, AutoBlIdName): ## Evaluation helpers _current_execution_cache: _EvalCache | None = None -_feedback_enabled: bool = True @contextmanager def execution_cache(): @@ -240,50 +239,6 @@ def execution_cache(): finally: _current_execution_cache = None -@contextmanager -def feedback_disabled(): - global _feedback_enabled - old = _feedback_enabled - _feedback_enabled = False - try: - yield - finally: - _feedback_enabled = old - -@contextmanager -def node_execution_feedback(node: bpy.types.Node): - if not _feedback_enabled: - with execution_cache(): - yield - return - - # Save original color - old_use_color = getattr(node, "use_custom_color", False) - old_color = getattr(node, "color", (0.0, 0.0, 0.0))[:] if hasattr(node, "color") else None - - if hasattr(node, "use_custom_color"): - node.use_custom_color = True - if hasattr(node, "color"): - node.color = (75/255, 73/255, 19/255) # Green - - # Refresh UI - try: - bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) - except Exception: - pass - try: - with execution_cache(): - yield - finally: - if hasattr(node, "use_custom_color"): - node.use_custom_color = old_use_color - if hasattr(node, "color") and old_color is not None: - node.color = old_color - try: - bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) - except Exception: - pass - @contextmanager def _group_context(node: bpy.types.Node, cache: _EvalCache | None = None): stack = _get_group_stack(cache) @@ -543,7 +498,7 @@ def _resolve_output( visited.add(node_key) try: - with node_execution_feedback(socket.node): + with execution_cache(): if not isinstance(socket.node, SliceNode): is_group = isinstance(socket.node, SLICENODE_Group) or ( isinstance(getattr(bpy.types, "NodeGroup", None), type) and isinstance(socket.node, bpy.types.NodeGroup)