Skip to content

Add animation support to gltf_importer#900

Merged
JannisX11 merged 12 commits into
JannisX11:masterfrom
Siydge:animated-gltf
May 31, 2026
Merged

Add animation support to gltf_importer#900
JannisX11 merged 12 commits into
JannisX11:masterfrom
Siydge:animated-gltf

Conversation

@Siydge
Copy link
Copy Markdown
Contributor

@Siydge Siydge commented May 9, 2026

Additions:

  • Add animation importing support to the gltf_importer plugin.
  • Fix compounding rotation with groups when importing a gltf model.

Example of compounding rotation on previous versions:
Screenshot_20260510_005412

This specifically occurs and wasn't noticed because Blockbench fails to recognize group rotation until the parts are updated or reloaded, i.e. moving the model around, which forces it to re-read the group rotation, or saving and reloading the project.
By applying rotation to just parts, we both fix the incorrect initial rendering issue, and also fix inaccurate / compounded rotation applied (rotation both applied to group and its descendants)

Current Bugs:

Animations don't show/render properly until you move the model, or reload the project. Unsure if there's a method in Blockbench to force this kind of an update, or if its a bug with Blockbench.
Fixed this, implemented Canvas.updateAll() to ensure these changes are detected.

@Siydge
Copy link
Copy Markdown
Contributor Author

Siydge commented May 10, 2026

Currently fixing an issue with inaccurate rotations once more.

@Siydge
Copy link
Copy Markdown
Contributor Author

Siydge commented May 10, 2026

I'm still trying to get things 1:1, it imports mostly right, but some animations aren't correct, or positions / rotations aren't perfect.
I think parts use ZXY and groups use XYZ Eulers? I have no clue.

@JannisX11
Copy link
Copy Markdown
Owner

@mr0x13f

@Siydge
Copy link
Copy Markdown
Contributor Author

Siydge commented May 10, 2026

Animations are now 1:1 for Blockbench -> Blockbench, same with groups rotation, and parts rotation.

@mr0x13f
Copy link
Copy Markdown
Contributor

mr0x13f commented May 11, 2026

I can't do super thorough testing because I don't have a lot of files with group animations to try, but the ones I do have work great! Blender also seems to agree on how the animations should look when importing the same glTF

@Siydge
Copy link
Copy Markdown
Contributor Author

Siydge commented May 16, 2026

I'm considering this feature complete, I was able to assist a user with importing a rigged and animated model into Blockbench (By baking the armatures in blender of course) and it imports perfectly.
The Euler's appear to be perfect matches in all of my tests, animations are 1:1, and I am confident in its current state.

@Siydge
Copy link
Copy Markdown
Contributor Author

Siydge commented May 16, 2026

Other than that. Which I forgot about...

@JannisX11
Copy link
Copy Markdown
Owner

Seems to generally work in my test as well. Please fix the validator issue (version mismatch), and clean up the code: You use patterns like (window as any), which should be avoided because it skips type checking. With the exception of maybe "Animation" which tends to conflict with DOM types. There is also a bunch of references to functions that don't exist and never have, such as Animator.updateContent() or Timeline.update(). Let me know if they are mentioned anywhere so I can investigate, but they shouldn't exist, and Typescript should also flag these as invalid if used correctly. Update blockbench-types to get the most up-to-date types.

@JannisX11 JannisX11 merged commit 78ff19f into JannisX11:master May 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants