PDA

View Full Version : Frame advancing with audio??


gimble
07-19-2012, 12:21 PM
Hi all,

I know there is a script out there that will let you advance through the timeline frames whilst also playing the audio for each frame. I've seen this script a couple times in previous jobs but forgot to grab it, could anyone help me?

Basically it's the same as the default maya hotkeys (Alt+, and Alt+.) but you can hear the audio. I'm doing some lip sync and it comes in very useful. I've spent almost 4 hours now hunting on the net and can't find it anywhere.

Thanks in advance!

Craig.

RedNine
07-19-2012, 03:17 PM
Dirty hack but this would do it in Python.

import maya.cmds as cmds
import maya.mel as mel
import time

def advanceWithTime(direction='forward'):
snd=cmds.timeControl(mel.eval('$var=$gPlayBackSlider'),q=True,s=True)
if direction=='forward':
cmds.play( forward=True, sound=snd,playSound=True, st=True)
time.sleep(0.2)
cmds.currentTime(cmds.currentTime(q=True) + 1, e=True)
cmds.play( forward=True, sound=snd,playSound=True, st=False)
else:
cmds.play( forward=False, sound=snd,playSound=True, st=True)
time.sleep(0.2)
cmds.currentTime(cmds.currentTime(q=True) - 1, e=True)
cmds.play( forward=False, sound=snd,playSound=True, st=False)

#Call for forward
advanceWithTime('forward')

#Call for backward
advanceWithTime('back')

gimble
07-20-2012, 02:13 AM
Hi RedNine,

thanks a lot for your post! I may be applying your script wrong but I get errors in the Script Editor when I execute it. Am I doing it correct by creating a shelf button with the python script you posted?

Thanks mate :)

Craig.

CGTalk Moderation
07-20-2012, 02:13 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.