UI: add theme option for grid levels to display in node editor background
Differential Revision: https://developer.blender.org/D6916
This commit is contained in:
@@ -827,6 +827,7 @@ const bTheme U_theme_default = {
|
||||
.nodeclass_pattern = RGBA(0x6c696fff),
|
||||
.nodeclass_layout = RGBA(0x6c696fff),
|
||||
.movie = RGBA(0x1a1a1acc),
|
||||
.grid_levels = 2,
|
||||
.gp_vertex_size = 3,
|
||||
.gp_vertex = RGBA(0x97979700),
|
||||
.gp_vertex_select = RGBA(0xff8500ff),
|
||||
|
||||
@@ -920,6 +920,7 @@
|
||||
matte_node="#977474"
|
||||
distor_node="#749797"
|
||||
noodle_curving="0"
|
||||
grid_levels="2"
|
||||
input_node="#ff6675"
|
||||
output_node="#ff6675"
|
||||
filter_node="#6c696f"
|
||||
|
||||
@@ -188,6 +188,10 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
|
||||
FROM_DEFAULT_V4_UCHAR(space_clip.time_marker_line_selected);
|
||||
}
|
||||
|
||||
if (!USER_VERSION_ATLEAST(283, 6)) {
|
||||
btheme->space_node.grid_levels = U_theme_default.space_node.grid_levels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioning code until next subversion bump goes here.
|
||||
*
|
||||
|
||||
@@ -231,6 +231,7 @@ typedef enum ThemeColorID {
|
||||
TH_DRAWEXTRA_FACEANG,
|
||||
|
||||
TH_NODE_CURVING,
|
||||
TH_NODE_GRID_LEVELS,
|
||||
|
||||
TH_MARKER_OUTLINE,
|
||||
TH_MARKER,
|
||||
|
||||
@@ -640,6 +640,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||
case TH_NODE_CURVING:
|
||||
cp = &ts->noodle_curving;
|
||||
break;
|
||||
case TH_NODE_GRID_LEVELS:
|
||||
cp = &ts->grid_levels;
|
||||
break;
|
||||
|
||||
case TH_SEQ_MOVIE:
|
||||
cp = ts->movie;
|
||||
|
||||
@@ -1691,6 +1691,8 @@ void drawnodespace(const bContext *C, ARegion *ar)
|
||||
snode->cursor[0] /= UI_DPI_FAC;
|
||||
snode->cursor[1] /= UI_DPI_FAC;
|
||||
|
||||
int grid_levels = UI_GetThemeValueType(TH_NODE_GRID_LEVELS, SPACE_NODE);
|
||||
|
||||
ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
|
||||
|
||||
/* only set once */
|
||||
@@ -1753,8 +1755,11 @@ void drawnodespace(const bContext *C, ARegion *ar)
|
||||
snode_setup_v2d(snode, ar, center);
|
||||
|
||||
/* grid, uses theme color based on node path depth */
|
||||
UI_view2d_multi_grid_draw(
|
||||
v2d, (depth > 0 ? TH_NODE_GROUP : TH_BACK), ED_node_grid_size(), NODE_GRID_STEPS, 2);
|
||||
UI_view2d_multi_grid_draw(v2d,
|
||||
(depth > 0 ? TH_NODE_GROUP : TH_BACK),
|
||||
ED_node_grid_size(),
|
||||
NODE_GRID_STEPS,
|
||||
grid_levels);
|
||||
|
||||
/* backdrop */
|
||||
draw_nodespace_back_pix(C, ar, snode, path->parent_key);
|
||||
@@ -1795,7 +1800,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
|
||||
}
|
||||
else {
|
||||
/* default grid */
|
||||
UI_view2d_multi_grid_draw(v2d, TH_BACK, ED_node_grid_size(), NODE_GRID_STEPS, 2);
|
||||
UI_view2d_multi_grid_draw(v2d, TH_BACK, ED_node_grid_size(), NODE_GRID_STEPS, grid_levels);
|
||||
|
||||
/* backdrop */
|
||||
draw_nodespace_back_pix(C, ar, snode, NODE_INSTANCE_KEY_NONE);
|
||||
|
||||
@@ -315,6 +315,7 @@ typedef struct ThemeSpace {
|
||||
|
||||
unsigned char vertex_size, outline_width, obcenter_dia, facedot_size;
|
||||
unsigned char noodle_curving;
|
||||
unsigned char grid_levels;
|
||||
|
||||
/* syntax for textwindow and nodes */
|
||||
unsigned char syntaxl[4], syntaxs[4]; // in nodespace used for backdrop matte
|
||||
@@ -323,7 +324,7 @@ typedef struct ThemeSpace {
|
||||
unsigned char syntaxd[4], syntaxr[4]; // in nodespace used for distort
|
||||
|
||||
unsigned char line_numbers[4];
|
||||
char _pad6[4];
|
||||
char _pad6[3];
|
||||
|
||||
unsigned char nodeclass_output[4], nodeclass_filter[4];
|
||||
unsigned char nodeclass_vector[4], nodeclass_texture[4];
|
||||
|
||||
@@ -2817,6 +2817,14 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Noodle curving", "Curving of the noodle");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "grid_levels", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "grid_levels");
|
||||
RNA_def_property_int_default(prop, 2);
|
||||
RNA_def_property_range(prop, 0, 2);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Grid levels", "Amount of grid lines displayed in the background");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "input_node", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "syntaxn");
|
||||
RNA_def_property_array(prop, 3);
|
||||
|
||||
Reference in New Issue
Block a user