You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Avoid animation length from ever being completely, fixes #19420
This commit is contained in:
@@ -643,6 +643,8 @@ void AnimationTimelineEdit::_anim_length_changed(double p_new_len) {
|
|||||||
if (editing)
|
if (editing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
p_new_len = MAX(0.001, p_new_len);
|
||||||
|
|
||||||
editing = true;
|
editing = true;
|
||||||
*block_animation_update_ptr = true;
|
*block_animation_update_ptr = true;
|
||||||
undo_redo->create_action("Change animation length");
|
undo_redo->create_action("Change animation length");
|
||||||
@@ -1059,7 +1061,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() {
|
|||||||
time_icon->set_tooltip(TTR("Animation Length Time (seconds)"));
|
time_icon->set_tooltip(TTR("Animation Length Time (seconds)"));
|
||||||
len_hb->add_child(time_icon);
|
len_hb->add_child(time_icon);
|
||||||
length = memnew(EditorSpinSlider);
|
length = memnew(EditorSpinSlider);
|
||||||
length->set_min(0);
|
length->set_min(0.001);
|
||||||
length->set_max(3600);
|
length->set_max(3600);
|
||||||
length->set_step(0.01);
|
length->set_step(0.01);
|
||||||
length->set_allow_greater(true);
|
length->set_allow_greater(true);
|
||||||
|
|||||||
@@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include "geometry.h"
|
#include "geometry.h"
|
||||||
|
|
||||||
|
#define ANIM_MIN_LENGTH 0.001
|
||||||
|
|
||||||
bool Animation::_set(const StringName &p_name, const Variant &p_value) {
|
bool Animation::_set(const StringName &p_name, const Variant &p_value) {
|
||||||
|
|
||||||
String name = p_name;
|
String name = p_name;
|
||||||
@@ -2524,7 +2526,9 @@ StringName Animation::animation_track_get_key_animation(int p_track, int p_key)
|
|||||||
|
|
||||||
void Animation::set_length(float p_length) {
|
void Animation::set_length(float p_length) {
|
||||||
|
|
||||||
ERR_FAIL_COND(length < 0);
|
if (p_length < ANIM_MIN_LENGTH) {
|
||||||
|
p_length = ANIM_MIN_LENGTH;
|
||||||
|
}
|
||||||
length = p_length;
|
length = p_length;
|
||||||
emit_changed();
|
emit_changed();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user