Skip to main content

A clean, performant parser for IGI 2: Covert Strike binary MEF models.

Project description

IGI 2 MEF Parsing Library (igi2mef)

A high-performance, specification-driven Python library for parsing IGI 2: Covert Strike binary .mef models. Developed to be 100% accurate with the original game engine's coordinate systems, collision, and skeletal structures.

🚀 Quick Start

Ensure the library is installed (pip install igi2mef).

from igi2mef import parse_mef

# 1. Load and parse a model
model = parse_mef("path/to/model.mef")

# 2. Access core metadata
if model.valid:
    print(f"Model: {model.name} ({model.model_type_name})")
    print(f"Stats: {model.total_vertices} Verts, {model.total_triangles} Tris")

    # 3. Traverse geometry (PARTS)
    for part in model.parts:
        print(f"Part {part.index} has {len(part.vertices)} vertices.")
        
    # 4. Traverse Skeleton (BONES)
    for bone in model.bones:
        print(f"Bone: {bone.name} (Parent: {bone.parent_id})")
else:
    print(f"Error loading model: {model.error}")

🛠️ Detailed API Reference

Object Attribute Type Description
MefModel model_type int Raw model type ID (1=Rigid, 3=Bone, etc.).
model_type_name str Professional name ("Rigid", "Bone", "Lightmap").
hsem_version float Internal HSEM specification version (e.g., 2.3).
parts list List of MefPart objects (the geometry).
bones list List of MefBone skeletons (if Bone model).
collision list List of CollisionMesh for physics boundaries.
magic_vertices list List of MagicVertex (attach points).
portals list List of Portal objects (visibility logic).
glow_sprites list List of GlowSprite (special FX).
bounds_min/max tuple AABB bounding box (min/max corners).
center tuple Computed geometric center of the model.
MefPart index int The zero-based index of this submesh.
vertices list List of (x, y, z) coordinate tuples.
faces list List of (v1, v2, v3) triangle indices.
normals/uvs list Per-vertex normal and texture coordinate data.
MefBone bone_id int The bone's unique index.
parent_id int Parent index (-1 for root).
local_offset tuple Original relative offset.
world_offset tuple Computed absolute position in object space.

🧪 Debug & Experiments Matrix

The parse_mef function accepts an optional debug parameter (MefDebugParams) to handle coordinate system swizzling or scaling for different 3D engines (GL, DirectX, Unity).

from igi2mef import parse_mef, MefDebugParams

params = MefDebugParams(
    v_scale=0.01,       # Scale vertices (1 IGI unit = 100 units)
    swizzle_mode="XZY", # Common IGI->OpenGL mapping
    flip_x=False,
    bone_id_bias=0      # Offset bone indices for certain rigs
)

model = parse_mef("anya_01.mef", debug=params)

📖 MEF Specification

For a deeper, byte-level look at the .mef file format, refer to guidemef.md.

License

MIT License. IGI 2: Covert Strike is a trademark of Innerloop Studios. This library is for educational and modding purposes only.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

igi2mef-0.1.5.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

igi2mef-0.1.5-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file igi2mef-0.1.5.tar.gz.

File metadata

  • Download URL: igi2mef-0.1.5.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for igi2mef-0.1.5.tar.gz
Algorithm Hash digest
SHA256 e0e23793e42dbfc6ae409be6209880fff5291e0b622b7d57920a0556a8ad712b
MD5 a1990ff41c21f06bd9f5c78683bf1977
BLAKE2b-256 03c04e36b9b4c7635c9ad02243682b09cef85032d8e8a2311e50a1e67d2aa79b

See more details on using hashes here.

File details

Details for the file igi2mef-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: igi2mef-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for igi2mef-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 19be296d69edc956cfdf6a3f78658d1f35d3a7ac461733903f10e4e08a1267c6
MD5 afaeda533131ebaaf5e288a8fb4c6923
BLAKE2b-256 3f19683b46679972f691ae77b60cc7f04dd8b177dcdc9300afb9b20b4f92d728

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page