Introduction to Maya - Modeling Fundamentals Vol 1
This course will look at the fundamentals of modeling in Maya with an emphasis on creating good topology. We'll look at what makes a good model in Maya and why objects are modeled in the way they are.
# 1 17-07-2004 , 01:31 AM
Registered User
Join Date: Jul 2004
Location: Vancouver
Posts: 9

test if channel has animation

Is there a mel command to determine whether a given channel of an object is animated or not ?

Thanks ...

# 2 17-07-2004 , 02:10 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Hi Suzie. Maybe the listConnections command could be used to determine if a given channel is connected to anything (eg an animation curve, expression or sometehing else). Let's say that you want to test if the rotateZ of a nurbsSphere1 is controlled by something:

Code:
{
	string $sAttrConn[]= `listConnections -source 1 -destination 0 nurbsSphere1.rotateZ`;

	if( size($sAttrConn) > 0 )
		print("nurbsSphere1.rotateZ is controlled by something");
	else
		print("nurbsSphere1.rotateZ is not controlled by anything");
}


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 3 17-07-2004 , 02:45 AM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Well there is the "attributeQuery" command, but I can't seem to figure out how to use it.

However, you can use a command like...

string $list[] = `listConnections pCube1`;
where pCube1 is the name of your locater to see if it has a translate or rotate node connected to it.


Hey!!!
When I first started my post, no one had replied. I was all excited to have figured this out. I got sidetracked and by the time I submitted my posting, good ole' K-man had beaten me to it.

Rats.


Last edited by Dann; 17-07-2004 at 02:47 AM.
# 4 17-07-2004 , 03:04 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
lol @ dann user added image


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 5 23-07-2004 , 05:15 AM
mark_wilkins's Avatar
Registered User
Join Date: Jan 2003
Posts: 161
The only strictly complete way to check for animation is to go through each frame and check each vertex position. However, if you're comfortable guessing that the animation will be keyed on a particular channel, doing a listConnections and looking for animCurve nodes of various types will be the simplest way.


Mark R. Wilkins
author of MEL Scripting for Maya Animators
www.melscripting.com
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