|
@@ -1376,14 +1376,16 @@ void AnimationTimelineEdit::_anim_loop_pressed() {
|
|
|
}
|
|
|
|
|
|
int AnimationTimelineEdit::get_buttons_width() const {
|
|
|
- Ref<Texture2D> interp_mode = get_editor_theme_icon(SNAME("TrackContinuous"));
|
|
|
- Ref<Texture2D> interp_type = get_editor_theme_icon(SNAME("InterpRaw"));
|
|
|
- Ref<Texture2D> loop_type = get_editor_theme_icon(SNAME("InterpWrapClamp"));
|
|
|
- Ref<Texture2D> remove_icon = get_editor_theme_icon(SNAME("Remove"));
|
|
|
- Ref<Texture2D> down_icon = get_theme_icon(SNAME("select_arrow"), SNAME("Tree"));
|
|
|
+ const Ref<Texture2D> interp_mode = get_editor_theme_icon(SNAME("TrackContinuous"));
|
|
|
+ const Ref<Texture2D> interp_type = get_editor_theme_icon(SNAME("InterpRaw"));
|
|
|
+ const Ref<Texture2D> loop_type = get_editor_theme_icon(SNAME("InterpWrapClamp"));
|
|
|
+ const Ref<Texture2D> remove_icon = get_editor_theme_icon(SNAME("Remove"));
|
|
|
+ const Ref<Texture2D> down_icon = get_theme_icon(SNAME("select_arrow"), SNAME("Tree"));
|
|
|
+
|
|
|
+ const int h_separation = get_theme_constant(SNAME("h_separation"), SNAME("AnimationTrackEdit"));
|
|
|
|
|
|
int total_w = interp_mode->get_width() + interp_type->get_width() + loop_type->get_width() + remove_icon->get_width();
|
|
|
- total_w += (down_icon->get_width() + 4 * EDSCALE) * 4;
|
|
|
+ total_w += (down_icon->get_width() + h_separation) * 4;
|
|
|
|
|
|
return total_w;
|
|
|
}
|
|
@@ -1391,7 +1393,7 @@ int AnimationTimelineEdit::get_buttons_width() const {
|
|
|
int AnimationTimelineEdit::get_name_limit() const {
|
|
|
Ref<Texture2D> hsize_icon = get_editor_theme_icon(SNAME("Hsize"));
|
|
|
|
|
|
- int limit = MAX(name_limit, add_track->get_minimum_size().width + hsize_icon->get_width());
|
|
|
+ int limit = MAX(name_limit, add_track->get_minimum_size().width + hsize_icon->get_width() + 8 * EDSCALE);
|
|
|
|
|
|
limit = MIN(limit, get_size().width - get_buttons_width() - 1);
|
|
|
|
|
@@ -1436,9 +1438,24 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
- int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
- Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
|
|
|
+ const Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
+ const int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
+
|
|
|
+ const Ref<StyleBox> &stylebox_time_unavailable = get_theme_stylebox(SNAME("time_unavailable"), SNAME("AnimationTimelineEdit"));
|
|
|
+ const Ref<StyleBox> &stylebox_time_available = get_theme_stylebox(SNAME("time_available"), SNAME("AnimationTimelineEdit"));
|
|
|
+
|
|
|
+ const Color v_line_primary_color = get_theme_color(SNAME("v_line_primary_color"), SNAME("AnimationTimelineEdit"));
|
|
|
+ const Color v_line_secondary_color = get_theme_color(SNAME("v_line_secondary_color"), SNAME("AnimationTimelineEdit"));
|
|
|
+ const Color h_line_color = get_theme_color(SNAME("h_line_color"), SNAME("AnimationTimelineEdit"));
|
|
|
+ const Color font_primary_color = get_theme_color(SNAME("font_primary_color"), SNAME("AnimationTimelineEdit"));
|
|
|
+ const Color font_secondary_color = get_theme_color(SNAME("font_secondary_color"), SNAME("AnimationTimelineEdit"));
|
|
|
+
|
|
|
+ const int v_line_primary_margin = get_theme_constant(SNAME("v_line_primary_margin"), SNAME("AnimationTimelineEdit"));
|
|
|
+ const int v_line_secondary_margin = get_theme_constant(SNAME("v_line_secondary_margin"), SNAME("AnimationTimelineEdit"));
|
|
|
+ const int v_line_primary_width = get_theme_constant(SNAME("v_line_primary_width"), SNAME("AnimationTimelineEdit"));
|
|
|
+ const int v_line_secondary_width = get_theme_constant(SNAME("v_line_secondary_width"), SNAME("AnimationTimelineEdit"));
|
|
|
+ const int text_primary_margin = get_theme_constant(SNAME("text_primary_margin"), SNAME("AnimationTimelineEdit"));
|
|
|
+ const int text_secondary_margin = get_theme_constant(SNAME("text_secondary_margin"), SNAME("AnimationTimelineEdit"));
|
|
|
|
|
|
int zoomw = key_range;
|
|
|
float scale = get_zoom_scale();
|
|
@@ -1450,7 +1467,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
|
|
}
|
|
|
|
|
|
Ref<Texture2D> hsize_icon = get_editor_theme_icon(SNAME("Hsize"));
|
|
|
- hsize_rect = Rect2(get_name_limit() - hsize_icon->get_width() - 2 * EDSCALE, (get_size().height - hsize_icon->get_height()) / 2, hsize_icon->get_width(), hsize_icon->get_height());
|
|
|
+ hsize_rect = Rect2(get_name_limit() - hsize_icon->get_width() - 8 * EDSCALE, (get_size().height - hsize_icon->get_height()) / 2, hsize_icon->get_width(), hsize_icon->get_height());
|
|
|
draw_texture(hsize_icon, hsize_rect.position);
|
|
|
|
|
|
{
|
|
@@ -1495,14 +1512,9 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
|
|
|
|
|
int end_px = (l - get_value()) * scale;
|
|
|
int begin_px = -get_value() * scale;
|
|
|
- Color notimecol = get_theme_color(SNAME("dark_color_2"), EditorStringName(Editor));
|
|
|
- Color timecolor = color;
|
|
|
- timecolor.a = 0.2;
|
|
|
- Color linecolor = color;
|
|
|
- linecolor.a = 0.2;
|
|
|
|
|
|
{
|
|
|
- draw_rect(Rect2(Point2(get_name_limit(), 0), Point2(zoomw - 1, h)), notimecol);
|
|
|
+ draw_style_box(stylebox_time_unavailable, Rect2(Point2(get_name_limit(), 0), Point2(zoomw - 1, h)));
|
|
|
|
|
|
if (begin_px < zoomw && end_px > 0) {
|
|
|
if (begin_px < 0) {
|
|
@@ -1512,13 +1524,9 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
|
|
end_px = zoomw;
|
|
|
}
|
|
|
|
|
|
- draw_rect(Rect2(Point2(get_name_limit() + begin_px, 0), Point2(end_px - begin_px, h)), timecolor);
|
|
|
+ draw_style_box(stylebox_time_available, Rect2(Point2(get_name_limit() + begin_px, 0), Point2(end_px - begin_px, h)));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- Color color_time_sec = color;
|
|
|
- Color color_time_dec = color;
|
|
|
- color_time_dec.a *= 0.5;
|
|
|
#define SC_ADJ 100
|
|
|
int dec = 1;
|
|
|
int step = 1;
|
|
@@ -1573,10 +1581,17 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
|
|
bool sub = Math::floor(prev) == Math::floor(pos);
|
|
|
|
|
|
if (frame != prev_frame && i >= prev_frame_ofs) {
|
|
|
- draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor, Math::round(EDSCALE));
|
|
|
+ int line_margin = sub ? v_line_secondary_margin : v_line_primary_margin;
|
|
|
+ int line_width = sub ? v_line_secondary_width : v_line_primary_width;
|
|
|
+ Color line_color = sub ? v_line_secondary_color : v_line_primary_color;
|
|
|
|
|
|
- draw_string(font, Point2(get_name_limit() + i + 3 * EDSCALE, (h - font->get_height(font_size)) / 2 + font->get_ascent(font_size)).floor(), itos(frame), HORIZONTAL_ALIGNMENT_LEFT, zoomw - i, font_size, sub ? color_time_dec : color_time_sec);
|
|
|
- prev_frame_ofs = i + font->get_string_size(itos(frame), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x + 5 * EDSCALE;
|
|
|
+ draw_line(Point2(get_name_limit() + i, 0 + line_margin), Point2(get_name_limit() + i, h - line_margin), line_color, line_width);
|
|
|
+
|
|
|
+ int text_margin = sub ? text_secondary_margin : text_primary_margin;
|
|
|
+
|
|
|
+ draw_string(font, Point2(get_name_limit() + i + text_margin, (h - font->get_height(font_size)) / 2 + font->get_ascent(font_size)).floor(), itos(frame), HORIZONTAL_ALIGNMENT_LEFT, zoomw - i, font_size, sub ? font_secondary_color : font_primary_color);
|
|
|
+
|
|
|
+ prev_frame_ofs = i + font->get_string_size(itos(frame), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x + text_margin;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1592,13 +1607,20 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
|
|
|
|
|
if ((sc / step) != (prev_sc / step) || (prev_sc < 0 && sc >= 0)) {
|
|
|
int scd = sc < 0 ? prev_sc : sc;
|
|
|
- draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor, Math::round(EDSCALE));
|
|
|
- draw_string(font, Point2(get_name_limit() + i + 3, (h - font->get_height(font_size)) / 2 + font->get_ascent(font_size)).floor(), String::num((scd - (scd % step)) / double(SC_ADJ), decimals), HORIZONTAL_ALIGNMENT_LEFT, zoomw - i, font_size, sub ? color_time_dec : color_time_sec);
|
|
|
+ int line_margin = sub ? v_line_secondary_margin : v_line_primary_margin;
|
|
|
+ int line_width = sub ? v_line_secondary_width : v_line_primary_width;
|
|
|
+ Color line_color = sub ? v_line_secondary_color : v_line_primary_color;
|
|
|
+
|
|
|
+ draw_line(Point2(get_name_limit() + i, 0 + line_margin), Point2(get_name_limit() + i, h - line_margin), line_color, line_width);
|
|
|
+
|
|
|
+ int text_margin = sub ? text_secondary_margin : text_primary_margin;
|
|
|
+
|
|
|
+ draw_string(font, Point2(get_name_limit() + i + text_margin, (h - font->get_height(font_size)) / 2 + font->get_ascent(font_size)).floor(), String::num((scd - (scd % step)) / double(SC_ADJ), decimals), HORIZONTAL_ALIGNMENT_LEFT, zoomw - i, font_size, sub ? font_secondary_color : font_primary_color);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- draw_line(Vector2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE));
|
|
|
+ draw_line(Vector2(0, get_size().height), get_size(), h_line_color, Math::round(EDSCALE));
|
|
|
update_values();
|
|
|
} break;
|
|
|
}
|
|
@@ -1628,10 +1650,10 @@ void AnimationTimelineEdit::set_animation(const Ref<Animation> &p_animation, boo
|
|
|
|
|
|
Size2 AnimationTimelineEdit::get_minimum_size() const {
|
|
|
Size2 ms = add_track->get_minimum_size();
|
|
|
- Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
- int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
+ const Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
+ const int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
ms.height = MAX(ms.height, font->get_height(font_size));
|
|
|
- ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_editor_theme_icon(SNAME("Hsize"))->get_width() + 2;
|
|
|
+ ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_editor_theme_icon(SNAME("Hsize"))->get_width() + 2 + 8 * EDSCALE;
|
|
|
return ms;
|
|
|
}
|
|
|
|
|
@@ -1967,46 +1989,49 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
|
|
|
int limit = timeline->get_name_limit();
|
|
|
|
|
|
+ const Ref<StyleBox> &stylebox_odd = get_theme_stylebox(SNAME("odd"), SNAME("AnimationTrackEdit"));
|
|
|
+ const Ref<StyleBox> &stylebox_focus = get_theme_stylebox(SNAME("focus"), SNAME("AnimationTrackEdit"));
|
|
|
+ const Ref<StyleBox> &stylebox_hover = get_theme_stylebox(SNAME("hover"), SNAME("AnimationTrackEdit"));
|
|
|
+
|
|
|
+ const Color h_line_color = get_theme_color(SNAME("h_line_color"), SNAME("AnimationTrackEdit"));
|
|
|
+ const int h_separation = get_theme_constant(SNAME("h_separation"), SNAME("AnimationTrackEdit"));
|
|
|
+ const int outer_margin = get_theme_constant(SNAME("outer_margin"), SNAME("AnimationTrackEdit"));
|
|
|
+
|
|
|
if (track % 2 == 1) {
|
|
|
// Draw a background over odd lines to make long lists of tracks easier to read.
|
|
|
- draw_rect(Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)), Color(0.5, 0.5, 0.5, 0.05));
|
|
|
+ draw_style_box(stylebox_odd, Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)));
|
|
|
}
|
|
|
|
|
|
if (hovered) {
|
|
|
// Draw hover feedback.
|
|
|
- draw_rect(Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)), Color(0.5, 0.5, 0.5, 0.1));
|
|
|
+ draw_style_box(stylebox_hover, Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)));
|
|
|
}
|
|
|
|
|
|
if (has_focus()) {
|
|
|
- Color accent = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
|
|
- accent.a *= 0.7;
|
|
|
// Offside so the horizontal sides aren't cutoff.
|
|
|
- draw_style_box(get_theme_stylebox(SNAME("Focus"), EditorStringName(EditorStyles)), Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)));
|
|
|
+ draw_style_box(stylebox_focus, Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)));
|
|
|
}
|
|
|
|
|
|
- Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
- int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
- Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
|
|
|
- int hsep = get_theme_constant(SNAME("h_separation"), SNAME("ItemList"));
|
|
|
- Color linecolor = color;
|
|
|
- linecolor.a = 0.2;
|
|
|
+ const Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
+ const int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
+ const Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
|
|
|
|
|
|
- Color dc = get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor));
|
|
|
+ const Color dc = get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor));
|
|
|
|
|
|
- // NAMES AND ICONS //
|
|
|
+ // Names and icons.
|
|
|
|
|
|
{
|
|
|
Ref<Texture2D> check = animation->track_is_enabled(track) ? get_theme_icon(SNAME("checked"), SNAME("CheckBox")) : get_theme_icon(SNAME("unchecked"), SNAME("CheckBox"));
|
|
|
|
|
|
- int ofs = in_group ? check->get_width() : 0; // Not the best reference for margin but..
|
|
|
+ int ofs = in_group ? outer_margin : 0;
|
|
|
|
|
|
- check_rect = Rect2(Point2(ofs, int(get_size().height - check->get_height()) / 2), check->get_size());
|
|
|
+ check_rect = Rect2(Point2(ofs, (get_size().height - check->get_height()) / 2).round(), check->get_size());
|
|
|
draw_texture(check, check_rect.position);
|
|
|
- ofs += check->get_width() + hsep;
|
|
|
+ ofs += check->get_width() + h_separation;
|
|
|
|
|
|
Ref<Texture2D> key_type_icon = _get_key_type_icon();
|
|
|
- draw_texture(key_type_icon, Point2(ofs, int(get_size().height - key_type_icon->get_height()) / 2));
|
|
|
- ofs += key_type_icon->get_width() + hsep;
|
|
|
+ draw_texture(key_type_icon, Point2(ofs, (get_size().height - key_type_icon->get_height()) / 2).round());
|
|
|
+ ofs += key_type_icon->get_width() + h_separation;
|
|
|
|
|
|
NodePath anim_path = animation->track_get_path(track);
|
|
|
Node *node = nullptr;
|
|
@@ -2035,11 +2060,11 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
Ref<Texture2D> icon = EditorNode::get_singleton()->get_object_icon(node, "Node");
|
|
|
const Vector2 icon_size = Vector2(1, 1) * get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor));
|
|
|
|
|
|
- draw_texture_rect(icon, Rect2(Point2(ofs, int(get_size().height - icon_size.y) / 2), icon_size));
|
|
|
+ draw_texture_rect(icon, Rect2(Point2(ofs, (get_size().height - icon_size.y) / 2).round(), icon_size));
|
|
|
icon_cache = icon;
|
|
|
|
|
|
text = String() + node->get_name() + ":" + anim_path.get_concatenated_subnames();
|
|
|
- ofs += hsep;
|
|
|
+ ofs += h_separation;
|
|
|
ofs += icon_size.x;
|
|
|
|
|
|
} else {
|
|
@@ -2050,22 +2075,22 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
|
|
|
path_cache = text;
|
|
|
|
|
|
- path_rect = Rect2(ofs, 0, limit - ofs - hsep, get_size().height);
|
|
|
+ path_rect = Rect2(ofs, 0, limit - ofs - h_separation, get_size().height);
|
|
|
|
|
|
Vector2 string_pos = Point2(ofs, (get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size));
|
|
|
string_pos = string_pos.floor();
|
|
|
- draw_string(font, string_pos, text, HORIZONTAL_ALIGNMENT_LEFT, limit - ofs - hsep, font_size, text_color);
|
|
|
+ draw_string(font, string_pos, text, HORIZONTAL_ALIGNMENT_LEFT, limit - ofs - h_separation, font_size, text_color);
|
|
|
|
|
|
- draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor, Math::round(EDSCALE));
|
|
|
+ draw_line(Point2(limit, 0), Point2(limit, get_size().height), h_line_color, Math::round(EDSCALE));
|
|
|
}
|
|
|
|
|
|
- // KEYFRAMES //
|
|
|
+ // Keyframes.
|
|
|
|
|
|
- draw_bg(limit, get_size().width - timeline->get_buttons_width());
|
|
|
+ draw_bg(limit, get_size().width - timeline->get_buttons_width() - outer_margin);
|
|
|
|
|
|
{
|
|
|
float scale = timeline->get_zoom_scale();
|
|
|
- int limit_end = get_size().width - timeline->get_buttons_width();
|
|
|
+ int limit_end = get_size().width - timeline->get_buttons_width() - outer_margin;
|
|
|
|
|
|
for (int i = 0; i < animation->track_get_key_count(track); i++) {
|
|
|
float offset = animation->track_get_key_time(track, i) - timeline->get_value();
|
|
@@ -2087,9 +2112,9 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- draw_fg(limit, get_size().width - timeline->get_buttons_width());
|
|
|
+ draw_fg(limit, get_size().width - timeline->get_buttons_width() - outer_margin);
|
|
|
|
|
|
- // BUTTONS //
|
|
|
+ // Buttons.
|
|
|
|
|
|
{
|
|
|
Ref<Texture2D> wrap_icon[2] = {
|
|
@@ -2113,13 +2138,13 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
get_editor_theme_icon(SNAME("UseBlendDisable")),
|
|
|
};
|
|
|
|
|
|
- int ofs = get_size().width - timeline->get_buttons_width();
|
|
|
+ int ofs = get_size().width - timeline->get_buttons_width() - outer_margin;
|
|
|
|
|
|
- Ref<Texture2D> down_icon = get_theme_icon(SNAME("select_arrow"), SNAME("Tree"));
|
|
|
+ const Ref<Texture2D> down_icon = get_theme_icon(SNAME("select_arrow"), SNAME("Tree"));
|
|
|
|
|
|
- draw_line(Point2(ofs, 0), Point2(ofs, get_size().height), linecolor, Math::round(EDSCALE));
|
|
|
+ draw_line(Point2(ofs, 0), Point2(ofs, get_size().height), h_line_color, Math::round(EDSCALE));
|
|
|
|
|
|
- ofs += hsep;
|
|
|
+ ofs += h_separation;
|
|
|
{
|
|
|
// Callmode.
|
|
|
|
|
@@ -2134,7 +2159,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
Ref<Texture2D> update_icon = cont_icon[update_mode];
|
|
|
|
|
|
update_mode_rect.position.x = ofs;
|
|
|
- update_mode_rect.position.y = int(get_size().height - update_icon->get_height()) / 2;
|
|
|
+ update_mode_rect.position.y = Math::round((get_size().height - update_icon->get_height()) / 2);
|
|
|
update_mode_rect.size = update_icon->get_size();
|
|
|
|
|
|
if (!animation->track_is_compressed(track) && animation->track_get_type(track) == Animation::TYPE_VALUE) {
|
|
@@ -2149,12 +2174,12 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
update_mode_rect.position.y = 0;
|
|
|
update_mode_rect.size.y = get_size().height;
|
|
|
|
|
|
- ofs += update_icon->get_width() + hsep / 2;
|
|
|
- update_mode_rect.size.x += hsep / 2;
|
|
|
+ ofs += update_icon->get_width() + h_separation / 2;
|
|
|
+ update_mode_rect.size.x += h_separation / 2;
|
|
|
|
|
|
if (!read_only) {
|
|
|
if (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_AUDIO) {
|
|
|
- draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2));
|
|
|
+ draw_texture(down_icon, Vector2(ofs, (get_size().height - down_icon->get_height()) / 2).round());
|
|
|
update_mode_rect.size.x += down_icon->get_width();
|
|
|
} else if (animation->track_get_type(track) == Animation::TYPE_BEZIER) {
|
|
|
update_mode_rect.size.x += down_icon->get_width();
|
|
@@ -2167,8 +2192,8 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
}
|
|
|
|
|
|
ofs += down_icon->get_width();
|
|
|
- draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor, Math::round(EDSCALE));
|
|
|
- ofs += hsep;
|
|
|
+ draw_line(Point2(ofs + h_separation * 0.5, 0), Point2(ofs + h_separation * 0.5, get_size().height), h_line_color, Math::round(EDSCALE));
|
|
|
+ ofs += h_separation;
|
|
|
}
|
|
|
|
|
|
{
|
|
@@ -2179,7 +2204,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
Ref<Texture2D> icon = interp_icon[interp_mode];
|
|
|
|
|
|
interp_mode_rect.position.x = ofs;
|
|
|
- interp_mode_rect.position.y = int(get_size().height - icon->get_height()) / 2;
|
|
|
+ interp_mode_rect.position.y = Math::round((get_size().height - icon->get_height()) / 2);
|
|
|
interp_mode_rect.size = icon->get_size();
|
|
|
|
|
|
if (!animation->track_is_compressed(track) && (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_BLEND_SHAPE || animation->track_get_type(track) == Animation::TYPE_POSITION_3D || animation->track_get_type(track) == Animation::TYPE_SCALE_3D || animation->track_get_type(track) == Animation::TYPE_ROTATION_3D)) {
|
|
@@ -2189,19 +2214,19 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
interp_mode_rect.position.y = 0;
|
|
|
interp_mode_rect.size.y = get_size().height;
|
|
|
|
|
|
- ofs += icon->get_width() + hsep / 2;
|
|
|
- interp_mode_rect.size.x += hsep / 2;
|
|
|
+ ofs += icon->get_width() + h_separation / 2;
|
|
|
+ interp_mode_rect.size.x += h_separation / 2;
|
|
|
|
|
|
if (!read_only && !animation->track_is_compressed(track) && (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_BLEND_SHAPE || animation->track_get_type(track) == Animation::TYPE_POSITION_3D || animation->track_get_type(track) == Animation::TYPE_SCALE_3D || animation->track_get_type(track) == Animation::TYPE_ROTATION_3D)) {
|
|
|
- draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2));
|
|
|
+ draw_texture(down_icon, Vector2(ofs, (get_size().height - down_icon->get_height()) / 2).round());
|
|
|
interp_mode_rect.size.x += down_icon->get_width();
|
|
|
} else {
|
|
|
interp_mode_rect = Rect2();
|
|
|
}
|
|
|
|
|
|
ofs += down_icon->get_width();
|
|
|
- draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor, Math::round(EDSCALE));
|
|
|
- ofs += hsep;
|
|
|
+ draw_line(Point2(ofs + h_separation * 0.5, 0), Point2(ofs + h_separation * 0.5, get_size().height), h_line_color, Math::round(EDSCALE));
|
|
|
+ ofs += h_separation;
|
|
|
}
|
|
|
|
|
|
{
|
|
@@ -2212,7 +2237,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
Ref<Texture2D> icon = wrap_icon[loop_wrap ? 1 : 0];
|
|
|
|
|
|
loop_wrap_rect.position.x = ofs;
|
|
|
- loop_wrap_rect.position.y = int(get_size().height - icon->get_height()) / 2;
|
|
|
+ loop_wrap_rect.position.y = Math::round((get_size().height - icon->get_height()) / 2);
|
|
|
loop_wrap_rect.size = icon->get_size();
|
|
|
|
|
|
if (!animation->track_is_compressed(track) && (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_BLEND_SHAPE || animation->track_get_type(track) == Animation::TYPE_POSITION_3D || animation->track_get_type(track) == Animation::TYPE_SCALE_3D || animation->track_get_type(track) == Animation::TYPE_ROTATION_3D)) {
|
|
@@ -2222,19 +2247,19 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
loop_wrap_rect.position.y = 0;
|
|
|
loop_wrap_rect.size.y = get_size().height;
|
|
|
|
|
|
- ofs += icon->get_width() + hsep / 2;
|
|
|
- loop_wrap_rect.size.x += hsep / 2;
|
|
|
+ ofs += icon->get_width() + h_separation / 2;
|
|
|
+ loop_wrap_rect.size.x += h_separation / 2;
|
|
|
|
|
|
if (!read_only && !animation->track_is_compressed(track) && (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_BLEND_SHAPE || animation->track_get_type(track) == Animation::TYPE_POSITION_3D || animation->track_get_type(track) == Animation::TYPE_SCALE_3D || animation->track_get_type(track) == Animation::TYPE_ROTATION_3D)) {
|
|
|
- draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2));
|
|
|
+ draw_texture(down_icon, Vector2(ofs, (get_size().height - down_icon->get_height()) / 2).round());
|
|
|
loop_wrap_rect.size.x += down_icon->get_width();
|
|
|
} else {
|
|
|
loop_wrap_rect = Rect2();
|
|
|
}
|
|
|
|
|
|
ofs += down_icon->get_width();
|
|
|
- draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor, Math::round(EDSCALE));
|
|
|
- ofs += hsep;
|
|
|
+ draw_line(Point2(ofs + h_separation * 0.5, 0), Point2(ofs + h_separation * 0.5, get_size().height), h_line_color, Math::round(EDSCALE));
|
|
|
+ ofs += h_separation;
|
|
|
}
|
|
|
|
|
|
{
|
|
@@ -2242,8 +2267,8 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
|
|
|
Ref<Texture2D> icon = get_editor_theme_icon(animation->track_is_compressed(track) ? SNAME("Lock") : SNAME("Remove"));
|
|
|
|
|
|
- remove_rect.position.x = ofs + ((get_size().width - ofs) - icon->get_width());
|
|
|
- remove_rect.position.y = int(get_size().height - icon->get_height()) / 2;
|
|
|
+ remove_rect.position.x = ofs + ((get_size().width - ofs) - icon->get_width()) - outer_margin;
|
|
|
+ remove_rect.position.y = Math::round((get_size().height - icon->get_height()) / 2);
|
|
|
remove_rect.size = icon->get_size();
|
|
|
|
|
|
if (read_only) {
|
|
@@ -2255,9 +2280,9 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|
|
}
|
|
|
|
|
|
if (in_group) {
|
|
|
- draw_line(Vector2(timeline->get_name_limit(), get_size().height), get_size(), linecolor, Math::round(EDSCALE));
|
|
|
+ draw_line(Vector2(timeline->get_name_limit(), get_size().height), get_size(), h_line_color, Math::round(EDSCALE));
|
|
|
} else {
|
|
|
- draw_line(Vector2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE));
|
|
|
+ draw_line(Vector2(0, get_size().height), get_size(), h_line_color, Math::round(EDSCALE));
|
|
|
}
|
|
|
|
|
|
if (dropping_at != 0) {
|
|
@@ -2358,11 +2383,11 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Vector2 ofs(p_x - icon_to_draw->get_width() / 2, int(get_size().height - icon_to_draw->get_height()) / 2);
|
|
|
+ Vector2 ofs(p_x - icon_to_draw->get_width() / 2, (get_size().height - icon_to_draw->get_height()) / 2);
|
|
|
|
|
|
if (animation->track_get_type(track) == Animation::TYPE_METHOD) {
|
|
|
- Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
- int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
+ const Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
+ const int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
|
|
|
color.a = 0.5;
|
|
|
|
|
@@ -2486,9 +2511,9 @@ NodePath AnimationTrackEdit::get_path() const {
|
|
|
|
|
|
Size2 AnimationTrackEdit::get_minimum_size() const {
|
|
|
Ref<Texture2D> texture = get_editor_theme_icon(SNAME("Object"));
|
|
|
- Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
- int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
- int separation = get_theme_constant(SNAME("v_separation"), SNAME("ItemList"));
|
|
|
+ const Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
+ const int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
+ const int separation = get_theme_constant(SNAME("v_separation"), SNAME("ItemList"));
|
|
|
|
|
|
int max_h = MAX(texture->get_height(), font->get_height(font_size));
|
|
|
max_h = MAX(max_h, get_key_height());
|
|
@@ -2977,7 +3002,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
|
|
}
|
|
|
|
|
|
path->set_text(animation->track_get_path(track));
|
|
|
- Vector2 theme_ofs = path->get_theme_stylebox(CoreStringName(normal), SNAME("LineEdit"))->get_offset();
|
|
|
+ const Vector2 theme_ofs = path->get_theme_stylebox(CoreStringName(normal), SNAME("LineEdit"))->get_offset();
|
|
|
|
|
|
moving_selection_attempt = false;
|
|
|
moving_selection = false;
|
|
@@ -3419,11 +3444,19 @@ void AnimationTrackEditGroup::_notification(int p_what) {
|
|
|
} break;
|
|
|
|
|
|
case NOTIFICATION_DRAW: {
|
|
|
- Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
- int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
- int separation = get_theme_constant(SNAME("h_separation"), SNAME("ItemList"));
|
|
|
+ const Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
+ const int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
|
|
|
|
|
|
+ const Ref<StyleBox> &stylebox_header = get_theme_stylebox(SNAME("header"), SNAME("AnimationTrackEditGroup"));
|
|
|
+ const int outer_margin = get_theme_constant(SNAME("outer_margin"), SNAME("AnimationTrackEdit"));
|
|
|
+
|
|
|
+ float v_margin_offset = stylebox_header->get_content_margin(SIDE_TOP) - stylebox_header->get_content_margin(SIDE_BOTTOM);
|
|
|
+
|
|
|
+ const Color h_line_color = get_theme_color(SNAME("h_line_color"), SNAME("AnimationTrackEditGroup"));
|
|
|
+ const Color v_line_color = get_theme_color(SNAME("v_line_color"), SNAME("AnimationTrackEditGroup"));
|
|
|
+ const int h_separation = get_theme_constant(SNAME("h_separation"), SNAME("AnimationTrackEditGroup"));
|
|
|
+
|
|
|
if (root) {
|
|
|
Node *n = root->get_node_or_null(node);
|
|
|
if (n && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) {
|
|
@@ -3431,25 +3464,21 @@ void AnimationTrackEditGroup::_notification(int p_what) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Color bgcol = get_theme_color(SNAME("dark_color_2"), EditorStringName(Editor));
|
|
|
- bgcol.a *= 0.6;
|
|
|
- draw_rect(Rect2(Point2(), get_size()), bgcol);
|
|
|
- Color linecolor = color;
|
|
|
- linecolor.a = 0.2;
|
|
|
+ draw_style_box(stylebox_header, Rect2(Point2(), get_size()));
|
|
|
|
|
|
- draw_line(Point2(), Point2(get_size().width, 0), linecolor, Math::round(EDSCALE));
|
|
|
- draw_line(Point2(timeline->get_name_limit(), 0), Point2(timeline->get_name_limit(), get_size().height), linecolor, Math::round(EDSCALE));
|
|
|
- draw_line(Point2(get_size().width - timeline->get_buttons_width(), 0), Point2(get_size().width - timeline->get_buttons_width(), get_size().height), linecolor, Math::round(EDSCALE));
|
|
|
+ draw_line(Point2(), Point2(get_size().width, 0), h_line_color, Math::round(EDSCALE));
|
|
|
+ draw_line(Point2(timeline->get_name_limit(), 0), Point2(timeline->get_name_limit(), get_size().height), v_line_color, Math::round(EDSCALE));
|
|
|
+ draw_line(Point2(get_size().width - timeline->get_buttons_width() - outer_margin, 0), Point2(get_size().width - timeline->get_buttons_width() - outer_margin, get_size().height), v_line_color, Math::round(EDSCALE));
|
|
|
|
|
|
- int ofs = 0;
|
|
|
- draw_texture_rect(icon, Rect2(Point2(ofs, int(get_size().height - icon_size.y) / 2), icon_size));
|
|
|
- ofs += separation + icon_size.x;
|
|
|
- draw_string(font, Point2(ofs, int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), node_name, HORIZONTAL_ALIGNMENT_LEFT, timeline->get_name_limit() - ofs, font_size, color);
|
|
|
+ int ofs = stylebox_header->get_margin(SIDE_LEFT);
|
|
|
+ draw_texture_rect(icon, Rect2(Point2(ofs, (get_size().height - icon_size.y) / 2 + v_margin_offset).round(), icon_size));
|
|
|
+ ofs += h_separation + icon_size.x;
|
|
|
+ draw_string(font, Point2(ofs, (get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size) + v_margin_offset).round(), node_name, HORIZONTAL_ALIGNMENT_LEFT, timeline->get_name_limit() - ofs, font_size, color);
|
|
|
|
|
|
int px = (-timeline->get_value() + timeline->get_play_position()) * timeline->get_zoom_scale() + timeline->get_name_limit();
|
|
|
|
|
|
if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
|
|
|
- Color accent = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
|
|
+ const Color accent = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
|
|
draw_line(Point2(px, 0), Point2(px, get_size().height), accent, Math::round(2 * EDSCALE));
|
|
|
}
|
|
|
} break;
|
|
@@ -3484,11 +3513,14 @@ void AnimationTrackEditGroup::set_type_and_name(const Ref<Texture2D> &p_type, co
|
|
|
}
|
|
|
|
|
|
Size2 AnimationTrackEditGroup::get_minimum_size() const {
|
|
|
- Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
- int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
- int separation = get_theme_constant(SNAME("v_separation"), SNAME("ItemList"));
|
|
|
+ const Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
|
|
|
+ const int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
|
|
+ const int separation = get_theme_constant(SNAME("v_separation"), SNAME("ItemList"));
|
|
|
+
|
|
|
+ const Ref<StyleBox> &header_style = get_theme_stylebox(SNAME("header"), SNAME("AnimationTrackEditGroup"));
|
|
|
+ const int content_margin = header_style->get_content_margin(SIDE_TOP) + header_style->get_content_margin(SIDE_BOTTOM);
|
|
|
|
|
|
- return Vector2(0, MAX(font->get_height(font_size), icon_size.y) + separation);
|
|
|
+ return Vector2(0, MAX(font->get_height(font_size), icon_size.y) + separation + content_margin);
|
|
|
}
|
|
|
|
|
|
void AnimationTrackEditGroup::set_timeline(AnimationTimelineEdit *p_timeline) {
|
|
@@ -4891,6 +4923,12 @@ void AnimationTrackEditor::_notification(int p_what) {
|
|
|
edit->get_popup()->set_item_icon(edit->get_popup()->get_item_index(EDIT_APPLY_RESET), get_editor_theme_icon(SNAME("Reload")));
|
|
|
auto_fit->set_icon(get_editor_theme_icon(SNAME("AnimationAutoFit")));
|
|
|
auto_fit_bezier->set_icon(get_editor_theme_icon(SNAME("AnimationAutoFitBezier")));
|
|
|
+
|
|
|
+ const int timeline_separation = get_theme_constant(SNAME("timeline_v_separation"), SNAME("AnimationTrackEditor"));
|
|
|
+ timeline_vbox->add_theme_constant_override("separation", timeline_separation);
|
|
|
+
|
|
|
+ const int track_separation = get_theme_constant(SNAME("track_v_separation"), SNAME("AnimationTrackEditor"));
|
|
|
+ track_vbox->add_theme_constant_override("separation", track_separation);
|
|
|
} break;
|
|
|
|
|
|
case NOTIFICATION_READY: {
|
|
@@ -6389,7 +6427,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
|
|
undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
|
|
|
undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
|
|
|
|
|
|
- // 7-reselect.
|
|
|
+ // 7 - Reselect.
|
|
|
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
|
|
|
float oldpos = E->get().pos;
|
|
|
float newpos = NEW_POS(oldpos);
|
|
@@ -7182,11 +7220,10 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
|
|
main_panel->add_child(timeline_scroll);
|
|
|
timeline_scroll->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
|
|
|
- VBoxContainer *timeline_vbox = memnew(VBoxContainer);
|
|
|
+ timeline_vbox = memnew(VBoxContainer);
|
|
|
timeline_scroll->add_child(timeline_vbox);
|
|
|
timeline_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
timeline_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
- timeline_vbox->add_theme_constant_override("separation", 0);
|
|
|
|
|
|
info_message = memnew(Label);
|
|
|
info_message->set_text(TTR("Select an AnimationPlayer node to create and edit animations."));
|
|
@@ -7239,7 +7276,6 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
|
|
scroll->add_child(track_vbox);
|
|
|
track_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
scroll->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
|
|
|
- track_vbox->add_theme_constant_override("separation", 0);
|
|
|
|
|
|
HBoxContainer *bottom_hb = memnew(HBoxContainer);
|
|
|
add_child(bottom_hb);
|
|
@@ -7585,7 +7621,6 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
|
|
bake_grid->add_child(memnew(Label(TTR("FPS:"))));
|
|
|
bake_grid->add_child(bake_fps);
|
|
|
|
|
|
- //
|
|
|
track_copy_dialog = memnew(ConfirmationDialog);
|
|
|
add_child(track_copy_dialog);
|
|
|
track_copy_dialog->set_title(TTR("Select Tracks to Copy"));
|
|
@@ -7617,7 +7652,7 @@ AnimationTrackEditor::~AnimationTrackEditor() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// AnimationTrackKeyEditEditorPlugin
|
|
|
+// AnimationTrackKeyEditEditorPlugin.
|
|
|
|
|
|
void AnimationTrackKeyEditEditor::_time_edit_entered() {
|
|
|
int key = animation->track_find_key(track, key_ofs, Animation::FIND_MODE_APPROX);
|