Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Do a better job with clearing all bones with all clearing type

Scott Petrovicf1572be27957
diff --git a/src/retarget/AnimationRetargetService.ts b/src/retarget/AnimationRetargetService.ts
index 4d6343f..9f20c11 100644
--- a/src/retarget/AnimationRetargetService.ts
+++ b/src/retarget/AnimationRetargetService.ts
@@ -36,6 +36,14 @@ export class AnimationRetargetService {
return this.bone_mappings
}
+ public clear_bone_mappings (): void {
+ this.bone_mappings.clear()
+ }
+
+ public reset_target_mapping_type (): void {
+ this.set_target_mapping_type(TargetBoneMappingType.Custom)
+ }
+
public set_source_armature (armature: Group): void {
this.source_armature = armature
}
diff --git a/src/retarget/index.html b/src/retarget/index.html
index c3c4d02..70b4774 100644
--- a/src/retarget/index.html
+++ b/src/retarget/index.html
@@ -138,7 +138,7 @@
<div style="display: flex; padding: 1rem; justify-content: flex-end; align-items: center; gap: 0.25rem;">
<button id="continue-to-listing-button" disabled>Continue</button>
<span id="continue-button-tooltip"
- data-tippy-content="Map at least one source bone to a target bone before continuing."
+ data-tippy-content="Map at least one source bone to a target bone before continuing by dragging a bone from the source bones list to the target bones list."
aria-label="Continue requirements help"
style="display: inline-flex; align-items: center; color: var(--text-secondary); cursor: help;"
>
diff --git a/src/retarget/steps/StepBoneMapping.ts b/src/retarget/steps/StepBoneMapping.ts
index b1bb527..4be3da7 100644
--- a/src/retarget/steps/StepBoneMapping.ts
+++ b/src/retarget/steps/StepBoneMapping.ts
@@ -288,6 +288,9 @@ export class StepBoneMapping extends EventTarget {
const target_bone_name = target.dataset.targetBoneName
if (source_bone_name !== '' && target_bone_name !== undefined) {
+ // Manual drag/drop means we are using custom mappings, not an auto-map preset.
+ AnimationRetargetService.getInstance().set_target_mapping_type(TargetBoneMappingType.Custom)
+
// Update the mapping
// this.bone_mapping.set(target_bone_name, source_bone_name)
AnimationRetargetService.getInstance().get_bone_mappings().set(target_bone_name, source_bone_name)
@@ -347,7 +350,8 @@ export class StepBoneMapping extends EventTarget {
// Clear a specific mapping
public clear_bone_mapping (target_bone_name: string): void {
// this.bone_mapping.delete(target_bone_name)
- AnimationRetargetService.getInstance().get_bone_mappings().delete(target_bone_name)
+ const retarget_service = AnimationRetargetService.getInstance()
+ retarget_service.get_bone_mappings().delete(target_bone_name)
this.update_target_bones_list()
this.update_clear_button_visibility()
@@ -358,7 +362,9 @@ export class StepBoneMapping extends EventTarget {
// Clear all mappings
public clear_all_bone_mappings (): void {
// this.bone_mapping.clear()
- AnimationRetargetService.getInstance().set_bone_mappings(new Map<string, string>())
+ const retarget_service = AnimationRetargetService.getInstance()
+ retarget_service.clear_bone_mappings()
+ retarget_service.reset_target_mapping_type()
this.update_target_bones_list()
this.update_clear_button_visibility()