Skip to content

Commit 6be0d29

Browse files
committed
Move property metadata from YAML into inline @propdef blocks in headers
Also move property sets and actions from YAML into inline @propset, @propsetdef, and @actiondef blocks in headers. Consolidate property metadata (type, dimension, values, defaults, etc.) from the separate ofx-props.yml file into @propdef YAML blocks within each property's doxygen comment in the C headers. This keeps metadata next to the code it describes, reducing maintenance burden. - Add scripts/ofx_prop_utils.py: shared parser for @propdef blocks - Migrate 182 properties across 10 headers with inline @propdef blocks - Update gen-props.py and gen-props-doc.py to read from headers - Delete properties section from ofx-props.yml (1348 -> 609 lines) - Delete legacy doc generator (genPropertiesReference.py) - Delete unused property_links Sphinx extension - Simplify Documentation/build.sh and conf.py This eliminates the YAML file entirely. All property metadata is now co-located with the code it describes. Generated C++ headers (ofxPropsMetadata.h, ofxPropsBySet.h, etc.) are verified identical before and after migration, except for a few additions noted during the migration, namely propset assignments and action args for ThumbnailRender and CPURenderSupported. The format for @propdef, @propsetdef and @actiondef sections is documented in Documentation/README.md. This commit also improves the generated doc sections and removes the old out-of-date property reference. Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
1 parent a21ac88 commit 6be0d29

30 files changed

Lines changed: 2707 additions & 3155 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ cmake-build.log
1717
build*/
1818
build.log
1919
.cache/
20+
__pycache__
21+
.claude/
22+
uv.lock
2023

2124
xcuserdata
2225

Documentation/README.md

Lines changed: 136 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The OpenFX documentation system combines several tools:
99
1. **Doxygen** - Parses C/C++ header files in the `include` directory to extract API documentation from comments
1010
2. **Breathe** - A Sphinx extension that bridges Doxygen XML output with Sphinx
1111
3. **Sphinx** - Processes ReStructured Text (.rst) files and Doxygen output to generate the final HTML documentation
12-
4. **Python scripts** - Custom scripts like `genPropertiesReference.py` extract property definitions from source files
12+
4. **Python scripts** - `scripts/gen-props.py` generates C++ metadata headers; `scripts/gen-props-doc.py` generates RST reference pages from inline metadata in the headers
1313

1414
The documentation is organized into:
1515
- **Reference manual** - API documentation generated from Doxygen comments in the header files
@@ -43,11 +43,10 @@ cd Documentation
4343

4444
This script performs the following steps:
4545

46-
1. Generates property references using `genPropertiesReference.py`
47-
2. Generates property documentation from YAML definitions using `scripts/gen-props-doc.py`
48-
3. Builds Doxygen documentation from the header files
49-
4. Uses Breathe to collect Doxygen API docs
50-
5. Builds the final HTML documentation with Sphinx
46+
1. Generates property and property-set RST reference pages from inline `@propdef`/`@propset` metadata using `scripts/gen-props-doc.py`
47+
2. Builds Doxygen documentation from the header files (using `include/doxy-filter.sh` to strip metadata blocks)
48+
3. Uses Breathe to collect Doxygen API docs
49+
4. Builds the final HTML documentation with Sphinx
5150

5251
After building, you can view the documentation at:
5352
`file:///path/to/your/ofx/openfx/Documentation/build/index.html`
@@ -162,14 +161,138 @@ The Breathe extension bridges Doxygen and Sphinx, enabling:
162161
2. **Adding New Documentation**
163162
- For new API elements: Add Doxygen comments to header files
164163
- For new concepts/guides: Create new RST files in `sources/Guide`
165-
- For property references: They're automatically generated from headers
164+
- For property references: They're automatically generated from inline metadata in headers (see below)
166165

