add usd-21-11-win64_py39
This commit is contained in:
1 parent
41d23e71ba
commit
ba5e1f7e67
15684 files changed
+3069957
No files matched your search
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright 2017 Pixar
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
||||
// with the following modification; you may not use this file except in
|
||||
// compliance with the Apache License and the following modification to it:
|
||||
// Section 6. Trademarks. is deleted and replaced with:
|
||||
//
|
||||
// 6. Trademarks. This License does not grant permission to use the trade
|
||||
// names, trademarks, service marks, or product names of the Licensor
|
||||
// and its affiliates, except as required to comply with Section 4(c) of
|
||||
// the License and to reproduce the content of the NOTICE file.
|
||||
//
|
||||
// You may obtain a copy of the Apache License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the Apache License with the above modification is
|
||||
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the Apache License for the specific
|
||||
// language governing permissions and limitations under the Apache License.
|
||||
//
|
||||
#ifndef USDRI_API_H
|
||||
#define USDRI_API_H
|
||||
|
||||
#include "pxr/base/arch/export.h"
|
||||
|
||||
#if defined(PXR_STATIC)
|
||||
# define USDRI_API
|
||||
# define USDRI_API_TEMPLATE_CLASS(...)
|
||||
# define USDRI_API_TEMPLATE_STRUCT(...)
|
||||
# define USDRI_LOCAL
|
||||
#else
|
||||
# if defined(USDRI_EXPORTS)
|
||||
# define USDRI_API ARCH_EXPORT
|
||||
# define USDRI_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDRI_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# else
|
||||
# define USDRI_API ARCH_IMPORT
|
||||
# define USDRI_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDRI_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# endif
|
||||
# define USDRI_LOCAL ARCH_HIDDEN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,355 @@
|
||||
//
|
||||
// Copyright 2016 Pixar
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
||||
// with the following modification; you may not use this file except in
|
||||
// compliance with the Apache License and the following modification to it:
|
||||
// Section 6. Trademarks. is deleted and replaced with:
|
||||
//
|
||||
// 6. Trademarks. This License does not grant permission to use the trade
|
||||
// names, trademarks, service marks, or product names of the Licensor
|
||||
// and its affiliates, except as required to comply with Section 4(c) of
|
||||
// the License and to reproduce the content of the NOTICE file.
|
||||
//
|
||||
// You may obtain a copy of the Apache License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the Apache License with the above modification is
|
||||
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the Apache License for the specific
|
||||
// language governing permissions and limitations under the Apache License.
|
||||
//
|
||||
#ifndef USDRI_GENERATED_MATERIALAPI_H
|
||||
#define USDRI_GENERATED_MATERIALAPI_H
|
||||
|
||||
/// \file usdRi/materialAPI.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usd/usdRi/api.h"
|
||||
#include "pxr/usd/usd/apiSchemaBase.h"
|
||||
#include "pxr/usd/usd/prim.h"
|
||||
#include "pxr/usd/usd/stage.h"
|
||||
#include "pxr/usd/usdRi/tokens.h"
|
||||
|
||||
#include "pxr/usd/usdShade/input.h"
|
||||
#include "pxr/usd/usdShade/output.h"
|
||||
#include "pxr/usd/usdShade/material.h"
|
||||
|
||||
|
||||
#include "pxr/base/vt/value.h"
|
||||
|
||||
#include "pxr/base/gf/vec3d.h"
|
||||
#include "pxr/base/gf/vec3f.h"
|
||||
#include "pxr/base/gf/matrix4d.h"
|
||||
|
||||
#include "pxr/base/tf/token.h"
|
||||
#include "pxr/base/tf/type.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// RIMATERIALAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class UsdRiMaterialAPI
|
||||
///
|
||||
///
|
||||
/// \deprecated Materials should use UsdShadeMaterial instead.
|
||||
/// This schema will be removed in a future release.
|
||||
///
|
||||
/// This API provides outputs that connect a material prim to prman
|
||||
/// shaders and RIS objects.
|
||||
///
|
||||
/// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
|
||||
/// that are text/tokens, the actual token is published and defined in \ref UsdRiTokens.
|
||||
/// So to set an attribute to the value "rightHanded", use UsdRiTokens->rightHanded
|
||||
/// as the value.
|
||||
///
|
||||
class UsdRiMaterialAPI : public UsdAPISchemaBase
|
||||
{
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a UsdRiMaterialAPI on UsdPrim \p prim .
|
||||
/// Equivalent to UsdRiMaterialAPI::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit UsdRiMaterialAPI(const UsdPrim& prim=UsdPrim())
|
||||
: UsdAPISchemaBase(prim)
|
||||
{
|
||||
}
|
||||
|
||||
/// Construct a UsdRiMaterialAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over UsdRiMaterialAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit UsdRiMaterialAPI(const UsdSchemaBase& schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj)
|
||||
{
|
||||
}
|
||||
|
||||
/// Destructor.
|
||||
USDRI_API
|
||||
virtual ~UsdRiMaterialAPI();
|
||||
|
||||
/// 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.
|
||||
USDRI_API
|
||||
static const TfTokenVector &
|
||||
GetSchemaAttributeNames(bool includeInherited=true);
|
||||
|
||||
/// Return a UsdRiMaterialAPI holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// UsdRiMaterialAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
USDRI_API
|
||||
static UsdRiMaterialAPI
|
||||
Get(const UsdStagePtr &stage, const SdfPath &path);
|
||||
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
USDRI_API
|
||||
static bool
|
||||
CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "RiMaterialAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid UsdRiMaterialAPI object is returned upon success.
|
||||
/// An invalid (or empty) UsdRiMaterialAPI object is returned upon
|
||||
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
USDRI_API
|
||||
static UsdRiMaterialAPI
|
||||
Apply(const UsdPrim &prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
USDRI_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
USDRI_API
|
||||
static const TfType &_GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
USDRI_API
|
||||
const TfType &_GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// SURFACE
|
||||
// --------------------------------------------------------------------- //
|
||||
///
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `token outputs:ri:surface` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
USDRI_API
|
||||
UsdAttribute GetSurfaceAttr() const;
|
||||
|
||||
/// See GetSurfaceAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
USDRI_API
|
||||
UsdAttribute CreateSurfaceAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// DISPLACEMENT
|
||||
// --------------------------------------------------------------------- //
|
||||
///
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `token outputs:ri:displacement` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
USDRI_API
|
||||
UsdAttribute GetDisplacementAttr() const;
|
||||
|
||||
/// See GetDisplacementAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
USDRI_API
|
||||
UsdAttribute CreateDisplacementAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// VOLUME
|
||||
// --------------------------------------------------------------------- //
|
||||
///
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `token outputs:ri:volume` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
USDRI_API
|
||||
UsdAttribute GetVolumeAttr() const;
|
||||
|
||||
/// See GetVolumeAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
USDRI_API
|
||||
UsdAttribute CreateVolumeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
|
||||
/// A constructor for creating a MaterialAPI object from a material prim.
|
||||
explicit UsdRiMaterialAPI(const UsdShadeMaterial& material)
|
||||
: UsdRiMaterialAPI(material.GetPrim())
|
||||
{
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
/// \name Outputs API
|
||||
// --------------------------------------------------------------------- //
|
||||
/// @{
|
||||
|
||||
/// Returns the "surface" output associated with the material.
|
||||
USDRI_API
|
||||
UsdShadeOutput GetSurfaceOutput() const;
|
||||
|
||||
/// Returns the "displacement" output associated with the material.
|
||||
USDRI_API
|
||||
UsdShadeOutput GetDisplacementOutput() const;
|
||||
|
||||
/// Returns the "volume" output associated with the material.
|
||||
USDRI_API
|
||||
UsdShadeOutput GetVolumeOutput() const;
|
||||
|
||||
/// @}
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
/// \name API for setting sources of outputs
|
||||
// --------------------------------------------------------------------- //
|
||||
/// @{
|
||||
|
||||
USDRI_API
|
||||
bool SetSurfaceSource(const SdfPath &surfacePath) const;
|
||||
|
||||
USDRI_API
|
||||
bool SetDisplacementSource(const SdfPath &displacementPath) const;
|
||||
|
||||
USDRI_API
|
||||
bool SetVolumeSource(const SdfPath &volumePath) const;
|
||||
|
||||
/// @}
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
/// \name Shaders API
|
||||
// --------------------------------------------------------------------- //
|
||||
/// @{
|
||||
|
||||
/// Returns a valid shader object if the "surface" output on the
|
||||
/// material is connected to one.
|
||||
///
|
||||
/// If \p ignoreBaseMaterial is true and if the "surface" shader source
|
||||
/// is specified in the base-material of this material, then this
|
||||
/// returns an invalid shader object.
|
||||
USDRI_API
|
||||
UsdShadeShader GetSurface(bool ignoreBaseMaterial=false) const;
|
||||
|
||||
/// Returns a valid shader object if the "displacement" output on the
|
||||
/// material is connected to one.
|
||||
///
|
||||
/// If \p ignoreBaseMaterial is true and if the "displacement" shader source
|
||||
/// is specified in the base-material of this material, then this
|
||||
/// returns an invalid shader object.
|
||||
USDRI_API
|
||||
UsdShadeShader GetDisplacement(bool ignoreBaseMaterial=false) const;
|
||||
|
||||
/// Returns a valid shader object if the "volume" output on the
|
||||
/// material is connected to one.
|
||||
///
|
||||
/// If \p ignoreBaseMaterial is true and if the "volume" shader source
|
||||
/// is specified in the base-material of this material, then this
|
||||
/// returns an invalid shader object.
|
||||
USDRI_API
|
||||
UsdShadeShader GetVolume(bool ignoreBaseMaterial=false) const;
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
/// Walks the namespace subtree below the material and computes a map
|
||||
/// containing the list of all inputs on the material and the associated
|
||||
/// vector of consumers of their values. The consumers can be inputs on
|
||||
/// shaders within the material or on node-graphs under it.
|
||||
USDRI_API
|
||||
UsdShadeNodeGraph::InterfaceInputConsumersMap
|
||||
ComputeInterfaceInputConsumersMap(
|
||||
bool computeTransitiveConsumers=false) const;
|
||||
|
||||
/// @}
|
||||
|
||||
private:
|
||||
UsdShadeShader _GetSourceShaderObject(const UsdShadeOutput &output,
|
||||
bool ignoreBaseMaterial) const;
|
||||
|
||||
// Helper method to get the deprecated 'bxdf' output.
|
||||
UsdShadeOutput _GetBxdfOutput(const UsdPrim &materialPrim) const;
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Copyright 2016 Pixar
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
||||
// with the following modification; you may not use this file except in
|
||||
// compliance with the Apache License and the following modification to it:
|
||||
// Section 6. Trademarks. is deleted and replaced with:
|
||||
//
|
||||
// 6. Trademarks. This License does not grant permission to use the trade
|
||||
// names, trademarks, service marks, or product names of the Licensor
|
||||
// and its affiliates, except as required to comply with Section 4(c) of
|
||||
// the License and to reproduce the content of the NOTICE file.
|
||||
//
|
||||
// You may obtain a copy of the Apache License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the Apache License with the above modification is
|
||||
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the Apache License for the specific
|
||||
// language governing permissions and limitations under the Apache License.
|
||||
//
|
||||
#ifndef PXR_USD_USD_RI_RMAN_UTILITIES_H
|
||||
#define PXR_USD_USD_RI_RMAN_UTILITIES_H
|
||||
|
||||
/// \file usdRi/rmanUtilities.h
|
||||
/// Utilities for converting between USD encodings and Renderman encodings in
|
||||
/// cases where there is a difference.
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usd/usdRi/api.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class TfToken;
|
||||
|
||||
/// Given a \p token representing a UsdGeom interpolate boundary value, returns
|
||||
/// corresponding rman enum (converted to int).
|
||||
USDRI_API
|
||||
int UsdRiConvertToRManInterpolateBoundary(const TfToken &token);
|
||||
|
||||
/// Given the integer \p i that corresponds to an rman enum for interpolate
|
||||
/// boundary condition, returns the equivalent UsdGeom token.
|
||||
USDRI_API
|
||||
const TfToken &UsdRiConvertFromRManInterpolateBoundary(int i);
|
||||
|
||||
/// Given a \p token representing a UsdGeom face-varying interpolate boundary
|
||||
/// value, returns corresponding rman enum (converted to int).
|
||||
USDRI_API
|
||||
int UsdRiConvertToRManFaceVaryingLinearInterpolation(const TfToken &token);
|
||||
|
||||
/// Given the integer \p i that corresponds to an rman enum for face-varying
|
||||
/// interpolate boundary condition, returns the equivalent UsdGeom token.
|
||||
USDRI_API
|
||||
const TfToken &UsdRiConvertFromRManFaceVaryingLinearInterpolation(int i);
|
||||
|
||||
/// Given a \p token representing a UsdGeom Catmull-Clark triangle subdivision
|
||||
/// rule value, returns corresponding rman enum (converted to int).
|
||||
USDRI_API
|
||||
int UsdRiConvertToRManTriangleSubdivisionRule(const TfToken &token);
|
||||
|
||||
/// Given the integer \p i that corresponds to an rman enum for a Catmull-
|
||||
/// Clark triangle subdivision rule, returns the equivalent UsdGeom token.
|
||||
USDRI_API
|
||||
const TfToken &UsdRiConvertFromRManTriangleSubdivisionRule(int i);
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif //PXR_USD_USD_RI_RMAN_UTILITIES_H
|
||||
@@ -0,0 +1,334 @@
|
||||
//
|
||||
// Copyright 2016 Pixar
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
||||
// with the following modification; you may not use this file except in
|
||||
// compliance with the Apache License and the following modification to it:
|
||||
// Section 6. Trademarks. is deleted and replaced with:
|
||||
//
|
||||
// 6. Trademarks. This License does not grant permission to use the trade
|
||||
// names, trademarks, service marks, or product names of the Licensor
|
||||
// and its affiliates, except as required to comply with Section 4(c) of
|
||||
// the License and to reproduce the content of the NOTICE file.
|
||||
//
|
||||
// You may obtain a copy of the Apache License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the Apache License with the above modification is
|
||||
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the Apache License for the specific
|
||||
// language governing permissions and limitations under the Apache License.
|
||||
//
|
||||
#ifndef USDRI_GENERATED_SPLINEAPI_H
|
||||
#define USDRI_GENERATED_SPLINEAPI_H
|
||||
|
||||
/// \file usdRi/splineAPI.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usd/usdRi/api.h"
|
||||
#include "pxr/usd/usd/apiSchemaBase.h"
|
||||
#include "pxr/usd/usd/prim.h"
|
||||
#include "pxr/usd/usd/stage.h"
|
||||
|
||||
#include "pxr/base/vt/value.h"
|
||||
|
||||
#include "pxr/base/gf/vec3d.h"
|
||||
#include "pxr/base/gf/vec3f.h"
|
||||
#include "pxr/base/gf/matrix4d.h"
|
||||
|
||||
#include "pxr/base/tf/token.h"
|
||||
#include "pxr/base/tf/type.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// RISPLINEAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class UsdRiSplineAPI
|
||||
///
|
||||
///
|
||||
/// \deprecated This API schema will be removed in a future release.
|
||||
///
|
||||
/// RiSplineAPI is a general purpose API schema used to describe
|
||||
/// a named spline stored as a set of attributes on a prim.
|
||||
///
|
||||
/// It is an add-on schema that can be applied many times to a prim with
|
||||
/// different spline names. All the attributes authored by the schema
|
||||
/// are namespaced under "$NAME:spline:", with the name of the
|
||||
/// spline providing a namespace for the attributes.
|
||||
///
|
||||
/// The spline describes a 2D piecewise cubic curve with a position and
|
||||
/// value for each knot. This is chosen to give straightforward artistic
|
||||
/// control over the shape. The supported basis types are:
|
||||
///
|
||||
/// - linear (UsdRiTokens->linear)
|
||||
/// - bspline (UsdRiTokens->bspline)
|
||||
/// - Catmull-Rom (UsdRiTokens->catmullRom)
|
||||
///
|
||||
///
|
||||
class UsdRiSplineAPI : public UsdAPISchemaBase
|
||||
{
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a UsdRiSplineAPI on UsdPrim \p prim .
|
||||
/// Equivalent to UsdRiSplineAPI::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit UsdRiSplineAPI(const UsdPrim& prim=UsdPrim())
|
||||
: UsdAPISchemaBase(prim)
|
||||
{
|
||||
}
|
||||
|
||||
/// Construct a UsdRiSplineAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over UsdRiSplineAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit UsdRiSplineAPI(const UsdSchemaBase& schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj)
|
||||
{
|
||||
}
|
||||
|
||||
/// Destructor.
|
||||
USDRI_API
|
||||
virtual ~UsdRiSplineAPI();
|
||||
|
||||
/// 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.
|
||||
USDRI_API
|
||||
static const TfTokenVector &
|
||||
GetSchemaAttributeNames(bool includeInherited=true);
|
||||
|
||||
/// Return a UsdRiSplineAPI holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// UsdRiSplineAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
USDRI_API
|
||||
static UsdRiSplineAPI
|
||||
Get(const UsdStagePtr &stage, const SdfPath &path);
|
||||
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
USDRI_API
|
||||
static bool
|
||||
CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "RiSplineAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid UsdRiSplineAPI object is returned upon success.
|
||||
/// An invalid (or empty) UsdRiSplineAPI object is returned upon
|
||||
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
USDRI_API
|
||||
static UsdRiSplineAPI
|
||||
Apply(const UsdPrim &prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
USDRI_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
USDRI_API
|
||||
static const TfType &_GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
USDRI_API
|
||||
const TfType &_GetTfType() const override;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
|
||||
/// Construct a UsdRiSplineAPI with the given \p splineName on
|
||||
/// the UsdPrim \p prim .
|
||||
explicit UsdRiSplineAPI(const UsdPrim& prim, const TfToken &splineName,
|
||||
const SdfValueTypeName &valuesTypeName,
|
||||
bool doesDuplicateBSplineEndpoints)
|
||||
: UsdAPISchemaBase(prim)
|
||||
, _splineName(splineName)
|
||||
, _valuesTypeName(valuesTypeName)
|
||||
, _duplicateBSplineEndpoints(doesDuplicateBSplineEndpoints)
|
||||
{
|
||||
}
|
||||
|
||||
/// Construct a UsdRiSplineAPI with the given \p splineName on
|
||||
/// the prim held by \p schemaObj .
|
||||
explicit UsdRiSplineAPI(const UsdSchemaBase& schemaObj,
|
||||
const TfToken &splineName,
|
||||
const SdfValueTypeName &valuesTypeName,
|
||||
bool doesDuplicateBSplineEndpoints)
|
||||
: UsdAPISchemaBase(schemaObj.GetPrim())
|
||||
, _splineName(splineName)
|
||||
, _valuesTypeName(valuesTypeName)
|
||||
, _duplicateBSplineEndpoints(doesDuplicateBSplineEndpoints)
|
||||
{
|
||||
}
|
||||
|
||||
/// Returns true if this UsdRiSplineAPI is configured to ensure
|
||||
/// the endpoints are duplicated when using a bspline basis.
|
||||
///
|
||||
/// Duplicating the endpoints ensures that the spline reaches
|
||||
/// those points at either end of the parameter range.
|
||||
USDRI_API
|
||||
bool DoesDuplicateBSplineEndpoints() const {
|
||||
return _duplicateBSplineEndpoints;
|
||||
}
|
||||
|
||||
/// Returns the intended typename of the values attribute of the spline.
|
||||
USDRI_API
|
||||
SdfValueTypeName GetValuesTypeName() const {
|
||||
return _valuesTypeName;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// INTERPOLATION
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Interpolation method for the spline.
|
||||
///
|
||||
/// \n C++ Type: TfToken
|
||||
/// \n Usd Type: SdfValueTypeNames->Token
|
||||
/// \n Variability: SdfVariabilityUniform
|
||||
/// \n Fallback Value: linear
|
||||
/// \n \ref UsdRiTokens "Allowed Values": [linear, constant, bspline, catmullRom]
|
||||
USDRI_API
|
||||
UsdAttribute GetInterpolationAttr() const;
|
||||
|
||||
/// See GetInterpolationAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
USDRI_API
|
||||
UsdAttribute CreateInterpolationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// POSITIONS
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Positions of the knots.
|
||||
///
|
||||
/// \n C++ Type: VtArray<float>
|
||||
/// \n Usd Type: SdfValueTypeNames->FloatArray
|
||||
/// \n Variability: SdfVariabilityUniform
|
||||
/// \n Fallback Value: No Fallback
|
||||
USDRI_API
|
||||
UsdAttribute GetPositionsAttr() const;
|
||||
|
||||
/// See GetPositionsAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
USDRI_API
|
||||
UsdAttribute CreatePositionsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// VALUES
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Values of the knots.
|
||||
///
|
||||
/// \n C++ Type: See GetValuesTypeName()
|
||||
/// \n Usd Type: See GetValuesTypeName()
|
||||
/// \n Variability: SdfVariabilityUniform
|
||||
/// \n Fallback Value: No Fallback
|
||||
USDRI_API
|
||||
UsdAttribute GetValuesAttr() const;
|
||||
|
||||
/// See GetValuesAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
USDRI_API
|
||||
UsdAttribute CreateValuesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
|
||||
|
||||
/// \anchor UsdRiSplineAPI_Validation
|
||||
/// \name Spline Validation API
|
||||
///
|
||||
/// API for validating the properties of a spline.
|
||||
///
|
||||
/// @{
|
||||
|
||||
/// Validates the attribute values belonging to the spline. Returns true
|
||||
/// if the spline has all valid attribute values. Returns false and
|
||||
/// populates the \p reason output argument if the spline has invalid
|
||||
/// attribute values.
|
||||
///
|
||||
/// Here's the list of validations performed by this method:
|
||||
/// \li the SplineAPI must be fully initialized
|
||||
/// \li interpolation attribute must exist and use an allowed value
|
||||
/// \li the positions array must be a float array
|
||||
/// \li the positions array must be sorted by increasing value
|
||||
/// \li the values array must use the correct value type
|
||||
/// \li the positions and values array must have the same size
|
||||
///
|
||||
USDRI_API
|
||||
bool Validate(std::string *reason) const;
|
||||
|
||||
/// @}
|
||||
|
||||
private:
|
||||
/// Returns the properly-scoped form of the given property name,
|
||||
/// accounting for the spline name.
|
||||
TfToken _GetScopedPropertyName(const TfToken &baseName) const;
|
||||
|
||||
private:
|
||||
const TfToken _splineName;
|
||||
const SdfValueTypeName _valuesTypeName;
|
||||
bool _duplicateBSplineEndpoints;
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,383 @@
|
||||
//
|
||||
// Copyright 2016 Pixar
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
||||
// with the following modification; you may not use this file except in
|
||||
// compliance with the Apache License and the following modification to it:
|
||||
// Section 6. Trademarks. is deleted and replaced with:
|
||||
//
|
||||
// 6. Trademarks. This License does not grant permission to use the trade
|
||||
// names, trademarks, service marks, or product names of the Licensor
|
||||
// and its affiliates, except as required to comply with Section 4(c) of
|
||||
// the License and to reproduce the content of the NOTICE file.
|
||||
//
|
||||
// You may obtain a copy of the Apache License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the Apache License with the above modification is
|
||||
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the Apache License for the specific
|
||||
// language governing permissions and limitations under the Apache License.
|
||||
//
|
||||
#ifndef USDRI_GENERATED_STATEMENTSAPI_H
|
||||
#define USDRI_GENERATED_STATEMENTSAPI_H
|
||||
|
||||
/// \file usdRi/statementsAPI.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usd/usdRi/api.h"
|
||||
#include "pxr/usd/usd/apiSchemaBase.h"
|
||||
#include "pxr/usd/usd/prim.h"
|
||||
#include "pxr/usd/usd/stage.h"
|
||||
|
||||
#include "pxr/usd/usdGeom/primvarsAPI.h"
|
||||
|
||||
|
||||
#include "pxr/base/vt/value.h"
|
||||
|
||||
#include "pxr/base/gf/vec3d.h"
|
||||
#include "pxr/base/gf/vec3f.h"
|
||||
#include "pxr/base/gf/matrix4d.h"
|
||||
|
||||
#include "pxr/base/tf/token.h"
|
||||
#include "pxr/base/tf/type.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// STATEMENTSAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class UsdRiStatementsAPI
|
||||
///
|
||||
/// Container namespace schema for all renderman statements.
|
||||
///
|
||||
/// \note The longer term goal is for clients to go directly to primvar
|
||||
/// or render-attribute API's, instead of using UsdRi StatementsAPI
|
||||
/// for inherited attributes. Anticpating this, StatementsAPI
|
||||
/// can smooth the way via a few environment variables:
|
||||
///
|
||||
/// * USDRI_STATEMENTS_READ_OLD_ENCODING: Causes StatementsAPI to read
|
||||
/// old-style attributes instead of primvars in the "ri:"
|
||||
/// namespace.
|
||||
///
|
||||
///
|
||||
class UsdRiStatementsAPI : public UsdAPISchemaBase
|
||||
{
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a UsdRiStatementsAPI on UsdPrim \p prim .
|
||||
/// Equivalent to UsdRiStatementsAPI::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit UsdRiStatementsAPI(const UsdPrim& prim=UsdPrim())
|
||||
: UsdAPISchemaBase(prim)
|
||||
{
|
||||
}
|
||||
|
||||
/// Construct a UsdRiStatementsAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over UsdRiStatementsAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit UsdRiStatementsAPI(const UsdSchemaBase& schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj)
|
||||
{
|
||||
}
|
||||
|
||||
/// Destructor.
|
||||
USDRI_API
|
||||
virtual ~UsdRiStatementsAPI();
|
||||
|
||||
/// 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.
|
||||
USDRI_API
|
||||
static const TfTokenVector &
|
||||
GetSchemaAttributeNames(bool includeInherited=true);
|
||||
|
||||
/// Return a UsdRiStatementsAPI holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// UsdRiStatementsAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
USDRI_API
|
||||
static UsdRiStatementsAPI
|
||||
Get(const UsdStagePtr &stage, const SdfPath &path);
|
||||
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
USDRI_API
|
||||
static bool
|
||||
CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "StatementsAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid UsdRiStatementsAPI object is returned upon success.
|
||||
/// An invalid (or empty) UsdRiStatementsAPI object is returned upon
|
||||
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
USDRI_API
|
||||
static UsdRiStatementsAPI
|
||||
Apply(const UsdPrim &prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
USDRI_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
USDRI_API
|
||||
static const TfType &_GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
USDRI_API
|
||||
const TfType &_GetTfType() const override;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// CreateRiAttribute
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Create a rib attribute on the prim to which this schema is attached.
|
||||
/// A rib attribute consists of an attribute \em "nameSpace" and an
|
||||
/// attribute \em "name". For example, the namespace "cull" may define
|
||||
/// attributes "backfacing" and "hidden", and user-defined attributes
|
||||
/// belong to the namespace "user".
|
||||
///
|
||||
/// This method makes no attempt to validate that the given \p nameSpace
|
||||
/// and \em name are actually meaningful to prman or any other
|
||||
/// renderer.
|
||||
///
|
||||
/// \param riType should be a known RenderMan type definition, which
|
||||
/// can be array-valued. For instance, both "color" and "float[3]"
|
||||
/// are valid values for \p riType.
|
||||
USDRI_API
|
||||
UsdAttribute
|
||||
CreateRiAttribute(
|
||||
const TfToken &name,
|
||||
const std::string &riType,
|
||||
const std::string &nameSpace = "user");
|
||||
|
||||
/// Creates an attribute of the given \p tfType.
|
||||
/// \overload
|
||||
USDRI_API
|
||||
UsdAttribute
|
||||
CreateRiAttribute(
|
||||
const TfToken &name,
|
||||
const TfType &tfType,
|
||||
const std::string &nameSpace = "user");
|
||||
|
||||
/// Return a UsdAttribute representing the Ri attribute with the
|
||||
/// name \a name, in the namespace \a nameSpace. The attribute
|
||||
/// returned may or may not \b actually exist so it must be
|
||||
/// checked for validity.
|
||||
USDRI_API
|
||||
UsdAttribute
|
||||
GetRiAttribute(
|
||||
const TfToken &name,
|
||||
const std::string &nameSpace = "user");
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// GetRiAttributes
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Return all rib attributes on this prim, or under a specific
|
||||
/// namespace (e.g.\ "user").
|
||||
///
|
||||
/// As noted above, rib attributes can be either UsdAttribute or
|
||||
/// UsdRelationship, and like all UsdProperties, need not have a defined
|
||||
/// value.
|
||||
USDRI_API
|
||||
std::vector<UsdProperty>
|
||||
GetRiAttributes(const std::string &nameSpace = "") const;
|
||||
// --------------------------------------------------------------------- //
|
||||
// GetRiAttributeName
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Return the base, most-specific name of the rib attribute. For example,
|
||||
/// the \em name of the rib attribute "cull:backfacing" is "backfacing"
|
||||
inline static TfToken GetRiAttributeName(const UsdProperty &prop) {
|
||||
return prop.GetBaseName();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// GetRiAttributeNameSpace
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Return the containing namespace of the rib attribute (e.g.\ "user").
|
||||
///
|
||||
USDRI_API
|
||||
static TfToken GetRiAttributeNameSpace(const UsdProperty &prop);
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// IsRiAttribute
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Return true if the property is in the "ri:attributes" namespace.
|
||||
///
|
||||
USDRI_API
|
||||
static bool IsRiAttribute(const UsdProperty &prop);
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// MakeRiAttributePropertyName
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Returns the given \p attrName prefixed with the full Ri attribute
|
||||
/// namespace, creating a name suitable for an RiAttribute UsdProperty.
|
||||
/// This handles conversion of common separator characters used in
|
||||
/// other packages, such as periods and underscores.
|
||||
///
|
||||
/// Will return empty string if attrName is not a valid property
|
||||
/// identifier; otherwise, will return a valid property name
|
||||
/// that identifies the property as an RiAttribute, according to the
|
||||
/// following rules:
|
||||
/// \li If \p attrName is already a properly constructed RiAttribute
|
||||
/// property name, return it unchanged.
|
||||
/// \li If \p attrName contains two or more tokens separated by a \em colon,
|
||||
/// consider the first to be the namespace, and the rest the name,
|
||||
/// joined by underscores
|
||||
/// \li If \p attrName contains two or more tokens separated by a \em period,
|
||||
/// consider the first to be the namespace, and the rest the name,
|
||||
/// joined by underscores
|
||||
/// \li If \p attrName contains two or more tokens separated by an,
|
||||
/// \em underscore consider the first to be the namespace, and the
|
||||
/// rest the name, joined by underscores
|
||||
/// \li else, assume \p attrName is the name, and "user" is the namespace
|
||||
USDRI_API
|
||||
static std::string MakeRiAttributePropertyName(const std::string &attrName);
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// SetCoordinateSystem
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Sets the "ri:coordinateSystem" attribute to the given string value,
|
||||
/// creating the attribute if needed. That identifies this prim as providing
|
||||
/// a coordinate system, which can be retrieved via
|
||||
/// UsdGeomXformable::GetTransformAttr(). Also adds the owning prim to the
|
||||
/// ri:modelCoordinateSystems relationship targets on its parent leaf model
|
||||
/// prim, if it exists. If this prim is not under a leaf model, no
|
||||
/// relationship targets will be authored.
|
||||
///
|
||||
USDRI_API
|
||||
void SetCoordinateSystem(const std::string &coordSysName);
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// GetCoordinateSystem
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Returns the value in the "ri:coordinateSystem" attribute if it exists.
|
||||
///
|
||||
USDRI_API
|
||||
std::string GetCoordinateSystem() const;
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// HasCoordinateSystem
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Returns true if the underlying prim has a ri:coordinateSystem opinion.
|
||||
///
|
||||
USDRI_API
|
||||
bool HasCoordinateSystem() const;
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// SetScopedCoordinateSystem
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Sets the "ri:scopedCoordinateSystem" attribute to the given string
|
||||
/// value, creating the attribute if needed. That identifies this prim as
|
||||
/// providing a coordinate system, which can be retrieved via
|
||||
/// UsdGeomXformable::GetTransformAttr(). Such coordinate systems are
|
||||
/// local to the RI attribute stack state, but does get updated properly
|
||||
/// for instances when defined inside an object master. Also adds the
|
||||
/// owning prim to the ri:modelScopedCoordinateSystems relationship
|
||||
/// targets on its parent leaf model prim, if it exists. If this prim is
|
||||
/// not under a leaf model, no relationship targets will be authored.
|
||||
///
|
||||
USDRI_API
|
||||
void SetScopedCoordinateSystem(const std::string &coordSysName);
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// GetScopedCoordinateSystem
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Returns the value in the "ri:scopedCoordinateSystem" attribute if it
|
||||
/// exists.
|
||||
///
|
||||
USDRI_API
|
||||
std::string GetScopedCoordinateSystem() const;
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// HasScopedCoordinateSystem
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Returns true if the underlying prim has a ri:scopedCoordinateSystem
|
||||
/// opinion.
|
||||
///
|
||||
USDRI_API
|
||||
bool HasScopedCoordinateSystem() const;
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// GetModelCoordinateSystems
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Populates the output \p targets with the authored
|
||||
/// ri:modelCoordinateSystems, if any. Returns true if the query was
|
||||
/// successful.
|
||||
///
|
||||
USDRI_API
|
||||
bool GetModelCoordinateSystems(SdfPathVector *targets) const;
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
// GetModelScopedCoordinateSystems
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Populates the output \p targets with the authored
|
||||
/// ri:modelScopedCoordinateSystems, if any. Returns true if the query was
|
||||
/// successful.
|
||||
///
|
||||
USDRI_API
|
||||
bool GetModelScopedCoordinateSystems(SdfPathVector *targets) const;
|
||||
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,228 @@
|
||||
//
|
||||
// Copyright 2016 Pixar
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
||||
// with the following modification; you may not use this file except in
|
||||
// compliance with the Apache License and the following modification to it:
|
||||
// Section 6. Trademarks. is deleted and replaced with:
|
||||
//
|
||||
// 6. Trademarks. This License does not grant permission to use the trade
|
||||
// names, trademarks, service marks, or product names of the Licensor
|
||||
// and its affiliates, except as required to comply with Section 4(c) of
|
||||
// the License and to reproduce the content of the NOTICE file.
|
||||
//
|
||||
// You may obtain a copy of the Apache License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the Apache License with the above modification is
|
||||
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the Apache License for the specific
|
||||
// language governing permissions and limitations under the Apache License.
|
||||
//
|
||||
#ifndef USDRI_GENERATED_TEXTUREAPI_H
|
||||
#define USDRI_GENERATED_TEXTUREAPI_H
|
||||
|
||||
/// \file usdRi/textureAPI.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usd/usdRi/api.h"
|
||||
#include "pxr/usd/usd/apiSchemaBase.h"
|
||||
#include "pxr/usd/usd/prim.h"
|
||||
#include "pxr/usd/usd/stage.h"
|
||||
#include "pxr/usd/usdRi/tokens.h"
|
||||
|
||||
#include "pxr/base/vt/value.h"
|
||||
|
||||
#include "pxr/base/gf/vec3d.h"
|
||||
#include "pxr/base/gf/vec3f.h"
|
||||
#include "pxr/base/gf/matrix4d.h"
|
||||
|
||||
#include "pxr/base/tf/token.h"
|
||||
#include "pxr/base/tf/type.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// RITEXTUREAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class UsdRiTextureAPI
|
||||
///
|
||||
///
|
||||
/// \deprecated This API schema will be removed in a future release.
|
||||
///
|
||||
/// RiTextureAPI is an API schema that provides an interface
|
||||
/// to add Renderman-specific attributes to adjust textures.
|
||||
///
|
||||
class UsdRiTextureAPI : public UsdAPISchemaBase
|
||||
{
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a UsdRiTextureAPI on UsdPrim \p prim .
|
||||
/// Equivalent to UsdRiTextureAPI::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit UsdRiTextureAPI(const UsdPrim& prim=UsdPrim())
|
||||
: UsdAPISchemaBase(prim)
|
||||
{
|
||||
}
|
||||
|
||||
/// Construct a UsdRiTextureAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over UsdRiTextureAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit UsdRiTextureAPI(const UsdSchemaBase& schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj)
|
||||
{
|
||||
}
|
||||
|
||||
/// Destructor.
|
||||
USDRI_API
|
||||
virtual ~UsdRiTextureAPI();
|
||||
|
||||
/// 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.
|
||||
USDRI_API
|
||||
static const TfTokenVector &
|
||||
GetSchemaAttributeNames(bool includeInherited=true);
|
||||
|
||||
/// Return a UsdRiTextureAPI holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// UsdRiTextureAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
USDRI_API
|
||||
static UsdRiTextureAPI
|
||||
Get(const UsdStagePtr &stage, const SdfPath &path);
|
||||
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
USDRI_API
|
||||
static bool
|
||||
CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "RiTextureAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid UsdRiTextureAPI object is returned upon success.
|
||||
/// An invalid (or empty) UsdRiTextureAPI object is returned upon
|
||||
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
USDRI_API
|
||||
static UsdRiTextureAPI
|
||||
Apply(const UsdPrim &prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
USDRI_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
USDRI_API
|
||||
static const TfType &_GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
USDRI_API
|
||||
const TfType &_GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// RITEXTUREGAMMA
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Gamma-correct the texture
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `float ri:texture:gamma` |
|
||||
/// | C++ Type | float |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
|
||||
USDRI_API
|
||||
UsdAttribute GetRiTextureGammaAttr() const;
|
||||
|
||||
/// See GetRiTextureGammaAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
USDRI_API
|
||||
UsdAttribute CreateRiTextureGammaAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// RITEXTURESATURATION
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Adjust the texture's saturation
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `float ri:texture:saturation` |
|
||||
/// | C++ Type | float |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
|
||||
USDRI_API
|
||||
UsdAttribute GetRiTextureSaturationAttr() const;
|
||||
|
||||
/// See GetRiTextureSaturationAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
USDRI_API
|
||||
UsdAttribute CreateRiTextureSaturationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,133 @@
|
||||
//
|
||||
// Copyright 2016 Pixar
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
||||
// with the following modification; you may not use this file except in
|
||||
// compliance with the Apache License and the following modification to it:
|
||||
// Section 6. Trademarks. is deleted and replaced with:
|
||||
//
|
||||
// 6. Trademarks. This License does not grant permission to use the trade
|
||||
// names, trademarks, service marks, or product names of the Licensor
|
||||
// and its affiliates, except as required to comply with Section 4(c) of
|
||||
// the License and to reproduce the content of the NOTICE file.
|
||||
//
|
||||
// You may obtain a copy of the Apache License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the Apache License with the above modification is
|
||||
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the Apache License for the specific
|
||||
// language governing permissions and limitations under the Apache License.
|
||||
//
|
||||
#ifndef USDRI_TOKENS_H
|
||||
#define USDRI_TOKENS_H
|
||||
|
||||
/// \file usdRi/tokens.h
|
||||
|
||||
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
//
|
||||
// This is an automatically generated file (by usdGenSchema.py).
|
||||
// Do not hand-edit!
|
||||
//
|
||||
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usd/usdRi/api.h"
|
||||
#include "pxr/base/tf/staticData.h"
|
||||
#include "pxr/base/tf/token.h"
|
||||
#include <vector>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdRiTokensType
|
||||
///
|
||||
/// \link UsdRiTokens \endlink provides static, efficient
|
||||
/// \link TfToken TfTokens\endlink for use in all public USD API.
|
||||
///
|
||||
/// These tokens are auto-generated from the module's schema, representing
|
||||
/// property names, for when you need to fetch an attribute or relationship
|
||||
/// directly by name, e.g. UsdPrim::GetAttribute(), in the most efficient
|
||||
/// manner, and allow the compiler to verify that you spelled the name
|
||||
/// correctly.
|
||||
///
|
||||
/// UsdRiTokens also contains all of the \em allowedTokens values
|
||||
/// declared for schema builtin attributes of 'token' scene description type.
|
||||
/// Use UsdRiTokens like so:
|
||||
///
|
||||
/// \code
|
||||
/// gprim.GetMyTokenValuedAttr().Set(UsdRiTokens->bspline);
|
||||
/// \endcode
|
||||
struct UsdRiTokensType {
|
||||
USDRI_API UsdRiTokensType();
|
||||
/// \brief "bspline"
|
||||
///
|
||||
/// UsdSplineAPI - BSpline spline interpolation
|
||||
const TfToken bspline;
|
||||
/// \brief "catmull-rom"
|
||||
///
|
||||
/// UsdSplineAPI - Catmull-Rom spline interpolation
|
||||
const TfToken catmullRom;
|
||||
/// \brief "constant"
|
||||
///
|
||||
/// UsdSplineAPI - Constant-value spline interpolation
|
||||
const TfToken constant;
|
||||
/// \brief "interpolation"
|
||||
///
|
||||
/// UsdSplineAPI - Interpolation attribute name
|
||||
const TfToken interpolation;
|
||||
/// \brief "linear"
|
||||
///
|
||||
/// UsdSplineAPI - Linear spline interpolation
|
||||
const TfToken linear;
|
||||
/// \brief "outputs:ri:displacement"
|
||||
///
|
||||
/// UsdRiMaterialAPI
|
||||
const TfToken outputsRiDisplacement;
|
||||
/// \brief "outputs:ri:surface"
|
||||
///
|
||||
/// UsdRiMaterialAPI
|
||||
const TfToken outputsRiSurface;
|
||||
/// \brief "outputs:ri:volume"
|
||||
///
|
||||
/// UsdRiMaterialAPI
|
||||
const TfToken outputsRiVolume;
|
||||
/// \brief "positions"
|
||||
///
|
||||
/// UsdSplineAPI - Positions attribute name
|
||||
const TfToken positions;
|
||||
/// \brief "ri"
|
||||
///
|
||||
/// UsdShadeMaterial / Hydra render context token for UsdRi
|
||||
const TfToken renderContext;
|
||||
/// \brief "ri:texture:gamma"
|
||||
///
|
||||
/// UsdRiTextureAPI
|
||||
const TfToken riTextureGamma;
|
||||
/// \brief "ri:texture:saturation"
|
||||
///
|
||||
/// UsdRiTextureAPI
|
||||
const TfToken riTextureSaturation;
|
||||
/// \brief "spline"
|
||||
///
|
||||
/// UsdSplineAPI - Namespace for spline attributes
|
||||
const TfToken spline;
|
||||
/// \brief "values"
|
||||
///
|
||||
/// UsdSplineAPI - values attribute name
|
||||
const TfToken values;
|
||||
/// A vector of all of the tokens listed above.
|
||||
const std::vector<TfToken> allTokens;
|
||||
};
|
||||
|
||||
/// \var UsdRiTokens
|
||||
///
|
||||
/// A global variable with static, efficient \link TfToken TfTokens\endlink
|
||||
/// for use in all public USD API. \sa UsdRiTokensType
|
||||
extern USDRI_API TfStaticData<UsdRiTokensType> UsdRiTokens;
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user