Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / Python / Scriptjob to run during playback?
  RSS 2.0 ATOM  

Scriptjob to run during playback?
Rate this thread
 
52028
 
Permlink of this thread  
avatar
  • Location: Honolulu, HI
  • Total Posts: 34
  • Joined: 07 March 2008 05:39 AM

I need a script to run at every frame during playback.  I tried making a scriptJob using the event “timeChanged”, as well as the condition “playingBack” and the ‘timeChange’ attribute.  The script only runs after the last frame of playback though, so I’m assuming Maya’s event handler is “locked” during playback.  Does anyone know of any solutions or workarounds to this?  Do I need to start learning the Maya API?  Thanks!

Windows 7
Maya 2011 x64
Python



- Howard Hsu http://www.linkedin.com/in/howardab234

Now using:
Windows XP 64 Pro v2003 SP2 (yes XP64 is still around)
Core 2 Quad CPU Q6600 @ 2.4GHz
2GB RAM
NVidia GeForce 8800 GTX

Max 2008 x64
Maya 2008 64
MotionBuilder 7.5

Replies: 1
/userdata/avatar/7p2qf3yyg_johnC.jpg

Can you use an expression?

Author: John Creson

Replied: 05 August 2011 04:34 AM  
avatar
  • .A_K.
  • Posted: 15 February 2011 04:21 PM

Hi, I’ve been looking into this thing as well, I wrote a script that would react to the playback being ON or OFF.

Everything worked fine till at one point I have restarted Maya , now it just reacts only after I stop scrubbing the timeline, can’t figure out what changed!!!!????

It did work perfectly fine at first. Tried other events and conditions connected to the time line, getting the same result every time :(



Replies: 0
avatar
  • .A_K.
  • Posted: 16 February 2011 02:35 PM

here is another method,using a MEL call, add this to have the functions you have created execute at press or release, though this doesn’t execute on simple playback, have to look into that as well, might be that the (playingBack) thing is buggy in python:

import maya.mel
playBackSlider 
maya.mel.eval('$tmpVar=$gPlayBackSlider')
mc
.timeControlplayBackSlider,edit=True,pressCommand='YourFunction1()',releaseCommand='YourFunction2()')


Replies: 0