From 73c35dbc22e4c7bb52f70028f5bfbec6269299f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Wed, 11 Oct 2023 15:41:41 +0200 Subject: [PATCH] Fix #113433: Avoid calling registered custom node function Follow-up fix for #113330. The `valid_socket_type` classmethod in node trees is only available on custom node trees (but documentation does not say that). It cannot be used to determine if the default float socket type is valid for built-in node tree types. We have to assume this socket type is always valid for built-in node trees, or the operator will try to call a non-existent method. Pull Request: https://projects.blender.org/blender/blender/pulls/113540 --- scripts/startup/bl_operators/node.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/startup/bl_operators/node.py b/scripts/startup/bl_operators/node.py index 542744f47bb..78d8a2e0a50 100644 --- a/scripts/startup/bl_operators/node.py +++ b/scripts/startup/bl_operators/node.py @@ -292,8 +292,10 @@ class NODE_OT_interface_item_new(NodeInterfaceOperator, Operator): @staticmethod def find_valid_socket_type(tree): socket_type = 'NodeSocketFloat' - # Try the default float socket type - if tree.valid_socket_type(socket_type): + # Socket type validation function is only available for custom + # node trees. Assume that 'NodeSocketFloat' is valid for + # built-in node tree types. + if not hasattr(tree, "valid_socket_type") or tree.valid_socket_type(socket_type): return socket_type # Custom nodes may not support float sockets, search all # registered socket subclasses.