All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
instanceAdapter.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
8#define PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usdImaging/usdImaging/api.h"
15
16#include "pxr/base/tf/hashmap.h"
17
18#include <mutex>
19
20PXR_NAMESPACE_OPEN_SCOPE
21
22
76{
77public:
79
80 USDIMAGING_API
82 UsdPrim const& prim,
84 UsdImagingInstancerContext const* instancerContext = nullptr) override;
85
86 USDIMAGING_API
87 bool ShouldCullChildren() const override;
88
89 USDIMAGING_API
90 bool IsInstancerAdapter() const override;
91
92 // ---------------------------------------------------------------------- //
94 // ---------------------------------------------------------------------- //
95
96 USDIMAGING_API
97 void TrackVariability(UsdPrim const& prim,
98 SdfPath const& cachePath,
99 HdDirtyBits* timeVaryingBits,
101 instancerContext = NULL) const override;
102
103 USDIMAGING_API
104 void UpdateForTime(UsdPrim const& prim,
105 SdfPath const& cachePath,
106 UsdTimeCode time,
107 HdDirtyBits requestedBits,
109 instancerContext = NULL) const override;
110
111 // ---------------------------------------------------------------------- //
113 // ---------------------------------------------------------------------- //
114
115 USDIMAGING_API
116 HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
117 SdfPath const& cachePath,
118 TfToken const& propertyName)
119 override;
120
121 USDIMAGING_API
122 void ProcessPrimResync(SdfPath const& cachePath,
123 UsdImagingIndexProxy* index) override;
124
125 USDIMAGING_API
126 void ProcessPrimRemoval(SdfPath const& cachePath,
127 UsdImagingIndexProxy* index) override;
128
129
130 USDIMAGING_API
131 void MarkDirty(UsdPrim const& prim,
132 SdfPath const& cachePath,
133 HdDirtyBits dirty,
134 UsdImagingIndexProxy* index) override;
135
136 // As this adapter hijacks the adapter for the child prim
137 // We need to forward these messages on, in case the child
138 // adapter needs them
139 USDIMAGING_API
140 void MarkRefineLevelDirty(UsdPrim const& prim,
141 SdfPath const& cachePath,
142 UsdImagingIndexProxy* index) override;
143
144 USDIMAGING_API
145 void MarkReprDirty(UsdPrim const& prim,
146 SdfPath const& cachePath,
147 UsdImagingIndexProxy* index) override;
148
149 USDIMAGING_API
150 void MarkCullStyleDirty(UsdPrim const& prim,
151 SdfPath const& cachePath,
152 UsdImagingIndexProxy* index) override;
153
154 USDIMAGING_API
155 void MarkRenderTagDirty(UsdPrim const& prim,
156 SdfPath const& cachePath,
157 UsdImagingIndexProxy* index) override;
158
159 USDIMAGING_API
160 void MarkTransformDirty(UsdPrim const& prim,
161 SdfPath const& cachePath,
162 UsdImagingIndexProxy* index) override;
163
164 USDIMAGING_API
165 void MarkVisibilityDirty(UsdPrim const& prim,
166 SdfPath const& cachePath,
167 UsdImagingIndexProxy* index) override;
168
169 // ---------------------------------------------------------------------- //
171 // ---------------------------------------------------------------------- //
172
173 USDIMAGING_API
174 std::vector<VtArray<TfToken>> GetInstanceCategories(
175 UsdPrim const& prim) override;
176
177 USDIMAGING_API
179 SdfPath const& instancerPath,
180 UsdTimeCode time) const override;
181
182 USDIMAGING_API
184 UsdPrim const& usdPrim,
185 SdfPath const& cachePath) const override;
186
187 USDIMAGING_API
189 UsdPrim const& usdPrim,
190 SdfPath const& cachePath) const override;
191
192 USDIMAGING_API
193 size_t SampleInstancerTransform(UsdPrim const& instancerPrim,
194 SdfPath const& instancerPath,
195 UsdTimeCode time,
196 size_t maxSampleCount,
197 float *sampleTimes,
198 GfMatrix4d *sampleValues) override;
199
200 USDIMAGING_API
201 size_t SampleTransform(UsdPrim const& prim,
202 SdfPath const& cachePath,
203 UsdTimeCode time,
204 size_t maxNumSamples,
205 float *sampleTimes,
206 GfMatrix4d *sampleValues) override;
207
208 USDIMAGING_API
209 size_t SamplePrimvar(UsdPrim const& usdPrim,
210 SdfPath const& cachePath,
211 TfToken const& key,
212 UsdTimeCode time,
213 size_t maxNumSamples,
214 float *sampleTimes,
215 VtValue *sampleValues,
216 VtIntArray *sampleIndices) override;
217
218 USDIMAGING_API
220 UsdPrim const& usdPrim,
221 SdfPath const& cachePath,
222 TfToken const& instanceInheritablePurpose) const override;
223
224 USDIMAGING_API
226 SdfPath const& cachePath,
227 UsdTimeCode time) const override;
228
229 USDIMAGING_API
231 SdfPath const& cachePath,
232 UsdTimeCode time) const override;
233
234 USDIMAGING_API
235 HdCullStyle GetCullStyle(UsdPrim const& prim,
236 SdfPath const& cachePath,
237 UsdTimeCode time) const override;
238
239 USDIMAGING_API
240 GfRange3d GetExtent(UsdPrim const& usdPrim,
241 SdfPath const& cachePath,
242 UsdTimeCode time) const override;
243
244 USDIMAGING_API
245 bool IsChildPath(const SdfPath& path) const override;
246
247 bool GetVisible(UsdPrim const& usdPrim,
248 SdfPath const& cachePath,
249 UsdTimeCode time) const override;
250
251 USDIMAGING_API
252 bool GetDoubleSided(UsdPrim const& prim,
253 SdfPath const& cachePath,
254 UsdTimeCode time) const override;
255
256 USDIMAGING_API
258 SdfPath const& cachePath,
259 UsdTimeCode time,
260 bool ignoreRootTransform = false) const override;
261
262 USDIMAGING_API
263 SdfPath GetMaterialId(UsdPrim const& prim,
264 SdfPath const& cachePath,
265 UsdTimeCode time) const override;
266
267 USDIMAGING_API
268 VtValue GetLightParamValue(
269 const UsdPrim& prim,
270 const SdfPath& cachePath,
271 const TfToken& paramName,
272 UsdTimeCode time) const override;
273
274 USDIMAGING_API
275 VtValue GetMaterialResource(
276 const UsdPrim& prim,
277 const SdfPath& cachePath,
278 UsdTimeCode time) const override;
279
280 USDIMAGING_API
281 HdExtComputationInputDescriptorVector
282 GetExtComputationInputs(UsdPrim const& prim,
283 SdfPath const& cachePath,
284 const UsdImagingInstancerContext* instancerContext)
285 const override;
286
287
288 USDIMAGING_API
289 HdExtComputationOutputDescriptorVector
290 GetExtComputationOutputs(UsdPrim const& prim,
291 SdfPath const& cachePath,
292 const UsdImagingInstancerContext* instancerContext)
293 const override;
294
295 USDIMAGING_API
296 HdExtComputationPrimvarDescriptorVector
297 GetExtComputationPrimvars(
298 UsdPrim const& prim,
299 SdfPath const& cachePath,
300 HdInterpolation interpolation,
301 const UsdImagingInstancerContext* instancerContext) const override;
302
303 USDIMAGING_API
304 VtValue
305 GetExtComputationInput(
306 UsdPrim const& prim,
307 SdfPath const& cachePath,
308 TfToken const& name,
309 UsdTimeCode time,
310 const UsdImagingInstancerContext* instancerContext) const override;
311
312 USDIMAGING_API
313 std::string
314 GetExtComputationKernel(
315 UsdPrim const& prim,
316 SdfPath const& cachePath,
317 const UsdImagingInstancerContext* instancerContext) const override;
318
319 USDIMAGING_API
320 VtValue
321 GetInstanceIndices(UsdPrim const& instancerPrim,
322 SdfPath const& instancerCachePath,
323 SdfPath const& prototypeCachePath,
324 UsdTimeCode time) const override;
325
326 USDIMAGING_API
327 VtValue Get(UsdPrim const& prim,
328 SdfPath const& cachePath,
329 TfToken const& key,
330 UsdTimeCode time,
331 VtIntArray *outIndices) const override;
332
333 // ---------------------------------------------------------------------- //
335 // ---------------------------------------------------------------------- //
336
337 USDIMAGING_API
339 SdfPath const &parentInstancerPath,
340 SdfPath const &instancerPath,
341 UsdTimeCode time) const override;
342
343 // ---------------------------------------------------------------------- //
345 // ---------------------------------------------------------------------- //
346
347 USDIMAGING_API
349 SdfPath const& cachePath,
350 int instanceIndex,
351 HdInstancerContext *instancerContext) const override;
352
353 USDIMAGING_API
354 SdfPathVector GetScenePrimPaths(
355 SdfPath const& cachePath,
356 std::vector<int> const& instanceIndices,
357 std::vector<HdInstancerContext> *instancerCtxs) const override;
358
359 USDIMAGING_API
360 bool PopulateSelection(
361 HdSelection::HighlightMode const& highlightMode,
362 SdfPath const &cachePath,
363 UsdPrim const &usdPrim,
364 int const hydraInstanceIndex,
365 VtIntArray const &parentInstanceIndices,
366 HdSelectionSharedPtr const &result) const override;
367
368 // ---------------------------------------------------------------------- //
370 // ---------------------------------------------------------------------- //
371
372 USDIMAGING_API
373 HdVolumeFieldDescriptorVector
374 GetVolumeFieldDescriptors(UsdPrim const& usdPrim, SdfPath const &id,
375 UsdTimeCode time) const override;
376
377protected:
378 USDIMAGING_API
379 void _RemovePrim(SdfPath const& cachePath,
380 UsdImagingIndexProxy* index) override final;
381
382private:
383
384 SdfPath _Populate(UsdPrim const& prim,
386 UsdImagingInstancerContext const* instancerContext,
387 SdfPath const& parentProxyPath);
388
389 struct _ProtoPrim;
390 struct _ProtoGroup;
391 struct _InstancerData;
392
393 bool _IsChildPrim(UsdPrim const& prim,
394 SdfPath const& cachePath) const;
395
396 // Returns true if the given prim serves as an instancer.
397 bool _PrimIsInstancer(UsdPrim const& prim) const;
398
399 // Inserts prototype prims for the usdPrim given by \p iter into the
400 // \p index. Any inserted gprims will be inserted under a special path
401 // combining \p ctx.instancerCachePath and \p ctx.childName.
402 SdfPath
403 _InsertProtoPrim(UsdPrimRange::iterator *iter,
404 const UsdImagingPrimAdapterSharedPtr& primAdapter,
406 UsdImagingIndexProxy* index);
407
408 // For a usd path, collects the instancers to resync.
409 void _ResyncPath(SdfPath const& cachePath,
411 bool reload);
412 // Removes and optionally reloads all instancer data, both locally and
413 // from the render index.
414 void _ResyncInstancer(SdfPath const& instancerPath,
415 UsdImagingIndexProxy* index, bool reload);
416
417 // Computes per-frame data in the instancer map. This is primarily used
418 // during update to send new instance indices out to Hydra.
419 struct _ComputeInstanceMapFn;
420 VtIntArray _ComputeInstanceMap(UsdPrim const& instancerPrim,
421 _InstancerData const& instrData,
422 UsdTimeCode time) const;
423
424 // Precomputes the instancer visibility data (as visible, invis, varying
425 // per-node), and returns whether the instance map is variable.
426 // Note: this function assumes the instancer data is already locked by
427 // the caller...
428 struct _ComputeInstanceMapVariabilityFn;
429 bool _ComputeInstanceMapVariability(UsdPrim const& instancerPrim,
430 _InstancerData const& instrData) const;
431
432 // Gets the associated _ProtoPrim and instancer context for the given
433 // instancer and cache path.
434 _ProtoPrim const& _GetProtoPrim(SdfPath const& instancerPath,
435 SdfPath const& cachePath,
436 UsdImagingInstancerContext* ctx) const;
437
438 // Gets the associated _ProtoPrim and instancerContext if cachePath is a
439 // child path and returns \c true, otherwise returns \c false.
440 bool _GetProtoPrimForChild(
441 UsdPrim const& usdPrim,
442 SdfPath const& cachePath,
443 _ProtoPrim const** proto,
444 UsdImagingInstancerContext* ctx) const;
445
446 // Computes the transforms for all instances corresponding to the given
447 // instancer.
448 struct _ComputeInstanceTransformFn;
449 bool _ComputeInstanceTransforms(UsdPrim const& instancer,
450 VtMatrix4dArray* transforms,
451 UsdTimeCode time) const;
452
453 // Gathers the authored transforms time samples given an instancer.
454 struct _GatherInstanceTransformTimeSamplesFn;
455 bool _GatherInstanceTransformsTimeSamples(UsdPrim const& instancer,
456 GfInterval interval,
457 std::vector<double>* outTimes)
458 const;
459
460 // Gathers the specified primvar time samples given an instancer.
461 struct _GatherInstancePrimvarTimeSamplesFn;
462 bool _GatherInstancePrimvarTimeSamples(UsdPrim const& instancer,
463 TfToken const& key,
464 GfInterval interval,
465 std::vector<double>* outTimes)
466 const;
467
468 // Returns true if any of the instances corresponding to the given
469 // instancer has a varying transform.
470 struct _IsInstanceTransformVaryingFn;
471 bool _IsInstanceTransformVarying(UsdPrim const& instancer) const;
472
473 // Computes the value of a primvar for all instances corresponding to the
474 // given instancer. The templated version runs the templated functor,
475 // and the un-templated version does type dispatch.
476 template<typename T> struct _ComputeInheritedPrimvarFn;
477
478 template<typename T>
479 bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
480 TfToken const& primvarName,
481 VtValue *result,
482 UsdTimeCode time) const;
483
484 bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
485 TfToken const& primvarName,
486 SdfValueTypeName const& type,
487 VtValue *result,
488 UsdTimeCode time) const;
489
490 // Returns true if any of the instances corresponding to the given
491 // instancer has varying inherited primvars.
492 struct _IsInstanceInheritedPrimvarVaryingFn;
493 bool _IsInstanceInheritedPrimvarVarying(UsdPrim const& instancer) const;
494
495 struct _PopulateInstanceSelectionFn;
496 struct _GetScenePrimPathsFn;
497 struct _GetInstanceCategoriesFn;
498
499 // Helper functions for dealing with "actual" instances to be drawn.
500 //
501 // Suppose we have:
502 // /Root
503 // Instance_A (prototype: /__Prototype_1)
504 // Instance_B (prototype: /__Prototype_1)
505 // /__Prototype_1
506 // AnotherInstance_A (prototype: /__Prototype_2)
507 // /__Prototype_2
508 //
509 // /__Prototype_2 has only one associated instance in the Usd scenegraph:
510 // /__Prototype_1/AnotherInstance_A. However, imaging actually needs to draw
511 // two instances of /__Prototype_2, because AnotherInstance_A is a nested
512 // instance beneath /__Prototype_1, and there are two instances of
513 // /__Prototype_1.
514 //
515 // Each instance to be drawn is addressed by the chain of instances
516 // that caused it to be drawn. In the above example, the two instances
517 // of /__Prototype_2 to be drawn are:
518 //
519 // [ /Root/Instance_A, /__Prototype_1/AnotherInstance_A ],
520 // [ /Root/Instance_B, /__Prototype_1/AnotherInstance_A ]
521 //
522 // This "instance context" describes the chain of opinions that
523 // ultimately affect the final drawn instance. For example, the
524 // transform of each instance to draw is the combined transforms
525 // of the prims in each context.
526 template <typename Functor>
527 void _RunForAllInstancesToDraw(UsdPrim const& instancer, Functor* fn) const;
528 template <typename Functor>
529 bool _RunForAllInstancesToDrawImpl(UsdPrim const& instancer,
530 std::vector<UsdPrim>* instanceContext,
531 size_t* instanceIdx,
532 Functor* fn) const;
533
534 typedef TfHashMap<SdfPath, size_t, SdfPath::Hash> _InstancerDrawCounts;
535 size_t _CountAllInstancesToDraw(UsdPrim const& instancer) const;
536 size_t _CountAllInstancesToDrawImpl(UsdPrim const& instancer,
537 _InstancerDrawCounts* drawCounts) const;
538
539 // A proto prim represents a single adapter under a prototype root declared
540 // on the instancer.
541 struct _ProtoPrim {
542 _ProtoPrim() {}
543 // Each prim will become a prototype "child" under the instancer. This
544 // path is the path to the prim on the Usd Stage (the path to a single
545 // mesh, for example).
546 SdfPath path;
547 // The prim adapter for the actual prototype prim.
548 UsdImagingPrimAdapterSharedPtr adapter;
549 };
550
551 // Indexed by prototype cachePath (each prim has one entry)
552 typedef TfHashMap<SdfPath, _ProtoPrim, SdfPath::Hash> _PrimMap;
553
554 // All data associated with a given instancer prim. PrimMap could
555 // technically be split out to avoid two lookups, however it seems cleaner
556 // to keep everything bundled up under the instancer path.
557 struct _InstancerData {
558 _InstancerData() : numInstancesToDraw(0), refresh(false) { }
559
560 // The prototype prim path associated with this instancer.
561 SdfPath prototypePath;
562
563 // The USD material path associated with this instancer.
564 SdfPath materialUsdPath;
565
566 // The drawmode associated with this instancer.
567 TfToken drawMode;
568
569 // The purpose value associated with this instance that can be inherited
570 // by proto prims that need to inherit ancestor purpose.
571 TfToken inheritablePurpose;
572
573 // Inherited primvar
574 struct PrimvarInfo {
575 TfToken name;
576 SdfValueTypeName type;
577 bool operator==(const PrimvarInfo& rhs) const;
578 bool operator<(const PrimvarInfo& rhs) const;
579 };
580 std::vector<PrimvarInfo> inheritedPrimvars;
581
582 // Paths to Usd instance prims. Note that this is not necessarily
583 // equivalent to all the instances that will be drawn. See below.
584 SdfPathSet instancePaths;
585
586 // Number of actual instances of this instancer that will be
587 // drawn. See comment on _RunForAllInstancesToDraw.
588 // XXX: This is mutable so that we can precache it in TrackVariability;
589 // it's inappropriate to track it in _Populate since not all instances
590 // will have been populated.
591 mutable size_t numInstancesToDraw;
592
593 // Cached visibility. This vector contains an entry for each instance
594 // that will be drawn (i.e., visibility.size() == numInstancesToDraw).
595 enum Visibility {
596 Invisible, //< Invisible over all time
597 Visible, //< Visible over all time
598 Varying, //< Visibility varies over time
599 Unknown //< Visibility has not yet been checked
600 };
601 // XXX: This is mutable so that we can precache visibility per-instance
602 // in TrackVariability(). Can we replace this with some kind of usage
603 // of an inherited cache?
604 mutable std::vector<Visibility> visibility;
605
606 // Map of all rprims for this instancer prim.
607 _PrimMap primMap;
608
609 // This is a set of reference paths, where this instancer needs
610 // to deferer to another instancer. While refered to here as a child
611 // instancer, the actual relationship is more like a directed graph.
612 SdfPathSet childPointInstancers;
613
614 // Nested (child) native instances.
615 SdfPathVector nestedInstances;
616
617 // Parent native instances.
618 SdfPathVector parentInstances;
619
620 // Flag indicating we've asked the delegate to refresh this instancer
621 // (via TrackVariability/UpdateForTime). We record this so we don't
622 // do it multiple times.
623 mutable bool refresh;
624 };
625
626 // Map from hydra instancer cache path to the various instancer state we
627 // need to answer adapter queries.
628 // Note: this map is modified in multithreaded code paths and must be
629 // locked.
630 typedef std::unordered_map<SdfPath, _InstancerData, SdfPath::Hash>
631 _InstancerDataMap;
632 _InstancerDataMap _instancerData;
633
634 // Map from USD instance prim paths to the cache path of the hydra instancer
635 // they are assigned to (which will typically be the path to the first
636 // instance of this instance group we run across).
637 // XXX: consider to move this forwarding map into HdRenderIndex.
638 typedef TfHashMap<SdfPath, SdfPath, SdfPath::Hash>
639 _InstanceToInstancerMap;
640 _InstanceToInstancerMap _instanceToInstancerMap;
641
642 // Hd and UsdImaging think of instancing in terms of an 'instancer' that
643 // specifies a list of 'prototype' prims that are shared per instance.
644 //
645 // For Usd scenegraph instancing, a prototype prim and its descendents
646 // roughly correspond to the instancer and prototype prims. However,
647 // Hd requires a different instancer and rprims for different combinations
648 // of inherited attributes (material binding, draw mode, etc).
649 // This means we cannot use the Usd prototype prim as the instancer, because
650 // we can't represent this in the case where multiple Usd instances share
651 // the same prototype but have different bindings.
652 //
653 // Instead, we use the first instance of a prototype with a given set of
654 // inherited attributes as our instancer. For example, if /A and /B are
655 // both instances of /__Prototype_1 but /A and /B have different material
656 // bindings authored on them, both /A and /B will be instancers,
657 // with their own set of rprims and instance indices.
658 //
659 // The below is a multimap from prototype path to the cache path of the
660 // hydra instancer. The data for the instancer is located in the
661 // _InstancerDataMap.
662 typedef TfHashMultiMap<SdfPath, SdfPath, SdfPath::Hash>
663 _PrototypeToInstancerMap;
664 _PrototypeToInstancerMap _prototypeToInstancerMap;
665
666 // Map from instance cache path to their instancer path.
667 // Note: this is for reducing proto prim lookup in _GetProtoPrim method.
668 typedef std::unordered_map<SdfPath, SdfPath, SdfPath::Hash>
669 _ProtoPrimToInstancerMap;
670 _ProtoPrimToInstancerMap _protoPrimToInstancerMap;
671};
672
673PXR_NAMESPACE_CLOSE_SCOPE
674
675#endif // PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
A basic mathematical interval class.
Definition: interval.h:33
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:71
Basic type: 3-dimensional floating point range.
Definition: range3d.h:47
HighlightMode
Selection modes allow differentiation in selection highlight behavior.
Definition: selection.h:39
Tags for non-hierarchial subdiv surfaces.
Definition: subdivTags.h:26
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Represents a value type name, i.e.
Definition: valueTypeName.h:71
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
This proxy class exposes a subset of the private Delegate API to PrimAdapters.
Definition: indexProxy.h:30
Delegate support for instanced prims.
USDIMAGING_API size_t SamplePrimvar(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, size_t maxNumSamples, float *sampleTimes, VtValue *sampleValues, VtIntArray *sampleIndices) override
Sample the primvar for the given prim.
USDIMAGING_API SdfPathVector GetInstancerPrototypes(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the list of known prototypes of this prim.
bool GetVisible(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Returns true if the given prim is visible, taking into account inherited visibility values.
USDIMAGING_API size_t SampleInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues) override
Sample the instancer transform for the given prim.
USDIMAGING_API std::vector< VtArray< TfToken > > GetInstanceCategories(UsdPrim const &prim) override
Return an array of the categories used by each instance.
USDIMAGING_API bool GetDoubleSided(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads double-sided from the given prim. If not authored, returns false.
USDIMAGING_API SdfPath GetScenePrimPath(SdfPath const &cachePath, int instanceIndex, HdInstancerContext *instancerContext) const override
USDIMAGING_API GfMatrix4d GetRelativeInstancerTransform(SdfPath const &parentInstancerPath, SdfPath const &instancerPath, UsdTimeCode time) const override
Returns the transform of protoInstancerPath relative to instancerPath.
USDIMAGING_API VtValue GetTopology(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the topology object of a specific Usd prim.
USDIMAGING_API void ProcessPrimResync(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
When a PrimResync event occurs, the prim may have been deleted entirely, adapter plug-ins should over...
USDIMAGING_API SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, UsdImagingInstancerContext const *instancerContext=nullptr) override
Called to populate the RenderIndex for this UsdPrim.
USDIMAGING_API HdCullStyle GetCullStyle(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the cullstyle of a specific path in the scene graph.
USDIMAGING_API void UpdateForTime(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, HdDirtyBits requestedBits, UsdImagingInstancerContext const *instancerContext=NULL) const override
Populates the cache for the given prim, time and requestedBits.
USDIMAGING_API GfRange3d GetExtent(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads the extent from the given prim.
USDIMAGING_API PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Get the subdiv tags for this prim.
USDIMAGING_API HdDirtyBits ProcessPropertyChange(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &propertyName) override
Returns a bit mask of attributes to be updated, or HdChangeTracker::AllDirty if the entire prim must ...
USDIMAGING_API void TrackVariability(UsdPrim const &prim, SdfPath const &cachePath, HdDirtyBits *timeVaryingBits, UsdImagingInstancerContext const *instancerContext=NULL) const override
For the given prim, variability is detected and stored in timeVaryingBits.
USDIMAGING_API GfMatrix4d GetInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time) const override
Get the instancer transform for the given prim.
USDIMAGING_API size_t SampleTransform(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, size_t maxNumSamples, float *sampleTimes, GfMatrix4d *sampleValues) override
Samples the transform for the given prim.
USDIMAGING_API VtValue Get(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, VtIntArray *outIndices) const override
Gets the value of the parameter named key for the given prim (which has the given cache path) and giv...
USDIMAGING_API void ProcessPrimRemoval(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
Removes all associated Rprims and dependencies from the render index without scheduling them for repo...
USDIMAGING_API TfToken GetPurpose(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &instanceInheritablePurpose) const override
Returns the purpose token for prim.
USDIMAGING_API SdfPath GetInstancerId(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the instancerId for this prim.
USDIMAGING_API GfMatrix4d GetTransform(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, bool ignoreRootTransform=false) const override
Fetches the transform for the given prim at the given time from a pre-computed cache of prim transfor...
Base class for all PrimAdapters.
Definition: primAdapter.h:54
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
A forward iterator into a UsdPrimRange.
Definition: primRange.h:123
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:67
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
Object used by instancer prim adapters to pass along context about the instancer and instance prim to...