summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/animated_sprite_2d.h22
-rw-r--r--scene/2d/area_2d.h2
-rw-r--r--scene/2d/audio_stream_player_2d.h2
-rw-r--r--scene/2d/back_buffer_copy.h6
-rw-r--r--scene/2d/camera_2d.cpp18
-rw-r--r--scene/2d/camera_2d.h2
-rw-r--r--scene/2d/canvas_modulate.h2
-rw-r--r--scene/2d/collision_object_2d.h2
-rw-r--r--scene/2d/collision_polygon_2d.h8
-rw-r--r--scene/2d/collision_shape_2d.cpp7
-rw-r--r--scene/2d/collision_shape_2d.h6
-rw-r--r--scene/2d/cpu_particles_2d.cpp6
-rw-r--r--scene/2d/cpu_particles_2d.h4
-rw-r--r--scene/2d/gpu_particles_2d.h4
-rw-r--r--scene/2d/joints_2d.h6
-rw-r--r--scene/2d/light_2d.h20
-rw-r--r--scene/2d/light_occluder_2d.h8
-rw-r--r--scene/2d/line_2d.h6
-rw-r--r--scene/2d/mesh_instance_2d.h2
-rw-r--r--scene/2d/multimesh_instance_2d.h2
-rw-r--r--scene/2d/navigation_agent_2d.h2
-rw-r--r--scene/2d/navigation_obstacle_2d.h2
-rw-r--r--scene/2d/navigation_region_2d.h6
-rw-r--r--scene/2d/node_2d.h22
-rw-r--r--scene/2d/parallax_layer.h2
-rw-r--r--scene/2d/path_2d.h10
-rw-r--r--scene/2d/physics_body_2d.cpp14
-rw-r--r--scene/2d/physics_body_2d.h6
-rw-r--r--scene/2d/polygon_2d.h16
-rw-r--r--scene/2d/position_2d.h4
-rw-r--r--scene/2d/ray_cast_2d.cpp3
-rw-r--r--scene/2d/remote_transform_2d.h2
-rw-r--r--scene/2d/skeleton_2d.h2
-rw-r--r--scene/2d/sprite_2d.cpp2
-rw-r--r--scene/2d/sprite_2d.h20
-rw-r--r--scene/2d/tile_map.h14
-rw-r--r--scene/2d/touch_screen_button.h6
-rw-r--r--scene/2d/visibility_notifier_2d.h10
38 files changed, 149 insertions, 129 deletions
diff --git a/scene/2d/animated_sprite_2d.h b/scene/2d/animated_sprite_2d.h
index 5e8344ec4c..cefed56620 100644
--- a/scene/2d/animated_sprite_2d.h
+++ b/scene/2d/animated_sprite_2d.h
@@ -172,21 +172,21 @@ class AnimatedSprite2D : public Node2D {
protected:
static void _bind_methods();
void _notification(int p_what);
- virtual void _validate_property(PropertyInfo &property) const;
+ virtual void _validate_property(PropertyInfo &property) const override;
public:
#ifdef TOOLS_ENABLED
- virtual Dictionary _edit_get_state() const;
- virtual void _edit_set_state(const Dictionary &p_state);
-
- virtual void _edit_set_pivot(const Point2 &p_pivot);
- virtual Point2 _edit_get_pivot() const;
- virtual bool _edit_use_pivot() const;
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
+ virtual Dictionary _edit_get_state() const override;
+ virtual void _edit_set_state(const Dictionary &p_state) override;
+
+ virtual void _edit_set_pivot(const Point2 &p_pivot) override;
+ virtual Point2 _edit_get_pivot() const override;
+ virtual bool _edit_use_pivot() const override;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
#endif
- virtual Rect2 get_anchorable_rect() const;
+ virtual Rect2 get_anchorable_rect() const override;
void set_sprite_frames(const Ref<SpriteFrames> &p_frames);
Ref<SpriteFrames> get_sprite_frames() const;
@@ -222,7 +222,7 @@ public:
void set_shininess(float p_shininess);
float get_shininess() const;
- virtual String get_configuration_warning() const;
+ virtual String get_configuration_warning() const override;
AnimatedSprite2D();
};
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h
index 0d0293dd12..32226ef5a4 100644
--- a/scene/2d/area_2d.h
+++ b/scene/2d/area_2d.h
@@ -130,7 +130,7 @@ private:
protected:
void _notification(int p_what);
static void _bind_methods();
- void _validate_property(PropertyInfo &property) const;
+ void _validate_property(PropertyInfo &property) const override;
public:
void set_space_override_mode(SpaceOverride p_mode);
diff --git a/scene/2d/audio_stream_player_2d.h b/scene/2d/audio_stream_player_2d.h
index 7f0b6f5897..4e236a367e 100644
--- a/scene/2d/audio_stream_player_2d.h
+++ b/scene/2d/audio_stream_player_2d.h
@@ -89,7 +89,7 @@ private:
float attenuation;
protected:
- void _validate_property(PropertyInfo &property) const;
+ void _validate_property(PropertyInfo &property) const override;
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/2d/back_buffer_copy.h b/scene/2d/back_buffer_copy.h
index 4b26bf1bdc..b58034de19 100644
--- a/scene/2d/back_buffer_copy.h
+++ b/scene/2d/back_buffer_copy.h
@@ -54,13 +54,13 @@ protected:
public:
#ifdef TOOLS_ENABLED
- Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
+ Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
#endif
void set_rect(const Rect2 &p_rect);
Rect2 get_rect() const;
- Rect2 get_anchorable_rect() const;
+ Rect2 get_anchorable_rect() const override;
void set_copy_mode(CopyMode p_mode);
CopyMode get_copy_mode() const;
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 68e99445d8..fd4d5981ff 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -56,7 +56,7 @@ void Camera2D::_update_scroll() {
viewport->set_canvas_transform(xform);
- Size2 screen_size = viewport->get_visible_rect().size;
+ Size2 screen_size = _get_camera_screen_size();
Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5) : Point2());
get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, group_name, "_camera_moved", xform, screen_offset);
@@ -94,7 +94,7 @@ Transform2D Camera2D::get_camera_transform() {
ERR_FAIL_COND_V(custom_viewport && !ObjectDB::get_instance(custom_viewport_id), Transform2D());
- Size2 screen_size = viewport->get_visible_rect().size;
+ Size2 screen_size = _get_camera_screen_size();
Point2 new_camera_pos = get_global_transform().get_origin();
Point2 ret_camera_pos;
@@ -274,7 +274,7 @@ void Camera2D::_notification(int p_what) {
}
Transform2D inv_camera_transform = get_camera_transform().affine_inverse();
- Size2 screen_size = get_viewport_rect().size;
+ Size2 screen_size = _get_camera_screen_size();
Vector2 screen_endpoints[4] = {
inv_camera_transform.xform(Vector2(0, 0)),
@@ -321,7 +321,7 @@ void Camera2D::_notification(int p_what) {
}
Transform2D inv_camera_transform = get_camera_transform().affine_inverse();
- Size2 screen_size = get_viewport_rect().size;
+ Size2 screen_size = _get_camera_screen_size();
Vector2 margin_endpoints[4] = {
inv_camera_transform.xform(Vector2((screen_size.width / 2) - ((screen_size.width / 2) * drag_margin[MARGIN_LEFT]), (screen_size.height / 2) - ((screen_size.height / 2) * drag_margin[MARGIN_TOP]))),
@@ -469,7 +469,7 @@ void Camera2D::reset_smoothing() {
void Camera2D::align() {
ERR_FAIL_COND(custom_viewport && !ObjectDB::get_instance(custom_viewport_id));
- Size2 screen_size = viewport->get_visible_rect().size;
+ Size2 screen_size = _get_camera_screen_size();
Point2 current_camera_pos = get_global_transform().get_origin();
if (anchor_mode == ANCHOR_MODE_DRAG_CENTER) {
@@ -507,6 +507,14 @@ Point2 Camera2D::get_camera_screen_center() const {
return camera_screen_center;
}
+Size2 Camera2D::_get_camera_screen_size() const {
+ // special case if the camera2D is in the root viewport
+ if (Engine::get_singleton()->is_editor_hint() && get_viewport()->get_parent_viewport() == get_tree()->get_root()) {
+ return Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height"));
+ }
+ return get_viewport_rect().size;
+}
+
void Camera2D::set_h_drag_enabled(bool p_enabled) {
h_drag_enabled = p_enabled;
}
diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h
index 0a4e269c40..867a5562b2 100644
--- a/scene/2d/camera_2d.h
+++ b/scene/2d/camera_2d.h
@@ -94,6 +94,8 @@ protected:
Camera2DProcessMode process_mode;
+ Size2 _get_camera_screen_size() const;
+
protected:
virtual Transform2D get_camera_transform();
void _notification(int p_what);
diff --git a/scene/2d/canvas_modulate.h b/scene/2d/canvas_modulate.h
index a0b61f43ba..eac3cf9e54 100644
--- a/scene/2d/canvas_modulate.h
+++ b/scene/2d/canvas_modulate.h
@@ -46,7 +46,7 @@ public:
void set_color(const Color &p_color);
Color get_color() const;
- String get_configuration_warning() const;
+ String get_configuration_warning() const override;
CanvasModulate();
~CanvasModulate();
diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h
index d7af2f3a2a..8eff1b3aec 100644
--- a/scene/2d/collision_object_2d.h
+++ b/scene/2d/collision_object_2d.h
@@ -113,7 +113,7 @@ public:
void set_pickable(bool p_enabled);
bool is_pickable() const;
- String get_configuration_warning() const;
+ String get_configuration_warning() const override;
_FORCE_INLINE_ RID get_rid() const { return rid; }
diff --git a/scene/2d/collision_polygon_2d.h b/scene/2d/collision_polygon_2d.h
index bf3e560a93..0f6b654149 100644
--- a/scene/2d/collision_polygon_2d.h
+++ b/scene/2d/collision_polygon_2d.h
@@ -67,9 +67,9 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
- virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
+ virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
#endif
void set_build_mode(BuildMode p_mode);
@@ -78,7 +78,7 @@ public:
void set_polygon(const Vector<Point2> &p_polygon);
Vector<Point2> get_polygon() const;
- virtual String get_configuration_warning() const;
+ virtual String get_configuration_warning() const override;
void set_disabled(bool p_disabled);
bool is_disabled() const;
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index 88d124536c..d022c857f3 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -176,11 +176,14 @@ String CollisionShape2D::get_configuration_warning() const {
if (!Object::cast_to<CollisionObject2D>(get_parent())) {
return TTR("CollisionShape2D only serves to provide a collision shape to a CollisionObject2D derived node. Please only use it as a child of Area2D, StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape.");
}
-
if (!shape.is_valid()) {
return TTR("A shape must be provided for CollisionShape2D to function. Please create a shape resource for it!");
}
-
+ Ref<ConvexPolygonShape2D> convex = shape;
+ Ref<ConcavePolygonShape2D> concave = shape;
+ if (convex.is_valid() || concave.is_valid()) {
+ return TTR("Polygon-based shapes are not meant be used nor edited directly through the CollisionShape2D node. Please use the CollisionPolygon2D node instead.");
+ }
return String();
}
diff --git a/scene/2d/collision_shape_2d.h b/scene/2d/collision_shape_2d.h
index ec7808ee7c..ced90d46f0 100644
--- a/scene/2d/collision_shape_2d.h
+++ b/scene/2d/collision_shape_2d.h
@@ -54,7 +54,11 @@ protected:
static void _bind_methods();
public:
+#ifdef TOOLS_ENABLED
+ virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
+#else
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
+#endif // TOOLS_ENABLED
void set_shape(const Ref<Shape2D> &p_shape);
Ref<Shape2D> get_shape() const;
@@ -68,7 +72,7 @@ public:
void set_one_way_collision_margin(float p_margin);
float get_one_way_collision_margin() const;
- virtual String get_configuration_warning() const;
+ virtual String get_configuration_warning() const override;
CollisionShape2D();
};
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 526951976e..e3a632c98a 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -749,7 +749,11 @@ void CPUParticles2D::_particles_process(float p_delta) {
p.transform[2] = emission_points.get(random_idx);
if (emission_shape == EMISSION_SHAPE_DIRECTED_POINTS && emission_normals.size() == pc) {
- p.velocity = emission_normals.get(random_idx);
+ Vector2 normal = emission_normals.get(random_idx);
+ Transform2D m2;
+ m2.set_axis(0, normal);
+ m2.set_axis(1, normal.tangent());
+ p.velocity = m2.basis_xform(p.velocity);
}
if (emission_colors.size() == pc) {
diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h
index 747f06b90d..dfc875ceb0 100644
--- a/scene/2d/cpu_particles_2d.h
+++ b/scene/2d/cpu_particles_2d.h
@@ -190,7 +190,7 @@ private:
protected:
static void _bind_methods();
void _notification(int p_what);
- virtual void _validate_property(PropertyInfo &property) const;
+ virtual void _validate_property(PropertyInfo &property) const override;
public:
void set_emitting(bool p_emitting);
@@ -280,7 +280,7 @@ public:
void set_gravity(const Vector2 &p_gravity);
Vector2 get_gravity() const;
- virtual String get_configuration_warning() const;
+ virtual String get_configuration_warning() const override;
void restart();
diff --git a/scene/2d/gpu_particles_2d.h b/scene/2d/gpu_particles_2d.h
index 47951d76dc..3258237f92 100644
--- a/scene/2d/gpu_particles_2d.h
+++ b/scene/2d/gpu_particles_2d.h
@@ -71,7 +71,7 @@ private:
protected:
static void _bind_methods();
- virtual void _validate_property(PropertyInfo &property) const;
+ virtual void _validate_property(PropertyInfo &property) const override;
void _notification(int p_what);
public:
@@ -114,7 +114,7 @@ public:
void set_normal_map(const Ref<Texture2D> &p_normal_map);
Ref<Texture2D> get_normal_map() const;
- virtual String get_configuration_warning() const;
+ virtual String get_configuration_warning() const override;
void restart();
Rect2 capture_rect() const;
diff --git a/scene/2d/joints_2d.h b/scene/2d/joints_2d.h
index 9a3bea4407..60534cae65 100644
--- a/scene/2d/joints_2d.h
+++ b/scene/2d/joints_2d.h
@@ -79,7 +79,7 @@ class PinJoint2D : public Joint2D {
protected:
void _notification(int p_what);
- virtual RID _configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b);
+ virtual RID _configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b) override;
static void _bind_methods();
public:
@@ -97,7 +97,7 @@ class GrooveJoint2D : public Joint2D {
protected:
void _notification(int p_what);
- virtual RID _configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b);
+ virtual RID _configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b) override;
static void _bind_methods();
public:
@@ -120,7 +120,7 @@ class DampedSpringJoint2D : public Joint2D {
protected:
void _notification(int p_what);
- virtual RID _configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b);
+ virtual RID _configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b) override;
static void _bind_methods();
public:
diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h
index 0d5e8d674a..45444800fe 100644
--- a/scene/2d/light_2d.h
+++ b/scene/2d/light_2d.h
@@ -82,17 +82,17 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Dictionary _edit_get_state() const;
- virtual void _edit_set_state(const Dictionary &p_state);
-
- virtual void _edit_set_pivot(const Point2 &p_pivot);
- virtual Point2 _edit_get_pivot() const;
- virtual bool _edit_use_pivot() const;
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
+ virtual Dictionary _edit_get_state() const override;
+ virtual void _edit_set_state(const Dictionary &p_state) override;
+
+ virtual void _edit_set_pivot(const Point2 &p_pivot) override;
+ virtual Point2 _edit_get_pivot() const override;
+ virtual bool _edit_use_pivot() const override;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
#endif
- virtual Rect2 get_anchorable_rect() const;
+ virtual Rect2 get_anchorable_rect() const override;
void set_enabled(bool p_enabled);
bool is_enabled() const;
@@ -154,7 +154,7 @@ public:
void set_shadow_smooth(float p_amount);
float get_shadow_smooth() const;
- String get_configuration_warning() const;
+ String get_configuration_warning() const override;
Light2D();
~Light2D();
diff --git a/scene/2d/light_occluder_2d.h b/scene/2d/light_occluder_2d.h
index eba67edfe4..694097f985 100644
--- a/scene/2d/light_occluder_2d.h
+++ b/scene/2d/light_occluder_2d.h
@@ -70,7 +70,7 @@ public:
void set_cull_mode(CullMode p_mode);
CullMode get_cull_mode() const;
- virtual RID get_rid() const;
+ virtual RID get_rid() const override;
OccluderPolygon2D();
~OccluderPolygon2D();
};
@@ -93,8 +93,8 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
#endif
void set_occluder_polygon(const Ref<OccluderPolygon2D> &p_polygon);
@@ -103,7 +103,7 @@ public:
void set_occluder_light_mask(int p_mask);
int get_occluder_light_mask() const;
- String get_configuration_warning() const;
+ String get_configuration_warning() const override;
LightOccluder2D();
~LightOccluder2D();
diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h
index bccbcbdcb9..43739ee638 100644
--- a/scene/2d/line_2d.h
+++ b/scene/2d/line_2d.h
@@ -56,9 +56,9 @@ public:
};
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
- virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
+ virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
#endif
Line2D();
diff --git a/scene/2d/mesh_instance_2d.h b/scene/2d/mesh_instance_2d.h
index 3356f44e91..f10ab17a7c 100644
--- a/scene/2d/mesh_instance_2d.h
+++ b/scene/2d/mesh_instance_2d.h
@@ -47,7 +47,7 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
+ virtual Rect2 _edit_get_rect() const override;
#endif
void set_mesh(const Ref<Mesh> &p_mesh);
diff --git a/scene/2d/multimesh_instance_2d.h b/scene/2d/multimesh_instance_2d.h
index a843606ebf..aadedac42a 100644
--- a/scene/2d/multimesh_instance_2d.h
+++ b/scene/2d/multimesh_instance_2d.h
@@ -48,7 +48,7 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
+ virtual Rect2 _edit_get_rect() const override;
#endif
void set_multimesh(const Ref<MultiMesh> &p_multimesh);
diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h
index 796a85f3f2..9474392ddf 100644
--- a/scene/2d/navigation_agent_2d.h
+++ b/scene/2d/navigation_agent_2d.h
@@ -141,7 +141,7 @@ public:
void set_velocity(Vector2 p_velocity);
void _avoidance_done(Vector3 p_new_velocity);
- virtual String get_configuration_warning() const;
+ virtual String get_configuration_warning() const override;
private:
void update_navigation();
diff --git a/scene/2d/navigation_obstacle_2d.h b/scene/2d/navigation_obstacle_2d.h
index bdef6f2843..d65f44bc0e 100644
--- a/scene/2d/navigation_obstacle_2d.h
+++ b/scene/2d/navigation_obstacle_2d.h
@@ -62,7 +62,7 @@ public:
return agent;
}
- virtual String get_configuration_warning() const;
+ virtual String get_configuration_warning() const override;
private:
void update_agent_shape();
diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h
index 07cf4d6668..ba92d27a95 100644
--- a/scene/2d/navigation_region_2d.h
+++ b/scene/2d/navigation_region_2d.h
@@ -109,8 +109,8 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
#endif
void set_enabled(bool p_enabled);
@@ -119,7 +119,7 @@ public:
void set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly);
Ref<NavigationPolygon> get_navigation_polygon() const;
- String get_configuration_warning() const;
+ String get_configuration_warning() const override;
NavigationRegion2D();
~NavigationRegion2D();
diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h
index 827c192585..e20f746447 100644
--- a/scene/2d/node_2d.h
+++ b/scene/2d/node_2d.h
@@ -56,20 +56,20 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Dictionary _edit_get_state() const;
- virtual void _edit_set_state(const Dictionary &p_state);
+ virtual Dictionary _edit_get_state() const override;
+ virtual void _edit_set_state(const Dictionary &p_state) override;
- virtual void _edit_set_position(const Point2 &p_position);
- virtual Point2 _edit_get_position() const;
+ virtual void _edit_set_position(const Point2 &p_position) override;
+ virtual Point2 _edit_get_position() const override;
- virtual void _edit_set_scale(const Size2 &p_scale);
- virtual Size2 _edit_get_scale() const;
+ virtual void _edit_set_scale(const Size2 &p_scale) override;
+ virtual Size2 _edit_get_scale() const override;
- virtual void _edit_set_rotation(float p_rotation);
- virtual float _edit_get_rotation() const;
- virtual bool _edit_use_rotation() const;
+ virtual void _edit_set_rotation(float p_rotation) override;
+ virtual float _edit_get_rotation() const override;
+ virtual bool _edit_use_rotation() const override;
- virtual void _edit_set_rect(const Rect2 &p_edit_rect);
+ virtual void _edit_set_rect(const Rect2 &p_edit_rect) override;
#endif
void set_position(const Point2 &p_pos);
@@ -119,7 +119,7 @@ public:
Transform2D get_relative_transform_to_parent(const Node *p_parent) const;
- Transform2D get_transform() const;
+ Transform2D get_transform() const override;
Node2D();
};
diff --git a/scene/2d/parallax_layer.h b/scene/2d/parallax_layer.h
index 1f001943b5..788df19a75 100644
--- a/scene/2d/parallax_layer.h
+++ b/scene/2d/parallax_layer.h
@@ -61,7 +61,7 @@ public:
void set_base_offset_and_scale(const Point2 &p_offset, float p_scale, const Point2 &p_screen_offset);
- virtual String get_configuration_warning() const;
+ virtual String get_configuration_warning() const override;
ParallaxLayer();
};
diff --git a/scene/2d/path_2d.h b/scene/2d/path_2d.h
index 38fcca0323..7fea75cd7c 100644
--- a/scene/2d/path_2d.h
+++ b/scene/2d/path_2d.h
@@ -47,9 +47,9 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
- virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
+ virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
#endif
void set_curve(const Ref<Curve2D> &p_curve);
@@ -75,7 +75,7 @@ private:
void _update_transform();
protected:
- virtual void _validate_property(PropertyInfo &property) const;
+ virtual void _validate_property(PropertyInfo &property) const override;
void _notification(int p_what);
static void _bind_methods();
@@ -105,7 +105,7 @@ public:
void set_cubic_interpolation(bool p_enable);
bool get_cubic_interpolation() const;
- String get_configuration_warning() const;
+ String get_configuration_warning() const override;
PathFollow2D();
};
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 84560b843b..0a9de20664 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -631,8 +631,8 @@ void RigidBody2D::apply_central_impulse(const Vector2 &p_impulse) {
PhysicsServer2D::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse);
}
-void RigidBody2D::apply_impulse(const Vector2 &p_offset, const Vector2 &p_impulse) {
- PhysicsServer2D::get_singleton()->body_apply_impulse(get_rid(), p_offset, p_impulse);
+void RigidBody2D::apply_impulse(const Vector2 &p_impulse, const Vector2 &p_position) {
+ PhysicsServer2D::get_singleton()->body_apply_impulse(get_rid(), p_impulse, p_position);
}
void RigidBody2D::apply_torque_impulse(float p_torque) {
@@ -659,8 +659,8 @@ void RigidBody2D::add_central_force(const Vector2 &p_force) {
PhysicsServer2D::get_singleton()->body_add_central_force(get_rid(), p_force);
}
-void RigidBody2D::add_force(const Vector2 &p_offset, const Vector2 &p_force) {
- PhysicsServer2D::get_singleton()->body_add_force(get_rid(), p_offset, p_force);
+void RigidBody2D::add_force(const Vector2 &p_force, const Vector2 &p_position) {
+ PhysicsServer2D::get_singleton()->body_add_force(get_rid(), p_force, p_position);
}
void RigidBody2D::add_torque(const float p_torque) {
@@ -801,8 +801,8 @@ void RigidBody2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_continuous_collision_detection_mode"), &RigidBody2D::get_continuous_collision_detection_mode);
ClassDB::bind_method(D_METHOD("set_axis_velocity", "axis_velocity"), &RigidBody2D::set_axis_velocity);
- ClassDB::bind_method(D_METHOD("apply_central_impulse", "impulse"), &RigidBody2D::apply_central_impulse);
- ClassDB::bind_method(D_METHOD("apply_impulse", "offset", "impulse"), &RigidBody2D::apply_impulse);
+ ClassDB::bind_method(D_METHOD("apply_central_impulse", "impulse"), &RigidBody2D::apply_central_impulse, Vector2());
+ ClassDB::bind_method(D_METHOD("apply_impulse", "impulse", "position"), &RigidBody2D::apply_impulse, Vector2());
ClassDB::bind_method(D_METHOD("apply_torque_impulse", "torque"), &RigidBody2D::apply_torque_impulse);
ClassDB::bind_method(D_METHOD("set_applied_force", "force"), &RigidBody2D::set_applied_force);
@@ -812,7 +812,7 @@ void RigidBody2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_applied_torque"), &RigidBody2D::get_applied_torque);
ClassDB::bind_method(D_METHOD("add_central_force", "force"), &RigidBody2D::add_central_force);
- ClassDB::bind_method(D_METHOD("add_force", "offset", "force"), &RigidBody2D::add_force);
+ ClassDB::bind_method(D_METHOD("add_force", "force", "position"), &RigidBody2D::add_force, Vector2());
ClassDB::bind_method(D_METHOD("add_torque", "torque"), &RigidBody2D::add_torque);
ClassDB::bind_method(D_METHOD("set_sleeping", "sleeping"), &RigidBody2D::set_sleeping);
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index cde4398ad3..e83ab6557d 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -237,7 +237,7 @@ public:
CCDMode get_continuous_collision_detection_mode() const;
void apply_central_impulse(const Vector2 &p_impulse);
- void apply_impulse(const Vector2 &p_offset, const Vector2 &p_impulse);
+ void apply_impulse(const Vector2 &p_impulse, const Vector2 &p_position = Vector2());
void apply_torque_impulse(float p_torque);
void set_applied_force(const Vector2 &p_force);
@@ -247,12 +247,12 @@ public:
float get_applied_torque() const;
void add_central_force(const Vector2 &p_force);
- void add_force(const Vector2 &p_offset, const Vector2 &p_force);
+ void add_force(const Vector2 &p_force, const Vector2 &p_position = Vector2());
void add_torque(float p_torque);
TypedArray<Node2D> get_colliding_bodies() const; //function for script
- virtual String get_configuration_warning() const;
+ virtual String get_configuration_warning() const override;
RigidBody2D();
~RigidBody2D();
diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h
index dafec1c343..c5ff05aace 100644
--- a/scene/2d/polygon_2d.h
+++ b/scene/2d/polygon_2d.h
@@ -82,16 +82,16 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Dictionary _edit_get_state() const;
- virtual void _edit_set_state(const Dictionary &p_state);
+ virtual Dictionary _edit_get_state() const override;
+ virtual void _edit_set_state(const Dictionary &p_state) override;
- virtual void _edit_set_pivot(const Point2 &p_pivot);
- virtual Point2 _edit_get_pivot() const;
- virtual bool _edit_use_pivot() const;
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
+ virtual void _edit_set_pivot(const Point2 &p_pivot) override;
+ virtual Point2 _edit_get_pivot() const override;
+ virtual bool _edit_use_pivot() const override;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
- virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
+ virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
#endif
void set_polygon(const Vector<Vector2> &p_polygon);
diff --git a/scene/2d/position_2d.h b/scene/2d/position_2d.h
index b53fa4c0e2..01b380bca8 100644
--- a/scene/2d/position_2d.h
+++ b/scene/2d/position_2d.h
@@ -44,8 +44,8 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
#endif
void set_gizmo_extents(float p_extents);
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index 5020940c5c..9fd24b5294 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -325,8 +325,7 @@ void RayCast2D::_bind_methods() {
}
RayCast2D::RayCast2D() {
- enabled = false;
-
+ enabled = true;
collided = false;
against_shape = 0;
collision_mask = 1;
diff --git a/scene/2d/remote_transform_2d.h b/scene/2d/remote_transform_2d.h
index caaa0394f2..8b6f8d9678 100644
--- a/scene/2d/remote_transform_2d.h
+++ b/scene/2d/remote_transform_2d.h
@@ -70,7 +70,7 @@ public:
void force_update_cache();
- virtual String get_configuration_warning() const;
+ virtual String get_configuration_warning() const override;
RemoteTransform2D();
};
diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h
index c6bee8d92b..7e9ffd98e6 100644
--- a/scene/2d/skeleton_2d.h
+++ b/scene/2d/skeleton_2d.h
@@ -60,7 +60,7 @@ public:
void apply_rest();
Transform2D get_skeleton_rest() const;
- String get_configuration_warning() const;
+ String get_configuration_warning() const override;
void set_default_length(float p_length);
float get_default_length() const;
diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp
index 7e07019578..d1be93e55d 100644
--- a/scene/2d/sprite_2d.cpp
+++ b/scene/2d/sprite_2d.cpp
@@ -498,8 +498,8 @@ void Sprite2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_h"), "set_flip_h", "is_flipped_h");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_v"), "set_flip_v", "is_flipped_v");
ADD_GROUP("Animation", "");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "vframes", PROPERTY_HINT_RANGE, "1,16384,1"), "set_vframes", "get_vframes");
ADD_PROPERTY(PropertyInfo(Variant::INT, "hframes", PROPERTY_HINT_RANGE, "1,16384,1"), "set_hframes", "get_hframes");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "vframes", PROPERTY_HINT_RANGE, "1,16384,1"), "set_vframes", "get_vframes");
ADD_PROPERTY(PropertyInfo(Variant::INT, "frame"), "set_frame", "get_frame");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "frame_coords", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_frame_coords", "get_frame_coords");
diff --git a/scene/2d/sprite_2d.h b/scene/2d/sprite_2d.h
index c72e956307..f6b752575f 100644
--- a/scene/2d/sprite_2d.h
+++ b/scene/2d/sprite_2d.h
@@ -66,20 +66,20 @@ protected:
static void _bind_methods();
- virtual void _validate_property(PropertyInfo &property) const;
+ virtual void _validate_property(PropertyInfo &property) const override;
public:
#ifdef TOOLS_ENABLED
- virtual Dictionary _edit_get_state() const;
- virtual void _edit_set_state(const Dictionary &p_state);
+ virtual Dictionary _edit_get_state() const override;
+ virtual void _edit_set_state(const Dictionary &p_state) override;
- virtual void _edit_set_pivot(const Point2 &p_pivot);
- virtual Point2 _edit_get_pivot() const;
- virtual bool _edit_use_pivot() const;
- virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
+ virtual void _edit_set_pivot(const Point2 &p_pivot) override;
+ virtual Point2 _edit_get_pivot() const override;
+ virtual bool _edit_use_pivot() const override;
+ virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
#endif
bool is_pixel_opaque(const Point2 &p_point) const;
@@ -133,7 +133,7 @@ public:
int get_hframes() const;
Rect2 get_rect() const;
- virtual Rect2 get_anchorable_rect() const;
+ virtual Rect2 get_anchorable_rect() const override;
Sprite2D();
~Sprite2D();
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index 24d4dc09db..7a2a3e412c 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -232,8 +232,8 @@ protected:
void _notification(int p_what);
static void _bind_methods();
- virtual void _validate_property(PropertyInfo &property) const;
- virtual void _changed_callback(Object *p_changed, const char *p_prop);
+ virtual void _validate_property(PropertyInfo &property) const override;
+ virtual void _changed_callback(Object *p_changed, const char *p_prop) override;
public:
enum {
@@ -241,7 +241,7 @@ public:
};
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
+ virtual Rect2 _edit_get_rect() const override;
#endif
void set_tileset(const Ref<TileSet> &p_tileset);
@@ -331,16 +331,16 @@ public:
void set_occluder_light_mask(int p_mask);
int get_occluder_light_mask() const;
- virtual void set_light_mask(int p_light_mask);
+ virtual void set_light_mask(int p_light_mask) override;
- virtual void set_material(const Ref<Material> &p_material);
+ virtual void set_material(const Ref<Material> &p_material) override;
- virtual void set_use_parent_material(bool p_use_parent_material);
+ virtual void set_use_parent_material(bool p_use_parent_material) override;
void set_clip_uv(bool p_enable);
bool get_clip_uv() const;
- String get_configuration_warning() const;
+ String get_configuration_warning() const override;
void fix_invalid_tiles();
void clear();
diff --git a/scene/2d/touch_screen_button.h b/scene/2d/touch_screen_button.h
index d9c7ef7034..287f886c2c 100644
--- a/scene/2d/touch_screen_button.h
+++ b/scene/2d/touch_screen_button.h
@@ -74,8 +74,8 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
#endif
void set_texture(const Ref<Texture2D> &p_texture);
@@ -107,7 +107,7 @@ public:
bool is_pressed() const;
- virtual Rect2 get_anchorable_rect() const;
+ virtual Rect2 get_anchorable_rect() const override;
TouchScreenButton();
};
diff --git a/scene/2d/visibility_notifier_2d.h b/scene/2d/visibility_notifier_2d.h
index fb6e48f5e8..671378bd4e 100644
--- a/scene/2d/visibility_notifier_2d.h
+++ b/scene/2d/visibility_notifier_2d.h
@@ -55,8 +55,8 @@ protected:
public:
#ifdef TOOLS_ENABLED
- virtual Rect2 _edit_get_rect() const;
- virtual bool _edit_use_rect() const;
+ virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
#endif
void set_rect(const Rect2 &p_rect);
@@ -82,8 +82,8 @@ public:
};
protected:
- virtual void _screen_enter();
- virtual void _screen_exit();
+ virtual void _screen_enter() override;
+ virtual void _screen_exit() override;
bool visible;
@@ -102,7 +102,7 @@ public:
void set_enabler(Enabler p_enabler, bool p_enable);
bool is_enabler_enabled(Enabler p_enabler) const;
- String get_configuration_warning() const;
+ String get_configuration_warning() const override;
VisibilityEnabler2D();
};