Undo after capture/snap goes to frame 1 instead of preserving the previous frame.
Closed this issue · 8 comments
The maya.cmds.playblast
command seems to suffer from an undo bug, see here. Upon undoing the command it'll revert back to frame 1 as opposed to going back to the frame it was before playblasting.
A workaround/bugfix is to set the current time before calling the playblast command, like so:
maya.cmds.currentTime(maya.cmds.currentTime(q=1))
I'm thinking a context-manager to automatically reset the time after each capture would be good here. No command should really mess with state, unless it's intended to.
I'm thinking a context-manager to automatically reset the time after each capture would be good here. No command should really mess with state, unless it's intended to.
That's a separate issue, since that's unrelated to the undo bug of the playblast command? Also that would mean setting the time afterwards instead of beforehand?
But yes, I totally agree. Set up the issue and I'll implement.
But wouldn't that nullify this problem? If capture
never altered the frame to begin with?
Would it still revert to frame 1 you think? :O
Would it still revert to frame 1 you think? :O
I think so, yes. But I'm thinking in the form of "undo chain". The current time is set afterwards thus gets processed first when undo'ing. Since the playblast has the issue where it resets to frame 1 on undo, the issue would then still be present.
But I'll have a look!
Yup, as I thought, the issue would still be there. :(
So setting in front and include a context manager would fix both.
But wouldn't that nullify this problem? If capture never altered the frame to begin with?
The issue with undoing is even there when you use the cmds.playblast
command solely to list the available compressions instead of actually performing a capture/playblast. It's a real bug. It doesn't actually have anything to do with altering the time.
This is fixed with BigRoy@f4a2207.
I'm thinking a context-manager to automatically reset the time after each capture would be good here. No command should really mess with state, unless it's intended to.
See #23.
Aweseome!