openrig.maya.core.solution module
Base class for all rig solutions.
Every solution — from a single joint to a full IK/FK arm — implements the
same SolutionBase contract. The framework does not distinguish between
atomic and composite solutions.
Subclasses are auto-registered via __init_subclass__ the moment their
module is imported. Adding a new solution type requires only creating a file
in maya/solutions/.
- class openrig.maya.core.solution.SolutionBase[source]
Bases:
ABCContract every rig solution must implement.
Subclasses must define:
solution_type— class variable used as the JSON registry key.settings— instance attribute holding aSolutionSettingssubclass with all configuration for this solution.build(ctx)— the main build method (abstract).
Subclasses are registered automatically when their module is imported. No manual registration is needed.
- solution_type
Class-level type string used as the JSON key (e.g.
"Arm"). Must be unique across all registered solutions.- Type:
ClassVar[str]
- solution_id
Instance-level unique identifier within a rig build (e.g.
"arm_l"). Set by the build pipeline beforebuild()is called.- Type:
str
- settings
Configuration for this solution instance. Each subclass defines its own
SolutionSettingssubclass with the fields it needs.
- solution_type: ClassVar[str]
- solution_id: str
- settings: SolutionSettings
- classmethod input_ports() dict[str, InputPort][source]
Declare what this solution needs from other solutions.
Override to declare input ports. The default returns an empty dict (no inputs required).
- Returns:
A dict mapping port name to
InputPortdescriptor.
- classmethod output_ports() dict[str, OutputPort][source]
Declare what this solution produces for other solutions.
Override to declare output ports. The default returns an empty dict (no outputs produced).
- Returns:
A dict mapping port name to
OutputPortdescriptor.
- create_guides(ctx: BuildContext) None[source]
Create guide objects in Maya for interactive positioning.
Optional. The default implementation does nothing — the solution builds from
settingsalone. Override to place guide locators or geometry that the rigger can reposition before callingbuild().- Parameters:
ctx – The shared build context.
- abstract build(ctx: BuildContext) None[source]
Build the solution in the Maya scene.
Required. Called by the build pipeline in dependency order.
Implementations must:
Read guide positions via
ctx.get_guide()when guides exist, falling back toself.settingswhen they do not.Create all necessary Maya nodes.
Register every declared output port via
ctx.set_output().
- Parameters:
ctx – The shared build context.
- post_build(ctx: BuildContext) None[source]
Run connections that require all solutions to already exist.
Optional. The default implementation does nothing. Override to make cross-solution connections (e.g. parenting arm to spine) that can only be established after every solution has completed
build().- Parameters:
ctx – The shared build context.