Loading...
Searching...
No Matches
primAPI.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef USDHYDRA_GENERATED_PRIMAPI_H
8#define USDHYDRA_GENERATED_PRIMAPI_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usdHydra/api.h"
15#include "pxr/usd/usd/prim.h"
16#include "pxr/usd/usd/stage.h"
18
19#include "pxr/base/vt/value.h"
20
21#include "pxr/base/gf/vec3d.h"
22#include "pxr/base/gf/vec3f.h"
24
25#include "pxr/base/tf/token.h"
26#include "pxr/base/tf/type.h"
27
28PXR_NAMESPACE_OPEN_SCOPE
29
30class SdfAssetPath;
31
32// -------------------------------------------------------------------------- //
33// HYDRAPRIMAPI //
34// -------------------------------------------------------------------------- //
35
41{
42public:
47
52 explicit UsdHydraPrimAPI(const UsdPrim& prim=UsdPrim())
53 : UsdAPISchemaBase(prim)
54 {
55 }
56
60 explicit UsdHydraPrimAPI(const UsdSchemaBase& schemaObj)
61 : UsdAPISchemaBase(schemaObj)
62 {
63 }
64
66 USDHYDRA_API
68
72 USDHYDRA_API
73 static const TfTokenVector &
74 GetSchemaAttributeNames(bool includeInherited=true);
75
85 USDHYDRA_API
86 static UsdHydraPrimAPI
87 Get(const UsdStagePtr &stage, const SdfPath &path);
88
89
106 USDHYDRA_API
107 static bool
108 CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
109
125 USDHYDRA_API
126 static UsdHydraPrimAPI
127 Apply(const UsdPrim &prim);
128
129protected:
133 USDHYDRA_API
135
136private:
137 // needs to invoke _GetStaticTfType.
138 friend class UsdSchemaRegistry;
139 USDHYDRA_API
140 static const TfType &_GetStaticTfType();
141
142 static bool _IsTypedSchema();
143
144 // override SchemaBase virtuals.
145 USDHYDRA_API
146 const TfType &_GetTfType() const override;
147
148public:
149 // --------------------------------------------------------------------- //
150 // HYDRAEXPANDINSTANCES
151 // --------------------------------------------------------------------- //
173 USDHYDRA_API
175
181 USDHYDRA_API
182 UsdAttribute CreateHydraExpandInstancesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
183
184public:
185 // ===================================================================== //
186 // Feel free to add custom code below this line, it will be preserved by
187 // the code generator.
188 //
189 // Just remember to:
190 // - Close the class declaration with };
191 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
192 // - Close the include guard with #endif
193 // ===================================================================== //
194 // --(BEGIN CUSTOM CODE)--
195
196 // Returns true if the prim (or any ancestor) has UsdHydraPrimAPI's
197 // hydra:expandInstances attribute authored to true. By default
198 // this recursively checks ancestors, but this can be skipped
199 // using includeAncestors=false.
200 USDHYDRA_API
201 static bool ShouldExpandInstancesForPrim(
202 UsdPrim const& prim,
203 bool includeAncestors=true);
204};
205
206PXR_NAMESPACE_CLOSE_SCOPE
207
208#endif
Contains an asset path and optional evaluated and resolved paths.
Definition assetPath.h:79
A path value used to locate objects in layers or scenegraphs.
Definition path.h:281
TfType represents a dynamic runtime type.
Definition type.h:48
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition attribute.h:183
Provides Hydra-specific prim settings.
Definition primAPI.h:41
USDHYDRA_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
static USDHYDRA_API UsdHydraPrimAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition primAPI.h:46
static USDHYDRA_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.
static USDHYDRA_API UsdHydraPrimAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdHydraPrimAPI holding the prim adhering to this schema at path on stage.
static USDHYDRA_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...
USDHYDRA_API UsdAttribute GetHydraExpandInstancesAttr() const
This property can be used to de-instance the Hydra scene index representation of prims that were othe...
UsdHydraPrimAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdHydraPrimAPI on UsdPrim prim .
Definition primAPI.h:52
UsdHydraPrimAPI(const UsdSchemaBase &schemaObj)
Construct a UsdHydraPrimAPI on the prim held by schemaObj .
Definition primAPI.h:60
USDHYDRA_API UsdAttribute CreateHydraExpandInstancesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetHydraExpandInstancesAttr(), and also Create vs Get Property Methods for when to use Get vs Cre...
virtual USDHYDRA_API ~UsdHydraPrimAPI()
Destructor.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition prim.h:117
The base class for all schema types in Usd.
Definition schemaBase.h:39
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...
Definition value.h:90
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition common.h:112
@ SingleApplyAPI
Single Apply API schema.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition token.h:489