HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
context.h
Go to the documentation of this file.
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 
25 #ifndef __GUSD_CONTEXT_H__
26 #define __GUSD_CONTEXT_H__
27 
28 #include "pxr/pxr.h"
29 #include "pxr/usd/usd/timeCode.h"
30 #include "pxr/usd/usd/stage.h"
31 #include "pxr/usd/usdGeom/tokens.h"
32 
33 #include <GT/GT_Primitive.h>
34 
35 #include <functional>
36 #include <string>
37 
39 
40 class GusdGT_AttrFilter;
41 class UsdGeomXformCache;
42 
43 /// A GusdContext structure is created by the ROPs that write USD files and
44 /// passed to the GusdPrimWrappers to control how they are written to the USD file.
45 
46 class GusdContext {
47 public:
48  typedef std::function<UsdStageRefPtr ()> GetStageFunc;
50 
52  Granularity g,
53  const GusdGT_AttrFilter& af )
54  : time( t )
55  , granularity( g )
56  , writeOverlay( false )
57  , overlayPoints( false )
58  , overlayTransforms( false )
59  , overlayPrimvars( false )
60  , overlayAll( false )
61  , writeStaticGeo( false )
62  , writeStaticTopology( false )
63  , writeStaticPrimvars( false )
64  , attributeFilter( af )
65  , purpose( UsdGeomTokens->default_ )
66  , makeRefsInstanceable( true )
67  {}
68 
69  // Time of the current frame we are writing
71 
72  // Are we writing on frame per file or all the frames into a single file?
74 
75  bool writeOverlay; // Overlay existing geometry rather than creating new geometry?
76 
77  // Flags indicating what should be overlayed
78  bool overlayPoints; // For point instancers, overlayPoints and overlayTransforms are synonymous.π
81  bool overlayAll; // Completely replace prims, including topology.
82  // For point instancers, if overlayAll is set and
83  // prototypes are specified, replace the prototypes.
84 
88 
89  // Filter specifying what primvars to write for each prim.
91 
92  // Name of attribute that specifies usd prim path to write prims to.
93  // a prim.
95 
96  // Path to a sop or obj node that contains all the prototypes so we can
97  // write a complete and static relationship array. Will be overridden by
98  // attributes if they exist.
100 
101  // Identifier (and possibly path to a primitive) to both create an entry
102  // in a point instancer's relationship array and mark which prototype to use
103  // for a point. Will be overridden by attributes if they exist.
105 
106  // Offset value to set in a Layer Offset of a USD reference. For retiming
107  // references.
109 
110  // Scale value to set in a Layer Offset of a USD reference. For retiming
111  // references.
112  double usdTimeScale;
113 
114  // When we write a USD packed prim to a USD file, we write a USD reference.
115  // If the prim path attribute in the USD packed prim contains a variant
116  // selection, write that with the reference.
118 
119  // Purpose (render, proxy or guide) to tag prims with.
121 
122  // Whether to make references to a USD prims instanceable.
124 
125 };
126 
128 
129 #endif // __GUSD_CONTEXT_H__
bool authorVariantSelections
Definition: context.h:117
bool writeStaticPrimvars
Definition: context.h:87
bool writeStaticGeo
Definition: context.h:85
std::string primPathAttribute
Definition: context.h:94
std::string usdInstancePath
Definition: context.h:104
bool overlayTransforms
Definition: context.h:79
const GusdGT_AttrFilter & attributeFilter
Definition: context.h:90
bool overlayPrimvars
Definition: context.h:80
bool writeStaticTopology
Definition: context.h:86
std::function< UsdStageRefPtr()> GetStageFunc
Definition: context.h:48
bool writeOverlay
Definition: context.h:75
Definition: token.h:87
bool overlayAll
Definition: context.h:81
bool overlayPoints
Definition: context.h:78
UsdTimeCode time
Definition: context.h:70
TfToken purpose
Definition: context.h:120
double usdTimeScale
Definition: context.h:112
GusdContext(UsdTimeCode t, Granularity g, const GusdGT_AttrFilter &af)
Definition: context.h:51
Granularity granularity
Definition: context.h:73
GLsizei const GLchar *const * string
Definition: glew.h:1844
USDGEOM_API TfStaticData< UsdGeomTokensType > UsdGeomTokens
bool makeRefsInstanceable
Definition: context.h:123
double usdTimeOffset
Definition: context.h:108
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
std::string usdPrototypesPath
Definition: context.h:99
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
GLdouble GLdouble t
Definition: glew.h:1398
GLboolean GLboolean g
Definition: glew.h:9477