add theme color for simulation region

This commit is contained in:
Jacques Lucke 2022-12-13 11:44:14 +01:00
parent 02a264f5ab
commit 3ef95d7f19
7 changed files with 29 additions and 5 deletions

View File

@ -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),

View File

@ -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

View File

@ -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,

View File

@ -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;

View File

@ -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);

View File

@ -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];

View File

@ -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)