masterdon Posted September 5, 2017 Share Posted September 5, 2017 Hi Team, I am working on an editor for room planner using babylon js. I am storing some custom properties for few of the meshes in my scene. shearWall.maxXPos = maxXPos; shearWall.minXPos = minXPos; These properties are having their use for dragging. there are other properties as well. each one of it having its own purpose. I need to save all the data and store it in database. so that user can revisit and work from where he have left the design. to export the data, i am using: var serializedScene = BABYLON.SceneSerializer.Serialize(scene);var strScene = JSON.stringify(serializedScene); The issue is, the custom properties set are not part of json data above. Is there a way to store the custom properties which becomes part of serializer above? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 5, 2017 Share Posted September 5, 2017 Hi again, Masterdon. Umm... I think scene.metaData and node.metaData... are included in serializations. Node includes lights, cameras, and mesh... any BJS type scene item that is an extension of node. Sooo... I suppose... make an object similar to one of our options objects. var mySuitcase = {}; mySuitcase.maxXPos = whatever; etc etc etc. Then... shearWall.metaData = JSON.serialize(mySuitcase); Does that sound sane? When it arrives somewhere, JSON.parse it, and re-install the custom properties onto the mesh.... from the mesh's suitcase. .metaData is your suitcase, but you must pack it before traveling, and unpack it upon arrival somewhere. With me? I hope so. Others may comment... and I could have said something incorrect. But, I think this is a WAY to do what you wish. Report back if you discover things, okay? thx. masterdon and Arte 2 Quote Link to comment Share on other sites More sharing options...
masterdon Posted September 5, 2017 Author Share Posted September 5, 2017 @Wingnut: Looks like exactly what i want..... let me give it a try. Thanks a lot Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted September 5, 2017 Share Posted September 5, 2017 ".metaData is your suitcase, but you must pack it before traveling, and unpack it upon arrival somewhere." Just grab a single item without unpacking the entire suitcase. Wingnut and masterdon 1 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 5, 2017 Share Posted September 5, 2017 metaData is exactly for that. you store what you want and reuse its contents save in BDD or file. masterdon 1 Quote Link to comment Share on other sites More sharing options...
masterdon Posted September 12, 2017 Author Share Posted September 12, 2017 Thanks a lot guys can anyone help me on this topic 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.