Commit 8b7bafa4 authored by Ell's avatar Ell

Issue #4204 - "Add Bevel" Has No Effect

In plug_in_compat.pdb, don't add child nodes to nodes containing an
op, since this turns them into graphs and discards the op.
Instead, add a new wrap_in_graph() helper function, which takes a
node op and wraps it in a simple "input -> op -> output" graph.
Use the graph as the container for child nodes, and as the node
passed to gimp_drawable_apply_operation().  (This is similar to
what we used to do before commit
afdd5731, except that we now pass
the parent node to gimp_drawable_apply_operation(), instead of the
op node).
parent 49221167
......@@ -60,6 +60,29 @@
#include "gimp-intl.h"
static GeglNode *
wrap_in_graph (GeglNode *node)
{
GeglNode *new_node;
GeglNode *input;
GeglNode *output;
new_node = gegl_node_new ();
gegl_node_add_child (new_node, node);
g_object_unref (node);
input = gegl_node_get_input_proxy (new_node, "input");
output = gegl_node_get_output_proxy (new_node, "output");
gegl_node_link_many (input,
node,
output,
NULL);
return new_node;
}
static GeglNode *
wrap_in_selection_bounds (GeglNode *node,
GimpDrawable *drawable)
......@@ -212,6 +235,7 @@ bump_map (GimpDrawable *drawable,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GeglNode *graph;
GeglNode *node;
GeglNode *src_node;
......@@ -230,14 +254,16 @@ bump_map (GimpDrawable *drawable,
"ambient", ambient,
NULL);
src_node = create_buffer_source_node (node, bump_map);
graph = wrap_in_graph (node);
src_node = create_buffer_source_node (graph, bump_map);
gegl_node_connect_to (src_node, "output", node, "aux");
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Bump Map"),
node);
g_object_unref (node);
graph);
g_object_unref (graph);
return TRUE;
}
......@@ -264,6 +290,7 @@ displace (GimpDrawable *drawable,
{
if (do_x || do_y)
{
GeglNode *graph;
GeglNode *node;
GeglAbyssPolicy abyss_policy = GEGL_ABYSS_NONE;
......@@ -289,24 +316,26 @@ displace (GimpDrawable *drawable,
"amount_y", amount_y,
NULL);
graph = wrap_in_graph (node);
if (do_x)
{
GeglNode *src_node;
src_node = create_buffer_source_node (node, displace_map_x);
src_node = create_buffer_source_node (graph, displace_map_x);
gegl_node_connect_to (src_node, "output", node, "aux");
}
if (do_y)
{
GeglNode *src_node;
src_node = create_buffer_source_node (node, displace_map_y);
src_node = create_buffer_source_node (graph, displace_map_y);
gegl_node_connect_to (src_node, "output", node, "aux2");
}
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Displace"),
node);
g_object_unref (node);
graph);
g_object_unref (graph);
}
return TRUE;
......@@ -2977,6 +3006,7 @@ plug_in_oilify_enhanced_invoker (GimpProcedure *procedure,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GeglNode *graph;
GeglNode *node;
node = gegl_node_new_child (NULL,
......@@ -2986,24 +3016,26 @@ plug_in_oilify_enhanced_invoker (GimpProcedure *procedure,
"exponent", exponent,
NULL);
graph = wrap_in_graph (node);
if (mask_size_map)
{
GeglNode *src_node;
src_node = create_buffer_source_node (node, mask_size_map);
src_node = create_buffer_source_node (graph, mask_size_map);
gegl_node_connect_to (src_node, "output", node, "aux");
}
if (exponent_map)
{
GeglNode *src_node;
src_node = create_buffer_source_node (node, exponent_map);
src_node = create_buffer_source_node (graph, exponent_map);
gegl_node_connect_to (src_node, "output", node, "aux2");
}
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Oilify"),
node);
g_object_unref (node);
graph);
g_object_unref (graph);
}
else
success = FALSE;
......
......@@ -2979,6 +2979,7 @@ HELP
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GeglNode *graph;
GeglNode *node;
node = gegl_node_new_child (NULL,
......@@ -2988,24 +2989,26 @@ HELP
"exponent", exponent,
NULL);
graph = wrap_in_graph (node);
if (mask_size_map)
{
GeglNode *src_node;
src_node = create_buffer_source_node (node, mask_size_map);
src_node = create_buffer_source_node (graph, mask_size_map);
gegl_node_connect_to (src_node, "output", node, "aux");
}
if (exponent_map)
{
GeglNode *src_node;
src_node = create_buffer_source_node (node, exponent_map);
src_node = create_buffer_source_node (graph, exponent_map);
gegl_node_connect_to (src_node, "output", node, "aux2");
}
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Oilify"),
node);
g_object_unref (node);
graph);
g_object_unref (graph);
}
else
success = FALSE;
......@@ -5066,6 +5069,29 @@ CODE
}
$extra{app}->{code} = <<'CODE';
static GeglNode *
wrap_in_graph (GeglNode *node)
{
GeglNode *new_node;
GeglNode *input;
GeglNode *output;
new_node = gegl_node_new ();
gegl_node_add_child (new_node, node);
g_object_unref (node);
input = gegl_node_get_input_proxy (new_node, "input");
output = gegl_node_get_output_proxy (new_node, "output");
gegl_node_link_many (input,
node,
output,
NULL);
return new_node;
}
static GeglNode *
wrap_in_selection_bounds (GeglNode *node,
GimpDrawable *drawable)
......@@ -5218,6 +5244,7 @@ bump_map (GimpDrawable *drawable,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GeglNode *graph;
GeglNode *node;
GeglNode *src_node;
......@@ -5236,14 +5263,16 @@ bump_map (GimpDrawable *drawable,
"ambient", ambient,
NULL);
src_node = create_buffer_source_node (node, bump_map);
graph = wrap_in_graph (node);
src_node = create_buffer_source_node (graph, bump_map);
gegl_node_connect_to (src_node, "output", node, "aux");
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Bump Map"),
node);
g_object_unref (node);
graph);
g_object_unref (graph);
return TRUE;
}
......@@ -5270,6 +5299,7 @@ displace (GimpDrawable *drawable,
{
if (do_x || do_y)
{
GeglNode *graph;
GeglNode *node;
GeglAbyssPolicy abyss_policy = GEGL_ABYSS_NONE;
......@@ -5295,24 +5325,26 @@ displace (GimpDrawable *drawable,
"amount_y", amount_y,
NULL);
graph = wrap_in_graph (node);
if (do_x)
{
GeglNode *src_node;
src_node = create_buffer_source_node (node, displace_map_x);
src_node = create_buffer_source_node (graph, displace_map_x);
gegl_node_connect_to (src_node, "output", node, "aux");
}
if (do_y)
{
GeglNode *src_node;
src_node = create_buffer_source_node (node, displace_map_y);
src_node = create_buffer_source_node (graph, displace_map_y);
gegl_node_connect_to (src_node, "output", node, "aux2");
}
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Displace"),
node);
g_object_unref (node);
graph);
g_object_unref (graph);
}
return TRUE;
......
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