Skip to content
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

HYDRA-712 : Handle hierarchical transform & visibility changes for plugin nodes #141

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
51d0528
HYDRA-712 : Make DataProducerData use UFE notifications to support hi…
debloip-adsk Apr 10, 2024
7a91f66
HYDRA-712 : Make FilteringSceneIndexData use UFE notifications to sup…
debloip-adsk Apr 12, 2024
3e56f18
HYDRA-712 : Formatting
debloip-adsk Apr 15, 2024
f22e8b8
HYDRA-712 : Adjust computation of memcpy
debloip-adsk Apr 15, 2024
be2f2b1
HYDRA-712 : Fix crash when adding filtering scene index while using M…
debloip-adsk Apr 16, 2024
40d3ff7
HYDRA-712 : Add test
debloip-adsk Apr 16, 2024
9b47dfd
HYDRA-712 : Include cleanup
debloip-adsk Apr 16, 2024
38e7e26
HYDRA-712 : Adjust sphere position in test
debloip-adsk Apr 17, 2024
fe67dde
HYDRA-712 : Remove dates
debloip-adsk Apr 17, 2024
eb51cca
HYDRA-712 : Make locator example a surface shape instead
debloip-adsk Apr 19, 2024
75788b2
HYDRA-712 : Make locator example a locator again, but with appropriat…
debloip-adsk Apr 22, 2024
1c83dc8
HYDRA-712 : Adjust classification of footprint node
debloip-adsk Apr 22, 2024
dcd6829
HYDRA-712 : Extract hierarchical properties test separately + playbac…
debloip-adsk Apr 24, 2024
a0affed
HYDRA-712 : Remove test from testFlowViewportAPI
debloip-adsk Apr 25, 2024
6dae7d5
Merge branch 'dev' into debloip/HYDRA-712/hierarchical-properties-for…
debloip-adsk Jun 7, 2024
c9f5de0
HYDRA-712 : Add silhouette-based test and test animated USD prim
debloip-adsk Jun 13, 2024
cd739a2
HYDRA-712 : Use VP2 comparison for other USD stage tests as well
debloip-adsk Jun 13, 2024
8038cf3
HYDRA-712 : Add comment on oiiotool issue
debloip-adsk Jun 13, 2024
047ec98
HYDRA-712 : Adjust test for animating the stage transform directly as…
debloip-adsk Jun 13, 2024
565b9e4
HYDRA-712 : Slight refactor of assertions order
debloip-adsk Jun 13, 2024
a625a97
HYDRA-712 : Adjust reference images
debloip-adsk Jun 18, 2024
77e1d0b
HYDRA-712 : Adjust thresholds
debloip-adsk Jun 18, 2024
4e5ae76
HYDRA-712 : Move to query-based approach to update plugin data produc…
debloip-adsk Jun 19, 2024
e27e1bd
HYDRA-712 : Fixup
debloip-adsk Jun 19, 2024
eda4a21
HYDRA-712 : Remove notification code for transform & visibility
debloip-adsk Jun 19, 2024
54cb811
HYDRA-712 : Remove unused GetDCCNodeName method
debloip-adsk Jun 19, 2024
a0e7e1c
HYDRA-712 : Add more detailed comments on UFE notifications approach
debloip-adsk Jun 19, 2024
ef30807
HYDRA-712 : Remove excess headers
debloip-adsk Jun 19, 2024
3a84b0d
HYDRA-712 : Revert plugin example changes
debloip-adsk Jun 19, 2024
df711a1
HYDRA-712 : Fix tests
debloip-adsk Jun 20, 2024
def2725
HYDRA-712 : Simplify updates of data producers and filtering scene in…
debloip-adsk Jun 20, 2024
1b868ea
HYDRA-712 : Rename and add USD file for test
debloip-adsk Jun 20, 2024
1219ee8
HYDRA-712 : Remove comments
debloip-adsk Jun 20, 2024
6b24abc
HYDRA-712 : Remove comment
debloip-adsk Jun 20, 2024
5aee6db
HYDRA-712 : Adjust comments
debloip-adsk Jun 20, 2024
61811aa
HYDRA-712 : Updates from code review
debloip-adsk Jun 25, 2024
c137ac2
HYDRA-712 : Add missing frame check in test
debloip-adsk Jun 25, 2024
d543b30
Merge branch 'dev' into debloip/HYDRA-712/hierarchical-properties-for…
debloip-adsk Jul 4, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ bool FilteringSceneIndexInterfaceImp::_CreateSceneFilteringSceneIndicesData(cons
std::lock_guard<std::mutex> lock(sceneFilteringClient_mutex);

auto findResult = std::find_if(sceneFilteringSceneIndicesData().cbegin(), sceneFilteringSceneIndicesData().cend(),
[&client](const PXR_NS::FVP_NS_DEF::FilteringSceneIndexDataBaseRefPtr& filteringSIData) { return filteringSIData->getClient() == client;});
[&client](const PXR_NS::FVP_NS_DEF::FilteringSceneIndexDataBaseRefPtr& filteringSIData) { return filteringSIData->GetClient() == client;});
if (findResult != sceneFilteringSceneIndicesData().cend()){
return false;
}
Expand All @@ -123,7 +123,7 @@ bool FilteringSceneIndexInterfaceImp::_CreateSelectionHighlightFilteringSceneInd
std::lock_guard<std::mutex> lock(selectionHighlightFilteringClient_mutex);

