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

Use MFnMatrixData when storing/retriving MMatrix from data block #765

Merged
merged 2 commits into from
Sep 8, 2020

Conversation

kxl-adsk
Copy link

@kxl-adsk kxl-adsk commented Sep 6, 2020

Matrix is stored as shared data, we have to use an appropriate function interface to allocate and maintain the lifetime of matrix objects when stored in the data block.

Added regression test to validate the fix and prevent regressions. Normally it would require a test only for the converter, but data block is not something we have easy access to from python.

@kxl-adsk kxl-adsk added proxy Related to base proxy shape workflows Related to in-context workflows labels Sep 6, 2020
def testMatrixOp_Caching(self):
"""
Validate that accessor works correctly with matrix ops
Cached playback is disabled in this test.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy-paste damage in comment (cached playback is enabled in this test).

@cfmoore007
Copy link

cfmoore007 commented Sep 8, 2020

I just compiled this against latest dev branch and it looks good!
matrix4d_PA_keyframeTest

After running the following code, I was able to get the UFE object to follow the locator :

Example file :
polyCube_custom_xformOp_matrix4d.zip

`
from mayaUsd.lib import proxyAccessor as pa
import maya.cmds as cmds

cmds.loadPlugin("mayaUsdPlugin")

selUfeObject = pa.getUfeSelection() # select /pCube1 in my simple box example
pa.createXformOps(selUfeObject)
dir(selUfeObject)
selUfeObject.nodeName()
selUfeObject.nodeType()
selUfeObject.path()
matrixPlug = pa.getOrCreateAccessPlug(selUfeObject, usdAttrName='xformOp:transform:offset')

nodeDagPath = cmds.ls('PolyCube_custom_xformOp_matrix4d_usdShape',l=True)[0]
cmds.currentTime(1)
cmds.getAttr('{}.{}'.format(nodeDagPath,matrixPlug))

cmds.spaceLocator()
srcNodeDagPath = cmds.ls(sl=True,l=True)[0]
cmds.setAttr('{}.ty'.format(srcNodeDagPath), 3)

cmds.connectAttr('{}.worldMatrix[0]'.format(srcNodeDagPath), '{}.{}'.format(nodeDagPath,matrixPlug)) # Connect src to drive matrix op
`
matrix4d_PA_keyframeTest2

Copy link

@cfmoore007 cfmoore007 left a comment

Choose a reason for hiding this comment

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

Basic usability testing looks good.

Unit tests also pass here (build/test/lib) :

100% tests passed, 0 tests failed out of 79

Label Time Summary:
interactive = 35.77 secproc (3 tests)
pxrUsdMayaGL = 35.77 sec
proc (3 tests)
translators = 140.75 secproc (47 tests)
ufe = 56.44 sec
proc (20 tests)
usdPreviewSurface = 5.05 sec*proc (2 tests)

Total Test time (real) = 257.35 sec

@kxl-adsk kxl-adsk merged commit 5abd7c0 into dev Sep 8, 2020
@kxl-adsk kxl-adsk deleted the kxl-adsk/fix_matrix_conversion_for_data_blocks branch September 8, 2020 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proxy Related to base proxy shape workflows Related to in-context workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants