Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2012-11-09 14:33:42 +0400
committerTon Roosendaal <ton@blender.org>2012-11-09 14:33:42 +0400
commit3ce1d54e95cd7ae8bb6777497688386f9729cf96 (patch)
treedae7c3040e75fc96a447e4f7898211c21f977355 /source
parent98e60b2f43a20dd206994aa62f04254badcfb98c (diff)
Bugfix #33124
User Preference setting for Color Picker type only affected the popup version. Now it uses it for all color pickers in Panels too. Note for UI Py team: col.template_color_wheel() function follows the userpref - might be a need for rename here? Dunno how to handle this. Comment noted in template code.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_templates.c46
-rw-r--r--source/blender/editors/interface/interface_widgets.c4
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c1
3 files changed, 43 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 24aca0c037d..3ee389fbd1f 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1951,10 +1951,11 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn
MEM_freeN(cb);
}
-/********************* ColorWheel Template ************************/
+/********************* ColorPicker Template ************************/
#define WHEEL_SIZE 100
+/* This template now follows User Preference for type - name is not correct anymore... */
void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
@@ -1970,10 +1971,24 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propnam
RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
- col = uiLayoutColumn(layout, FALSE);
+ col = uiLayoutColumn(layout, TRUE);
row = uiLayoutRow(col, TRUE);
- but = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, "");
+ switch (U.color_picker_type) {
+ case USER_CP_CIRCLE:
+ but = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, "");
+ break;
+ case USER_CP_SQUARE_SV:
+ but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, UI_GRAD_SV, 0, "");
+ break;
+ case USER_CP_SQUARE_HS:
+ but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, UI_GRAD_HS, 0, "");
+ break;
+ case USER_CP_SQUARE_HV:
+ but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, UI_GRAD_HV, 0, "");
+ break;
+ }
+
if (lock) {
but->flag |= UI_BUT_COLOR_LOCK;
@@ -1989,10 +2004,29 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propnam
if (cubic)
but->flag |= UI_BUT_COLOR_CUBIC;
- uiItemS(row);
- if (value_slider)
- uiDefButR_prop(block, HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
+ if (value_slider) {
+
+ switch (U.color_picker_type) {
+ case USER_CP_CIRCLE:
+ uiItemS(row);
+ uiDefButR_prop(block, HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
+ break;
+ case USER_CP_SQUARE_SV:
+ uiItemS(col);
+ uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, -1, softmin, softmax, UI_GRAD_SV + 3, 0, "");
+ break;
+ case USER_CP_SQUARE_HS:
+ uiItemS(col);
+ uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, -1, softmin, softmax, UI_GRAD_HS + 3, 0, "");
+ break;
+ case USER_CP_SQUARE_HV:
+ uiItemS(col);
+ uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, -1, softmin, softmax, UI_GRAD_HV + 3, 0, "");
+ break;
+ }
+
+ }
}
/********************* Layer Buttons Template ************************/
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index d16169f1034..feb1e95ad23 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2059,7 +2059,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa
/* old below */
- for (dx = 0.0f; dx < 1.0f; dx += color_step) {
+ for (dx = 0.0f; dx < 0.999f; dx += color_step) { /* 0.999 = prevent float inaccuracy for steps */
/* previous color */
copy_v3_v3(col0[0], col1[0]);
copy_v3_v3(col0[1], col1[1]);
@@ -2114,7 +2114,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa
sx1 = rect->xmin + dx * BLI_rcti_size_x(rect);
sx2 = rect->xmin + (dx + color_step) * BLI_rcti_size_x(rect);
sy = rect->ymin;
- dy = BLI_rcti_size_y(rect) / 3.0;
+ dy = (float)BLI_rcti_size_y(rect) / 3.0;
glBegin(GL_QUADS);
for (a = 0; a < 3; a++, sy += dy) {
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 11e04cdd281..31a1360829e 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3162,6 +3162,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_enum_items(prop, color_picker_types);
RNA_def_property_enum_sdna(prop, NULL, "color_picker_type");
RNA_def_property_ui_text(prop, "Color Picker Type", "Different styles of displaying the color picker widget");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "use_preview_images", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ALLWINCODECS);