diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/code_edit.cpp | 3 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 4 | ||||
-rw-r--r-- | scene/gui/control.h | 1 | ||||
-rw-r--r-- | scene/gui/file_dialog.cpp | 98 | ||||
-rw-r--r-- | scene/gui/file_dialog.h | 2 | ||||
-rw-r--r-- | scene/gui/gradient_edit.cpp | 4 | ||||
-rw-r--r-- | scene/gui/graph_edit.cpp | 1 | ||||
-rw-r--r-- | scene/gui/popup.cpp | 3 | ||||
-rw-r--r-- | scene/gui/scroll_container.cpp | 5 | ||||
-rw-r--r-- | scene/main/window.h | 1 | ||||
-rw-r--r-- | scene/resources/animation.cpp | 134 |
11 files changed, 132 insertions, 124 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index b9760499ef..e54ba7ce13 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -36,7 +36,8 @@ void CodeEdit::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_THEME_CHANGED: + case NOTIFICATION_ENTER_TREE: { style_normal = get_theme_stylebox(SNAME("normal")); font = get_theme_font(SNAME("font")); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index ed42d1c5ea..a417e7b9e2 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -63,8 +63,8 @@ void ColorPicker::_notification(int p_what) { } } #endif - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { btn_pick->set_icon(get_theme_icon(SNAME("screen_picker"), SNAME("ColorPicker"))); btn_add_preset->set_icon(get_theme_icon(SNAME("add_preset"))); diff --git a/scene/gui/control.h b/scene/gui/control.h index 66cd15542a..6215594ae0 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -357,7 +357,6 @@ public: NOTIFICATION_MOUSE_EXIT = 42, NOTIFICATION_FOCUS_ENTER = 43, NOTIFICATION_FOCUS_EXIT = 44, - // This doesn't need to be paired with `NOTIFICATION_ENTER_TREE`. NOTIFICATION_THEME_CHANGED = 45, NOTIFICATION_SCROLL_BEGIN = 47, NOTIFICATION_SCROLL_END = 48, diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index ab2c19e9b1..57655afb4c 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -59,6 +59,38 @@ VBoxContainer *FileDialog::get_vbox() { return vbox; } +void FileDialog::_theme_changed() { + Color font_color = vbox->get_theme_color(SNAME("font_color"), SNAME("Button")); + Color font_hover_color = vbox->get_theme_color(SNAME("font_hover_color"), SNAME("Button")); + Color font_focus_color = vbox->get_theme_color(SNAME("font_focus_color"), SNAME("Button")); + Color font_pressed_color = vbox->get_theme_color(SNAME("font_pressed_color"), SNAME("Button")); + + dir_up->add_theme_color_override("icon_normal_color", font_color); + dir_up->add_theme_color_override("icon_hover_color", font_hover_color); + dir_up->add_theme_color_override("icon_focus_color", font_focus_color); + dir_up->add_theme_color_override("icon_pressed_color", font_pressed_color); + + dir_prev->add_theme_color_override("icon_color_normal", font_color); + dir_prev->add_theme_color_override("icon_color_hover", font_hover_color); + dir_prev->add_theme_color_override("icon_focus_color", font_focus_color); + dir_prev->add_theme_color_override("icon_color_pressed", font_pressed_color); + + dir_next->add_theme_color_override("icon_color_normal", font_color); + dir_next->add_theme_color_override("icon_color_hover", font_hover_color); + dir_next->add_theme_color_override("icon_focus_color", font_focus_color); + dir_next->add_theme_color_override("icon_color_pressed", font_pressed_color); + + refresh->add_theme_color_override("icon_normal_color", font_color); + refresh->add_theme_color_override("icon_hover_color", font_hover_color); + refresh->add_theme_color_override("icon_focus_color", font_focus_color); + refresh->add_theme_color_override("icon_pressed_color", font_pressed_color); + + show_hidden->add_theme_color_override("icon_normal_color", font_color); + show_hidden->add_theme_color_override("icon_hover_color", font_hover_color); + show_hidden->add_theme_color_override("icon_focus_color", font_focus_color); + show_hidden->add_theme_color_override("icon_pressed_color", font_pressed_color); +} + void FileDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_VISIBILITY_CHANGED: { @@ -67,51 +99,22 @@ void FileDialog::_notification(int p_what) { } } break; - case NOTIFICATION_TRANSLATION_CHANGED: { - update_filters(); - } break; - - case NOTIFICATION_THEME_CHANGED: { - dir_up->set_icon(get_theme_icon(SNAME("parent_folder"), SNAME("FileDialog"))); + case NOTIFICATION_ENTER_TREE: { + dir_up->set_icon(vbox->get_theme_icon(SNAME("parent_folder"), SNAME("FileDialog"))); if (vbox->is_layout_rtl()) { - dir_prev->set_icon(get_theme_icon(SNAME("forward_folder"), SNAME("FileDialog"))); - dir_next->set_icon(get_theme_icon(SNAME("back_folder"), SNAME("FileDialog"))); + dir_prev->set_icon(vbox->get_theme_icon(SNAME("forward_folder"), SNAME("FileDialog"))); + dir_next->set_icon(vbox->get_theme_icon(SNAME("back_folder"), SNAME("FileDialog"))); } else { - dir_prev->set_icon(get_theme_icon(SNAME("back_folder"), SNAME("FileDialog"))); - dir_next->set_icon(get_theme_icon(SNAME("forward_folder"), SNAME("FileDialog"))); + dir_prev->set_icon(vbox->get_theme_icon(SNAME("back_folder"), SNAME("FileDialog"))); + dir_next->set_icon(vbox->get_theme_icon(SNAME("forward_folder"), SNAME("FileDialog"))); } - refresh->set_icon(get_theme_icon(SNAME("reload"), SNAME("FileDialog"))); - show_hidden->set_icon(get_theme_icon(SNAME("toggle_hidden"), SNAME("FileDialog"))); - - Color font_color = get_theme_color(SNAME("font_color"), SNAME("Button")); - Color font_hover_color = get_theme_color(SNAME("font_hover_color"), SNAME("Button")); - Color font_focus_color = get_theme_color(SNAME("font_focus_color"), SNAME("Button")); - Color font_pressed_color = get_theme_color(SNAME("font_pressed_color"), SNAME("Button")); - - dir_up->add_theme_color_override("icon_normal_color", font_color); - dir_up->add_theme_color_override("icon_hover_color", font_hover_color); - dir_up->add_theme_color_override("icon_focus_color", font_focus_color); - dir_up->add_theme_color_override("icon_pressed_color", font_pressed_color); - - dir_prev->add_theme_color_override("icon_color_normal", font_color); - dir_prev->add_theme_color_override("icon_color_hover", font_hover_color); - dir_prev->add_theme_color_override("icon_focus_color", font_focus_color); - dir_prev->add_theme_color_override("icon_color_pressed", font_pressed_color); - - dir_next->add_theme_color_override("icon_color_normal", font_color); - dir_next->add_theme_color_override("icon_color_hover", font_hover_color); - dir_next->add_theme_color_override("icon_focus_color", font_focus_color); - dir_next->add_theme_color_override("icon_color_pressed", font_pressed_color); - - refresh->add_theme_color_override("icon_normal_color", font_color); - refresh->add_theme_color_override("icon_hover_color", font_hover_color); - refresh->add_theme_color_override("icon_focus_color", font_focus_color); - refresh->add_theme_color_override("icon_pressed_color", font_pressed_color); - - show_hidden->add_theme_color_override("icon_normal_color", font_color); - show_hidden->add_theme_color_override("icon_hover_color", font_hover_color); - show_hidden->add_theme_color_override("icon_focus_color", font_focus_color); - show_hidden->add_theme_color_override("icon_pressed_color", font_pressed_color); + refresh->set_icon(vbox->get_theme_icon(SNAME("reload"), SNAME("FileDialog"))); + show_hidden->set_icon(vbox->get_theme_icon(SNAME("toggle_hidden"), SNAME("FileDialog"))); + _theme_changed(); + } break; + + case NOTIFICATION_TRANSLATION_CHANGED: { + update_filters(); } break; } } @@ -503,10 +506,10 @@ void FileDialog::update_file_list() { } TreeItem *root = tree->create_item(); - Ref<Texture2D> folder = get_theme_icon(SNAME("folder"), SNAME("FileDialog")); - Ref<Texture2D> file_icon = get_theme_icon(SNAME("file"), SNAME("FileDialog")); - const Color folder_color = get_theme_color(SNAME("folder_icon_modulate"), SNAME("FileDialog")); - const Color file_color = get_theme_color(SNAME("file_icon_modulate"), SNAME("FileDialog")); + Ref<Texture2D> folder = vbox->get_theme_icon(SNAME("folder"), SNAME("FileDialog")); + Ref<Texture2D> file_icon = vbox->get_theme_icon(SNAME("file"), SNAME("FileDialog")); + const Color folder_color = vbox->get_theme_color(SNAME("folder_icon_modulate"), SNAME("FileDialog")); + const Color file_color = vbox->get_theme_color(SNAME("file_icon_modulate"), SNAME("FileDialog")); List<String> files; List<String> dirs; @@ -603,7 +606,7 @@ void FileDialog::update_file_list() { ti->set_icon_modulate(0, file_color); if (mode == FILE_MODE_OPEN_DIR) { - ti->set_custom_color(0, get_theme_color(SNAME("files_disabled"), SNAME("FileDialog"))); + ti->set_custom_color(0, vbox->get_theme_color(SNAME("files_disabled"), SNAME("FileDialog"))); ti->set_selectable(0, false); } Dictionary d; @@ -1003,6 +1006,7 @@ FileDialog::FileDialog() { vbox = memnew(VBoxContainer); add_child(vbox, false, INTERNAL_MODE_FRONT); + vbox->connect("theme_changed", callable_mp(this, &FileDialog::_theme_changed)); mode = FILE_MODE_SAVE_FILE; set_title(TTRC("Save a File")); diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index 4ea39691c1..4945094086 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -143,6 +143,8 @@ private: virtual void _post_popup() override; protected: + void _theme_changed(); + void _notification(int p_what); static void _bind_methods(); //bind helpers diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index be097f7543..cc27a6b7c2 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -292,8 +292,8 @@ void GradientEdit::_notification(int p_what) { if (!picker->is_connected("color_changed", callable_mp(this, &GradientEdit::_color_changed))) { picker->connect("color_changed", callable_mp(this, &GradientEdit::_color_changed)); } - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { draw_spacing = BASE_SPACING * get_theme_default_base_scale(); draw_point_width = BASE_POINT_WIDTH * get_theme_default_base_scale(); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index a556514e0d..00f2e48601 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -424,6 +424,7 @@ void GraphEdit::remove_child_notify(Node *p_child) { void GraphEdit::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { port_hotzone_inner_extent = get_theme_constant("port_hotzone_inner_extent"); port_hotzone_outer_extent = get_theme_constant("port_hotzone_outer_extent"); diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 7461f48a6c..c4396f636a 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -240,7 +240,8 @@ void PopupPanel::_notification(int p_what) { panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), get_class_name())); } break; - case NOTIFICATION_ENTER_TREE: { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_READY: { panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), get_class_name())); _update_child_rects(); } break; diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index f58cb0fe70..8fd547813d 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -317,9 +317,10 @@ void ScrollContainer::_reposition_children() { void ScrollContainer::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: - case NOTIFICATION_TRANSLATION_CHANGED: - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_TRANSLATION_CHANGED: { _updating_scrollbars = true; call_deferred(SNAME("_update_scrollbar_position")); } break; diff --git a/scene/main/window.h b/scene/main/window.h index ebaf8fea75..a5b6b26104 100644 --- a/scene/main/window.h +++ b/scene/main/window.h @@ -168,7 +168,6 @@ public: enum { NOTIFICATION_VISIBILITY_CHANGED = 30, NOTIFICATION_POST_POPUP = 31, - // This doesn't need to be paired with `NOTIFICATION_ENTER_TREE`. NOTIFICATION_THEME_CHANGED = 32 }; diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 823617328e..9d5bc18c96 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -4201,25 +4201,25 @@ void Animation::_position_track_optimize(int p_idx, real_t p_allowed_velocity_er void Animation::_rotation_track_optimize(int p_idx, real_t p_allowed_velocity_err, real_t p_allowed_angular_err, real_t p_allowed_precision_error) { ERR_FAIL_INDEX(p_idx, tracks.size()); ERR_FAIL_COND(tracks[p_idx]->type != TYPE_ROTATION_3D); - RotationTrack *tt = static_cast<RotationTrack *>(tracks[p_idx]); + RotationTrack *rt = static_cast<RotationTrack *>(tracks[p_idx]); int i = 0; - while (i < tt->rotations.size() - 2) { - TKey<Quaternion> t0 = tt->rotations[i]; - TKey<Quaternion> t1 = tt->rotations[i + 1]; - TKey<Quaternion> t2 = tt->rotations[i + 2]; + while (i < rt->rotations.size() - 2) { + TKey<Quaternion> t0 = rt->rotations[i]; + TKey<Quaternion> t1 = rt->rotations[i + 1]; + TKey<Quaternion> t2 = rt->rotations[i + 2]; bool erase = _quaternion_track_optimize_key(t0, t1, t2, p_allowed_velocity_err, p_allowed_angular_err, p_allowed_precision_error); if (erase) { - tt->rotations.remove_at(i + 1); + rt->rotations.remove_at(i + 1); } else { i++; } } - if (tt->rotations.size() == 2) { - if ((tt->rotations[0].value - tt->rotations[1].value).length() < p_allowed_precision_error) { - tt->rotations.remove_at(1); + if (rt->rotations.size() == 2) { + if ((rt->rotations[0].value - rt->rotations[1].value).length() < p_allowed_precision_error) { + rt->rotations.remove_at(1); } } } @@ -4227,25 +4227,25 @@ void Animation::_rotation_track_optimize(int p_idx, real_t p_allowed_velocity_er void Animation::_scale_track_optimize(int p_idx, real_t p_allowed_velocity_err, real_t p_allowed_angular_err, real_t p_allowed_precision_error) { ERR_FAIL_INDEX(p_idx, tracks.size()); ERR_FAIL_COND(tracks[p_idx]->type != TYPE_SCALE_3D); - ScaleTrack *tt = static_cast<ScaleTrack *>(tracks[p_idx]); + ScaleTrack *st = static_cast<ScaleTrack *>(tracks[p_idx]); int i = 0; - while (i < tt->scales.size() - 2) { - TKey<Vector3> t0 = tt->scales[i]; - TKey<Vector3> t1 = tt->scales[i + 1]; - TKey<Vector3> t2 = tt->scales[i + 2]; + while (i < st->scales.size() - 2) { + TKey<Vector3> t0 = st->scales[i]; + TKey<Vector3> t1 = st->scales[i + 1]; + TKey<Vector3> t2 = st->scales[i + 2]; bool erase = _vector3_track_optimize_key(t0, t1, t2, p_allowed_velocity_err, p_allowed_angular_err, p_allowed_precision_error); if (erase) { - tt->scales.remove_at(i + 1); + st->scales.remove_at(i + 1); } else { i++; } } - if (tt->scales.size() == 2) { - if ((tt->scales[0].value - tt->scales[1].value).length() < p_allowed_precision_error) { - tt->scales.remove_at(1); + if (st->scales.size() == 2) { + if ((st->scales[0].value - st->scales[1].value).length() < p_allowed_precision_error) { + st->scales.remove_at(1); } } } @@ -4253,25 +4253,25 @@ void Animation::_scale_track_optimize(int p_idx, real_t p_allowed_velocity_err, void Animation::_blend_shape_track_optimize(int p_idx, real_t p_allowed_velocity_err, real_t p_allowed_precision_error) { ERR_FAIL_INDEX(p_idx, tracks.size()); ERR_FAIL_COND(tracks[p_idx]->type != TYPE_BLEND_SHAPE); - BlendShapeTrack *tt = static_cast<BlendShapeTrack *>(tracks[p_idx]); + BlendShapeTrack *bst = static_cast<BlendShapeTrack *>(tracks[p_idx]); int i = 0; - while (i < tt->blend_shapes.size() - 2) { - TKey<float> t0 = tt->blend_shapes[i]; - TKey<float> t1 = tt->blend_shapes[i + 1]; - TKey<float> t2 = tt->blend_shapes[i + 2]; + while (i < bst->blend_shapes.size() - 2) { + TKey<float> t0 = bst->blend_shapes[i]; + TKey<float> t1 = bst->blend_shapes[i + 1]; + TKey<float> t2 = bst->blend_shapes[i + 2]; bool erase = _float_track_optimize_key(t0, t1, t2, p_allowed_velocity_err, p_allowed_precision_error); if (erase) { - tt->blend_shapes.remove_at(i + 1); + bst->blend_shapes.remove_at(i + 1); } else { i++; } } - if (tt->blend_shapes.size() == 2) { - if (abs(tt->blend_shapes[0].value - tt->blend_shapes[1].value) < p_allowed_precision_error) { - tt->blend_shapes.remove_at(1); + if (bst->blend_shapes.size() == 2) { + if (abs(bst->blend_shapes[0].value - bst->blend_shapes[1].value) < p_allowed_precision_error) { + bst->blend_shapes.remove_at(1); } } } @@ -4279,28 +4279,28 @@ void Animation::_blend_shape_track_optimize(int p_idx, real_t p_allowed_velocity void Animation::_value_track_optimize(int p_idx, real_t p_allowed_velocity_err, real_t p_allowed_angular_err, real_t p_allowed_precision_error) { ERR_FAIL_INDEX(p_idx, tracks.size()); ERR_FAIL_COND(tracks[p_idx]->type != TYPE_VALUE); - ValueTrack *tt = static_cast<ValueTrack *>(tracks[p_idx]); - if (tt->values.size() == 0) { + ValueTrack *vt = static_cast<ValueTrack *>(tracks[p_idx]); + if (vt->values.size() == 0) { return; } - Variant::Type type = tt->values[0].value.get_type(); + Variant::Type type = vt->values[0].value.get_type(); // Special case for angle interpolation. - bool is_using_angle = tt->interpolation == Animation::INTERPOLATION_LINEAR_ANGLE || tt->interpolation == Animation::INTERPOLATION_CUBIC_ANGLE; + bool is_using_angle = vt->interpolation == Animation::INTERPOLATION_LINEAR_ANGLE || vt->interpolation == Animation::INTERPOLATION_CUBIC_ANGLE; int i = 0; - while (i < tt->values.size() - 2) { + while (i < vt->values.size() - 2) { bool erase = false; switch (type) { case Variant::FLOAT: { TKey<float> t0; TKey<float> t1; TKey<float> t2; - t0.time = tt->values[i].time; - t1.time = tt->values[i + 1].time; - t2.time = tt->values[i + 2].time; - t0.value = tt->values[i].value; - t1.value = tt->values[i + 1].value; - t2.value = tt->values[i + 2].value; + t0.time = vt->values[i].time; + t1.time = vt->values[i + 1].time; + t2.time = vt->values[i + 2].time; + t0.value = vt->values[i].value; + t1.value = vt->values[i + 1].value; + t2.value = vt->values[i + 2].value; if (is_using_angle) { float diff1 = fmod(t1.value - t0.value, Math_TAU); t1.value = t0.value + fmod(2.0 * diff1, Math_TAU) - diff1; @@ -4316,36 +4316,36 @@ void Animation::_value_track_optimize(int p_idx, real_t p_allowed_velocity_err, TKey<Vector2> t0; TKey<Vector2> t1; TKey<Vector2> t2; - t0.time = tt->values[i].time; - t1.time = tt->values[i + 1].time; - t2.time = tt->values[i + 2].time; - t0.value = tt->values[i].value; - t1.value = tt->values[i + 1].value; - t2.value = tt->values[i + 2].value; + t0.time = vt->values[i].time; + t1.time = vt->values[i + 1].time; + t2.time = vt->values[i + 2].time; + t0.value = vt->values[i].value; + t1.value = vt->values[i + 1].value; + t2.value = vt->values[i + 2].value; erase = _vector2_track_optimize_key(t0, t1, t2, p_allowed_velocity_err, p_allowed_angular_err, p_allowed_precision_error); } break; case Variant::VECTOR3: { TKey<Vector3> t0; TKey<Vector3> t1; TKey<Vector3> t2; - t0.time = tt->values[i].time; - t1.time = tt->values[i + 1].time; - t2.time = tt->values[i + 2].time; - t0.value = tt->values[i].value; - t1.value = tt->values[i + 1].value; - t2.value = tt->values[i + 2].value; + t0.time = vt->values[i].time; + t1.time = vt->values[i + 1].time; + t2.time = vt->values[i + 2].time; + t0.value = vt->values[i].value; + t1.value = vt->values[i + 1].value; + t2.value = vt->values[i + 2].value; erase = _vector3_track_optimize_key(t0, t1, t2, p_allowed_velocity_err, p_allowed_angular_err, p_allowed_precision_error); } break; case Variant::QUATERNION: { TKey<Quaternion> t0; TKey<Quaternion> t1; TKey<Quaternion> t2; - t0.time = tt->values[i].time; - t1.time = tt->values[i + 1].time; - t2.time = tt->values[i + 2].time; - t0.value = tt->values[i].value; - t1.value = tt->values[i + 1].value; - t2.value = tt->values[i + 2].value; + t0.time = vt->values[i].time; + t1.time = vt->values[i + 1].time; + t2.time = vt->values[i + 2].time; + t0.value = vt->values[i].value; + t1.value = vt->values[i + 1].value; + t2.value = vt->values[i + 2].value; erase = _quaternion_track_optimize_key(t0, t1, t2, p_allowed_velocity_err, p_allowed_angular_err, p_allowed_precision_error); } break; default: { @@ -4353,18 +4353,18 @@ void Animation::_value_track_optimize(int p_idx, real_t p_allowed_velocity_err, } if (erase) { - tt->values.remove_at(i + 1); + vt->values.remove_at(i + 1); } else { i++; } } - if (tt->values.size() == 2) { + if (vt->values.size() == 2) { bool single_key = false; switch (type) { case Variant::FLOAT: { - float val_0 = tt->values[0].value; - float val_1 = tt->values[1].value; + float val_0 = vt->values[0].value; + float val_1 = vt->values[1].value; if (is_using_angle) { float diff1 = fmod(val_1 - val_0, Math_TAU); val_1 = val_0 + fmod(2.0 * diff1, Math_TAU) - diff1; @@ -4372,25 +4372,25 @@ void Animation::_value_track_optimize(int p_idx, real_t p_allowed_velocity_err, single_key = abs(val_0 - val_1) < p_allowed_precision_error; } break; case Variant::VECTOR2: { - Vector2 val_0 = tt->values[0].value; - Vector2 val_1 = tt->values[1].value; + Vector2 val_0 = vt->values[0].value; + Vector2 val_1 = vt->values[1].value; single_key = (val_0 - val_1).length() < p_allowed_precision_error; } break; case Variant::VECTOR3: { - Vector3 val_0 = tt->values[0].value; - Vector3 val_1 = tt->values[1].value; + Vector3 val_0 = vt->values[0].value; + Vector3 val_1 = vt->values[1].value; single_key = (val_0 - val_1).length() < p_allowed_precision_error; } break; case Variant::QUATERNION: { - Quaternion val_0 = tt->values[0].value; - Quaternion val_1 = tt->values[1].value; + Quaternion val_0 = vt->values[0].value; + Quaternion val_1 = vt->values[1].value; single_key = (val_0 - val_1).length() < p_allowed_precision_error; } break; default: { } break; } if (single_key) { - tt->values.remove_at(1); + vt->values.remove_at(1); } } } |