repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 5b6ddc4f0e928909fbbf4b373fa1370f3f4d8cfa:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 5b6ddc4f0e928909fbbf4b373fa1370f3f4d8cfa
Author: James Baicoianu 
Date:   Thu Oct 19 22:41:22 2017 -0700

    Implemented hierarchical asset loading

diff --git a/scripts/janusbase.js b/scripts/janusbase.js
index 91527475bdfdf5a58808559fdc14929a23b562d3..
index ..1778c8c7f731c60690f5a6043a90a34a78b560d3 100644
--- a/scripts/janusbase.js
+++ b/scripts/janusbase.js
@@ -242,11 +242,22 @@ elation.require(['engine.things.generic', 'utils.template'], function() {
       }
       return childproxies;
     }
-    this.getAsset = function(type, id) {
-      if (!this.assets[type]) {
-        this.assets[type] = {};
+    this.getAsset = function(type, id, nocache) {
+      var parent = this.parent || this.room;
+
+      var asset;
+      if (this.assetpack) {
+        asset = this.assetpack.get(type, id);
+      }
+      if (!asset) {
+        asset = parent.getAsset(type, id);
+      }
+      if (asset && !nocache) {
+        if (!this.assets[type]) {
+          this.assets[type] = {};
+        }
+        this.assets[type][id] = asset;
       }
-      var asset = this.assets[type][id] = this.room.getAsset(type, id);
       return asset;
     }
     this.getActiveAssets = function(assetlist) {

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