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 <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
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 <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
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 <garyo@darkstarsystems.com>
See `get_cname` and `find_stringname` in gen-props.py, and the new
`cname` member of the props metadata.

Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
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 <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Also separate out Actions from prop sets in ofx-props.yml, for
cleanliness.

Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
garyo added 13 commits October 13, 2025 13:45
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Update testProperties sample to use it (WIP)

Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
- 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 <garyo@darkstarsystems.com>
Also cleaned up a few doc typos I noticed.

Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
- Added to ofx-props.yml
- Ran gen-props.py script to update property set headers

Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
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 <garyo@darkstarsystems.com>
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 <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
To be extended to all standard prop sets

Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
@valadaptive
Copy link
Contributor

I'm interested in this PR landing, because I think the YAML could also be used to generate idiomatic Rust bindings to the OpenFX API. I maintain a video effect written in Rust that has an OpenFX plugin, and it currently uses FFI to the C headers. It'd be nice to be able to autogenerate a set of idiomatic Rust bindings.

Related to that, I have a question about the C++17 "host-extensible properties" system. As I understand it, the C++ helper is solely about adding type-safety to host-defined properties, atop the existing plugin layer defined by the C ABI. Property lookups are still done via strings, and it is still possible to use host-defined custom properties via the C API without requiring C++17. Is that correct? (Adding on to my concern is that the README for the host-extensible properties example appears to be entirely AI-generated.)

It may be good to encourage hosts to ship the .yml files used to generate the host-defined properties headers as well, since if they are in fact independent of C++, they could also be used to provide an idiomatic Rust interface to host-defined properties.

@garyo
Copy link
Contributor Author

garyo commented Dec 21, 2025

Hi @valadaptive , thanks for the interest! Enabling rust bindings (and python) were one of the original goals of this work, so I'm glad you're thinking the same way. And yes, I'm hoping hosts will ship the .yml files and not just the headers. You're right that this is just a type-safety layer on top of the C API based on using the .yaml file as the source of truth for properties and their types; nothing is changing at the C level. And yeah, I'll rewrite that header properly soon.
I'm thinking this is the beginning of a larger modern C++ layer, one that can be adopted by hosts or plugins as much or as little as needed, without buying into a whole C++ framework. I assume you'd like to see just the property layer landed soon, rather than waiting for more stuff like params, images, clips, etc.?

@valadaptive
Copy link
Contributor

I assume you'd like to see just the property layer landed soon, rather than waiting for more stuff like params, images, clips, etc.?

Yes. If it's possible to land this in stages rather than waiting for a complete overhaul, I think that would be good.

I might open an issue going over what would help for Rust bindings. I'm still experimenting and trying to come up with the best API.

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.

4 participants