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
This commit is contained in:
Lukas Tönne 2023-10-11 15:41:41 +02:00
parent 40ea1cdb97
commit 73c35dbc22

@ -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.