24 #ifndef __GUSD_INSTANCERWRAPPER_H__
25 #define __GUSD_INSTANCERWRAPPER_H__
48 bool isOverride =
false );
57 const UsdStagePtr& stage,
89 const char * viewportLod,
97 const UsdStagePtr& stage,
107 bool initUsdPrim(
const UsdStagePtr& stage,
112 const UsdStagePtr& stage,
115 void storePreOverlayData(
bool justProtoIndices,
const UsdTimeCode*
time);
117 void clearPreOverlayData();
119 void setTransformAttrsFromMatrices(
const UT_Matrix4D &worldToLocal,
128 bool convert_to_radians =
false)
const;
136 RelationshipIndexMap m_relationshipIndexMap;
140 std::vector<UT_Matrix4D> m_prototypeTransforms;
146 std::vector<TfToken> m_usdGeomTokens = {
UsdGeomTokens->protoIndices,
157 struct PreOverlayDataEntry {
158 std::map<UsdTimeCode, VtArray<T>> preOverlayDataMap;
161 PreOverlayDataEntry(
UsdAttribute usdAttr) : usdAttr(usdAttr) {}
163 PreOverlayDataEntry() {}
164 ~PreOverlayDataEntry() {}
165 PreOverlayDataEntry(PreOverlayDataEntry &&other) {
166 preOverlayDataMap = std::move(other.preOverlayDataMap);
167 usdAttr = other.usdAttr;
169 PreOverlayDataEntry&
operator=(PreOverlayDataEntry &&other) {
170 preOverlayDataMap = std::move(other.preOverlayDataMap);
171 usdAttr = other.usdAttr;
174 PreOverlayDataEntry(PreOverlayDataEntry
const& other){
175 preOverlayDataMap = other.preOverlayDataMap;
176 usdAttr = other.usdAttr;
182 if (usdAttr.Get(&dataArray, time)){
183 preOverlayDataMap[
time] = dataArray;
190 if (preOverlayDataMap.count(time) > 0) {
191 dataArray = preOverlayDataMap[
time];
192 if (dataArray.size() > ptNum) {
193 value = dataArray[ptNum];
197 usdAttr.Get(&dataArray, time);
198 if (dataArray.size() > ptNum) {
199 value = dataArray[ptNum];
209 typedef std::variant<PreOverlayDataEntry<int>,
210 PreOverlayDataEntry<GfVec3f>,
211 PreOverlayDataEntry<GfQuath>> dataEntry;
214 std::map<TfToken, dataEntry> m_preOverlayDataMap;
223 template <
typename T>
224 void operator()(
T& t)
const {
232 template <
typename T>
233 void operator()(
T t)
const {
234 t.preOverlayDataMap.
clear();
241 #endif // __GUSD_INSTANCERWRAPPER_H__
A GT_Primitive that wraps a USD Prim.
bool unpack(UT_Array< GU_DetailHandle > &details, const UT_StringRef &fileName, const SdfPath &primPath, const UT_Matrix4D *xform, fpreal frame, const char *viewportLod, GusdPurposeSet purposes, const GT_RefineParms &rparms) const override
bool refine(GT_Refine &refiner, const GT_RefineParms *parms=NULL) const override
GT_API const UT_StringHolder time
~GusdInstancerWrapper() override
SYS_FORCE_INLINE void clear()
static GT_PrimitiveHandle defineForRead(const UsdGeomImageable &sourcePrim, UsdTimeCode time, GusdPurposeSet purposes)
GLsizei const GLchar *const * path
bool updateFromGTPrim(const GT_PrimitiveHandle &sourcePrim, const UT_Matrix4D &houXform, const GusdContext &ctxt, GusdSimpleXformCache &xformCache) override
bool isValid() const override
Return true if the underlying USD prim is valid.
UT_IntrusiveRefCounter & operator=(const UT_IntrusiveRefCounter &) noexcept
Assignment operator: Does not modify counter.
GT_PrimitiveHandle doSoftCopy() const override
const char * className() const override
bool redefine(const UsdStagePtr &stage, const SdfPath &path, const GusdContext &ctxt, const GT_PrimitiveHandle &sourcePrim) override
Create a new USD prim to match GT primitive.
GusdInstancerWrapper(const UsdStagePtr &stage, const SdfPath &path, const GusdContext &ctxt, bool isOverride=false)
int64 getMemoryUsage() const override
Processes primitives generated by refinement process.
USDGEOM_API TfStaticData< UsdGeomTokensType > UsdGeomTokens
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
const UsdGeomImageable getUsdPrim() const override
void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const override
#define PXR_NAMESPACE_CLOSE_SCOPE
static GT_PrimitiveHandle defineForWrite(const GT_PrimitiveHandle &sourcePrim, const UsdStagePtr &stage, const SdfPath &path, const GusdContext &ctxt)
std::map< SdfPath, UT_Matrix4D > GusdSimpleXformCache
int getMotionSegments() const override