You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/beyond-basics/active-inactive-prims.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,14 +63,24 @@ We can use the following Python functions to set the "active" metadata on a prim
63
63
*`UsdPrim.IsActive()` - Return whether a prim is currently active on the stage
64
64
65
65
## Examples
66
+
+++ {"tags": ["remove-cell"]}
67
+
>**NOTE**: Before starting make sure to run the cell below. This will install the relevant OpenUSD libraries that will be used through this notebook.
68
+
+++
69
+
```{code-cell}
70
+
:tags: [remove-input]
71
+
:test-tags: [active-inactive-setup]
72
+
from lousd.utils.helperfunctions import create_new_stage
73
+
```
74
+
66
75
67
76
### Example 1: Setting Prims as Active/Inactive
68
77
69
78
+++ {"tags": ["remove-cell"]}
70
-
>**NOTE**: The next cell is content setup for this example..
79
+
>**NOTE**: The next cell is content setup for this example.
71
80
+++
72
81
```{code-cell}
73
82
:tags: [remove-input]
83
+
:test-tags: [active-inactive-content-setup]
74
84
75
85
from pxr import Usd, UsdGeom, UsdLux, UsdShade
76
86
@@ -102,6 +112,7 @@ stage.Save()
102
112
In this example, we will print out the contents of a stage at the start and then see how the contents change after deactivating a prim. Here's is what the USDA for this stage looks like:
@@ -176,7 +180,8 @@ After creating an attribute, we can set and get the value of the attribute, simi
176
180
177
181
Try applying the same logic to the other attributes.
178
182
179
-
```{code-cell}
183
+
```{code-cell}
184
+
:test-tags: [custom-properties-modify-attributes]
180
185
:emphasize-lines: 7-10
181
186
182
187
from pxr import Usd
@@ -207,12 +212,13 @@ When working with grouped or compound data from other sources, namespace-prefixe
207
212
Notice the double namespacing pattern `acme:sensor:temperature`. The first namespace (`acme:`) identifies the organization that created these custom properties, while the second namespace (`sensor:`) groups related properties together. This hierarchical approach allows you to both claim ownership of your custom properties and logically organize them into functional groups. It's a common pattern when mapping compound data types from other formats into USD.
Copy file name to clipboardExpand all lines: docs/beyond-basics/model-kinds.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,7 @@ prim.IsModel()
122
122
+++
123
123
```{code-cell}
124
124
:tags: [remove-input]
125
+
:test-tags: [model-kinds-setup]
125
126
from lousd.utils.visualization import DisplayUSD, DisplayCode
126
127
from lousd.utils.helperfunctions import create_new_stage
127
128
```
@@ -131,12 +132,13 @@ from lousd.utils.helperfunctions import create_new_stage
131
132
This example shows the practical benefit of Model Kinds. `/World` is marked as a group so children can qualify as models, `/World/Component` is classified as a component, and `/World/Markers` is left untagged. Model‑only traversal allow for edits only to the component while the markers remain untouched.
Copy file name to clipboardExpand all lines: docs/beyond-basics/primvars.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,7 @@ values = primvar.Get()
84
84
+++
85
85
```{code-cell}
86
86
:tags: [remove-input]
87
+
:test-tags: [primvars-setup]
87
88
from lousd.utils.visualization import DisplayUSD, DisplayCode
88
89
from lousd.utils.helperfunctions import create_new_stage
89
90
```
@@ -93,12 +94,13 @@ from lousd.utils.helperfunctions import create_new_stage
93
94
This example builds the same two‑quad mesh three times and authors the displayColor primvar with three {term}`interpolation <Interpolation>` modes: constant (one value for the whole gprim), uniform (one per face), and vertex (one per point).
94
95
95
96
```{code-cell}
97
+
:test-tags: [primvars-displaycolor-interpolation]
96
98
:emphasize-lines: 28-53
97
99
from pxr import Usd, UsdGeom, Gf
98
100
99
101
# Create stage and default prim
100
102
file_path = "_assets/primvars_displaycolor.usda"
101
-
stage = Usd.Stage.CreateNew(file_path)
103
+
stage = create_new_stage(file_path)
102
104
world = UsdGeom.Xform.Define(stage, "/World")
103
105
stage.SetDefaultPrim(world.GetPrim())
104
106
@@ -164,6 +166,7 @@ DisplayCode(file_path)
164
166
This example writes two vertex primvars on a quad: rest_state and deformation. It computes new points as rest_state + deformation, then {term}`time samples <Time Sample>` Mesh.points
To traverse through the stage, we can use the [`Traverse()`](https://openusd.org/release/api/class_usd_stage.html#adba675b55f41cc1b305bed414fc4f178) method. This traversal will yield prims that are active, loaded, defined, non-abstract on the stage in depth-first order.
147
149
148
150
```{code-cell}
151
+
:test-tags: [stage-traversal-traverse]
149
152
:emphasize-lines: 7-10
150
153
151
154
# Import the Usd module from the pxr package
@@ -169,6 +172,7 @@ For this practical example, we will traverse the stage to operate on specific pr
169
172
We can filter based on the type of the prim. For example, we can check if the prim is of type `scope` or `xform`. To do this we pass the prim into the constructor method for the prim type we are interested in. For example,`UsdGeom.Scope(prim)` is equivalent to [`UsdGeom.Scope.Get(prim.GetStage(), prim.GetPath())`](https://openusd.org/release/api/class_usd_geom_scope.html#a538339c2aa462ebcf1eb07fed16f9be4) for a valid prim. If the prim's type does not match, it will return an invalid prim.
170
173
171
174
```{code-cell}
175
+
:test-tags: [stage-traversal-filter-types]
172
176
:emphasize-lines: 7-21
173
177
174
178
# Import necessary modules from the pxr package
@@ -201,6 +205,7 @@ Using [`Traverse()`](https://openusd.org/release/api/class_usd_stage.html#adba67
201
205
If you need to work within a specific scope or hierarchy in the stage, you can perform a traversal starting from a particular prim. Let's take a look at how we can traverse through the children of the default prim.
202
206
203
207
```{code-cell}
208
+
:test-tags: [stage-traversal-children]
204
209
:emphasize-lines: 10-13
205
210
206
211
# Import the `Usd` module from the `pxr` package:
@@ -227,6 +232,7 @@ Let's see an example of [`UsdPrimRange`](https://openusd.org/release/api/class_u
Copy file name to clipboardExpand all lines: docs/beyond-basics/units.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,7 +152,9 @@ print(f"Updated to: {UsdPhysics.GetStageKilogramsPerUnit(stage)}")
152
152
+++
153
153
```{code-cell}
154
154
:tags: [remove-input]
155
+
:test-tags: [units-setup]
155
156
from lousd.utils.visualization import DisplayUSD, DisplayCode
157
+
from lousd.utils.helperfunctions import create_new_stage
156
158
```
157
159
158
160
### Example 1: Demonstrating metersPerUnit Composition Behavior
@@ -165,12 +167,13 @@ This example shows what happens when assets with different `metersPerUnit` value
165
167
Both cubes represent the same real-world size—1 meter. If USD automatically converted units during composition, both cubes would appear identical when referenced into any scene regardless of that scene's `metersPerUnit`. Let's see what actually happens when we reference both into a millimeter-scale scene.
166
168
167
169
```{code-cell}
170
+
:test-tags: [units-meters-per-unit]
168
171
:emphasize-lines: 7,10-11,25,28-29,50-51,54-55
169
172
from pxr import Usd, UsdGeom, Sdf, Gf
170
173
171
174
# Create a cube asset in CENTIMETERS (metersPerUnit = 0.01)
This example demonstrates that USD **does** automatically handle `timeCodesPerSecond` differences during composition. We'll create an animated asset at 60 fps and reference it into a 24 fps scene.
Copy file name to clipboardExpand all lines: docs/beyond-basics/value-resolution.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,6 +108,7 @@ When you get an attribute value without an explicit time code, the default time
108
108
+++
109
109
```{code-cell}
110
110
:tags: [remove-input]
111
+
:test-tags: [value-resolution-setup]
111
112
from lousd.utils.visualization import DisplayUSD, DisplayCode
112
113
from lousd.utils.helperfunctions import create_new_stage
113
114
```
@@ -117,6 +118,7 @@ from lousd.utils.helperfunctions import create_new_stage
117
118
This example shows how a transform attribute (the `xformOp:scale` authored by `XformCommonAPI`) resolves from four sources: a {term}`fallback <Fallback>` value when no authored value exists, an authored default value, authored time sample values, and interpolated values between time samples.
@@ -208,13 +210,14 @@ Notice `Get(..., Usd.TimeCode.Default())` returns the user defined default (non
208
210
This example composes {term}`layers <Layer>` to show two resolution rules for dictionary metadata like `customData` (per key by strength) as well as relationships `list editing semantics`.
0 commit comments