auto findResult = std::find_if(selectionHighlightFilteringSceneIndicesData.cbegin(), selectionHighlightFilteringSceneIndicesData.cend(),
[&client](const PXR_NS::FVP_NS_DEF::FilteringSceneIndexDataBaseRefPtr& filteringSIData) { return filteringSIData->getClient() == client;});
[&client](const PXR_NS::FVP_NS_DEF::FilteringSceneIndexDataBaseRefPtr& filteringSIData) { return filteringSIData->GetClient() == client;});
if (findResult != selectionHighlightFilteringSceneIndicesData.cend()){
return false;
}
Expand All @@ -149,11 +149,11 @@ void FilteringSceneIndexInterfaceImp::_DestroySceneFilteringSceneIndicesData(con
std::lock_guard<std::mutex> lock(sceneFilteringClient_mutex);

auto findResult = std::find_if(sceneFilteringSceneIndicesData().cbegin(), sceneFilteringSceneIndicesData().cend(),
[&client](const PXR_NS::FVP_NS_DEF::FilteringSceneIndexDataBaseRefPtr& filteringSIData) { return filteringSIData->getClient() == client;});
[&client](const PXR_NS::FVP_NS_DEF::FilteringSceneIndexDataBaseRefPtr& filteringSIData) { return filteringSIData->GetClient() == client;});
if (findResult != sceneFilteringSceneIndicesData().cend()){
const auto& filteringSIData = (*findResult);
rendererNames = (filteringSIData)
? filteringSIData->getClient()->getRendererNames()
? filteringSIData->GetClient()->getRendererNames()
: FvpViewportAPITokens->allRenderers;

sceneFilteringSceneIndicesData().erase(findResult);//This also decreases ref count
Expand All @@ -175,7 +175,7 @@ void FilteringSceneIndexInterfaceImp::_DestroySelectionHighlightFilteringSceneIn
std::lock_guard<std::mutex> lock(selectionHighlightFilteringClient_mutex);

auto findResult = std::find_if(selectionHighlightFilteringSceneIndicesData.cbegin(), selectionHighlightFilteringSceneIndicesData.cend(),
[&client](const PXR_NS::FVP_NS_DEF::FilteringSceneIndexDataBaseRefPtr& filteringSIData) { return filteringSIData->getClient() == client;});
[&client](const PXR_NS::FVP_NS_DEF::FilteringSceneIndexDataBaseRefPtr& filteringSIData) { return filteringSIData->GetClient() == client;});
if (findResult != selectionHighlightFilteringSceneIndicesData.cend()){
selectionHighlightFilteringSceneIndicesData.erase(findResult);//Also decreases ref count
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ class FilteringSceneIndexInterfaceImp : public FilteringSceneIndexInterface
FVP_API
void setSceneIndexDataFactory(FilteringSceneIndexDataAbstractFactory& factory);

//Called by Flow viewport
//Called by Flow viewport and the DCC
FVP_API
const std::set<PXR_NS::FVP_NS_DEF::FilteringSceneIndexDataBaseRefPtr>& getSceneFilteringSceneIndicesData() const;
FVP_API
const std::set<PXR_NS::FVP_NS_DEF::FilteringSceneIndexDataBaseRefPtr>& getSelectionHighlightFilteringSceneIndicesData() const;

private :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ namespace FVP_NS_DEF {
*/
DataProducerSceneIndexDataBase::DataProducerSceneIndexDataBase(const CreationParameters& params)
{
_parentMatrix.SetIdentity();
_dataProducerSceneIndex = params._customDataProducerSceneIndex;
_prefix = params._prefix;
_lastSceneIndexChain = params._customDataProducerSceneIndex;
Expand All @@ -55,7 +54,6 @@ DataProducerSceneIndexDataBase::DataProducerSceneIndexDataBase(const CreationPar
//For Usd stages
DataProducerSceneIndexDataBase::DataProducerSceneIndexDataBase(const CreationParametersForUsdStage& params)
{
_parentMatrix.SetIdentity();
_dataProducerSceneIndex = nullptr;//Will be set later
_prefix = params._prefix;
_lastSceneIndexChain = nullptr;//Will be set later
Expand All @@ -70,24 +68,6 @@ DataProducerSceneIndexDataBase::~DataProducerSceneIndexDataBase()
#endif
}

void DataProducerSceneIndexDataBase::UpdateHydraTransformFromParentPath()
{
if (! _rootOverridesSceneIndex){
return;
}

_rootOverridesSceneIndex->SetRootTransform(_parentMatrix);
}

void DataProducerSceneIndexDataBase::UpdateVisibilityFromDCCNode(bool isVisible)
{
if (! _rootOverridesSceneIndex){
return;
}

_rootOverridesSceneIndex->SetRootVisibility(isVisible);
}

void DataProducerSceneIndexDataBase::_CreateSceneIndexChainForDataProducerSceneIndex()
{
if (_dccNode){
Expand Down Expand Up @@ -135,7 +115,6 @@ void DataProducerSceneIndexDataBase::_CreateSceneIndexChainForDataProducerSceneI
{
_rootOverridesSceneIndex = UsdImagingRootOverridesSceneIndex::New(inputSceneIndex);
_lastSceneIndexChain = _rootOverridesSceneIndex;
UpdateHydraTransformFromParentPath();//Update the transform, this is useful when deleting the node and undoing it
}

void DataProducerSceneIndexDataBase::_CreateSceneIndexChainForDataProducerSceneIndexWithoutDCCNode(HdSceneIndexBaseRefPtr const & inputSceneIndex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ TF_DECLARE_WEAK_AND_REF_PTRS(DataProducerSceneIndexDataBase);//Be able to use Re
const SdfPath& GetPrefix()const{return _prefix;}
const std::string& GetRendererNames() const {return _rendererNames;}

/// Provide the node name from the DCC to be overriden in a DCC specific subclass
virtual std::string GetDCCNodeName() const {return "";}
// Returns true if visibility was changed, false otherwise.
virtual bool UpdateVisibility() = 0;

void UpdateVisibilityFromDCCNode(bool isVisible);
void UpdateHydraTransformFromParentPath();
// Returns true if transform was changed, false otherwise.
virtual bool UpdateTransform() = 0;

protected:

Expand Down Expand Up @@ -119,9 +119,6 @@ TF_DECLARE_WEAK_AND_REF_PTRS(DataProducerSceneIndexDataBase);//Be able to use Re
/// Is the last scene index of the scene index chain when a dccNode was passed.
HdSceneIndexBaseRefPtr _lastSceneIndexChain = nullptr;

/// Is the world matrix of the scene index. It is used only when a dccNode was passed to override the transform of the root of the scene index.
GfMatrix4d _parentMatrix;

/// _rootOverridesSceneIndex is used to set a transform and visibility at the root of the Usd stage/data producer scene index. It is used only when a dccNode was passed.
/// With this scene index when you select the proxyshape node and move it or hide it, we apply the same operation on the stage, same for a data producer scene index with a hosting node.
UsdImagingRootOverridesSceneIndexRefPtr _rootOverridesSceneIndex = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ FilteringSceneIndexDataBase::FilteringSceneIndexDataBase(const std::shared_ptr<:
{
}

void FilteringSceneIndexDataBase::updateVisibilityFromDCCNode(bool isVisible)
{
_isVisible = isVisible;
const std::string& rendererNames = _client->getRendererNames();
::Fvp::FilteringSceneIndicesChainManager::get().updateFilteringSceneIndicesChain(rendererNames);
}

}//End of namespace FVP_NS_DEF

PXR_NAMESPACE_CLOSE_SCOPE
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ TF_DECLARE_WEAK_AND_REF_PTRS(FilteringSceneIndexDataBase);//Be able to use Ref c

~FilteringSceneIndexDataBase() override = default;

void updateVisibilityFromDCCNode(bool isVisible);
std::shared_ptr<::Fvp::FilteringSceneIndexClient> getClient() {return _client;}
bool getVisible() const{return _isVisible;}
void setVisible(bool visible) {_isVisible = visible;}
std::shared_ptr<::Fvp::FilteringSceneIndexClient> GetClient() {return _client;}

bool GetVisibility() { return _isVisible; }

// Returns true if visibility was changed, false otherwise.
virtual bool UpdateVisibility() = 0;

protected:
FilteringSceneIndexDataBase(const std::shared_ptr<::Fvp::FilteringSceneIndexClient>& filteringSIClient);
Expand All @@ -53,7 +55,7 @@ TF_DECLARE_WEAK_AND_REF_PTRS(FilteringSceneIndexDataBase);//Be able to use Ref c
const std::shared_ptr<::Fvp::FilteringSceneIndexClient> _client;

///_isVisible is true when the filteringSceneIndices should be visible and false when they are not such as when the hosting node has been hidden/deleted.
bool _isVisible = true;
bool _isVisible = false;
};

}//End of namespace FVP_NS_DEF {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ void FilteringSceneIndicesChainManager::_AppendFilteringSceneIndicesChain( View
//Call our Hydra viewport API mechanism for custom filtering scene index clients
const auto& viewportFilteringSceneIndicesData = FilteringSceneIndexInterfaceImp::get().getSceneFilteringSceneIndicesData();
for (const auto& filteringSceneIndexData : viewportFilteringSceneIndicesData) {
auto client = filteringSceneIndexData->getClient();
auto client = filteringSceneIndexData->GetClient();
const std::string& rendererNames = client->getRendererNames();
//Filter by render delegate name
if ( (FvpViewportAPITokens->allRenderers != rendererNames) && rendererNames.find(rendererDisplayName) == std::string::npos){
//Ignore that client info, it is not targeted for this renderer
continue;
}

const bool isVisible = filteringSceneIndexData->getVisible();
const bool isVisible = filteringSceneIndexData->GetVisibility();
if (! isVisible){
continue; //We should not append not visible filtering scene indices
}
Expand Down
Loading