Commit 2d86bac
[hd, hdsi, hdGp] Scene index plugin ordering via JSON metadata
This change introduces a JSON metadata-based system for declaring scene index plugin ordering, as an alternative and improvement to the existing C++ registration API.
It lays the groundwork for eventually deprecating the C++ registration API in favor of a more declarative, data-driven approach.
Plugins can now declare ordering constraints directly in their plugInfo.json via the following new fields:
- tags - a list of semantic labels for a plugin (the plugin's own ID is added as a default tag)
- ordering.before / ordering.after - tag-based constraints specifying which groups of plugins this plugin must come before or after
- ordering.position - a tiebreaker within the unconstrained middle group (firstAfter, lastBefore, doesNotMatter)
A new PluginOrderingPolicy enum controls which ordering mechanism is active:
- CppRegistrationOnly (default) - preserves existing behavior, uses C++ insertion phase/order
- JsonMetadataOnly - uses JSON metadata exclusively
- Hybrid - attempts to honor both C++ registration order and JSON metadata constraints
When using JsonMetadataOnly or Hybrid, ordering constraints are resolved using a topological sort (Kahn's algorithm).
The default policy can be set via the env var HD_SCENE_INDEX_PLUGIN_ORDERING_POLICY_DEFAULT.
It can also be set programmatically via SetPluginOrderingPolicy(), but this API is intended for testing purposes.
Additionally, this change addresses a latent bug wherein the app name was used as a filter for plugin loading, but not when gathering the plugin entries.
Callouts:
Previously, plugins could use an env var to guard C++ registration causing the plugin to be excluded when creating the scene index plugin graph. Plugins should now also use the guard in _AppendSceneIndex so that the input scene is returned if the plugin shouldn't have an effect. See changes in hdsi/hdGp for examples.
Testing:
Updated testHdSceneIndexPluginRegistry to exercise all 3 ordering policies.
(Internal change: 2398753)1 parent 7f4bfb0 commit 2d86bac
10 files changed
Lines changed: 1120 additions & 115 deletions
File tree
- pxr/imaging
- hdGp
- hdsi
- hd
- testenv
- testHdSceneIndexPluginRegistry
- clean
- coffee
- omelette
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
0 commit comments