JohnK Posted July 20, 2015 Share Posted July 20, 2015 EDIT Less than 30 people read the complete rubbish I have just deleted. All because I did not read a line of code correctly. I think I might now be able to answer my own question. If so I'll give myself a reply if not then I be asking the question differently. When SceneFile.babylon contains a saved scene and Meshes.babylon contains saved meshes is there a direct way of loading the scene from the content of SceneFile.babylon and the meshes from the content of Meshes.babylon? Quote Link to comment Share on other sites More sharing options...
JohnK Posted July 20, 2015 Author Share Posted July 20, 2015 Yes now I have read it correctly. When meshes is an array of meshes and you serialize them withvar serializedMesh = BABYLON.SceneSerializer.SerializeMesh(meshes);var content = JSON.stringify(serializedMesh);Then leaving the path as an empty string and replacing the filename with 'data:'+content will import the meshes, as inBABYLON.SceneLoader.ImportMesh("", "", 'data:'+content, scene, function (meshes, particleSystems, skeletons) { }); Quote Link to comment Share on other sites More sharing options...
SuperPudding Posted April 3, 2016 Share Posted April 3, 2016 Hello, I'm sorry to "wake" an old post but I came across this and I'm trying to do exactly what you describe. The part of the serialization works fine, but for some reason the parsing afterwards gives me an empty mesh. I copied the code here but it doesn't work. Am I missing something? Quote Link to comment Share on other sites More sharing options...
JohnK Posted April 3, 2016 Author Share Posted April 3, 2016 Looking back at my actual code I see I have the following before calling sceneLoader var re = /\s*/gi; content = content.replace(re, ''); To remove extraneous white spaces, tabs etc. Try this Quote Link to comment Share on other sites More sharing options...
SuperPudding Posted April 10, 2016 Share Posted April 10, 2016 I tried it and it still doesn't work. The sceneLoader creates a new mesh but for some reason it is not visible and it's flawed in some way. When I try to serialize the new mesh back I get a run-time error. When I try to just print the mesh in an alert it shows some encrypted name and says the mesh has 0 submeshes and 0 vertices. I have no idea what the problem is, are you sure the sceneLoader can parse a mesh this way? Quote Link to comment Share on other sites More sharing options...
JohnK Posted April 11, 2016 Author Share Posted April 11, 2016 Have a snippet to show you that SceneLoader can parse a mesh as above. However when I try it in the playground I get an error message. Have started a new topic that shows the code. If you copy and paste the code from the new thread see if it works for you. New topic Quote Link to comment Share on other sites More sharing options...
JohnK Posted April 12, 2016 Author Share Posted April 12, 2016 @SuperPudding RanaanW has sorted the playground problem in the new topic as above. Perhaps yours is a related problem and the solution will work for you. If not then for further help we will need to see the code you are using, preferably with a version we can run. 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.