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

Selection highlighting, picking of MhFootPrint node, with test. #228

Conversation

ppt-adsk
Copy link
Collaborator

No description provided.

@ppt-adsk ppt-adsk self-assigned this Dec 11, 2024
@ppt-adsk ppt-adsk added the test label Dec 11, 2024

// Pick handler for the footprint node.

class FootPrintPickHandler : public MayaHydra::PickHandler {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Foot print node had no pick handler, picking did not work.


//Add the callback when an attribute of this node changes
MObject obj = thisMObject();
_cbAttributeChangedId = MNodeMessage::addAttributeChangedCallback(obj, attributeChangedCallback, ((void*)this));

//Data producer scene index interface is used to add the retained scene index to all viewports with all render delegates
auto& dataProducerSceneIndexInterface = Fvp::DataProducerSceneIndexInterface::get();
dataProducerSceneIndexInterface.addDataProducerSceneIndex(_retainedSceneIndex, noPrefix, (void*)&obj, FvpViewportAPITokens->allViewports,FvpViewportAPITokens->allRenderers);
dataProducerSceneIndexInterface.addDataProducerSceneIndex(_retainedSceneIndex, _pathPrefix, (void*)&obj);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed default arguments.

@@ -552,19 +598,30 @@ void* MhFootPrint::creator()

void MhFootPrint::addedToModelCb()
{
static const SdfPath noPrefix = SdfPath::AbsoluteRootPath();
_pathPrefix = SdfPath(TfStringPrintf("/MhFootPrint_%p", this));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lack of path prefix meant that the prefix was the Hydra scene index root. Thus, when foot print node was selected, the Hydra scene index root was selected, and all its children received selection highlighting, which is the normal and correct way to highlight children of a selected prim. Unfortunately, this meant that the whole scene was selection highlighted... Fixed with a proper Hydra scene index prefix.

@@ -108,3 +112,29 @@ TEST(TestHydraPrim, translation)
constexpr double epsilon{1e-7};
ASSERT_TRUE(GfIsClose(primTranslation, expectedTranslation, epsilon));
}

TEST(TestHydraPrim, countPrims)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New utility to count Hydra scene index prims, given a regular expression.

@@ -257,5 +259,38 @@ def test_Load(self):
#using imageVersion as the color is different for this image under usd 24.11+
self.assertSnapshotClose("loadingFootPrintScene.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT, self.imageVersion)

# Test selection highlighting. When the footprint node is selected, only
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the fixes for picking and selection highlighting, these two tests fail.

With the fixes, these two tests pass.

@ppt-adsk ppt-adsk assigned ppt-adsk and unassigned ppt-adsk Dec 11, 2024
@ppt-adsk ppt-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Dec 11, 2024
@lilike-adsk lilike-adsk merged commit b0db8f0 into dev Dec 11, 2024
10 of 12 checks passed
@lilike-adsk lilike-adsk deleted the tremblp/HYDRA-1323/fix_footPrintNode_picking_and_sel_highlighting branch December 11, 2024 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants