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

MAYA-124702: retrieve ufe runtime id by data source integer reference #2933

22 changes: 17 additions & 5 deletions lib/mayaUsd/sceneIndex/proxyShapeSceneIndexPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#if PXR_VERSION >= 2211

#include <mayaUsd/ufe/Global.h>

#include <pxr/imaging/hd/flatteningSceneIndex.h>
#include <pxr/imaging/hd/retainedDataSource.h>
#include <pxr/imaging/hd/sceneIndexPlugin.h>
Expand All @@ -29,6 +31,7 @@
#include <maya/MObjectHandle.h>
#include <maya/MSelectionList.h>
#include <maya/MString.h>
#include <ufe/rtid.h>

PXR_NAMESPACE_OPEN_SCOPE

Expand All @@ -47,12 +50,21 @@ HdSceneIndexBaseRefPtr MayaUsdProxyShapeMayaNodeSceneIndexPlugin::_AppendSceneIn
const HdContainerDataSourceHandle& inputArgs)
{
using HdMObjectDataSource = HdRetainedTypedSampledDataSource<MObject>;
using HdMObjectDataSourceHandle = HdRetainedTypedSampledDataSource<MObject>::Handle;
static TfToken dataSourceNodePathEntry("object");
using HdRtidRefDataSource = HdRetainedTypedSampledDataSource<Ufe::Rtid&>;

static TfToken dataSourceNodePathEntry("object");
static TfToken dataSourceRuntimeEntry("runtime");

HdDataSourceBaseHandle dataSourceEntryPathHandle = inputArgs->Get(dataSourceNodePathEntry);
if (HdMObjectDataSourceHandle dataSourceEntryPath
= HdMObjectDataSource::Cast(dataSourceEntryPathHandle)) {
MObject dagNode = dataSourceEntryPath->GetTypedValue(0.0f);
HdDataSourceBaseHandle dataSourceEntryRuntimeHandle = inputArgs->Get(dataSourceRuntimeEntry);
if (auto dataSourceEntryNodePath = HdMObjectDataSource::Cast(dataSourceEntryPathHandle)) {
auto dataSourceEntryRuntime = HdRtidRefDataSource::Cast(dataSourceEntryRuntimeHandle);
if (TF_VERIFY(dataSourceEntryRuntime, "Error UFE runtime id data source not found")) {
Ufe::Rtid& id = dataSourceEntryRuntime->GetTypedValue(0.0f);
id = MayaUsd::ufe::getUsdRunTimeId();
TF_VERIFY(id != 0, "Invalid UFE runtime id");
}
MObject dagNode = dataSourceEntryNodePath->GetTypedValue(0.0f);
MStatus status;
MFnDependencyNode dependNodeFn(dagNode, &status);
if (!TF_VERIFY(status, "Error getting MFnDependencyNode")) {
Expand Down