Skip to content

Fix incorrect @propdef enum value names + add regression guard (#247)#250

Open
garyo wants to merge 1 commit into
mainfrom
fix/propdef-enum-values-247
Open

Fix incorrect @propdef enum value names + add regression guard (#247)#250
garyo wants to merge 1 commit into
mainfrom
fix/propdef-enum-values-247

Conversation

@garyo

@garyo garyo commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #247.

Problem

Enum properties declare their valid values in @propdef … values:. By convention each value is the string literal its value-#define expands to. Four clusters violated that, so the generated openfx-cpp metadata (ofxPropsMetadata.h enum arrays) and the generated property docs advertised valid-value strings that no host or plugin actually uses — anything validating a real value against the metadata would reject it.

The macro string values are wire/ABI and must not change (e.g. kOfxImagePreMultiplied has always been "OfxImageAlphaPremultiplied"). So this corrects only the metadata to match reality; no #define names or values are touched.

What changed

Property/cluster was (wrong) now (real macro string)
Field ×4¹ OfxImageFieldNone, …Lower, … OfxFieldNone, OfxFieldLower, …
…PropPreMultiplication OfxImagePreMultiplied, OfxImageUnPreMultiplied OfxImageAlphaPremultiplied, OfxImageAlphaUnPremultiplied
…HostPropNativeOrigin OfxImageEffectHostPropNativeOrigin{…} kOfxImageEffectHostPropNativeOrigin{…} (the literals really do start with k)
…PropColourManagementStyle OfxImageEffectPropColourManagement{…} OfxImageEffectColourManagement{…} (no "Prop")

¹ FieldOrder, PropField, FieldExtraction, FieldToRender. The true/false/needed literal enums are correct and untouched.

Regression guard

Following the codebase's existing pattern (generated static_assert(string_view("Ofx…") == string_view(kOfx…)) for every property name), gen-props.py now also:

  • emits a static_assert for every enum value (value string == its #define), so drift fails to compile; and
  • aborts generation if an Ofx-prefixed enum value names no macro — the typo class that can't be expressed as an assert. Verified: reintroducing OfxImagePreMultiplied makes gen-props.py exit 1 with a clear message.

Also removed dead nonProperties entries in gen-props.py that listed misspelled (extra-"Prop") ColourManagement value macros which never existed; the real value macros contain no "Prop" so were never collected. Confirmed byte-identical output.

Generated / regenerated

  • openfx-cpp/include/openfx/ofxPropsMetadata.h — corrected enum arrays + new per-value asserts.
  • Documentation/.../ofxPropertiesReferenceGenerated.rst, ofxPropertySetsGenerated.rst — corrected value lists. The doc regen also picks up kOfxImageEffectPluginPropObsolete, whose generated docs were already stale on main (incidental, unrelated to Incorrect @propdef enum value names. #247).

Validation

  • gen-props.py and gen-props-doc.py both run clean and are idempotent.
  • Negative test: a reintroduced bad value aborts the generator (exit 1).
  • No header #define names or string values changed → no ABI impact.

🤖 Generated with Claude Code

…#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>
@garyo garyo force-pushed the fix/propdef-enum-values-247 branch from bc47102 to 759c396 Compare June 30, 2026 16:03
@garyo garyo moved this to Upcoming Meeting Agenda Items in TSC Meeting Agenda Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Upcoming Meeting Agenda Items

Development

Successfully merging this pull request may close these issues.

Incorrect @propdef enum value names.

1 participant