Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Improve AnimationMixer page. #27914

Merged
merged 2 commits into from
Mar 18, 2024
Merged

Docs: Improve AnimationMixer page. #27914

merged 2 commits into from
Mar 18, 2024

Conversation

trusktr
Copy link
Contributor

@trusktr trusktr commented Mar 13, 2024

and tip at using it when there is a single root upon disposing a mixer. (Let me know if this doc update is correct, it wasn't clear to me from the doc, which is why I'd like to clarify it)

Related issue: N/A

Description

Make it a little easier to understand how to clean up.

This contribution is funded by Lume (3D HTML elements)

…on()` will call `AnimationAction.stop()` on all actions, and tip at using it when there is a single root upon disposing a mixer.
@trusktr
Copy link
Contributor Author

trusktr commented Mar 13, 2024

I'm making this doc update based on code like this (wondering if it is correct):

                // After loading an asset with GLTFLoader, make the mixer.
                let mixer = new AnimationMixer(model.scene)

                // Play all animations by default.
                for (const anim of model.animations) {
                    const action = mixer.clipAction(anim)
                    action.play()
                }

                // ... later when ready to dispose animations (f.e. keeping the model, but applying different animations)
                mixer.stopAllAction()
                mixer.uncacheRoot(model.scene)
                
                // ... even later, create a new AnimationMixer with new animations, using the same model.scene root.
                // ... even later, dispose animations the same way, etc

@Mugen87 Mugen87 added this to the r163 milestone Mar 14, 2024
@Mugen87 Mugen87 changed the title Update AnimationMixer.html: describe that AnimationMixer.stopAllAction() will call AnimationAction.stop() on all actions, Docs: Improve AnimationMixer page. Mar 14, 2024
@Mugen87 Mugen87 merged commit 83f7580 into mrdoob:dev Mar 18, 2024
1 of 2 checks passed
@trusktr trusktr deleted the patch-26 branch March 19, 2024 04:57
Repository owner deleted a comment from Mosth8dplayer666 Mar 20, 2024
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