diff options
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/camera_2d.cpp | 8 | ||||
-rw-r--r-- | scene/2d/path_2d.cpp | 6 | ||||
-rw-r--r-- | scene/2d/path_2d.h | 2 |
3 files changed, 10 insertions, 6 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 8f69676da4..68e99445d8 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -343,7 +343,9 @@ void Camera2D::_notification(int p_what) { void Camera2D::set_offset(const Vector2 &p_offset) { offset = p_offset; + Point2 old_smoothed_camera_pos = smoothed_camera_pos; _update_scroll(); + smoothed_camera_pos = old_smoothed_camera_pos; } Vector2 Camera2D::get_offset() const { @@ -361,7 +363,9 @@ Camera2D::AnchorMode Camera2D::get_anchor_mode() const { void Camera2D::set_rotating(bool p_rotating) { rotating = p_rotating; + Point2 old_smoothed_camera_pos = smoothed_camera_pos; _update_scroll(); + smoothed_camera_pos = old_smoothed_camera_pos; } bool Camera2D::is_rotating() const { @@ -522,7 +526,9 @@ bool Camera2D::is_v_drag_enabled() const { void Camera2D::set_v_offset(float p_offset) { v_ofs = p_offset; v_offset_changed = true; + Point2 old_smoothed_camera_pos = smoothed_camera_pos; _update_scroll(); + smoothed_camera_pos = old_smoothed_camera_pos; } float Camera2D::get_v_offset() const { @@ -532,7 +538,9 @@ float Camera2D::get_v_offset() const { void Camera2D::set_h_offset(float p_offset) { h_ofs = p_offset; h_offset_changed = true; + Point2 old_smoothed_camera_pos = smoothed_camera_pos; _update_scroll(); + smoothed_camera_pos = old_smoothed_camera_pos; } float Camera2D::get_h_offset() const { diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 00e9af3bb7..f2f549e851 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -149,11 +149,7 @@ void Path2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_curve", "curve"), &Path2D::set_curve); ClassDB::bind_method(D_METHOD("get_curve"), &Path2D::get_curve); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve2D"), "set_curve", "get_curve"); -} - -Path2D::Path2D() { - set_curve(Ref<Curve2D>(memnew(Curve2D))); //create one by default + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve2D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT), "set_curve", "get_curve"); } ///////////////////////////////////////////////////////////////////////////////// diff --git a/scene/2d/path_2d.h b/scene/2d/path_2d.h index 288ef698e7..38fcca0323 100644 --- a/scene/2d/path_2d.h +++ b/scene/2d/path_2d.h @@ -55,7 +55,7 @@ public: void set_curve(const Ref<Curve2D> &p_curve); Ref<Curve2D> get_curve() const; - Path2D(); + Path2D() {} }; class PathFollow2D : public Node2D { |