Loading...
Searching...
No Matches
statementsAPI.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 USDRI_GENERATED_STATEMENTSAPI_H
8#define USDRI_GENERATED_STATEMENTSAPI_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usdRi/api.h"
15#include "pxr/usd/usd/prim.h"
16#include "pxr/usd/usd/stage.h"
17
19
20
21#include "pxr/base/vt/value.h"
22
23#include "pxr/base/gf/vec3d.h"
24#include "pxr/base/gf/vec3f.h"
26
27#include "pxr/base/tf/token.h"
28#include "pxr/base/tf/type.h"
29
30PXR_NAMESPACE_OPEN_SCOPE
31
32class SdfAssetPath;
33
34// -------------------------------------------------------------------------- //
35// STATEMENTSAPI //
36// -------------------------------------------------------------------------- //
37
53{
54public:
58 static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
59
64 explicit UsdRiStatementsAPI(const UsdPrim& prim=UsdPrim())
65 : UsdAPISchemaBase(prim)
66 {
67 }
68
72 explicit UsdRiStatementsAPI(const UsdSchemaBase& schemaObj)
73 : UsdAPISchemaBase(schemaObj)
74 {
75 }
76
78 USDRI_API
80
84 USDRI_API
85 static const TfTokenVector &
86 GetSchemaAttributeNames(bool includeInherited=true);
87
97 USDRI_API
99 Get(const UsdStagePtr &stage, const SdfPath &path);
100
101
118 USDRI_API
119 static bool
120 CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
121
137 USDRI_API
138 static UsdRiStatementsAPI
139 Apply(const UsdPrim &prim);
140
141protected:
145 USDRI_API
147
148private:
149 // needs to invoke _GetStaticTfType.
150 friend class UsdSchemaRegistry;
151 USDRI_API
152 static const TfType &_GetStaticTfType();
153
154 static bool _IsTypedSchema();
155
156 // override SchemaBase virtuals.
157 USDRI_API
158 const TfType &_GetTfType() const override;
159
160public:
161 // ===================================================================== //
162 // Feel free to add custom code below this line, it will be preserved by
163 // the code generator.
164 //
165 // Just remember to:
166 // - Close the class declaration with };
167 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
168 // - Close the include guard with #endif
169 // ===================================================================== //
170 // --(BEGIN CUSTOM CODE)--
171
172 // --------------------------------------------------------------------- //
173 // CreateRiAttribute
174 // --------------------------------------------------------------------- //
188 USDRI_API
191 const TfToken &name,
192 const std::string &riType,
193 const std::string &nameSpace = "user");
194
197 USDRI_API
200 const TfToken &name,
201 const TfType &tfType,
202 const std::string &nameSpace = "user");
203
208 USDRI_API
211 const TfToken &name,
212 const std::string &nameSpace = "user");
213
214 // --------------------------------------------------------------------- //
215 // GetRiAttributes
216 // --------------------------------------------------------------------- //
223 USDRI_API
224 std::vector<UsdProperty>
225 GetRiAttributes(const std::string &nameSpace = "") const;
226 // --------------------------------------------------------------------- //
227 // GetRiAttributeName
228 // --------------------------------------------------------------------- //
231 inline static TfToken GetRiAttributeName(const UsdProperty &prop) {
232 return prop.GetBaseName();
233 }
234
235 // --------------------------------------------------------------------- //
236 // GetRiAttributeNameSpace
237 // --------------------------------------------------------------------- //
240 USDRI_API
242
243 // --------------------------------------------------------------------- //
244 // IsRiAttribute
245 // --------------------------------------------------------------------- //
248 USDRI_API
249 static bool IsRiAttribute(const UsdProperty &prop);
250
251 // --------------------------------------------------------------------- //
252 // MakeRiAttributePropertyName
253 // --------------------------------------------------------------------- //
275 USDRI_API
276 static std::string MakeRiAttributePropertyName(const std::string &attrName);
277
278 // --------------------------------------------------------------------- //
279 // SetCoordinateSystem
280 // --------------------------------------------------------------------- //
289 USDRI_API
290 void SetCoordinateSystem(const std::string &coordSysName);
291
292 // --------------------------------------------------------------------- //
293 // GetCoordinateSystem
294 // --------------------------------------------------------------------- //
297 USDRI_API
298 std::string GetCoordinateSystem() const;
299
300 // --------------------------------------------------------------------- //
301 // HasCoordinateSystem
302 // --------------------------------------------------------------------- //
305 USDRI_API
307
308 // --------------------------------------------------------------------- //
309 // SetScopedCoordinateSystem
310 // --------------------------------------------------------------------- //
321 USDRI_API
322 void SetScopedCoordinateSystem(const std::string &coordSysName);
323
324 // --------------------------------------------------------------------- //
325 // GetScopedCoordinateSystem
326 // --------------------------------------------------------------------- //
330 USDRI_API
331 std::string GetScopedCoordinateSystem() const;
332
333 // --------------------------------------------------------------------- //
334 // HasScopedCoordinateSystem
335 // --------------------------------------------------------------------- //
339 USDRI_API
341
342 // --------------------------------------------------------------------- //
343 // GetModelCoordinateSystems
344 // --------------------------------------------------------------------- //
349 USDRI_API
350 bool GetModelCoordinateSystems(SdfPathVector *targets) const;
351
352 // --------------------------------------------------------------------- //
353 // GetModelScopedCoordinateSystems
354 // --------------------------------------------------------------------- //
359 USDRI_API
360 bool GetModelScopedCoordinateSystems(SdfPathVector *targets) const;
361
362};
363
364PXR_NAMESPACE_CLOSE_SCOPE
365
366#endif
Contains an asset path and an optional resolved path.
Definition: assetPath.h:30
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfType represents a dynamic runtime type.
Definition: type.h:48
The base class for all API schemas.
Definition: apiSchemaBase.h:99
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:159
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
Base class for UsdAttribute and UsdRelationship scenegraph objects.
Definition: property.h:38
USD_API TfToken GetBaseName() const
Return this property's name with all namespace prefixes removed, i.e.
Container namespace schema for all renderman statements.
Definition: statementsAPI.h:53
USDRI_API std::string GetCoordinateSystem() const
Returns the value in the "ri:coordinateSystem" attribute if it exists.
static TfToken GetRiAttributeName(const UsdProperty &prop)
Return the base, most-specific name of the rib attribute.
static USDRI_API std::string MakeRiAttributePropertyName(const std::string &attrName)
Returns the given attrName prefixed with the full Ri attribute namespace, creating a name suitable fo...
USDRI_API UsdAttribute CreateRiAttribute(const TfToken &name, const TfType &tfType, const std::string &nameSpace="user")
Creates an attribute of the given tfType.
USDRI_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
static USDRI_API UsdRiStatementsAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdRiStatementsAPI holding the prim adhering to this schema at path on stage.
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: statementsAPI.h:58
static USDRI_API bool IsRiAttribute(const UsdProperty &prop)
Return true if the property is in the "ri:attributes" namespace.
UsdRiStatementsAPI(const UsdSchemaBase &schemaObj)
Construct a UsdRiStatementsAPI on the prim held by schemaObj .
Definition: statementsAPI.h:72
static USDRI_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...
USDRI_API bool GetModelCoordinateSystems(SdfPathVector *targets) const
Populates the output targets with the authored ri:modelCoordinateSystems, if any.
USDRI_API void SetScopedCoordinateSystem(const std::string &coordSysName)
Sets the "ri:scopedCoordinateSystem" attribute to the given string value, creating the attribute if n...
static USDRI_API UsdRiStatementsAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
virtual USDRI_API ~UsdRiStatementsAPI()
Destructor.
USDRI_API UsdAttribute CreateRiAttribute(const TfToken &name, const std::string &riType, const std::string &nameSpace="user")
Create a rib attribute on the prim to which this schema is attached.
static USDRI_API TfToken GetRiAttributeNameSpace(const UsdProperty &prop)
Return the containing namespace of the rib attribute (e.g. "user").
static USDRI_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.
UsdRiStatementsAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdRiStatementsAPI on UsdPrim prim .
Definition: statementsAPI.h:64
USDRI_API std::vector< UsdProperty > GetRiAttributes(const std::string &nameSpace="") const
Return all rib attributes on this prim, or under a specific namespace (e.g. "user").
USDRI_API void SetCoordinateSystem(const std::string &coordSysName)
Sets the "ri:coordinateSystem" attribute to the given string value, creating the attribute if needed.
USDRI_API bool GetModelScopedCoordinateSystems(SdfPathVector *targets) const
Populates the output targets with the authored ri:modelScopedCoordinateSystems, if any.
USDRI_API std::string GetScopedCoordinateSystem() const
Returns the value in the "ri:scopedCoordinateSystem" attribute if it exists.
USDRI_API bool HasScopedCoordinateSystem() const
Returns true if the underlying prim has a ri:scopedCoordinateSystem opinion.
USDRI_API UsdAttribute GetRiAttribute(const TfToken &name, const std::string &nameSpace="user")
Return a UsdAttribute representing the Ri attribute with the name name, in the namespace nameSpace.
USDRI_API bool HasCoordinateSystem() const
Returns true if the underlying prim has a ri:coordinateSystem opinion.
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...
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:112
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:440