Interactive auto keyframe

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 09 September 2012   #1
Interactive auto keyframe


I am animating a character in the viewport using some controls. I would like to save the animation (keyframe) exactly at the rate that I animated it. The only thing that comes to mind is a job script timer event that keyframes the controls. Is there an already made / a better method?

Old 09 September 2012   #2

This thread has the command that you are looking for.
I am sure you can bend it to your will:
Old 09 September 2012   #3

Use the mouse as a capture device. A few pitfalls: The rotation units need to be radians, else it won't capture rotations. Also don't forget to delete old keys, since it only adds new ones.

playbackOptions -min 0 -max 400 -ps 1;
  string $curAngleUnits = `currentUnit -q -a`; // Get the current angle units
  currentUnit -a rad; // Temporary set to radians
  recordAttr -at "rotate" -at "translate"; // Set attributes to record
  play -record;
  currentUnit -a ($curAngleUnits); // Reset back to defaults
Old 09 September 2012   #4
Do you have this bug (maya 2013) while recording when clicking the outliner all the text in the outliner disappears but is still click-able?
Old 09 September 2012   #5
Also after opening another scene after a recording session would mostly crash maya.

But a major bug, which I can't seem to circumvent (except writing the whole damn thing from scratch which I don't have time for) is when recording a camera movement. It seems that someone with good intentions in autodesk wanted to save us some space and record only the changes, but in camera recording if there's a large distance between keyframes the camera would slowly float, interpolating small values.

Is there a way to tell maya to record any frame?
Old 09 September 2012   #6
I wrote my own version that saves each keyframe:

Execute it with:

import record_mouse 
#reload(record_mouse) # reloading resets the global vars

If anyone has suggestions how to improve it, I would welcome them. I still can't overcome the inherent problem when setting and expression and playing the time slider the outliner list disappears.
Old 09 September 2012   #7
It seems that my script work well only for the camera, and hides the gizmos for the objects.
Which means that only a mocap plugin might do the work, and it doesn't really worth the effort.
Maya is so lame!
Old 09 September 2012   #8
At least I wrote something that fixes the camera drift:

import record_mouse 
Old 10 October 2012   #9
Could you advice me how to install your script? I tried running it and nothing happened.
Q1 2011 Reel
Old 10 October 2012   #10
Sorry, it's not meant as an off-the-shelf script for the public, but more of a quick'n'dirty proof of concept for programmers. For example fix_camera_drift() looks for a (hard coded) camera named:

obj = 'cam_anim'

instead of querying the selection.

Nevertheless, I assume you are referring to the fix_camera_drift(). Set in your scene a camera named 'cam_anim'. Put my script in the script path, and set to a button my code above.
The function should be called with two parameters, and if the threshold isn't passed then nothing happens:

def fix_camera_drift(thresh=0.06, min_span=20):

The script overwrites key frames that are only a small perturbation of their previous (a smarter script should delete them altogether). A debug is written to the script editor.

Good luck...
Old 01 January 2013   #11
Originally Posted by zoharl: Coo.oo.ool!

Use the mouse as a capture device. A few pitfalls: The rotation units need to be radians, else it won't capture rotations. Also don't forget to delete old keys, since it only adds new ones.

recordAttr -at "rotate" -at "translate"; // Set attributes to record
   play -record;

recordAttr / play -record makes my Maya very unstable. I've tried 2012 and 2013 but both are crashing intermittently after running those commands. Have you had any similar problems? Not many people use this command which makes finding info very problematic.

Its very possible this issue pushes me to C4D which seems to handle mouse mocap very nicely.
Old 01 January 2013   #12
Yes, I get crashes here and there. And you should probably save the scene and restart maya after the recording. Also try to execute the two lines in two difference executions (also a garlic near the computer can't hurt...). But hey, else it wouldn't have been maya otherwise, right?
Old 04 April 2013   #13
Are there any plugins that I can use for mouse capture instead?
Old 04 April 2013   #14
Would you like to write one?
Old 04 April 2013   #15
Originally Posted by zoharl: Would you like me to write one?

YES! Thank you!! J/K

There are a lot of things I would like to do. Reality sets in.

I have verified that Maya 2009 also crashes with these commands. I can't find any such issues circa 2006 via Google.

I am trying workarounds. Like recording an alias to the transform, instead of the transform itself. Some other things come to mind.

Is this a memory leak? Any ideas at all? I've tried deleting the record nodes and deleting history.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:58 AM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.