• Mason Smigel

Building a rig

Updated: Mar 23

Building a rig requires more than just the components, it also requires inputs like the model, skeleton, and post-build operations like constructing deformations, pose readers, and final publishing steps.


For this rigamajig2 uses the builder, a system of short scripts to wrap up all the required methods to build a rig.



Managing data

Rigs contain a lot of data. A key design choice of rigamajig2 was that almost all data is saved outside of Maya so the entire rig can be rebuilt. or this, the builder relies on an external folder structure to manage the data.



The builder uses a .rig file to store relative paths to data needed in the build. The build has the functionality to both load and save the data for the rig.

{
    "type": "AbstractData", 
    "user": "masonsmigel", 
    "time": "2021-11-22 23:12:13", 
    "data": {
        "model_file": null, 
        "skeleton_file": "skeleton.ma", 
        "skeleton_pos": "skeleton_pos.json", 
        "pre_scripts": [], 
        "post_scripts": [], 
        "pub_scripts": [], 
        "control_shapes" : "controlShapes.json", 
        "guides": "guides.json",
        "components": "components.json",
        "psd": "psd.json",
        "output_file": "../out/biped_rig.ma"
    }

An example .rig file



Using the builder


The builder class is a system of methods to sequentially run code. Under the hood the code looks like this:


import rigamajig2.maya.rig.builder as builder

# initialize the builder 
path = "/Users/masonsmigel/Documents/dev/maya/rigamajig2/archetypes/biped/biped.rig"
b = builder.Builder(rigFile=path)

# artist can manually run each step... 
b.load_required_plugins()
b.pre_script()
b.import_model()
b.import_skeleton()
b.load_joint_positions()
b.load_components()
b.initalize()
b.build()
b.connect()
b.finalize()
b.load_controlShapes()
b.load_deform_data()
b.post_script()
b.optimize()
b.pub_script()
b.publish()

# ... or use the run() method to run all the above code at once. 
b.run()

Because rigamajig2 relies entirely on external data the final rig can be built without any manual input. The primary method for publishing rigs to the end-user (aka animator) is to use the command line since it seems a bit silly to wait for Maya to boot up just to run a script that doesn't require the rigger.


Using the command line allows the rigger to rebuild multiple rigs at once. As an example use case, if a bug is found in the rig and is present across all characters in a production a TD could adjust the code in the component and rebuild all rigs to push the change to the animators.


However, the command line is only useful during the publishing phase of building a rig, while data is still being created the builder UI allows users to more intuitively edit and walk through rig construction step by step.

Between steps, the rigger has time to author new data within Maya. This can range from positioning joints and guides to editing control shapes to skinning and blendshapes. All this data is pushed back to external files in the rig environment and referenced the next time the rig is built.