Skip to content

Commit

Permalink
Generate list of all actions, & fix action names
Browse files Browse the repository at this point in the history
Signed-off-by: Gary Oberbrunner <[email protected]>
  • Loading branch information
garyo committed Sep 2, 2024
1 parent 3569bc7 commit dd8b1b5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
18 changes: 9 additions & 9 deletions include/ofx-props.yml
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ propertySets:
kOfxActionDestroyInstanceInteract:
inArgs:
outArgs:
kOfxActionInteractActionDraw:
kOfxInteractActionDraw:
inArgs:
- kOfxPropEffectInstance
- kOfxInteractPropDrawContext
Expand All @@ -513,7 +513,7 @@ propertySets:
- kOfxImageEffectPropRenderScale
outArgs:

kOfxActionInteractActionPenMotion:
kOfxInteractActionPenMotion:
inArgs:
- kOfxPropEffectInstance
- kOfxInteractPropPixelScale
Expand All @@ -525,7 +525,7 @@ propertySets:
- kOfxInteractPropPenPressure
outArgs:

kOfxActionInteractActionPenDown:
kOfxInteractActionPenDown:
inArgs:
- kOfxPropEffectInstance
- kOfxInteractPropPixelScale
Expand All @@ -537,7 +537,7 @@ propertySets:
- kOfxInteractPropPenPressure
outArgs:

kOfxActionInteractActionPenUp:
kOfxInteractActionPenUp:
inArgs:
- kOfxPropEffectInstance
- kOfxInteractPropPixelScale
Expand All @@ -549,7 +549,7 @@ propertySets:
- kOfxInteractPropPenPressure
outArgs:

kOfxActionInteractActionKeyDown:
kOfxInteractActionKeyDown:
inArgs:
- kOfxPropEffectInstance
- kOfxPropKeySym
Expand All @@ -558,7 +558,7 @@ propertySets:
- kOfxImageEffectPropRenderScale
outArgs:

kOfxActionInteractActionKeyUp:
kOfxInteractActionKeyUp:
inArgs:
- kOfxPropEffectInstance
- kOfxPropKeySym
Expand All @@ -567,7 +567,7 @@ propertySets:
- kOfxImageEffectPropRenderScale
outArgs:

kOfxActionInteractActionKeyRepeat:
kOfxInteractActionKeyRepeat:
inArgs:
- kOfxPropEffectInstance
- kOfxPropKeySym
Expand All @@ -576,7 +576,7 @@ propertySets:
- kOfxImageEffectPropRenderScale
outArgs:

kOfxActionInteractActionGainFocus:
kOfxInteractActionGainFocus:
inArgs:
- kOfxPropEffectInstance
- kOfxInteractPropPixelScale
Expand All @@ -585,7 +585,7 @@ propertySets:
- kOfxImageEffectPropRenderScale
outArgs:

kOfxActionInteractActionLoseFocus:
kOfxInteractActionLoseFocus:
inArgs:
- kOfxPropEffectInstance
- kOfxInteractPropPixelScale
Expand Down
27 changes: 21 additions & 6 deletions scripts/gen-props.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,23 +264,38 @@ def gen_props_by_set(props_by_set, outfile_path: Path):
namespace OpenFX {
""")
outfile.write("const std::map<std::string, std::vector<const char *>> prop_sets {\n")
outfile.write("// Properties for property sets\n")
outfile.write("const std::map<const char *, std::vector<const char *>> prop_sets {\n")
for pset in sorted(props_by_set.keys()):
if isinstance(props_by_set[pset], dict):
continue
propnames = ",\n ".join(sorted(props_by_set[pset]))
outfile.write(f"{{ \"{pset}\", {{ {propnames} }} }},\n")
outfile.write("};\n\n")

actions = sorted([pset for pset in props_by_set.keys()
if isinstance(props_by_set[pset], dict)])

outfile.write("// Actions\n")
outfile.write(f"const std::array<const char *, {len(actions)}> actions {{\n")
for pset in actions:
if not pset.startswith("kOfx"):
pset = '"' + pset + '"' # quote if it's not a known constant
outfile.write(f" {pset},\n") # use string constant
outfile.write("};\n\n")
outfile.write("const std::map<std::string, std::vector<const char *>> action_props {\n")
for pset in sorted(props_by_set.keys()):
if not isinstance(props_by_set[pset], dict): # actions have a dict of args
continue

outfile.write("// Properties for action args\n")
outfile.write("const std::map<std::array<std::string, 2>, std::vector<const char *>> action_props {\n")
for pset in actions:
for subset in props_by_set[pset]:
if not props_by_set[pset][subset]:
continue
propnames = ",\n ".join(sorted(props_by_set[pset][subset]))
outfile.write(f"{{ \"{pset}.{subset}\", {{ {propnames} }} }},\n")
if not pset.startswith("kOfx"):
psetname = '"' + pset + '"' # quote if it's not a known constant
else:
psetname = pset
outfile.write(f"{{ {{ {psetname}, \"{subset}\" }}, {{ {propnames} }} }},\n")

outfile.write("};\n} // namespace OpenFX\n")

Expand Down

0 comments on commit dd8b1b5

Please sign in to comment.