|02 February 2010||#1|
global proc yipieh ()
Join Date: Jun 2007
MEL-query custom Attributes?
just came around this. I want to Melscript all my custom attributes to zero.
so instead of having to type them all in explicit like this with the setAttr Cmd
i am wondering if anyone knew a more savvy attempt. Maybe by query all custom attributes into a list and then set the output list (array(?) all to zero.
But with querying i just can see the addAttr with -dv flag (default values). hmm...
|02 February 2010||#2|
Here you go.
This queries all user defined(custom) attributes and sort out any that are non animatable (keyable) such as message attr etc. Then with this array called $attrArray you can just put in a loop and use the setAttr command like so:
//Loop through to eval the setAttr command on each custom attribute
If there are other types of attributes except for floats such as enum or boolean you could sort them out to only allow floats in the array otherwise it will break =/ or perhaps a better choie is to query it's min or max and match to what settings you chose. IE if you set 2 and it's max is 1 then set 1.
REASON FOR EDIT:
I mistyped some and then added some more so this should work for all attributes in the channelbox. However, this also means that every custom attribute values are set to what you specified which most often is not desireable. I hope the idea is clear and you can alter it to suit your needs.
Also had to comment. often slips my mind.
Last edited by Geuse : 02 February 2010 at 03:19 PM.
|02 February 2010||#3|
Where's my pony?
vfx & creature td
Join Date: Jun 2003
I've been using one of the zooToolbox scripts for this. I dont think Hamish would mind me posting the code here. This one has the ability to reset all keyable attributes (including custom attributes) and in addition will return joints to their bind pose rather than zeroing them. It deals with the attribute limits too (by ignoring them quietly).
You could run it for each object like this
string $all = `ls -sl`;
for( $a in $all ) zooResetAttrs $a;
|02 February 2010||#4|
Join Date: Sep 2003
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.
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
|Thread Closed share thread|