Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
I want to give credit and thanks to Marco Giordano who made a tutorial on Vimeo for the original setup, and to Wade Ryer who demoed this setup in his facial rigging workshop.
SETUP: Copy the script to your "C:\Users\<USERNAME>\Documents\maya\<MAYAVERSION>\scripts" folder. Run this command in the script editor or commandline as a Python script:
from eyeLidSetupTool import EyeLidSetupUI EyeLidSetupUI.mayaRun()
If you only copy/paste the code into Maya Script Editor than add this to the last line:
DESCRIPTION: To use the tool you need to have an object that represents the eye center, the eye joint is great to use. The tool also requires an upper lid curve and a lower lid curve that represents the border of each one.
To create the curves start by selecting the edges of your upper lid border and go into the "Edit Curve" menu in the tool and select "Create From Selection". Do the same thing for the lower lid curve and be careful not to select the edges that represent the upper lid, the upper lid curve will show in pink when in edge selection mode. When both curves are created rename them and check the direction of the curve. IMPORTANT: The curve direction needs to be from the inner corner of the eye to the outer.
To check the direction of the curves, select the curves and go in to component mode, the start of the curve has a little "u" as the second vertex to indicate the direction. If the direction is wrong, select the curve and from the "Edit Curve" menu in the tool select "Reverse Direction". Load the eye center object and the curves to the tool text fields and hit "Build Eye Rig" If everything went as it supposed to, you should have an eye rig created :)
The joints that you skin to the mesh are located in the "lid_parentToHeadGrp" >> "lidSkinJntsGrp" >> "uplidJntGrp" and "lolidJntGrp". The skin joints are post-fixed with "_s" they can be found as child joints to the base joints with "_jnt" as post-fix. Select all the base joints and press the down arrow once on your keyboard for easy selection. Add the selected joints to your skinned mesh. There will be one skinned joint for each vertex on the lid boarder.