Loading...
Searching...
No Matches
statementsAPI.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef USDRI_GENERATED_STATEMENTSAPI_H
25#define USDRI_GENERATED_STATEMENTSAPI_H
26
28
29#include "pxr/pxr.h"
30#include "pxr/usd/usdRi/api.h"
32#include "pxr/usd/usd/prim.h"
33#include "pxr/usd/usd/stage.h"
34
36
37
38#include "pxr/base/vt/value.h"
39
40#include "pxr/base/gf/vec3d.h"
41#include "pxr/base/gf/vec3f.h"
43
44#include "pxr/base/tf/token.h"
45#include "pxr/base/tf/type.h"
46
47PXR_NAMESPACE_OPEN_SCOPE
48
49class SdfAssetPath;
50
51// -------------------------------------------------------------------------- //
52// STATEMENTSAPI //
53// -------------------------------------------------------------------------- //
54
70{
71public:
75 static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
76
81 explicit UsdRiStatementsAPI(const UsdPrim& prim=UsdPrim())
82 : UsdAPISchemaBase(prim)
83 {
84 }
85
89 explicit UsdRiStatementsAPI(const UsdSchemaBase& schemaObj)
90 : UsdAPISchemaBase(schemaObj)
91 {
92 }
93
95 USDRI_API
97
101 USDRI_API
102 static const TfTokenVector &
103 GetSchemaAttributeNames(bool includeInherited=true);
104
114 USDRI_API
115 static UsdRiStatementsAPI
116 Get(const UsdStagePtr &stage, const SdfPath &path);
117
118
135 USDRI_API
136 static bool
137 CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
138
154 USDRI_API
155 static UsdRiStatementsAPI
156 Apply(const UsdPrim &prim);
157
158protected:
162 USDRI_API
164
165private:
166 // needs to invoke _GetStaticTfType.
167 friend class UsdSchemaRegistry;
168 USDRI_API
169 static const TfType &_GetStaticTfType();
170
171 static bool _IsTypedSchema();
172
173 // override SchemaBase virtuals.
174 USDRI_API
175 const TfType &_GetTfType() const override;
176
177public:
178 // ===================================================================== //
179 // Feel free to add custom code below this line, it will be preserved by
180 // the code generator.
181 //
182 // Just remember to:
183 // - Close the class declaration with };
184 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
185 // - Close the include guard with #endif
186 // ===================================================================== //
187 // --(BEGIN CUSTOM CODE)--
188
189 // --------------------------------------------------------------------- //
190 // CreateRiAttribute
191 // --------------------------------------------------------------------- //
205 USDRI_API
208 const TfToken &name,
209 const std::string &riType,
210 const std::string &nameSpace = "user");
211
214 USDRI_API
217 const TfToken &name,
218 const TfType &tfType,
219 const std::string &nameSpace = "user");
220
225 USDRI_API
228 const TfToken &name,
229 const std::string &nameSpace = "user");
230
231 // --------------------------------------------------------------------- //
232 // GetRiAttributes
233 // --------------------------------------------------------------------- //
240 USDRI_API
241 std::vector<UsdProperty>
242 GetRiAttributes(const std::string &nameSpace = "") const;
243 // --------------------------------------------------------------------- //
244 // GetRiAttributeName
245 // --------------------------------------------------------------------- //
248 inline static TfToken GetRiAttributeName(const UsdProperty &prop) {
249 return prop.GetBaseName();
250 }
251
252 // --------------------------------------------------------------------- //
253 // GetRiAttributeNameSpace
254 // --------------------------------------------------------------------- //
257 USDRI_API
259
260 // --------------------------------------------------------------------- //
261 // IsRiAttribute
262 // --------------------------------------------------------------------- //
265 USDRI_API
266 static bool IsRiAttribute(const UsdProperty &prop);
267
268 // --------------------------------------------------------------------- //
269 // MakeRiAttributePropertyName
270 // --------------------------------------------------------------------- //
292 USDRI_API
293 static std::string MakeRiAttributePropertyName(const std::string &attrName);
294
295 // --------------------------------------------------------------------- //
296 // SetCoordinateSystem
297 // --------------------------------------------------------------------- //
306 USDRI_API
307 void SetCoordinateSystem(const std::string &coordSysName);
308
309 // --------------------------------------------------------------------- //
310 // GetCoordinateSystem
311 // --------------------------------------------------------------------- //
314 USDRI_API
315 std::string GetCoordinateSystem() const;
316
317 // --------------------------------------------------------------------- //
318 // HasCoordinateSystem
319 // --------------------------------------------------------------------- //
322 USDRI_API
324
325 // --------------------------------------------------------------------- //
326 // SetScopedCoordinateSystem
327 // --------------------------------------------------------------------- //
338 USDRI_API
339 void SetScopedCoordinateSystem(const std::string &coordSysName);
340
341 // --------------------------------------------------------------------- //
342 // GetScopedCoordinateSystem
343 // --------------------------------------------------------------------- //
347 USDRI_API
348 std::string GetScopedCoordinateSystem() const;
349
350 // --------------------------------------------------------------------- //
351 // HasScopedCoordinateSystem
352 // --------------------------------------------------------------------- //
356 USDRI_API
358
359 // --------------------------------------------------------------------- //
360 // GetModelCoordinateSystems
361 // --------------------------------------------------------------------- //
366 USDRI_API
367 bool GetModelCoordinateSystems(SdfPathVector *targets) const;
368
369 // --------------------------------------------------------------------- //
370 // GetModelScopedCoordinateSystems
371 // --------------------------------------------------------------------- //
376 USDRI_API
377 bool GetModelScopedCoordinateSystems(SdfPathVector *targets) const;
378
379};
380
381PXR_NAMESPACE_CLOSE_SCOPE
382
383#endif
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
TfType represents a dynamic runtime type.
Definition: type.h:65
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:176
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
Base class for UsdAttribute and UsdRelationship scenegraph objects.
Definition: property.h:55
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:70
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:75
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:89
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:81
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:56
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:129
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:457