diff --git a/app/tools/gimpnpointdeformationoptions.c b/app/tools/gimpnpointdeformationoptions.c index 05c87b8dd5..407e162c9a 100644 --- a/app/tools/gimpnpointdeformationoptions.c +++ b/app/tools/gimpnpointdeformationoptions.c @@ -42,7 +42,8 @@ enum PROP_RIGIDITY, PROP_ASAP_DEFORMATION, PROP_MLS_WEIGHTS, - PROP_MLS_WEIGHTS_ALPHA + PROP_MLS_WEIGHTS_ALPHA, + PROP_MESH_VISIBLE }; @@ -94,6 +95,11 @@ gimp_n_point_deformation_options_class_init (GimpNPointDeformationOptionsClass * "MLS-weights-alpha", _("MLS Weights Alpha"), 0.1, 2.0, 1.0, GIMP_PARAM_STATIC_STRINGS); + + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_MESH_VISIBLE, + "mesh-visible", _("Mesh Visible"), + TRUE, + GIMP_PARAM_STATIC_STRINGS); } static void @@ -126,6 +132,9 @@ gimp_n_point_deformation_options_set_property (GObject *object, case PROP_MLS_WEIGHTS_ALPHA: options->square_size = g_value_get_double (value); break; + case PROP_MESH_VISIBLE: + options->mesh_visible = g_value_get_boolean (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -157,6 +166,9 @@ gimp_n_point_deformation_options_get_property (GObject *object, case PROP_MLS_WEIGHTS_ALPHA: g_value_set_double (value, options->square_size); break; + case PROP_MESH_VISIBLE: + g_value_set_boolean (value, options->mesh_visible); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -168,8 +180,11 @@ gimp_n_point_deformation_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options); - GtkWidget *combo; - GtkWidget *scale; + GtkWidget *combo, *scale, *check; + + check = gimp_prop_check_button_new (config, "mesh-visible", _("Show Mesh")); + gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); + gtk_widget_show (check); scale = gimp_prop_spin_scale_new (config, "square-size", _("Square Size"), 1.0, 10.0, 0); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 5.0, 1000.0); diff --git a/app/tools/gimpnpointdeformationoptions.h b/app/tools/gimpnpointdeformationoptions.h index 3b6b668447..a539b20661 100644 --- a/app/tools/gimpnpointdeformationoptions.h +++ b/app/tools/gimpnpointdeformationoptions.h @@ -44,6 +44,7 @@ struct _GimpNPointDeformationOptions gboolean ASAP_deformation; gboolean MLS_weights; gdouble MLS_weights_alpha; + gboolean mesh_visible; }; struct _GimpNPointDeformationOptionsClass diff --git a/app/tools/gimpnpointdeformationtool.c b/app/tools/gimpnpointdeformationtool.c index fe31d7a7c6..ebbd31dd18 100644 --- a/app/tools/gimpnpointdeformationtool.c +++ b/app/tools/gimpnpointdeformationtool.c @@ -216,6 +216,7 @@ gimp_n_point_deformation_tool_start (GimpNPointDeformationTool *npd_tool, gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display); tool->display = display; + npd_tool->display = display; gimp_draw_tool_start (draw_tool, display); npd_tool->active = TRUE; @@ -243,9 +244,9 @@ gimp_n_point_deformation_tool_start (GimpNPointDeformationTool *npd_tool, GIMP_N_POINT_DEFORMATION_TOOL_GET_OPTIONS (npd_tool)); gegl_node_process (sink); - + gegl_node_get (node, "model", &model, NULL); - + npd_tool->buf = buf; npd_tool->drawable = drawable; npd_tool->graph = graph; @@ -262,13 +263,15 @@ gimp_n_point_deformation_tool_halt (GimpNPointDeformationTool *npd_tool) { GimpTool *tool = GIMP_TOOL (npd_tool); GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (npd_tool); + + npd_tool->active = FALSE; if (gimp_draw_tool_is_active (draw_tool)) gimp_draw_tool_stop (draw_tool); if (gimp_tool_control_is_active (tool->control)) gimp_tool_control_halt (tool->control); - + tool->display = NULL; } @@ -282,6 +285,7 @@ gimp_n_point_deformation_tool_set_options (GeglNode *npd_nod "ASAP deformation", npd_options->ASAP_deformation, "MLS weights", npd_options->MLS_weights, "MLS weights alpha", npd_options->MLS_weights_alpha, + "mesh visible", npd_options->mesh_visible, NULL); } diff --git a/app/tools/gimpnpointdeformationtool.h b/app/tools/gimpnpointdeformationtool.h index 8af9b76907..f8b8bfc6b7 100644 --- a/app/tools/gimpnpointdeformationtool.h +++ b/app/tools/gimpnpointdeformationtool.h @@ -42,6 +42,8 @@ struct _GimpNPointDeformationTool { GimpDrawTool parent_instance; + GimpDisplay *display; + GeglNode *graph; GeglNode *source; GeglNode *node;