Skip to content

Commit 759c396

Browse files
garyoclaude
andcommitted
Fix incorrect @propdef enum value names and guard against regressions (#247)
Several enum properties listed @propdef `values:` that did not match the actual string literals their value #defines expand to, so the generated openfx-cpp metadata advertised valid-value strings no host or plugin ever uses. The macro string values are ABI and are left untouched; only the metadata is corrected to match them: - Field props (FieldOrder, PropField, FieldExtraction, FieldToRender): OfxImageField* -> OfxField* (kOfxImageFieldNone == "OfxFieldNone") - PreMultiplication: OfxImage{,Un}PreMultiplied -> OfxImageAlpha{,Un}Premultiplied - HostPropNativeOrigin: add the leading "k" the string literals actually have (kOfxHostNativeOriginBottomLeft == "kOfxImageEffectHostProp...") - ColourManagementStyle: drop the erroneous "Prop" (kOfxImageEffectColourManagementNone == "OfxImageEffectColourManagementNone") The three irregularly-named value clusters (Field, PreMultiplication, NativeOrigin) get a header comment noting the name/value mismatch is ABI-locked and must not be copied as an example. (ColourManagementStyle is conventionally named; only its @propdef had a typo.) Guard: gen-props.py now emits a static_assert for every enum value (value string == its #define), mirroring the existing per-property asserts, and aborts generation if an `Ofx`-prefixed value names no macro. A reintroduced typo therefore fails the generator and, failing that, fails to compile. Verified by reintroducing a bad value. Also removed dead `nonProperties` entries in gen-props.py that excluded misspelled (extra-"Prop") ColourManagement value macros which never existed; the real value macros contain no "Prop" and were never collected as properties. Output is byte-identical. Regenerated openfx-cpp metadata and the property reference docs. The docs regen also picks up kOfxImageEffectPluginPropObsolete, whose generated docs were stale on main. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
1 parent 9943cdf commit 759c396

6 files changed

Lines changed: 251 additions & 72 deletions

File tree

Documentation/sources/Reference/ofxPropertiesReferenceGenerated.rst

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ Integer (Boolean) Properties
112112
- **Used in Property Sets**: :ref:`EffectDescriptor <propset_EffectDescriptor>` (plugin)
113113
- **Doc**: For detailed doc, see :c:macro:`kOfxImageEffectPluginPropHostFrameThreading`.
114114

115+
.. _prop_OfxImageEffectPluginPropObsolete:
116+
117+
**OfxImageEffectPluginPropObsolete**
118+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119+
120+
- **C #define**: :c:macro:`kOfxImageEffectPluginPropObsolete`
121+
- **Type**: bool
122+
- **Dimension**: 1
123+
- **Used in Property Sets**: :ref:`EffectDescriptor <propset_EffectDescriptor>` (plugin)
124+
- **Doc**: For detailed doc, see :c:macro:`kOfxImageEffectPluginPropObsolete`.
125+
115126
.. _prop_OfxImageEffectPluginPropSingleInstance:
116127

117128
**OfxImageEffectPluginPropSingleInstance**
@@ -957,12 +968,12 @@ Enumeration Properties
957968
- **Dimension**: 1
958969
- **Used in Property Sets**: :ref:`ClipDescriptor <propset_ClipDescriptor>` (plugin), :ref:`ClipInstance <propset_ClipInstance>` (host)
959970
- **Valid Values**:
960-
- ``OfxImageFieldNone``
961-
- ``OfxImageFieldLower``
962-
- ``OfxImageFieldUpper``
963-
- ``OfxImageFieldBoth``
964-
- ``OfxImageFieldSingle``
965-
- ``OfxImageFieldDoubled``
971+
- ``OfxFieldNone``
972+
- ``OfxFieldLower``
973+
- ``OfxFieldUpper``
974+
- ``OfxFieldBoth``
975+
- ``OfxFieldSingle``
976+
- ``OfxFieldDoubled``
966977
- **Doc**: For detailed doc, see :c:macro:`kOfxImageClipPropFieldExtraction`.
967978

968979
.. _prop_OfxImageClipPropFieldOrder:
@@ -975,9 +986,9 @@ Enumeration Properties
975986
- **Dimension**: 1
976987
- **Used in Property Sets**: :ref:`ClipInstance <propset_ClipInstance>` (host)
977988
- **Valid Values**:
978-
- ``OfxImageFieldNone``
979-
- ``OfxImageFieldLower``
980-
- ``OfxImageFieldUpper``
989+
- ``OfxFieldNone``
990+
- ``OfxFieldLower``
991+
- ``OfxFieldUpper``
981992
- **Doc**: For detailed doc, see :c:macro:`kOfxImageClipPropFieldOrder`.
982993

983994
.. _prop_OfxImageClipPropUnmappedComponents:
@@ -1023,9 +1034,9 @@ Enumeration Properties
10231034
- **Dimension**: 1
10241035
- **Used in Property Sets**: :ref:`ImageEffectHost <propset_ImageEffectHost>` (host)
10251036
- **Valid Values**:
1026-
- ``OfxImageEffectHostPropNativeOriginBottomLeft``
1027-
- ``OfxImageEffectHostPropNativeOriginTopLeft``
1028-
- ``OfxImageEffectHostPropNativeOriginCenter``
1037+
- ``kOfxImageEffectHostPropNativeOriginBottomLeft``
1038+
- ``kOfxImageEffectHostPropNativeOriginTopLeft``
1039+
- ``kOfxImageEffectHostPropNativeOriginCenter``
10291040
- **Doc**: For detailed doc, see :c:macro:`kOfxImageEffectHostPropNativeOrigin`.
10301041

10311042
.. _prop_OfxImageEffectPluginRenderThreadSafety:
@@ -1068,11 +1079,11 @@ Enumeration Properties
10681079
- **Dimension**: 1
10691080
- **Used in Property Sets**: :ref:`EffectDescriptor <propset_EffectDescriptor>` (plugin), :ref:`EffectInstance <propset_EffectInstance>` (host), :ref:`ImageEffectHost <propset_ImageEffectHost>` (host)
10701081
- **Valid Values**:
1071-
- ``OfxImageEffectPropColourManagementNone``
1072-
- ``OfxImageEffectPropColourManagementBasic``
1073-
- ``OfxImageEffectPropColourManagementCore``
1074-
- ``OfxImageEffectPropColourManagementFull``
1075-
- ``OfxImageEffectPropColourManagementOCIO``
1082+
- ``OfxImageEffectColourManagementNone``
1083+
- ``OfxImageEffectColourManagementBasic``
1084+
- ``OfxImageEffectColourManagementCore``
1085+
- ``OfxImageEffectColourManagementFull``
1086+
- ``OfxImageEffectColourManagementOCIO``
10761087
- **Introduced in**: version 1.5
10771088
- **Doc**: For detailed doc, see :c:macro:`kOfxImageEffectPropColourManagementStyle`.
10781089

@@ -1147,10 +1158,10 @@ Enumeration Properties
11471158
- **Type**: enum
11481159
- **Dimension**: 1
11491160
- **Valid Values**:
1150-
- ``OfxImageFieldNone``
1151-
- ``OfxImageFieldBoth``
1152-
- ``OfxImageFieldLower``
1153-
- ``OfxImageFieldUpper``
1161+
- ``OfxFieldNone``
1162+
- ``OfxFieldBoth``
1163+
- ``OfxFieldLower``
1164+
- ``OfxFieldUpper``
11541165
- **Doc**: For detailed doc, see :c:macro:`kOfxImageEffectPropFieldToRender`.
11551166

11561167
.. _prop_OfxImageEffectPropMetalRenderSupported:
@@ -1255,8 +1266,8 @@ Enumeration Properties
12551266
- **Used in Property Sets**: :ref:`ClipInstance <propset_ClipInstance>` (host), :ref:`Image <propset_Image>` (host)
12561267
- **Valid Values**:
12571268
- ``OfxImageOpaque``
1258-
- ``OfxImagePreMultiplied``
1259-
- ``OfxImageUnPreMultiplied``
1269+
- ``OfxImageAlphaPremultiplied``
1270+
- ``OfxImageAlphaUnPremultiplied``
12601271
- **Doc**: For detailed doc, see :c:macro:`kOfxImageEffectPropPreMultiplication`.
12611272

12621273
.. _prop_OfxImageEffectPropSupportedComponents:
@@ -1334,10 +1345,10 @@ Enumeration Properties
13341345
- **Dimension**: 1
13351346
- **Used in Property Sets**: :ref:`Image <propset_Image>` (host)
13361347
- **Valid Values**:
1337-
- ``OfxImageFieldNone``
1338-
- ``OfxImageFieldBoth``
1339-
- ``OfxImageFieldLower``
1340-
- ``OfxImageFieldUpper``
1348+
- ``OfxFieldNone``
1349+
- ``OfxFieldBoth``
1350+
- ``OfxFieldLower``
1351+
- ``OfxFieldUpper``
13411352
- **Doc**: For detailed doc, see :c:macro:`kOfxImagePropField`.
13421353

13431354
.. _prop_OfxOpenGLPropPixelDepth:

Documentation/sources/Reference/ofxPropertySetsGenerated.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ These property sets represent collections of properties associated with various
104104
- :ref:`OfxImageEffectPluginPropFieldRenderTwiceAlways <prop_OfxImageEffectPluginPropFieldRenderTwiceAlways>` - Type: bool, Dimension: 1 (doc: :c:macro:`kOfxImageEffectPluginPropFieldRenderTwiceAlways`)
105105
- :ref:`OfxImageEffectPluginPropGrouping <prop_OfxImageEffectPluginPropGrouping>` - Type: string, Dimension: 1 (doc: :c:macro:`kOfxImageEffectPluginPropGrouping`)
106106
- :ref:`OfxImageEffectPluginPropHostFrameThreading <prop_OfxImageEffectPluginPropHostFrameThreading>` - Type: bool, Dimension: 1 (doc: :c:macro:`kOfxImageEffectPluginPropHostFrameThreading`)
107+
- :ref:`OfxImageEffectPluginPropObsolete <prop_OfxImageEffectPluginPropObsolete>` - Type: bool, Dimension: 1 (doc: :c:macro:`kOfxImageEffectPluginPropObsolete`)
107108
- :ref:`OfxImageEffectPluginPropOverlayInteractV1 <prop_OfxImageEffectPluginPropOverlayInteractV1>` - Type: pointer, Dimension: 1 (doc: :c:macro:`kOfxImageEffectPluginPropOverlayInteractV1`)
108109
- :ref:`OfxImageEffectPluginPropOverlayInteractV2 <prop_OfxImageEffectPluginPropOverlayInteractV2>` - Type: pointer, Dimension: 1 (doc: :c:macro:`kOfxImageEffectPluginPropOverlayInteractV2`)
109110
- :ref:`OfxImageEffectPluginPropSingleInstance <prop_OfxImageEffectPluginPropSingleInstance>` - Type: bool, Dimension: 1 (doc: :c:macro:`kOfxImageEffectPluginPropSingleInstance`)

include/ofxColour.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ effect instance.
5555
type: enum
5656
dimension: 1
5757
values:
58-
- OfxImageEffectPropColourManagementNone
59-
- OfxImageEffectPropColourManagementBasic
60-
- OfxImageEffectPropColourManagementCore
61-
- OfxImageEffectPropColourManagementFull
62-
- OfxImageEffectPropColourManagementOCIO
58+
- OfxImageEffectColourManagementNone
59+
- OfxImageEffectColourManagementBasic
60+
- OfxImageEffectColourManagementCore
61+
- OfxImageEffectColourManagementFull
62+
- OfxImageEffectColourManagementOCIO
6363
introduced: "1.5"
6464
*/
6565
#define kOfxImageEffectPropColourManagementStyle "OfxImageEffectPropColourManagementStyle"

include/ofxImageEffect.h

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -897,9 +897,14 @@ This property is set to indicate whether the effect is currently being rendered
897897
*/
898898
#define kOfxImageEffectPropSequentialRenderStatus "OfxImageEffectPropSequentialRenderStatus"
899899

900-
#define kOfxHostNativeOriginBottomLeft "kOfxImageEffectHostPropNativeOriginBottomLeft"
901-
#define kOfxHostNativeOriginTopLeft "kOfxImageEffectHostPropNativeOriginTopLeft"
902-
#define kOfxHostNativeOriginCenter "kOfxImageEffectHostPropNativeOriginCenter"
900+
/* NOTE: these constants are irregularly named: the macro name differs from the
901+
string value, and unusually the string value itself begins with "k" (e.g.
902+
kOfxHostNativeOriginBottomLeft is "kOfxImageEffectHostPropNativeOriginBottomLeft").
903+
The string values are fixed by ABI and cannot change. Do not copy this in new
904+
constants; values should not begin with "k". */
905+
#define kOfxHostNativeOriginBottomLeft "kOfxImageEffectHostPropNativeOriginBottomLeft"
906+
#define kOfxHostNativeOriginTopLeft "kOfxImageEffectHostPropNativeOriginTopLeft"
907+
#define kOfxHostNativeOriginCenter "kOfxImageEffectHostPropNativeOriginCenter"
903908
/** @brief Property that indicates the host native UI space - this is only a UI hint, has no impact on pixel processing
904909
905910
This property is set to kOfxHostNativeOriginBottomLeft pre V1.4 and was to be discovered by plug-ins. This is useful for drawing overlay for points... so everything matches the rest of the app (for example expression linking to other tools, or simply match the reported location of the host viewer).
@@ -912,9 +917,9 @@ This property is set to kOfxHostNativeOriginBottomLeft pre V1.4 and was to be di
912917
type: enum
913918
dimension: 1
914919
values:
915-
- OfxImageEffectHostPropNativeOriginBottomLeft
916-
- OfxImageEffectHostPropNativeOriginTopLeft
917-
- OfxImageEffectHostPropNativeOriginCenter
920+
- kOfxImageEffectHostPropNativeOriginBottomLeft
921+
- kOfxImageEffectHostPropNativeOriginTopLeft
922+
- kOfxImageEffectHostPropNativeOriginCenter
918923
*/
919924
#define kOfxImageEffectHostPropNativeOrigin "OfxImageEffectHostPropNativeOrigin"
920925

@@ -1178,14 +1183,18 @@ See the documentation on clip preferences for more details on how this is used w
11781183
dimension: 1
11791184
values:
11801185
- OfxImageOpaque
1181-
- OfxImagePreMultiplied
1182-
- OfxImageUnPreMultiplied
1186+
- OfxImageAlphaPremultiplied
1187+
- OfxImageAlphaUnPremultiplied
11831188
*/
11841189
#define kOfxImageEffectPropPreMultiplication "OfxImageEffectPropPreMultiplication"
11851190

11861191
/** Used to flag the alpha of an image as opaque */
11871192
#define kOfxImageOpaque "OfxImageOpaque"
11881193

1194+
/* NOTE: the two constants below are irregularly named: the string value differs
1195+
from the macro name (it inserts "Alpha" and changes case, e.g.
1196+
kOfxImagePreMultiplied is "OfxImageAlphaPremultiplied"). The string values are
1197+
fixed by ABI and cannot change. Do not copy this mismatch in new constants. */
11891198
/** Used to flag an image as premultiplied */
11901199
#define kOfxImagePreMultiplied "OfxImageAlphaPremultiplied"
11911200

@@ -1491,9 +1500,9 @@ This contains the duration of the plug-in effect, in frames.
14911500
type: enum
14921501
dimension: 1
14931502
values:
1494-
- OfxImageFieldNone
1495-
- OfxImageFieldLower
1496-
- OfxImageFieldUpper
1503+
- OfxFieldNone
1504+
- OfxFieldLower
1505+
- OfxFieldUpper
14971506
*/
14981507
#define kOfxImageClipPropFieldOrder "OfxImageClipPropFieldOrder"
14991508

@@ -1575,10 +1584,10 @@ Row bytes is not supported for OpenCL Images.
15751584
type: enum
15761585
dimension: 1
15771586
values:
1578-
- OfxImageFieldNone
1579-
- OfxImageFieldBoth
1580-
- OfxImageFieldLower
1581-
- OfxImageFieldUpper
1587+
- OfxFieldNone
1588+
- OfxFieldBoth
1589+
- OfxFieldLower
1590+
- OfxFieldUpper
15821591
*/
15831592
#define kOfxImagePropField "OfxImagePropField"
15841593

@@ -1607,12 +1616,12 @@ Note that if it fetches kOfxImageFieldSingle and the host stores images natively
16071616
type: enum
16081617
dimension: 1
16091618
values:
1610-
- OfxImageFieldNone
1611-
- OfxImageFieldLower
1612-
- OfxImageFieldUpper
1613-
- OfxImageFieldBoth
1614-
- OfxImageFieldSingle
1615-
- OfxImageFieldDoubled
1619+
- OfxFieldNone
1620+
- OfxFieldLower
1621+
- OfxFieldUpper
1622+
- OfxFieldBoth
1623+
- OfxFieldSingle
1624+
- OfxFieldDoubled
16161625
*/
16171626
#define kOfxImageClipPropFieldExtraction "OfxImageClipPropFieldExtraction"
16181627

@@ -1627,10 +1636,10 @@ Note that if it fetches kOfxImageFieldSingle and the host stores images natively
16271636
type: enum
16281637
dimension: 1
16291638
values:
1630-
- OfxImageFieldNone
1631-
- OfxImageFieldBoth
1632-
- OfxImageFieldLower
1633-
- OfxImageFieldUpper
1639+
- OfxFieldNone
1640+
- OfxFieldBoth
1641+
- OfxFieldLower
1642+
- OfxFieldUpper
16341643
*/
16351644
#define kOfxImageEffectPropFieldToRender "OfxImageEffectPropFieldToRender"
16361645

@@ -1672,6 +1681,10 @@ This will be in \ref PixelCoordinates
16721681
*/
16731682
#define kOfxImageEffectPropRenderWindow "OfxImageEffectPropRenderWindow"
16741683

1684+
/* NOTE: these kOfxImageField* constants are irregularly named: the macro name
1685+
contains "Image" but the string value does not (e.g. kOfxImageFieldNone is
1686+
"OfxFieldNone", not "OfxImageFieldNone"). The string values are fixed by ABI
1687+
and cannot change. Do not copy this name/value mismatch in new constants. */
16751688
/** String used to label imagery as having no fields */
16761689
#define kOfxImageFieldNone "OfxFieldNone"
16771690
/** String used to label the lower field (scan lines 0,2,4...) of fielded imagery */

0 commit comments

Comments
 (0)