7#ifndef USD_GENERATED_COLORSPACEAPI_H
8#define USD_GENERATED_COLORSPACEAPI_H
13#include "pxr/usd/usd/api.h"
19#include "pxr/base/gf/colorSpace.h"
20#include "pxr/base/tf/bigRWMutex.h"
23#include "pxr/base/vt/value.h"
30#include "pxr/base/tf/type.h"
32PXR_NAMESPACE_OPEN_SCOPE
193 static const TfType &_GetStaticTfType();
195 static bool _IsTypedSchema();
199 const TfType &_GetTfType()
const override;
250 virtual void Insert(
const SdfPath& prim,
const TfToken& colorSpace) = 0;
271 TfHashMap<SdfPath, TfToken, SdfPath::Hash> _cache;
279 auto it = _cache.find(prim);
280 if (it != _cache.end()) {
286 void Insert(
const SdfPath& prim,
const TfToken& colorSpace)
override {
288 _cache[prim] = colorSpace;
374PXR_NAMESPACE_CLOSE_SCOPE
Contains an asset path and optional evaluated and resolved paths.
A path value used to locate objects in layers or scenegraphs.
This class implements a readers-writer mutex and provides a scoped lock utility.
Token for efficient comparison, assignment, and hashing of known strings.
TfType represents a dynamic runtime type.
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
A minimalistic cache for color space lookups.
This is a simple example of a color space cache implementation.
UsdColorSpaceAPI is an API schema that introduces a colorSpace property for authoring scene referred ...
static USD_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor cl...
virtual USD_API ~UsdColorSpaceAPI()
Destructor.
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
USD_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
USD_API UsdAttribute CreateColorSpaceNameAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetColorSpaceNameAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
static USD_API GfColorSpace ComputeColorSpace(const UsdAttribute &attribute, ColorSpaceCache *cache=nullptr)
Computes the color space for the given attribute on this prim, using the same algorithm as ComputeCol...
static USD_API TfToken ComputeColorSpaceName(UsdPrim prim, ColorSpaceCache *cache=nullptr)
Computes the color space name for the given prim.
UsdColorSpaceAPI(const UsdSchemaBase &schemaObj)
Construct a UsdColorSpaceAPI on the prim held by schemaObj .
static USD_API TfToken ComputeColorSpaceName(const UsdAttribute &attribute, ColorSpaceCache *cache=nullptr)
Computes the color space name for the given attribute.
static USD_API bool IsValidColorSpaceName(UsdPrim prim, const TfToken &colorSpace, ColorSpaceCache *cache=nullptr)
Returns true if the named color space is built in, defined on the supplied prim, or on one of the pri...
static USD_API UsdColorSpaceAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
static USD_API GfColorSpace ComputeColorSpace(UsdPrim prim, const TfToken &colorSpace, ColorSpaceCache *cache=nullptr)
Creates a color space object for the named color space if it built in, defined on the prim or on an a...
USD_API UsdAttribute GetColorSpaceNameAttr() const
The color space that applies to attributes with unauthored color spaces on this prim and its descende...
UsdColorSpaceAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdColorSpaceAPI on UsdPrim prim .
static USD_API UsdColorSpaceAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdColorSpaceAPI holding the prim adhering to this schema at path on stage.
static USD_API GfColorSpace ComputeColorSpace(UsdPrim prim, ColorSpaceCache *cache=nullptr)
Computes the color space for this prim, using the same algorithm as ComputeColorSpaceName().
static USD_API bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
Returns true if this single-apply API schema can be applied to the given prim.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
The base class for all schema types in Usd.
Singleton registry that provides access to schema type information and the prim definitions for regis...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Scoped lock utility class.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.