temp fix for saving too many

beta.r3js.org
Theunis J. Botha 2017-06-14 11:45:48 +02:00
parent 928b018ae2
commit d174999cf9
5 changed files with 30 additions and 9 deletions

View File

@ -28,7 +28,7 @@ GameLib.Component = function(
this.built = false;
this.saved = false;
this.canSave = true;
this.loaded = false;
@ -277,11 +277,11 @@ GameLib.Component.prototype.clone = function() {
GameLib.Component.prototype.save = function() {
if (this.saved) {
if (!this.canSave) {
return;
}
this.saved = true;
this.canSave = false;
var apiObject = this.toApiObject(true);
@ -294,5 +294,4 @@ GameLib.Component.prototype.save = function() {
apiObject
);
this.saved = false;
};

View File

@ -155,7 +155,11 @@ GameLib.D3.Image.prototype.updateInstance = function() {
*
* @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(
this.id,

View File

@ -917,6 +917,10 @@ GameLib.D3.Material.prototype.updateInstance = function() {
*/
GameLib.D3.Material.prototype.toApiObject = function(save) {
if (GameLib.Utils.UndefinedOrNull(save)) {
save = false;
}
var apiAlphaMap = null;
if (this.alphaMap) {
if (save) {
@ -1011,7 +1015,7 @@ GameLib.D3.Material.prototype.toApiObject = function(save) {
apiSpecularMap = this.specularMap.id;
}
return new GameLib.D3.API.Material(
var apiMaterial = new GameLib.D3.API.Material(
this.id,
this.materialType,
this.name,
@ -1082,6 +1086,8 @@ GameLib.D3.Material.prototype.toApiObject = function(save) {
apiSpecularMap,
GameLib.Utils.IdOrNull(this.parentEntity)
);
return apiMaterial;
};
/**

View File

@ -474,6 +474,10 @@ GameLib.D3.Mesh.prototype.updateInstance = function() {
*/
GameLib.D3.Mesh.prototype.toApiObject = function(save) {
if (GameLib.Utils.UndefinedOrNull(save)) {
save = false;
}
var apiSkeleton = null;
if (this.skeleton) {
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.meshType,
this.name,
@ -522,6 +526,8 @@ GameLib.D3.Mesh.prototype.toApiObject = function(save) {
GameLib.Utils.IdOrNull(this.parentEntity),
this.renderOrder
);
return apiMesh;
};
/**

View File

@ -344,6 +344,10 @@ GameLib.D3.Texture.prototype.updateInstance = function() {
*/
GameLib.D3.Texture.prototype.toApiObject = function(save) {
if (GameLib.Utils.UndefinedOrNull(save)) {
save = false;
}
var apiImage = null;
if (this.image) {
if (save) {
@ -352,7 +356,7 @@ GameLib.D3.Texture.prototype.toApiObject = function(save) {
apiImage = this.image.id
}
return new GameLib.D3.API.Texture(
var apiTexture = new GameLib.D3.API.Texture(
this.id,
this.typeId,
this.name,
@ -375,7 +379,9 @@ GameLib.D3.Texture.prototype.toApiObject = function(save) {
this.premultiplyAlpha,
this.encoding,
GameLib.Utils.IdOrNull(this.parentEntity)
)
);
return apiTexture;
};