Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/beyond-basics/stage-traversal.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ DisplayCode(file_path)

### Example 1: Traversing Through the Stage

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.
To traverse through the stage, we can use the {usdcpp}`UsdStage::Traverse` method. This traversal will yield prims that are active, loaded, defined, non-abstract on the stage in depth-first order.

```{code-cell}
:test-tags: [stage-traversal-traverse]
Expand All @@ -173,7 +173,7 @@ Note how the prims were printed in depth-first order. All of the descendants of

For this practical example, we will traverse the stage to operate on specific prims based on their types.

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.
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 {usdcpp}`UsdGeomScope::Get` for a valid prim. If the prim's type does not match, it will return an invalid prim.

```{code-cell}
:test-tags: [stage-traversal-filter-types]
Expand Down Expand Up @@ -204,7 +204,7 @@ print("Number of Xform prims: ", xform_count)

### Example 3: Traversing Through the Children of a Prim

Using [`Traverse()`](https://openusd.org/release/api/class_usd_stage.html#adba675b55f41cc1b305bed414fc4f178) can be a powerful tool, but for large stages, more efficient and targeted methods should be considered. A way to be more efficient and targeted is to traverse through the children of a prim.
Using {usdcpp}`UsdStage::Traverse` can be a powerful tool, but for large stages, more efficient and targeted methods should be considered. A way to be more efficient and targeted is to traverse through the children of a prim.

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.

Expand All @@ -230,9 +230,9 @@ for child in default_prim.GetAllChildren():

### Example 4: Traversing Using Usd.PrimRange

[`Traverse()`](https://openusd.org/release/api/class_usd_stage.html#adba675b55f41cc1b305bed414fc4f178) will return a [`UsdPrimRange`](https://openusd.org/release/api/class_usd_prim_range.html) object. `UsdPrimRange` exposes pre- and post- prim visitations allowing for a more involved traversals. It can also be used to perform actions such as pruning subtrees.
{usdcpp}`UsdStage::Traverse` will return a {usdcpp}`UsdPrimRange` object. `UsdPrimRange` exposes pre- and post- prim visitations allowing for a more involved traversals. It can also be used to perform actions such as pruning subtrees.

Let's see an example of [`UsdPrimRange`](https://openusd.org/release/api/class_usd_prim_range.html) in use.
Let's see an example of {usdcpp}`UsdPrimRange` in use.


```{code-cell}
Expand All @@ -252,7 +252,7 @@ for prim in prim_range:

Note how only "/World/Box" and its descendants are printed.

There are other ways to use [`UsdPrimRange`](https://openusd.org/release/api/class_usd_prim_range.html) such as passing in [`predicates`](https://openusd.org/release/api/prim_flags_8h.html#Usd_PrimFlags), you can find more information in the [Using Usd.PrimRange in Python](https://openusd.org/release/api/class_usd_prim_range.html#details) section of `UsdPrimRange`.
There are other ways to use {usdcpp}`UsdPrimRange` such as passing in predicates, you can find more information in the {usdcpp}`UsdPrimRange Details` section of `UsdPrimRange`.


## Key Takeaways
Expand Down
2 changes: 1 addition & 1 deletion docs/composition-basics/default-prim.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ from lousd.utils.helperfunctions import create_new_stage

### Example 1: Setting a Default Prim

[`SetDefaultPrim()`](https://openusd.org/release/api/class_usd_stage.html#a82b260faf91fbf721b0503075f2861e2) sets the default prim for the stage's root layer.
{usdcpp}`UsdStage::SetDefaultPrim` sets the default prim for the stage's root layer.

A `defaultPrim` is layer metadata. If the stage's root layer is used as a reference or payload it is best practice to set a default prim.

Expand Down
4 changes: 2 additions & 2 deletions docs/composition-basics/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def Xform "World"
}
```

Firstly, we want to grab all references of a prim. To do this we use [`GetReferences()`](https://openusd.org/release/api/class_usd_prim.html#ac9081d27e9d2a1058e32249fb96aaa34). This returns a [`UsdReferences`](https://openusd.org/release/api/class_usd_references.html) object, which allows us to add, remove, and modify references.
Firstly, we want to grab all references of a prim. To do this we use {usdcpp}`UsdPrim::GetReferences`. This returns a {usdcpp}`UsdReferences` object, which allows us to add, remove, and modify references.

To add a reference, we use [`AddReference()`](https://openusd.org/release/api/class_usd_references.html#a95bf456b23a234d3aa017015a4ad05e0). Let's see these in practice.
To add a reference, we use {usdcpp}`UsdReferences::AddReference`. Let's see these in practice.

```{code-cell}
:test-tags: [references-add-reference]
Expand Down
2 changes: 1 addition & 1 deletion docs/creating-composition-arcs/prim-composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Those are combined during {term}`composition <Composition>`.

Knowing that properties can be {term}`attributes <Attribute>` or {term}`relationships <Relationship>`, when talking about property specs you can infer that there are attribute specs and relationship specs.

You can interact with Specs using the [Sdf (Scene Description Foundations) API](https://openusd.org/release/api/class_sdf_spec.html). Both prim spec and property spec have their own API that is based off of `SdfSpec` API.
You can interact with Specs using the {usdcpp}`SdfSpec` API. Both prim spec and property spec have their own API that is based off of `SdfSpec` API.

The image above shows the different parts of the composition. Here we have the rendered result on the left and the USDA file represented on the right. Sphere is a prim spec, `radius` is a property spec, and the value to the right of `radius` is an opinion.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Let’s take some time to ask some common questions when it comes to working wit

## Why not add these as sublayers? Why add them as references?

This depends on two things, the contents of the {term}`layers <Layer>` and what you will need to do with the resulting {term}`composition <Composition>`. Since we are adding `skyscraperA` twice, if added as a {term}`sublayer <Sublayer>` then the first sublayer would overwrite the second `skyscraperA` instead of adding a second skyscraper. For more information on when to use sublayers vs references visit this site: [USD Frequently Asked Questions](https://openusd.org/release/usdfaq.html#i-have-some-layers-i-want-to-combine-should-i-use-sublayers-or-references)
This depends on two things, the contents of the {term}`layers <Layer>` and what you will need to do with the resulting {term}`composition <Composition>`. Since we are adding `skyscraperA` twice, if added as a {term}`sublayer <Sublayer>` then the first sublayer would overwrite the second `skyscraperA` instead of adding a second skyscraper. For more information on when to use sublayers vs references visit this site: [USD Frequently Asked Questions](inv:usd:std:doc#usdfaq)

Sublayers are like including, but referencing is like grafting.

## Why prepend?

You may have noticed the prepend operation in the reference statement above. Prepend means that, when this layer is composed with others to populate the {term}`stage <Stage>`, the reference will be inserted before any references that might exist in weaker sublayers. This ensures that the contents of the reference will contribute stronger {term}`opinions <Opinions>` than any reference arcs that might exist in other, weaker layers.

In other words, prepend gives the intuitive result you’d expect when you apply one layer on top of another. This is what the [UsdReferences](https://openusd.org/release/api/class_usd_references.html) API will create by default. You can specify other options with the position parameter, but this should rarely be necessary.
In other words, prepend gives the intuitive result you’d expect when you apply one layer on top of another. This is what the {usdcpp}`UsdReferences` API will create by default. You can specify other options with the position parameter, but this should rarely be necessary.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ You can find these files in the `composition_arcs/sublayers/exercise/contents/`

5. To start, go to `composition_arcs/sublayers/exercise/sublayers_exercise.py` from Visual Studio Code’s explorer window.

We will be adding in code that adds sublayers to our root layer. This is done using [Sdf.Layer API](https://openusd.org/release/api/class_sdf_layer.html).
We will be adding in code that adds sublayers to our root layer. This is done using {usdcpp}`SdfLayer` API.

![](../../images/composition-arcs/image94.png)

Expand Down
2 changes: 1 addition & 1 deletion docs/data-exchange/data-exchange/what-is-data-exchange.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ File format plugins are a unique feature of OpenUSD. They allow OpenUSD to compo
- An OpenUSD {term}`stage <Stage>` can include a source file format directly as a {term}`reference <Reference>`, {term}`payload <Payload>` or {term}`sublayer <Sublayer>`. The source file format is translated on the fly, while it is read as a USD document ({term}`layer <Layer>`, in USD parlance).
- The source file format can remain the source of truth.
- File format plugins can be bidirectional, supporting both reading from and writing to the source file format.
- They can be used as standalone converters with tools like [usdcat](https://openusd.org/release/toolset.html#usdcat).
- They can be used as standalone converters with tools like [usdcat](inv:usd:std#toolset:usdcat).

![](../../images/data-exchange/image1.png)

Expand Down
18 changes: 9 additions & 9 deletions docs/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ Asset Info
database name), payloadAssetDependencies (pre-computed dependencies for optimization), and version (asset revision information). Asset info persists through composition and flattening, enabling you to track where assets are introduced in your scene and reconstruct references to them.

**Also Known As:** *AssetInfo, asset metadata*
**Further Reading**: [AssetInfo -- OpenUSD.org](<inv:usd:std#glossary:assetinfo>), [UsdObject AssetInfo API](<https://openusd.org/release/api/class_usd_object.html>)
**Further Reading**: [AssetInfo -- OpenUSD.org](<inv:usd:std#glossary:assetinfo>), {usdcpp}`UsdObject`

Asset Resolution

Asset resolution is the process of translating an asset path into the actual location of a consumable resource.

USD provides a plugin point called `ArResolver` that you can customize to resolve assets using your own logic, external databases, or version control systems. If no custom resolver is available, USD uses a default resolver that searches for assets using configurable search paths.

**Further Reading**: [Asset Resolution -- OpenUSD.org](<inv:usd:std#glossary:asset resolution>), [ArResolver Documentation](<https://openusd.org/release/api/ar_page_front.html>)
**Further Reading**: [Asset Resolution -- OpenUSD.org](<inv:usd:std#glossary:asset resolution>), {usdcpp}`ArResolver <ar_page_front>`

Attribute

Expand All @@ -90,7 +90,7 @@ Change Processing

When you edit a layer, the stage immediately re-indexes affected prims in the same thread, potentially adding, removing, or modifying prims to maintain an accurate composed view. After processing changes, the stage notifies registered clients through the notification system so they can update themselves accordingly.

**Further Reading**: [Change Processing -- OpenUSD.org](<inv:usd:std#glossary:change processing>), [UsdNotice](<https://openusd.org/release/api/class_usd_notice.html>)
**Further Reading**: [Change Processing -- OpenUSD.org](<inv:usd:std#glossary:change processing>), {usdcpp}`UsdNotice`

Class

Expand All @@ -109,7 +109,7 @@ Collection
Collections use include and exclude relationships with expansion rules to compactly represent large object sets, implemented through the multiple-apply `UsdCollectionAPI` schema. They support explicit path lists and pattern-based membership, and can include prims, properties, or even other collections.

**Also Known As:** *UsdCollectionAPI*
**Further Reading**: [Collections and Patterns](<https://openusd.org/release/user_guides/collections_and_patterns.html>), [Collection -- OpenUSD.org](<inv:usd:std#glossary:collection>)
**Further Reading**: [Collections and Patterns](<inv:usd:std:doc#user_guides/collections_and_patterns>), [Collection -- OpenUSD.org](<inv:usd:std#glossary:collection>)

Component

Expand Down Expand Up @@ -197,7 +197,7 @@ Flatten

Flattening converts a dynamically composed stage into a single standalone layer by resolving all composition arcs and baking the results, creating a highly portable file that contains everything. The trade-off is larger file size since referenced assets get duplicated, and the process can be memory and compute intensive. You can flatten using `UsdStage::Flatten` or the usdcat tool with `--flatten`.

**Further Reading**: [Flatten -- OpenUSD.org](<inv:usd:std#glossary:flatten>), [usdcat Tool](<https://openusd.org/release/toolset.html#usdcat>)
**Further Reading**: [Flatten -- OpenUSD.org](<inv:usd:std#glossary:flatten>), [usdcat Tool](<inv:usd:std#toolset:usdcat>)

Gprim

Expand Down Expand Up @@ -438,7 +438,7 @@ Prim Definition
The prim definition combines a prim's IsA schema and applied API schemas to determine its built-in properties and metadata beyond its authored scene description. It also provides fallback values for these built-in elements during value resolution, accessible through the `UsdPrimDefinition` class.

**Also Known As:** *type definition, schema definition*
**Further Reading**: [Prim Definition -- OpenUSD.org](<inv:usd:std#glossary:prim definition>), [UsdPrimDefinition API](<https://openusd.org/release/api/class_usd_prim_definition.html>)
**Further Reading**: [Prim Definition -- OpenUSD.org](<inv:usd:std#glossary:prim definition>), {usdcpp}`UsdPrimDefinition`

Prim Spec

Expand Down Expand Up @@ -518,7 +518,7 @@ Purpose

Purpose is a UsdGeomImageable attribute that provides visibility categories that gate scenegraph traversals, with values including "default" (general geometry), "render" (final quality), "proxy" (lightweight preview), and "guide" (visualization helpers). This allows clients to independently include or exclude geometry categories during traversals like rendering or bounding box computation. Purpose is inherited down the namespace hierarchy until explicitly overridden.

**Further Reading**: [Purpose -- OpenUSD.org](<inv:usd:std#glossary:purpose>), [UsdGeomImageable](<https://openusd.org/release/api/class_usd_geom_imageable.html>)
**Further Reading**: [Purpose -- OpenUSD.org](<inv:usd:std#glossary:purpose>), {usdcpp}`UsdGeomImageable`

Reference

Expand Down Expand Up @@ -571,7 +571,7 @@ Session Layer

Created optionally with a stage, the session layer is the strongest layer in the stage's root layer stack and can have its own sublayers. Session layers embody application state rather than asset data, and commonly contain UI-driven selections like variant choices, visibility overrides, and activation state. `UsdStage::Save()` does not save the session layer, as it's considered temporary application state rather than permanent scene data.

**Further Reading**: [Session Layer -- OpenUSD.org](<inv:usd:std#glossary:session layer>), [usdview](<https://openusd.org/release/toolset.html#usdview>)
**Further Reading**: [Session Layer -- OpenUSD.org](<inv:usd:std#glossary:session layer>), [usdview](<inv:usd:std#toolset:usdview>)

Specialize

Expand Down Expand Up @@ -691,7 +691,7 @@ Visibility
Managed by the `UsdGeomImageable` schema, visibility is inherited down the prim hierarchy and can be set to "inherited" (use parent's visibility) or "invisible" (hide this prim and descendants). Unlike active/inactive which affects composition, visibility is purely a rendering concept. Computing visibility requires traversing ancestor prims, so USD provides the efficient `UsdGeomImageable::ComputeVisibility()` method rather than simple attribute queries.

**Also Known As:** *prim visibility*
**Further Reading**: [Visibility -- OpenUSD.org](<inv:usd:std#glossary:visibility>), [UsdGeomImageable](<https://openusd.org/release/api/class_usd_geom_imageable.html>)
**Further Reading**: [Visibility -- OpenUSD.org](<inv:usd:std#glossary:visibility>), {usdcpp}`UsdGeomImageable`

:::

4 changes: 2 additions & 2 deletions docs/scene-description-blueprints/lights.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ from lousd.utils.helperfunctions import create_new_stage

[`UsdLux`](https://openusd.org/release/api/usd_lux_page_front.html) is a USD lighting schema that provides a representation for lights.

One of the schemas in `UsdLux` is [`DistantLight`](https://openusd.org/release/api/class_usd_lux_distant_light.html). A light is emitted from a distance source along the -Z axis. This is commonly known as a directional light.
One of the schemas in `UsdLux` is {usdcpp}`UsdLuxDistantLight`. A light is emitted from a distance source along the -Z axis. This is commonly known as a directional light.

```{code-cell}
:test-tags: [lights-distant-light]
Expand Down Expand Up @@ -119,7 +119,7 @@ DisplayUSD(file_path, show_usd_code=True)

### Example 2: Setting Light Properties

We're going to define two new prims, [`SphereLight`](https://openusd.org/dev/api/class_usd_lux_sphere_light.html) and [`DistantLight`](https://openusd.org/release/api/class_usd_lux_distant_light.html), and set a few properties for them.
We're going to define two new prims, {usdcpp}`UsdLuxSphereLight` and {usdcpp}`UsdLuxDistantLight`, and set a few properties for them.


```{code-cell}
Expand Down
2 changes: 1 addition & 1 deletion docs/scene-description-blueprints/materials-shaders.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ from lousd.utils.helperfunctions import create_new_stage

[`UsdShade`](https://openusd.org/release/api/usd_shade_page_front.html) is a {term}`schema <Schema>` for creating and binding materials.

[`Material`](https://openusd.org/release/api/class_usd_shade_material.html) provides a container to store data for defining a "shading material" to a renderer.
{usdcpp}`UsdShadeMaterial` provides a container to store data for defining a "shading material" to a renderer.

`UsdShade` and `Materials` will be covered in later topics and are only covered here to show another use case for schema-specific APIs.

Expand Down
4 changes: 2 additions & 2 deletions docs/scene-description-blueprints/scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ from lousd.utils.helperfunctions import create_new_stage
```

### Example 1: Define a Scope
[`Scope`](https://openusd.org/release/api/class_usd_geom_scope.html) is a grouping primitive and does NOT have transformability. It can be used to organize libraries with large numbers of entry points. It also is best to group actors and environments under partitioning Scopes. Besides navigating, it's easy for a user to {term}`deactivate <Active and Inactive>` all actors or environments by deactivating the root scope.
{usdcpp}`UsdGeomScope` is a grouping primitive and does NOT have transformability. It can be used to organize libraries with large numbers of entry points. It also is best to group actors and environments under partitioning Scopes. Besides navigating, it's easy for a user to {term}`deactivate <Active and Inactive>` all actors or environments by deactivating the root scope.

We can define `Scope`using [`UsdGeom.Scope.Define()`](https://openusd.org/release/api/class_usd_geom_scope.html#acdb17fed396719a9a21294ebca0116ae).
We can define `Scope`using {usdcpp}`UsdGeomScope::Define`.

```{code-cell}
:test-tags: [scope-define-scopes]
Expand Down
Loading
Loading