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

Expose interpolation methods for 3D track in Animation class #73656

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

TokageItLab
Copy link
Member

@TokageItLab TokageItLab commented Feb 21, 2023

Animation::value_track_interpolate() is already exposed, but not for TRS3D/BlendShape tracks. They need to return an error internally to check for compression/decompression outside of interpolate().

Now we expose these wrapper functions for GDScript.

// Internal functions.
Error _position_track_interpolate(int p_track, double p_time, Vector3 *r_interpolation) const;
Error _rotation_track_interpolate(int p_track, double p_time, Quaternion *r_interpolation) const;
Error _scale_track_interpolate(int p_track, double p_time, Vector3 *r_interpolation) const;
Error _blend_shape_track_interpolate(int p_track, double p_time, float *r_blend) const;

// Bound functions.
Vector3 position_track_interpolate(int p_track, double p_time) const;
Quaternion rotation_track_interpolate(int p_track, double p_time) const;
Vector3 scale_track_interpolate(int p_track, double p_time) const;
float blend_shape_track_interpolate(int p_track, double p_time) const;

Copy link
Member

@SaracenOne SaracenOne left a comment

Choose a reason for hiding this comment

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

I think this looks good. Sorry I wasn't able to look at this for 4.0, but as discussed in the channel, I think we'll be able to get this in in a small point release.

@YuriSizov
Copy link
Contributor

This needs a rebase.

Also, we shouldn't rename the public method to have an underscore. You say those are "internal", but they are used throughout the codebase. Bound methods, on the other hand, don't need to be public, and can start with the underscore.

@TokageItLab
Copy link
Member Author

TokageItLab commented Apr 24, 2023

Rebased.

Renamed public core methods as follow:

Error _position_track_interpolate(int p_track, double p_time, Vector3 *r_interpolation) const;

to

Error try_position_track_interpolate(int p_track, double p_time, Vector3 *r_interpolation) const;

@akien-mga akien-mga merged commit be00dcd into godotengine:master Apr 25, 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