-
Notifications
You must be signed in to change notification settings - Fork 4
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
Selection highlighting, picking of MhFootPrint node, with test. #228
Conversation
|
||
// Pick handler for the footprint node. | ||
|
||
class FootPrintPickHandler : public MayaHydra::PickHandler { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
No description provided.