Import a 3D Model and automatically assign and export animations
TypeScript
Default loading human mesh. Start reset logic
Scott Petrovic03cb533f7d70
diff --git a/src/marketing/MarketingBootstrap.ts b/src/marketing/MarketingBootstrap.tsindex 08fb9f4..ddf14b8 100644--- a/src/marketing/MarketingBootstrap.ts+++ b/src/marketing/MarketingBootstrap.ts@@ -3,7 +3,7 @@ import { SkeletonType } from '../lib/enums/SkeletonType'import { Mesh2MotionEngine } from '../Mesh2MotionEngine'export class MarketingBootstrap {- private readonly mesh2motion_engine: Mesh2MotionEngine+ private mesh2motion_engine: Mesh2MotionEngineprivate skeleton_type: SkeletonType = SkeletonType.Noneconstructor () {@@ -11,6 +11,11 @@ export class MarketingBootstrap {this.add_event_listeners()}+ public reset_to_beginning (): void {+ // reset data points and our current step of the process so we can continue+ this.mesh2motion_engine.process_step_changed(ProcessStep.LoadModel)+ }+public setup_model_buttons (): void {// add click events for each button typeconst human_button = document.getElementById('load-human-model-button')@@ -19,43 +24,51 @@ export class MarketingBootstrap {const dragon_button = document.getElementById('load-dragon-model-button')human_button?.addEventListener('click', () => {+ this.reset_to_beginning()this.mesh2motion_engine.load_model_step.load_model_file('../models/model-human.glb', 'glb')this.skeleton_type = SkeletonType.Human})fox_button?.addEventListener('click', () => {+ this.reset_to_beginning()this.mesh2motion_engine.load_model_step.load_model_file('../models/model-fox.glb', 'glb')this.skeleton_type = SkeletonType.Quadraped})bird_button?.addEventListener('click', () => {+ this.reset_to_beginning()this.mesh2motion_engine.load_model_step.load_model_file('../models/model-bird.glb', 'glb')this.skeleton_type = SkeletonType.Bird})dragon_button?.addEventListener('click', () => {+ this.reset_to_beginning()this.mesh2motion_engine.load_model_step.load_model_file('../models/model-dragon.glb', 'glb')this.skeleton_type = SkeletonType.Dragon})++ human_button?.click() // load human by default to start us out}public add_event_listeners (): void {// event after the DOM is fully loaded for HTML elementsdocument.addEventListener('DOMContentLoaded', () => {- this.setup_model_buttons()-+ // events to trigger after model and skeleton are loadedthis.mesh2motion_engine.load_model_step.addEventListener('modelLoaded', () => {// this (this.skeleton_type) value contains the filename for the skeleton rigthis.mesh2motion_engine.load_skeleton_step.load_skeleton_file('../' + this.skeleton_type)this.mesh2motion_engine.load_skeleton_step.set_skeleton_type(this.skeleton_type)+ // need to automatically finish the edit skeleton step and move onto the next step+ // this needs to be added after the load skeleton is done...since it expects a valid skeletonthis.mesh2motion_engine.load_skeleton_step.addEventListener('skeletonLoaded', () => {- // need to automatically finish the edit skeleton step and move onto the next stepthis.mesh2motion_engine.animations_listing_step.set_animations_file_path('../animations/')this.mesh2motion_engine.process_step_changed(ProcessStep.BindPose)})})- })++ this.setup_model_buttons() // automatically trigger the human once we begin for the default+ }) // end the DOMContentLoaded function}}