-
-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Labels
Description
Description about the feature
When creating nodes, it doesn't seem possible to use the "default_value" attribute for a NodeSocket, as those are defined for subclasses of NodeSocket such as NodeSocketFloat.
For instance, this code accesses the second input of a math node:
subtract = create_node(self.node_tree.nodes, -400, 1083, ShaderNodeMath) # subtract is of type ShaderNodeMath
subtract.operation = "SUBTRACT" # this works
subtract.inputs[1].default_value = 1.0This however throws a type error as .default_value may is not defined in the NodeSocket class. It's possible to work around this by overriding the type of the input:
subtract = create_node(self.node_tree.nodes, -400, 1083, ShaderNodeMath)
subtract.operation = "SUBTRACT"
_: NodeSocketFloat = subtract.inputs[1]
_.default_value = 1.0Unfortunately, the documentation does not seem to specify the types for each input in a node socket, so I'm not sure if an implementation is possible.
Are you willing to contribute about this feature.
Yes, contributing to blender docs to specify input types.
Reactions are currently unavailable