Bug 763135 - Gimp cage tool doesn't work anymore

Fix various bugs, most importantly make sure the cage node is
properly updated when the config changes.
This commit is contained in:
Massimo Valentini 2016-03-23 23:00:48 +01:00 committed by Michael Natterer
parent 1b71731cb8
commit de4bc99448
1 changed files with 53 additions and 34 deletions

View File

@ -309,6 +309,8 @@ gimp_cage_tool_options_notify (GimpTool *tool,
{
/* switch to deform mode */
if (gimp_cage_config_get_n_points (ct->config) > 2)
{
gimp_cage_config_reset_displacement (ct->config);
gimp_cage_config_reverse_cage_if_needed (ct->config);
gimp_tool_push_status (tool, tool->display,
@ -336,20 +338,33 @@ gimp_cage_tool_options_notify (GimpTool *tool,
gimp_cage_tool_image_map_update (ct);
}
else
{
g_object_set (options,
"cage-mode", GIMP_CAGE_MODE_CAGE_CHANGE,
NULL);
}
}
else
{
/* switch to edit mode */
if (ct->image_map)
{
gimp_image_map_abort (ct->image_map);
gimp_tool_pop_status (tool, tool->display);
ct->tool_state = CAGE_STATE_WAIT;
}
}
}
else if (strcmp (pspec->name, "fill-plain-color") == 0)
{
if (ct->tool_state == DEFORM_STATE_WAIT)
{
gimp_cage_tool_render_node_update (ct);
gimp_cage_tool_image_map_update (ct);
}
}
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
@ -711,6 +726,7 @@ gimp_cage_tool_button_release (GimpTool *tool,
case DEFORM_STATE_MOVE_HANDLE:
ct->tool_state = DEFORM_STATE_WAIT;
gimp_cage_config_commit_displacement (ct->config);
gegl_node_set (ct->cage_node, "config", ct->config, NULL);
gimp_cage_tool_image_map_update (ct);
break;
@ -937,6 +953,8 @@ gimp_cage_tool_halt (GimpCageTool *ct)
static void
gimp_cage_tool_commit (GimpCageTool *ct)
{
if (ct->image_map)
{
GimpTool *tool = GIMP_TOOL (ct);
@ -950,6 +968,7 @@ gimp_cage_tool_commit (GimpCageTool *ct)
gimp_image_flush (gimp_display_get_image (tool->display));
}
}
static gint
gimp_cage_tool_is_on_handle (GimpCageTool *ct,