ImageEngine/gaffer — pull request #1120 by johnhaddon (2014-12-11 15:52:40+00:00)
Title: Plug presets metadata

This allows preset values for plugs to be defined via metadata. Presets are made available via the right click menu on all plug widgets, and also by a new `PresetsPlugValueWidget` which is equivalent to the existing `EnumPlugValueWidget`, but driven by metadata.

This has several purposes :

- Allow config files to add additional presets. Since Metadata values can be callables, this also allows the creation of dynamic presets like "Current time", or "The frame range for this shot", where the preset value is only calculated when it is requested.
- Provide a basis for allowing presets and dropdown menus to be defined by the `UIEditor`
- Provide a basis for migrating some of the existing RSL annotations code to something more central, usable by OSL etc
- Allow us to generate documentation for presets automatically

Ideally we would now replace all use of `EnumPlugValueWidget`, but I haven't done that in this pull request. First, I'd like to define a new Metadata method which is sufficient to provide all the metadata for a node and its plugs in one call. Otherwise I'll be transcribing loads of EnumPlugValueWidget calls into individual metadata calls per preset, which won't be very readable. And then I'll have to transcribe them all again when we make a nice one-shot readable metadata method.

I'd like to make a new ticket for this latter task, and as part of it add test cases asserting that every node and plug is documented. Sound OK? I think we could do with a little drive to at least make sure we have complete reference documentation even if we're lacking in tutorials etc.