UI: Add new node colors for geometry nodes

During the development of the new nodes in the `geometry-nodes` branch
the color of the new nodes wasn't considered, so all of the nodes ended
up red, the color for "input" nodes. This patch introduces two new
colors, one for "Geometry" and one for "Attributes". There are only two
attribute nodes currently, but the next sprint will add two more,
attribute mix, and sample from texture. The attribute nodes are
conceptually different enough from the nodes that modify the geometry
that they deserve their own color.

Differential Revision: https://developer.blender.org/D9682
This commit is contained in:
Hans Goudey 2020-12-01 10:28:29 -05:00 committed by Jacques Lucke
parent 8522b1b6fb
commit 9281a1f4eb
22 changed files with 50 additions and 14 deletions

@ -840,6 +840,8 @@ const bTheme U_theme_default = {
.nodeclass_script = RGBA(0x084d4dff),
.nodeclass_pattern = RGBA(0x6c696fff),
.nodeclass_layout = RGBA(0x6c696fff),
.nodeclass_geometry = RGBA(0x00d7a4ff),
.nodeclass_attribute = RGBA(0x3f5980ff),
.movie = RGBA(0x1a1a1acc),
.gp_vertex_size = 3,
.gp_vertex = RGBA(0x97979700),

@ -818,7 +818,7 @@
metadatabg="#000000"
metadatatext="#ffffff"
preview_range="#a14d0066"
row_alternate = "#ffffff0d"
row_alternate="#ffffff0d"
>
<space>
<ThemeSpaceGeneric
@ -963,6 +963,8 @@
script_node="#6c696f"
pattern_node="#6c696f"
layout_node="#6c696f"
geometry_node="#00d7a4"
attribute_node="#3f5980"
>
<space>
<ThemeSpaceGeneric

@ -343,6 +343,8 @@ typedef struct bNodeType {
#define NODE_CLASS_SCRIPT 32
#define NODE_CLASS_INTERFACE 33
#define NODE_CLASS_SHADER 40
#define NODE_CLASS_GEOMETRY 41
#define NODE_CLASS_ATTRIBUTE 42
#define NODE_CLASS_LAYOUT 100
/* node resize directions */

@ -261,6 +261,8 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
FROM_DEFAULT_V4_UCHAR(collection_color[i].color);
}
FROM_DEFAULT_V4_UCHAR(space_sequencer.row_alternate);
FROM_DEFAULT_V4_UCHAR(space_node.nodeclass_geometry);
FROM_DEFAULT_V4_UCHAR(space_node.nodeclass_attribute);
}
#undef FROM_DEFAULT_V4_UCHAR

@ -190,6 +190,8 @@ typedef enum ThemeColorID {
TH_NODE_FRAME,
TH_NODE_MATTE,
TH_NODE_DISTORT,
TH_NODE_GEOMETRY,
TH_NODE_ATTRIBUTE,
TH_CONSOLE_OUTPUT,
TH_CONSOLE_INPUT,

@ -619,6 +619,12 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_NODE_LAYOUT:
cp = ts->nodeclass_layout;
break;
case TH_NODE_GEOMETRY:
cp = ts->nodeclass_geometry;
break;
case TH_NODE_ATTRIBUTE:
cp = ts->nodeclass_attribute;
break;
case TH_NODE_SHADER:
cp = ts->nodeclass_shader;
break;

@ -679,6 +679,10 @@ int node_get_colorid(bNode *node)
return TH_NODE_PATTERN;
case NODE_CLASS_LAYOUT:
return TH_NODE_LAYOUT;
case NODE_CLASS_GEOMETRY:
return TH_NODE_GEOMETRY;
case NODE_CLASS_ATTRIBUTE:
return TH_NODE_ATTRIBUTE;
default:
return TH_NODE;
}

@ -334,6 +334,7 @@ typedef struct ThemeSpace {
unsigned char nodeclass_vector[4], nodeclass_texture[4];
unsigned char nodeclass_shader[4], nodeclass_script[4];
unsigned char nodeclass_pattern[4], nodeclass_layout[4];
unsigned char nodeclass_geometry[4], nodeclass_attribute[4];
/** For sequence editor. */
unsigned char movie[4], movieclip[4], mask[4], image[4], scene[4], audio[4];

@ -2967,6 +2967,18 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Layout Node", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "geometry_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nodeclass_geometry");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Geometry Node", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "attribute_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nodeclass_attribute");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Attribute Node", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_buts(BlenderRNA *brna)

@ -81,7 +81,7 @@ void register_node_type_fn_boolean_math()
{
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_BOOLEAN_MATH, "Boolean Math", 0, 0);
fn_node_type_base(&ntype, FN_NODE_BOOLEAN_MATH, "Boolean Math", NODE_CLASS_CONVERTOR, 0);
node_type_socket_templates(&ntype, fn_node_boolean_math_in, fn_node_boolean_math_out);
node_type_label(&ntype, node_boolean_math_label);
node_type_update(&ntype, node_boolean_math_update);

