It's been a while since my last post. The reason is that work's keeping me really busy and i'm learning a lot about Python and MEL.
The last couple of weeks i 've left temporarily rigging the props and i 've got back to scripting.
It happens that some of the main characters' rigs cannot use FK because the dynamics don't work, so i was talking to one of the lead animators and he came up with an idea, and i was the one to code it and make it possible. I did several scripts that accomplish all the tasks the lead animator asked for the main and secondary characters. Still it has to be tested by the art director and the other lead animators but it feels like it's really useful since it mimics an FK chain with IK controls.
One of the scripts is a panel with selection buttons. Those buttons select each locator so they can animate the locators and then bake the animation.
In MEL we have the "select -r <whatever>" which selects the new by replacing the old. Also we have "select -tgl <whatever>" which adds the selected to the current selection.
The MEL code for a button is:
button -label $label -command $command
Where $command stands for some sort of "select" as described before. The problem is none of them
works as it should. I wanted to "select -r" replace but with the ability to Shift Select other locators, this is to add them to the selection if i use Shift just like Maya works.
The solution is to add the following line of code to the $command:
So that finally the button code results like this:
string $command = "string $object=\"object_name_to_select\"; int $mods = `getModifiers`; if (($mods)%2 == 1) select -add $object; else select $object;";
button -label $label -command $command
I'd like to post some rigs i've done but i'm afraid i cannot show the models due to confidentiality terms.
No hay comentarios:
Publicar un comentario