Animation plot data

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 02 February 2013   #1
Animation plot data

Hi,

Does anybody know if there is a way to export the plot data from the graph editor in Maya? I can see the time/value plot data using Spreadsheet... from the Curves menu in the graph editor, but would like to be able to export this to create a graph in other software (such as MatLab or Excel) using time as the x axis and the value as the y axis.

Any ideas?

Cheers,

Andy
 
Old 02 February 2013   #2
You can easily do this with a script, either MEL or Python. The latter would probably be recommendable due to it's more advanced string editing methods and most importantly the inclusion of an XML module.


Edit:

here's some example python code. very simple, creates an xml on C: with the time/value information for every curve selected in the GraphEditor

import maya.cmds as cmds
from xml.dom.minidom import Document

xmlDoc = Document()

root = xmlDoc.createElement('curveData')
xmlDoc.appendChild(root)


animCurves = cmds.keyframe(query=True, name=True, sl=True)

for c in animCurves:
	
	curveElement = xmlDoc.createElement('curve')
	curveElement.setAttribute('name', str(c))
	root.appendChild(curveElement)
	keyTimes = cmds.keyframe(c, q=True, tc=True)
	for t in keyTimes:
		
		frameElement = xmlDoc.createElement('frame')
		curveElement.appendChild(frameElement)
		
		value = cmds.keyframe(c, time=(t,), q=True, vc=True)[0]
		frameElement.setAttribute('time', str(t))
		frameElement.setAttribute('value', str(value))
		
file = open('C:/animInfo.xml', 'w')
file.write(xmlDoc.toprettyxml())
file.close()

Last edited by Nyro : 02 February 2013 at 07:27 PM.
 
Old 02 February 2013   #3
Built in method (...read 'Not pretty')

File>Export[] choose move format.

Altho' if I had need to do something like this often I'd write/use something like what Nyro was kind enough to write above
 
Old 02 February 2013   #4
Many thanks for the reply's. I couldn't find a built in method, not sure I fully understood the post, but I have Export All and Export Selection, and I think this just relates to the objects within the scene rather than plot data for the anim curves.

I tried the script and got this error...

# Error: IOError: 13 #

You'll have to excuse my dumbness, I've no experience with scripting.

Last edited by andyman121 : 02 February 2013 at 06:22 PM.
 
Old 02 February 2013   #5
Can you turn on linenumbers in errors? You can do that in the script Editors menu.

But just by looking at the error, I'm guessing you either a) don't have a C: drive because you're not on Windows (are you using a Mac?) or b) you don't have file creation/write permission.
 
Old 02 February 2013   #6
Hi, yes with line numbers this is the error:

# Error: line 1: IOError: file <maya console> line 27: 13 #

I am on windows and do have a C drive, and on my home PC so should have full permissions
 
Old 02 February 2013   #7
weird. works perfectly for me.

Try creating the file manually first (just create an empty textfile and rename it to animInfo.xml)
 
Old 02 February 2013   #8
Done.

Apparently I didn't have permission to save to C: as you suggested earlier, and I found out when trying to create the file manually. Strange that - I must have changed the permissions at some point (or the computer has gone off on one)

I changed to save to my H: and it worked fine.

Thanks for your help!! (y)
 
Old 02 February 2013   #9
Quote: I couldn't find a built in method, not sure I fully understood the post, but I have Export All and Export Selection, and I think this just relates to the objects within the scene rather than plot data for the anim curves.


File>Export Selection... File Of Type == move
select channels | From ChannelBox > Save
Saved move file has saved values of channels/time

I mainly use this for bring info in from afterEffects, but hey, it's all plain text
 
Old 02 February 2013   #10
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 03:09 PM.


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