Skip to content

HYDRA-1286 : Support displacement on GeomSubset wireframe highlights #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
99c118d
HYDRA-1286 : Initial displacement (no updates)
debloip-adsk Jan 27, 2025
9ff8b6f
HYDRA-1286 : Update GeomSubset highlight on displacement update
debloip-adsk Jan 27, 2025
bb09773
HYDRA-1286 : Add utility method to create data source dependencies
debloip-adsk Jan 27, 2025
b82eeeb
HYDRA-1286 : Extract method to make geomSubset highlights
debloip-adsk Jan 27, 2025
c04605b
HYDRA-1286 : Support displacement in point instancing
debloip-adsk Jan 27, 2025
951fd0b
HYDRA-1286 : Cleanup
debloip-adsk Jan 27, 2025
25ec258
HYDRA-1286 : Handle scaling
debloip-adsk Jan 28, 2025
6624b98
HYDRA-1286 : Cleanup
debloip-adsk Jan 28, 2025
733ee36
HYDRA-1286 : Re-order methods
debloip-adsk Jan 28, 2025
0b34fe0
HYDRA-1286 : Move TrimMeshForGeomSubset to FVP namespace
debloip-adsk Jan 28, 2025
d96aefe
HYDRA-1286 : Update variable names
debloip-adsk Jan 28, 2025
bc3cbeb
HYDRA-1286 : Update tokens
debloip-adsk Jan 28, 2025
273b0b5
HYDRA-1286 : Add GeomSubset displacement test scene
debloip-adsk Jan 28, 2025
26881d6
HYDRA-1286 : Add GeomSubset displacement test
debloip-adsk Jan 28, 2025
e75b3f0
HYDRA-1286 : Go back to using only copy-pasted data sources from rero…
debloip-adsk Jan 28, 2025
089d385
HYDRA-1286 : Handle conditional compilation
debloip-adsk Jan 28, 2025
15aae41
HYDRA-1286 : Additional conditional compilation
debloip-adsk Jan 28, 2025
336f8ab
HYDRA-1286 : Additional conditional compilation
debloip-adsk Jan 28, 2025
04077dc
HYDRA-1286 : Rename ComputeSmoothNormals
debloip-adsk Jan 29, 2025
936b1f9
HYDRA-1286 : Move transpose of inverse matrix out of loop
debloip-adsk Jan 29, 2025
7542b52
HYDRA-1286 : Extract out utility functions
debloip-adsk Jan 29, 2025
98f0193
HYDRA-1286 : GeomSubset highlight displacement
debloip-adsk Feb 4, 2025
8d5a141
HYDRA-1286 : Simplify geomSubset displacement highlight
debloip-adsk Mar 5, 2025
0cbe54d
HYDRA-1286 : Update test
debloip-adsk Mar 5, 2025
314b3b4
HYDRA-1286 : Clean headers
debloip-adsk Mar 5, 2025
78dd7da
HYDRA-1286 : Remove outdated anonymous namespace
debloip-adsk Mar 5, 2025
708efff
HYDRA-1286 : Remove unused token
debloip-adsk Mar 6, 2025
a2cbf8f
HYDRA-1286 : Fix conditional compilation
debloip-adsk Mar 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions lib/flowViewport/fvpUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
#include "fvpUtils.h"

#include <pxr/imaging/hd/instanceIndicesSchema.h>
#include <pxr/imaging/hd/materialBindingsSchema.h>
#include <pxr/imaging/hd/selectionSchema.h>

PXR_NAMESPACE_USING_DIRECTIVE

namespace FVP_NS_DEF {

#ifdef CODE_COVERAGE_WORKAROUND
Expand Down Expand Up @@ -56,4 +59,53 @@ PXR_NS::HdDataSourceBaseHandle createSelectionDataSource(const Fvp::PrimSelectio
return PXR_NS::HdDataSourceBase::Cast(selectionBuilder.Build());
}

Fvp::PrimSelection ConvertHydraToFvpSelection(const SdfPath& primPath, const HdSelectionSchema& selectionSchema) {
Fvp::PrimSelection primSelection;
primSelection.primPath = primPath;

auto nestedInstanceIndicesSchema =
#if HD_API_VERSION < 66
const_cast<HdSelectionSchema&>(selectionSchema).GetNestedInstanceIndices();
#else
selectionSchema.GetNestedInstanceIndices();
#endif
for (size_t iNestedInstanceIndices = 0; iNestedInstanceIndices < nestedInstanceIndicesSchema.GetNumElements(); iNestedInstanceIndices++) {
HdInstanceIndicesSchema instanceIndicesSchema = nestedInstanceIndicesSchema.GetElement(iNestedInstanceIndices);
auto instanceIndices = instanceIndicesSchema.GetInstanceIndices()->GetTypedValue(0);
primSelection.nestedInstanceIndices.push_back(
{
instanceIndicesSchema.GetInstancer()->GetTypedValue(0),
instanceIndicesSchema.GetPrototypeIndex()->GetTypedValue(0),
std::vector<int>(instanceIndices.begin(), instanceIndices.end())
}
);
}

return primSelection;
}

SdfPath GetMaterialPath(const PXR_NS::HdContainerDataSourceHandle& primDataSource)
{
if (!primDataSource) {
return {};
}

HdMaterialBindingsSchema materialBindingsSchema = HdMaterialBindingsSchema::GetFromParent(primDataSource);
if (!materialBindingsSchema.IsDefined()) {
return {};
}

HdMaterialBindingSchema materialBindingSchema = materialBindingsSchema.GetMaterialBinding();
if (!materialBindingSchema) {
return {};
}

HdPathDataSourceHandle bindingPathDataSource = materialBindingSchema.GetPath();
if (!bindingPathDataSource) {
return {};
}

return bindingPathDataSource->GetTypedValue(0);
}

} // namespace FVP_NS_DEF
7 changes: 7 additions & 0 deletions lib/flowViewport/fvpUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <pxr/imaging/hd/tokens.h>
#include <pxr/imaging/hd/retainedDataSource.h>
#include <pxr/imaging/hd/selectionSchema.h>
#include <pxr/imaging/hd/primvarsSchema.h>

namespace FVP_NS_DEF {
Expand Down Expand Up @@ -125,6 +126,12 @@ auto FindSelfOrFirstChild(const PXR_NS::SdfPath& path, const std::map<PXR_NS::Sd
return pathMap.cend();
}

// Return a Fvp::PrimSelection equivalent to the given Hydra selection
Fvp::PrimSelection ConvertHydraToFvpSelection(const PXR_NS::SdfPath& primPath, const PXR_NS::HdSelectionSchema& selectionSchema);

// Get the path to the prim's bound material.
PXR_NS::SdfPath GetMaterialPath(const PXR_NS::HdContainerDataSourceHandle& primDataSource);

} // namespace FVP_NS_DEF

#endif // FVP_UTILS_H
Loading