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

Added disableSparseSamples #2815

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

tryptik
Copy link

@tryptik tryptik commented Jan 10, 2023

The UsdUtilsSparseValueWriter seems to write duplicate values for some curves. This P/R adds a disableSparseSamples flag to the mayaUSDExport command. When true, the sparse sample writer is disabled for the export.

This issue has been observed in the animation data in UsdSkelAnimation prims - similar values on an XForm do not seem to yield the same result. The disabling of the sparse sampling was applied across the board as a precaution. The modified test case shows where the issue is found in the scale animation. The result of the sparse sample export can be seen in the figure below:

image

I am covered under the Apple CLA as John Hood.

Clang format

Updated copyright, added __main__

Added testDisableSparseSamples.py

updating to match Autodesk style

Updated to work w/ maya test suite

Disabled sparse check on joint
@seando-adsk seando-adsk added the do-not-merge-yet Development is not finished, PR not ready for merge label Jan 11, 2023
@seando-adsk
Copy link
Collaborator

@dgovil / @tryptik - Dhruv there are 3 persons listed on the CLA that I have on file for Apple, but "John Hood" is not one of them.

@dgovil
Copy link
Collaborator

dgovil commented Jan 11, 2023

@seando-adsk apologies, I just updated our CLA and sent it over with the name changes on there.

@seando-adsk
Copy link
Collaborator

@dgovil Thanks I got it. We'll proceed with an internal discussion about these changes.

@santosd
Copy link
Collaborator

santosd commented Feb 22, 2023

Hi @tryptik and @dgovil, I am wondering if we have a test scene that we can look at that shows the issue with the duplicate values when using the UsdUtilsSparseValueWriter. We are trying to see if this is a bug that would need fixed in the sparser instead. Once we have a test file, we can take a closer look on our end. Thank you.

@tryptik
Copy link
Author

tryptik commented Feb 28, 2023

Hi, @santosd, I agree that the issue may be in the UsdUtilsSparseValueWriter. The test/lib/mayaUsd/fileio/testDisableSparseSamples.py file builds a sample scene that reveals the issue -is that sufficient?

@santosd
Copy link
Collaborator

santosd commented Mar 30, 2023

Hi @tryptik sorry for the delay on this one. I ran what is in the script locally on my machine (the building of the scene and the export) and I was not able to reproduce the issue that you show in your screen capture.
I ran this:

import maya.cmds as cmds

cmds.file(f=1, new=1)

grp = cmds.createNode('transform', name='root')
pcube = cmds.polyCube()
cmds.parent(pcube[0], grp)
cmds.select( d=True )

cmds.select(grp)
joint_a = cmds.joint()
joint_a = cmds.joint( p=(0, 0, 0))
cmds.joint( p=(0, 4, 0))

cmds.skinCluster(joint_a, pcube[0], tsb=1, mi=1)

cmds.setKeyframe("joint2.sx", t=0.0, v=0.0)
cmds.setKeyframe("joint2.sx", t=100.0, v=1.0)
cmds.keyTangent("joint2.sx", wt=1)
cmds.keyTangent("joint2.sx", e=1, index=(0,), itt='linear', ott='linear')
cmds.keyTangent("joint2.sx", e=1, index=(1,), itt='auto', ott='auto')

psphere = cmds.polySphere()
cmds.setKeyframe(psphere[0]+".sx", t=0.0, v=0.0)
cmds.setKeyframe(psphere[0]+".sx", t=100.0, v=1.0)
cmds.keyTangent(psphere[0]+".sx", wt=1)
cmds.keyTangent(psphere[0]+".sx", e=1, index=(0,), itt='linear', ott='linear')
cmds.keyTangent(psphere[0]+".sx", e=1, index=(1,), itt='auto', ott='auto')

Then I ran this for export:

import maya.cmds as cmds
usd_file = "C:/Users/santosd/Documents/maya/projects/default/scenes/sparse.usda"
cmds.mayaUSDExport(
    selection=False,
    exportDisplayColor=True,
    materialsScopeName="Looks",
    mergeTransformAndShape=True,
    shadingMode="useRegistry",
    defaultMeshScheme="none",
    exportSkin="auto",
    exportSkels="auto",
    frameRange=[70, 99],
    file=usd_file
    )

I then tried importing the resulting file to check the animation curves, but I am not seeing the issue you see.

Let me know if I am missing something.

Thank you.

@tryptik
Copy link
Author

tryptik commented Apr 12, 2023

Hi, @santosd, sorry it took me a bit to get to this. If you re-import that Usd into Maya, you should see:

image

I used mayaUSDImport -f "[path-to-file].usda" -ani 1

@santosd
Copy link
Collaborator

santosd commented Apr 13, 2023

Thank you @tryptik I am seeing the issue. I will work with @seando-adsk to look further into the issue and see if we can fix this on the sparser end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge-yet Development is not finished, PR not ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants