← BACK TO SELECTED WORK

TOOL DEVELOPMENT / CASE STUDY 02

Rebuild the rig.
Keep the weights.

gcSkinclusterIO

Skinning takes time and careful judgment. gcSkinclusterIO separates that work from the rig build, so weight data can be exported, inspected, and restored during iteration.

Explore the breakdown
THE WORKING TOOL / PYTHON SOURCEFEBRUARY 24, 2026
MY ROLE
Python tool development
THE TOOLKIT
Maya / OpenMaya API 2.0 / JSON
PROJECT FOCUS
Skin weight export & import

Keep the work.
Make room for iteration.

I built this tool while developing an autorig for my final degree project. The goal was straightforward: preserve the skinning data outside the scene, so rebuilding a rig would not automatically mean starting the weight work again.

THE CHALLENGE

Skinning outlives a rig version

Skeleton and rig changes can turn a useful iteration into a time-consuming round of weight transfers.

THE APPROACH

Use Maya’s native API

Read and write weight arrays through OpenMaya, then store the relevant values and settings in JSON.

THE FOCUS

Make the data inspectable

Keep the exported structure readable, including influences, component counts, skin settings and blend weights.

Python source code for exporting skin weight data with the Maya API
THE WORKING TOOL / PYTHON SOURCE GUIDO GONZALEZ

THE SYSTEM AT A GLANCE

  1. 01Select skinned geometry
  2. 02Export to JSON
  3. 03Rebuild the rig
  4. 04Restore & check

01 / THE BREAKDOWN

Protect the skinning work.

Rigging and skinning are closely related, but they do not always change at the same pace. A rig may need a new control, a different joint arrangement, or a revised build process while much of the weight painting remains useful.

During my final degree project, transferring that data became a recurring task. I wanted a small tool that could become part of my own Python workflow, using Maya’s native modules rather than requiring an additional rigging plugin.

The result is SkinIO, the class behind gcSkinclusterIO. It exports skinCluster data into a JSON file and reads that file back into a scene. The export includes joint influences, skinning settings, sparse weights, and dual-quaternion blend weights when available.

02 / THE BREAKDOWN

Read weights as data, rather than one command at a time.

A skin weight describes how much influence a joint has over a point on a surface. A character with many vertices and joints can therefore have a large number of possible weight values, even when most of those values are zero.

For scale, a mesh with 50,000 vertices and 100 influences has five million possible vertex–joint pairs. That is an illustrative example, not a benchmark for this project. Querying each pair separately would add a large amount of repeated work.

The exporter uses Maya API 2.0 and MFnSkinCluster.getWeights() to retrieve a weight array for the selected components. It then processes that array in Python. The importer reconstructs an array and passes it back through setWeights().

This approach keeps the data handling concentrated in a few bulk operations. The Python code still has work to do: filtering values, mapping influence names, and rebuilding arrays. Performance depends on the geometry, influence count, and scene; the goal here is a practical data workflow.

03 / THE BREAKDOWN

Different geometry needs different addresses.

Rigging setups do not only use polygon meshes. A ribbon may use a NURBS curve or surface, and those objects also have points that can be influenced by joints. The tool needs to identify those points correctly before it can read their weights.

A mesh vertex or curve CV can be addressed with one index: point 0, point 1, and so on. The tool uses a single-indexed component for these geometry types. A NURBS surface is a grid, so a CV is addressed by two indices, one in U and one in V.

For a surface, the tool creates a double-indexed component and records the total point count from the U and V dimensions. This lets the export and import use a common workflow while preparing the appropriate API component for each type of geometry.

Inside the tool: preparing geometry components
skin_io.py — component typesPYTHON
# Handling different API component types based on geometry
def _get_geometry_components(self, dag_path):
    component = None
    count = 0

    if dag_path.hasFn(om.MFn.kMesh):
        # Single indexed component for meshes
        fn_mesh = om.MFnMesh(dag_path)
        count = fn_mesh.numVertices
        fn_single = om.MFnSingleIndexedComponent()
        component = fn_single.create(om.MFn.kMeshVertComponent)
        fn_single.setCompleteData(count)

    elif dag_path.hasFn(om.MFn.kNurbsSurface):
        # Double indexed component for surfaces (U, V)
        fn_surf = om.MFnNurbsSurface(dag_path)
        num_u = fn_surf.numCVsInU
        num_v = fn_surf.numCVsInV
        count = num_u * num_v

        fn_double = om.MFnDoubleIndexedComponent()
        component = fn_double.create(om.MFn.kSurfaceCVComponent)
        fn_double.setCompleteData(num_u, num_v)

    return count, component

