Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Default source skeleton to human since that is what most people will use

Scott Petrovic5629aaa4aa55
diff --git a/src/retarget/StepLoadSourceSkeleton.ts b/src/retarget/StepLoadSourceSkeleton.ts
index b7bea76..cc1c6d5 100644
--- a/src/retarget/StepLoadSourceSkeleton.ts
+++ b/src/retarget/StepLoadSourceSkeleton.ts
@@ -31,6 +31,21 @@ export class StepLoadSourceSkeleton extends EventTarget {
this.add_event_listeners()
this._added_event_listeners = true
}
+
+ // Auto-load the default human skeleton
+ this.load_default_skeleton()
+ }
+
+ private load_default_skeleton (): void {
+ // Set the skeleton type to human and load it automatically
+ this.skeleton_type = SkeletonType.Human
+
+ this.load_skeleton_from_path(`/${SkeletonType.Human}`).catch((error) => {
+ console.error('Failed to load default human skeleton:', error)
+ })
+
+ // Dispatch event to notify that skeleton is being loaded
+ this.dispatchEvent(new CustomEvent('skeleton-loading'))
}
private add_event_listeners (): void {
@@ -48,11 +63,6 @@ export class StepLoadSourceSkeleton extends EventTarget {
// Map selection to skeleton type enum
this.skeleton_type = this.get_skeleton_type_enum(selected_value)
- if (this.skeleton_type === SkeletonType.None) {
- console.error('Invalid skeleton selection:', selected_value)
- return
- }
-
// Clear any previously loaded skeleton
this.clear_previous_skeleton()
diff --git a/src/retarget/index.html b/src/retarget/index.html
index ace207a..af9a73a 100644
--- a/src/retarget/index.html
+++ b/src/retarget/index.html
@@ -50,15 +50,14 @@
<div class="bone-map-content">
<div id="skeleton-selection-container" >
<select id="skeleton-type-select" class="button">
- <option value="">-- Select Skeleton --</option>
- <option value="human">Human</option>
+ <option value="human" selected>Human</option>
<option value="quadraped">Quadruped (Fox)</option>
<option value="bird">Bird</option>
<option value="dragon">Dragon</option>
</select>
</div>
- <p>Bones List (Drag from here) <span id="source-bone-count">(0)</span></p>
+ <p>Bones List <span id="source-bone-count">(0)</span></p>
<div id="source-bones-list">
<p style="color: var(--text-secondary);">No source skeleton loaded</p>
</div>