imageable.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 USDGEOM_GENERATED_IMAGEABLE_H
25 #define USDGEOM_GENERATED_IMAGEABLE_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdGeom/api.h"
31 #include "pxr/usd/usd/typed.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usdGeom/tokens.h"
35 
36 #include "pxr/base/gf/bbox3d.h"
37 #include "pxr/usd/usdGeom/primvar.h"
38 
39 #include "pxr/base/vt/value.h"
40 
41 #include "pxr/base/gf/vec3d.h"
42 #include "pxr/base/gf/vec3f.h"
43 #include "pxr/base/gf/matrix4d.h"
44 
45 #include "pxr/base/tf/token.h"
46 #include "pxr/base/tf/type.h"
47 
48 PXR_NAMESPACE_OPEN_SCOPE
49 
50 class SdfAssetPath;
51 
52 // -------------------------------------------------------------------------- //
53 // IMAGEABLE //
54 // -------------------------------------------------------------------------- //
55 
74 class UsdGeomImageable : public UsdTyped
75 {
76 public:
81 
86  explicit UsdGeomImageable(const UsdPrim& prim=UsdPrim())
87  : UsdTyped(prim)
88  {
89  }
90 
94  explicit UsdGeomImageable(const UsdSchemaBase& schemaObj)
95  : UsdTyped(schemaObj)
96  {
97  }
98 
100  USDGEOM_API
101  virtual ~UsdGeomImageable();
102 
106  USDGEOM_API
107  static const TfTokenVector &
108  GetSchemaAttributeNames(bool includeInherited=true);
109 
119  USDGEOM_API
120  static UsdGeomImageable
121  Get(const UsdStagePtr &stage, const SdfPath &path);
122 
123 
124 protected:
128  USDGEOM_API
129  UsdSchemaKind _GetSchemaKind() const override;
130 
131 private:
132  // needs to invoke _GetStaticTfType.
133  friend class UsdSchemaRegistry;
134  USDGEOM_API
135  static const TfType &_GetStaticTfType();
136 
137  static bool _IsTypedSchema();
138 
139  // override SchemaBase virtuals.
140  USDGEOM_API
141  const TfType &_GetTfType() const override;
142 
143 public:
144  // --------------------------------------------------------------------- //
145  // VISIBILITY
146  // --------------------------------------------------------------------- //
160  USDGEOM_API
162 
168  USDGEOM_API
169  UsdAttribute CreateVisibilityAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
170 
171 public:
172  // --------------------------------------------------------------------- //
173  // PURPOSE
174  // --------------------------------------------------------------------- //
189  USDGEOM_API
191 
197  USDGEOM_API
198  UsdAttribute CreatePurposeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
199 
200 public:
201  // --------------------------------------------------------------------- //
202  // PROXYPRIM
203  // --------------------------------------------------------------------- //
225  USDGEOM_API
227 
230  USDGEOM_API
232 
233 public:
234  // ===================================================================== //
235  // Feel free to add custom code below this line, it will be preserved by
236  // the code generator.
237  //
238  // Just remember to:
239  // - Close the class declaration with };
240  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
241  // - Close the include guard with #endif
242  // ===================================================================== //
243  // --(BEGIN CUSTOM CODE)--
244 
245 
246  // --------------------------------------------------------------------- //
249  // --------------------------------------------------------------------- //
250 
252  USDGEOM_API
253  UsdGeomPrimvar CreatePrimvar(const TfToken& attrName,
254  const SdfValueTypeName &typeName,
255  const TfToken& interpolation = TfToken(),
256  int elementSize = -1) const;
257 
259  USDGEOM_API
260  UsdGeomPrimvar GetPrimvar(const TfToken &name) const;
261 
263  USDGEOM_API
264  std::vector<UsdGeomPrimvar> GetPrimvars() const;
265 
267  USDGEOM_API
268  std::vector<UsdGeomPrimvar> GetAuthoredPrimvars() const;
269 
271  USDGEOM_API
272  bool HasPrimvar(const TfToken &name) const;
273 
274 
286  USDGEOM_API
287  static const TfTokenVector &GetOrderedPurposeTokens();
288 
289  // --------------------------------------------------------------------- //
294  // --------------------------------------------------------------------- //
295 
322  USDGEOM_API
323  void MakeVisible(const UsdTimeCode &time=UsdTimeCode::Default()) const;
324 
338  USDGEOM_API
339  void MakeInvisible(const UsdTimeCode &time=UsdTimeCode::Default()) const;
340 
342 
343  // --------------------------------------------------------------------- //
354  // --------------------------------------------------------------------- //
355 
373  USDGEOM_API
375 
384  USDGEOM_API
386  const TfToken &purpose = UsdGeomTokens->default_) const;
387 
416  USDGEOM_API
418  const TfToken &purpose = UsdGeomTokens->default_,
419  const UsdTimeCode &time = UsdTimeCode::Default()) const;
420 
427  struct PurposeInfo {
428  constexpr PurposeInfo() = default;
429 
430  PurposeInfo(const TfToken &purpose_, bool isInheritable_) :
431  purpose(purpose_), isInheritable(isInheritable_) {}
432 
436 
439  bool isInheritable = false;
440 
442  explicit operator bool() const { return !purpose.IsEmpty(); }
443 
444  bool operator==(const PurposeInfo &rhs) {
445  return purpose == rhs.purpose && isInheritable == rhs.isInheritable;
446  }
447 
448  bool operator!=(const PurposeInfo &rhs) {
449  return !(*this == rhs);
450  }
451 
454  static const TfToken empty;
455  return isInheritable ? purpose : empty;
456  }
457  };
458 
473  USDGEOM_API
474  PurposeInfo ComputePurposeInfo() const;
475 
484  USDGEOM_API
485  PurposeInfo ComputePurposeInfo(const PurposeInfo &parentPurposeInfo) const;
486 
500  USDGEOM_API
501  TfToken ComputePurpose() const;
502 
531  USDGEOM_API
532  UsdPrim ComputeProxyPrim(UsdPrim *renderPrim=NULL) const;
533 
542  USDGEOM_API
543  bool SetProxyPrim(const UsdPrim &proxy) const;
544 
546  USDGEOM_API
547  bool SetProxyPrim(const UsdSchemaBase &proxy) const;
548 
562  USDGEOM_API
564  TfToken const &purpose1=TfToken(),
565  TfToken const &purpose2=TfToken(),
566  TfToken const &purpose3=TfToken(),
567  TfToken const &purpose4=TfToken()) const;
568 
569 
583  USDGEOM_API
585  TfToken const &purpose1=TfToken(),
586  TfToken const &purpose2=TfToken(),
587  TfToken const &purpose3=TfToken(),
588  TfToken const &purpose4=TfToken()) const;
589 
603  USDGEOM_API
605  TfToken const &purpose1=TfToken(),
606  TfToken const &purpose2=TfToken(),
607  TfToken const &purpose3=TfToken(),
608  TfToken const &purpose4=TfToken()) const;
609 
617  USDGEOM_API
619 
627  USDGEOM_API
629 
631 
632 };
633 
634 PXR_NAMESPACE_CLOSE_SCOPE
635 
636 #endif
USDGEOM_API bool SetProxyPrim(const UsdPrim &proxy) const
Convenience function for authoring the renderProxy rel on this prim to target the given proxy prim.
USDGEOM_API UsdAttribute CreatePurposeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetPurposeAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API UsdAttribute CreateVisibilityAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetVisibilityAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
bool IsEmpty() const
Returns true iff this token contains the empty string "".
Definition: token.h:302
USDGEOM_API GfMatrix4d ComputeLocalToWorldTransform(UsdTimeCode const &time) const
Compute the transformation matrix for this prim at the given time, including the transform authored o...
USDGEOM_API bool HasPrimvar(const TfToken &name) const
USDGEOM_API UsdPrim ComputeProxyPrim(UsdPrim *renderPrim=NULL) const
Find the prim whose purpose is proxy that serves as the proxy for this prim, as established by the Ge...
USDGEOM_API TfToken ComputeEffectiveVisibility(const TfToken &purpose=UsdGeomTokens->default_, const UsdTimeCode &time=UsdTimeCode::Default()) const
Calculate the effective purpose visibility of this prim for the given purpose, taking into account op...
USDGEOM_API std::vector< UsdGeomPrimvar > GetAuthoredPrimvars() const
USDGEOM_API UsdGeomPrimvar CreatePrimvar(const TfToken &attrName, const SdfValueTypeName &typeName, const TfToken &interpolation=TfToken(), int elementSize=-1) const
USDGEOM_API void MakeVisible(const UsdTimeCode &time=UsdTimeCode::Default()) const
Make the imageable visible if it is invisible at the given time.
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
virtual USDGEOM_API ~UsdGeomImageable()
Destructor.
Represents a value type name, i.e.
Definition: valueTypeName.h:87
USDGEOM_API std::vector< UsdGeomPrimvar > GetPrimvars() const
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:176
static USDGEOM_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...
USDGEOM_API UsdAttribute GetPurposeAttr() const
Purpose is a classification of geometry into categories that can each be independently included or ex...
bool isInheritable
Whether this purpose should be inherited by namespace children that do not have their own authored pu...
Definition: imageable.h:439
static USDGEOM_API UsdGeomImageable Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdGeomImageable holding the prim adhering to this schema at path on stage.
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:127
TfToken purpose
The computed purpose.
Definition: imageable.h:435
USDGEOM_API TfToken ComputePurpose() const
Calculate the effective purpose information about this prim.
USDGEOM_API PurposeInfo ComputePurposeInfo() const
Calculate the effective purpose information about this prim which includes final computed purpose val...
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
USDGEOM_API void MakeInvisible(const UsdTimeCode &time=UsdTimeCode::Default()) const
Makes the imageable invisible if it is visible at the given time.
USDGEOM_API UsdAttribute GetPurposeVisibilityAttr(const TfToken &purpose=UsdGeomTokens->default_) const
Return the attribute that is used for expressing visibility opinions for the given purpose.
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: imageable.h:80
USDGEOM_API TfStaticData< UsdGeomTokensType > UsdGeomTokens
A global variable with static, efficient TfTokens for use in all public USD API.
USDGEOM_API UsdGeomPrimvar GetPrimvar(const TfToken &name) const
Value type containing information about a prim's computed effective purpose as well as storing whethe...
Definition: imageable.h:427
UsdGeomImageable(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomImageable on UsdPrim prim .
Definition: imageable.h:86
USDGEOM_API TfToken ComputeVisibility(UsdTimeCode const &time=UsdTimeCode::Default()) const
Calculate the effective visibility of this prim, as defined by its most ancestral authored "invisible...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:132
The base class for all typed schemas (those that can impart a typeName to a UsdPrim),...
Definition: typed.h:47
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:288
USDGEOM_API GfMatrix4d ComputeParentToWorldTransform(UsdTimeCode const &time) const
Compute the transformation matrix for this prim at the given time, NOT including the transform author...
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Definition: relationship.h:128
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
const TfToken & GetInheritablePurpose() const
Returns the purpose if it's inheritable, returns empty if it is not.
Definition: imageable.h:453
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Definition: timeCode.h:113
static USDGEOM_API const TfTokenVector & GetOrderedPurposeTokens()
Returns an ordered list of allowed values of the purpose attribute.
USDGEOM_API UsdRelationship GetProxyPrimRel() const
The proxyPrim relationship allows us to link a prim whose purpose is "render" to its (single target) ...
USDGEOM_API UsdAttribute GetVisibilityAttr() const
Visibility is meant to be the simplest form of "pruning" visibility that is supported by most DCC app...
UsdGeomImageable(const UsdSchemaBase &schemaObj)
Construct a UsdGeomImageable on the prim held by schemaObj .
Definition: imageable.h:94
Represents a non-concrete typed schema.
TfType represents a dynamic runtime type.
Definition: type.h:64
Singleton registry that provides access to schema type information and the prim definitions for regis...
Schema wrapper for UsdAttribute for authoring and introspecting attributes that are primvars.
Definition: primvar.h:260
USDGEOM_API GfBBox3d ComputeUntransformedBound(UsdTimeCode const &time, TfToken const &purpose1=TfToken(), TfToken const &purpose2=TfToken(), TfToken const &purpose3=TfToken(), TfToken const &purpose4=TfToken()) const
Compute the untransformed bound of this prim, at the specified time, and for the specified purposes.
The base class for all schema types in Usd.
Definition: schemaBase.h:56
Base class for all prims that may require rendering or visualization of some sort.
Definition: imageable.h:74
USDGEOM_API UsdRelationship CreateProxyPrimRel() const
See GetProxyPrimRel(), and also Create vs Get Property Methods for when to use Get vs Create.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:168
USDGEOM_API GfBBox3d ComputeLocalBound(UsdTimeCode const &time, TfToken const &purpose1=TfToken(), TfToken const &purpose2=TfToken(), TfToken const &purpose3=TfToken(), TfToken const &purpose4=TfToken()) const
Compute the bound of this prim in local space, at the specified time, and for the specified purposes.
Basic type: arbitrarily oriented 3D bounding box.
Definition: bbox3d.h:84
USDGEOM_API GfBBox3d ComputeWorldBound(UsdTimeCode const &time, TfToken const &purpose1=TfToken(), TfToken const &purpose2=TfToken(), TfToken const &purpose3=TfToken(), TfToken const &purpose4=TfToken()) const
Compute the bound of this prim in world space, at the specified time, and for the specified purposes.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...