CGTalk > Software > Autodesk Maya
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 02-07-2013, 03:42 PM   #1
andyman121
Veteran
portfolio
Andrew Brownridge
Manchester, United Kingdom
 
Join Date: Oct 2010
Posts: 75
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-07-2013, 06:06 PM   #2
Nyro
Lurking
 
Nyro's Avatar
portfolio
A. D.
Vertex Slinger
Munich, Germany
 
Join Date: Dec 2006
Posts: 1,436
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

Code:
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-07-2013 at 07:27 PM.
 
Old 02-07-2013, 10:07 PM   #3
Faux
Expert
portfolio
Dee Mae
Salis, GB
 
Join Date: Jun 2008
Posts: 369
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-08-2013, 04:32 PM   #4
andyman121
Veteran
portfolio
Andrew Brownridge
Manchester, United Kingdom
 
Join Date: Oct 2010
Posts: 75
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-08-2013 at 06:22 PM.
 
Old 02-08-2013, 06:40 PM   #5
Nyro
Lurking
 
Nyro's Avatar
portfolio
A. D.
Vertex Slinger
Munich, Germany
 
Join Date: Dec 2006
Posts: 1,436
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-08-2013, 06:48 PM   #6
andyman121
Veteran
portfolio
Andrew Brownridge
Manchester, United Kingdom
 
Join Date: Oct 2010
Posts: 75
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-08-2013, 06:56 PM   #7
Nyro
Lurking
 
Nyro's Avatar
portfolio
A. D.
Vertex Slinger
Munich, Germany
 
Join Date: Dec 2006
Posts: 1,436
weird. works perfectly for me.

Try creating the file manually first (just create an empty textfile and rename it to animInfo.xml)
 
Old 02-08-2013, 07:55 PM   #8
andyman121
Veteran
portfolio
Andrew Brownridge
Manchester, United Kingdom
 
Join Date: Oct 2010
Posts: 75
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-08-2013, 09:16 PM   #9
Faux
Expert
portfolio
Dee Mae
Salis, GB
 
Join Date: Jun 2008
Posts: 369
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-08-2013, 09:16 PM   #10
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,480
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 06:56 PM.


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