top of page
  • Mason Smigel

Updated: Mar 22, 2022

Setting up an organized project structure is essential for maintaining and collaborating on large-scale projects. RIGAMJIG2 is designed to be simple, flexible, and logical so it makes sense to not only me but other TDs.

ree


Maya environment

I used Maya's Module system to keep track of data within Maya's environment variables. This allows me to use a single .mod file to add all the icons, scripts, and plugins into Maya's environment variables on startup.


Using modules also makes it simple to install rigamajig2. Using the techniques from Christian Akesson's tutorial I wrote a simple drag and drop installer to create the .mod file and load in the scripts and plugins.


""" Drag and Drop installer for rigamajig2"""
import os
import sys

import pymel.util
import maya.cmds as cmds

def onMayaDroppedPythonFile(*args):
    # Get the location of the installer
    installer_path = __file__.replace('\\', '/')

    # from the installer path build other important paths.
    module_root = os.path.dirname(installer_path)
    python_path = os.path.join(module_root, 'scripts')
    plugin_path = os.path.join(module_root, 'plug-ins')
    lib_path = os.path.join(module_root, 'scripts', 'lib')

    # Check if the modules directory exists in the user preference directory (if it doesn't, create it)
    maya_moddir_path = '{}/modules'.format(pymel.util.getEnv('MAYA_APP_DIR'))
    if not os.path.exists(maya_moddir_path):
        os.makedirs(maya_moddir_path)

    # Define the module file path
    maya_mod_file = '{}/rigamajig2.mod'.format(maya_moddir_path)

    # Write our module file
    with open(maya_mod_file, 'w') as moduleFile:

        output = '+ rigamajig2 1.0 {}'.format(module_root)
        output += '\r\nPYTHONPATH += {}'.format(lib_path)
        # Add the path to plugin path on first use
        if plugin_path not in pymel.util.getEnv("MAYA_PLUG_IN_PATH"):
            pymel.util.putEnv("MAYA_PLUG_IN_PATH", [pymel.util.getEnv("MAYA_PLUG_IN_PATH"), plugin_path])

        moduleFile.write(output)

    # add the python path on first use
    if python_path not in sys.path:
        sys.path.append(python_path)
    if lib_path not in sys.path:
        sys.path.append(lib_path)

Project structure

rigamajig2/
|-- archetypes/
|   |-- base/
|   |-- biped/
|   |-- quadruped/
|-- bin/
|-- icons/
|-- misc/
|-- plug-ins/
|-- scripts/
|   |-- lib/
|   |-- rigamajig2/
|   |   |-- maya/
|   |   |   |-- anim/
|   |   |   |-- cmpts/
|   |   |   |-- data/
|   |   |   |-- rig/
|   |   |   |-- test/
|   |   |-- shared/
|   |   |-- ui/
|-- tests/
|-- .gitignore
|-- drag_into_maya.py
|-- README.md

archetypes: rig archetypes or presets. Each archetype contains data to act as a starting point when constructing a rig.


bin: executable files. This should be added to a system path to run from the terminal.


icons: icons used within UI or shelves. This is added to the XBMLANGPATH environment variable.


misc: random assets or files. (ex. poly modeled axis marker file)


plug-ins: plugins. This is added to the MAYA_PLUG_IN_PATH environment variable.


scripts: python and Mel scripts. This is added to the PYTHONPATH and MAYA_SCRIPT_PATH environment variables.


lib: external python libraries. For this project we only need NumPy.


rigamajig2: python module for rigamajig2


maya: scripts for Maya. At the root level, the scripts should be largely independent of other modules and are combined together later.

(ex. matrix constrain, match transform, create nodes, cleanup mesh).


anim: scripts for animation. (ex. mirror pose, ikfk matching)


cmpts: components used in rig build. Components are python classes with specific methods and parameters used in the rig builder.

(ex. arm, leg, cog, lookAt)


data: scripts to manage saving and loading data from Maya to JSON.

(ex. hierarchy data, skin data, joint data, blendshape data, curve data)


rig: scripts for building rigs, but not whole components. (ex. controls, rig builder, ikfk setups, ik spline setup, space switching)


test: contains Maya unit test runner


shared: scripts not related to Maya or another DCC.


ui: python scripts for UIs and custom PySide widgets


tests: python files for unit testing. All files here are run when using the 'runmayaunittest' executable.


.gitignore: git file to specify files not under VCS


drag_into_maya.py: drag and drop installer


README.md: markdown document containing basic documentation about rigamajig2

  • Mason Smigel

Updated: Mar 23, 2022

When working on rigamajig2 setting up an efficient development environment was crucial for maintaining and organizing code. In the past I have primarily relied on the Maya script editor or Chris Zurbriggs Charcoal editor 2, however the scale of this project would not allow me to work out of only the script editor.


For development of rigamajig2, I opted to use PyCharm as my primary IDE. For easier use and access within Maya, I also used the plugin MayaCharm which simply forms a connection between the PyCharm UI and Maya to avoid constantly switching between the two applications. For quick development the charcoal editor allowed me to quickly test and experiment with code. Finally, I used Git as my version control system (VCS) within PyCharm.


ree


Python interperter

The first step to preparing PyCharm as a Maya IDE was to add the Maya Python interpreter as the main interpreter for the project.

To add a new Python interpreter in PyCharm. 1. Open the preferences window

2. Navigate to the Project> Project Interpreter panel

3. Click the gear icon and press add.

4. Locate and select the mayapy Python interpreter

MAC: /Applications/Autodesk/<version>/Maya.app/Contents/bin/mayapy
WIN: C:\Program Files\Autodesk\<version>\bin\mayapy.exe

5. Press 'OK' to add the new interpreter


ree

In my case I chose to lock into Maya2020 so I could utilize the new matrix options without fully committing to Python 3 (rigamajig2 is forward compatible with Python 3).


Auto complete

I'm a pretty terrible speller so auto-completion is also a huge productivity booster for me, and it's super easy to add Maya auto-complete in PyCharm.


1. Download and install the Maya devkit

2. Navigate to the Project> Project Interpreter panel

3. Select "Show All..." in the project interpreter dropdown

4. Click the folder icon to edit interpreter paths

5. Add the Python Stubs path from the devkit

MAC: /Applications/Autodesk/maya2020/devkit/other/pymel/extras/completion/py
WIN: C:\Program Files\Autodesk\Maya2019\devkit\other\pymel\extras\completion\py

6. Remove the site-package paths from the interpreter paths


ree

ree

Auto complete works with both Maya commands and open Maya.


MayaCharm

MayaCharm is pretty simple to install, navigate to the plugins option of the preferences, search MayaCharm and install it. To begin using MayaCharm:


1. Create a new configuration and select MayaCharm

2. Select a file to execute (Most of the time for this I like to use a scratch file to store the temp code to run within maya)

3. Open Maya if its not already running

4. Prepare Maya to receive code from PyCharm by opening a command port:

# connect maya to PyCharm
if not cmds.commandPort(':4434', query=True):
    cmds.commandPort(name=':4434')

This can also be added to your userSetup.py

5. In PyCharm navigate to Run> Connect to Maya's Log to see log messages from Maya inside PyCharm

6. Click the execute button. The Code should run within Maya


You can also use alt + S and alt + A to run the selected code or document within Maya.


ree

GIT

For rigamajig2 I used Git for version control. Jetbrains has great documentation about using Git within PyCharm.


Updated: Jan 17, 2023

Over a year ago I built my first automated rigging system for Maya (Rigmajig). It was a huge step up from manually building character rigs, and allowed me to rig characters very quickly. However, after using the system for over a year on dozens of rigs the faults became painstakingly apparent. I decided to tackle rebuilding a new modular rigging system, building upon what I learned from the previous version, as well as adding new functionally based on things the first version was missing. Over the span of the next several months, I plan to record progress, on rigamajig2.



THE PROBLEM:


Rigging is a complex process that involves many elements of production. rigamajig2 aims to simplify three key areas:

  • Pipeline scalability

  • Rigger interface

  • Animator interface


Pipeline scalability:

  • SCAD currently has no unified rig building pipeline. Rigs are often created as one-off products with the delivery as a Maya file.

  • This can cause a bottleneck in the pipeline, with production slowing because of model or manual rig updates.

  • Working in this way also makes rigging massive amounts of assets not only cumbersome but unrealistic


Rigger interface

  • Auto-rigging solutions may offer immediate speed boosts to rig time, however extending rigs beyond the capability of the built-in functionality. Additionally, the artist-guided setup can be confusing, overly complex, or otherwise un-intuitive.

Animation interface

  • The end goal is to create a speedy rig with beautiful deformations. Reaching peak performance while also providing artists with the needed controls to fine-tune poses.



THE SOLUTION:


Pipeline Scalability:

  • The system must be 100% modular. Components can be connected anywhere on any other component.

  • Rigs must be data-centric. All elements should be exported and saved, allowing the rig to be completely rebuilt from several lines of code.

  • A scalable pipeline should support large quantities of assets along with variants.


Rigger interface:

  • Simple component authoring, components can easily be created by additional TD's

  • Compartmentalized components. Each component can stand on its own receiving inputs into a single node, at least in the rigger interface. (Cult of Rig style )

  • Laying out guides or joints should be intuitive.


Animator interface:

  • Rig performance as close to real-time as possible.

  • Optimization of setup. Extra attributes and nodes to make the setup easier to modify for the rigger are baked and removed.

  • All Rigging information will be stored in meta nodes in the deliverable Maya scene. (Allowing for fun bells and whistles like space matching, Ik/Fk matching, and more.)


The workflow is also defined into several sections. Allowing users to interact with rigamajig2 at a very low level (for TDs) or a high level (Animators)

  1. Author Interface: Python framework of utilities used to create components or perform other operations in Maya.

  2. Rigger Interface: User Interface for riggers to build rigs using pre-constructed components and archetypes.

  3. Animator Interface: Deliverable rig complete with animation interface to access quick control selections, Ik/Fk match, and more.


ree

MEASUREMENT OF SUCCESS:


Variants:

rigamajig2 should be capable of easily creating numerous quantities of variants falling under three categories.

  • Model Variants

  • Look Variants

  • Rig Variants


Pipeline:

rigamajig2 is capable of building a rig from a single file in only several lines of code. This should scale to building multiple files at once.


Rig:

The deliverable rigs should be fast, intuitive and easy to use. It should be designed to contain an optimal amount of controls, so the animator can easily pose, but has the ability to fine-tune small details.




bottom of page