Skip to content

Repository files navigation

Mayflower-glTF

An open-source (MIT), standards-compliant glTF 2.0 import/export plug-in for Autodesk Maya. Registers natively under File > Import and File > Export (All/Selection) as .gltf and .glb, alongside a scriptable Python API for pipeline automation.

Mayflower-glTF exists because the only complete, actively-maintained glTF plug-ins for Maya (ProtoTech, SimLab) are commercial. See docs/prior-art.md for a survey of existing open-source attempts and what this project does differently.

Status: early / pre-alpha. Export supports static meshes and basic aiStandardSurface materials, validated against the official Khronos glTF-Validator. Import supports static meshes (single UV set) and PBR materials mapped back to aiStandardSurface (requires the mtoa/Arnold plug-in). See the compatibility matrix below for what's implemented vs. planned.

Install

  1. Clone or download this repository anywhere on disk.
  2. Drag install.py onto the Maya viewport. This writes a module file into your Maya user modules directory pointing at wherever you put the repo -- no manual copying of scripts//plug-ins/ needed.
  3. Restart Maya.
  4. Windows > Settings/Preferences > Plug-in Manager, enable mayflowerGltfTranslator.
  5. File > Export Selection..., choose "glTF" or "glTF Binary" as the file type.

Alternatively, for pipeline/CI setups, add the repo root to your MAYA_MODULE_PATH (the Mayflower-gltf.mod file at the repo root already declares scripts/ and plug-ins/) instead of running install.py.

No pip install step is required: pygltflib and its dependency closure are vendored (pure Python only, see vendor/NOTICES.md) so the plug-in works out of the box even on locked-down studio machines with no internet access or write permission to Maya's own site-packages. If your Maya's Python environment already has pygltflib installed (e.g. a studio pinning a specific version), that real install takes precedence over the vendored copy automatically.

Supports Maya 2022 through the current version (pure Python, no compiled binaries, no per-version rebuild).

Scripting API

import mayflower_gltf.commands as mf

mf.export_gltf("C:/out/character.glb", embed_textures=True, selection_only=True)
mf.import_gltf("C:/out/character.glb")

or from MEL:

source "mayflowerGltf.mel";
mayflowerGltfExport("C:/out/character.glb", 1, 1);
mayflowerGltfImport("C:/out/character.glb");

Compatibility matrix

Status vs. Maya's built-in FBX exporter, since that's the closest native reference point most Maya users already know:

Feature FBX (native) Mayflower-glTF
Static meshes (positions/normals) Yes Yes
Multiple UV sets Yes Yes
Vertex colors Yes Planned
Multi-material per mesh (primitive split) Yes Yes
PBR materials (metallic-roughness) No (legacy Lambert/Phong only) Yes (aiStandardSurface -> KHR PBR)
Normal / emissive / occlusion maps Partial Yes
Alpha modes (opaque/mask/blend) No Yes
Skinning (joints + weights) Yes Planned
Skeletal animation Yes Planned
Blend shapes / morph targets Yes Planned
Cameras Yes Planned
Lights (KHR_lights_punctual) Yes (proprietary) Planned
Draco mesh compression No Planned (flag reserved, not implemented)
KHR_materials_variants No Not yet implemented
KHR_texture_transform No Not yet implemented
Import: static mesh + PBR material Yes Yes (single UV set; requires mtoa/Arnold)
Import: skinning / animation / blend shapes / cameras / lights Yes Planned
Native Maya module (.mod) Yes Yes
Runs on Maya 2022 -> current w/o rebuild Yes Yes

"Planned" items are sequenced in issues; this table is kept up to date as they land. Import-specific caveats: only TEXCOORD_0 is read (additional UV sets are skipped, not merged); occlusion textures aren't wired into the aiStandardSurface network (it has no dedicated AO input, mirroring the export side); a material import silently falls back to Maya's default shading group if the mtoa plug-in can't be loaded.

Architecture

scripts/mayflower_gltf/
  gltf/        DCC-independent glTF 2.0 document model (pygltflib-based):
               document.py/buffers.py write, reader.py reads (accessor
               decoding, mesh/material/node extraction). No Maya imports --
               unit testable head-less.
  maya/        Maya-specific scene traversal (OpenMaya API 2.0).
    scene.py, mesh.py, material.py   export: Maya scene -> gltf documents.
               Pure conversion functions (e.g. material mapping) are
               separated from the Maya-attribute "reader" functions that
               feed them, so conversion logic is unit tested without mayapy.
    import_/   import: gltf.reader output -> Maya nodes (scene.py
               orchestrates, mesh.py builds MFnMesh geometry, material.py
               builds the aiStandardSurface network, textures.py writes
               resolved image bytes to disk for Maya's file nodes).
  ui/          Export options MEL UI shown inside Maya's native File >
               Export dialog.
  commands.py  Scriptable Python entry points for pipeline automation.

plug-ins/mayflowerGltfTranslator.py
               MPxFileTranslator registration. Uses Maya API 1.0 only for
               this registration shim, since MPxFileTranslator has no API
               2.0 equivalent -- everything it delegates to uses API 2.0.

vendor/        pygltflib + its pure-Python dependency closure, vendored so
               the plug-in needs no `pip install` step (see
               vendor/NOTICES.md). A real install elsewhere on Maya's
               Python path always takes precedence over this fallback.

This mirrors the schema-vs-DCC separation used by Khronos' own glTF-Blender-IO reference implementation.

Testing

python -m venv .venv
.venv/Scripts/pip install -e ".[dev]"
.venv/Scripts/pytest tests/unit

Unit tests cover material conversion and glTF buffer/document assembly head-lessly (no Maya required). A validator smoke test (tests/tools/validate_gltf.py + build_sample_gltf.py) runs the same way in CI, checking that the gltf document layer's output validates clean against the official Khronos glTF-Validator. Full scene-traversal round-trip tests (tests/tools/run_mayapy_tests.py) need a licensed Maya install and are not run on GitHub-hosted CI runners; see CONTRIBUTING.md.

License

MIT, see LICENSE.

About

Open-Source, standards-compliant glTF 2.0 import/export plug-in for Autodesk Maya

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Contributors

Languages