Commit d0802832 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

do the right thing for operations without "input" pad so we can use all

2008-02-05  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpimagemap.c (gimp_image_map_apply): do the right
	thing for operations without "input" pad so we can use all source
	operations too.

	* app/tools/gimpimagemaptool.[ch]: make
	gimp_image_map_tool_create_map() public for the time being.

	* app/tools/gimpgegltool.c (gimp_gegl_tool_operation_changed):
	recreate the GimpImageMap so we can switch from filter to source
	operations and back.


svn path=/trunk/; revision=24810
parent b4255ae3
2008-02-05 Michael Natterer <mitch@gimp.org>
* app/core/gimpimagemap.c (gimp_image_map_apply): do the right
thing for operations without "input" pad so we can use all source
operations too.
* app/tools/gimpimagemaptool.[ch]: make
gimp_image_map_tool_create_map() public for the time being.
* app/tools/gimpgegltool.c (gimp_gegl_tool_operation_changed):
recreate the GimpImageMap so we can switch from filter to source
operations and back.
2008-02-05 Michael Natterer <mitch@gimp.org>
* app/widgets/gimppropwidgets.[ch] (gimp_prop_table_new): new
......
......@@ -429,15 +429,18 @@ gimp_image_map_apply (GimpImageMap *image_map,
{
image_map->gegl = gegl_node_new ();
image_map->input =
gegl_node_new_child (image_map->gegl,
"operation", "gimp-tilemanager-source",
NULL);
image_map->shift =
gegl_node_new_child (image_map->gegl,
"operation", "shift",
NULL);
if (gegl_node_find_property (image_map->operation, "input"))
{
image_map->input =
gegl_node_new_child (image_map->gegl,
"operation", "gimp-tilemanager-source",
NULL);
image_map->shift =
gegl_node_new_child (image_map->gegl,
"operation", "shift",
NULL);
}
gegl_node_add_child (image_map->gegl, image_map->operation);
......@@ -460,22 +463,34 @@ gimp_image_map_apply (GimpImageMap *image_map,
g_object_unref (sink_operation);
}
gegl_node_link_many (image_map->input,
image_map->shift,
image_map->operation,
image_map->output,
NULL);
if (image_map->input)
{
gegl_node_link_many (image_map->input,
image_map->shift,
image_map->operation,
image_map->output,
NULL);
}
else
{
gegl_node_link_many (image_map->operation,
image_map->output,
NULL);
}
}
gegl_node_set (image_map->input,
"tile-manager", image_map->undo_tiles,
"linear", TRUE,
NULL);
gegl_node_set (image_map->shift,
"x", (gdouble) rect.x,
"y", (gdouble) rect.y,
NULL);
if (image_map->input)
{
gegl_node_set (image_map->input,
"tile-manager", image_map->undo_tiles,
"linear", TRUE,
NULL);
gegl_node_set (image_map->shift,
"x", (gdouble) rect.x,
"y", (gdouble) rect.y,
NULL);
}
gegl_node_set (image_map->output,
"tile-manager", gimp_drawable_get_shadow_tiles (image_map->drawable),
......
......@@ -605,10 +605,19 @@ gimp_gegl_tool_operation_changed (GtkWidget *widget,
if (! tool->operation)
return;
if (GIMP_IMAGE_MAP_TOOL (tool)->image_map)
{
gimp_image_map_clear (GIMP_IMAGE_MAP_TOOL (tool)->image_map);
g_object_unref (GIMP_IMAGE_MAP_TOOL (tool)->image_map);
GIMP_IMAGE_MAP_TOOL (tool)->image_map = NULL;
}
gegl_node_set (GIMP_IMAGE_MAP_TOOL (tool)->operation,
"operation", tool->operation,
NULL);
gimp_image_map_tool_create_map (GIMP_IMAGE_MAP_TOOL (tool));
tool->config = gimp_gegl_tool_get_config (tool);
if (tool->options_table)
......
......@@ -90,8 +90,6 @@ static void gimp_image_map_tool_map (GimpImageMapTool *im_tool);
static void gimp_image_map_tool_dialog (GimpImageMapTool *im_tool);
static void gimp_image_map_tool_reset (GimpImageMapTool *im_tool);
static void gimp_image_map_tool_create_map (GimpImageMapTool *im_tool);
static void gimp_image_map_tool_flush (GimpImageMap *image_map,
GimpImageMapTool *im_tool);
......@@ -571,12 +569,16 @@ gimp_image_map_tool_reset (GimpImageMapTool *tool)
}
}
static void
void
gimp_image_map_tool_create_map (GimpImageMapTool *tool)
{
Gimp *gimp = GIMP_TOOL (tool)->tool_info->gimp;
Gimp *gimp;
gboolean use_gegl;
g_return_if_fail (GIMP_IS_IMAGE_MAP_TOOL (tool));
gimp = GIMP_TOOL (tool)->tool_info->gimp;
if (tool->image_map)
{
gimp_image_map_clear (tool->image_map);
......
......@@ -86,9 +86,13 @@ struct _GimpImageMapToolClass
};
GType gimp_image_map_tool_get_type (void) G_GNUC_CONST;
GType gimp_image_map_tool_get_type (void) G_GNUC_CONST;
void gimp_image_map_tool_preview (GimpImageMapTool *image_map_tool);
/* temp hack for the gegl tool */
void gimp_image_map_tool_create_map (GimpImageMapTool *image_map_tool);
void gimp_image_map_tool_preview (GimpImageMapTool *image_map_tool);
#endif /* __GIMP_IMAGE_MAP_TOOL_H__ */
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