Commit c403e472 authored by Jehan's avatar Jehan
Browse files

app: don't sync Blend tool's gradient-repeat property with gimp:blend...

... when gradient_type >= GIMP_GRADIENT_SHAPEBURST_ANGULAR.
Our current GUI code for the Blend tool options disables the "Repeat"
widget with any of the shaped and spiral gradient types, which means (I
assume) no repeat mode is allowed on these gradients. Nevertheless it
was possible to change the repeat mode in another gradient type, then
switch to one of these and get the repeat processed even though the GUI
shows insensitive.
I could simply reset the repeat mode to GIMP_REPEAT_NONE when setting
one of these gradient types, but I think you'd want the repeat to stay
at its value (being insensitive is enough to mean whatever value is set
is not taken into account). So instead, I just unsync this specific
property when appropriate.
Note also I don't do this in the gimp:blend operation code because I am
not sure this specific behavior is meant to be a generic blend behavior
or just relative to the tool (render of the shaped gradients is barely
different with a repeat, but there is still a difference).
parent 87330a77
......@@ -511,6 +511,40 @@ gimp_blend_tool_options_notify (GimpTool *tool,
if (! strcmp (pspec->name, "gradient-type"))
{
GimpRepeatMode gradient_repeat;
GimpRepeatMode node_repeat;
GimpGradientType gradient_type;
gradient_repeat = GIMP_PAINT_OPTIONS (options)->gradient_options->gradient_repeat;
gradient_type = GIMP_BLEND_OPTIONS (options)->gradient_type;
gegl_node_get (blend_tool->render_node,
"gradient-repeat", &node_repeat,
NULL);
if (gradient_type >= GIMP_GRADIENT_SHAPEBURST_ANGULAR)
{
/* These gradient types are only meant to work with repeat
* value of "none" so these are the only ones where we
* don't keep the render node and the blend options in
* sync.
* We could instead reset the "gradient-repeat" value on
* GimpBlendOptions, but I assume one would want to revert
* back to the last set value if changing back the
* gradient type. So instead we just make the option
* insensitive (both in GUI and in render).
*/
if (node_repeat != GIMP_REPEAT_NONE)
gegl_node_set (blend_tool->render_node,
"gradient-repeat", GIMP_REPEAT_NONE,
NULL);
}
else if (node_repeat != gradient_repeat)
{
gegl_node_set (blend_tool->render_node,
"gradient-repeat", gradient_repeat,
NULL);
}
if (gimp_blend_tool_is_shapeburst (blend_tool))
gimp_blend_tool_precalc_shapeburst (blend_tool);
......@@ -602,6 +636,12 @@ gimp_blend_tool_start (GimpBlendTool *blend_tool,
gimp_operation_config_sync_node (G_OBJECT (options),
blend_tool->render_node);
/* We don't allow repeat values for some shapes. */
if (options->gradient_type >= GIMP_GRADIENT_SHAPEBURST_ANGULAR)
gegl_node_set (blend_tool->render_node,
"gradient-repeat", GIMP_REPEAT_NONE,
NULL);
/* Connect signal handlers for the gradient */
gimp_blend_tool_set_gradient (blend_tool, context->gradient);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment