PDA

View Full Version : character set query/activation


backwheelbates
04-14-2009, 07:02 AM
Hi,

Im trying to make a script that will make active a character set based on the current selection, but I'm not really sure where to start. The "character" command doesn't seem to work this way.

ex. I have a scene with lots of characters, so for animation I'm doing a lot of jumping around between character sets. To speed up my work flow, I would like to select an animation control curve in the viewport, then run the script to make whatever character set it corresponds to the active character set.

user select-> character_87_bodyControl
run script->
-> check object input, query linked character set
-> activate that character set


Thanks for any ideas!

Cheers.

Mark-J
04-14-2009, 08:14 AM
the character command is pretty limiting, better to check the connections directly;

string $objs[] = `ls -sl -l`;
string $ChSet[] = `listConnections -type "character" $objs[0]`;
ClearCurrentCharacterList;
setCurrentCharacters( { $ChSet[0] } );

should do what you're after. Actually it's a nice idea, never thought of switching the active one by default.

Mark

backwheelbates
04-15-2009, 05:56 AM
That's terrific! Exactly what I was aiming for, thanks Mark-J:)

backwheelbates
04-15-2009, 07:45 AM
I added a couple of bits of code that will clear the characterSet when you run the script with nothing selected, or with an object that doesn't belong to a character set. This will makes it easy to flip character sets on and off as well.

I put it on a hotkey and it works great!


string $objs[] = `ls -sl -l`;
if (size($objs)==0){
ClearCurrentCharacterList;
}else{
string $ChSet[] = `listConnections -type "character" $objs[0]`;
ClearCurrentCharacterList;
if (size($ChSet)>0){
setCurrentCharacters( { $ChSet[0] } );
}}

Cheers:) Thanks again!!

CGTalk Moderation
04-15-2009, 07:45 AM
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.