After speaking with Dan about what I want to do in the future, he suggested I start looking into MEL scripting. I started to have a look at simple code like selecting things, de-selecting things, creating objects, moving objects etc. I thought it would be good to practice more advanced script so whilst rigging the cat, I have left the script editor open so I can see the script as I do things.
I have been keeping the script editor open and looking at the script every time I do something. This has given me an idea of how the script will look and has allowed me to deconstruct the script so when I write script, I know what to write to make it do certain things. It has meant learning script has become quite easy and fast so that I could create my own scripts shortly afterwards.
This lead me to figure out how to create set driven keys for the cat's paws. I created script to key each toe to the driver that I selected. I had to then move the joints manually as I have not quite finessed that part yet but then could key each movement to the driver to create the desired effect.
This was the script, it is only for one foot at a time and one driven key at a time.
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Bend Rightbackfirsttoe1.translateX;
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Bend Rightbackfirsttoe1.rotateZ;
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Bend Rightbacksecondtoe1.translateX;
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Bend Rightbacksecondtoe1.rotateZ;
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Bend Rightbackthirdtoe1.translateX;
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Bend Rightbackthirdtoe1.rotateZ;
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Bend Rightbackfourthtoe1.translateX;
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Bend Rightbackfourthtoe1.rotateZ;
I had to change the attribute name for each foot and for each driver. For example this was to create set driven keys for the bend attribute but for the stretch attribute each section of script would be changed to:
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Stretch Rightbackfirsttoe1.translateX;
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Stretch Rightbackfirsttoe1.translateY;
setDrivenKeyframe -currentDriver Rightbackfootcontrol.Stretch Rightbackfirsttoe1.rotateZ;
The stretch effects more attributes so they have also been added. The name of the control would change with each foot too depending on what I have named them. After writing all the script, this was the final outcome.
No comments:
Post a Comment