Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/startup/bl_ui/space_node.py')
-rw-r--r--release/scripts/startup/bl_ui/space_node.py93
1 files changed, 93 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index 1208ca0a64a..fba86676ad4 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -694,6 +694,97 @@ class NODE_UL_interface_sockets(bpy.types.UIList):
layout.template_node_socket(color=color)
+class NodeTreeInterfacePanel:
+ def draw_socket_list(self, context, in_out, sockets_propname, active_socket_propname):
+ layout = self.layout
+
+ snode = context.space_data
+ tree = snode.edit_tree
+ sockets = getattr(tree, sockets_propname)
+ active_socket_index = getattr(tree, active_socket_propname)
+ active_socket = sockets[active_socket_index] if active_socket_index >= 0 else None
+
+ split = layout.row()
+
+ split.template_list("NODE_UL_interface_sockets", in_out, tree, sockets_propname, tree, active_socket_propname)
+
+ ops_col = split.column()
+
+ add_remove_col = ops_col.column(align=True)
+ props = add_remove_col.operator("node.tree_socket_add", icon='ADD', text="")
+ props.in_out = in_out
+ props = add_remove_col.operator("node.tree_socket_remove", icon='REMOVE', text="")
+ props.in_out = in_out
+
+ ops_col.separator()
+
+ up_down_col = ops_col.column(align=True)
+ props = up_down_col.operator("node.tree_socket_move", icon='TRIA_UP', text="")
+ props.in_out = in_out
+ props.direction = 'UP'
+ props = up_down_col.operator("node.tree_socket_move", icon='TRIA_DOWN', text="")
+ props.in_out = in_out
+ props.direction = 'DOWN'
+
+ if active_socket is not None:
+ # Mimicking property split.
+ layout.use_property_split = False
+ layout.use_property_decorate = False
+ 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'
+ # Menu to change the socket type.
+ label_column.label(text="Type")
+
+ property_row = layout_split.row(align=True)
+ props = property_row.operator_menu_enum(
+ "node.tree_socket_change_type",
+ "socket_type",
+ text=active_socket.bl_label if active_socket.bl_label else active_socket.bl_idname
+ )
+ props.in_out = in_out
+
+ layout.use_property_split = True
+ layout.use_property_decorate = False
+
+ layout.prop(active_socket, "name")
+ # Display descriptions only for Geometry Nodes, since it's only used in the modifier panel.
+ if tree.type == 'GEOMETRY':
+ layout.prop(active_socket, "description")
+ active_socket.draw(context, layout)
+
+
+class NODE_PT_node_tree_interface_inputs(NodeTreeInterfacePanel, Panel):
+ bl_space_type = 'NODE_EDITOR'
+ bl_region_type = 'UI'
+ bl_category = "Group"
+ bl_label = "Inputs"
+
+ @classmethod
+ def poll(cls, context):
+ snode = context.space_data
+ return snode.edit_tree is not None
+
+ def draw(self, context):
+ self.draw_socket_list(context, "IN", "inputs", "active_input")
+
+class NODE_PT_node_tree_interface_outputs(NodeTreeInterfacePanel, Panel):
+ bl_space_type = 'NODE_EDITOR'
+ bl_region_type = 'UI'
+ bl_category = "Group"
+ bl_label = "Outputs"
+
+ @classmethod
+ def poll(cls, context):
+ snode = context.space_data
+ return snode.edit_tree is not None
+
+ def draw(self, context):
+ self.draw_socket_list(context, "OUT", "outputs", "active_output")
+
+
# Grease Pencil properties
class NODE_PT_annotation(AnnotationDataPanel, Panel):
bl_space_type = 'NODE_EDITOR'
@@ -752,6 +843,8 @@ classes = (
NODE_PT_quality,
NODE_PT_annotation,
NODE_UL_interface_sockets,
+ NODE_PT_node_tree_interface_inputs,
+ NODE_PT_node_tree_interface_outputs,
node_panel(EEVEE_MATERIAL_PT_settings),
node_panel(MATERIAL_PT_viewport),