temp fix for saving too many
parent
928b018ae2
commit
d174999cf9
|
@ -28,7 +28,7 @@ GameLib.Component = function(
|
||||||
|
|
||||||
this.built = false;
|
this.built = false;
|
||||||
|
|
||||||
this.saved = false;
|
this.canSave = true;
|
||||||
|
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
|
|
||||||
|
@ -277,11 +277,11 @@ GameLib.Component.prototype.clone = function() {
|
||||||
|
|
||||||
GameLib.Component.prototype.save = function() {
|
GameLib.Component.prototype.save = function() {
|
||||||
|
|
||||||
if (this.saved) {
|
if (!this.canSave) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.saved = true;
|
this.canSave = false;
|
||||||
|
|
||||||
var apiObject = this.toApiObject(true);
|
var apiObject = this.toApiObject(true);
|
||||||
|
|
||||||
|
@ -294,5 +294,4 @@ GameLib.Component.prototype.save = function() {
|
||||||
apiObject
|
apiObject
|
||||||
);
|
);
|
||||||
|
|
||||||
this.saved = false;
|
|
||||||
};
|
};
|
|
@ -155,7 +155,11 @@ GameLib.D3.Image.prototype.updateInstance = function() {
|
||||||
*
|
*
|
||||||
* @returns {GameLib.D3.API.Image}
|
* @returns {GameLib.D3.API.Image}
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Image.prototype.toApiObject = function() {
|
GameLib.D3.Image.prototype.toApiObject = function(save) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(save)) {
|
||||||
|
save = false;
|
||||||
|
}
|
||||||
|
|
||||||
var apiImage = new GameLib.D3.API.Image(
|
var apiImage = new GameLib.D3.API.Image(
|
||||||
this.id,
|
this.id,
|
||||||
|
|
|
@ -917,6 +917,10 @@ GameLib.D3.Material.prototype.updateInstance = function() {
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Material.prototype.toApiObject = function(save) {
|
GameLib.D3.Material.prototype.toApiObject = function(save) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(save)) {
|
||||||
|
save = false;
|
||||||
|
}
|
||||||
|
|
||||||
var apiAlphaMap = null;
|
var apiAlphaMap = null;
|
||||||
if (this.alphaMap) {
|
if (this.alphaMap) {
|
||||||
if (save) {
|
if (save) {
|
||||||
|
@ -1011,7 +1015,7 @@ GameLib.D3.Material.prototype.toApiObject = function(save) {
|
||||||
apiSpecularMap = this.specularMap.id;
|
apiSpecularMap = this.specularMap.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new GameLib.D3.API.Material(
|
var apiMaterial = new GameLib.D3.API.Material(
|
||||||
this.id,
|
this.id,
|
||||||
this.materialType,
|
this.materialType,
|
||||||
this.name,
|
this.name,
|
||||||
|
@ -1082,6 +1086,8 @@ GameLib.D3.Material.prototype.toApiObject = function(save) {
|
||||||
apiSpecularMap,
|
apiSpecularMap,
|
||||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return apiMaterial;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -474,6 +474,10 @@ GameLib.D3.Mesh.prototype.updateInstance = function() {
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Mesh.prototype.toApiObject = function(save) {
|
GameLib.D3.Mesh.prototype.toApiObject = function(save) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(save)) {
|
||||||
|
save = false;
|
||||||
|
}
|
||||||
|
|
||||||
var apiSkeleton = null;
|
var apiSkeleton = null;
|
||||||
if (this.skeleton) {
|
if (this.skeleton) {
|
||||||
if (save) {
|
if (save) {
|
||||||
|
@ -494,7 +498,7 @@ GameLib.D3.Mesh.prototype.toApiObject = function(save) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return new GameLib.D3.API.Mesh(
|
var apiMesh = new GameLib.D3.API.Mesh(
|
||||||
this.id,
|
this.id,
|
||||||
this.meshType,
|
this.meshType,
|
||||||
this.name,
|
this.name,
|
||||||
|
@ -522,6 +526,8 @@ GameLib.D3.Mesh.prototype.toApiObject = function(save) {
|
||||||
GameLib.Utils.IdOrNull(this.parentEntity),
|
GameLib.Utils.IdOrNull(this.parentEntity),
|
||||||
this.renderOrder
|
this.renderOrder
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return apiMesh;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -344,6 +344,10 @@ GameLib.D3.Texture.prototype.updateInstance = function() {
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Texture.prototype.toApiObject = function(save) {
|
GameLib.D3.Texture.prototype.toApiObject = function(save) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(save)) {
|
||||||
|
save = false;
|
||||||
|
}
|
||||||
|
|
||||||
var apiImage = null;
|
var apiImage = null;
|
||||||
if (this.image) {
|
if (this.image) {
|
||||||
if (save) {
|
if (save) {
|
||||||
|
@ -352,7 +356,7 @@ GameLib.D3.Texture.prototype.toApiObject = function(save) {
|
||||||
apiImage = this.image.id
|
apiImage = this.image.id
|
||||||
}
|
}
|
||||||
|
|
||||||
return new GameLib.D3.API.Texture(
|
var apiTexture = new GameLib.D3.API.Texture(
|
||||||
this.id,
|
this.id,
|
||||||
this.typeId,
|
this.typeId,
|
||||||
this.name,
|
this.name,
|
||||||
|
@ -375,7 +379,9 @@ GameLib.D3.Texture.prototype.toApiObject = function(save) {
|
||||||
this.premultiplyAlpha,
|
this.premultiplyAlpha,
|
||||||
this.encoding,
|
this.encoding,
|
||||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||||
)
|
);
|
||||||
|
|
||||||
|
return apiTexture;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue