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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-02-09 17:48:02 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-02-09 17:48:02 +0300
commit4912e0e74666a827315c370314e62fdc4827aed8 (patch)
tree20d5cafc3f86a082ef13f3e70e285c124089d38e
parent24e6411be6d0795d3107cc2d5dca8ae838e54663 (diff)
Fix T47339: Unified color not used w/ radial control
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h3
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c27
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c46
3 files changed, 63 insertions, 13 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index a3d74956d90..b6a7d671882 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -249,7 +249,8 @@ typedef enum {
RC_ROTATION = 2,
RC_ZOOM = 4,
RC_WEIGHT = 8,
- RC_SECONDARY_ROTATION = 16
+ RC_SECONDARY_ROTATION = 16,
+ RC_COLOR_OVERRIDE = 32,
} RCFlags;
void set_brush_rc_props(struct PointerRNA *ptr, const char *paint, const char *prop, const char *secondary_prop,
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 4727153430b..da7667c775e 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -1187,19 +1187,28 @@ void set_brush_rc_props(PointerRNA *ptr, const char *paint,
set_brush_rc_path(ptr, brush_path, "rotation_path", "texture_slot.angle");
RNA_string_set(ptr, "image_id", brush_path);
- if (flags & RC_COLOR)
+ if (flags & RC_COLOR) {
set_brush_rc_path(ptr, brush_path, "fill_color_path", "color");
- else
+ }
+ else {
RNA_string_set(ptr, "fill_color_path", "");
+ }
+
+ if (flags & RC_COLOR_OVERRIDE) {
+ RNA_string_set(ptr, "fill_color_override_path", "tool_settings.unified_paint_settings.color");
+ RNA_string_set(ptr, "fill_color_override_test_path", "tool_settings.unified_paint_settings.use_unified_color");
+ }
+ else {
+ RNA_string_set(ptr, "fill_color_override_path", "");
+ RNA_string_set(ptr, "fill_color_override_test_path", "");
+ }
+
if (flags & RC_ZOOM)
RNA_string_set(ptr, "zoom_path", "space_data.zoom");
else
RNA_string_set(ptr, "zoom_path", "");
- if (flags & RC_SECONDARY_ROTATION)
- RNA_boolean_set(ptr, "secondary_tex", true);
- else
- RNA_boolean_set(ptr, "secondary_tex", false);
+ RNA_boolean_set(ptr, "secondary_tex", (flags & RC_SECONDARY_ROTATION) != 0);
MEM_freeN(brush_path);
}
@@ -1373,7 +1382,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
ed_keymap_paint_brush_switch(keymap, "vertex_paint");
ed_keymap_paint_brush_size(keymap, "tool_settings.vertex_paint.brush.size");
- ed_keymap_paint_brush_radial_control(keymap, "vertex_paint", RC_COLOR | RC_ROTATION);
+ ed_keymap_paint_brush_radial_control(keymap, "vertex_paint", RC_COLOR | RC_COLOR_OVERRIDE | RC_ROTATION);
ed_keymap_stencil(keymap);
@@ -1449,7 +1458,9 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
ed_keymap_paint_brush_switch(keymap, "image_paint");
ed_keymap_paint_brush_size(keymap, "tool_settings.image_paint.brush.size");
- ed_keymap_paint_brush_radial_control(keymap, "image_paint", RC_COLOR | RC_ZOOM | RC_ROTATION | RC_SECONDARY_ROTATION);
+ ed_keymap_paint_brush_radial_control(
+ keymap, "image_paint",
+ RC_COLOR | RC_COLOR_OVERRIDE | RC_ZOOM | RC_ROTATION | RC_SECONDARY_ROTATION);
ed_keymap_stencil(keymap);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 96355c44f02..70557a0f2b1 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3866,7 +3866,9 @@ typedef struct {
PropertyType type;
PropertySubType subtype;
PointerRNA ptr, col_ptr, fill_col_ptr, rot_ptr, zoom_ptr, image_id_ptr;
+ PointerRNA fill_col_override_ptr, fill_col_override_test_ptr;
PropertyRNA *prop, *col_prop, *fill_col_prop, *rot_prop, *zoom_prop;
+ PropertyRNA *fill_col_override_prop, *fill_col_override_test_prop;
StructRNA *image_id_srna;
float initial_value, current_value, min_value, max_value;
int initial_mouse[2];
@@ -3959,8 +3961,23 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
float rot;
/* set fill color */
- if (rc->fill_col_prop)
- RNA_property_float_get_array(&rc->fill_col_ptr, rc->fill_col_prop, col);
+ if (rc->fill_col_prop) {
+ PointerRNA *fill_ptr;
+ PropertyRNA *fill_prop;
+
+ if (rc->fill_col_override_prop &&
+ RNA_property_boolean_get(&rc->fill_col_override_test_ptr, rc->fill_col_override_test_prop))
+ {
+ fill_ptr = &rc->fill_col_override_ptr;
+ fill_prop = rc->fill_col_override_prop;
+ }
+ else {
+ fill_ptr = &rc->fill_col_ptr;
+ fill_prop = rc->fill_col_prop;
+ }
+
+ RNA_property_float_get_array(fill_ptr, fill_prop, col);
+ }
glColor4f(col[0], col[1], col[2], alpha);
if (rc->gltex) {
@@ -4224,9 +4241,27 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
return 0;
if (!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT))
return 0;
- if (!radial_control_get_path(&ctx_ptr, op, "fill_color_path", &rc->fill_col_ptr, &rc->fill_col_prop, 3, RC_PROP_REQUIRE_FLOAT))
+
+
+ if (!radial_control_get_path(
+ &ctx_ptr, op, "fill_color_path", &rc->fill_col_ptr, &rc->fill_col_prop, 3, RC_PROP_REQUIRE_FLOAT))
+ {
return 0;
-
+ }
+
+ if (!radial_control_get_path(
+ &ctx_ptr, op, "fill_color_override_path",
+ &rc->fill_col_override_ptr, &rc->fill_col_override_prop, 3, RC_PROP_REQUIRE_FLOAT))
+ {
+ return 0;
+ }
+ if (!radial_control_get_path(
+ &ctx_ptr, op, "fill_color_override_test_path",
+ &rc->fill_col_override_test_ptr, &rc->fill_col_override_test_prop, 0, RC_PROP_REQUIRE_BOOL))
+ {
+ return 0;
+ }
+
/* slightly ugly; allow this property to not resolve
* correctly. needed because 3d texture paint shares the same
* keymap as 2d image paint */
@@ -4597,6 +4632,9 @@ static void WM_OT_radial_control(wmOperatorType *ot)
RNA_def_string(ot->srna, "fill_color_path", NULL, 0, "Fill Color Path", "Path of property used to set the fill color of the control");
+ RNA_def_string(ot->srna, "fill_color_override_path", NULL, 0, "Fill Color Override Path", "");
+ RNA_def_string(ot->srna, "fill_color_override_test_path", NULL, 0, "Fill Color Override Test", "");
+
RNA_def_string(ot->srna, "zoom_path", NULL, 0, "Zoom Path", "Path of property used to set the zoom level for the control");
RNA_def_string(ot->srna, "image_id", NULL, 0, "Image ID", "Path of ID that is used to generate an image for the control");