Skip to content

Conversation

@garyo
Copy link
Contributor

@garyo garyo commented Aug 28, 2024

  • include/ofx-props.yml is the property reference/metadata
  • scripts/gen-props.py is the checker and source generator

All props are included in the YML definition, and the script generates C++ files with all the property metadata and suite assignments. The C++ files aren't yet checked in, but you can build them easily: python scripts/gen-props.py -v and then look in include/gen_*.hxx.

Copy link

@abizeauMaxon abizeauMaxon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That super! I see a lot of good thing here! Will be helpfull with time.

std::vector<const char *> values; // for enums
};

const std::vector<struct PropsMetadata> props_metadata {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this it auto generated, you could consider std::array<struct PropsMetadata, N=FeedByScrip>.

If this header is intended to be use more C++, you should consider having this std::array as constexpr.

maybe:

#if defined(__cplusplus)
#define CONST_SPECIFIER constexpr
#else
#define CONST_SPECIFIER const
#endif

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @abizeauMaxon -- totally agreed. As per discussion at the TSC today, I've moved these into Support/include and they are 100% C++. I used fixed-size std::arrays where possible, as well as some other updates and cleanups. More feedback will be helpful; let me know if you try it out.

int dimension;
Writable writable;
bool host_optional;
std::vector<const char *> values; // for enums

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be consistant, if you use std::string for name, you should also use std::vector<std::string>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried now to move to char *, to avoid allocations where possible during startup. I should move to std::string_view in some places. I'll do that.


namespace OpenFX {
// Properties for property sets
const std::map<const char *, std::vector<const char *>> prop_sets {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, here you should consider consistency, pick std::string or const char*

@@ -0,0 +1,1508 @@
########################################################################

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this auto generated? If so maybe add it into the header

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ofx-props.yml is hand-created -- it's now the source of truth for all info about properties and property sets. That's the lion's share of the work in this PR (and probably the source of remaining bugs, where I may have gotten some stuff wrong). None of this info was machine-readable before, so I extracted it from the docs and header file comments.

@garyo garyo marked this pull request as ready for review October 1, 2024 16:22
@garyo garyo force-pushed the props-metadata branch 2 times, most recently from a758e36 to f62c4be Compare March 26, 2025 20:47
@garyo garyo mentioned this pull request Mar 26, 2025
17 tasks
@garyo garyo moved this to Upcoming Meeting Agenda Items in TSC Meeting Agenda May 6, 2025
@garyo garyo force-pushed the props-metadata branch from aba1423 to 1e69304 Compare May 6, 2025 19:44
@garyo garyo changed the title Add property checker/metadata system Add property checker/metadata system and C++ helpers May 6, 2025
garyo added 14 commits October 13, 2025 13:45
* include/ofx-props.yml is the property reference/metadata
* scripts/gen-props.py is the checker and source generator

All props are included in the YML definition, and the script generates
C++ files with all the property metadata and suite assignments.

Signed-off-by: Gary Oberbrunner <[email protected]>
Also include them into prop tester plugin, to test whether they
compile properly. TODO: prop tester should use the metadata to do
better tests.

Signed-off-by: Gary Oberbrunner <[email protected]>
The strings are the true spec, not the #define names. This also adds a
set of static_assert tests to ensure the #define names match their
strings. But doing this brought up that there are some mismatches
between the strings and their #defines. Those will be accounted for
in a following commit.

Signed-off-by: Gary Oberbrunner <[email protected]>
See `get_cname` and `find_stringname` in gen-props.py, and the new
`cname` member of the props metadata.

Signed-off-by: Gary Oberbrunner <[email protected]>
Replaced a vector with a std::array for reduced memory & startup time.
Also add static_assert checks for all action names vs. their #defines.

Signed-off-by: Gary Oberbrunner <[email protected]>
Also separate out Actions from prop sets in ofx-props.yml, for
cleanliness.

Signed-off-by: Gary Oberbrunner <[email protected]>
garyo added 13 commits October 13, 2025 13:45
Update testProperties sample to use it (WIP)

Signed-off-by: Gary Oberbrunner <[email protected]>
Signed-off-by: Gary Oberbrunner <[email protected]>
- New script gen-props-doc.py to generate RST doc for all props and
  prop sets
  - Generated docs are checked in, just like the generated props
    headers.
- Use it in Documentation/build.sh
- Fix some other doc I noticed along the way

Signed-off-by: Gary Oberbrunner <[email protected]>
Also cleaned up a few doc typos I noticed.

Signed-off-by: Gary Oberbrunner <[email protected]>
- Added to ofx-props.yml
- Ran gen-props.py script to update property set headers

Signed-off-by: Gary Oberbrunner <[email protected]>
garyo added 6 commits October 13, 2025 18:22
Switch to using spans in a few places where it makes sense, mostly
for property type arrays.

Signed-off-by: Gary Oberbrunner <[email protected]>
Hosts can set up properties in their own namespaces and give plugins
type-safe access just like built-in properties.

Signed-off-by: Gary Oberbrunner <[email protected]>
To be extended to all standard prop sets

Signed-off-by: Gary Oberbrunner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Upcoming Meeting Agenda Items

Development

Successfully merging this pull request may close these issues.

3 participants