diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml index 942299cc7e4..887e9cda819 100644 --- a/doc/classes/Animation.xml +++ b/doc/classes/Animation.xml @@ -293,6 +293,15 @@ Returns the arguments values to be called on a method track for a given key in a given track. + + + + + + + Optimize the animation and all its tracks in-place. This will preserve only as many keys as are necessary to keep the animation within the specified bounds. + + diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index a2ed6af23c3..31d195d948e 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -3902,6 +3902,7 @@ void Animation::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &Animation::clear); ClassDB::bind_method(D_METHOD("copy_track", "track_idx", "to_animation"), &Animation::copy_track); + ClassDB::bind_method(D_METHOD("optimize", "allowed_velocity_err", "allowed_angular_err", "precision"), &Animation::optimize, DEFVAL(0.01), DEFVAL(0.01), DEFVAL(3)); ClassDB::bind_method(D_METHOD("compress", "page_size", "fps", "split_tolerance"), &Animation::compress, DEFVAL(8192), DEFVAL(120), DEFVAL(4.0)); ClassDB::bind_method(D_METHOD("is_capture_included"), &Animation::is_capture_included);