Import a 3D Model and automatically assign and export animations
TypeScript
Bring back FBX import. I think I just don't know how to export out FBX files right
Scott Petrovic37a37740e13f
diff --git a/src/index.html b/src/index.htmlindex 32f7d97..8256e64 100644--- a/src/index.html+++ b/src/index.html@@ -40,7 +40,7 @@<div id="load-model-tools">- <p class="step-instructions">Supports GLTF or GLB model files.</p>+ <p class="step-instructions">Supports GLTF,GLB and FBX files.</p><label for="model-upload" class="button" ><span class="button-icon-group">@@ -48,7 +48,7 @@<span>Upload Custom Model</span></span></label>- <input id="model-upload" type="file" name="file-upload" accept=".glb, .gltf" />+ <input id="model-upload" type="file" name="file-upload" accept=".glb, .gltf, .fbx" /><div style="text-align: center; font-size: 1.5rem">or</div>diff --git a/src/lib/processes/StepLoadModel.ts b/src/lib/processes/StepLoadModel.tsindex 0c3e3ee..0a6c92c 100644--- a/src/lib/processes/StepLoadModel.ts+++ b/src/lib/processes/StepLoadModel.ts@@ -155,25 +155,25 @@ export class StepLoadModel extends EventTarget {}}- private process_loaded_scene (loaded_scene: Scene, max_height: number): void {+ private process_loaded_scene(loaded_scene: Scene, max_height: number): void {this.original_model_data = loaded_scene.clone()this.original_model_data.name = 'Cloned Scene'+ this.original_model_data.traverse((child) => {+ child.castShadow = true+ })+// strip out stuff that we are not bringing into the model stepconst clean_scene_with_only_models = this.strip_out_all_unecessary_model_data(this.original_model_data)- // this.scale_model_on_import(clean_scene_with_only_models, max_height) // if we have multiple objects, we want to scale them all the same+ this.scale_model_on_import(clean_scene_with_only_models, max_height) // if we have multiple objects, we want to scale them all the same- // additional data cleanup and normalization+ // loop through each child in scene and reset rotation+ // if we don't the skinning process doesn't take rotation into account+ // and creates odd resultsclean_scene_with_only_models.traverse((child) => {- // make sure all the meshes can cast shadow onto the ground- child.castShadow = true-- // make sure all the meshes have a scale of 1,1,1- // this should also update the buffer geometry data- if (child.type === 'Mesh') {- child.scale.set(1, 1, 1)- }+ child.rotation.set(0, 0, 0)})+console.log('Model loaded', clean_scene_with_only_models)// assign the final cleaned up model to the original model data@@ -216,7 +216,6 @@ export class StepLoadModel extends EventTarget {return new_scene}- // unused for now until I figure out what to do with this...or even if we need itprivate scale_model_on_import (scene_object: Scene, max_height = 1.0): void {let scale_factor: number = 1.0