[gimp] Issue #4204 - "Add Bevel" Has No Effect
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #4204 - "Add Bevel" Has No Effect
- Date: Tue, 7 Jan 2020 08:53:17 +0000 (UTC)
commit 8b7bafa43aea69883643ec97b8c2b3cb1cc79238
Author: Ell <ell_se yahoo com>
Date: Tue Jan 7 10:40:15 2020 +0200
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
afdd57313627fa3b367f62ead7b7b15fc53e644e, except that we now pass
the parent node to gimp_drawable_apply_operation(), instead of the
op node).
app/pdb/plug-in-compat-cmds.c | 54 ++++++++++++++++++++++++++++++++++---------
pdb/groups/plug_in_compat.pdb | 54 ++++++++++++++++++++++++++++++++++---------
2 files changed, 86 insertions(+), 22 deletions(-)
---
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index a6b65da751..0074d361db 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -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;
diff --git a/pdb/groups/plug_in_compat.pdb b/pdb/groups/plug_in_compat.pdb
index 8f498557d8..9f5d9a700d 100644
--- a/pdb/groups/plug_in_compat.pdb
+++ b/pdb/groups/plug_in_compat.pdb
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]