You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Revert "Added toggle for loop interpolation based on adolson's code"
This reverts commits8884b8f519bd5c8f2aa0and5cb31f6d5b. <reduz> Akien, I understand the need for the second loop mode, but I think the current UI is pretty confusing. I think this should be changed for an enum, both there and in the animation.. otherwise we should revert it [...] <reduz> alternatively this could be added per track, which I think should make it a little less confusing Reopens #959..
This commit is contained in:
@@ -540,7 +540,6 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd,float p_delta,flo
|
|||||||
|
|
||||||
float len=cd.from->animation->get_length();
|
float len=cd.from->animation->get_length();
|
||||||
bool loop=cd.from->animation->has_loop();
|
bool loop=cd.from->animation->has_loop();
|
||||||
bool loop_interpolation=cd.from->animation->has_loop_interpolation();
|
|
||||||
|
|
||||||
if (!loop) {
|
if (!loop) {
|
||||||
|
|
||||||
@@ -566,20 +565,9 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd,float p_delta,flo
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (loop_interpolation) {
|
|
||||||
|
|
||||||
next_pos=Math::fposmod(next_pos,len);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (next_pos<0 || next_pos>len) {
|
next_pos=Math::fposmod(next_pos,len);
|
||||||
if (!backwards)
|
|
||||||
next_pos=0;
|
|
||||||
else if (backwards)
|
|
||||||
next_pos=len;
|
|
||||||
}
|
|
||||||
// fix delta - not sure if needed here
|
|
||||||
delta=next_pos-cd.pos;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) {
|
|||||||
set_length(p_value);
|
set_length(p_value);
|
||||||
else if (name=="loop")
|
else if (name=="loop")
|
||||||
set_loop(p_value);
|
set_loop(p_value);
|
||||||
else if (name=="loop_interpolation")
|
|
||||||
set_loop_interpolation(p_value);
|
|
||||||
else if (name=="step")
|
else if (name=="step")
|
||||||
set_step(p_value);
|
set_step(p_value);
|
||||||
else if (name.begins_with("tracks/")) {
|
else if (name.begins_with("tracks/")) {
|
||||||
@@ -270,8 +268,6 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const {
|
|||||||
r_ret= length;
|
r_ret= length;
|
||||||
else if (name=="loop")
|
else if (name=="loop")
|
||||||
r_ret= loop;
|
r_ret= loop;
|
||||||
else if (name=="loop_interpolation")
|
|
||||||
r_ret= loop_interpolation;
|
|
||||||
else if (name=="step")
|
else if (name=="step")
|
||||||
r_ret= step;
|
r_ret= step;
|
||||||
else if (name.begins_with("tracks/")) {
|
else if (name.begins_with("tracks/")) {
|
||||||
@@ -437,7 +433,6 @@ void Animation::_get_property_list( List<PropertyInfo> *p_list) const {
|
|||||||
|
|
||||||
p_list->push_back( PropertyInfo( Variant::REAL, "length", PROPERTY_HINT_RANGE, "0.001,99999,0.001"));
|
p_list->push_back( PropertyInfo( Variant::REAL, "length", PROPERTY_HINT_RANGE, "0.001,99999,0.001"));
|
||||||
p_list->push_back( PropertyInfo( Variant::BOOL, "loop" ));
|
p_list->push_back( PropertyInfo( Variant::BOOL, "loop" ));
|
||||||
p_list->push_back( PropertyInfo( Variant::BOOL, "loop_interpolation"));
|
|
||||||
p_list->push_back( PropertyInfo( Variant::REAL, "step", PROPERTY_HINT_RANGE, "0,4096,0.001" ));
|
p_list->push_back( PropertyInfo( Variant::REAL, "step", PROPERTY_HINT_RANGE, "0,4096,0.001" ));
|
||||||
|
|
||||||
for (int i=0;i<tracks.size();i++) {
|
for (int i=0;i<tracks.size();i++) {
|
||||||
@@ -1244,7 +1239,7 @@ T Animation::_interpolate( const Vector< TKey<T> >& p_keys, float p_time, Inter
|
|||||||
float c=0;
|
float c=0;
|
||||||
// prepare for all cases of interpolation
|
// prepare for all cases of interpolation
|
||||||
|
|
||||||
if (loop && loop_interpolation) {
|
if (loop) {
|
||||||
// loop
|
// loop
|
||||||
if (idx>=0) {
|
if (idx>=0) {
|
||||||
|
|
||||||
@@ -1632,19 +1627,10 @@ void Animation::set_loop(bool p_enabled) {
|
|||||||
loop=p_enabled;
|
loop=p_enabled;
|
||||||
emit_changed();
|
emit_changed();
|
||||||
}
|
}
|
||||||
void Animation::set_loop_interpolation(bool p_enabled) {
|
|
||||||
|
|
||||||
loop_interpolation=p_enabled;
|
|
||||||
emit_changed();
|
|
||||||
}
|
|
||||||
bool Animation::has_loop() const {
|
bool Animation::has_loop() const {
|
||||||
|
|
||||||
return loop;
|
return loop;
|
||||||
}
|
}
|
||||||
bool Animation::has_loop_interpolation() const {
|
|
||||||
|
|
||||||
return loop_interpolation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Animation::track_move_up(int p_track) {
|
void Animation::track_move_up(int p_track) {
|
||||||
|
|
||||||
@@ -1741,9 +1727,7 @@ void Animation::_bind_methods() {
|
|||||||
ObjectTypeDB::bind_method(_MD("get_length"),&Animation::get_length);
|
ObjectTypeDB::bind_method(_MD("get_length"),&Animation::get_length);
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("set_loop","enabled"),&Animation::set_loop);
|
ObjectTypeDB::bind_method(_MD("set_loop","enabled"),&Animation::set_loop);
|
||||||
ObjectTypeDB::bind_method(_MD("set_loop_interpolation","enabled"),&Animation::set_loop_interpolation);
|
|
||||||
ObjectTypeDB::bind_method(_MD("has_loop"),&Animation::has_loop);
|
ObjectTypeDB::bind_method(_MD("has_loop"),&Animation::has_loop);
|
||||||
ObjectTypeDB::bind_method(_MD("has_loop_interpolation"),&Animation::has_loop_interpolation);
|
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("set_step","size_sec"),&Animation::set_step);
|
ObjectTypeDB::bind_method(_MD("set_step","size_sec"),&Animation::set_step);
|
||||||
ObjectTypeDB::bind_method(_MD("get_step"),&Animation::get_step);
|
ObjectTypeDB::bind_method(_MD("get_step"),&Animation::get_step);
|
||||||
@@ -1771,7 +1755,6 @@ void Animation::clear() {
|
|||||||
memdelete( tracks[i] );
|
memdelete( tracks[i] );
|
||||||
tracks.clear();
|
tracks.clear();
|
||||||
loop=false;
|
loop=false;
|
||||||
loop_interpolation=true;
|
|
||||||
length=1;
|
length=1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2031,7 +2014,6 @@ Animation::Animation() {
|
|||||||
|
|
||||||
step=0.1;
|
step=0.1;
|
||||||
loop=false;
|
loop=false;
|
||||||
loop_interpolation=true;
|
|
||||||
length=1;
|
length=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2042,3 +2024,5 @@ Animation::~Animation() {
|
|||||||
memdelete( tracks[i] );
|
memdelete( tracks[i] );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ private:
|
|||||||
float length;
|
float length;
|
||||||
float step;
|
float step;
|
||||||
bool loop;
|
bool loop;
|
||||||
bool loop_interpolation;
|
|
||||||
|
|
||||||
// bind helpers
|
// bind helpers
|
||||||
private:
|
private:
|
||||||
@@ -279,9 +278,7 @@ public:
|
|||||||
float get_length() const;
|
float get_length() const;
|
||||||
|
|
||||||
void set_loop(bool p_enabled);
|
void set_loop(bool p_enabled);
|
||||||
void set_loop_interpolation(bool p_enabled);
|
|
||||||
bool has_loop() const;
|
bool has_loop() const;
|
||||||
bool has_loop_interpolation() const;
|
|
||||||
|
|
||||||
void set_step(float p_step);
|
void set_step(float p_step);
|
||||||
float get_step() const;
|
float get_step() const;
|
||||||
|
|||||||
@@ -2922,7 +2922,6 @@ void AnimationKeyEditor::_notification(int p_what) {
|
|||||||
edit_button->connect("pressed",this,"_toggle_edit_curves");
|
edit_button->connect("pressed",this,"_toggle_edit_curves");
|
||||||
|
|
||||||
loop->set_icon(get_icon("Loop","EditorIcons"));
|
loop->set_icon(get_icon("Loop","EditorIcons"));
|
||||||
loop_interpolation->set_icon(get_icon("LoopInterpolation","EditorIcons"));
|
|
||||||
curve_edit->connect("transition_changed",this,"_curve_transition_changed");
|
curve_edit->connect("transition_changed",this,"_curve_transition_changed");
|
||||||
|
|
||||||
//edit_button->add_color_override("font_color",get_color("font_color","Tree"));
|
//edit_button->add_color_override("font_color",get_color("font_color","Tree"));
|
||||||
@@ -3013,7 +3012,6 @@ void AnimationKeyEditor::_update_menu() {
|
|||||||
|
|
||||||
length->set_val(animation->get_length());
|
length->set_val(animation->get_length());
|
||||||
loop->set_pressed(animation->has_loop());
|
loop->set_pressed(animation->has_loop());
|
||||||
loop_interpolation->set_pressed(animation->has_loop_interpolation());
|
|
||||||
step->set_val(animation->get_step());
|
step->set_val(animation->get_step());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3469,21 +3467,6 @@ void AnimationKeyEditor::_animation_loop_changed() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationKeyEditor::_animation_loop_interpolation_changed() {
|
|
||||||
|
|
||||||
if (updating)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!animation.is_null()) {
|
|
||||||
|
|
||||||
undo_redo->create_action(TTR("Change Anim Loop Interpolation"));
|
|
||||||
undo_redo->add_do_method(animation.ptr(),"set_loop_interpolation",loop_interpolation->is_pressed());
|
|
||||||
undo_redo->add_undo_method(animation.ptr(),"set_loop_interpolation",!loop_interpolation->is_pressed());
|
|
||||||
undo_redo->commit_action();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AnimationKeyEditor::_create_value_item(int p_type) {
|
void AnimationKeyEditor::_create_value_item(int p_type) {
|
||||||
|
|
||||||
@@ -3769,7 +3752,6 @@ void AnimationKeyEditor::_bind_methods() {
|
|||||||
|
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("_animation_loop_changed"),&AnimationKeyEditor::_animation_loop_changed);
|
ObjectTypeDB::bind_method(_MD("_animation_loop_changed"),&AnimationKeyEditor::_animation_loop_changed);
|
||||||
ObjectTypeDB::bind_method(_MD("_animation_loop_interpolation_changed"),&AnimationKeyEditor::_animation_loop_interpolation_changed);
|
|
||||||
ObjectTypeDB::bind_method(_MD("_animation_len_changed"),&AnimationKeyEditor::_animation_len_changed);
|
ObjectTypeDB::bind_method(_MD("_animation_len_changed"),&AnimationKeyEditor::_animation_len_changed);
|
||||||
ObjectTypeDB::bind_method(_MD("_create_value_item"),&AnimationKeyEditor::_create_value_item);
|
ObjectTypeDB::bind_method(_MD("_create_value_item"),&AnimationKeyEditor::_create_value_item);
|
||||||
ObjectTypeDB::bind_method(_MD("_pane_drag"),&AnimationKeyEditor::_pane_drag);
|
ObjectTypeDB::bind_method(_MD("_pane_drag"),&AnimationKeyEditor::_pane_drag);
|
||||||
@@ -3880,12 +3862,6 @@ AnimationKeyEditor::AnimationKeyEditor() {
|
|||||||
hb->add_child(loop);
|
hb->add_child(loop);
|
||||||
loop->set_tooltip(TTR("Enable/Disable looping in animation."));
|
loop->set_tooltip(TTR("Enable/Disable looping in animation."));
|
||||||
|
|
||||||
loop_interpolation = memnew( ToolButton );
|
|
||||||
loop_interpolation->set_toggle_mode(true);
|
|
||||||
loop_interpolation->connect("pressed",this,"_animation_loop_interpolation_changed");
|
|
||||||
hb->add_child(loop_interpolation);
|
|
||||||
loop_interpolation->set_tooltip(TTR("Enable/Disable interpolation when looping animation."));
|
|
||||||
|
|
||||||
hb->add_child( memnew( VSeparator ) );
|
hb->add_child( memnew( VSeparator ) );
|
||||||
|
|
||||||
menu_add_track = memnew( MenuButton );
|
menu_add_track = memnew( MenuButton );
|
||||||
|
|||||||
@@ -173,7 +173,6 @@ class AnimationKeyEditor : public VBoxContainer {
|
|||||||
//MenuButton *menu;
|
//MenuButton *menu;
|
||||||
SpinBox *length;
|
SpinBox *length;
|
||||||
Button *loop;
|
Button *loop;
|
||||||
Button *loop_interpolation;
|
|
||||||
bool keying;
|
bool keying;
|
||||||
ToolButton *edit_button;
|
ToolButton *edit_button;
|
||||||
ToolButton *move_up_button;
|
ToolButton *move_up_button;
|
||||||
@@ -239,7 +238,6 @@ class AnimationKeyEditor : public VBoxContainer {
|
|||||||
|
|
||||||
void _animation_len_changed(float p_len);
|
void _animation_len_changed(float p_len);
|
||||||
void _animation_loop_changed();
|
void _animation_loop_changed();
|
||||||
void _animation_loop_interpolation_changed();
|
|
||||||
void _step_changed(float p_len);
|
void _step_changed(float p_len);
|
||||||
|
|
||||||
struct InsertData {
|
struct InsertData {
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 374 B |
Reference in New Issue
Block a user