Skip to content

Commit

Permalink
Add schema names changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaScheller committed Feb 3, 2024
1 parent 800edd5 commit 26b6520
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions code/core/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def "cube" (
# you have to use this for codeless schemas.
# prim.RemoveAppliedSchema("SkelBindingAPI")
# Single-Apply API Schemas
prim.ApplyAPI("UsdGeomModelAPI")
prim.ApplyAPI("GeomModelAPI") # Older USD versions: prim.ApplyAPI("UsdGeomModelAPI")

### Low Level ###
# To set applied API schemas via the low level API, we just
Expand All @@ -465,7 +465,7 @@ def "cube" (
prim_spec.typeName = "Xform"
# Applied Schemas
schemas = Sdf.TokenListOp.Create(
prependedItems=["SkelBindingAPI", "UsdGeomModelAPI"]
prependedItems=["SkelBindingAPI", "GeomModelAPI"]
)
prim_spec.SetInfo("apiSchemas", schemas)
#// ANCHOR_END: dataContainerPrimSchemas
Expand Down Expand Up @@ -499,7 +499,7 @@ def "cube" (
stage = Usd.Stage.CreateInMemory()
prim_path = Sdf.Path("/bicycle")
prim = stage.DefinePrim(prim_path, "Xform")
prim.ApplyAPI("UsdGeomModelAPI")
prim.ApplyAPI("GeomModelAPI")
print(prim.IsA(UsdGeom.Xform)) # Returns: True
print(prim.IsA(Tf.Type.FindByName('UsdGeomXform'))) # Returns: True
prim_type_info = prim.GetPrimTypeInfo()
Expand Down Expand Up @@ -2093,7 +2093,7 @@ def "prim" (
# Check if it can be applied
print(UsdGeom.MotionAPI.CanApply(prim)) # Returns True
# Apply API schema (in active layer),
prim.ApplyAPI("UsdGeomModelAPI") # Returns: True
prim.ApplyAPI("GeomModelAPI") # Returns: True, older USD versions: prim.ApplyAPI("UsdGeomModelAPI")
# Add applied schema
# This does not check if the schema actually exists,
# you have to use this for codeless schemas.
Expand All @@ -2102,7 +2102,7 @@ def "prim" (
applied_api_schema = UsdGeom.MotionAPI.Apply(prim)
# Remove applied schema (in active layer)
# prim.RemoveAppliedSchema("SkelBindingAPI")
# prim.RemoveAPI("UsdGeomModelAPI")
# prim.RemoveAPI("GeomModelAPI")
# For multi-apply schemas, we can feed in our custom name,
# for example for collections it drives the collection name.
prim.ApplyAPI("UsdCollectionAPI", "myCoolCollectionName")
Expand Down
2 changes: 1 addition & 1 deletion docs/src/core/elements/animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Usd encodes time related data in a very simple format:
~~~admonish tip
- Terminology: A single time/value pair is called `time sample`, if an attribute doesn't have time samples, it has `default` value (Which just means it has a single static value).
- Time samples are encoded in a simple {\<time(frame)\>: \<value\>} dict.
- If a frame is requested where no time samples exist, it will be interpolated if the data type allows it and non changing array lengths in neighbour time samples exist. Value queries before/after the first/last time sample will be clamped to these time samples, if you want a cache in a different FPS format to match a certain frame range.
- If a frame is requested where no time samples exist, it will be interpolated if the data type allows it and non changing array lengths in neighbour time samples exist. Value queries before/after the first/last time sample will be clamped to these time samples.
- Time samples are encoded unitless/per frame and not in time units. This means they have to be shifted depending on the current frames per second.
- Only attributes can carry time sample data. (So composition arcs can not be time animated, only offset/scaled (see the LayerOffset section on this page)).
Expand Down
2 changes: 1 addition & 1 deletion docs/src/core/elements/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Here is an example of the inheritance graph of the [UsdGeom.Imageable](https://o
- Adds additional metadata/properties to prim and provides methods to manipulate these.
- The schema name is added to the `apiSchemas` metadata, it contributes to the prim definition.
- We can check if it is applied to a prim via `prim.HasAPI(<APISchemaType>)`
- Applied via `SchemaClassAPI.Apply(prim)` e.g. `UsdGeom.ModelAPI.Apply(prim)`/`prim_spec.SetInfo("apiSchemas", Sdf.TokenListOp.Create(prependedItems=["UsdGeomModelAPI"]))`
- Applied via `SchemaClassAPI.Apply(prim)` e.g. `UsdGeom.ModelAPI.Apply(prim)`/`prim_spec.SetInfo("apiSchemas", Sdf.TokenListOp.Create(prependedItems=["GeomModelAPI"]))`
- `API Schemas (Usd.APISchemaBase)` -> `Applied API Schemas` -> `Single Apply API Schemas`:
- Can only be applied once per prim
- `API Schemas (Usd.APISchemaBase)` -> `Applied API Schemas` -> `Multi Apply API Schemas`:
Expand Down

0 comments on commit 26b6520

Please sign in to comment.