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

Implement AnimationNodeSub2 to AnimationTree and allow less or greater value in mathematical AnimationNode #76616

Merged
merged 1 commit into from
May 29, 2023

Conversation

TokageItLab
Copy link
Member

@TokageItLab TokageItLab commented Apr 30, 2023

If you want to use NodeAdd2 to blend animation, the difference from rest will be added unless the animation of the in port is rest. Also see godotengine/godot-proposals#2700 and #76310 for more information.

image

This can make the animation too exaggerated, so add a NodeSub2 to cancel the extra pose in advance and extract the delta animation. This improves the flexibility of NodeAdd2/Add3.

image

Test for calculation consistency. The following results are equivalent:

image

@@ -281,7 +281,7 @@ double AnimationNode::_blend_node(const StringName &p_subpath, const Vector<Stri
if (r_max) {
*r_max = 0;
for (int i = 0; i < blend_count; i++) {
*r_max = MAX(*r_max, blendw[i]);
*r_max = MAX(*r_max, Math::abs(blendw[i]));
Copy link
Member Author

@TokageItLab TokageItLab Apr 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed a problem in which graph lines were not colored when blend values were negative, even though blending occurred. This r_max only affects the activity value and not the actual blend value.

image

@TokageItLab TokageItLab force-pushed the implement-anim-node-sub2 branch 4 times, most recently from 69db072 to 8964743 Compare April 30, 2023 18:43
@TokageItLab TokageItLab changed the title Implement AnimationNodeSub2 to AnimationTree Implement AnimationNodeSub2 to AnimationTree and allow less or greater value in AnimationNodeAdd2/3 May 25, 2023
@TokageItLab
Copy link
Member Author

TokageItLab commented May 25, 2023

I remembered that the extracted additive animations are useful for amplification and knockback by using outside the 0~1 range blending, so I allowed them in Add2/3.

Godot.2023.05.25.-.15.36.24.02.mp4

Also, for consistency, it is applied to Blend2/3 & Sub2. Their calculations are meaningful and can be used for quick blending with amplified or inverted animations like a video in #63369.

@TokageItLab TokageItLab changed the title Implement AnimationNodeSub2 to AnimationTree and allow less or greater value in AnimationNodeAdd2/3 Implement AnimationNodeSub2 to AnimationTree and allow less or greater value in mathematical AnimationNode May 26, 2023
@TokageItLab TokageItLab force-pushed the implement-anim-node-sub2 branch 3 times, most recently from d5c6c5d to 9673291 Compare May 26, 2023 10:11
Copy link
Contributor

@MewPurPur MewPurPur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with this engine area, so giving some natural language suggestions.

It fell just outside of the diff, but I also suggest changing every instance of "node" with "animation node" around this area.

doc/classes/AnimationNodeAdd2.xml Outdated Show resolved Hide resolved
doc/classes/AnimationNodeAdd2.xml Outdated Show resolved Hide resolved
doc/classes/AnimationNodeAdd3.xml Outdated Show resolved Hide resolved
doc/classes/AnimationNodeAdd3.xml Outdated Show resolved Hide resolved
doc/classes/AnimationNodeBlend2.xml Outdated Show resolved Hide resolved
doc/classes/AnimationNodeBlend3.xml Outdated Show resolved Hide resolved
doc/classes/AnimationNodeBlend3.xml Outdated Show resolved Hide resolved
doc/classes/AnimationNodeSub2.xml Outdated Show resolved Hide resolved
@TokageItLab TokageItLab force-pushed the implement-anim-node-sub2 branch 7 times, most recently from 2ed8c40 to ead4886 Compare May 27, 2023 04:16
@TokageItLab
Copy link
Member Author

Fixed document tweak and rebased.

@TokageItLab TokageItLab requested review from fire and lyuma May 27, 2023 04:21
@akien-mga akien-mga merged commit aa739ba into godotengine:master May 29, 2023
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants