store clones option
parent
68e1c09557
commit
ff2fd4651c
|
@ -479,13 +479,15 @@ GameLib.Component.prototype.buildIdToObject = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this instanceof GameLib.D3.Scene) {
|
if (this instanceof GameLib.D3.Scene) {
|
||||||
this.clones.map(
|
if (!this.storeClones) {
|
||||||
function(clone) {
|
this.clones.map(
|
||||||
if (this.idToObject.hasOwnProperty(clone.id)) {
|
function (clone) {
|
||||||
delete this.idToObject[clone.id];
|
if (this.idToObject.hasOwnProperty(clone.id)) {
|
||||||
}
|
delete this.idToObject[clone.id];
|
||||||
}.bind(this)
|
}
|
||||||
)
|
}.bind(this)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.idToObject[this.id] = this;
|
this.idToObject[this.id] = this;
|
||||||
|
@ -616,43 +618,6 @@ GameLib.Component.prototype.cloneInstance = function() {
|
||||||
return clone;
|
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() {
|
GameLib.Component.prototype.saveToRemoteAPI = function() {
|
||||||
this.save(true);
|
this.save(true);
|
||||||
};
|
};
|
||||||
|
@ -671,14 +636,6 @@ GameLib.Component.prototype.save = function(remote) {
|
||||||
|
|
||||||
apiObject.componentType = this.idToObject[property].componentType;
|
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(
|
this.publish(
|
||||||
GameLib.Event.SAVE_COMPONENT,
|
GameLib.Event.SAVE_COMPONENT,
|
||||||
{
|
{
|
||||||
|
|
|
@ -147,6 +147,8 @@ GameLib.D3.Scene = function (
|
||||||
|
|
||||||
this.clones = [];
|
this.clones = [];
|
||||||
|
|
||||||
|
this.storeClones = false;
|
||||||
|
|
||||||
GameLib.Component.call(
|
GameLib.Component.call(
|
||||||
this,
|
this,
|
||||||
GameLib.Component.COMPONENT_SCENE,
|
GameLib.Component.COMPONENT_SCENE,
|
||||||
|
@ -296,7 +298,7 @@ GameLib.D3.Scene.prototype.toApiObject = function() {
|
||||||
/**
|
/**
|
||||||
* Do not store any cloned meshes
|
* 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));
|
result.push(GameLib.Utils.IdOrNull(mesh));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +313,7 @@ GameLib.D3.Scene.prototype.toApiObject = function() {
|
||||||
/**
|
/**
|
||||||
* Do not store any cloned lights
|
* 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));
|
result.push(GameLib.Utils.IdOrNull(light));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue