Blender Git Commit Log

Git Commits -> Revision 586cf8b

Revision 586cf8b by Lukas Toenne (master)
July 6, 2021, 17:36 (GMT)
Nodes: Adds button to groups to change type of sockets.

The menu lists all socket types that are valid for the node tree.
Changing a socket type updates all instances of the group and keeps
existing links to the socket.
If changing the socket type leads to incorrect node connections the
links are flagged as invalid (red) and ignored but not removed. This is
so users don't lose information and can then fix resulting issues.
For example: Changing a Color socket to a Shader socket can cause an
invalid Shader-to-Color connection.

Implementation details:
The new `NODE_OT_tree_socket_change_type` operator uses the generic
`rna_node_socket_type_itemf` function to list all eligible socket types.
It uses the tree type's `valid_socket_type` callback to test for valid
types. In addition it also checks the subtype, because multiple RNA
types are registered for the same base type. The `valid_socket_type`
callback has been modified slightly to accept full socket types instead
of just the base type enum, so that custom (python) socket types can be
used by this operator.

The `nodeModifySocketType` function is now called when group nodes
encounter a socket type mismatch, instead of replacing the socket
entirely. This ensures that links are kept to/from group nodes as well
as group input/output nodes. The `nodeModifySocketType` function now
also takes a full `bNodeSocketType` instead of just the base and subtype
enum (a shortcut `nodeModifySocketTypeStatic` exists for when only
static types are used).

Differential Revision: https://developer.blender.org/D10912

Commit Details:

Full Hash: 586cf8b1905257bf0f7d9c20b5333271f9cab3e9
Parent Commit: 933eddc
Lines Changed: +273, -45

14 Modified Paths:

/source/blender/blenkernel/BKE_node.h (+14, -3) (Diff)
/source/blender/blenkernel/intern/node.cc (+69, -7) (Diff)
/source/blender/editors/space_node/node_buttons.c (+29, -2) (Diff)
/source/blender/editors/space_node/node_edit.cc (+103, -0) (Diff)
/source/blender/editors/space_node/node_intern.h (+1, -0) (Diff)
/source/blender/editors/space_node/node_ops.c (+1, -0) (Diff)
/source/blender/makesrna/intern/rna_nodetree.c (+18, -8) (Diff)
/source/blender/makesrna/RNA_access.h (+1, -0) (Diff)
/source/blender/nodes/composite/node_composite_tree.c (+4, -3) (Diff)
/source/blender/nodes/geometry/node_geometry_tree.cc (+14, -14) (Diff)
/source/blender/nodes/intern/node_common.c (+8, -1) (Diff)
/source/blender/nodes/intern/node_socket.cc (+3, -1) (Diff)
/source/blender/nodes/shader/node_shader_tree.c (+4, -3) (Diff)
/source/blender/nodes/texture/node_texture_tree.c (+4, -3) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021