Maya for 3D Printing - Rapid Prototyping
In this course we're going to look at something a little different, creating technically accurate 3D printed parts.
# 1 28-02-2016 , 07:37 AM
Registered User
Join Date: Feb 2016
Posts: 6

How do I get the selected curve name?

I'm trying to get the name of the selected curve in the Graph Editor.
For example: pSphere.scaleX (note the period!)

1) If I try this:
string $curves[] = `keyframe -selected -q -name`;
I get this: pSphere_scaleX (note the underscore instead of the period!)

2) If I try this:
string $connection = `editor -q -mainListConnection graphEditor1GraphEd`;
string $curves[] = `expandSelectionConnectionAsArray $connection`;
I get this, but it gives me ALL curves in the channel list, not the selected curve:
pSphere.scaleX pSphere.scaleY pSphere.scaleZ

keyframe -selected -q -name would work great, if only it didn't replace the period with an underscore...

Also, I can't simply substituteAllString "_" with "." because some object names contain underscores, and it would result in this other problem:
Ctrl_Upper_Head.rotateX //this is the real correct curve name
Ctrl_Upper_Head_rotateX //keyframe -selected -q -name would give me this
Ctrl.Upper.Head.rotateX //substituteAllString($curves[0], "_", ".") would give me this

Thank you for your help in advance!

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads