Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit 06d2cd3

Browse files
Update ASSIMP Viewer
1 parent f09dd7a commit 06d2cd3

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

viewers/templates/ASSIMP Viewer.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356
height: 50vh;
357357
top: 50vh;
358358
left: 25vw;
359-
padding: 10px;
359+
padding: 5px;
360360
border: none;
361361
}
362362

@@ -371,7 +371,7 @@
371371
height: 50vh;
372372
top: 50vh;
373373
left: 25vw;
374-
padding: 10px;
374+
padding: 5px;
375375
border: none;
376376
}
377377

@@ -3193,13 +3193,13 @@
31933193
}
31943194
}
31953195

3196-
function load_with_assimp( fetched_files = null, from_url = false ) {
3196+
async function load_with_assimp( fetched_files = null, from_url = false ) {
31973197
if (fetched_files === null) return;
31983198

31993199
assimp_load = true;
32003200

32013201
// Use ASSIMPJS to load files - some models might take time to load
3202-
assimpjs().then( async function( ajs ) {
3202+
await assimpjs().then( async function( ajs ) {
32033203
if (from_url === true) {
32043204
Promise.all( assimp_files.map( ( file, index ) => fetch( fetched_files[ index ] ) )).then( ( responses ) => {
32053205
return Promise.all( responses.map( ( res ) => res.arrayBuffer() ) );
@@ -3263,7 +3263,7 @@
32633263
result = null;
32643264
resultFile = null;
32653265

3266-
load_components( false );
3266+
load_components( from_url );
32673267
}
32683268
});
32693269
}
@@ -3392,6 +3392,8 @@
33923392
// Load DRACO or gltf file
33933393
if (selected_gltf_file !== null) loadFile();
33943394
else if (selected_draco_file !== null) loadDRACO();
3395+
} else {
3396+
if (assimp_load === true && selected_gltf_file !== null) loadFile();
33953397
}
33963398
}
33973399

@@ -3704,9 +3706,9 @@
37043706
}
37053707

37063708
function loadFile() {
3707-
let lfile = local_files[ selected_gltf_file ];
3709+
let lfile = local_files ? local_files[ selected_gltf_file ] : ( assimp_load === true ? selected_gltf_file : null );
37083710

3709-
gltf_loader.load( URL.createObjectURL( assimp_load === true ? selected_gltf_file : lfile ), async function( gltf ) {
3711+
gltf_loader.load( URL.createObjectURL( lfile ), async function( gltf ) {
37103712
URL.revokeObjectURL( assimp_load === true ? selected_gltf_file : lfile );
37113713

37123714
parser = gltf.parser;
@@ -4059,7 +4061,7 @@
40594061
handle_error( error );
40604062
});
40614063
} else {
4062-
gltf_loader.load( selected_gltf_url_file, async function( gltf ) {
4064+
gltf_loader.load( selected_gltf_url_file ? selected_gltf_url_file : selected_gltf_file, async function( gltf ) {
40634065
parser = gltf.parser;
40644066
scenes = gltf.scenes;
40654067
cameras = gltf.cameras;

0 commit comments

Comments
 (0)