Skip to content

Commit

Permalink
call Mesh.initPoses() before posing
Browse files Browse the repository at this point in the history
otherwise posing will result in a mess
  • Loading branch information
markandre13 committed Dec 2, 2023
1 parent d74e4d4 commit a2da3a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/PosePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ let tiles: Tile[]
let selectedJoint: number | undefined = undefined

export function posesBodyPanel(mesh: Mesh) {
mesh.initPoses()
const panel: HTMLElement[] = []
tiles = new Array<Tile>(poseTargets.length)
for (let jointIdx = 1; jointIdx < poseTargets.length; ++jointIdx) {
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function main() {
mgr.calcWidgetTargets()

// console.log("init poses")
mesh.initPoses()
// mesh.initPoses()

// console.log(mesh)

Expand Down
8 changes: 2 additions & 6 deletions src/screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ interface ToolDef {
desc: string
img?: HTMLImageElement
render?: (mesh: Mesh, mgr: SelectorListener) => Fragment
dom?: Fragment // FIXME: toad.jsx can not initialize the same JSX twice, hence we must cache
}

const toolbarDefinition: ToolDef[] = [
Expand Down Expand Up @@ -52,11 +51,8 @@ function setTab(mesh: Mesh, mgr: SelectorListener, tab: ToolDef) {
}
activeTab = tab
activeTab.img!.src = `images/ui/toolbar_${activeTab.file}_over.png`
if (tab.dom === undefined && tab.render !== undefined) {
tab.dom = tab.render(mesh, mgr)
}
if (tab.dom !== undefined) {
refs.panel.replaceChildren(...tab.dom)
if (tab.render !== undefined) {
refs.panel.replaceChildren(...tab.render(mesh, mgr))
} else {
refs.panel.replaceChildren()
}
Expand Down

0 comments on commit a2da3a6

Please sign in to comment.