summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorMarcus Elg <marcusaccounts@yahoo.se>2023-03-02 20:53:25 +0100
committerYuri Sizov <yuris@humnom.net>2023-03-13 21:25:14 +0100
commit6041ad5c701b05b7cf3518dfda1cf047333aaeb5 (patch)
treec0a0b54dd2f8bfdc0854c625e547887f9f7eaf02 /scene/2d
parent6cd227a35c3ca27d138e99582dcf8b1e4ac20aa6 (diff)
Fix Camera2D position smoothing properties not being grouped
(cherry picked from commit a835dfd96d2a758fb194237954f0d4824ff08e05)
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/camera_2d.cpp14
-rw-r--r--scene/2d/camera_2d.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 2b90a3702f..fdd709c3cb 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -158,7 +158,7 @@ Transform2D Camera2D::get_camera_transform() {
}
}
- if (follow_smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
+ if (position_smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
real_t c = position_smoothing_speed * (process_callback == CAMERA2D_PROCESS_PHYSICS ? get_physics_process_delta_time() : get_process_delta_time());
smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos;
ret_camera_pos = smoothed_camera_pos;
@@ -186,7 +186,7 @@ Transform2D Camera2D::get_camera_transform() {
Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom_scale);
- if (!follow_smoothing_enabled || !limit_smoothing_enabled) {
+ if (!position_smoothing_enabled || !limit_smoothing_enabled) {
if (screen_rect.position.x < limit[SIDE_LEFT]) {
screen_rect.position.x = limit[SIDE_LEFT];
}
@@ -617,18 +617,18 @@ real_t Camera2D::get_drag_horizontal_offset() const {
void Camera2D::_set_old_smoothing(real_t p_enable) {
//compatibility
if (p_enable > 0) {
- follow_smoothing_enabled = true;
+ position_smoothing_enabled = true;
set_position_smoothing_speed(p_enable);
}
}
void Camera2D::set_position_smoothing_enabled(bool p_enabled) {
- follow_smoothing_enabled = p_enabled;
+ position_smoothing_enabled = p_enabled;
notify_property_list_changed();
}
bool Camera2D::is_position_smoothing_enabled() const {
- return follow_smoothing_enabled;
+ return position_smoothing_enabled;
}
void Camera2D::set_custom_viewport(Node *p_viewport) {
@@ -699,7 +699,7 @@ bool Camera2D::is_margin_drawing_enabled() const {
}
void Camera2D::_validate_property(PropertyInfo &p_property) const {
- if (!follow_smoothing_enabled && p_property.name == "smoothing_speed") {
+ if (!position_smoothing_enabled && p_property.name == "position_smoothing_speed") {
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
}
if (!rotation_smoothing_enabled && p_property.name == "rotation_smoothing_speed") {
@@ -801,7 +801,7 @@ void Camera2D::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::INT, "limit_bottom", PROPERTY_HINT_NONE, "suffix:px"), "set_limit", "get_limit", SIDE_BOTTOM);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "limit_smoothed"), "set_limit_smoothing_enabled", "is_limit_smoothing_enabled");
- ADD_GROUP("Follow Smoothing", "follow_smoothing_");
+ ADD_GROUP("Position Smoothing", "position_smoothing_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "position_smoothing_enabled"), "set_position_smoothing_enabled", "is_position_smoothing_enabled");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "position_smoothing_speed", PROPERTY_HINT_NONE, "suffix:px/s"), "set_position_smoothing_speed", "get_position_smoothing_speed");
diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h
index 2417953691..808529b0fb 100644
--- a/scene/2d/camera_2d.h
+++ b/scene/2d/camera_2d.h
@@ -67,7 +67,7 @@ protected:
bool ignore_rotation = true;
bool enabled = true;
real_t position_smoothing_speed = 5.0;
- bool follow_smoothing_enabled = false;
+ bool position_smoothing_enabled = false;
real_t camera_angle = 0.0;
real_t rotation_smoothing_speed = 5.0;