Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

show a flat hiearachy warning

Scott Petrovice4097d2ad186
diff --git a/src/retarget/TargetBoneTreeDialog.ts b/src/retarget/TargetBoneTreeDialog.ts
index df7f9a9..3e866b7 100644
--- a/src/retarget/TargetBoneTreeDialog.ts
+++ b/src/retarget/TargetBoneTreeDialog.ts
@@ -40,12 +40,24 @@ export class TargetBoneTreeDialog {
.map((root_bone) => TargetBoneTreeDialog.create_bone_tree_html(root_bone, target_bones))
.join('')
+ // some imports may result where there is no hiearachy...which will create issues. show this in the view
+ // Check for flat hierarchy: if all bones are root bones (no parent-child relationships)
+ const is_flat_hierarchy = target_bones.size > 1 && root_target_bones.length === target_bones.size
+ const flat_hierarchy_warning_html = is_flat_hierarchy
+ ? `<div class="bone-tree-dialog-warning">
+ ⚠️ Flat hierarchy detected: all bones appear as root bones with no parent-child relationships.
+ This may indicate the skeleton was exported without hierarchy data (e.g. some FBX exports).
+ Retargeting will not work.
+ </div>`
+ : ''
+
const content_html = `
<div class="bone-tree-dialog-summary">
<span>Total bones: ${target_bones.size}</span>
<span>Root chains: ${root_target_bones.length}</span>
<span>Skinned meshes: ${this.target_skinned_mesh_count}</span>
</div>
+ ${flat_hierarchy_warning_html}
<ul class="bone-tree-dialog-list">
${tree_html}
</ul>
diff --git a/src/retarget/index.html b/src/retarget/index.html
index 325cde6..1553c6d 100644
--- a/src/retarget/index.html
+++ b/src/retarget/index.html
@@ -100,7 +100,10 @@
<p class="bone-map-heading">
<span>Your 3D Rig Model</span>
<span id="auto-bone-map-match">✨Mixamo</span>
- <span id="view-bone-tree-button" data-tippy-content="View bone hierarchy for for debugging purposes" style="display: none;">👓</span>
+ <span id="view-bone-tree-button"
+ data-tippy-content="View bone hierarchy for for debugging purposes" style="display: none;">
+ Analyze
+ </span>
</p>
<div class="bone-map-content">
<div style="display: flex; gap: 0.5rem; margin-bottom: 1rem;">
diff --git a/src/retarget/retarget.css b/src/retarget/retarget.css
index f23b10e..d7ec036 100644
--- a/src/retarget/retarget.css
+++ b/src/retarget/retarget.css
@@ -142,6 +142,17 @@ h1 {
border-bottom: 1px solid var(--bg-tertiary);
}
+.bone-tree-dialog-warning {
+ margin: 0.6rem 0;
+ padding: 0.5rem 0.75rem;
+ border-left: 3px solid #f0a500;
+ background: rgba(240, 165, 0, 0.1);
+ color: #f0a500;
+ font-size: 0.875rem;
+ line-height: 1.4;
+ border-radius: 0 4px 4px 0;
+}
+
.bone-tree-dialog-list,
.bone-tree-dialog-list ul {
list-style: none;
@@ -167,10 +178,9 @@ h1 {
}
#view-bone-tree-button {
- font-size: 1.5rem;
cursor: pointer;
opacity: 0.7;
- transition: opacity 0.3s;
+ text-decoration: underline;
}
#view-bone-tree-button:hover {
opacity: 1;