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 commitafdd573136
, except that we now pass the parent node to gimp_drawable_apply_operation(), instead of the op node). (cherry picked from commit8b7bafa43a
)
This commit is contained in:
@ -61,6 +61,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;
|
||||
@ -3085,6 +3114,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,
|
||||
@ -3094,24 +3124,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;
|
||||
|
@ -3072,6 +3072,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,
|
||||
@ -3081,24 +3082,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;
|
||||
@ -5023,6 +5026,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)
|
||||
@ -5174,6 +5200,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;
|
||||
|
||||
@ -5192,14 +5219,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;
|
||||
}
|
||||
@ -5226,6 +5255,7 @@ displace (GimpDrawable *drawable,
|
||||
{
|
||||
if (do_x || do_y)
|
||||
{
|
||||
GeglNode *graph;
|
||||
GeglNode *node;
|
||||
GeglAbyssPolicy abyss_policy = GEGL_ABYSS_NONE;
|
||||
|
||||
@ -5251,24 +5281,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;
|
||||
|
Reference in New Issue
Block a user