Fix custom partial animations leaving peds rigid - #5101
Merged
FileEX merged 2 commits intoJul 30, 2026
Conversation
Replacing a partial animation like a weapon fire with one from a custom IFP left the ped rigid; it could still walk around, but its legs and torso stopped animating. Loading an IFP pads every animation out to all 32 bones, filling the ones it does not define with a fixed pose. A partial animation is only meant to drive part of the skeleton, so that padding took over the root, pelvis and legs as well. The replacement is now trimmed back to the bones the original animates, read from its static association.
|
Tested this and it worked. I tested with all the custom animations he provided in the test script. I've even test with fighta_block and no problems. |
FileEX
requested changes
Jul 30, 2026
Member
|
I think it would be good to have this in the upcoming 1.7 release. It looks good to me, and I trust that RughCuttle has tested it. |
FileEX
approved these changes
Jul 30, 2026
1 task
Contributor
|
goated PR, thank you so much dude |
This was referenced Jul 30, 2026
TheCrazy17
added a commit
to TheCrazy17/mtasa-blue
that referenced
this pull request
Jul 31, 2026
Dropped noexcept from two functions that touch raw game memory, per FileEx's feedback on multitheftauto#5101. Removed an unused GetTrainTrack accessor, a stray forward declaration, and an old comment from before this branch existed.
1 task
2 tasks
FileEX
pushed a commit
that referenced
this pull request
Aug 2, 2026
) #### Summary Fixes custom partial animations played straight from a custom IFP bank (via `engineLoadIFP` + `setPedAnimation`) leaving the ped rigid, the same padding problem #5101 fixed for `engineReplaceAnimation`. `CClientIFP` pads every loaded animation out to 32 bones regardless of what the source IFP actually defines. #5101 trimmed that padding by comparing against the built-in animation being replaced, but an animation played directly from a custom bank has no built-in original to compare against, so the fix never applied there and the padding kept driving the root, pelvis and legs. `CClientIFP` now records which bones an animation actually defines while parsing it. `CAnimBlendAssociation` gains `RestrictToBones(mask)`, a sibling of `RestrictToBonesOf` driven by that record instead of a built-in original; `CClientPed` applies it once the animation is actually playing. #### Motivation Continuation of #5101. That fix only covered animations replacing a built-in one; partial animations loaded into their own custom bank and played directly still went rigid. Fixes #5121. #### Test plan Loaded a custom IFP with a partial animation (upper body only, e.g. `crry_prtial`) into a custom bank via `engineLoadIFP`, played it with `setPedAnimation` on a ped. Before the fix the ped froze in place; after, the custom animation plays on the upper body while walking, turning and leg movement keep working normally. Also re-tested #5101's original `engineReplaceAnimation` scenario to confirm that path is untouched. Test script, thanks to @RughCuttle [partialtest.zip](https://github.com/user-attachments/files/30626244/partialtest.zip) #### Checklist * [x] Your code should follow the [coding guidelines](https://wiki.multitheftauto.com/index.php?title=Coding_guidelines). * [x] Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replacing a partial animation, like any of the weapon fire ones, with an animation loaded from a custom IFP left the ped rigid. It could still be walked around, but the legs and torso stopped animating and it stayed locked facing one direction.
Loading an IFP pads every animation out to all 32 bones and fills the ones the animation does not define with a fixed pose. A full body animation needs that padding, but a partial animation is only meant to drive part of the skeleton and leave the rest to whatever movement animation is playing, so the padding ended up driving the root, pelvis and legs as well.
The replacement is now trimmed back to the bones the original animation drives, read from its static association, so the padding can no longer reach bones the original never touched. This only runs for partial animations, so full body replacements keep taking exactly the same path as before.
Before: https://www.youtube.com/watch?v=gqyxviWVcJE
After:
MTA_.San.Andreas.DEBUG.mp4
Motivation
Fixes #2733 and #3055.
Custom weapon animations have been unusable for a long time.
Test plan
partialanimtest.zip
Tested with a small resource that loads a custom shotgun.ifp and binds two keys, one calling
engineReplaceAnimationon"shotgun"/"shotgun_fire"and the other callingengineRestoreAnimationto go back to the stock one.Before the change, once the animation was replaced, aiming and firing the shotgun locked the ped facing a single direction with the legs and torso frozen, so it slid around without any walking animation.
After the change, the custom fire animation plays on the upper body while the ped keeps walking, turning and animating normally, and restoring brings the stock animation back.
Checklist