feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

@ -30,7 +30,6 @@
#include "parallax_2d.h"
#include "core/config/project_settings.h"
#include "scene/main/viewport.h"
void Parallax2D::_notification(int p_what) {
@ -47,9 +46,18 @@ void Parallax2D::_notification(int p_what) {
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
autoscroll_offset += autoscroll * get_process_delta_time();
autoscroll_offset = autoscroll_offset.posmodv(repeat_size);
Point2 offset = scroll_offset;
offset += autoscroll * get_process_delta_time();
if (repeat_size.x) {
offset.x = Math::fposmod(offset.x, repeat_size.x);
}
if (repeat_size.y) {
offset.y = Math::fposmod(offset.y, repeat_size.y);
}
scroll_offset = offset;
_update_scroll();
} break;
@ -61,7 +69,9 @@ void Parallax2D::_notification(int p_what) {
#ifdef TOOLS_ENABLED
void Parallax2D::_edit_set_position(const Point2 &p_position) {
set_scroll_offset(p_position);
// Avoids early return for grid snap compatibility
scroll_offset = p_position;
_update_scroll();
}
#endif // TOOLS_ENABLED
@ -74,7 +84,11 @@ void Parallax2D::_validate_property(PropertyInfo &p_property) const {
void Parallax2D::_camera_moved(const Transform2D &p_transform, const Point2 &p_screen_offset, const Point2 &p_adj_screen_pos) {
if (!ignore_camera_scroll) {
if (get_viewport() && get_viewport()->is_snap_2d_transforms_to_pixel_enabled()) {
set_screen_offset((p_adj_screen_pos + Vector2(0.5, 0.5)).floor());
Size2 vps = get_viewport_rect().size;
Vector2 offset;
offset.x = ((int)vps.width % 2) ? 0.0 : 0.5;
offset.y = ((int)vps.height % 2) ? 0.0 : 0.5;
set_screen_offset((p_adj_screen_pos + offset).floor());
} else {
set_screen_offset(p_adj_screen_pos);
}
@ -106,14 +120,14 @@ void Parallax2D::_update_scroll() {
scroll_ofs *= scroll_scale;
if (repeat_size.x) {
real_t mod = Math::fposmod(scroll_ofs.x - scroll_offset.x - autoscroll_offset.x, repeat_size.x * get_scale().x);
real_t mod = Math::fposmod(scroll_ofs.x - scroll_offset.x, repeat_size.x * get_scale().x);
scroll_ofs.x = screen_offset.x - mod;
} else {
scroll_ofs.x = screen_offset.x + scroll_offset.x - scroll_ofs.x;
}
if (repeat_size.y) {
real_t mod = Math::fposmod(scroll_ofs.y - scroll_offset.y - autoscroll_offset.y, repeat_size.y * get_scale().y);
real_t mod = Math::fposmod(scroll_ofs.y - scroll_offset.y, repeat_size.y * get_scale().y);
scroll_ofs.y = screen_offset.y - mod;
} else {
scroll_ofs.y = screen_offset.y + scroll_offset.y - scroll_ofs.y;
@ -193,7 +207,6 @@ void Parallax2D::set_autoscroll(const Point2 &p_autoscroll) {
}
autoscroll = p_autoscroll;
autoscroll_offset = Point2();
_update_process();
_update_scroll();