maya-usd icon indicating copy to clipboard operation
maya-usd copied to clipboard

Maya USD Reference Animation 25 FPS time mismatch

Open BigRoy opened this issue 1 year ago • 7 comments

Describe the bug

Below is all done in a 25 FPS Maya scene.

When exporting an animation via maya usd export, say from 1001 to 1020 and then loading this USD back in directly as Maya USD Proxy Shape as the actual file works fine.

But creating an empty Maya USD Proxy Shape stage and then (USD) referencing in that animation it seems that the animation plays back around the time range of 962-977

Steps to reproduce

All steps below are in Maya workfile set to 25 FPS.

Steps to reproduce the behavior:

  1. Create an animation between 1001-1020 (in a 25 FPS scenefile)
  2. Export via Maya USD
  3. Create empty Maya USD Proxy Shape
  4. Create a root prim, e.g. an Xform
  5. Reference in the animation onto that prim.

The time is now at the incorrect frames. As if playing an invalid FPS.

Expected behavior

There should be a way via the UI to manage these FPS discrepencies. Furthermore, I'd expect when working in a 25 FPS scene for exporting, and also for the Maya USD Proxy Shape for Maya to 'do the right thing automatically'. It should default mayaUsdProxyShape 's timeCodePerSecond and framesPerSecond to the current FPS.

It sounds like e.g. Maya USD Proxy Shape is at the wrong 'FPS'?

Attachments

n/a

Specs (if applicable):

  • OS & version: Windows 10
  • Maya version: 2024.2
  • Maya USD: 0.26.0

Additional context

n/a

BigRoy avatar Jan 29 '24 17:01 BigRoy

A workaround seems to be to author the timeCodesPerSecond metadata on the stage's root layer.

If e.g. you KNOW for a fact that your project has only the same FPS on assets and workfiles throughout, you can e.g. force the stage's metadata to match your current scenes' FPS (which I expected would maybe have been the default behavior?)

# Set all mayaUsdProxyShape timeCodesPerSecond and framesPerSecond to current Maya scene FPS
from maya import cmds, mel
import mayaUsd.ufe

fps = mel.eval('currentTimeUnitToFPS()')
for proxy in cmds.ls(type="mayaUsdProxyShape", long=True):
    stage = mayaUsd.ufe.getStage(proxy)
    stage.SetTimeCodesPerSecond(fps)
    stage.SetFramesPerSecond(fps)

Is this the intended behavior? Any tips/workflows for potentially mixed FPS files?

BigRoy avatar Jan 29 '24 18:01 BigRoy

Thank you for sharing this. We will look into this.

wallworm avatar Jan 31 '24 15:01 wallworm

Just checking back in - any thoughts about the intended behavior?

BigRoy avatar Feb 06 '24 00:02 BigRoy

@BigRoy if we save that stage without metadata and play the animation on USDView - are you seeing the same behavior? would you be able to provide us the test file you are using?

we are investigating a bit deeper to try and understand the behavior, and that info would be very helpful.

santosg87 avatar Feb 07 '24 16:02 santosg87

Sure can!

Here's an animated cube exported from Maya 2024.2 with MayaUSD 0.26.0 at 25 FPS with an animation from frame 1001 through 1100 where it's at:

  • frame 1001: Translate Y = 0
  • frame 1100: Translate Y = 10

cube_1001_1100.zip

If you reference this into the (also 25 FPS) maya scene within an empty stage. So: Create stage, create a prim, add reference. Then it plays at the wrong frames because the empty stage does not have timecode per seconds set:

example_maya_scene.zip

image

When loading that stage into USD view (when writing out the root layer) I'm not sure how to playback the time, since the layer itself does not author any time samples the playbar is disabled in USD view.

However, if I first Duplicate as USD data my local cube to the stage that has my reference then in my Maya viewport I'm seeing the cube that was duplicated into it in Maya at the correct frame like the original animation in my scene. Saving that layer however, still has no authored start and end time code.

If I add that timecode metadata manually:

(
    endTimeCode = 1100
    startTimeCode = 1001
)

Then it does show the timebar in USD view, and now for that state also shows indeed that the referenced cube plays at the wrong time - until I specify my current root layer is at timeCodesPerSecond = 25

Interestingly enough - they then both play at the same frame.

Also setting framesPerSecond = 25 seems to make no difference. Here's an example export of that state:

exported_states.zip

You might need to remap some paths here and there - all my files here were in a E:\debug folder.

Does this help?

BigRoy avatar Feb 07 '24 18:02 BigRoy

@santosg87 Just wanted to loop back about this - did you need more information?

BigRoy avatar Feb 15 '24 20:02 BigRoy

@BigRoy sorry for the late reply, and thank you for the detailed explanation!

we are discussing the behavior to have a better understanding if this is intended or not. I will update once we have more info. :)

santosg87 avatar Feb 16 '24 03:02 santosg87