forked from playcanvas/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhierarchy.js
More file actions
36 lines (29 loc) · 952 Bytes
/
hierarchy.js
File metadata and controls
36 lines (29 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
pc.extend(pc, function () {
'use strict';
var HierarchyHandler = function (app) {
this._app = app;
};
HierarchyHandler.prototype = {
load: function (url, callback) {
pc.http.get(url, function (err, response) {
if (!err) {
callback(null, response);
} else {
callback("Error requesting scene: " + url);
}
});
},
open: function (url, data) {
// prevent script initialization until entire scene is open
this._app.systems.script.preloading = true;
var parser = new pc.SceneParser(this._app);
var parent = parser.parse(data);
// re-enable script initialization
this._app.systems.script.preloading = false;
return parent;
}
};
return {
HierarchyHandler: HierarchyHandler
};
}());