add options to load_url for grouping and file name
This commit is contained in:
parent
7fb36b91a6
commit
9e89eef250
2 changed files with 4 additions and 4 deletions
|
|
@ -1875,11 +1875,11 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||||
}, formdata, scale);
|
}, formdata, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
function platformLoadURL(url, group) {
|
function platformLoadURL(url, options = {}) {
|
||||||
platform.group();
|
platform.group();
|
||||||
MOTO.URL.load(url).then((objects) => {
|
MOTO.URL.load(url, options).then((objects) => {
|
||||||
for (let object of objects) {
|
for (let object of objects) {
|
||||||
let widget = newWidget(undefined, group).loadVertices(object.mesh);
|
let widget = newWidget(undefined, options.group).loadVertices(object.mesh);
|
||||||
widget.meta.file = object.file;
|
widget.meta.file = object.file;
|
||||||
platform.add(widget);
|
platform.add(widget);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
function load(url, options = {}) {
|
function load(url, options = {}) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
let file = (((url.split('?')[0]).split('#')[0]).split('/')).pop();
|
let file = options.file || options.filename || (((url.split('?')[0]).split('#')[0]).split('/')).pop();
|
||||||
let ext = file.split('.').pop().toLowerCase();
|
let ext = file.split('.').pop().toLowerCase();
|
||||||
let deftype = ext === "obj" ? "text" : "arraybuffer";
|
let deftype = ext === "obj" ? "text" : "arraybuffer";
|
||||||
let datatype = options.datatype || deftype;
|
let datatype = options.datatype || deftype;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue