eucly2 Posted May 19, 2014 Share Posted May 19, 2014 Hello everyone, With BabylonJs we can load a scene from a babylon file but why we can't load a scene from a data steam? In my project we can save BabylonScene to a DataBase on the server with using BABYLON.SceneSerializer and JSON.stringify but after we can't reload this BabyloneScene from the server. Anyone have an idea? Quote Link to comment Share on other sites More sharing options...
gwenael Posted May 26, 2014 Share Posted May 26, 2014 Hello eucly2, Welcome on board.Not sure but I think it's what Deltakosh added with this commit https://github.com/BabylonJS/Babylon.js/commit/137abac2f50a636d32768f93c5bb5fec46b9dbf8 Quote Link to comment Share on other sites More sharing options...
Kilombo Posted May 26, 2014 Share Posted May 26, 2014 Hello there. You can try to use a database to store the name and path (each one in is own var), then you pass the query result to a var and pass that var to the scene loader (when you instantiate one). It's not a complete answer to the problem, but i think it can help you out. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 26, 2014 Share Posted May 26, 2014 BTW I added this feature: just use a Load or an ImportMesh with a string starting with "data:" instead of giving the filename Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 3, 2015 Share Posted February 3, 2015 Hi, I end up with the same kind of problem. I added several objects on the stage with importMesh, I use Manipulator to move objects on the ground and seralize my scene I stringnify then I save it in a file with ajax and PHP. var serializedScene = BABYLON.SceneSerializer.Serialize(scene);var strScene = JSON.stringify(serializedScene);$.ajax({ url:"save_json.php", type:'post', data: 'value='+strScene});in the file PHP (save_json.php): function save($terrainName, $value) { $cheminFichierJson = "./../data_admin/terrain/scene.babylon"; $json = json_encode($value, JSON_UNESCAPED_SLASHES); $json = str_replace('\"', '"', $json); chmod($cheminFichierJson, 0777); file_put_contents($cheminFichierJson, substr($json,1,-1)); chmod($cheminFichierJson, 0644);}but when I load the file I have a SyntaxError: Unexpected token BABYLON.SceneLoader.Load("./data_admin/terrain/", "scene.babylon", engine, function (newScene) { engine.runRenderLoop(function() { newScene.render(); }); }); //SyntaxError: Unexpected token I do not understand. Is this a bug? I have no error file name or line number. just:Uncaught SyntaxError: Unexpected token Thanks for help 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.