add usd-21-11-win64_py39

This commit is contained in:
Sébastien Albert committed 2021-12-07 17:43:55 +01:00
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 USDSCHEMAEXAMPLES_API_H
#define USDSCHEMAEXAMPLES_API_H
#include "pxr/base/arch/export.h"
#if defined(PXR_STATIC)
# define USDSCHEMAEXAMPLES_API
# define USDSCHEMAEXAMPLES_API_TEMPLATE_CLASS(...)
# define USDSCHEMAEXAMPLES_API_TEMPLATE_STRUCT(...)
# define USDSCHEMAEXAMPLES_LOCAL
#else
# if defined(USDSCHEMAEXAMPLES_EXPORTS)
# define USDSCHEMAEXAMPLES_API ARCH_EXPORT
# define USDSCHEMAEXAMPLES_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
# define USDSCHEMAEXAMPLES_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
# else
# define USDSCHEMAEXAMPLES_API ARCH_IMPORT
# define USDSCHEMAEXAMPLES_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
# define USDSCHEMAEXAMPLES_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
# endif
# define USDSCHEMAEXAMPLES_LOCAL ARCH_HIDDEN
#endif
#endif
@@ -0,0 +1,188 @@
//
// 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 USDSCHEMAEXAMPLES_GENERATED_COMPLEX_H
#define USDSCHEMAEXAMPLES_GENERATED_COMPLEX_H
/// \file usdSchemaExamples/complex.h
#include "pxr/pxr.h"
#include "./api.h"
#include "./simple.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include "./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;
// -------------------------------------------------------------------------- //
// COMPLEXPRIM //
// -------------------------------------------------------------------------- //
/// \class UsdSchemaExamplesComplex
///
/// An example of a untyped IsA schema prim
///
class UsdSchemaExamplesComplex : public UsdSchemaExamplesSimple
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
/// Construct a UsdSchemaExamplesComplex on UsdPrim \p prim .
/// Equivalent to UsdSchemaExamplesComplex::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit UsdSchemaExamplesComplex(const UsdPrim& prim=UsdPrim())
: UsdSchemaExamplesSimple(prim)
{
}
/// Construct a UsdSchemaExamplesComplex on the prim held by \p schemaObj .
/// Should be preferred over UsdSchemaExamplesComplex(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit UsdSchemaExamplesComplex(const UsdSchemaBase& schemaObj)
: UsdSchemaExamplesSimple(schemaObj)
{
}
/// Destructor.
USDSCHEMAEXAMPLES_API
virtual ~UsdSchemaExamplesComplex();
/// 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.
USDSCHEMAEXAMPLES_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a UsdSchemaExamplesComplex 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
/// UsdSchemaExamplesComplex(stage->GetPrimAtPath(path));
/// \endcode
///
USDSCHEMAEXAMPLES_API
static UsdSchemaExamplesComplex
Get(const UsdStagePtr &stage, const SdfPath &path);
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
/// is defined (according to UsdPrim::IsDefined()) on this stage.
///
/// If a prim adhering to this schema at \p path is already defined on this
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
/// current EditTarget for any nonexistent, or existing but not \a Defined
/// ancestors.
///
/// The given \a 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 \a path cannot map to the current UsdEditTarget's
/// namespace) issue an error and return an invalid \a 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.
///
USDSCHEMAEXAMPLES_API
static UsdSchemaExamplesComplex
Define(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
USDSCHEMAEXAMPLES_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
USDSCHEMAEXAMPLES_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
USDSCHEMAEXAMPLES_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// COMPLEXSTRING
// --------------------------------------------------------------------- //
///
///
/// | ||
/// | -- | -- |
/// | Declaration | `string complexString = "somethingComplex"` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
USDSCHEMAEXAMPLES_API
UsdAttribute GetComplexStringAttr() const;
/// See GetComplexStringAttr(), 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.
USDSCHEMAEXAMPLES_API
UsdAttribute CreateComplexStringAttr(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,245 @@
//
// 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 USDSCHEMAEXAMPLES_GENERATED_PARAMSAPI_H
#define USDSCHEMAEXAMPLES_GENERATED_PARAMSAPI_H
/// \file usdSchemaExamples/paramsAPI.h
#include "pxr/pxr.h"
#include "./api.h"
#include "pxr/usd/usd/apiSchemaBase.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include "./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;
// -------------------------------------------------------------------------- //
// PARAMSAPI //
// -------------------------------------------------------------------------- //
/// \class UsdSchemaExamplesParamsAPI
///
///
class UsdSchemaExamplesParamsAPI : public UsdAPISchemaBase
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
/// Construct a UsdSchemaExamplesParamsAPI on UsdPrim \p prim .
/// Equivalent to UsdSchemaExamplesParamsAPI::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit UsdSchemaExamplesParamsAPI(const UsdPrim& prim=UsdPrim())
: UsdAPISchemaBase(prim)
{
}
/// Construct a UsdSchemaExamplesParamsAPI on the prim held by \p schemaObj .
/// Should be preferred over UsdSchemaExamplesParamsAPI(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit UsdSchemaExamplesParamsAPI(const UsdSchemaBase& schemaObj)
: UsdAPISchemaBase(schemaObj)
{
}
/// Destructor.
USDSCHEMAEXAMPLES_API
virtual ~UsdSchemaExamplesParamsAPI();
/// 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.
USDSCHEMAEXAMPLES_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a UsdSchemaExamplesParamsAPI 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
/// UsdSchemaExamplesParamsAPI(stage->GetPrimAtPath(path));
/// \endcode
///
USDSCHEMAEXAMPLES_API
static UsdSchemaExamplesParamsAPI
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()
///
USDSCHEMAEXAMPLES_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 "ParamsAPI" to the
/// token-valued, listOp metadata \em apiSchemas on the prim.
///
/// \return A valid UsdSchemaExamplesParamsAPI object is returned upon success.
/// An invalid (or empty) UsdSchemaExamplesParamsAPI 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()
///
USDSCHEMAEXAMPLES_API
static UsdSchemaExamplesParamsAPI
Apply(const UsdPrim &prim);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
USDSCHEMAEXAMPLES_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
USDSCHEMAEXAMPLES_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
USDSCHEMAEXAMPLES_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// MASS
// --------------------------------------------------------------------- //
/// Double value denoting mass
///
/// | ||
/// | -- | -- |
/// | Declaration | `double params:mass` |
/// | C++ Type | double |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
USDSCHEMAEXAMPLES_API
UsdAttribute GetMassAttr() const;
/// See GetMassAttr(), 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.
USDSCHEMAEXAMPLES_API
UsdAttribute CreateMassAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// VELOCITY
// --------------------------------------------------------------------- //
/// Double value denoting velocity
///
/// | ||
/// | -- | -- |
/// | Declaration | `double params:velocity` |
/// | C++ Type | double |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
USDSCHEMAEXAMPLES_API
UsdAttribute GetVelocityAttr() const;
/// See GetVelocityAttr(), 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.
USDSCHEMAEXAMPLES_API
UsdAttribute CreateVelocityAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// VOLUME
// --------------------------------------------------------------------- //
/// Double value denoting volume
///
/// | ||
/// | -- | -- |
/// | Declaration | `double params:volume` |
/// | C++ Type | double |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
USDSCHEMAEXAMPLES_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.
USDSCHEMAEXAMPLES_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)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
@@ -0,0 +1,179 @@
//
// 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 USDSCHEMAEXAMPLES_GENERATED_SIMPLE_H
#define USDSCHEMAEXAMPLES_GENERATED_SIMPLE_H
/// \file usdSchemaExamples/simple.h
#include "pxr/pxr.h"
#include "./api.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include "./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;
// -------------------------------------------------------------------------- //
// SIMPLEPRIM //
// -------------------------------------------------------------------------- //
/// \class UsdSchemaExamplesSimple
///
/// An example of an untyped schema prim. Note that it does not
/// specify a typeName
///
class UsdSchemaExamplesSimple : public UsdTyped
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::AbstractTyped;
/// Construct a UsdSchemaExamplesSimple on UsdPrim \p prim .
/// Equivalent to UsdSchemaExamplesSimple::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit UsdSchemaExamplesSimple(const UsdPrim& prim=UsdPrim())
: UsdTyped(prim)
{
}
/// Construct a UsdSchemaExamplesSimple on the prim held by \p schemaObj .
/// Should be preferred over UsdSchemaExamplesSimple(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit UsdSchemaExamplesSimple(const UsdSchemaBase& schemaObj)
: UsdTyped(schemaObj)
{
}
/// Destructor.
USDSCHEMAEXAMPLES_API
virtual ~UsdSchemaExamplesSimple();
/// 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.
USDSCHEMAEXAMPLES_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a UsdSchemaExamplesSimple 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
/// UsdSchemaExamplesSimple(stage->GetPrimAtPath(path));
/// \endcode
///
USDSCHEMAEXAMPLES_API
static UsdSchemaExamplesSimple
Get(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
USDSCHEMAEXAMPLES_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
USDSCHEMAEXAMPLES_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
USDSCHEMAEXAMPLES_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// INTATTR
// --------------------------------------------------------------------- //
/// An integer attribute with fallback value of 0.
///
/// | ||
/// | -- | -- |
/// | Declaration | `int intAttr = 0` |
/// | C++ Type | int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
USDSCHEMAEXAMPLES_API
UsdAttribute GetIntAttrAttr() const;
/// See GetIntAttrAttr(), 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.
USDSCHEMAEXAMPLES_API
UsdAttribute CreateIntAttrAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// TARGET
// --------------------------------------------------------------------- //
/// A relationship called target that could point to another prim
/// or a property
///
USDSCHEMAEXAMPLES_API
UsdRelationship GetTargetRel() const;
/// See GetTargetRel(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
USDSCHEMAEXAMPLES_API
UsdRelationship CreateTargetRel() 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,101 @@
//
// 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 USDSCHEMAEXAMPLES_TOKENS_H
#define USDSCHEMAEXAMPLES_TOKENS_H
/// \file usdSchemaExamples/tokens.h
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//
// This is an automatically generated file (by usdGenSchema.py).
// Do not hand-edit!
//
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include "pxr/pxr.h"
#include "./api.h"
#include "pxr/base/tf/staticData.h"
#include "pxr/base/tf/token.h"
#include <vector>
PXR_NAMESPACE_OPEN_SCOPE
/// \class UsdSchemaExamplesTokensType
///
/// \link UsdSchemaExamplesTokens \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.
///
/// UsdSchemaExamplesTokens also contains all of the \em allowedTokens values
/// declared for schema builtin attributes of 'token' scene description type.
/// Use UsdSchemaExamplesTokens like so:
///
/// \code
/// gprim.GetMyTokenValuedAttr().Set(UsdSchemaExamplesTokens->complexString);
/// \endcode
struct UsdSchemaExamplesTokensType {
USDSCHEMAEXAMPLES_API UsdSchemaExamplesTokensType();
/// \brief "complexString"
///
/// UsdSchemaExamplesComplex
const TfToken complexString;
/// \brief "intAttr"
///
/// UsdSchemaExamplesSimple
const TfToken intAttr;
/// \brief "params:mass"
///
/// UsdSchemaExamplesParamsAPI
const TfToken paramsMass;
/// \brief "params:velocity"
///
/// UsdSchemaExamplesParamsAPI
const TfToken paramsVelocity;
/// \brief "params:volume"
///
/// UsdSchemaExamplesParamsAPI
const TfToken paramsVolume;
/// \brief "target"
///
/// UsdSchemaExamplesSimple
const TfToken target;
/// A vector of all of the tokens listed above.
const std::vector<TfToken> allTokens;
};
/// \var UsdSchemaExamplesTokens
///
/// A global variable with static, efficient \link TfToken TfTokens\endlink
/// for use in all public USD API. \sa UsdSchemaExamplesTokensType
extern USDSCHEMAEXAMPLES_API TfStaticData<UsdSchemaExamplesTokensType> UsdSchemaExamplesTokens;
PXR_NAMESPACE_CLOSE_SCOPE
#endif
@@ -0,0 +1,135 @@
//
// Copyright 2020 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 EXTRAS_IMAGING_EXAMPLES_HD_TINY_MESH_H
#define EXTRAS_IMAGING_EXAMPLES_HD_TINY_MESH_H
#include "pxr/pxr.h"
#include "pxr/imaging/hd/mesh.h"
PXR_NAMESPACE_OPEN_SCOPE
/// \class HdTinyMesh
///
/// This class is an example of a Hydra Rprim, or renderable object, and it
/// gets created on a call to HdRenderIndex::InsertRprim() with a type of
/// HdPrimTypeTokens->mesh.
///
/// The prim object's main function is to bridge the scene description and the
/// renderable representation. The Hydra image generation algorithm will call
/// HdRenderIndex::SyncAll() before any drawing; this, in turn, will call
/// Sync() for each mesh with new data.
///
/// Sync() is passed a set of dirtyBits, indicating which scene buffers are
/// dirty. It uses these to pull all of the new scene data and constructs
/// updated geometry objects.
///
/// An rprim's state is lazily populated in Sync(); matching this, Finalize()
/// can do the heavy work of releasing state (such as handles into the top-level
/// scene), so that object population and existence aren't tied to each other.
///
class HdTinyMesh final : public HdMesh
{
public:
HF_MALLOC_TAG_NEW("new HdTinyMesh");
/// HdTinyMesh constructor.
/// \param id The scene-graph path to this mesh.
HdTinyMesh(SdfPath const& id);
/// HdTinyMesh destructor.
~HdTinyMesh() override = default;
/// Inform the scene graph which state needs to be downloaded in the
/// first Sync() call: in this case, topology and points data to build
/// the geometry object in the scene graph.
/// \return The initial dirty state this mesh wants to query.
HdDirtyBits GetInitialDirtyBitsMask() const override;
/// Pull invalidated scene data and prepare/update the renderable
/// representation.
///
/// This function is told which scene data to pull through the
/// dirtyBits parameter. The first time it's called, dirtyBits comes
/// from _GetInitialDirtyBits(), which provides initial dirty state,
/// but after that it's driven by invalidation tracking in the scene
/// delegate.
///
/// The contract for this function is that the prim can only pull on scene
/// delegate buffers that are marked dirty. Scene delegates can and do
/// implement just-in-time data schemes that mean that pulling on clean
/// data will be at best incorrect, and at worst a crash.
///
/// This function is called in parallel from worker threads, so it needs
/// to be threadsafe; calls into HdSceneDelegate are ok.
///
/// Reprs are used by hydra for controlling per-item draw settings like
/// flat/smooth shaded, wireframe, refined, etc.
/// \param sceneDelegate The data source for this geometry item.
/// \param renderParam State.
/// \param dirtyBits A specifier for which scene data has changed.
/// \param reprToken A specifier for which representation to draw with.
///
void Sync(
HdSceneDelegate* sceneDelegate,
HdRenderParam* renderParam,
HdDirtyBits* dirtyBits,
TfToken const &reprToken) override;
protected:
// Initialize the given representation of this Rprim.
// This is called prior to syncing the prim, the first time the repr
// is used.
//
// reprToken is the name of the repr to initalize.
//
// dirtyBits is an in/out value. It is initialized to the dirty bits
// from the change tracker. InitRepr can then set additional dirty bits
// if additional data is required from the scene delegate when this
// repr is synced. InitRepr occurs before dirty bit propagation.
//
// See HdRprim::InitRepr()
void _InitRepr(
TfToken const &reprToken,
HdDirtyBits *dirtyBits) override;
// This callback from Rprim gives the prim an opportunity to set
// additional dirty bits based on those already set. This is done
// before the dirty bits are passed to the scene delegate, so can be
// used to communicate that extra information is needed by the prim to
// process the changes.
//
// The return value is the new set of dirty bits, which replaces the bits
// passed in.
//
// See HdRprim::PropagateRprimDirtyBits()
HdDirtyBits _PropagateDirtyBits(HdDirtyBits bits) const override;
// This class does not support copying.
HdTinyMesh(const HdTinyMesh&) = delete;
HdTinyMesh &operator =(const HdTinyMesh&) = delete;
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif // EXTRAS_IMAGING_EXAMPLES_HD_TINY_MESH_H
@@ -0,0 +1,106 @@
//
// Copyright 2020 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 EXTRAS_IMAGING_EXAMPLES_HD_TINY_RENDER_DELEGATE_H
#define EXTRAS_IMAGING_EXAMPLES_HD_TINY_RENDER_DELEGATE_H
#include "pxr/pxr.h"
#include "pxr/imaging/hd/renderDelegate.h"
#include "pxr/imaging/hd/resourceRegistry.h"
#include "pxr/base/tf/staticTokens.h"
PXR_NAMESPACE_OPEN_SCOPE
///
/// \class HdTinyRenderDelegate
///
/// Render delegates provide renderer-specific functionality to the render
/// index, the main hydra state management structure. The render index uses
/// the render delegate to create and delete scene primitives, which include
/// geometry and also non-drawable objects. The render delegate is also
/// responsible for creating renderpasses, which know how to draw this
/// renderer's scene primitives.
///
class HdTinyRenderDelegate final : public HdRenderDelegate
{
public:
/// Render delegate constructor.
HdTinyRenderDelegate();
/// Render delegate constructor.
HdTinyRenderDelegate(HdRenderSettingsMap const& settingsMap);
/// Render delegate destructor.
virtual ~HdTinyRenderDelegate();
/// Supported types
const TfTokenVector &GetSupportedRprimTypes() const override;
const TfTokenVector &GetSupportedSprimTypes() const override;
const TfTokenVector &GetSupportedBprimTypes() const override;
// Basic value to return from the RD
HdResourceRegistrySharedPtr GetResourceRegistry() const override;
// Prims
HdRenderPassSharedPtr CreateRenderPass(
HdRenderIndex *index,
HdRprimCollection const& collection) override;
HdInstancer *CreateInstancer(HdSceneDelegate *delegate,
SdfPath const& id) override;
void DestroyInstancer(HdInstancer *instancer) override;
HdRprim *CreateRprim(TfToken const& typeId,
SdfPath const& rprimId) override;
void DestroyRprim(HdRprim *rPrim) override;
HdSprim *CreateSprim(TfToken const& typeId,
SdfPath const& sprimId) override;
HdSprim *CreateFallbackSprim(TfToken const& typeId) override;
void DestroySprim(HdSprim *sprim) override;
HdBprim *CreateBprim(TfToken const& typeId,
SdfPath const& bprimId) override;
HdBprim *CreateFallbackBprim(TfToken const& typeId) override;
void DestroyBprim(HdBprim *bprim) override;
void CommitResources(HdChangeTracker *tracker) override;
HdRenderParam *GetRenderParam() const override;
private:
static const TfTokenVector SUPPORTED_RPRIM_TYPES;
static const TfTokenVector SUPPORTED_SPRIM_TYPES;
static const TfTokenVector SUPPORTED_BPRIM_TYPES;
void _Initialize();
HdResourceRegistrySharedPtr _resourceRegistry;
// This class does not support copying.
HdTinyRenderDelegate(const HdTinyRenderDelegate &) = delete;
HdTinyRenderDelegate &operator =(const HdTinyRenderDelegate &) = delete;
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif // EXTRAS_IMAGING_EXAMPLES_HD_TINY_RENDER_DELEGATE_H
@@ -0,0 +1,64 @@
//
// Copyright 2020 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 EXTRAS_IMAGING_EXAMPLES_HD_TINY_RENDER_PASS_H
#define EXTRAS_IMAGING_EXAMPLES_HD_TINY_RENDER_PASS_H
#include "pxr/pxr.h"
#include "pxr/imaging/hd/renderPass.h"
PXR_NAMESPACE_OPEN_SCOPE
/// \class HdTinyRenderPass
///
/// HdRenderPass represents a single render iteration, rendering a view of the
/// scene (the HdRprimCollection) for a specific viewer (the camera/viewport
/// parameters in HdRenderPassState) to the current draw target.
///
class HdTinyRenderPass final : public HdRenderPass
{
public:
/// Renderpass constructor.
/// \param index The render index containing scene data to render.
/// \param collection The initial rprim collection for this renderpass.
HdTinyRenderPass(HdRenderIndex *index,
HdRprimCollection const &collection);
/// Renderpass destructor.
virtual ~HdTinyRenderPass();
protected:
/// Draw the scene with the bound renderpass state.
/// \param renderPassState Input parameters (including viewer parameters)
/// for this renderpass.
/// \param renderTags Which rendertags should be drawn this pass.
void _Execute(
HdRenderPassStateSharedPtr const& renderPassState,
TfTokenVector const &renderTags) override;
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif // EXTRAS_IMAGING_EXAMPLES_HD_TINY_RENDER_PASS_H
@@ -0,0 +1,73 @@
//
// Copyright 2020 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 EXTRAS_IMAGING_EXAMPLES_HD_TINY_RENDERER_PLUGIN_H
#define EXTRAS_IMAGING_EXAMPLES_HD_TINY_RENDERER_PLUGIN_H
#include "pxr/pxr.h"
#include "pxr/imaging/hd/rendererPlugin.h"
PXR_NAMESPACE_OPEN_SCOPE
///
/// \class HdTinyRendererPlugin
///
/// A registered child of HdRendererPlugin, this is the class that gets
/// loaded when a Hydra application asks to draw with a certain renderer.
/// It supports rendering via creation/destruction of renderer-specific
/// classes. The render delegate is the Hydra-facing entrypoint into the
/// renderer; it's responsible for creating specialized implementations of Hydra
/// prims (which translate scene data into drawable representations) and Hydra
/// renderpasses (which draw the scene to the framebuffer).
///
class HdTinyRendererPlugin final : public HdRendererPlugin
{
public:
HdTinyRendererPlugin() = default;
virtual ~HdTinyRendererPlugin() = default;
/// Construct a new render delegate of type HdTinyRenderDelegate.
virtual HdRenderDelegate *CreateRenderDelegate() override;
/// Construct a new render delegate of type HdTinyRenderDelegate.
virtual HdRenderDelegate *CreateRenderDelegate(
HdRenderSettingsMap const& settingsMap) override;
/// Destroy a render delegate created by this class's CreateRenderDelegate.
/// \param renderDelegate The render delegate to delete.
virtual void DeleteRenderDelegate(
HdRenderDelegate *renderDelegate) override;
/// Checks to see if the plugin is supported on the running system.
virtual bool IsSupported() const override;
private:
// This class does not support copying.
HdTinyRendererPlugin(const HdTinyRendererPlugin&) = delete;
HdTinyRendererPlugin &operator =(const HdTinyRendererPlugin&) = delete;
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif // EXTRAS_IMAGING_EXAMPLES_HD_TINY_RENDERER_PLUGIN_H
@@ -0,0 +1,133 @@
//
// Copyright 2019 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_EXTRAS_USD_EXAMPLES_USD_DANCING_CUBES_EXAMPLE_FILE_FORMAT_H
#define PXR_EXTRAS_USD_EXAMPLES_USD_DANCING_CUBES_EXAMPLE_FILE_FORMAT_H
#include "pxr/pxr.h"
#include "pxr/usd/sdf/fileFormat.h"
#include "pxr/usd/pcp/dynamicFileFormatInterface.h"
#include "pxr/base/tf/staticTokens.h"
PXR_NAMESPACE_OPEN_SCOPE
#define USD_DANCING_CUBES_EXAMPLE_FILE_FORMAT_TOKENS \
((Id, "usdDancingCubesExample")) \
((Version, "1.0")) \
((Target, "usd")) \
((Extension, "usddancingcubesexample")) \
((Params, "Usd_DCE_Params"))
TF_DECLARE_PUBLIC_TOKENS(UsdDancingCubesExampleFileFormatTokens,
USD_DANCING_CUBES_EXAMPLE_FILE_FORMAT_TOKENS);
TF_DECLARE_WEAK_AND_REF_PTRS(UsdDancingCubesExampleFileFormat);
/// \class UsdDancingCubesExampleFileFormat
///
/// Example of a dynamic file format plugin implementation that is entirely
/// procedurally generated from the layer's file format arguments.
///
/// It employs its own custom SdfAbstractData subclass,
/// UsdDancingCubesExample_Data, which is used to generate multiple animated
/// prims entirely from a small set of parameters. Since layers of this file
/// format have their contents solely generated from the file format arguments,
/// they do not need to read or parse the contents of the file at all. The file
/// format arguments provided by the layer's identifier are converted to a
/// params object defined with UsdDancingCubesExample_Data which the layer's
/// data uses to generate its specs when requested. See data.h and dataImpl.h
/// more details on the params and how the data generates its content.
///
/// This being a PcpDynamicFileFormatInterface subclass, if a file of this
/// format is a payload for a prim spec, the file format arguments can be
/// generated through the composed fields on the prim. There is a single custom
/// metadata field defined in plugInfo.json called "Usd_DCE_Params" that can be
/// used to customize the payload's file format arguments. This field needs to
/// hold a dictionary value which can provide overrides to the individual param
/// value arguments defined in UsdDancingCubesExample_Data.
///
class UsdDancingCubesExampleFileFormat : public SdfFileFormat,
public PcpDynamicFileFormatInterface
{
public:
/// Override this function from SdfFileFormat to provide our own procedural
/// SdfAbstractData class.
SdfAbstractDataRefPtr InitData(
const FileFormatArguments &args) const override;
/// Must implement SdfFileFormat's CanRead function. Returns true for all
/// files as the contents of the file aren't used.
bool CanRead(const std::string &filePath) const override;
/// Must implement SdfFileFormat's Read function, though this implemenation
/// doesn't do anything. There is nothing from the file that needs to be
/// read as data will have already been initialized from file format
/// arguments.
bool Read(SdfLayer *layer,
const std::string &resolvedPath,
bool metadataOnly) const override;
/// We override WriteToString and WriteToStream methods so
/// SdfLayer::ExportToString() etc, work. Writing this layer will write out
/// the generated layer contents.
/// We do NOT implement WriteToFile as it doesn't make sense to write to
/// files of this format when the contents are completely generated from the
/// file format arguments.
bool WriteToString(const SdfLayer & layer,
std::string *str,
const std::string &comment=std::string()) const override;
bool WriteToStream(const SdfSpecHandle &spec,
std::ostream& out,
size_t indent) const override;
/// A required PcpDynamicFileFormatInterface override for generating
/// the file format arguments in context.
void ComposeFieldsForFileFormatArguments(
const std::string &assetPath,
const PcpDynamicFileFormatContext &context,
FileFormatArguments *args,
VtValue *contextDependencyData) const override;
/// A required PcpDynamicFileFormatInterface override for processing whether
/// a field change may affect the file format arguments within a given
/// context.
bool CanFieldChangeAffectFileFormatArguments(
const TfToken &field,
const VtValue &oldValue,
const VtValue &newValue,
const VtValue &contextDependencyData) const override;
protected:
SDF_FILE_FORMAT_FACTORY_ACCESS;
bool _ShouldSkipAnonymousReload() const override;
bool _ShouldReadAnonymousLayers() const override;
virtual ~UsdDancingCubesExampleFileFormat();
UsdDancingCubesExampleFileFormat();
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif // PXR_EXTRAS_USD_EXAMPLES_USD_DANCING_CUBES_EXAMPLE_FILE_FORMAT_H
@@ -0,0 +1,47 @@
//
// Copyright 2021 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 USD_RESOLVER_EXAMPLE_API_H
#define USD_RESOLVER_EXAMPLE_API_H
#include "pxr/base/arch/export.h"
#if defined(PXR_STATIC)
# define USDRESOLVEREXAMPLE_API
# define USDRESOLVEREXAMPLE_API_TEMPLATE_CLASS(...)
# define USDRESOLVEREXAMPLE_API_TEMPLATE_STRUCT(...)
# define USDRESOLVEREXAMPLE_LOCAL
#else
# if defined(USDRESOLVEREXAMPLE_EXPORTS)
# define USDRESOLVEREXAMPLE_API ARCH_EXPORT
# define USDRESOLVEREXAMPLE_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
# define USDRESOLVEREXAMPLE_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
# else
# define USDRESOLVEREXAMPLE_API ARCH_IMPORT
# define USDRESOLVEREXAMPLE_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
# define USDRESOLVEREXAMPLE_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
# endif
# define USDRESOLVEREXAMPLE_LOCAL ARCH_HIDDEN
#endif
#endif
@@ -0,0 +1,97 @@
//
// Copyright 2021 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.
//
#include "pxr/pxr.h"
#include "pxr/usd/ar/asset.h"
#include "pxr/usd/ar/resolver.h"
#include "pxr/usd/ar/resolvedPath.h"
#include "pxr/usd/ar/writableAsset.h"
#include "pxr/base/vt/value.h"
#include <memory>
#include <string>
/// \class UsdResolverExampleResolver
///
/// Example URI resolver supporting asset paths of the form:
/// asset:<asset_name>/<path_to_file>
///
class UsdResolverExampleResolver final
: public PXR_NS::ArResolver
{
public:
UsdResolverExampleResolver();
virtual ~UsdResolverExampleResolver();
protected:
std::string _CreateIdentifier(
const std::string& assetPath,
const PXR_NS::ArResolvedPath& anchorAssetPath) const final;
std::string _CreateIdentifierForNewAsset(
const std::string& assetPath,
const PXR_NS::ArResolvedPath& anchorAssetPath) const final;
PXR_NS::ArResolvedPath _Resolve(
const std::string& assetPath) const final;
PXR_NS::ArResolvedPath _ResolveForNewAsset(
const std::string& assetPath) const final;
PXR_NS::ArResolverContext _CreateDefaultContext() const final;
PXR_NS::ArResolverContext _CreateDefaultContextForAsset(
const std::string& assetPath) const final;
PXR_NS::ArResolverContext _CreateContextFromString(
const std::string& contextStr) const final;
bool _IsContextDependentPath(
const std::string& assetPath) const final;
void _RefreshContext(
const PXR_NS::ArResolverContext& context) final;
PXR_NS::ArTimestamp _GetModificationTimestamp(
const std::string& assetPath,
const PXR_NS::ArResolvedPath& resolvedPath) const final;
PXR_NS::ArAssetInfo _GetAssetInfo(
const std::string& assetPath,
const PXR_NS::ArResolvedPath& resolvedPath) const final;
std::shared_ptr<PXR_NS::ArAsset> _OpenAsset(
const PXR_NS::ArResolvedPath& resolvedPath) const final;
std::shared_ptr<PXR_NS::ArWritableAsset>
_OpenAssetForWrite(
const PXR_NS::ArResolvedPath& resolvedPath,
WriteMode writeMode) const final;
private:
PXR_NS::ArResolvedPath _ResolveHelper(
const std::string& assetPath,
bool forNewAsset) const;
};
@@ -0,0 +1,76 @@
//
// Copyright 2021 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.
//
#include "pxr/pxr.h"
#include "api.h"
#include "pxr/usd/ar/defineResolverContext.h"
#include "pxr/usd/ar/resolverContext.h"
#include <string>
/// \class UsdResolverExampleResolverContext
///
/// Context object for the UsdResolverExampleResolver. This object
/// allows the client to specify a version mapping file to use for
/// {$VERSION} substitutions during asset resolution. See overview
/// for more details.
class UsdResolverExampleResolverContext
{
public:
/// Create a context that specifies that the version mappings in
/// \p mappingFile should be used when resolving asset paths with
/// this context bound. \p mappingFile may be an absolute or
/// relative file path; if relative, it will be anchored to the
/// current working directory.
USDRESOLVEREXAMPLE_API
explicit UsdResolverExampleResolverContext(
const std::string& mappingFile);
USDRESOLVEREXAMPLE_API
UsdResolverExampleResolverContext();
USDRESOLVEREXAMPLE_API
UsdResolverExampleResolverContext(
const UsdResolverExampleResolverContext& rhs);
USDRESOLVEREXAMPLE_API
bool operator<(const UsdResolverExampleResolverContext& rhs) const;
USDRESOLVEREXAMPLE_API
bool operator==(const UsdResolverExampleResolverContext& rhs) const;
USDRESOLVEREXAMPLE_API
friend size_t hash_value(const UsdResolverExampleResolverContext& ctx);
USDRESOLVEREXAMPLE_API
const std::string& GetMappingFile() const;
private:
std::string _mappingFile;
};
PXR_NAMESPACE_OPEN_SCOPE
AR_DECLARE_RESOLVER_CONTEXT(UsdResolverExampleResolverContext);
PXR_NAMESPACE_CLOSE_SCOPE