Maya hangs after script fails to execute during playback

19 views
Skip to first unread message

Geoffrey Beatty

unread,
Apr 29, 2013, 12:37:23 PM4/29/13
to python_in...@googlegroups.com
Project on GitHub: https://github.com/germantownstudios/AirSketch-Maya
Some tests on Vimeo: https://vimeo.com/album/2300835

Continuing work on my project to use a mobile device's motion to draw 3D strokes within Maya. It's basically working, but I have a little glitch that is causing Maya to crash.

The iPhone app basically calls (over the network after a socket has been opened) functions I've defined in a host-side python script.

First, it creates a locator and attaches the device motion output to it, essentially moving it around the screen.

Next, pressing the record button causes playback to start with recording enabled. The user moves the device and this records the motion as keyframes. I've capped it at 100 frames.

Finally, when the user releases the button, it stops playback, converts the keyframes into a motion trail, converts that into a curve, then finally attaches a paint effects stroke to it.

Now, this last step is where the crash sometimes occurs. If the script to stop playback and initiate the curve fails to execute, the timeline plays to the end. Anything I do after that point causes Maya to crash, even opening a new scene.

What am I missing here? Is that script causing a resource conflict under the surface? How do I begin to troubleshoot something like this? Is there a way to just wait until playback ends to call the script each time, rather than trying to interrupt it (which is not reliably working)?

Thanks in advance for your help.

Geoffrey Beatty

unread,
May 1, 2013, 10:26:54 AM5/1/13
to python_in...@googlegroups.com
Okay, I realized that all it takes is manually advancing in code (accomplished through setting a timer) and setting the keyframes at each moment. Works like a charm - no more crashing. Also, there's no need to hard-code the timeline. Here's what I came up with (recordMotion is called by a timer in the iOS code):

def recordMotion():
cmds.setKeyframe('drawLoc', at='translateX')
cmds.setKeyframe('drawLoc', at='translateY')
cmds.setKeyframe('drawLoc', at='translateZ')
cmds.currentTime((cmds.currentTime(query=True))+1)

Ævar Guðmundsson

unread,
May 25, 2013, 8:27:08 AM5/25/13
to python_in...@googlegroups.com
Was reading through your github and watching the demo videos just now, impressive stuff.

Have you tried, as you have the connection already in there, to use the motion to control the built it grease pencil tool? It sounds like that way you get away with a lot less room for error and should get instant draw feedback if you "stagger" your connection a little bit, pulses rather than a steady stream so to say.
Sorry I can't offer any more practical help, only just started playing with the grease pencil myself but will post here if I stumble on anything to this regard.

Geoffrey Beatty

unread,
May 28, 2013, 6:00:54 PM5/28/13
to python_in...@googlegroups.com
Thanks! That's a great suggestion. I don't have 2014 to play around with yet, but will try to get it working as soon as I do. Right now just using a locator as the "cursor."



--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/IPz5ByDHxH8/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To post to this group, send email to python_in...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Reply all
Reply to author
Forward
0 new messages