store clones option
parent
68e1c09557
commit
ff2fd4651c
|
@ -479,6 +479,7 @@ GameLib.Component.prototype.buildIdToObject = function() {
|
|||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Scene) {
|
||||
if (!this.storeClones) {
|
||||
this.clones.map(
|
||||
function (clone) {
|
||||
if (this.idToObject.hasOwnProperty(clone.id)) {
|
||||
|
@ -487,6 +488,7 @@ GameLib.Component.prototype.buildIdToObject = function() {
|
|||
}.bind(this)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
this.idToObject[this.id] = this;
|
||||
|
||||
|
@ -616,43 +618,6 @@ GameLib.Component.prototype.cloneInstance = function() {
|
|||
return clone;
|
||||
};
|
||||
|
||||
// GameLib.Component.prototype.getStorageDependencies = function() {
|
||||
//
|
||||
// var dependencies = {};
|
||||
//
|
||||
// for (var property in this.linkedObjects) {
|
||||
// if (this.linkedObjects.hasOwnProperty(property)){
|
||||
// if (this.hasOwnProperty(property)) {
|
||||
//
|
||||
// if (
|
||||
// this[property] instanceof Array &&
|
||||
// this.linkedObjects[property] instanceof Array
|
||||
// ) {
|
||||
//
|
||||
// if (this.linkedObjects[property].length !== 1) {
|
||||
// console.log('Invalid formed argument type');
|
||||
// }
|
||||
//
|
||||
// dependencies[property] = this[property].map(
|
||||
// function(__constructor) {
|
||||
// return function(arrayProperty){
|
||||
// if (arrayProperty instanceof __constructor) {
|
||||
// return GameLib.Utils.IdOrNull(arrayProperty);
|
||||
// }
|
||||
// }.bind(this)
|
||||
// }(this.linkedObjects[property][0])
|
||||
// );
|
||||
//
|
||||
// } else if (this[property] instanceof this.linkedObjects[property]) {
|
||||
// dependencies[property] = GameLib.Utils.IdOrNull(this[property]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return dependencies;
|
||||
// };
|
||||
|
||||
GameLib.Component.prototype.saveToRemoteAPI = function() {
|
||||
this.save(true);
|
||||
};
|
||||
|
@ -671,14 +636,6 @@ GameLib.Component.prototype.save = function(remote) {
|
|||
|
||||
apiObject.componentType = this.idToObject[property].componentType;
|
||||
|
||||
// var storageDependencies = this.idToObject[property].getStorageDependencies();
|
||||
//
|
||||
// for (var storageProperty in storageDependencies) {
|
||||
// if (storageDependencies.hasOwnProperty(storageProperty)) {
|
||||
// apiObject[storageProperty] = storageDependencies[storageProperty];
|
||||
// }
|
||||
// }
|
||||
|
||||
this.publish(
|
||||
GameLib.Event.SAVE_COMPONENT,
|
||||
{
|
||||
|
|
|
@ -147,6 +147,8 @@ GameLib.D3.Scene = function (
|
|||
|
||||
this.clones = [];
|
||||
|
||||
this.storeClones = false;
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_SCENE,
|
||||
|
@ -296,7 +298,7 @@ GameLib.D3.Scene.prototype.toApiObject = function() {
|
|||
/**
|
||||
* Do not store any cloned meshes
|
||||
*/
|
||||
if (this.clones.indexOf(mesh) === -1) {
|
||||
if ((this.clones.indexOf(mesh) === -1) || this.storeClones) {
|
||||
result.push(GameLib.Utils.IdOrNull(mesh));
|
||||
}
|
||||
|
||||
|
@ -311,7 +313,7 @@ GameLib.D3.Scene.prototype.toApiObject = function() {
|
|||
/**
|
||||
* Do not store any cloned lights
|
||||
*/
|
||||
if (this.clones.indexOf(light) === -1) {
|
||||
if (this.clones.indexOf(light) === -1 || this.storeClones) {
|
||||
result.push(GameLib.Utils.IdOrNull(light));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue