Is there a way to check if the traverse function is complete (finished traversing the scene)?
Something like (example)
fbx.traverse( function( c )
if ( c instanceof THREE.Camera ) {
// Debug log camera child
console.log( c
}).onComplete(function( e ) {
// Do something on complete
}
Explanation of problem: Whena user selects a FBX file, it traverses it for all cameras. If it's a valid FBX file, and successfully read, it then processes 'FBX loaded. Found ' + count + ' camera(s).'
The issue is, when I load a FBX file, I can cleary see it states "0" cameras, before the traverse has found a camera. Then it changes to 1. I'd like to know when the traverse is complete, so the user can be notified it's safe to export converted camera file.
Otherwise they may download before the traverse function is even complete.
Current Code
reader.addEventListener( "load", function( e )
const buffer = event.target.result,
loader = new THREE.FBXLoader(),
fbx = loader.parse( buffer );
var count = 0;
fbx.traverse( function( c )
if ( c instanceof THREE.Camera ) {
// Debug log camera child
console.log( c
count+
});
msg.innerHTML = '<span class="green">FBX loaded. Found <strong>' + count + '</strong> camera(s).</span>';
});