RSS/Atom feed Twitter
Site is read-only, email is disabled

Improvements to operation API with arbitrary property metadata

This discussion is connected to the gegl-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

1 of 1 message available
Toggle history

Please log in to manage your subscriptions.

Improvements to operation API with arbitrary property metadata Øyvind Kolås 15 May 01:48
Øyvind Kolås
2014-05-15 01:48:51 UTC (over 10 years ago)

Improvements to operation API with arbitrary property metadata

The autogenerated UIs for GEGL operations work well; but for many operations additional information about how to render/group/pre-initialize defaults not based on storage type but depending on
the property role as control data for the operation.

The first time such data was needed; an additional paramspec sub-type was added for integer/double, with three more arguments. The list of number arguments, with only their position to rely on is already a bit unreadable with the gobject param_spec construction api with three numbers.

I've added the ability to store arbitrary meta-data in form of string based key/values. As well as an alternative to gegl-chant.h which is called gegl-op.h, which also cleans up some of the API naming mistakes in gegl-chant.

The minimum declaration of a double property with the new system is:

gegl_property_double (name, NULL)

Arguments mandatory for gegl_chant_double_ui are optional, the above declaration is the equivalent to:

gegl_property_double( property_name,
"nick", "property_name",
"min", G_MINDOUBLE,
"max", G_MAXDOUBLE,
"default", 0.0,
"ui-min", -100.0, (or min, if -100 is below min) "ui-max", 100.0, (or max, if 100 is above max) "ui-gamma", 1.0,
"blurb", "",
NULL)

I am considering to rename/alias "nick" and "blurb" to "label" and "description", that would be better names - but inconsistent with how they are named in the GParamSpec APIs. Some fatal runtime errors can occur with missing commas, this would be discovered by developers when creating the op - and I consider conciseness/readability of this API more important than compile-time checks (.. when we've got out of process ops working this would at least not bring down applications).

To test the API, the following ops have been ported to use gegl-op.h instead of gegl-chant.h: threshold, emboss, panorama-projection, checkerboard, color, noise-rgb, layer, brightness-contrast and plasma.

Commit 9c50b32f6a2d76cb683585f2d96143d026616699 shows how the change from gegl-chant.h to gegl-op.h affected the panorama VR rendering operation; git master passes make check locally with me; but these changes for some reason trips up jenkins.

Additional string based key/value pairs can be added, and later queried by GIMP or other applications, some already identified needs are:

-hiding internal/scripting specific properties from the UI and/or docs -specifying that a color should default to current foreground/background -linking a property to canvas/drawable width/height (and maybe hiding it) -specifying that a string should be shown in a multi-line editor instead of a single-line text entry (replacing the current gparamspec with the specific purpose.)
-specifying that properties should be grouped or even linked -specifying the units for a value (degrees/pixels/percentage if one has special input types)

How to encode this in key/value pairs isn't decided yet; and more uses will surface - the API should cover these uses and more.

/pippin