mirror of https://github.com/GNOME/gimp.git
libgimp*, plug-ins: filter ID are now usable in script-fu.
Marshalled PDB procedures into script-fu can now convert a filter ID into the proper object. For instance, here would be the code to append a new gaussian blur filter to the drawable with ID 2 (with specific settings), then making invisible: ```script-fu (define filter (gimp-drawable-append-new-filter 2 "gegl:gaussian-blur" "hello" LAYER-MODE-COLOR-ERASE 1.0 "std-dev-x" 20 "abyss-policy" "none")) (gimp-drawable-filter-set-visible filter FALSE) (gimp-drawable-update 2 0 0 -1 -1) ```
This commit is contained in:
parent
39df978c2c
commit
e5134e67aa
|
@ -290,6 +290,11 @@ _gimp_gp_param_def_to_param_spec (const GPParamDef *param_def)
|
||||||
return gimp_param_spec_path (name, nick, blurb,
|
return gimp_param_spec_path (name, nick, blurb,
|
||||||
param_def->meta.m_id.none_ok,
|
param_def->meta.m_id.none_ok,
|
||||||
flags);
|
flags);
|
||||||
|
|
||||||
|
if (! strcmp (param_def->type_name, "GimpParamDrawableFilter"))
|
||||||
|
return gimp_param_spec_drawable_filter (name, nick, blurb,
|
||||||
|
param_def->meta.m_id.none_ok,
|
||||||
|
flags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GP_PARAM_DEF_TYPE_ID_ARRAY:
|
case GP_PARAM_DEF_TYPE_ID_ARRAY:
|
||||||
|
@ -585,6 +590,14 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
|
||||||
|
|
||||||
param_def->meta.m_id.none_ok = ispec->none_ok;
|
param_def->meta.m_id.none_ok = ispec->none_ok;
|
||||||
}
|
}
|
||||||
|
else if (GIMP_IS_PARAM_SPEC_DRAWABLE_FILTER (pspec))
|
||||||
|
{
|
||||||
|
GimpParamSpecDrawableFilter *fspec = GIMP_PARAM_SPEC_DRAWABLE_FILTER (pspec);
|
||||||
|
|
||||||
|
param_def->param_def_type = GP_PARAM_DEF_TYPE_ID;
|
||||||
|
|
||||||
|
param_def->meta.m_id.none_ok = fspec->none_ok;
|
||||||
|
}
|
||||||
else if (pspec_type == GIMP_TYPE_PARAM_DISPLAY)
|
else if (pspec_type == GIMP_TYPE_PARAM_DISPLAY)
|
||||||
{
|
{
|
||||||
GimpParamSpecDisplay *ispec = GIMP_PARAM_SPEC_DISPLAY (pspec);
|
GimpParamSpecDisplay *ispec = GIMP_PARAM_SPEC_DISPLAY (pspec);
|
||||||
|
|
|
@ -310,21 +310,22 @@ gimp_config_param_spec_duplicate (GParamSpec *pspec)
|
||||||
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
||||||
const gchar *type_name = g_type_name (value_type);
|
const gchar *type_name = g_type_name (value_type);
|
||||||
|
|
||||||
if (value_type == G_TYPE_FILE ||
|
if (value_type == G_TYPE_FILE ||
|
||||||
/* These types are not visibile in libgimpconfig so we compare
|
/* These types are not visibile in libgimpconfig so we compare
|
||||||
* with type names instead.
|
* with type names instead.
|
||||||
*/
|
*/
|
||||||
g_strcmp0 (type_name, "GimpImage") == 0 ||
|
g_strcmp0 (type_name, "GimpImage") == 0 ||
|
||||||
g_strcmp0 (type_name, "GimpDisplay") == 0 ||
|
g_strcmp0 (type_name, "GimpDisplay") == 0 ||
|
||||||
g_strcmp0 (type_name, "GimpDrawable") == 0 ||
|
g_strcmp0 (type_name, "GimpDrawable") == 0 ||
|
||||||
g_strcmp0 (type_name, "GimpLayer") == 0 ||
|
g_strcmp0 (type_name, "GimpLayer") == 0 ||
|
||||||
g_strcmp0 (type_name, "GimpGroupLayer") == 0 ||
|
g_strcmp0 (type_name, "GimpGroupLayer") == 0 ||
|
||||||
g_strcmp0 (type_name, "GimpTextLayer") == 0 ||
|
g_strcmp0 (type_name, "GimpTextLayer") == 0 ||
|
||||||
g_strcmp0 (type_name, "GimpChannel") == 0 ||
|
g_strcmp0 (type_name, "GimpChannel") == 0 ||
|
||||||
g_strcmp0 (type_name, "GimpItem") == 0 ||
|
g_strcmp0 (type_name, "GimpItem") == 0 ||
|
||||||
g_strcmp0 (type_name, "GimpLayerMask") == 0 ||
|
g_strcmp0 (type_name, "GimpLayerMask") == 0 ||
|
||||||
g_strcmp0 (type_name, "GimpSelection") == 0 ||
|
g_strcmp0 (type_name, "GimpSelection") == 0 ||
|
||||||
g_strcmp0 (type_name, "GimpPath") == 0)
|
g_strcmp0 (type_name, "GimpPath") == 0 ||
|
||||||
|
g_strcmp0 (type_name, "GimpDrawableFilter") == 0)
|
||||||
{
|
{
|
||||||
copy = g_param_spec_object (name, nick, blurb,
|
copy = g_param_spec_object (name, nick, blurb,
|
||||||
value_type,
|
value_type,
|
||||||
|
|
|
@ -1024,6 +1024,33 @@ script_fu_marshal_arg_to_value (scheme *sc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (GIMP_VALUE_HOLDS_DRAWABLE_FILTER (value))
|
||||||
|
{
|
||||||
|
if (! sc->vptr->is_number (arg_val))
|
||||||
|
{
|
||||||
|
return script_type_error (sc, "numeric", arg_index, proc_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gint id;
|
||||||
|
|
||||||
|
id = sc->vptr->ivalue (arg_val);
|
||||||
|
|
||||||
|
if (gimp_drawable_filter_id_is_valid (id))
|
||||||
|
{
|
||||||
|
GimpDrawableFilter *filter = gimp_drawable_filter_get_by_id (id);
|
||||||
|
|
||||||
|
g_value_set_object (value, filter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Filter ID is invalid.
|
||||||
|
* Usually 0 or -1, passed for a nullable arg.
|
||||||
|
*/
|
||||||
|
g_value_set_object (value, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (GIMP_VALUE_HOLDS_INT32_ARRAY (value))
|
else if (GIMP_VALUE_HOLDS_INT32_ARRAY (value))
|
||||||
{
|
{
|
||||||
vector = arg_val;
|
vector = arg_val;
|
||||||
|
|
Loading…
Reference in New Issue