coordSysAPI.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 USDSHADE_GENERATED_COORDSYSAPI_H
25 #define USDSHADE_GENERATED_COORDSYSAPI_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdShade/api.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
35 
37 
38 #include "pxr/base/vt/value.h"
39 
40 #include "pxr/base/gf/vec3d.h"
41 #include "pxr/base/gf/vec3f.h"
42 #include "pxr/base/gf/matrix4d.h"
43 
44 #include "pxr/base/tf/token.h"
45 #include "pxr/base/tf/type.h"
46 
47 PXR_NAMESPACE_OPEN_SCOPE
48 
49 class SdfAssetPath;
50 
51 // -------------------------------------------------------------------------- //
52 // COORDSYSAPI //
53 // -------------------------------------------------------------------------- //
54 
83 {
84 public:
89 
100  const UsdPrim& prim=UsdPrim(), const TfToken &name=TfToken())
101  : UsdAPISchemaBase(prim, /*instanceName*/ name)
102  { }
103 
109  const UsdSchemaBase& schemaObj, const TfToken &name)
110  : UsdAPISchemaBase(schemaObj, /*instanceName*/ name)
111  { }
112 
114  USDSHADE_API
115  virtual ~UsdShadeCoordSysAPI();
116 
120  USDSHADE_API
121  static const TfTokenVector &
122  GetSchemaAttributeNames(bool includeInherited=true);
123 
129  USDSHADE_API
130  static TfTokenVector
131  GetSchemaAttributeNames(bool includeInherited, const TfToken &instanceName);
132 
134  TfToken GetName() const {
135  return _GetInstanceName();
136  }
137 
152  USDSHADE_API
153  static UsdShadeCoordSysAPI
154  Get(const UsdStagePtr &stage, const SdfPath &path);
155 
158  USDSHADE_API
159  static UsdShadeCoordSysAPI
160  Get(const UsdPrim &prim, const TfToken &name);
161 
164  USDSHADE_API
165  static std::vector<UsdShadeCoordSysAPI>
166  GetAll(const UsdPrim &prim);
167 
170  USDSHADE_API
171  static bool
172  IsSchemaPropertyBaseName(const TfToken &baseName);
173 
177  USDSHADE_API
178  static bool
179  IsCoordSysAPIPath(const SdfPath &path, TfToken *name);
180 
197  USDSHADE_API
198  static bool
199  CanApply(const UsdPrim &prim, const TfToken &name,
200  std::string *whyNot=nullptr);
201 
221  USDSHADE_API
222  static UsdShadeCoordSysAPI
223  Apply(const UsdPrim &prim, const TfToken &name);
224 
225 protected:
229  USDSHADE_API
230  UsdSchemaKind _GetSchemaKind() const override;
231 
232 private:
233  // needs to invoke _GetStaticTfType.
234  friend class UsdSchemaRegistry;
235  USDSHADE_API
236  static const TfType &_GetStaticTfType();
237 
238  static bool _IsTypedSchema();
239 
240  // override SchemaBase virtuals.
241  USDSHADE_API
242  const TfType &_GetTfType() const override;
243 
244 public:
245  // --------------------------------------------------------------------- //
246  // BINDING
247  // --------------------------------------------------------------------- //
250  USDSHADE_API
252 
255  USDSHADE_API
257 
258 public:
259  // ===================================================================== //
260  // Feel free to add custom code below this line, it will be preserved by
261  // the code generator.
262  //
263  // Just remember to:
264  // - Close the class declaration with };
265  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
266  // - Close the include guard with #endif
267  // ===================================================================== //
268  // --(BEGIN CUSTOM CODE)--
269 
273  typedef struct {
274  TfToken name;
275  SdfPath bindingRelPath;
276  SdfPath coordSysPrimPath;
277  } Binding;
278 
290  USDSHADE_API
291  bool HasLocalBindings() const;
292 
296  USDSHADE_API
297  static bool HasLocalBindingsForPrim(const UsdPrim &prim);
298 
313  USDSHADE_API
314  std::vector<Binding> GetLocalBindings() const;
315 
324  USDSHADE_API
325  static std::vector<Binding> GetLocalBindingsForPrim(const UsdPrim &prim);
326 
332  USDSHADE_API
333  Binding GetLocalBinding() const;
334 
356  USDSHADE_API
357  std::vector<Binding> FindBindingsWithInheritance() const;
358 
371  USDSHADE_API
372  static std::vector<Binding> FindBindingsWithInheritanceForPrim(
373  const UsdPrim &prim);
374 
387  USDSHADE_API
389 
403  USDSHADE_API
404  bool Bind(const TfToken &name, const SdfPath &path) const;
405 
411  USDSHADE_API
412  bool ApplyAndBind(const TfToken &name, const SdfPath &path) const;
413 
418  USDSHADE_API
419  bool Bind(const SdfPath &path) const;
420 
437  USDSHADE_API
438  bool ClearBinding(const TfToken &name, bool removeSpec) const;
439 
447  USDSHADE_API
448  bool ClearBinding(bool removeSpec) const;
449 
462  USDSHADE_API
463  bool BlockBinding(const TfToken &name) const;
464 
468  USDSHADE_API
469  bool BlockBinding() const;
470 
473  //
477  //
478  USDSHADE_API
479  static TfToken GetCoordSysRelationshipName(const std::string &coordSysName);
480 
482  USDSHADE_API
483  static bool CanContainPropertyName(const TfToken &name);
484 
487  USDSHADE_API
488  static TfToken GetBindingBaseName(const TfToken &name);
489 
492  USDSHADE_API
493  TfToken GetBindingBaseName() const;
494 
495 private:
496  USDSHADE_API
497  static void _GetBindingsForPrim(const UsdPrim &prim,
498  std::vector<Binding> &result, bool checkExistingBindings=false);
499 
500 };
501 
502 PXR_NAMESPACE_CLOSE_SCOPE
503 
504 #include "pxr/base/tf/envSetting.h"
505 
506 PXR_NAMESPACE_OPEN_SCOPE
507 USDSHADE_API
508 extern TfEnvSetting<std::string> USD_SHADE_COORD_SYS_IS_MULTI_APPLY;
509 
510 PXR_NAMESPACE_CLOSE_SCOPE
511 
512 #endif
UsdShadeCoordSysAPI(const UsdSchemaBase &schemaObj, const TfToken &name)
Construct a UsdShadeCoordSysAPI on the prim held by schemaObj with name name.
Definition: coordSysAPI.h:108
UsdShadeCoordSysAPI provides a way to designate, name, and discover coordinate systems.
Definition: coordSysAPI.h:82
UsdShadeCoordSysAPI(const UsdPrim &prim=UsdPrim(), const TfToken &name=TfToken())
Construct a UsdShadeCoordSysAPI on UsdPrim prim with name name .
Definition: coordSysAPI.h:99
USDSHADE_API bool ApplyAndBind(const TfToken &name, const SdfPath &path) const
A convinience API for clients to use to Apply schema in accordance with new UsdShadeCoordSysAPI schem...
static USDSHADE_API bool HasLocalBindingsForPrim(const UsdPrim &prim)
Returns true if the prim has UsdShadeCoordSysAPI applied.
USDSHADE_API TfToken GetBindingBaseName() const
Strips "coordSys:" from the relationship name and returns "<instanceName>:binding".
USDSHADE_API UsdRelationship GetBindingRel() const
Prim binding expressing the appropriate coordinate systems.
USDSHADE_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
static USDSHADE_API bool IsCoordSysAPIPath(const SdfPath &path, TfToken *name)
Checks if the given path path is of an API schema of type CoordSysAPI.
The base class for all API schemas.
USDSHADE_API bool ClearBinding(const TfToken &name, bool removeSpec) const
Clear the indicated coordinate system binding on this prim from the current edit target.
static USDSHADE_API std::vector< UsdShadeCoordSysAPI > GetAll(const UsdPrim &prim)
Return a vector of all named instances of UsdShadeCoordSysAPI on the given prim.
USDSHADE_API Binding GetLocalBinding() const
Get the coordinate system bindings local to this prim cooresponding to this instance name.
static USDSHADE_API std::vector< Binding > FindBindingsWithInheritanceForPrim(const UsdPrim &prim)
Find the list of coordinate system bindings that apply to this prim, including inherited bindings.
A coordinate system binding.
Definition: coordSysAPI.h:273
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:127
USDSHADE_API UsdRelationship CreateBindingRel() const
See GetBindingRel(), and also Create vs Get Property Methods for when to use Get vs Create.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: coordSysAPI.h:88
virtual USDSHADE_API ~UsdShadeCoordSysAPI()
Destructor.
Environment setting variable.
TfToken GetName() const
Returns the name of this multiple-apply schema instance.
Definition: coordSysAPI.h:134
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
USDSHADE_API Binding FindBindingWithInheritance() const
Find the coordinate system bindings that apply to this prim, including inherited bindings.
USDSHADE_API bool HasLocalBindings() const
Returns true if the prim has local coordinate system relationship exists.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
USDSHADE_API bool Bind(const TfToken &name, const SdfPath &path) const
Bind the name to the given path.
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Definition: relationship.h:128
USDSHADE_API std::vector< Binding > FindBindingsWithInheritance() const
Find the list of coordinate system bindings that apply to this prim, including inherited bindings.
static USDSHADE_API bool CanApply(const UsdPrim &prim, const TfToken &name, std::string *whyNot=nullptr)
Returns true if this multiple-apply API schema can be applied, with the given instance name,...
static USDSHADE_API UsdShadeCoordSysAPI Apply(const UsdPrim &prim, const TfToken &name)
Applies this multiple-apply API schema to the given prim along with the given instance name,...
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
Multiple Apply API Schema.
static USDSHADE_API bool IsSchemaPropertyBaseName(const TfToken &baseName)
Checks if the given name baseName is the base name of a property of CoordSysAPI.
static USDSHADE_API UsdShadeCoordSysAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdShadeCoordSysAPI holding the prim adhering to this schema at path on stage.
static USDSHADE_API std::vector< Binding > GetLocalBindingsForPrim(const UsdPrim &prim)
Get the list of coordinate system bindings local to this prim, across all multi-apply instanceNames.
TfType represents a dynamic runtime type.
Definition: type.h:64
static USDSHADE_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...
Singleton registry that provides access to schema type information and the prim definitions for regis...
USDSHADE_API bool BlockBinding() const
Block the indicated coordinate system binding on this prim by blocking targets on the underlying rela...
USDSHADE_API std::vector< Binding > GetLocalBindings() const
Get the list of coordinate system bindings local to this prim.
static USDSHADE_API bool CanContainPropertyName(const TfToken &name)
Test whether a given name contains the "coordSys:" prefix.
The base class for all schema types in Usd.
Definition: schemaBase.h:56
const TfToken & _GetInstanceName() const
Returns the instance name of the API schema object belonging to a multiple-apply API schema.
static USDSHADE_API TfToken GetCoordSysRelationshipName(const std::string &coordSysName)
Returns the fully namespaced coordinate system relationship name, given the coordinate system name.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...