vcti-usd-schema-model-catalog 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vcti_usd_schema_model_catalog-0.2.0/LICENSE +8 -0
- vcti_usd_schema_model_catalog-0.2.0/PKG-INFO +242 -0
- vcti_usd_schema_model_catalog-0.2.0/README.md +213 -0
- vcti_usd_schema_model_catalog-0.2.0/pyproject.toml +97 -0
- vcti_usd_schema_model_catalog-0.2.0/setup.cfg +4 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/__init__.py +152 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/authoring.py +145 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/catalog.py +196 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/declarations.py +109 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/fixtures.py +195 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/plugin/generatedSchema.usda +41 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/plugin/plugInfo.json +31 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/plugin/schema.usda +26 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/py.typed +0 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/registry.py +38 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/stage.py +87 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/stages/cad/cad_assembly.usda +169 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/stages/cad/cad_assembly_merged.usda +128 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/stages/cad/cad_assembly_merged_reused.usda +125 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/stages/cad/cad_assembly_merged_slabs.usda +126 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/stages/cae/overrides/user.usda +62 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/stages/cae/static_structural.usda +156 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/stages/cae/transient_cfd.usda +198 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/stages/studies/knuckle_and_bracket.usda +30 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/study.py +44 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/validator.py +353 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti/usd/schema/modelcatalog/vocabulary.py +132 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti_usd_schema_model_catalog.egg-info/PKG-INFO +242 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti_usd_schema_model_catalog.egg-info/SOURCES.txt +44 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti_usd_schema_model_catalog.egg-info/dependency_links.txt +1 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti_usd_schema_model_catalog.egg-info/entry_points.txt +2 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti_usd_schema_model_catalog.egg-info/requires.txt +16 -0
- vcti_usd_schema_model_catalog-0.2.0/src/vcti_usd_schema_model_catalog.egg-info/top_level.txt +1 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_authoring.py +117 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_catalog.py +158 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_declarations.py +57 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_docs.py +158 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_examples.py +268 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_fixtures.py +149 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_registry.py +84 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_schema_reference.py +101 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_stage.py +46 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_study.py +207 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_validator.py +560 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_version.py +15 -0
- vcti_usd_schema_model_catalog-0.2.0/tests/test_vocabulary.py +55 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Copyright (c) 2018-2026 Visual Collaboration Technologies Inc.
|
|
2
|
+
All Rights Reserved.
|
|
3
|
+
|
|
4
|
+
This software is proprietary and confidential. Unauthorized copying,
|
|
5
|
+
distribution, or use of this software, via any medium, is strictly
|
|
6
|
+
prohibited. Access is granted only to authorized VCollab developers
|
|
7
|
+
and individuals explicitly authorized by Visual Collaboration
|
|
8
|
+
Technologies Inc.
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vcti-usd-schema-model-catalog
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Codeless OpenUSD schema for the catalog of a VCollab model, the trees and lists a user browses it by, kept in a layer of its own that the model never depends on: schema source, generated plugin, synthetic fixtures and a validator
|
|
5
|
+
Author: Visual Collaboration Technologies Inc.
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Project-URL: Repository, https://github.com/vcollab/vcti-python-usd-schema-model-catalog
|
|
8
|
+
Project-URL: Changelog, https://github.com/vcollab/vcti-python-usd-schema-model-catalog/blob/main/CHANGELOG.md
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Requires-Python: <3.15,>=3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: usd-core<27,>=26.11
|
|
17
|
+
Requires-Dist: vcti-usd-schema-core>=0.4.0
|
|
18
|
+
Requires-Dist: vcti-usd-schema-model>=0.5.0
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest; extra == "test"
|
|
21
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
22
|
+
Provides-Extra: lint
|
|
23
|
+
Requires-Dist: ruff; extra == "lint"
|
|
24
|
+
Provides-Extra: typecheck
|
|
25
|
+
Requires-Dist: mypy; extra == "typecheck"
|
|
26
|
+
Provides-Extra: schema
|
|
27
|
+
Requires-Dist: jinja2; extra == "schema"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# VCollab USD Model Catalog Schema
|
|
31
|
+
|
|
32
|
+
Codeless OpenUSD schema for the catalog of a VCollab model, the trees and lists a user browses it by, kept in a layer of its own that the model never depends on: schema source, generated plugin, synthetic fixtures and a validator
|
|
33
|
+
|
|
34
|
+
## Overview
|
|
35
|
+
|
|
36
|
+
A VCollab model is a USD stage of prims the server builds and a viewer
|
|
37
|
+
renders. A user does not browse that stage by prim path. They browse a
|
|
38
|
+
**catalog**: the lists the application shows, whose entries carry the
|
|
39
|
+
labels a user reads and name the model's prims.
|
|
40
|
+
|
|
41
|
+
**`VctStudy`** is what a server serves and a client enters through. It
|
|
42
|
+
lists the model catalogs that belong together, each under the name a user
|
|
43
|
+
reads for the model.
|
|
44
|
+
|
|
45
|
+
**`VctModelCatalog`** is the root of a catalog. It names the one model it
|
|
46
|
+
describes and holds the lists.
|
|
47
|
+
|
|
48
|
+
**A list** is a child of the catalog with a fixed name: `parts`,
|
|
49
|
+
`components`, `entitySets`, `fields`, `frames`, `histories`,
|
|
50
|
+
`displayModes` or `materials`. The name says which model types its entries
|
|
51
|
+
may describe.
|
|
52
|
+
|
|
53
|
+
**An entry** is a `VctDescriptor` of the
|
|
54
|
+
[core schema](https://github.com/vcollab/vcti-python-usd-schema-core): a
|
|
55
|
+
label, free-form `attr:*` attributes and the model prims it describes.
|
|
56
|
+
Entries nest, so a list is a tree where the user needs one, with folders
|
|
57
|
+
the model has no prim for. Part attributes live on entries.
|
|
58
|
+
|
|
59
|
+
**The catalog is a layer of its own.** It is stacked over the model's
|
|
60
|
+
layer, which never names it. A user's renames, order, hidden and moved
|
|
61
|
+
entries are core override layers over the catalog, and reach nothing of
|
|
62
|
+
the model.
|
|
63
|
+
|
|
64
|
+
This package ships the schema as a codeless USD plugin, the declarations
|
|
65
|
+
it is generated from, fixture catalogs for six of the model package's
|
|
66
|
+
fixture stages, helpers to read and author a catalog, and the validator a
|
|
67
|
+
catalog must pass.
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install vcti-usd-schema-model-catalog
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### In `requirements.txt`
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
vcti-usd-schema-model-catalog>=0.2.0
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### In `pyproject.toml` dependencies
|
|
82
|
+
|
|
83
|
+
```toml
|
|
84
|
+
dependencies = [
|
|
85
|
+
"vcti-usd-schema-model-catalog>=0.2.0",
|
|
86
|
+
]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Quick Start
|
|
92
|
+
|
|
93
|
+
### Read a catalog
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from vcti.usd.schema.core import attributes, label, subjects
|
|
97
|
+
from vcti.usd.schema.modelcatalog import find_catalog, lists, open_fixture, walk
|
|
98
|
+
|
|
99
|
+
stage = open_fixture("static_structural")
|
|
100
|
+
catalog = find_catalog(stage)
|
|
101
|
+
for shown in lists(catalog):
|
|
102
|
+
print(shown.GetName(), label(shown))
|
|
103
|
+
for entry in walk(shown):
|
|
104
|
+
described = [str(subject.GetPath()) for subject in subjects(entry)]
|
|
105
|
+
print(" ", label(entry), attributes(entry), described)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`open_fixture` opens the model package's fixture of that name with this
|
|
109
|
+
package's catalog layer over it. `lists` and `walk` return what a client
|
|
110
|
+
shows, in the order it shows it. Labels, attributes and subjects are read
|
|
111
|
+
with the core package's functions.
|
|
112
|
+
|
|
113
|
+
### Find the entry for a model prim
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from vcti.usd.schema.core import label
|
|
117
|
+
from vcti.usd.schema.modelcatalog import catalog_list, describing, find_catalog, open_fixture
|
|
118
|
+
|
|
119
|
+
stage = open_fixture("static_structural")
|
|
120
|
+
fields = catalog_list(find_catalog(stage), "fields")
|
|
121
|
+
stress = stage.GetPrimAtPath("/Model/fields/stress")
|
|
122
|
+
print([label(entry) for entry in describing(fields, stress)])
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Author a catalog in a layer of its own
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from pxr import Sdf
|
|
129
|
+
|
|
130
|
+
from vcti.usd.schema.core import define_descriptor
|
|
131
|
+
from vcti.usd.schema.model import fixture_path as model_fixture_path
|
|
132
|
+
from vcti.usd.schema.modelcatalog import define_catalog, define_list, open_catalog, validate
|
|
133
|
+
|
|
134
|
+
layer = Sdf.Layer.CreateAnonymous(".usda")
|
|
135
|
+
stage = open_catalog(model_fixture_path("static_structural"), layer)
|
|
136
|
+
stage.SetEditTarget(layer)
|
|
137
|
+
|
|
138
|
+
catalog = define_catalog(stage, "/Model")
|
|
139
|
+
fields = define_list(catalog, "fields", "Results")
|
|
140
|
+
define_descriptor(
|
|
141
|
+
stage,
|
|
142
|
+
"/ModelCatalog/fields/d1",
|
|
143
|
+
"Displacement",
|
|
144
|
+
subjects=["/Model/fields/displacement"],
|
|
145
|
+
)
|
|
146
|
+
print(validate(stage))
|
|
147
|
+
print(layer.ExportToString())
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Everything authored lands in the catalog's layer; the model's layer is not
|
|
151
|
+
written to. Each entry's path is the caller's to give: a prim name is an
|
|
152
|
+
identifier the producer generates, never a form of the label.
|
|
153
|
+
|
|
154
|
+
### Open a study of several models
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
from vcti.usd.schema.core import label
|
|
158
|
+
from vcti.usd.schema.modelcatalog import (
|
|
159
|
+
catalogs,
|
|
160
|
+
find_study,
|
|
161
|
+
model_of,
|
|
162
|
+
open_study_fixture,
|
|
163
|
+
validate,
|
|
164
|
+
walk,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
stage = open_study_fixture("knuckle_and_bracket")
|
|
168
|
+
study = find_study(stage)
|
|
169
|
+
print([label(entry) for entry in walk(study)])
|
|
170
|
+
print([str(model_of(catalog).GetPath()) for catalog in catalogs(study)])
|
|
171
|
+
print(validate(stage))
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
A study is what a server serves. Its entries name the model catalogs, and
|
|
175
|
+
each catalog names its model. Every model and catalog on the stage has a
|
|
176
|
+
root prim name of its own.
|
|
177
|
+
|
|
178
|
+
### Compose a user's changes
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
from vcti.usd.schema.core import entries, label, validate_override_layer
|
|
182
|
+
from vcti.usd.schema.modelcatalog import (
|
|
183
|
+
catalog_list,
|
|
184
|
+
find_catalog,
|
|
185
|
+
open_fixture,
|
|
186
|
+
override_path,
|
|
187
|
+
validate,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
stage = open_fixture("static_structural", ["user"])
|
|
191
|
+
fields = catalog_list(find_catalog(stage), "fields")
|
|
192
|
+
print([label(entry) for entry in entries(fields)])
|
|
193
|
+
print(validate(stage), validate_override_layer(stage, override_path("user")))
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
`open_catalog(model, catalog, overrides)` does the same for any layers. An
|
|
197
|
+
override layer is checked with both validators: the core's for what the
|
|
198
|
+
layer may hold, this package's for the stage it composes.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## API at a glance
|
|
203
|
+
|
|
204
|
+
| Name | What it does |
|
|
205
|
+
|---|---|
|
|
206
|
+
| `open_catalog(model, catalog, overrides)`, `open_fixture(name, overrides)` | Open a model under its catalog and any override layers, with every plugin of the family registered |
|
|
207
|
+
| `open_study(models, catalogs, study, overrides)`, `open_study_fixture(name)` | Open several models on one stage under their catalogs and the study that lists them |
|
|
208
|
+
| `find_study(stage)`, `catalogs(study)` | The study on a stage, and the model catalogs it shows, in order |
|
|
209
|
+
| `find_catalog(stage, model)`, `find_catalogs(stage)`, `model_of(catalog)` | The catalog of a model, and the model of a catalog |
|
|
210
|
+
| `component_tree(catalog, occurrence)` | The entry whose children are the parts shown beneath an occurrence: the one that describes the mesh it places |
|
|
211
|
+
| `default_display_mode(catalog)` | The display mode a catalog says to start in |
|
|
212
|
+
| `lists(catalog)`, `catalog_list(catalog, name)` | The lists a catalog shows, in order; one list by name |
|
|
213
|
+
| `walk(prim)`, `describing(prim, subject)` | Every listed entry beneath a prim; the entries that describe a model prim |
|
|
214
|
+
| `define_study(stage, path)`, `define_catalog(stage, model, path)`, `define_list(catalog, name, label)` | Author a study's root, a catalog's root and its lists |
|
|
215
|
+
| `set_default_display_mode(catalog, mode)` | Say which display mode an application starts in |
|
|
216
|
+
| `validate(stage)`, `validate_files(model, catalog, overrides)` | Every contract of a catalog and of its entries, as a list of messages |
|
|
217
|
+
| `register_plugin()` | Register this plugin, the core's and the model's with this process, once |
|
|
218
|
+
| `CATALOG`, `MODEL`, `LISTS`, `LIST_NAMES`, `SCHEMA_VERSION`, … | The names the schema fixes |
|
|
219
|
+
|
|
220
|
+
Entries are read with the core package's `label`, `attributes`, `subjects`
|
|
221
|
+
and `entries`, authored with its `define_descriptor`, and overridden with
|
|
222
|
+
its `override_*` helpers.
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Dependencies
|
|
227
|
+
|
|
228
|
+
- `usd-core`, which provides the USD runtime the plugin registers into.
|
|
229
|
+
- `vcti-usd-schema-core`, whose `VctDescriptor` every entry of a catalog is.
|
|
230
|
+
- `vcti-usd-schema-model`, whose types a catalog describes. The model
|
|
231
|
+
package depends on neither of the other two.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Documentation
|
|
236
|
+
|
|
237
|
+
| If you want to… | Read |
|
|
238
|
+
|---|---|
|
|
239
|
+
| Get started using the package | Quick Start above |
|
|
240
|
+
| Look up a prim type, a property or a list | [docs/schema.md](docs/schema.md) |
|
|
241
|
+
| Understand the catalog, its lists and its rules | [docs/design.md](docs/design.md) |
|
|
242
|
+
| See what changed | [CHANGELOG.md](CHANGELOG.md) |
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# VCollab USD Model Catalog Schema
|
|
2
|
+
|
|
3
|
+
Codeless OpenUSD schema for the catalog of a VCollab model, the trees and lists a user browses it by, kept in a layer of its own that the model never depends on: schema source, generated plugin, synthetic fixtures and a validator
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
A VCollab model is a USD stage of prims the server builds and a viewer
|
|
8
|
+
renders. A user does not browse that stage by prim path. They browse a
|
|
9
|
+
**catalog**: the lists the application shows, whose entries carry the
|
|
10
|
+
labels a user reads and name the model's prims.
|
|
11
|
+
|
|
12
|
+
**`VctStudy`** is what a server serves and a client enters through. It
|
|
13
|
+
lists the model catalogs that belong together, each under the name a user
|
|
14
|
+
reads for the model.
|
|
15
|
+
|
|
16
|
+
**`VctModelCatalog`** is the root of a catalog. It names the one model it
|
|
17
|
+
describes and holds the lists.
|
|
18
|
+
|
|
19
|
+
**A list** is a child of the catalog with a fixed name: `parts`,
|
|
20
|
+
`components`, `entitySets`, `fields`, `frames`, `histories`,
|
|
21
|
+
`displayModes` or `materials`. The name says which model types its entries
|
|
22
|
+
may describe.
|
|
23
|
+
|
|
24
|
+
**An entry** is a `VctDescriptor` of the
|
|
25
|
+
[core schema](https://github.com/vcollab/vcti-python-usd-schema-core): a
|
|
26
|
+
label, free-form `attr:*` attributes and the model prims it describes.
|
|
27
|
+
Entries nest, so a list is a tree where the user needs one, with folders
|
|
28
|
+
the model has no prim for. Part attributes live on entries.
|
|
29
|
+
|
|
30
|
+
**The catalog is a layer of its own.** It is stacked over the model's
|
|
31
|
+
layer, which never names it. A user's renames, order, hidden and moved
|
|
32
|
+
entries are core override layers over the catalog, and reach nothing of
|
|
33
|
+
the model.
|
|
34
|
+
|
|
35
|
+
This package ships the schema as a codeless USD plugin, the declarations
|
|
36
|
+
it is generated from, fixture catalogs for six of the model package's
|
|
37
|
+
fixture stages, helpers to read and author a catalog, and the validator a
|
|
38
|
+
catalog must pass.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install vcti-usd-schema-model-catalog
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### In `requirements.txt`
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
vcti-usd-schema-model-catalog>=0.2.0
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### In `pyproject.toml` dependencies
|
|
53
|
+
|
|
54
|
+
```toml
|
|
55
|
+
dependencies = [
|
|
56
|
+
"vcti-usd-schema-model-catalog>=0.2.0",
|
|
57
|
+
]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Quick Start
|
|
63
|
+
|
|
64
|
+
### Read a catalog
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from vcti.usd.schema.core import attributes, label, subjects
|
|
68
|
+
from vcti.usd.schema.modelcatalog import find_catalog, lists, open_fixture, walk
|
|
69
|
+
|
|
70
|
+
stage = open_fixture("static_structural")
|
|
71
|
+
catalog = find_catalog(stage)
|
|
72
|
+
for shown in lists(catalog):
|
|
73
|
+
print(shown.GetName(), label(shown))
|
|
74
|
+
for entry in walk(shown):
|
|
75
|
+
described = [str(subject.GetPath()) for subject in subjects(entry)]
|
|
76
|
+
print(" ", label(entry), attributes(entry), described)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`open_fixture` opens the model package's fixture of that name with this
|
|
80
|
+
package's catalog layer over it. `lists` and `walk` return what a client
|
|
81
|
+
shows, in the order it shows it. Labels, attributes and subjects are read
|
|
82
|
+
with the core package's functions.
|
|
83
|
+
|
|
84
|
+
### Find the entry for a model prim
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from vcti.usd.schema.core import label
|
|
88
|
+
from vcti.usd.schema.modelcatalog import catalog_list, describing, find_catalog, open_fixture
|
|
89
|
+
|
|
90
|
+
stage = open_fixture("static_structural")
|
|
91
|
+
fields = catalog_list(find_catalog(stage), "fields")
|
|
92
|
+
stress = stage.GetPrimAtPath("/Model/fields/stress")
|
|
93
|
+
print([label(entry) for entry in describing(fields, stress)])
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Author a catalog in a layer of its own
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from pxr import Sdf
|
|
100
|
+
|
|
101
|
+
from vcti.usd.schema.core import define_descriptor
|
|
102
|
+
from vcti.usd.schema.model import fixture_path as model_fixture_path
|
|
103
|
+
from vcti.usd.schema.modelcatalog import define_catalog, define_list, open_catalog, validate
|
|
104
|
+
|
|
105
|
+
layer = Sdf.Layer.CreateAnonymous(".usda")
|
|
106
|
+
stage = open_catalog(model_fixture_path("static_structural"), layer)
|
|
107
|
+
stage.SetEditTarget(layer)
|
|
108
|
+
|
|
109
|
+
catalog = define_catalog(stage, "/Model")
|
|
110
|
+
fields = define_list(catalog, "fields", "Results")
|
|
111
|
+
define_descriptor(
|
|
112
|
+
stage,
|
|
113
|
+
"/ModelCatalog/fields/d1",
|
|
114
|
+
"Displacement",
|
|
115
|
+
subjects=["/Model/fields/displacement"],
|
|
116
|
+
)
|
|
117
|
+
print(validate(stage))
|
|
118
|
+
print(layer.ExportToString())
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Everything authored lands in the catalog's layer; the model's layer is not
|
|
122
|
+
written to. Each entry's path is the caller's to give: a prim name is an
|
|
123
|
+
identifier the producer generates, never a form of the label.
|
|
124
|
+
|
|
125
|
+
### Open a study of several models
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from vcti.usd.schema.core import label
|
|
129
|
+
from vcti.usd.schema.modelcatalog import (
|
|
130
|
+
catalogs,
|
|
131
|
+
find_study,
|
|
132
|
+
model_of,
|
|
133
|
+
open_study_fixture,
|
|
134
|
+
validate,
|
|
135
|
+
walk,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
stage = open_study_fixture("knuckle_and_bracket")
|
|
139
|
+
study = find_study(stage)
|
|
140
|
+
print([label(entry) for entry in walk(study)])
|
|
141
|
+
print([str(model_of(catalog).GetPath()) for catalog in catalogs(study)])
|
|
142
|
+
print(validate(stage))
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
A study is what a server serves. Its entries name the model catalogs, and
|
|
146
|
+
each catalog names its model. Every model and catalog on the stage has a
|
|
147
|
+
root prim name of its own.
|
|
148
|
+
|
|
149
|
+
### Compose a user's changes
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from vcti.usd.schema.core import entries, label, validate_override_layer
|
|
153
|
+
from vcti.usd.schema.modelcatalog import (
|
|
154
|
+
catalog_list,
|
|
155
|
+
find_catalog,
|
|
156
|
+
open_fixture,
|
|
157
|
+
override_path,
|
|
158
|
+
validate,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
stage = open_fixture("static_structural", ["user"])
|
|
162
|
+
fields = catalog_list(find_catalog(stage), "fields")
|
|
163
|
+
print([label(entry) for entry in entries(fields)])
|
|
164
|
+
print(validate(stage), validate_override_layer(stage, override_path("user")))
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
`open_catalog(model, catalog, overrides)` does the same for any layers. An
|
|
168
|
+
override layer is checked with both validators: the core's for what the
|
|
169
|
+
layer may hold, this package's for the stage it composes.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## API at a glance
|
|
174
|
+
|
|
175
|
+
| Name | What it does |
|
|
176
|
+
|---|---|
|
|
177
|
+
| `open_catalog(model, catalog, overrides)`, `open_fixture(name, overrides)` | Open a model under its catalog and any override layers, with every plugin of the family registered |
|
|
178
|
+
| `open_study(models, catalogs, study, overrides)`, `open_study_fixture(name)` | Open several models on one stage under their catalogs and the study that lists them |
|
|
179
|
+
| `find_study(stage)`, `catalogs(study)` | The study on a stage, and the model catalogs it shows, in order |
|
|
180
|
+
| `find_catalog(stage, model)`, `find_catalogs(stage)`, `model_of(catalog)` | The catalog of a model, and the model of a catalog |
|
|
181
|
+
| `component_tree(catalog, occurrence)` | The entry whose children are the parts shown beneath an occurrence: the one that describes the mesh it places |
|
|
182
|
+
| `default_display_mode(catalog)` | The display mode a catalog says to start in |
|
|
183
|
+
| `lists(catalog)`, `catalog_list(catalog, name)` | The lists a catalog shows, in order; one list by name |
|
|
184
|
+
| `walk(prim)`, `describing(prim, subject)` | Every listed entry beneath a prim; the entries that describe a model prim |
|
|
185
|
+
| `define_study(stage, path)`, `define_catalog(stage, model, path)`, `define_list(catalog, name, label)` | Author a study's root, a catalog's root and its lists |
|
|
186
|
+
| `set_default_display_mode(catalog, mode)` | Say which display mode an application starts in |
|
|
187
|
+
| `validate(stage)`, `validate_files(model, catalog, overrides)` | Every contract of a catalog and of its entries, as a list of messages |
|
|
188
|
+
| `register_plugin()` | Register this plugin, the core's and the model's with this process, once |
|
|
189
|
+
| `CATALOG`, `MODEL`, `LISTS`, `LIST_NAMES`, `SCHEMA_VERSION`, … | The names the schema fixes |
|
|
190
|
+
|
|
191
|
+
Entries are read with the core package's `label`, `attributes`, `subjects`
|
|
192
|
+
and `entries`, authored with its `define_descriptor`, and overridden with
|
|
193
|
+
its `override_*` helpers.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Dependencies
|
|
198
|
+
|
|
199
|
+
- `usd-core`, which provides the USD runtime the plugin registers into.
|
|
200
|
+
- `vcti-usd-schema-core`, whose `VctDescriptor` every entry of a catalog is.
|
|
201
|
+
- `vcti-usd-schema-model`, whose types a catalog describes. The model
|
|
202
|
+
package depends on neither of the other two.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Documentation
|
|
207
|
+
|
|
208
|
+
| If you want to… | Read |
|
|
209
|
+
|---|---|
|
|
210
|
+
| Get started using the package | Quick Start above |
|
|
211
|
+
| Look up a prim type, a property or a list | [docs/schema.md](docs/schema.md) |
|
|
212
|
+
| Understand the catalog, its lists and its rules | [docs/design.md](docs/design.md) |
|
|
213
|
+
| See what changed | [CHANGELOG.md](CHANGELOG.md) |
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vcti-usd-schema-model-catalog"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Codeless OpenUSD schema for the catalog of a VCollab model, the trees and lists a user browses it by, kept in a layer of its own that the model never depends on: schema source, generated plugin, synthetic fixtures and a validator"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Visual Collaboration Technologies Inc."}
|
|
12
|
+
]
|
|
13
|
+
license = "LicenseRef-Proprietary"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
]
|
|
21
|
+
requires-python = ">=3.12,<3.15"
|
|
22
|
+
dependencies = [
|
|
23
|
+
# The shipped plugin was generated by usdGenSchema 26.11; a new major is
|
|
24
|
+
# admitted only after the plugin is regenerated and checked against it.
|
|
25
|
+
"usd-core>=26.11,<27",
|
|
26
|
+
# The entries of a catalog are the core schema's descriptors.
|
|
27
|
+
"vcti-usd-schema-core>=0.4.0",
|
|
28
|
+
# What a catalog describes is the model schema's. The model depends on
|
|
29
|
+
# neither this package nor the core.
|
|
30
|
+
"vcti-usd-schema-model>=0.5.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Repository = "https://github.com/vcollab/vcti-python-usd-schema-model-catalog"
|
|
35
|
+
Changelog = "https://github.com/vcollab/vcti-python-usd-schema-model-catalog/blob/main/CHANGELOG.md"
|
|
36
|
+
|
|
37
|
+
# Every schema package of the family names its plugin directory here, and
|
|
38
|
+
# register_plugin() registers them all.
|
|
39
|
+
[project.entry-points."vcti.usd.schema"]
|
|
40
|
+
modelcatalog = "vcti.usd.schema.modelcatalog.registry:PLUGIN_DIR"
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.packages.find]
|
|
43
|
+
where = ["src"]
|
|
44
|
+
include = ["vcti.usd.schema.modelcatalog", "vcti.usd.schema.modelcatalog.*"]
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.package-data]
|
|
47
|
+
"vcti.usd.schema.modelcatalog" = [
|
|
48
|
+
"py.typed",
|
|
49
|
+
"plugin/*.json",
|
|
50
|
+
"plugin/*.usda",
|
|
51
|
+
"stages/cad/*.usda",
|
|
52
|
+
"stages/cae/*.usda",
|
|
53
|
+
"stages/cae/overrides/*.usda",
|
|
54
|
+
"stages/studies/*.usda",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[project.optional-dependencies]
|
|
58
|
+
test = ["pytest", "pytest-cov"]
|
|
59
|
+
lint = ["ruff"]
|
|
60
|
+
typecheck = ["mypy"]
|
|
61
|
+
# usdGenSchema, which regenerates the plugin, renders its output with jinja2.
|
|
62
|
+
schema = ["jinja2"]
|
|
63
|
+
|
|
64
|
+
[tool.pytest.ini_options]
|
|
65
|
+
addopts = "--cov=vcti.usd.schema.modelcatalog --cov-report=term-missing --cov-fail-under=95"
|
|
66
|
+
|
|
67
|
+
[tool.mypy]
|
|
68
|
+
python_version = "3.12"
|
|
69
|
+
strict = true
|
|
70
|
+
files = ["src"]
|
|
71
|
+
namespace_packages = true
|
|
72
|
+
explicit_package_bases = true
|
|
73
|
+
mypy_path = ["src"]
|
|
74
|
+
|
|
75
|
+
[tool.coverage.run]
|
|
76
|
+
branch = true
|
|
77
|
+
|
|
78
|
+
[tool.coverage.report]
|
|
79
|
+
exclude_also = [
|
|
80
|
+
"raise NotImplementedError",
|
|
81
|
+
"if TYPE_CHECKING:",
|
|
82
|
+
"if __name__ == .__main__.:",
|
|
83
|
+
"@(abc\\.)?abstractmethod",
|
|
84
|
+
"^\\s*\\.\\.\\.\\s*$",
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
[tool.ruff]
|
|
88
|
+
target-version = "py312"
|
|
89
|
+
line-length = 99
|
|
90
|
+
|
|
91
|
+
[tool.ruff.lint]
|
|
92
|
+
select = ["E", "F", "W", "I", "UP"]
|
|
93
|
+
|
|
94
|
+
# usd-core ships no type information, so its modules are untyped here.
|
|
95
|
+
[[tool.mypy.overrides]]
|
|
96
|
+
module = ["pxr.*"]
|
|
97
|
+
ignore_missing_imports = true
|