Merge pull request #90894 from lyuma/animation_step_30
Set animation step from importers. Increase default step from 10 to 30FPS
This commit is contained in:
commit
17d9c52ad9
8 changed files with 12 additions and 3 deletions
|
@ -602,7 +602,7 @@
|
|||
<member name="loop_mode" type="int" setter="set_loop_mode" getter="get_loop_mode" enum="Animation.LoopMode" default="0">
|
||||
Determines the behavior of both ends of the animation timeline during animation playback. This is used for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
|
||||
</member>
|
||||
<member name="step" type="float" setter="set_step" getter="get_step" default="0.1">
|
||||
<member name="step" type="float" setter="set_step" getter="get_step" default="0.0333333">
|
||||
The animation step value.
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -1556,6 +1556,7 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
|
|||
}
|
||||
|
||||
animation->set_length(anim_length);
|
||||
animation->set_step(snapshot_interval);
|
||||
|
||||
bool tracks_found = false;
|
||||
|
||||
|
|
|
@ -1908,6 +1908,7 @@ void ResourceImporterScene::_create_slices(AnimationPlayer *ap, Ref<Animation> a
|
|||
|
||||
new_anim->set_loop_mode(loop_mode);
|
||||
new_anim->set_length(to - from);
|
||||
new_anim->set_step(anim->get_step());
|
||||
|
||||
al->add_animation(name, new_anim);
|
||||
|
||||
|
|
|
@ -548,8 +548,13 @@ void AnimationPlayerEditor::_animation_name_edited() {
|
|||
} break;
|
||||
|
||||
case TOOL_NEW_ANIM: {
|
||||
String current = animation->get_item_text(animation->get_selected());
|
||||
Ref<Animation> current_anim = player->get_animation(current);
|
||||
Ref<Animation> new_anim = Ref<Animation>(memnew(Animation));
|
||||
new_anim->set_name(new_name);
|
||||
if (current_anim.is_valid()) {
|
||||
new_anim->set_step(current_anim->get_step());
|
||||
}
|
||||
String library_name;
|
||||
Ref<AnimationLibrary> al;
|
||||
library_name = library->get_item_metadata(library->get_selected());
|
||||
|
|
|
@ -1699,6 +1699,7 @@ void FBXDocument::_import_animation(Ref<FBXState> p_state, AnimationPlayer *p_an
|
|||
Ref<Animation> animation;
|
||||
animation.instantiate();
|
||||
animation->set_name(anim_name);
|
||||
animation->set_step(1.0 / p_bake_fps);
|
||||
|
||||
if (anim->get_loop()) {
|
||||
animation->set_loop_mode(Animation::LOOP_LINEAR);
|
||||
|
|
|
@ -5881,6 +5881,7 @@ void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_
|
|||
Ref<Animation> animation;
|
||||
animation.instantiate();
|
||||
animation->set_name(anim_name);
|
||||
animation->set_step(1.0 / p_bake_fps);
|
||||
|
||||
if (anim->get_loop()) {
|
||||
animation->set_loop_mode(Animation::LOOP_LINEAR);
|
||||
|
|
|
@ -266,7 +266,7 @@ private:
|
|||
_FORCE_INLINE_ void _track_get_key_indices_in_range(const Vector<T> &p_array, double from_time, double to_time, List<int> *p_indices, bool p_is_backward) const;
|
||||
|
||||
double length = 1.0;
|
||||
real_t step = 0.1;
|
||||
real_t step = 1.0 / 30;
|
||||
LoopMode loop_mode = LOOP_NONE;
|
||||
|
||||
void _track_update_hash(int p_track);
|
||||
|
|
|
@ -41,7 +41,7 @@ TEST_CASE("[Animation] Empty animation getters") {
|
|||
const Ref<Animation> animation = memnew(Animation);
|
||||
|
||||
CHECK(animation->get_length() == doctest::Approx(real_t(1.0)));
|
||||
CHECK(animation->get_step() == doctest::Approx(real_t(0.1)));
|
||||
CHECK(animation->get_step() == doctest::Approx(real_t(1.0 / 30)));
|
||||
}
|
||||
|
||||
TEST_CASE("[Animation] Create value track") {
|
||||
|
|
Loading…
Reference in a new issue