All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
xformWrapper.h
1 //
2 // Copyright 2017 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 __GUSD_XFORMWRAPPER_H__
25 #define __GUSD_XFORMWRAPPER_H__
26 
27 #include "pxr/pxr.h"
28 
29 #include "gusd/api.h"
30 
31 #include "groupBaseWrapper.h"
32 
33 #include "pxr/usd/usdGeom/xform.h"
34 
35 PXR_NAMESPACE_OPEN_SCOPE
36 
37 
38 class GusdXformWrapper : public GusdGroupBaseWrapper
39 {
40 public:
41 
42  GUSD_API
43  GusdXformWrapper(
44  const UsdStagePtr& stage,
45  const SdfPath& path,
46  bool isOverride = false );
47 
48  GUSD_API
49  GusdXformWrapper( const GusdXformWrapper& in );
50 
51  GUSD_API
52  GusdXformWrapper(
53  const UsdGeomXform& usdXform,
54  UsdTimeCode t,
55  GusdPurposeSet purposes );
56 
57  virtual ~GusdXformWrapper();
58 
59  // GusdPrimWrapper interface -----------------------------------------------
60 
61 public:
62 
63  virtual const UsdGeomImageable getUsdPrim() const override { return m_usdXform; }
64 
65  virtual bool redefine(
66  const UsdStagePtr& stage,
67  const SdfPath& path,
68  const GusdContext& ctxt,
69  const GT_PrimitiveHandle& sourcePrim ) override;
70 
71  virtual const char* className() const override;
72 
73  virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const override;
74 
75  virtual int getMotionSegments() const override;
76 
77  virtual int64 getMemoryUsage() const override;
78 
79  virtual GT_PrimitiveHandle doSoftCopy() const override;
80 
81  virtual bool
82  updateFromGTPrim(const GT_PrimitiveHandle& sourcePrim,
83  const UT_Matrix4D& localXform,
84  const GusdContext& ctxt,
85  GusdSimpleXformCache& xformCache) override;
86 
87  virtual bool isValid() const override;
88 
89  virtual bool refine(GT_Refine& refiner,
90  const GT_RefineParms* parms=NULL) const override;
91 
92  // -------------------------------------------------------------------------
93 
94 public:
95 
96  static GT_PrimitiveHandle
97  defineForWrite(const GT_PrimitiveHandle& sourcePrim,
98  const UsdStagePtr& stage,
99  const SdfPath& path,
100  const GusdContext& ctxt);
101 
102  static GT_PrimitiveHandle
103  defineForRead( const UsdGeomImageable& sourcePrim,
104  UsdTimeCode time,
105  GusdPurposeSet purposes );
106 
107 private:
108 
109  bool initUsdPrim(const UsdStagePtr& stage,
110  const SdfPath& path,
111  bool asOverride);
112 
113  UsdGeomXformable m_usdXform;
114 };
115 
116 PXR_NAMESPACE_CLOSE_SCOPE
117 #endif // __GUSD_XFORMWRAPPER_H__
118 
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
A GusdContext structure is created by the ROPs that write USD files and passed to the GusdPrimWrapper...
Definition: context.h:46
Concrete prim schema for a transform, which implements Xformable.
Definition: xform.h:56
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
Base class for all prims that may require rendering or visualization of some sort.
Definition: imageable.h:74
Base class for all transformable prims, which allows arbitrary sequences of component affine transfor...
Definition: xformable.h:252