UsdVol module
Summary: The UsdVol module provides schemas for representing volumes (smoke, fire, etc).
Classes:
Field3D field primitive. |
|
Base class for field primitives defined by an external file. |
|
Base class for field primitives. |
|
OpenVDB field primitive. |
|
A renderable volume primitive. |
- class pxr.UsdVol.Field3DAsset
Field3D field primitive. The FieldAsset filePath attribute must specify a file in the Field3D format on disk.
For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdVolTokens. So to set an attribute to the value”rightHanded”, use UsdVolTokens->rightHanded as the value.
Methods:
CreateFieldDataTypeAttr
(defaultValue, ...)See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
CreateFieldPurposeAttr
(defaultValue, ...)See GetFieldPurposeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
classmethod Define(stage, path) -> Field3DAsset
classmethod Get(stage, path) -> Field3DAsset
Token which is used to indicate the data type of an individual field.
Optional token which can be used to indicate the purpose or grouping of an individual field.
classmethod GetSchemaAttributeNames(includeInherited) -> list[str]
- CreateFieldDataTypeAttr(defaultValue, writeSparsely) Attribute
See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.- Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
- CreateFieldPurposeAttr(defaultValue, writeSparsely) Attribute
See GetFieldPurposeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.- Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
- static Define()
classmethod Define(stage, path) -> Field3DAsset
Attempt to ensure a UsdPrim adhering to this schema at
path
is defined (according to UsdPrim::IsDefined() ) on this stage.If a prim adhering to this schema at
path
is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema’s prim type name for the prim atpath
at the current EditTarget. Author SdfPrimSpec s withspecifier
== SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors.The given path must be an absolute prim path that does not contain any variant selections.
If it is impossible to author any of the necessary PrimSpecs, (for example, in case path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid UsdPrim.
Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget.
- static Get()
classmethod Get(stage, path) -> Field3DAsset
Return a UsdVolField3DAsset holding the prim adhering to this schema at
path
onstage
.If no prim exists at
path
onstage
, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:UsdVolField3DAsset(stage->GetPrimAtPath(path));
- GetFieldDataTypeAttr() Attribute
Token which is used to indicate the data type of an individual field.
Authors use this to tell consumers more about the field without opening the file on disk. The list of allowed tokens reflects the available choices for Field3d volumes.
Declaration
token fieldDataType
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
Allowed Values
half, float, double, half3, float3, double3
- GetFieldPurposeAttr() Attribute
Optional token which can be used to indicate the purpose or grouping of an individual field.
Clients which consume Field3D files should treat this as the Field3D field name.
Declaration
token fieldPurpose
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
- static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[str]
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended methods of the schemas involved.
- Parameters
includeInherited (bool) –
- class pxr.UsdVol.FieldAsset
Base class for field primitives defined by an external file.
For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdVolTokens. So to set an attribute to the value”rightHanded”, use UsdVolTokens->rightHanded as the value.
Methods:
CreateFieldDataTypeAttr
(defaultValue, ...)See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
CreateFieldIndexAttr
(defaultValue, writeSparsely)See GetFieldIndexAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
CreateFieldNameAttr
(defaultValue, writeSparsely)See GetFieldNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
CreateFilePathAttr
(defaultValue, writeSparsely)See GetFilePathAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
CreateVectorDataRoleHintAttr
(defaultValue, ...)See GetVectorDataRoleHintAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
classmethod Get(stage, path) -> FieldAsset
Token which is used to indicate the data type of an individual field.
A file can contain multiple fields with the same name.
Name of an individual field within the file specified by the filePath attribute.
An asset path attribute that points to a file on disk.
classmethod GetSchemaAttributeNames(includeInherited) -> list[str]
Optional token which is used to indicate the role of a vector valued field.
- CreateFieldDataTypeAttr(defaultValue, writeSparsely) Attribute
See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.- Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
- CreateFieldIndexAttr(defaultValue, writeSparsely) Attribute
See GetFieldIndexAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.- Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
- CreateFieldNameAttr(defaultValue, writeSparsely) Attribute
See GetFieldNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.- Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
- CreateFilePathAttr(defaultValue, writeSparsely) Attribute
See GetFilePathAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.- Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
- CreateVectorDataRoleHintAttr(defaultValue, writeSparsely) Attribute
See GetVectorDataRoleHintAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.- Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
- static Get()
classmethod Get(stage, path) -> FieldAsset
Return a UsdVolFieldAsset holding the prim adhering to this schema at
path
onstage
.If no prim exists at
path
onstage
, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:UsdVolFieldAsset(stage->GetPrimAtPath(path));
- GetFieldDataTypeAttr() Attribute
Token which is used to indicate the data type of an individual field.
Authors use this to tell consumers more about the field without opening the file on disk. The list of allowed tokens is specified with the specific asset type. A missing value is considered an error.
Declaration
token fieldDataType
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
- GetFieldIndexAttr() Attribute
A file can contain multiple fields with the same name.
This optional attribute is an index used to disambiguate between these multiple fields with the same name.
Declaration
int fieldIndex
C++ Type
int
Usd Type
SdfValueTypeNames->Int
- GetFieldNameAttr() Attribute
Name of an individual field within the file specified by the filePath attribute.
Declaration
token fieldName
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
- GetFilePathAttr() Attribute
An asset path attribute that points to a file on disk.
For each supported file format, a separate FieldAsset subclass is required.
This attribute’s value can be animated over time, as most volume asset formats represent just a single timeSample of a volume. However, it does not, at this time, support any pattern substitutions like”$F”.
Declaration
asset filePath
C++ Type
SdfAssetPath
Usd Type
SdfValueTypeNames->Asset
- static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[str]
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended methods of the schemas involved.
- Parameters
includeInherited (bool) –
- GetVectorDataRoleHintAttr() Attribute
Optional token which is used to indicate the role of a vector valued field.
This can drive the data type in which fields are made available in a renderer or whether the vector values are to be transformed.
Declaration
token vectorDataRoleHint ="None"
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
Allowed Values
None, Point, Normal, Vector, Color
- class pxr.UsdVol.FieldBase
Base class for field primitives.
Methods:
classmethod Get(stage, path) -> FieldBase
classmethod GetSchemaAttributeNames(includeInherited) -> list[str]
- static Get()
classmethod Get(stage, path) -> FieldBase
Return a UsdVolFieldBase holding the prim adhering to this schema at
path
onstage
.If no prim exists at
path
onstage
, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:UsdVolFieldBase(stage->GetPrimAtPath(path));
- static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[str]
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended methods of the schemas involved.
- Parameters
includeInherited (bool) –
- class pxr.UsdVol.OpenVDBAsset
OpenVDB field primitive. The FieldAsset filePath attribute must specify a file in the OpenVDB format on disk.
For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdVolTokens. So to set an attribute to the value”rightHanded”, use UsdVolTokens->rightHanded as the value.
Methods:
CreateFieldClassAttr
(defaultValue, writeSparsely)See GetFieldClassAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
CreateFieldDataTypeAttr
(defaultValue, ...)See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
classmethod Define(stage, path) -> OpenVDBAsset
classmethod Get(stage, path) -> OpenVDBAsset
Optional token which can be used to indicate the class of an individual grid.
Token which is used to indicate the data type of an individual field.
classmethod GetSchemaAttributeNames(includeInherited) -> list[str]
- CreateFieldClassAttr(defaultValue, writeSparsely) Attribute
See GetFieldClassAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.- Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
- CreateFieldDataTypeAttr(defaultValue, writeSparsely) Attribute
See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.- Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
- static Define()
classmethod Define(stage, path) -> OpenVDBAsset
Attempt to ensure a UsdPrim adhering to this schema at
path
is defined (according to UsdPrim::IsDefined() ) on this stage.If a prim adhering to this schema at
path
is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema’s prim type name for the prim atpath
at the current EditTarget. Author SdfPrimSpec s withspecifier
== SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors.The given path must be an absolute prim path that does not contain any variant selections.
If it is impossible to author any of the necessary PrimSpecs, (for example, in case path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid UsdPrim.
Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget.
- static Get()
classmethod Get(stage, path) -> OpenVDBAsset
Return a UsdVolOpenVDBAsset holding the prim adhering to this schema at
path
onstage
.If no prim exists at
path
onstage
, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:UsdVolOpenVDBAsset(stage->GetPrimAtPath(path));
- GetFieldClassAttr() Attribute
Optional token which can be used to indicate the class of an individual grid.
This is a mapping to openvdb::GridClass where the values are GRID_LEVEL_SET, GRID_FOG_VOLUME, GRID_STAGGERED, and GRID_UNKNOWN.
Declaration
token fieldClass
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
Allowed Values
levelSet, fogVolume, staggered, unknown
- GetFieldDataTypeAttr() Attribute
Token which is used to indicate the data type of an individual field.
Authors use this to tell consumers more about the field without opening the file on disk. The list of allowed tokens reflects the available choices for OpenVDB volumes.
Declaration
token fieldDataType
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
Allowed Values
half, float, double, int, uint, int64, half2, float2, double2, int2, half3, float3, double3, int3, matrix3d, matrix4d, quatd, bool, mask, string
- static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[str]
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended methods of the schemas involved.
- Parameters
includeInherited (bool) –
- class pxr.UsdVol.Tokens
Attributes:
- bool_ = 'bool'
- color = 'Color'
- double2 = 'double2'
- double3 = 'double3'
- double_ = 'double'
- field = 'field'
- fieldClass = 'fieldClass'
- fieldDataType = 'fieldDataType'
- fieldIndex = 'fieldIndex'
- fieldName = 'fieldName'
- fieldPurpose = 'fieldPurpose'
- filePath = 'filePath'
- float2 = 'float2'
- float3 = 'float3'
- float_ = 'float'
- fogVolume = 'fogVolume'
- half = 'half'
- half2 = 'half2'
- half3 = 'half3'
- int2 = 'int2'
- int3 = 'int3'
- int64 = 'int64'
- int_ = 'int'
- levelSet = 'levelSet'
- mask = 'mask'
- matrix3d = 'matrix3d'
- matrix4d = 'matrix4d'
- none_ = 'None'
- normal = 'Normal'
- point = 'Point'
- quatd = 'quatd'
- staggered = 'staggered'
- string = 'string'
- uint = 'uint'
- unknown = 'unknown'
- vector = 'Vector'
- vectorDataRoleHint = 'vectorDataRoleHint'
- class pxr.UsdVol.Volume
A renderable volume primitive. A volume is made up of any number of FieldBase primitives bound together in this volume. Each FieldBase primitive is specified as a relationship with a namespace prefix of”field”.
The relationship name is used by the renderer to associate individual fields with the named input parameters on the volume shader. Using this indirect approach to connecting fields to shader parameters (rather than using the field prim’s name) allows a single field to be reused for different shader inputs, or to be used as different shader parameters when rendering different Volumes. This means that the name of the field prim is not relevant to its contribution to the volume prims which refer to it. Nor does the field prim’s location in the scene graph have any relevance, and Volumes may refer to fields anywhere in the scene graph. However, unless Field prims need to be shared by multiple Volumes, a Volume’s Field prims should be located under the Volume in namespace, for enhanced organization.
Methods:
BlockFieldRelationship
(name)Blocks an existing field relationship on this volume, ensuring it will not be enumerated by GetFieldPaths() .
CreateFieldRelationship
(name, fieldPath)Creates a relationship on this volume that targets the specified field.
classmethod Define(stage, path) -> Volume
classmethod Get(stage, path) -> Volume
GetFieldPath
(name)Checks if there is an existing field relationship with a given name, and if so, returns the path to the Field prim it targets, or else the empty path.
Return a map of field relationship names to the fields themselves, represented as prim paths.
classmethod GetSchemaAttributeNames(includeInherited) -> list[str]
HasFieldRelationship
(name)Checks if there is an existing field relationship with a given name.
- BlockFieldRelationship(name) bool
Blocks an existing field relationship on this volume, ensuring it will not be enumerated by GetFieldPaths() .
Returns true if the relationship existed, false if it did not. In other words the return value indicates whether the volume prim was changed.
The name lookup automatically applies the field relationship namespacing, if it isn’t specified in the name token.
- Parameters
name (str) –
- CreateFieldRelationship(name, fieldPath) bool
Creates a relationship on this volume that targets the specified field.
If an existing relationship exists with the same name, it is replaced (since only one target is allowed for each named relationship).
Returns
true
if the relationship was successfully created and set - it is legal to call this method for a field relationship that already”exists”, i.e. already posesses scene description, as this is the only method we provide for setting a field relatioonship’s value, to help enforce that field relationships can have only a single (or no) target.fieldPath
- can be a prim path, or the path of another relationship, to effect Relationship Forwarding The name lookup automatically applies the field relationship namespacing, if it isn’t specified in the name token.
- Parameters
name (str) –
fieldPath (Path) –
- static Define()
classmethod Define(stage, path) -> Volume
Attempt to ensure a UsdPrim adhering to this schema at
path
is defined (according to UsdPrim::IsDefined() ) on this stage.If a prim adhering to this schema at
path
is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema’s prim type name for the prim atpath
at the current EditTarget. Author SdfPrimSpec s withspecifier
== SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors.The given path must be an absolute prim path that does not contain any variant selections.
If it is impossible to author any of the necessary PrimSpecs, (for example, in case path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid UsdPrim.
Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget.
- static Get()
classmethod Get(stage, path) -> Volume
Return a UsdVolVolume holding the prim adhering to this schema at
path
onstage
.If no prim exists at
path
onstage
, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:UsdVolVolume(stage->GetPrimAtPath(path));
- GetFieldPath(name) Path
Checks if there is an existing field relationship with a given name, and if so, returns the path to the Field prim it targets, or else the empty path.
The name lookup automatically applies the field relationship namespacing, if it isn’t specified in the name token.
- Parameters
name (str) –
- GetFieldPaths() FieldMap
Return a map of field relationship names to the fields themselves, represented as prim paths.
This map provides all the information that should be needed to tie fields to shader parameters and render this volume.
The field relationship names that server as the map keys will have the field namespace stripped from them.
- static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[str]
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended methods of the schemas involved.
- Parameters
includeInherited (bool) –
- HasFieldRelationship(name) bool
Checks if there is an existing field relationship with a given name.
This query will return
true
even for a field relationship that has been blocked and therefore will not contribute to the map returned by GetFieldRelationships()The name lookup automatically applies the field relationship namespacing, if it isn’t specified in the name token.
- Parameters
name (str) –