update node on updating sockets
This commit is contained in:
parent
3465c89fb8
commit
f2b2c28e9b
2 changed files with 14 additions and 0 deletions
|
|
@ -89,6 +89,7 @@ class SLICESOCK_VectorRotation_Common(InputNodeSocket):
|
||||||
|
|
||||||
value: bpy.props.FloatVectorProperty(name="Vector", size=3, default=(0.0, 0.0, 0.0), subtype='EULER', update=notify_tree_changed) # pyright: ignore[reportInvalidTypeForm]
|
value: bpy.props.FloatVectorProperty(name="Vector", size=3, default=(0.0, 0.0, 0.0), subtype='EULER', update=notify_tree_changed) # pyright: ignore[reportInvalidTypeForm]
|
||||||
bl_color = (0.39, 0.39, 0.78, 1.0)
|
bl_color = (0.39, 0.39, 0.78, 1.0)
|
||||||
|
|
||||||
@register_class
|
@register_class
|
||||||
class SLICESOCK_VectorRotation(SLICESOCK_VectorRotation_Common): ...
|
class SLICESOCK_VectorRotation(SLICESOCK_VectorRotation_Common): ...
|
||||||
@register_class
|
@register_class
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,19 @@ def notify_tree_changed(self, context):
|
||||||
global _tree_changed
|
global _tree_changed
|
||||||
_tree_changed = True
|
_tree_changed = True
|
||||||
|
|
||||||
|
# Trigger node update if it exists
|
||||||
|
node = None
|
||||||
|
if isinstance(self, bpy.types.Node):
|
||||||
|
node = self
|
||||||
|
elif isinstance(self, bpy.types.NodeSocket):
|
||||||
|
node = self.node
|
||||||
|
|
||||||
|
if node and hasattr(node, "update"):
|
||||||
|
try:
|
||||||
|
node.update()
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error updating node {node.name}: {e}")
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
def depsgraph_update_handler(scene, depsgraph):
|
def depsgraph_update_handler(scene, depsgraph):
|
||||||
global _is_updating, _tree_changed
|
global _is_updating, _tree_changed
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue