All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
curvesWrapper.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_CURVESWRAPPER_H__
25 #define __GUSD_CURVESWRAPPER_H__
26 
27 #include "primWrapper.h"
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdGeom/basisCurves.h"
31 
32 PXR_NAMESPACE_OPEN_SCOPE
33 
34 
35 class GusdCurvesWrapper : public GusdPrimWrapper
36 {
37 public:
38  GusdCurvesWrapper(
39  const GT_PrimitiveHandle& sourcePrim,
40  const UsdStagePtr& stage,
41  const SdfPath& path,
42  bool isOverride = false );
43  GusdCurvesWrapper(
44  const UsdGeomBasisCurves& usdCurves,
45  UsdTimeCode time,
46  GusdPurposeSet purposes );
47 
48  virtual ~GusdCurvesWrapper();
49 
50  virtual const UsdGeomImageable getUsdPrim() const override { return m_usdCurves; }
51 
52  virtual bool redefine(
53  const UsdStagePtr& stage,
54  const SdfPath& path,
55  const GusdContext& ctxt,
56  const GT_PrimitiveHandle& sourcePrim ) override;
57 
58  virtual const char* className() const override;
59 
60  virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const override;
61 
62  virtual int getMotionSegments() const override;
63 
64  virtual int64 getMemoryUsage() const override;
65 
66  virtual GT_PrimitiveHandle doSoftCopy() const override;
67 
68  virtual bool
69  updateFromGTPrim(const GT_PrimitiveHandle& sourcePrim,
70  const UT_Matrix4D& houXform,
71  const GusdContext& ctxt,
72  GusdSimpleXformCache& xformCache ) override;
73 
74  virtual bool isValid() const override;
75 
76  virtual bool refine(GT_Refine& refiner,
77  const GT_RefineParms* parms=NULL) const override;
78 public:
79 
80  static GT_PrimitiveHandle
81  defineForWrite( const GT_PrimitiveHandle& sourcePrim,
82  const UsdStagePtr& stage,
83  const SdfPath& path,
84  const GusdContext& ctxt);
85 
86  static GT_PrimitiveHandle
87  defineForRead( const UsdGeomImageable& sourcePrim,
88  UsdTimeCode time,
89  GusdPurposeSet purposes );
90 
91 private:
92  bool initUsdPrim( const UsdStagePtr& stage,
93  const SdfPath& path,
94  bool asOverride);
95 
96  UsdGeomBasisCurves m_usdCurves;
97  bool m_forceCreateNewGeo;
98 };
99 
100 PXR_NAMESPACE_CLOSE_SCOPE
101 
102 #endif // __GUSD_CURVESWRAPPER_H__
A GT_Primitive that wraps a USD Prim.
Definition: primWrapper.h:89
virtual bool updateFromGTPrim(const GT_PrimitiveHandle &sourcePrim, const UT_Matrix4D &houXform, const GusdContext &ctxt, GusdSimpleXformCache &xformCache)
Fill a USD prim's attribute samples for a frame from the attributes in a GT primitive.
virtual bool redefine(const UsdStagePtr &stage, const SdfPath &path, const GusdContext &ctxt, const GT_PrimitiveHandle &sourcePrim)
Create a new USD prim to match GT primitive.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
static GT_PrimitiveHandle defineForWrite(const GT_PrimitiveHandle &sourcePrim, const UsdStagePtr &stage, const SdfPath &path, const GusdContext &ctxt)
Given a GT_Primitive, create a USD prim of the proper type.
A GusdContext structure is created by the ROPs that write USD files and passed to the GusdPrimWrapper...
Definition: context.h:46
BasisCurves are a batched curve representation analogous to the classic RIB definition via Basis and ...
Definition: basisCurves.h:263
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
virtual bool isValid() const
Return true if the underlying USD prim is valid.
static GT_PrimitiveHandle defineForRead(const UsdGeomImageable &sourcePrim, UsdTimeCode time, GusdPurposeSet purposes)
Given a USD prim, create a GusdPrimWrapper of the proper type.
Base class for all prims that may require rendering or visualization of some sort.
Definition: imageable.h:74