Project excerpt. This shows part of the setup, rather than a standalone script.

04 / THE BREAKDOWN

Save the values that matter.

Most joints do not affect most points on a character. A vertex near the foot, for example, usually has no meaningful weight from a shoulder joint. Writing every zero into the file makes the exported data larger without adding much useful information.

The exporter stores a sparse representation. For each influence, it records the component indices with weights above a tolerance of 1e-5, along with their values rounded to five decimal places. An omitted entry is reconstructed as zero during import.

This is a deliberate tradeoff: very small weights are discarded and the remaining values are rounded. The amount of storage saved depends on how many influences actually affect each point. It is not a lossless dump of every original floating-point value.

Inside the tool: a sparse weight dictionary
skin_io.py — sparse exportPYTHON
# Extracting sparse data using a stride and tolerance
flat_weights = list(weights_marray)
sparse_weights = {}
stride = len(inf_names)

for inf_idx, inf_name in enumerate(inf_names):
    # Slice the flat array for this specific influence
    inf_vals = flat_weights[inf_idx::stride]

    # Keep only indices and weights above the tolerance (1e-5)
    j_indices = [i for i, v in enumerate(inf_vals) if v > self.tolerance]
    j_weights = [round(inf_vals[i], 5) for i in j_indices]

    if j_indices:
        sparse_weights[inf_name] = {"ix": j_indices, "vw": j_weights}

Project excerpt. This shows part of the setup, rather than a standalone script.

Why JSON?

JSON keeps the exported structure readable. I can see which geometry was saved, which influences were listed, and which settings were captured without having to interpret a custom binary format. The file is written without extra whitespace to avoid unnecessary bulk.

A readable format is useful for debugging, but it does not make a file automatically compatible with changed topology. This version restores data by component index and influence name. It does not include a proximity-based transfer or an automatic remapping system.

05 / THE BREAKDOWN

Restore more than the painted values.

A skinCluster also contains settings that affect how weights are interpreted. The tool captures settings such as the skinning method, normalization mode, maximum-influence settings, and weight distribution. These sit alongside the weight data in each exported entry.

On import, the tool looks for the geometry in the scene and compares its point count with the saved count. If those counts differ, that skin entry is skipped. Matching counts alone are not enough to prove matching topology: the point order still needs to describe the same geometry.

The importer reuses an existing skinCluster or tries to create one from the available joints. Influence names are used to place the saved values into the current weight array. Keeping geometry and joint names consistent is therefore part of the intended workflow.

While injecting the weight array, the script temporarily disables normalization and maximum-influence enforcement, then restores those settings. It also restores stored blend weights when present and attempts to place the processed skinClusters back in the captured order.

This version records the order of skinClusters, rather than serializing every deformer and every connection in the scene. I still check the resulting deformation and history after import, especially when the rig has other deformation layers.

06 / THE BREAKDOWN

Use it as part of a repeatable workflow.

Download the script below and make it available on Maya’s Python path. In Maya’s Python Script Editor, import SkinIO, create an instance, and call the export or import method with a JSON file path.

For export, select the skinned geometry or skinClusters you want to save. If there is no active selection, the exporter searches the scene for skinned geometry. This makes it useful both for a focused asset update and for a broader export.

Example usage in MayaPYTHON
from gcSkinclusterIO import SkinIO

skin_io = SkinIO()

# Select the geometry to export first.
skin_io.export_skins("C:/tmp/skin_data.json")

# In the target scene, with matching geometry and joints:
skin_io.import_skins("C:/tmp/skin_data.json")

Use a path to an existing folder. The export writes a JSON file at that location; the import reads it and updates or creates skinClusters in the target scene. I keep a scene copy when testing a changed build and compare representative poses after restoring the weights.

The practical gain is a clearer division of work: the rig build creates the structure, and a separate file carries the skin data. There is room to improve the checks and add more flexible mapping, but the current tool gives my workflow a small, inspectable foundation.

TAKE A LOOK INSIDE

gcSkinclusterIO.py

The source used in this breakdown. Runs inside Maya using its native Python modules.

Download Python script

EXPLORE ANOTHER PROJECT

Automated Dragon Wing System

The relationships behind a folding creature wing.

Read the breakdown ↗

LET’S TALK RIGGING

A question, an idea,
or a new challenge?

guidogoca@gmail.com ↗