Fix T47339: Unified color not used w/ radial control
This commit is contained in:
parent
24e6411be6
commit
4912e0e746
Notes:
blender-bot
2023-02-14 10:18:56 +01:00
Referenced by issue #47339, Project Paint - Unified Settings: Color
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue