KevinK Posted March 26, 2018 Share Posted March 26, 2018 I am getting the following errors when calling ImportMesh. BJS - [14:34:00]: Unable to import meshes from data:# Blender v2.79 (sub 0) OBJ File: '' : importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse I am using beta 1 version of Babylon and loaders because of babylonjs.loaders.module.d.ts with 3.2.0-beta.3 reported Following code give me the error import * as BABYLON from 'babylonjs'; import 'babylonjs-loaders'; uploadSaveFiles(files: File[]) { files.map((file, i) => { let reader = new FileReader(); if (isImage(file)) { reader.readAsDataURL(file); } else if (isObj(file)) { reader.readAsText(file); } else if (isMtl(file)) { reader.readAsText(file); } else { console.log("File not supported!"); } let data = reader.result; if( isObj(file)) { BABYLON.SceneLoader.ImportMesh("", "", 'data:' + data, scene, function (meshes: BABYLON.AbstractMesh[]) { meshes.forEach((mesh) => { console.log(mesh); }); }); } } } I am trying to load a Obj file from disk. The obj file has accompanying mtl and images files. I currently have a interface where the user drags and drops all appropriate files. Not sure if this is the best way. Do the accompanying files need to be in uploaded first before I can load obj file? If there is a better way to upload obj and material files let me know Thanks Quote Link to comment Share on other sites More sharing options...
KevinK Posted March 27, 2018 Author Share Posted March 27, 2018 Solved my issue by supplying the ".obj" plugin extension importmesh Wingnut and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 27, 2018 Share Posted March 27, 2018 Way to go, KevinK! Thanks for sharing the solve, and welcome to the BJS forum. I hope to do better than 19 hours... next time. Sorry for the slow replies. Quote Link to comment Share on other sites More sharing options...
migo Posted November 12, 2018 Share Posted November 12, 2018 can you provide a full solution please thanks in advance Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.