Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hi @samuelliu-adsk , thanks for working on this for the issue #3243. I tested it but unfortunately it doesn't resolve the issue due to the following code:
MGlobal::executeCommand(("listConnections -shapes on " + this->name()), result);
This is because a
mayaUsdProxyShape
usually has atime1
node's connection to itstime
attribute. The maya-usd code base does this as well. Please see https://github.com/Autodesk/maya-usd/blob/dev/plugin/adsk/scripts/mayaUsd_createStageWithNewLayer.py#L39 and https://github.com/Autodesk/maya-usd/blob/dev/lib/mayaUsd/ufe/UsdUndoCreateStageWithNewLayerCommand.cpp#L150-L151. Hence,MGlobal::executeCommand(("listConnections -shapes on " + this->name()), result)
would return atime1
node and theisIncomingStage
would be set totrue
which is not correct. I guess you might have been using the example code on the issue page #3243 to test the solution but the code example is missingtime1
node's connection. Sorry for that.According to the logic we discussed on the issue page:
I would suggest the following solution (I tested it and it resolves the issue):
This is because the
!inDataHandle.data().isNull()
check already takes care of checking whether the proxy shape has an incoming connection to itsinStageData
attribute which might be from a bifrost graph or another proxy shape node. If there is no connection to it then we can considerisIncomingStage
is false. I don't think we need to check thestageCacheId
value because if it has value and is valid and in USD stage cache thenisIncomingStage
should be false. And ifstageCacheId
value is set but it's not valid thenisIncomingStage
should be false too.I did a test for our internal patch which you could use to test as well:
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.
Thanks @NickWu , I'll make a new PR with the fixes.
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.
Hi @samuelliu-adsk , thanks for working on this. I forgot to add the code to connect
time1
again. I have updated the test code with this linecmds.connectAttr('time1.outTime', '{}.time'.format(shapeNode))