Nodes: Reorder socket data types list

Currently there is a difference in the assigned accelerator keys for
Boolean attribute type for Store Named Attribute and Named Attribute.
For Named Attribute it is assigned <kbd>B</kbd> as a user would expect
but in the Store Named Attribute it is assigned <kbd>o</kbd> as it comes
after _Byte Color_ which leads to confusion when using lots of each node.

This PR changes the order of the socket types so simpler types come
first, and updates the attribute types to reflect this same ordering.

This fixes the issue with the accelerator keys and improves overall
consistency. The more specialised subtypes such as 8-Bit Integer, Byte
Color and 2D Vector all appear at the end of the menu in the same order.

This ordering will also be reflected in other nodes such as Sample Index,
Sample Curve etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/146722
This commit is contained in:
Brady Johnston
2025-09-25 09:34:36 +02:00
committed by Hans Goudey
parent 97297bd167
commit c010bab779
5 changed files with 25 additions and 23 deletions

View File

@@ -142,8 +142,6 @@ static const bNodeSocketStaticTypeInfo node_socket_subtypes[] = {
{"NodeSocketIntPercentage", "NodeTreeInterfaceSocketIntPercentage", SOCK_INT, PROP_PERCENTAGE},
{"NodeSocketIntFactor", "NodeTreeInterfaceSocketIntFactor", SOCK_INT, PROP_FACTOR},
{"NodeSocketBool", "NodeTreeInterfaceSocketBool", SOCK_BOOLEAN, PROP_NONE},
{"NodeSocketRotation", "NodeTreeInterfaceSocketRotation", SOCK_ROTATION, PROP_NONE},
{"NodeSocketMatrix", "NodeTreeInterfaceSocketMatrix", SOCK_MATRIX, PROP_NONE},
{"NodeSocketVector", "NodeTreeInterfaceSocketVector", SOCK_VECTOR, PROP_NONE},
{"NodeSocketVectorFactor", "NodeTreeInterfaceSocketVectorFactor", SOCK_VECTOR, PROP_FACTOR},
@@ -226,6 +224,9 @@ static const bNodeSocketStaticTypeInfo node_socket_subtypes[] = {
{"NodeSocketVectorEuler4D", "NodeTreeInterfaceSocketVectorEuler4D", SOCK_VECTOR, PROP_EULER},
{"NodeSocketVectorXYZ4D", "NodeTreeInterfaceSocketVectorXYZ4D", SOCK_VECTOR, PROP_XYZ},
{"NodeSocketRotation", "NodeTreeInterfaceSocketRotation", SOCK_ROTATION, PROP_NONE},
{"NodeSocketMatrix", "NodeTreeInterfaceSocketMatrix", SOCK_MATRIX, PROP_NONE},
{"NodeSocketColor", "NodeTreeInterfaceSocketColor", SOCK_RGBA, PROP_NONE},
{"NodeSocketString", "NodeTreeInterfaceSocketString", SOCK_STRING, PROP_NONE},
{"NodeSocketStringFilePath",

View File

@@ -28,21 +28,21 @@ using blender::bke::AttrDomain;
const EnumPropertyItem rna_enum_attribute_type_items[] = {
{CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
{CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"},
{CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
{CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
{CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with 32-bit floating-point values"},
{CD_PROP_QUATERNION, "QUATERNION", 0, "Quaternion", "Floating point quaternion rotation"},
{CD_PROP_FLOAT4X4, "FLOAT4X4", 0, "4x4 Matrix", "Floating point matrix"},
{CD_PROP_STRING, "STRING", 0, "String", "Text string"},
{CD_PROP_INT8, "INT8", 0, "8-Bit Integer", "Smaller integer with a range from -128 to 127"},
{CD_PROP_INT16_2D, "INT16_2D", 0, "2D 16-Bit Integer Vector", "16-bit signed integer vector"},
{CD_PROP_INT32_2D, "INT32_2D", 0, "2D Integer Vector", "32-bit signed integer vector"},
{CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
{CD_PROP_BYTE_COLOR,
"BYTE_COLOR",
0,
"Byte Color",
"RGBA color with 8-bit positive integer values"},
{CD_PROP_STRING, "STRING", 0, "String", "Text string"},
{CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
{CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
{CD_PROP_INT8, "INT8", 0, "8-Bit Integer", "Smaller integer with a range from -128 to 127"},
{CD_PROP_INT16_2D, "INT16_2D", 0, "2D 16-Bit Integer Vector", "16-bit signed integer vector"},
{CD_PROP_INT32_2D, "INT32_2D", 0, "2D Integer Vector", "32-bit signed integer vector"},
{CD_PROP_QUATERNION, "QUATERNION", 0, "Quaternion", "Floating point quaternion rotation"},
{CD_PROP_FLOAT4X4, "FLOAT4X4", 0, "4x4 Matrix", "Floating point matrix"},
{0, nullptr, 0, nullptr, nullptr},
};
@@ -59,21 +59,21 @@ const EnumPropertyItem rna_enum_attribute_type_with_auto_items[] = {
{CD_AUTO_FROM_NAME, "AUTO", 0, "Auto", ""},
{CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
{CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"},
{CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
{CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
{CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with 32-bit floating-point values"},
{CD_PROP_QUATERNION, "QUATERNION", 0, "Quaternion", "Floating point quaternion rotation"},
{CD_PROP_FLOAT4X4, "FLOAT4X4", 0, "4x4 Matrix", "Floating point matrix"},
{CD_PROP_STRING, "STRING", 0, "String", "Text string"},
{CD_PROP_INT8, "INT8", 0, "8-Bit Integer", "Smaller integer with a range from -128 to 127"},
{CD_PROP_INT16_2D, "INT16_2D", 0, "2D 16-Bit Integer Vector", "16-bit signed integer vector"},
{CD_PROP_INT32_2D, "INT32_2D", 0, "2D Integer Vector", "32-bit signed integer vector"},
{CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
{CD_PROP_BYTE_COLOR,
"BYTE_COLOR",
0,
"Byte Color",
"RGBA color with 8-bit positive integer values"},
{CD_PROP_STRING, "STRING", 0, "String", "Text string"},
{CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
{CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
{CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
{CD_PROP_INT16_2D, "INT16_2D", 0, "2D 16-Bit Integer Vector", "16-bit signed integer vector"},
{CD_PROP_INT32_2D, "INT32_2D", 0, "2D Integer Vector", "32-bit signed integer vector"},
{CD_PROP_QUATERNION, "QUATERNION", 0, "Quaternion", "Floating point quaternion rotation"},
{CD_PROP_FLOAT4X4, "FLOAT4X4", 0, "4x4 Matrix", "Floating point matrix"},
{0, nullptr, 0, nullptr, nullptr},
};

View File

@@ -1902,8 +1902,6 @@ static const bNodeSocketStaticTypeInfo node_socket_subtypes[] = {
{"NodeSocketIntPercentage", "NodeTreeInterfaceSocketIntPercentage", SOCK_INT, PROP_PERCENTAGE},
{"NodeSocketIntFactor", "NodeTreeInterfaceSocketIntFactor", SOCK_INT, PROP_FACTOR},
{"NodeSocketBool", "NodeTreeInterfaceSocketBool", SOCK_BOOLEAN, PROP_NONE},
{"NodeSocketRotation", "NodeTreeInterfaceSocketRotation", SOCK_ROTATION, PROP_NONE},
{"NodeSocketMatrix", "NodeTreeInterfaceSocketMatrix", SOCK_MATRIX, PROP_NONE},
{"NodeSocketVector", "NodeTreeInterfaceSocketVector", SOCK_VECTOR, PROP_NONE},
{"NodeSocketVectorFactor", "NodeTreeInterfaceSocketVectorFactor", SOCK_VECTOR, PROP_FACTOR},
@@ -1986,6 +1984,9 @@ static const bNodeSocketStaticTypeInfo node_socket_subtypes[] = {
{"NodeSocketVectorEuler4D", "NodeTreeInterfaceSocketVectorEuler4D", SOCK_VECTOR, PROP_EULER},
{"NodeSocketVectorXYZ4D", "NodeTreeInterfaceSocketVectorXYZ4D", SOCK_VECTOR, PROP_XYZ},
{"NodeSocketRotation", "NodeTreeInterfaceSocketRotation", SOCK_ROTATION, PROP_NONE},
{"NodeSocketMatrix", "NodeTreeInterfaceSocketMatrix", SOCK_MATRIX, PROP_NONE},
{"NodeSocketColor", "NodeTreeInterfaceSocketColor", SOCK_RGBA, PROP_NONE},
{"NodeSocketString", "NodeTreeInterfaceSocketString", SOCK_STRING, PROP_NONE},
{"NodeSocketStringFilePath",

View File

@@ -47,11 +47,11 @@ const EnumPropertyItem rna_enum_node_socket_data_type_items[] = {
{SOCK_INT, "INT", ICON_NODE_SOCKET_INT, "Integer", ""},
{SOCK_BOOLEAN, "BOOLEAN", ICON_NODE_SOCKET_BOOLEAN, "Boolean", ""},
{SOCK_VECTOR, "VECTOR", ICON_NODE_SOCKET_VECTOR, "Vector", ""},
{SOCK_RGBA, "RGBA", ICON_NODE_SOCKET_RGBA, "Color", ""},
{SOCK_ROTATION, "ROTATION", ICON_NODE_SOCKET_ROTATION, "Rotation", ""},
{SOCK_MATRIX, "MATRIX", ICON_NODE_SOCKET_MATRIX, "Matrix", ""},
{SOCK_STRING, "STRING", ICON_NODE_SOCKET_STRING, "String", ""},
{SOCK_MENU, "MENU", ICON_NODE_SOCKET_MENU, "Menu", ""},
{SOCK_RGBA, "RGBA", ICON_NODE_SOCKET_RGBA, "Color", ""},
{SOCK_SHADER, "SHADER", ICON_NODE_SOCKET_SHADER, "Shader", ""},
{SOCK_OBJECT, "OBJECT", ICON_NODE_SOCKET_OBJECT, "Object", ""},
{SOCK_IMAGE, "IMAGE", ICON_NODE_SOCKET_IMAGE, "Image", ""},

View File

@@ -1260,8 +1260,6 @@ void register_standard_node_socket_types()
bke::node_register_socket_type(*make_socket_type_int(PROP_FACTOR));
bke::node_register_socket_type(*make_socket_type_bool());
bke::node_register_socket_type(*make_socket_type_rotation());
bke::node_register_socket_type(*make_socket_type_matrix());
bke::node_register_socket_type(*make_socket_type_vector(PROP_NONE, 3));
bke::node_register_socket_type(*make_socket_type_vector(PROP_FACTOR, 3));
@@ -1294,6 +1292,8 @@ void register_standard_node_socket_types()
bke::node_register_socket_type(*make_socket_type_vector(PROP_XYZ, 4));
bke::node_register_socket_type(*make_socket_type_rgba());
bke::node_register_socket_type(*make_socket_type_rotation());
bke::node_register_socket_type(*make_socket_type_matrix());
bke::node_register_socket_type(*make_socket_type_string(PROP_NONE));
bke::node_register_socket_type(*make_socket_type_string(PROP_FILEPATH));