app: npd-tool: add option to show mesh

This commit is contained in:
Marek Dvoroznak 2013-08-18 20:43:01 +02:00 committed by Michael Natterer
parent b1059d9461
commit 6ea27ea690
4 changed files with 28 additions and 6 deletions

View File

@ -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);

View File

@ -44,6 +44,7 @@ struct _GimpNPointDeformationOptions
gboolean ASAP_deformation;
gboolean MLS_weights;
gdouble MLS_weights_alpha;
gboolean mesh_visible;
};
struct _GimpNPointDeformationOptionsClass

View File

@ -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);
}

View File

@ -42,6 +42,8 @@ struct _GimpNPointDeformationTool
{
GimpDrawTool parent_instance;
GimpDisplay *display;
GeglNode *graph;
GeglNode *source;
GeglNode *node;