167-
3. **Property Documentation**
168-
- Property definitions are extracted automatically by `genPropertiesReference.py`
169-
- Format should be: `#define kOfxPropName "OfxPropName"`
170-
- Add Doxygen comments above property definitions
171-
172-
4. **Testing Changes**
166+
3. **Testing Changes**
173167
- Always build documentation locally before submitting changes
174168
- Check for warning messages during the build process
175169
- Review the HTML output to ensure proper formatting and cross-references
170+
171+
## Property and Action Metadata
172+
173+
Properties, property sets, and actions are documented using inline YAML
174+
metadata blocks embedded in doxygen comments in the C header files
175+
(`include/ofx*.h`). These blocks are parsed by `scripts/gen-props.py`
176+
(to generate C++ metadata headers) and `scripts/gen-props-doc.py` (to
177+
generate RST reference pages). A doxygen input filter
178+
(`include/doxy-filter.sh`) strips them from the doxygen output so they
179+
don't appear in the API reference HTML.
180+
181+
### `@propdef` — Property Definitions
182+
183+
A `@propdef` block goes inside the `/** ... */` doxygen comment for a
184+
property `#define`. It must appear at the **end** of the comment, just
185+
before the closing `*/`. Everything before `@propdef` is treated as
186+
the doxygen documentation; everything after it is parsed as YAML.
187+
188+
```c
189+
/** @brief Unique name of the plug-in.
190+
191+
- Type - C string X 1
192+
- Property Set - host descriptor (read only)
193+
- Valid Values - the unique name of the plug-in
194+
195+
@propdef
196+
type: string
197+
dimension: 1
198+
*/
199+
#define kOfxPropName "OfxPropName"
200+
```
201+
202+
Supported YAML fields:
203+
204+
| Field | Description | Example |
205+
|---------------|------------------------------------------------------|--------------------------------------|
206+
| `type` | Property type | `string`, `int`, `double`, `pointer`, `bool`, `enum` |
207+
| `dimension` | Number of values (integer or `N`) | `1`, `2`, `N` |
208+
| `values` | List of valid enum/string values | `["false", "true", "needed"]` |
209+
| `default` | Default value | `"false"`, `0` |
210+
| `introduced` | Version when this property was added | `"1.4"` |
211+
| `deprecated` | Version when this property was deprecated | `"1.4"` |
212+
| `cname` | Override the C macro name (rare, for misnamed props) | `kOfxImageEffectFrameVarying` |
213+
214+
### `@propset` — Property Set Definitions
215+
216+
A `@propset` block defines which properties belong to a named property
217+
set (e.g., the set of properties on an image effect descriptor). These
218+
are standalone `/** ... */` comments, not attached to a `#define`.
219+
220+
```c
221+
/** @propset EffectDescriptor
222+
write: plugin
223+
props:
224+
- OfxPropLabel
225+
- OfxPropShortLabel
226+
- OfxPluginPropFilePath | write=host
227+
- OfxImageEffectPropCPURenderSupported | host_optional=true
228+
*/
229+
```
230+
231+
- `write:` sets the default write permission (`plugin` or `host`)
232+
- Each property in `props:` can have pipe-separated modifiers:
233+
- `| write=host` — override the write permission for this property
234+
- `| host_optional=true` — mark as optional for hosts to support
235+
236+
### `@propsetdef` — Reusable Property Lists
237+
238+
When multiple property sets share a common subset of properties, use
239+
`@propsetdef` to define the shared list, then reference it with `_REF`:
240+
241+
```c
242+
/** @propsetdef ParamsCommon
243+
- OfxPropType
244+
- OfxPropName
245+
- OfxPropLabel
246+
*/
247+
248+
/** @propset IntParam
249+
write: plugin
250+
props:
251+
- ParamsCommon_REF
252+
- OfxParamPropDefault
253+
*/
254+
```
255+
256+
`ParamsCommon_REF` expands to all the properties listed in the
257+
`ParamsCommon` `@propsetdef` block.
258+
259+
### `@actiondef` — Action Argument Definitions
260+
261+
An `@actiondef` block lists the properties passed in `inArgs` and
262+
`outArgs` for an action. Like `@propdef`, it goes at the **end** of
263+
the doxygen comment, just before `*/`.
264+
265+
```c
266+
/** @brief Called when something in the instance is changed.
267+
268+
@param handle handle to the plug-in instance
269+
@param inArgs has the following properties
270+
- \ref kOfxPropType the type of the thing that changed
271+
- \ref kOfxPropName the name of the thing that changed
272+
- \ref kOfxPropChangeReason what triggered the change
273+
274+
@actiondef
275+
inArgs:
276+
- OfxPropType
277+
- OfxPropName
278+
- OfxPropChangeReason
279+
- OfxPropTime
280+
- OfxImageEffectPropRenderScale
281+
outArgs:
282+
*/
283+
#define kOfxActionInstanceChanged "OfxActionInstanceChanged"
284+
```
285+
286+
Property names in `inArgs`/`outArgs` use the string name (without the
287+
`k` prefix), matching the `@propdef` key. Use an empty value or `[]`
288+
for actions with no args on that side.
289+
290+
### Validation
291+
292+
Run `scripts/gen-props.py` to validate the metadata. It checks that:
293+
294+
- Every property with a `@propdef` is referenced in at least one
295+
`@propset` or `@actiondef`
296+
- All property names referenced in `@propset` and `@actiondef` blocks
297+
have corresponding `@propdef` definitions
298+
- No duplicate property or property set names exist

Documentation/build.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ catch() {
1717

1818
# Check for prereqs
1919

20-
if [ ! -f genPropertiesReference.py ] ; then
20+
if [ ! -f build.sh ] ; then
2121
echo "This script must be run in the Documentation directory."
2222
exit 1
2323
fi
@@ -34,14 +34,7 @@ fi
3434

3535
rm -rf build
3636

37-
# Generate references
38-
EXPECTED_ERRS="unable to resolve reference|explicit link request|found in multiple"
39-
$UV_RUN python genPropertiesReference.py \
40-
-i ../include -o sources/Reference/ofxPropertiesReference.rst -r \
41-
> /tmp/ofx-doc-build.out 2>&1
42-
grep -v -E "$EXPECTED_ERRS" /tmp/ofx-doc-build.out || true
43-
44-
# Generate property documentation from YAML definitions
37+
# Generate property documentation from inline @propdef metadata in headers
4538
cd ..
4639
if command -v uv > /dev/null 2>&1; then
4740
uv run scripts/gen-props-doc.py -v >> /tmp/ofx-doc-build.out 2>&1

Documentation/genPropertiesReference.py

Lines changed: 0 additions & 91 deletions
This file was deleted.

Documentation/sources/Reference/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ the API. The changes to the API are listed in an addendum.
3030
suites/ofxSuiteReference
3131
.. outdated:
3232
.. ofxPropertiesByObject
33-
ofxPropertiesReference
3433
ofxPropertiesReferenceGenerated
3534
ofxPropertySetsGenerated
3635
DoxygenIndex

0 commit comments

Comments
 (0)