Merge branch 'blender-v4.0-release'

This commit is contained in:
Omar Emara
2023-11-06 11:49:24 +02:00
2 changed files with 12 additions and 2 deletions

View File

@@ -1205,7 +1205,13 @@ void node_socket_color_get(const bContext &C,
float r_color[4])
{
if (!sock.typeinfo->draw_color) {
copy_v4_v4(r_color, float4(1.0f, 0.0f, 1.0f, 1.0f));
/* Fallback to the simple variant. If not defined either, fallback to a magenta color. */
if (sock.typeinfo->draw_color_simple) {
sock.typeinfo->draw_color_simple(sock.typeinfo, r_color);
}
else {
copy_v4_v4(r_color, float4(1.0f, 0.0f, 1.0f, 1.0f));
}
return;
}

View File

@@ -592,7 +592,11 @@ static void rna_def_node_socket(BlenderRNA *brna)
RNA_def_function_output(func, parm);
func = RNA_def_function(srna, "draw_color_simple", nullptr);
RNA_def_function_ui_description(func, "Color of the socket icon");
RNA_def_function_ui_description(
func,
"Color of the socket icon. Used to draw sockets in places where the socket does not belong "
"to a node, like the node interface panel. Also used to draw node sockets if draw_color is "
"not defined");
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
parm = RNA_def_float_array(
func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);