@ -100,7 +100,7 @@ void register_node_type_fn_float_compare()
{
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_FLOAT_COMPARE, "Float Compare", 0, 0);
fn_node_type_base(&ntype, FN_NODE_FLOAT_COMPARE, "Float Compare", NODE_CLASS_CONVERTOR, 0);
node_type_socket_templates(&ntype, fn_node_float_compare_in, fn_node_float_compare_out);
node_type_label(&ntype, node_float_compare_label);
node_type_update(&ntype, node_float_compare_update);

@ -158,7 +158,7 @@ void register_node_type_geo_attribute_math()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_ATTRIBUTE_MATH, "Attribute Math", 0, 0);
geo_node_type_base(&ntype, GEO_NODE_ATTRIBUTE_MATH, "Attribute Math", NODE_CLASS_ATTRIBUTE, 0);
node_type_socket_templates(&ntype, geo_node_attribute_math_in, geo_node_attribute_math_out);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_math_exec;
node_type_update(&ntype, geo_node_attribute_math_update);

@ -145,7 +145,7 @@ void register_node_type_geo_boolean()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_BOOLEAN, "Boolean", 0, 0);
geo_node_type_base(&ntype, GEO_NODE_BOOLEAN, "Boolean", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_boolean_in, geo_node_boolean_out);
ntype.geometry_node_execute = blender::nodes::geo_node_boolean_exec;
nodeRegisterType(&ntype);

@ -89,7 +89,7 @@ void register_node_type_geo_edge_split()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_EDGE_SPLIT, "Edge Split", 0, 0);
geo_node_type_base(&ntype, GEO_NODE_EDGE_SPLIT, "Edge Split", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_edge_split_in, geo_node_edge_split_out);
ntype.geometry_node_execute = blender::nodes::geo_node_edge_split_exec;
nodeRegisterType(&ntype);

@ -269,7 +269,7 @@ void register_node_type_geo_join_geometry()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_JOIN_GEOMETRY, "Join Geometry", 0, 0);
geo_node_type_base(&ntype, GEO_NODE_JOIN_GEOMETRY, "Join Geometry", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_join_geometry_in, geo_node_join_geometry_out);
ntype.geometry_node_execute = blender::nodes::geo_node_join_geometry_exec;
nodeRegisterType(&ntype);

@ -87,7 +87,7 @@ void register_node_type_geo_object_info()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_OBJECT_INFO, "Object Info", 0, 0);
geo_node_type_base(&ntype, GEO_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT, 0);
node_type_socket_templates(&ntype, geo_node_object_info_in, geo_node_object_info_out);
ntype.geometry_node_execute = blender::nodes::geo_node_object_info_exec;
nodeRegisterType(&ntype);

@ -132,7 +132,8 @@ void register_node_type_geo_point_distribute()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_POINT_DISTRIBUTE, "Point Distribute", 0, 0);
geo_node_type_base(
&ntype, GEO_NODE_POINT_DISTRIBUTE, "Point Distribute", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_point_distribute_in, geo_node_point_distribute_out);
ntype.geometry_node_execute = blender::nodes::geo_node_point_distribute_exec;
nodeRegisterType(&ntype);

@ -80,7 +80,7 @@ void register_node_type_geo_point_instance()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_POINT_INSTANCE, "Point Instance", 0, 0);
geo_node_type_base(&ntype, GEO_NODE_POINT_INSTANCE, "Point Instance", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_point_instance_in, geo_node_point_instance_out);
ntype.geometry_node_execute = blender::nodes::geo_node_point_instance_exec;
nodeRegisterType(&ntype);

@ -151,7 +151,8 @@ void register_node_type_geo_random_attribute()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_RANDOM_ATTRIBUTE, "Random Attribute", 0, 0);
geo_node_type_base(
&ntype, GEO_NODE_RANDOM_ATTRIBUTE, "Random Attribute", NODE_CLASS_ATTRIBUTE, 0);
node_type_socket_templates(&ntype, geo_node_random_attribute_in, geo_node_random_attribute_out);
node_type_init(&ntype, geo_node_random_attribute_init);
node_type_update(&ntype, geo_node_random_attribute_update);

@ -105,7 +105,8 @@ void register_node_type_geo_subdivision_surface()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_SUBDIVISION_SURFACE, "Subdivision Surface", 0, 0);
geo_node_type_base(
&ntype, GEO_NODE_SUBDIVISION_SURFACE, "Subdivision Surface", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(
&ntype, geo_node_subdivision_surface_in, geo_node_subdivision_surface_out);
ntype.geometry_node_execute = blender::nodes::geo_node_subdivision_surface_exec;

@ -138,7 +138,7 @@ void register_node_type_geo_transform()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_TRANSFORM, "Transform", 0, 0);
geo_node_type_base(&ntype, GEO_NODE_TRANSFORM, "Transform", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_transform_in, geo_node_transform_out);
ntype.geometry_node_execute = blender::nodes::geo_node_transform_exec;
nodeRegisterType(&ntype);

@ -71,7 +71,7 @@ void register_node_type_geo_triangulate()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_TRIANGULATE, "Triangulate", 0, 0);
geo_node_type_base(&ntype, GEO_NODE_TRIANGULATE, "Triangulate", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_triangulate_in, geo_node_triangulate_out);
node_type_init(&ntype, geo_triangulate_init);
ntype.geometry_node_execute = blender::nodes::geo_node_triangulate_exec;