View Full Version : delete/break setDriven key via mel help?
02-27-2008, 06:48 PM
An artist is using the UI to break a set driven key, and I am trying to hunt down how to do that via mel without driving the UI. The function CBdeleteConnection() is called by the UI. How does one break a set driven key on a specific channel box attribute. Anyone know what functions do the same command without having to drive the UI?
With the help of one of the other Technical Artist at work I now have been enlightened on the matter and I thought I would share.
When you make a setDriven key in Maya it acturally creates a new node (per channel) inbetween your driven and driver attributes. In my example I just made two cubes and set one cubes translateX to drive the translateX on the second cube. If you querry the input and output connections in HG you will see the new node inbetween.
This new node is an AnimationCurve. There are 7 types of animation curves from what I was told. So, to get rid of them, all you really have to do, is querry the connections of your object via listConnections. The walk though the connections and verify that they are animation curves via the handy isAnimCurve function and then delete the node if true.
Here's the sudo-code version.
// list your connection from your object, put in var
// verify that the input connection is a AnimationCurve
// delete :)
Hope that helps someone out there. I didn't see any write ups on this matter. Most threads are about creating, not deleting.
02-28-2008, 02:48 AM
thank you for sharing about the isAnimCuve command..
but i noticed it returns 1, even for the animCurveTL , animCurveTA and animCurveTU nodes - which are regular animation curve nodes
so i thought i'd share one more specific way to find out (in a situation where the obj is animated + has some sdk and u want to do something to sdk nodes only...)
string $concSDKNodes=`listConnections -s 0 -d 1 -type "animCurveUA" $obj`;
string $tmp=`listConnections -s 0 -d 1 -type "animCurveUL" $obj`;
$tmp=`listConnections -s 0 -d 1 -type "animCurveUU" $obj`;
print $concSDKNodes; // should return only the SDK nodes connected to the $obj :)
I'd love to just use string $concSDKNodes = `listConnections -s 0 -d 1 -type "animCurveUL" -type "animCurveUA" -type "animCurveUU" $obj`; just one sweet line ! but -type flag cannot be repeated :shrug:
02-29-2008, 10:03 PM
Very cool. I have to admit that I am a bit green on the animation side of Maya. I haven't worked on a lot of movie rigs, and game rigs can be extemely simple. So I have a lot to learn, but I guess that is always the case in 3D. :)
02-29-2008, 10:03 PM
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.