Jump to content

Scene Serializer


ChrisR
 Share

Recommended Posts

Sorry for my noob ignorance to all things Github and how to do pull requests and keep updated babylon code and yadayada.. So i had to make a change to a babylonjs file. I'll add my code change here and if someone wants to add it themselves they can.

 

I assume that the way materials were handled has been changed, but it wasn't updated in the sceneSerializer.

            // Materials            serializationObject.materials = [];            serializationObject.multiMaterials = [];            for (index = 0; index < scene.materials.length; index++) {                var material = scene.materials[index];                if (material instanceof StandardMaterial) {                    serializationObject.materials.push(serializeMaterial(<StandardMaterial>material));                } else if (material instanceof MultiMaterial) {                    serializationObject.multiMaterials.push(serializeMultiMaterial(<MultiMaterial>material));                }            }

The update deals with the fact that multimaterials are there own object in scene, rather than a type located under materials.

            // Materials            serializationObject.materials = [];            for (index = 0; index < scene.materials.length; index++) {                var material = scene.materials[index];                serializationObject.materials.push(serializeMaterial(<StandardMaterial>material));            }            // MultiMaterials            serializationObject.multiMaterials = [];            for(index = 0; index < scene.multiMaterials.length; index++){                var multiMaterial = scene.multiMaterials[index];                serializationObject.multiMaterials.push(serializeMultiMaterial(<MultiMaterial>multiMaterial));            }

Cheers. Also, if anyone could point me in the right direction to have a git working so that i keep updated with the latest babylon files (typescript) rather than just downloading the zip each time and extracting it. Would be appriciated.

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...