repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 8a07b197b874dd5c5d5762c92bcfd3715ba3368f:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 8a07b197b874dd5c5d5762c92bcfd3715ba3368f
Author: James Baicoianu 
Date:   Thu Mar 29 01:30:32 2018 -0700

    Only fetch model asset if id changes

diff --git a/scripts/object.js b/scripts/object.js
index 92d837c49c053e97683d3525adf9b3409ede3463..
index ..06b32efb0e27789cabe0b941dc3a8d525327e390 100644
--- a/scripts/object.js
+++ b/scripts/object.js
@@ -200,7 +200,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
     this.assignTextures = function() {
       //console.log('assign textures', this.name, this.objects['3d']);
       if (!this.objects['3d']) return;
-      var modelasset = false,
+      var modelasset = this.modelasset,
           texture = false,
           textureLightmap = false,
           color = false,
@@ -215,7 +215,10 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
           normal_image_id = false,
           lightmap_image_id = this.lmap_id;
       if (this.janusid) {
-        modelasset = this.getAsset('model', this.janusid, true);
+        if (!modelasset || modelasset.name != this.janusid) {
+          modelasset = this.getAsset('model', this.janusid, true);
+          this.modelasset = modelasset;
+        }
         if (modelasset.tex) {
           image_id = modelasset.tex;
         }
@@ -223,7 +226,6 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
           image_id = modelasset.tex0;
         }
       }
-      this.modelasset = modelasset;
       if (image_id) {
         textureasset = this.getAsset('image', image_id, true);
         if (textureasset) {

-----END OF PAGE-----