[Bf-blender-cvs] [3ef95d7f196] geometry-nodes-simulation: add theme color for simulation region
Jacques Lucke
noreply at git.blender.org
Tue Dec 13 11:44:24 CET 2022
Commit: 3ef95d7f19606cc689724182075634a59ceca04b
Author: Jacques Lucke
Date: Tue Dec 13 11:44:14 2022 +0100
Branches: geometry-nodes-simulation
https://developer.blender.org/rB3ef95d7f19606cc689724182075634a59ceca04b
add theme color for simulation region
===================================================================
M release/datafiles/userdef/userdef_default_theme.c
M source/blender/blenloader/intern/versioning_userdef.c
M source/blender/editors/include/UI_resources.h
M source/blender/editors/interface/resources.cc
M source/blender/editors/space_node/node_draw.cc
M source/blender/makesdna/DNA_userdef_types.h
M source/blender/makesrna/intern/rna_userdef.c
===================================================================
diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 04ad04d4812..0b177fad3f6 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -866,6 +866,7 @@ const bTheme U_theme_default = {
.nodeclass_layout = RGBA(0x6c696fff),
.nodeclass_geometry = RGBA(0x00d6a3ff),
.nodeclass_attribute = RGBA(0x001566ff),
+ .node_region_simulation = RGBA(0x000000ff),
.movie = RGBA(0x0f0f0fcc),
.gp_vertex_size = 3,
.gp_vertex = RGBA(0x97979700),
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index b4890131861..3003f6678dd 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -98,6 +98,10 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
*/
{
/* Keep this block, even when empty. */
+
+ if (btheme->space_node.node_region_simulation[3] == 0) {
+ btheme->space_node.node_region_simulation[3] = 0.1f;
+ }
}
#undef FROM_DEFAULT_V4_UCHAR
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 9a46728097c..e6225ebe60f 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -177,6 +177,8 @@ typedef enum ThemeColorID {
TH_NODE_GEOMETRY,
TH_NODE_ATTRIBUTE,
+ TH_NODE_REGION_SIMULATION,
+
TH_CONSOLE_OUTPUT,
TH_CONSOLE_INPUT,
TH_CONSOLE_INFO,
diff --git a/source/blender/editors/interface/resources.cc b/source/blender/editors/interface/resources.cc
index 74590dccec4..0b7286f65ba 100644
--- a/source/blender/editors/interface/resources.cc
+++ b/source/blender/editors/interface/resources.cc
@@ -635,6 +635,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_NODE_GRID_LEVELS:
cp = &ts->grid_levels;
break;
+ case TH_NODE_REGION_SIMULATION:
+ cp = ts->node_region_simulation;
+ break;
case TH_SEQ_MOVIE:
cp = ts->movie;
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index f31899c0374..2ca30e3808c 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -92,7 +92,8 @@ using blender::Vector;
namespace blender::ed::space_node {
struct SubContext {
- float3 color;
+ float4 background_color;
+ float4 outline_color;
Vector<const bNode *> input_nodes;
Vector<const bNode *> output_nodes;
};
@@ -2370,7 +2371,7 @@ static void node_draw_basis(const bContext &C,
UI_GetThemeColor4fv(TH_REDALERT, color_outline);
}
else {
- copy_v3_v3(color_outline, context->color);
+ copy_v3_v3(color_outline, context->outline_color);
color_outline[3] = 1.0f;
}
}
@@ -3045,7 +3046,11 @@ static void node_draw_sub_context_frames(TreeDrawContext &tree_draw_ctx,
for (const bNode *sim_input : all_simulation_inputs) {
const auto &storage = *static_cast<const NodeGeometrySimulationInput *>(sim_input->storage);
if (const bNode *sim_output = ntree.node_by_id(storage.output_node_id)) {
- sub_contexts.append({float3(0.0f, 0.0f, 0.0f), {sim_input}, {sim_output}});
+ float4 background_color;
+ UI_GetThemeColor4fv(TH_NODE_REGION_SIMULATION, background_color);
+ float4 outline_color = background_color;
+ outline_color[3] = 1.0f;
+ sub_contexts.append({background_color, outline_color, {sim_input}, {sim_output}});
}
}
@@ -3117,14 +3122,14 @@ static void node_draw_sub_context_frames(TreeDrawContext &tree_draw_ctx,
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
GPU_blend(GPU_BLEND_ALPHA);
- immUniformColor4f(sub_context.color[0], sub_context.color[1], sub_context.color[2], 0.2f);
+ immUniformColor4fv(sub_context.background_color);
immBegin(GPU_PRIM_TRI_FAN, boundary_positions.size() + 1);
for (const float3 &p : boundary_positions) {
immVertex3fv(pos, p);
}
immVertex3fv(pos, boundary_positions[0]);
immEnd();
- immUniformColor4f(sub_context.color[0], sub_context.color[1], sub_context.color[2], 1.0f);
+ immUniformColor4fv(sub_context.outline_color);
immBegin(GPU_PRIM_LINE_STRIP, boundary_positions.size() + 1);
for (const float3 &p : boundary_positions) {
immVertex3fv(pos, p);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 8a644803fd7..64ae3898282 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -330,6 +330,9 @@ typedef struct ThemeSpace {
unsigned char nodeclass_pattern[4], nodeclass_layout[4];
unsigned char nodeclass_geometry[4], nodeclass_attribute[4];
+ unsigned char node_region_simulation[4];
+ char _pad8[4];
+
/** For sequence editor. */
unsigned char movie[4], movieclip[4], mask[4], image[4], scene[4], audio[4];
unsigned char effect[4], transition[4], meta[4], text_strip[4], color_strip[4];
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index b93983d0a87..886fcb3d459 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2936,6 +2936,12 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Attribute Node", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "simulation_region", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "node_region_simulation");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Simulation Region", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_buts(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list