BABYLONJS isSynchronize not complete

isSynchronize must store the parent in its cache, because if you change the parent of an item, it does not synchronize the item.

by MaxenceBrasselet

HTML

<script src="https://rawgithub.com/BabylonJS/Babylon.js/master/babylon.1.8.0.js"></script>
<div id="rootDiv">
   <button id="dispose">dispose</button>
  <canvas id="renderCanvas"></canvas>
</div>

CSS

html, body, div, canvas {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

JavaScript

BABYLON.Mesh.prototype.dispose = function (doNotRecurse) {
    if (this._vertexBuffers) {
        for (var index = 0; index < this._vertexBuffers.length; index++) {
            this._vertexBuffers[index].dispose();
        }
        this._vertexBuffers = null;
    }
    
    if (this._indexBuffer) {
        this._scene.getEngine()._releaseBuffer(this._indexBuffer);
        this._indexBuffer = null;
    }
    
    // Remove from scene
    var index = this._scene.meshes.indexOf(this);
        
    if(index == -1) {
        return;
    }
    
    this._scene.meshes.splice(index, 1);
    
    if (!doNotRecurse) {
        // Particles
        for (var index = 0; index < this._scene.particleSystems.length; index++) {
            if (this._scene.particleSystems[index].emitter == this) {
                this._scene.particleSystems[index].dispose();
                index--;
            }
        }
        
        // Children
        var objects = this._scene.meshes.slice(0);
        for (var index = 0; index < objects.length; index++) {
            if (objects[index].parent == this) {
                objects[index].dispose();
            }
        }
    }
    else { // the parent is deleted, we remove the reference of every child.
        var objects = this._scene.meshes.slice(0);
        for (var index = 0; index < objects.length; index++) {
            if (objects[index].parent == this) {
                delete objects[index].parent;
            }
        }
    }
    
    this._isDisposed = true;
    
    // Callback
    if (this.onDispose) {
        this.onDispose();
    }
};

// Get the Canvas element from our HTML below
var canvas = document.getElementById("renderCanvas");
// Load BABYLON 3D engine
var engine = new BABYLON.Engine(canvas, true);

window.scene = new BABYLON.Scene(engine);
var scene = window.scene;

// Creating a camera looking to the zero point (0,0,0), a light, and a sphere of size 1
var camera = new BABYLON.ArcRotateCamera("Camera", 1, 0.8, 30, new...