24 #ifndef PXR_USD_IMAGING_USD_IMAGING_DELEGATE_H
25 #define PXR_USD_IMAGING_USD_IMAGING_DELEGATE_H
63 #include <hboost/container/flat_map.hpp>
64 #include <tbb/spin_rw_mutex.h>
106 void SyncAll(
bool includeUnvarying);
126 static void SetTimes(
const std::vector<UsdImagingDelegate*>& delegates,
127 const std::vector<UsdTimeCode>& times);
284 return _displayUnloadedPrimsWithBounds;
338 VtIntArray *outIndices)
override;
347 virtual std::vector<VtArray<TfToken>>
355 SdfPath const &prototypeId)
override;
374 size_t maxSampleCount,
float *times,
379 size_t maxNumSamples,
float *times,
385 size_t maxNumSamples,
float *times,
398 TfToken const ¶mName)
override;
402 TfToken const ¶mName)
override;
428 std::vector<int> instanceIndices,
429 std::vector<HdInstancerContext> *instancerContexts =
nullptr)
override;
453 TfToken const& input)
override;
458 size_t maxSampleCount,
460 VtValue *sampleValues)
override;
474 if (it != _cache2indexPath.
end()) {
498 if (it != _index2cachePath.
end()) {
549 bool _ValidateRefineLevel(
int level) {
550 if (!(0 <= level && level <= 8)) {
552 "expected range is [0,8]",
559 void _AddTask(UsdImagingDelegate::_Worker *worker,
SdfPath const& usdPath);
565 bool _IsDrawModeApplied(
UsdPrim const& prim);
579 _FlattenedDependenciesCacheMap;
591 bool _RefreshUsdObject(
SdfPath const& usdPath,
593 _FlattenedDependenciesCacheMap
const &cache,
604 void _ResyncUsdPrim(
SdfPath const& usdRootPath,
605 _FlattenedDependenciesCacheMap
const &cache,
607 bool repopulateFromRoot =
false);
615 TF_VERIFY(p,
"No prim found for id: %s",
620 void _UpdateSingleValue(
SdfPath const& cachePath,
int dirtyFlags);
627 bool _CanPopulate(
UsdPrim const& rootPrim)
const;
631 void _SetStateForPopulation(
UsdPrim const& rootPrim,
641 static void _ExecuteWorkForVariabilityUpdate(_Worker* worker);
646 bool _GetVisible(
UsdPrim const& prim);
657 static void _ExecuteWorkForTimeUpdate(_Worker* worker);
666 _AdapterMap _adapterMap;
683 _HdPrimInfoMap _hdPrimInfoMap;
685 typedef std::multimap<SdfPath, SdfPath> _DependencyMap;
688 _DependencyMap _dependencyInfo;
692 void _GatherDependencies(
SdfPath const& subtree,
699 _GatherDependencies(
SdfPath const &subtree,
700 _FlattenedDependenciesCacheMap
const &cache,
707 SdfPathMap _cache2indexPath;
708 SdfPathMap _index2cachePath;
714 bool ignoreInstancing =
false);
719 _HdPrimInfo *_GetHdPrimInfo(
const SdfPath &cachePath);
726 void _MarkRenderTagsDirty();
731 _DirtySet _dirtyCachePaths;
736 _RefineLevelMap _refineLevelMap;
742 UsdStageRefPtr _stage;
760 SdfPath _cameraPathForSampling;
762 int _refineLevelFallback;
768 bool _timeVaryingPrimCacheValid;
777 typedef std::unordered_map<SdfPath, TfTokenVector, SdfPath::Hash>
779 _PathsToUpdateMap _usdPathsToUpdate;
801 bool _enableUsdDrawModes;
803 const bool _hasDrawModeAdapter;
806 bool _sceneMaterialsEnabled;
809 bool _sceneLightsEnabled;
814 const bool _coordSysEnabled;
817 bool _displayUnloadedPrimsWithBounds;
826 #endif //PXR_USD_IMAGING_USD_IMAGING_DELEGATE_H
std::shared_ptr< SdfPathVector > HdIdVectorSharedPtr
A shared pointer to a vector of id's.
SDF_API const char * GetText() const
TfHashMap< SdfPath, GfMatrix4d, SdfPath::Hash > RigidXformOverridesMap
USDIMAGING_API void Populate(UsdPrim const &rootPrim)
Populates the rootPrim in the HdRenderIndex.
PxOsdSubdivTags SubdivTags
_Base::const_iterator const_iterator
virtual USDIMAGING_API ~UsdImagingDelegate()
USDIMAGING_API void ClearRefineLevel(SdfPath const &usdPath)
std::shared_ptr< UsdImagingPrimAdapter > UsdImagingPrimAdapterSharedPtr
static SDF_API const SdfPath & AbsoluteRootPath()
USDIMAGING_API void SetDisplayGuides(const bool displayGuides)
Sets display of prims with purpose "guide".
GLsizei GLenum const void * indices
bool GetDisplayGuides() const
virtual USDIMAGING_API GfMatrix4d GetTransform(SdfPath const &id) override
Returns the object space transform, including all parent transforms.
USDIMAGING_API void InvokeExtComputation(SdfPath const &computationId, HdExtComputationContext *context) override
hboost::math::policies::policy< hboost::math::policies::domain_error< hboost::math::policies::ignore_error >, hboost::math::policies::pole_error< hboost::math::policies::ignore_error >, hboost::math::policies::overflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::underflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::denorm_error< hboost::math::policies::ignore_error >, hboost::math::policies::rounding_error< hboost::math::policies::ignore_error >, hboost::math::policies::evaluation_error< hboost::math::policies::ignore_error >, hboost::math::policies::indeterminate_result_error< hboost::math::policies::ignore_error > > policy
USDIMAGING_API void SetDisplayUnloadedPrimsWithBounds(bool displayUnloaded)
virtual USDIMAGING_API VtArray< TfToken > GetCategories(SdfPath const &id) override
Returns the prim categories.
virtual USDIMAGING_API std::vector< VtArray< TfToken > > GetInstanceCategories(SdfPath const &instancerId) override
Returns the categories for all instances in the instancer.
GT_API const UT_StringHolder time
USDIMAGING_API HdExtComputationInputDescriptorVector GetExtComputationInputDescriptors(SdfPath const &computationId) override
virtual USDIMAGING_API SdfPathVector GetScenePrimPaths(SdfPath const &rprimId, std::vector< int > instanceIndices, std::vector< HdInstancerContext > *instancerContexts=nullptr) override
USDIMAGING_API void SetTime(UsdTimeCode time)
static USDIMAGING_API void SetTimes(const std::vector< UsdImagingDelegate * > &delegates, const std::vector< UsdTimeCode > ×)
GLsizei const GLchar *const * string
USDIMAGING_API void SetInvisedPrimPaths(SdfPathVector const &invisedPaths)
Set the list of paths that must be invised.
USDIMAGING_API bool PopulateSelection(HdSelection::HighlightMode const &highlightMode, const SdfPath &usdPath, int instanceIndex, HdSelectionSharedPtr const &result)
virtual USDIMAGING_API size_t SampleIndexedPrimvar(SdfPath const &id, TfToken const &key, size_t maxNumSamples, float *times, VtValue *samples, VtIntArray *indices) override
GLsizei const GLchar *const * path
virtual USDIMAGING_API size_t SampleInstancerTransform(SdfPath const &instancerId, size_t maxSampleCount, float *times, GfMatrix4d *samples) override
std::vector< HdExtComputationInputDescriptor > HdExtComputationInputDescriptorVector
virtual USDIMAGING_API VtValue GetMaterialResource(SdfPath const &materialId) override
Returns the material ID bound to the rprim rprimId.
SDF_API SdfPath GetAbsoluteRootOrPrimPath() const
virtual USDIMAGING_API VtValue Get(SdfPath const &id, TfToken const &key) override
Returns a named value.
virtual USDIMAGING_API HdVolumeFieldDescriptorVector GetVolumeFieldDescriptors(SdfPath const &volumeId) override
USDIMAGING_API void SetSceneMaterialsEnabled(bool enable)
Enables custom shading on prims.
USDIMAGING_API PickabilityMap GetPickabilityMap() const
Returns the root paths of pickable objects.
virtual USDIMAGING_API size_t SampleTransform(SdfPath const &id, size_t maxNumSamples, float *times, GfMatrix4d *samples) override
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
USDIMAGING_API void SetCameraForSampling(SdfPath const &id)
Setup for the shutter open and close to be used for motion sampling.
Functor to use for hash maps from tokens to other things.
std::vector< HdExtComputationOutputDescriptor > HdExtComputationOutputDescriptorVector
USDIMAGING_API size_t SampleExtComputationInput(SdfPath const &computationId, TfToken const &input, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues) override
**But if you need a result
virtual USDIMAGING_API SdfPath GetMaterialId(SdfPath const &rprimId) override
Returns the material ID bound to the rprim rprimId.
HdReprSelector GetReprFallback() const
Returns the fallback repr name.
USDIMAGING_API HdExtComputationOutputDescriptorVector GetExtComputationOutputDescriptors(SdfPath const &computationId) override
virtual USDIMAGING_API GfRange3d GetExtent(SdfPath const &id) override
UsdStagePtr UsdStageWeakPtr
virtual USDIMAGING_API VtValue GetIndexedPrimvar(SdfPath const &id, TfToken const &key, VtIntArray *outIndices) override
USDIMAGING_API GfInterval GetCurrentTimeSamplingInterval()
USDIMAGING_API void SetRootInstancerId(SdfPath const &instancerId)
virtual USDIMAGING_API HdReprSelector GetReprSelector(SdfPath const &id) override
Returns the authored repr (if any) for the given prim.
virtual USDIMAGING_API SdfPathVector GetInstancerPrototypes(SdfPath const &instancerId) override
virtual USDIMAGING_API VtIntArray GetInstanceIndices(SdfPath const &instancerId, SdfPath const &prototypeId) override
std::vector< std::pair< SdfPath, int > > HdInstancerContext
Instancer context: a pair of instancer paths and instance indices.
USDIMAGING_API void SetDisplayRender(const bool displayRender)
Sets display of prims with purpose "render".
USDIMAGING_API void SetSceneLightsEnabled(bool enable)
Enables lights found in the usdscene.
USDIMAGING_API void SetRootVisibility(bool isVisible)
USDIMAGING_API void SetCullStyleFallback(HdCullStyle cullStyle)
Sets the fallback cull style.
UsdTimeCode GetTimeWithOffset(float offset) const
USDIMAGING_API void SetUsdDrawModesEnabled(bool enableUsdDrawModes)
Returns whether draw modes are enabled.
bool GetDisplayUnloadedPrimsWithBounds() const
virtual USDIMAGING_API VtValue GetLightParamValue(SdfPath const &id, TfToken const ¶mName) override
virtual USDIMAGING_API HdCullStyle GetCullStyle(SdfPath const &id) override
Returns the cullstyle for the given prim.
std::vector< UsdPrim > UsdPrimVector
USDIMAGING_API TfTokenVector GetExtComputationSceneInputNames(SdfPath const &computationId) override
virtual USDIMAGING_API size_t SamplePrimvar(SdfPath const &id, TfToken const &key, size_t maxNumSamples, float *times, VtValue *samples) override
HdCullStyle GetCullStyleFallback() const
Returns the fallback cull style.
hboost::container::flat_map< SdfPath, bool > PickabilityMap
USDIMAGING_API void SetRefineLevelFallback(int level)
UsdTimeCode GetTime() const
Returns the current time.
SdfPath GetRootInstancerId() const
Returns the root instancer id for the entire delegate.
virtual USDIMAGING_API HdMeshTopology GetMeshTopology(SdfPath const &id) override
Gets the topological mesh data for a given prim.
bool GetDisplayRender() const
USDIMAGING_API void SetRootTransform(GfMatrix4d const &xf)
virtual USDIMAGING_API bool GetVisible(SdfPath const &id) override
Returns the authored visible state of the prim.
virtual USDIMAGING_API bool GetDoubleSided(SdfPath const &id) override
Returns the doubleSided state for the given prim.
bool GetRootVisibility() const
Returns the root visibility for the entire delegate.
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_PTRS(UsdImagingDelegate)
std::vector< TfToken > TfTokenVector
Convenience types.
HighlightMode
Selection modes allow differentiation in selection highlight behavior.
virtual USDIMAGING_API GfMatrix4d GetInstancerTransform(SdfPath const &instancerId) override
Returns the instancer transform.
std::vector< HdVolumeFieldDescriptor > HdVolumeFieldDescriptorVector
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
USDIMAGING_API void SetRigidXformOverrides(RigidXformOverridesMap const &overrides)
Set transform value overrides on a set of paths.
USDIMAGING_API HdExtComputationPrimvarDescriptorVector GetExtComputationPrimvarDescriptors(SdfPath const &computationId, HdInterpolation interpolation) override
USDIMAGING_API void SetRefineLevel(SdfPath const &usdPath, int level)
USDIMAGING_API bool IsInInvisedPaths(const SdfPath &usdPath) const
Returns true if usdPath is included in invised path list.
std::set< class SdfPath > SdfPathSet
A set of SdfPaths.
USDIMAGING_API void SetPickability(SdfPath const &path, bool pickable)
Sets pickability for a specific path.
SdfPath const & GetDelegateID() const
virtual USDIMAGING_API void Sync(HdSyncRequestVector *request) override
Synchronizes the delegate state for the given request vector.
virtual USDIMAGING_API TfToken GetRenderTag(SdfPath const &id) override
USDIMAGING_API VtValue GetExtComputationInput(SdfPath const &computationId, TfToken const &input) override
USDIMAGING_API void SetDisplayProxy(const bool displayProxy)
Sets display of prims with purpose "proxy".
virtual USDIMAGING_API VtValue GetCameraParamValue(SdfPath const &id, TfToken const ¶mName) override
virtual USDIMAGING_API HdPrimvarDescriptorVector GetPrimvarDescriptors(SdfPath const &id, HdInterpolation interpolation) override
Returns descriptors for all primvars of the given interpolation type.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
USDIMAGING_API SdfPath ConvertIndexPathToCachePath(SdfPath const &indexPath)
USDIMAGING_API void ClearPickabilityMap()
Clears any pickability opinions that this delegates might have.
virtual USDIMAGING_API HdDisplayStyle GetDisplayStyle(SdfPath const &id) override
bool GetUsdDrawModesEnabled() const
static constexpr int ALL_INSTANCES
virtual USDIMAGING_API HdBasisCurvesTopology GetBasisCurvesTopology(SdfPath const &id) override
Gets the topological curve data for a given prim.
#define PXR_NAMESPACE_CLOSE_SCOPE
std::shared_ptr< UsdImagingPrimAdapter > UsdImagingPrimAdapterSharedPtr
USDIMAGING_API SdfPath ConvertCachePathToIndexPath(SdfPath const &cachePath)
USDIMAGING_API void SyncAll(bool includeUnvarying)
USDIMAGING_API std::string GetExtComputationKernel(SdfPath const &computationId) override
USDIMAGING_API void ApplyPendingUpdates()
Applies any scene edits which have been queued up by notices from USD.
virtual USDIMAGING_API SdfPath GetInstancerId(SdfPath const &primId) override
Returns the parent instancer of the given rprim or instancer.
USDIMAGING_API void SetWindowPolicy(CameraUtilConformWindowPolicy policy)
virtual USDIMAGING_API SubdivTags GetSubdivTags(SdfPath const &id) override
Gets the subdivision surface tags (sharpness, holes, etc).
std::vector< HdPrimvarDescriptor > HdPrimvarDescriptorVector
bool GetDisplayProxy() const
std::shared_ptr< class HdSelection > HdSelectionSharedPtr
USDIMAGING_API HdModelDrawMode GetModelDrawMode(SdfPath const &id) override
Returns the model draw mode object for the given prim.
virtual SdfPath GetDataSharingId(SdfPath const &primId) override
virtual USDIMAGING_API SdfPath GetScenePrimPath(SdfPath const &rprimId, int instanceIndex, HdInstancerContext *instancerContext=nullptr) override
USDIMAGING_API virtual HdIdVectorSharedPtr GetCoordSysBindings(SdfPath const &id) override
Returns the coordinate system bindings, or a nullptr if none are bound.
SDF_API SdfPath ReplacePrefix(const SdfPath &oldPrefix, const SdfPath &newPrefix, bool fixTargetPaths=true) const
const GfMatrix4d & GetRootTransform() const
Returns the root transform for the entire delegate.
int GetRefineLevelFallback() const
std::vector< HdExtComputationPrimvarDescriptor > HdExtComputationPrimvarDescriptorVector
USDIMAGING_API void SetReprFallback(HdReprSelector const &repr)