Control Factory
Control Factory is a Maya tool for building, authoring, managing, and applying reusable NURBS control shapes for rigging.
The tool provides a dedicated shape library where controls can be organized into custom groups, searched, authored from existing Maya scenes, and applied to new or existing controls. Shapes can be created with customizable scale, rotation, offset, and color, or accessed programmatically through the tool's Python API.
One of the more unique features is the ability to author NURBS control shapes from polygon geometry. Mesh objects and selected mesh components can be converted into reusable NURBS curves, making it possible to use Maya's modeling tools to design control shapes.
The library is also designed to work independently of the UI. Shapes can be loaded and built through Python commands, allowing the same library to be used by autorigging systems and other tools.
Features
Shape Library - Store and reuse custom control shapes.
Shape Groups - Organize controls into custom categories.
Search - Quickly find shapes within the library.
Shape Authoring - Capture shape data directly from the Maya scene.
Mesh to Curve Conversion - Convert mesh objects and selected mesh components into NURBS curves.
Paste, Replace, and Combine - Apply shapes to existing transforms or combine multiple shapes into a single transform.
Multi-Selection - Select multiple library shapes and apply library operations to them simultaneously.
Color Management - Apply Maya indexed colors or RGB colors to controls.
Transform Controls - Scale, rotate, and offset shapes when placing them.
Pipeline Integration - Build shapes from the library programmatically using Python commands
User Interface
The Control Factory UI provides access to the shape library and scene operations from a single interface.
Shape Groups
The top of the UI contains the shape group selector. Shape groups organize the library into custom categories.
The group options allow shape groups to be added, renamed, and deleted. An All Shapes group is maintained automatically and provides access to every shape in the library.
Search and Shape Grid
The search bar filters the shapes in the current group using fuzzy matching. Matching shapes are displayed in a grid using their saved icons.
Shape buttons support both normal and multi-selection:
Single click - Sets the shape as the current shape and clears any existing multi-selection.
Shift click - Adds or removes a shape from the current multi-selection.
Double click - Builds the selected shape or shapes into the Maya scene.
The UI maintains the selected shape names separately from the visual checked state of the buttons. This allows selections to persist when changing shape groups or rebuilding the shape grid.
Shape Library Operations
The buttons below the shape grid manage the contents of the library.
Add - Adds the selected shape or shapes to the current shape group.
Delete - Removes the selected shape or shapes from the current group. When operating from the All Shapes group, deleting a shape removes it from the library and all other groups.
Rename - Renames the current shape in the library. Renaming is limited to single-shape selections.
A copied shape is temporarily stored as __copy__. Adding the copy to the library prompts for a name and moves it into the permanent library.
Scene Operations
The scene operation buttons apply library shapes to objects in the Maya scene.
Copy - Captures the selected scene shapes and stores them as a temporary library shape.
Paste - Builds the selected library shape or shapes and adds them to the selected transforms.
Replace - Replaces selected scene shapes with the selected library shape or shapes.
Combine - Moves selected NURBS curve shapes onto the first selected transform, combining them into a single control.
Paste, replace, and combine operations are grouped into Maya undo chunks so that each operation can be undone as a single action.
Color
The color button controls the color applied to scene shapes and newly created controls.
A single click applies the current color to the selected scene shapes, while a double click opens a color selector containing Maya’s index colors.
Shape Placement
The UI provides controls for scale, rotation, and offset. These values are applied when creating, pasting, or replacing shapes.
This allows the same library shape to be reused at different sizes and orientations without modifying the original library data.
Pipeline Integration
Control Factory's library can be used independently of the UI, making it suitable for integration into autorigging systems and other rigging tools.
The underlying functionality is separated into three main classes:
CtrlShapeIO
The CtrlShapeIO class handles communication with the shape library. It is responsible for reading and writing shape data, managing shape groups, resolving shape and icon paths, and maintaining the library structure.
The I/O class is initialized with the path to a shape library, allowing different tools or projects to use different libraries.
CtrlShapeAuthor
The CtrlShapeAuthor class handles extracting shape data from Maya scenes and saving it to the library. It takes a CtrlShapeIO instance in its constructor, which it uses to determine where and how shape data should be stored.
The main method for authoring shapes is .save(). It takes an MSelectionList as an argument and extracts the selected NURBS curve and mesh data, combining the selected components into a single reusable shape.
This makes it quick to populate a Control Factory library from existing Maya scenes. For example, if shapes from another library or an existing rig need to be moved into a Control Factory library, multiple shapes can be selected in the scene and saved directly into the library:
from pathlib import Path import maya.cmds as mc import maya.api.OpenMaya as om from ControlFactory.factory_author import CtrlAuthor from ControlFactory.factory_io import FactoryIO scripts_path = Path( mc.internalVar( userScriptDir=True ) ) shape_library = ( scripts_path / 'ControlFactory' / 'ShapeLibrary' ) io = FactoryIO(shape_library) author = CtrlAuthor(io) selection = om.MGlobal.getActiveSelectionList() for index in range(selection.length()): dag_path, component = selection.getComponent(index) object_selection = om.MSelectionList() object_selection.add(dag_path) author.save( object_selection )
This makes the authoring system particularly useful for building and migrating shape libraries. Shapes can be pulled from existing rigs or another Maya scene and quickly brought into a Control Factory library without having to add each shape manually.
CtrlShapeBuilder
The CtrlShapeBuilder class handles creating and modifying NURBS curves in the Maya scene. Like the author, it takes a CtrlShapeIO instance in its constructor so that it can access the shape library.
The primary method for creating a library shape is .build(). The only required argument is library_shape, which specifies the name of the shape to load from the library:
shape = shape_builder.build( library_shape='Circle', )
The other arguments are optional and allow the shape to be customized when it is created:
shape = shape_builder.build( library_shape='Circle', name='hand_ctrl', scale=(2, 2, 2), rotate=(0, 0, 45), offset=(0, 0, 10), color=17, units=om.MDistance.kCentimeters, )
Name specifies the name of the control when it is created. If no name is provided, Maya's default naming behavior is used.
Scale specifies the scale applied to the curve shape, not the transform.
Rotate is applied to the curve shape and can be provided either as an (x, y, z) tuple or as an MEulerRotation. When a tuple is provided, the values are interpreted as degrees and use kXYZ rotation order:
rotate=(0, 0, 45)
For cases where a specific rotation order or angle representation is required, an MEulerRotation can be passed directly:
rotation = om.MEulerRotation( om.MAngle(45, om.MAngle.kDegrees), om.MAngle(0, om.MAngle.kDegrees), om.MAngle(90, om.MAngle.kDegrees), om.MEulerRotation.kXYZ, ) shape = shape_builder.build( library_shape='Circle', rotate=rotation, )
Offset specifies the translation applied to the curve shape.
Color can be specified as either a Maya indexed color or RGB value.
Units uses a Maya MDistance enum to specify the units used for the offset values and initial creation scale. If left as None, the scene's working units are used.
This provides a simple interface for autorigging systems and other tools to create curves from the library without needing to interact with the Control Factory UI.
Separate Pipeline Libraries
For production use, the library used by pipeline tools can be kept separate from the library used for authoring.
An authoring library can contain experimental and artist-created shapes, while a production library can contain stable shapes used by autorigs and other tools. This prevents changes made while managing the authoring library from unexpectedly affecting production tools.
A valid Control Factory library directory contains directories representing the shape groups. Within each shape group are directories using the shape names and containing the data.json and icon.png files for the shape.
Using Different Shape Libraries
The Control Factory UI is not tied to the included shape library. A UI can be created for any Control Factory-compatible shape library by passing its path to ControlFactory.factory_ui.show().
The default shelf button points to ShapeLibrary included with the Control Factory install:
from pathlib import Path from ControlFactory import factory_ui shape_library_path = ( Path(factory_ui.__file__).parent / 'ShapeLibrary' ) factory_ui.show( shape_library_path )
This also makes it easy to maintain separate shape libraries for different projects or pipelines. A new shelf button can be created and point to the desired library:
factory_ui.show( '/path/to/my/ShapeLibrary' )
The UI can then be used to author and manage shapes in that library.