|
@@ -2235,8 +2235,21 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
offset_n = offset_n + editor->get_moving_selection_offset();
|
|
offset_n = offset_n + editor->get_moving_selection_offset();
|
|
}
|
|
}
|
|
offset_n = offset_n * scale + limit;
|
|
offset_n = offset_n * scale + limit;
|
|
-
|
|
|
|
|
|
+ float offset_last = limit_end;
|
|
|
|
+ if (i < animation->track_get_key_count(track) - 2) {
|
|
|
|
+ offset_last = animation->track_get_key_time(track, i + 2) - timeline->get_value();
|
|
|
|
+ if (editor->is_key_selected(track, i + 2) && editor->is_moving_selection()) {
|
|
|
|
+ offset_last = offset_last + editor->get_moving_selection_offset();
|
|
|
|
+ }
|
|
|
|
+ offset_last = offset_last * scale + limit;
|
|
|
|
+ }
|
|
|
|
+ int limit_string = (editor->is_key_selected(track, i + 1) && editor->is_moving_selection()) ? int(offset_last) : int(offset_n);
|
|
|
|
+ if (editor->is_key_selected(track, i) && editor->is_moving_selection()) {
|
|
|
|
+ limit_string = int(MAX(limit_end, offset_last));
|
|
|
|
+ }
|
|
draw_key_link(i, scale, int(offset), int(offset_n), limit, limit_end);
|
|
draw_key_link(i, scale, int(offset), int(offset_n), limit, limit_end);
|
|
|
|
+ draw_key(i, scale, int(offset), editor->is_key_selected(track, i), limit, limit_string);
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
|
|
draw_key(i, scale, int(offset), editor->is_key_selected(track, i), limit, limit_end);
|
|
draw_key(i, scale, int(offset), editor->is_key_selected(track, i), limit, limit_end);
|
|
@@ -2541,7 +2554,8 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
|
|
}
|
|
}
|
|
text += ")";
|
|
text += ")";
|
|
|
|
|
|
- int limit = MAX(0, p_clip_right - p_x - icon_to_draw->get_width());
|
|
|
|
|
|
+ int limit = ((p_selected && editor->is_moving_selection()) || editor->is_function_name_pressed()) ? 0 : MAX(0, p_clip_right - p_x - icon_to_draw->get_width() * 2);
|
|
|
|
+
|
|
if (limit > 0) {
|
|
if (limit > 0) {
|
|
draw_string(font, Vector2(p_x + icon_to_draw->get_width(), int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), text, HORIZONTAL_ALIGNMENT_LEFT, limit, font_size, color);
|
|
draw_string(font, Vector2(p_x + icon_to_draw->get_width(), int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), text, HORIZONTAL_ALIGNMENT_LEFT, limit, font_size, color);
|
|
}
|
|
}
|
|
@@ -5162,6 +5176,7 @@ void AnimationTrackEditor::_notification(int p_what) {
|
|
snap_keys->set_button_icon(get_editor_theme_icon(SNAME("SnapKeys")));
|
|
snap_keys->set_button_icon(get_editor_theme_icon(SNAME("SnapKeys")));
|
|
fps_compat->set_button_icon(get_editor_theme_icon(SNAME("FPS")));
|
|
fps_compat->set_button_icon(get_editor_theme_icon(SNAME("FPS")));
|
|
view_group->set_button_icon(get_editor_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup")));
|
|
view_group->set_button_icon(get_editor_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup")));
|
|
|
|
+ function_name_toggler->set_button_icon(get_editor_theme_icon(SNAME("MemberMethod")));
|
|
selected_filter->set_button_icon(get_editor_theme_icon(SNAME("AnimationFilter")));
|
|
selected_filter->set_button_icon(get_editor_theme_icon(SNAME("AnimationFilter")));
|
|
imported_anim_warning->set_button_icon(get_editor_theme_icon(SNAME("NodeWarning")));
|
|
imported_anim_warning->set_button_icon(get_editor_theme_icon(SNAME("NodeWarning")));
|
|
dummy_player_warning->set_button_icon(get_editor_theme_icon(SNAME("NodeWarning")));
|
|
dummy_player_warning->set_button_icon(get_editor_theme_icon(SNAME("NodeWarning")));
|
|
@@ -5176,6 +5191,8 @@ void AnimationTrackEditor::_notification(int p_what) {
|
|
|
|
|
|
const int track_separation = get_theme_constant(SNAME("track_v_separation"), SNAME("AnimationTrackEditor"));
|
|
const int track_separation = get_theme_constant(SNAME("track_v_separation"), SNAME("AnimationTrackEditor"));
|
|
track_vbox->add_theme_constant_override("separation", track_separation);
|
|
track_vbox->add_theme_constant_override("separation", track_separation);
|
|
|
|
+
|
|
|
|
+ function_name_toggler->add_theme_color_override("icon_pressed_color", get_theme_color("icon_disabled_color", EditorStringName(Editor)));
|
|
} break;
|
|
} break;
|
|
|
|
|
|
case NOTIFICATION_READY: {
|
|
case NOTIFICATION_READY: {
|
|
@@ -7345,6 +7362,10 @@ void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) {
|
|
_update_tracks();
|
|
_update_tracks();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void AnimationTrackEditor::_toggle_function_names() {
|
|
|
|
+ _redraw_tracks();
|
|
|
|
+}
|
|
|
|
+
|
|
void AnimationTrackEditor::_view_group_toggle() {
|
|
void AnimationTrackEditor::_view_group_toggle() {
|
|
_update_tracks();
|
|
_update_tracks();
|
|
view_group->set_button_icon(get_editor_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup")));
|
|
view_group->set_button_icon(get_editor_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup")));
|
|
@@ -7359,6 +7380,10 @@ bool AnimationTrackEditor::is_grouping_tracks() {
|
|
return !view_group->is_pressed();
|
|
return !view_group->is_pressed();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+bool AnimationTrackEditor::is_function_name_pressed() {
|
|
|
|
+ return function_name_toggler->is_pressed();
|
|
|
|
+}
|
|
|
|
+
|
|
void AnimationTrackEditor::_auto_fit() {
|
|
void AnimationTrackEditor::_auto_fit() {
|
|
timeline->auto_fit();
|
|
timeline->auto_fit();
|
|
}
|
|
}
|
|
@@ -7652,6 +7677,16 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
|
|
|
|
|
bottom_hf->add_child(bezier_edit_icon);
|
|
bottom_hf->add_child(bezier_edit_icon);
|
|
|
|
|
|
|
|
+ function_name_toggler = memnew(Button);
|
|
|
|
+ function_name_toggler->set_flat(true);
|
|
|
|
+ function_name_toggler->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_toggle_function_names));
|
|
|
|
+ function_name_toggler->set_shortcut(ED_SHORTCUT("animation_editor/toggle_function_names", TTRC("Toggle method names")));
|
|
|
|
+ function_name_toggler->set_toggle_mode(true);
|
|
|
|
+ function_name_toggler->set_shortcut_in_tooltip(false);
|
|
|
|
+ function_name_toggler->set_tooltip_text(TTRC("Toggle function names in the track editor."));
|
|
|
|
+
|
|
|
|
+ bottom_hf->add_child(function_name_toggler);
|
|
|
|
+
|
|
selected_filter = memnew(Button);
|
|
selected_filter = memnew(Button);
|
|
selected_filter->set_flat(true);
|
|
selected_filter->set_flat(true);
|
|
selected_filter->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); // Same function works the same.
|
|
selected_filter->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); // Same function works the same.
|