Skip to content

Commit

Permalink
Prevent scene serializaion if not on top level
Browse files Browse the repository at this point in the history
  • Loading branch information
tentone committed Jul 3, 2017
1 parent 6e65bef commit 6cb7561
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/core/objects/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ Scene.prototype.setFogMode = function(mode)
*/
Scene.prototype.toJSON = function(meta)
{
if(this.parent !== null && this.parent.type !== "Program")
{
this.type = "Group";
console.warn("nunuStudio: Scene is not on top level serializing as Group.");
return THREE.Object3D.prototype.toJSON.call(this, meta);
}

var background = this.background;
var data = THREE.Object3D.prototype.toJSON.call(this, meta, function(meta, object)
{
Expand Down

0 comments on commit 6cb7561

Please sign in to comment.