Skip to content

Add OBJ File Import/Export Support#2

Closed
ebowwa wants to merge 0 commit intovibe-stack:mainfrom
ebowwa:main
Closed

Add OBJ File Import/Export Support#2
ebowwa wants to merge 0 commit intovibe-stack:mainfrom
ebowwa:main

Conversation

@ebowwa
Copy link
Copy Markdown
Contributor

@ebowwa ebowwa commented Sep 11, 2025

Summary

This PR adds comprehensive OBJ file format support to Gestalt 3D Editor, enabling import and export of Wavefront OBJ files for improved interoperability with other 3D applications.

Features Implemented

✅ OBJ Import

  • Complete OBJ parser supporting vertices, normals, UVs, and faces
  • Automatic triangulation of quads and n-gons
  • Support for multiple objects per file
  • Robust error handling for malformed files
  • File size validation (50MB limit)
  • Integration with existing menu system

✅ OBJ Export

  • Full mesh geometry export with normals and UVs
  • Optional MTL material file generation
  • Support for multiple mesh export
  • Maintains data integrity through round-trip operations
  • Integration with existing export dialog

Technical Implementation

Architecture

  • Follows existing patterns from gltf-importer.ts
  • Leverages existing geometry utilities (buildEdgesFromFaces, calculateVertexNormals)
  • Integrates seamlessly with Zustand stores
  • Comprehensive TypeScript typing throughout

Files Added

  • src/utils/obj-importer.ts - OBJ parsing and scene integration
  • src/utils/obj-exporter.ts - Mesh to OBJ conversion
  • src/utils/test-obj.ts - Test utilities for validation

Files Modified

  • src/features/menu/components/menu-bar.tsx - Added OBJ import menu option

Testing

The implementation includes:

  • Comprehensive error handling and validation
  • File size and format validation
  • Round-trip testing utilities
  • Support for various OBJ format variations

Benefits

  • Interoperability: Work with models from Blender, Maya, 3ds Max, and other standard 3D tools
  • Workflow Integration: Seamless asset exchange with external tools
  • User Adoption: Lower barrier to entry with familiar file format support
  • Industry Standard: Support for the most widely-used 3D interchange format

Screenshots

The OBJ import option is now available in the Import menu, replacing the previous "OBJ... (soon)" placeholder.

Compatibility

  • ✅ No breaking changes
  • ✅ Maintains existing T3D functionality
  • ✅ TypeScript compilation passes
  • ✅ Build succeeds without errors

Closes #1

🤖 Generated with Claude Code

@ebowwa ebowwa mentioned this pull request Sep 11, 2025
16 tasks
@alightinastorm
Copy link
Copy Markdown
Contributor

I was just about to review it all, but then saw that it is using an old commit head

Sorry! I was not prepared for someone to contribute - However love that you do!

If you can resolve the conflicts, i'll review it and most likely merge it :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add OBJ File Import/Export Support

2 participants