Nodes: Add dropdown to select group socket subtype
Previously the only way to control the subtype was to remove the group input or output and create it again. This commit adds a dropdown to change an existing socket, for supported socket types. Based on a patch by Angus Stanton: https://developer.blender.org/D15715 It was necessary to fix the UI code slightly; the layout's context wasn't being used in calls to an operator's enum items callback. Pull Request: https://projects.blender.org/blender/blender/pulls/105614
This commit is contained in:
@@ -889,6 +889,23 @@ class NodeTreeInterfacePanel(Panel):
|
||||
)
|
||||
props.in_out = in_out
|
||||
|
||||
with context.temp_override(interface_socket=active_socket):
|
||||
if bpy.ops.node.tree_socket_change_subtype.poll():
|
||||
layout_row = layout.row(align=True)
|
||||
layout_split = layout_row.split(factor=0.4, align=True)
|
||||
|
||||
label_column = layout_split.column(align=True)
|
||||
label_column.alignment = 'RIGHT'
|
||||
label_column.label(text="Subtype")
|
||||
property_row = layout_split.row(align=True)
|
||||
|
||||
property_row.context_pointer_set("interface_socket", active_socket)
|
||||
props = property_row.operator_menu_enum(
|
||||
"node.tree_socket_change_subtype",
|
||||
"socket_subtype",
|
||||
text=active_socket.bl_subtype_label if active_socket.bl_subtype_label else active_socket.bl_idname
|
||||
)
|
||||
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user