Skip to content

Fix for MultiPolygon errors and missing UV coordinates #2

@Janky2Slow

Description

@Janky2Slow

Problem

The current Meshery implementation crashes when processing complex golf courses (18+ holes) with the error:

AttributeError: 'MultiPolygon' object has no attribute 'exterior'

Additionally, exported OBJ files don't include UV coordinates, making textures unusable in Unity.

Solution

I've fixed both issues:

1. MultiPolygon Handling (mesh.py)

  • Added MultiPolygon support to densify_polygon() and triangulate_polygon()
  • Functions now handle both simple Polygons and MultiPolygons
  • Complex courses with hundreds of overlapping shapes now process correctly

2. UV Coordinate Generation (export.py)

  • Added UV coordinate generation for all vertices
  • Uses planar projection from XZ coordinates
  • Exports proper vt lines in OBJ format
  • Textures now work in Unity

Testing

Tested successfully with:

  • Bartow18: 18-hole course with 165 paths - previously crashed, now works ✅
  • Keystone12: 12-hole course with complex terrain - processes correctly ✅
  • Simple courses continue to work without changes ✅

Files

I'll attach the two fixed files:

  • mesh.py - MultiPolygon handling
  • export.py - UV coordinate generation

Both files are backward compatible. No breaking changes.

mesh.py

export.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions