summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-12 17:01:17 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 10:01:56 +0200
commit1f6f364a56319eabd02c050746fe7df3f55ffee3 (patch)
tree8bebdce946466ce8e9476ccd46c9dba62c323938 /scene
parente7c9d818766a119089873e4941e4865fb36883ec (diff)
Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/navigation_agent_2d.cpp10
-rw-r--r--scene/2d/navigation_agent_2d.h14
-rw-r--r--scene/2d/navigation_obstacle_2d.cpp4
-rw-r--r--scene/2d/navigation_obstacle_2d.h2
-rw-r--r--scene/2d/navigation_region_2d.cpp11
-rw-r--r--scene/2d/navigation_region_2d.h10
-rw-r--r--scene/3d/navigation_agent_3d.cpp11
-rw-r--r--scene/3d/navigation_agent_3d.h16
-rw-r--r--scene/3d/navigation_obstacle_3d.cpp4
-rw-r--r--scene/3d/navigation_obstacle_3d.h2
-rw-r--r--scene/3d/navigation_region_3d.cpp6
-rw-r--r--scene/3d/navigation_region_3d.h8
-rw-r--r--scene/3d/physics_body_3d.cpp19
-rw-r--r--scene/3d/physics_body_3d.h169
-rw-r--r--scene/3d/physics_joint_3d.cpp3
-rw-r--r--scene/3d/physics_joint_3d.h2
-rw-r--r--scene/3d/skeleton_ik_3d.cpp10
-rw-r--r--scene/3d/skeleton_ik_3d.h52
-rw-r--r--scene/3d/soft_body_3d.cpp12
-rw-r--r--scene/3d/soft_body_3d.h16
-rw-r--r--scene/3d/spring_arm_3d.cpp8
-rw-r--r--scene/3d/spring_arm_3d.h12
-rw-r--r--scene/3d/vehicle_body_3d.cpp2
-rw-r--r--scene/animation/animation_player.h65
-rw-r--r--scene/debugger/scene_debugger.h2
-rw-r--r--scene/gui/label.cpp17
-rw-r--r--scene/gui/label.h43
-rw-r--r--scene/main/canvas_item.h8
-rw-r--r--scene/main/viewport.cpp4
-rw-r--r--scene/resources/environment.cpp6
-rw-r--r--scene/resources/environment.h8
-rw-r--r--scene/resources/physics_material.cpp6
-rw-r--r--scene/resources/physics_material.h16
-rw-r--r--scene/resources/shape_3d.cpp12
-rw-r--r--scene/resources/shape_3d.h2
-rw-r--r--scene/resources/tile_set.h38
36 files changed, 217 insertions, 413 deletions
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index df23a40721..dfeb5eea45 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -133,15 +133,7 @@ void NavigationAgent2D::_notification(int p_what) {
}
}
-NavigationAgent2D::NavigationAgent2D() :
- agent_parent(nullptr),
- navigation(nullptr),
- agent(RID()),
- target_desired_distance(1.0),
- path_max_distance(3.0),
- velocity_submitted(false),
- target_reached(false),
- navigation_finished(true) {
+NavigationAgent2D::NavigationAgent2D() {
agent = NavigationServer2D::get_singleton()->agent_create();
set_neighbor_dist(500.0);
set_max_neighbors(10);
diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h
index 26eccfc949..796a85f3f2 100644
--- a/scene/2d/navigation_agent_2d.h
+++ b/scene/2d/navigation_agent_2d.h
@@ -40,29 +40,29 @@ class Navigation2D;
class NavigationAgent2D : public Node {
GDCLASS(NavigationAgent2D, Node);
- Node2D *agent_parent;
- Navigation2D *navigation;
+ Node2D *agent_parent = nullptr;
+ Navigation2D *navigation = nullptr;
RID agent;
- real_t target_desired_distance;
+ real_t target_desired_distance = 1.0;
real_t radius;
real_t neighbor_dist;
int max_neighbors;
real_t time_horizon;
real_t max_speed;
- real_t path_max_distance;
+ real_t path_max_distance = 3.0;
Vector2 target_location;
Vector<Vector2> navigation_path;
int nav_path_index;
- bool velocity_submitted;
+ bool velocity_submitted = false;
Vector2 prev_safe_velocity;
/// The submitted target velocity
Vector2 target_velocity;
- bool target_reached;
- bool navigation_finished;
+ bool target_reached = false;
+ bool navigation_finished = true;
// No initialized on purpose
uint32_t update_frame_id;
diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp
index 50d02ca507..3eb3ef332f 100644
--- a/scene/2d/navigation_obstacle_2d.cpp
+++ b/scene/2d/navigation_obstacle_2d.cpp
@@ -78,9 +78,7 @@ void NavigationObstacle2D::_notification(int p_what) {
}
}
-NavigationObstacle2D::NavigationObstacle2D() :
- navigation(nullptr),
- agent(RID()) {
+NavigationObstacle2D::NavigationObstacle2D() {
agent = NavigationServer2D::get_singleton()->agent_create();
}
diff --git a/scene/2d/navigation_obstacle_2d.h b/scene/2d/navigation_obstacle_2d.h
index 3935fe1bc5..bdef6f2843 100644
--- a/scene/2d/navigation_obstacle_2d.h
+++ b/scene/2d/navigation_obstacle_2d.h
@@ -38,7 +38,7 @@ class Navigation2D;
class NavigationObstacle2D : public Node {
GDCLASS(NavigationObstacle2D, Node);
- Navigation2D *navigation;
+ Navigation2D *navigation = nullptr;
RID agent;
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index abbfbf83b7..f3f335e66a 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -367,13 +367,6 @@ void NavigationPolygon::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "outlines", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_outlines", "_get_outlines");
}
-NavigationPolygon::NavigationPolygon() :
- rect_cache_dirty(true) {
-}
-
-NavigationPolygon::~NavigationPolygon() {
-}
-
void NavigationRegion2D::set_enabled(bool p_enabled) {
if (enabled == p_enabled)
@@ -569,12 +562,8 @@ void NavigationRegion2D::_bind_methods() {
}
NavigationRegion2D::NavigationRegion2D() {
-
- enabled = true;
set_notify_transform(true);
region = NavigationServer2D::get_singleton()->region_create();
-
- navigation = nullptr;
}
NavigationRegion2D::~NavigationRegion2D() {
diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h
index e730df6373..54d2ac11f8 100644
--- a/scene/2d/navigation_region_2d.h
+++ b/scene/2d/navigation_region_2d.h
@@ -46,7 +46,7 @@ class NavigationPolygon : public Resource {
Vector<Vector<Vector2>> outlines;
mutable Rect2 item_rect;
- mutable bool rect_cache_dirty;
+ mutable bool rect_cache_dirty = true;
Mutex navmesh_generation;
// Navigation mesh
@@ -88,8 +88,8 @@ public:
Ref<NavigationMesh> get_mesh();
- NavigationPolygon();
- ~NavigationPolygon();
+ NavigationPolygon() {}
+ ~NavigationPolygon() {}
};
class Navigation2D;
@@ -98,9 +98,9 @@ class NavigationRegion2D : public Node2D {
GDCLASS(NavigationRegion2D, Node2D);
- bool enabled;
+ bool enabled = true;
RID region;
- Navigation2D *navigation;
+ Navigation2D *navigation = nullptr;
Ref<NavigationPolygon> navpoly;
void _navpoly_changed();
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index e672ed9a54..020d598f00 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -141,16 +141,7 @@ void NavigationAgent3D::_notification(int p_what) {
}
}
-NavigationAgent3D::NavigationAgent3D() :
- agent_parent(nullptr),
- navigation(nullptr),
- agent(RID()),
- target_desired_distance(1.0),
- navigation_height_offset(0.0),
- path_max_distance(3.0),
- velocity_submitted(false),
- target_reached(false),
- navigation_finished(true) {
+NavigationAgent3D::NavigationAgent3D() {
agent = NavigationServer3D::get_singleton()->agent_create();
set_neighbor_dist(50.0);
set_max_neighbors(10);
diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h
index 3558b4e51b..6dc375ef24 100644
--- a/scene/3d/navigation_agent_3d.h
+++ b/scene/3d/navigation_agent_3d.h
@@ -40,31 +40,31 @@ class Navigation3D;
class NavigationAgent3D : public Node {
GDCLASS(NavigationAgent3D, Node);
- Node3D *agent_parent;
- Navigation3D *navigation;
+ Node3D *agent_parent = nullptr;
+ Navigation3D *navigation = nullptr;
RID agent;
- real_t target_desired_distance;
+ real_t target_desired_distance = 1.0;
real_t radius;
- real_t navigation_height_offset;
+ real_t navigation_height_offset = 0.0;
bool ignore_y;
real_t neighbor_dist;
int max_neighbors;
real_t time_horizon;
real_t max_speed;
- real_t path_max_distance;
+ real_t path_max_distance = 3.0;
Vector3 target_location;
Vector<Vector3> navigation_path;
int nav_path_index;
- bool velocity_submitted;
+ bool velocity_submitted = false;
Vector3 prev_safe_velocity;
/// The submitted target velocity
Vector3 target_velocity;
- bool target_reached;
- bool navigation_finished;
+ bool target_reached = false;
+ bool navigation_finished = true;
// No initialized on purpose
uint32_t update_frame_id;
diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp
index 2ee2008799..2f99a5f99e 100644
--- a/scene/3d/navigation_obstacle_3d.cpp
+++ b/scene/3d/navigation_obstacle_3d.cpp
@@ -86,9 +86,7 @@ void NavigationObstacle3D::_notification(int p_what) {
}
}
-NavigationObstacle3D::NavigationObstacle3D() :
- navigation(nullptr),
- agent(RID()) {
+NavigationObstacle3D::NavigationObstacle3D() {
agent = NavigationServer3D::get_singleton()->agent_create();
}
diff --git a/scene/3d/navigation_obstacle_3d.h b/scene/3d/navigation_obstacle_3d.h
index b58d7c4991..c7d2b556af 100644
--- a/scene/3d/navigation_obstacle_3d.h
+++ b/scene/3d/navigation_obstacle_3d.h
@@ -38,7 +38,7 @@ class Navigation3D;
class NavigationObstacle3D : public Node {
GDCLASS(NavigationObstacle3D, Node);
- Navigation3D *navigation;
+ Navigation3D *navigation = nullptr;
RID agent;
diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp
index 043b816033..b15fa6166f 100644
--- a/scene/3d/navigation_region_3d.cpp
+++ b/scene/3d/navigation_region_3d.cpp
@@ -242,14 +242,8 @@ void NavigationRegion3D::_changed_callback(Object *p_changed, const char *p_prop
}
NavigationRegion3D::NavigationRegion3D() {
-
- enabled = true;
set_notify_transform(true);
region = NavigationServer3D::get_singleton()->region_create();
-
- navigation = nullptr;
- debug_view = nullptr;
- bake_thread = nullptr;
}
NavigationRegion3D::~NavigationRegion3D() {
diff --git a/scene/3d/navigation_region_3d.h b/scene/3d/navigation_region_3d.h
index ae071e6b7a..a7b5077f53 100644
--- a/scene/3d/navigation_region_3d.h
+++ b/scene/3d/navigation_region_3d.h
@@ -41,13 +41,13 @@ class NavigationRegion3D : public Node3D {
GDCLASS(NavigationRegion3D, Node3D);
- bool enabled;
+ bool enabled = true;
RID region;
Ref<NavigationMesh> navmesh;
- Navigation3D *navigation;
- Node *debug_view;
- Thread *bake_thread;
+ Navigation3D *navigation = nullptr;
+ Node *debug_view = nullptr;
+ Thread *bake_thread = nullptr;
protected:
void _notification(int p_what);
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 280bab5d45..d672c6f6b5 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -2579,24 +2579,7 @@ bool PhysicalBone3D::get_axis_lock(PhysicsServer3D::BodyAxis p_axis) const {
}
PhysicalBone3D::PhysicalBone3D() :
- PhysicsBody3D(PhysicsServer3D::BODY_MODE_STATIC),
-#ifdef TOOLS_ENABLED
- gizmo_move_joint(false),
-#endif
- joint_data(nullptr),
- parent_skeleton(nullptr),
- simulate_physics(false),
- _internal_simulate_physics(false),
- bone_id(-1),
- bone_name(""),
- bounce(0),
- mass(1),
- friction(1),
- gravity_scale(1),
- linear_damp(-1),
- angular_damp(-1),
- can_sleep(true) {
-
+ PhysicsBody3D(PhysicsServer3D::BODY_MODE_STATIC) {
reset_physics_simulation_state();
}
diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h
index 0e719f5108..205052f798 100644
--- a/scene/3d/physics_body_3d.h
+++ b/scene/3d/physics_body_3d.h
@@ -396,14 +396,11 @@ public:
virtual bool _get(const StringName &p_name, Variant &r_ret) const;
virtual void _get_property_list(List<PropertyInfo> *p_list) const;
- real_t bias;
- real_t damping;
- real_t impulse_clamp;
-
- PinJointData() :
- bias(0.3),
- damping(1.),
- impulse_clamp(0) {}
+ real_t bias = 0.3;
+ real_t damping = 1.;
+ real_t impulse_clamp = 0;
+
+ PinJointData() {}
};
struct ConeJointData : public JointData {
@@ -414,17 +411,13 @@ public:
virtual void _get_property_list(List<PropertyInfo> *p_list) const;
real_t swing_span;
- real_t twist_span;
- real_t bias;
- real_t softness;
- real_t relaxation;
+ real_t twist_span = Math_PI;
+ real_t bias = 0.3;
+ real_t softness = 0.8;
+ real_t relaxation = 1.;
ConeJointData() :
- swing_span(Math_PI * 0.25),
- twist_span(Math_PI),
- bias(0.3),
- softness(0.8),
- relaxation(1.) {}
+ swing_span(Math_PI * 0.25) {}
};
struct HingeJointData : public JointData {
@@ -434,20 +427,17 @@ public:
virtual bool _get(const StringName &p_name, Variant &r_ret) const;
virtual void _get_property_list(List<PropertyInfo> *p_list) const;
- bool angular_limit_enabled;
+ bool angular_limit_enabled = false;
real_t angular_limit_upper;
real_t angular_limit_lower;
- real_t angular_limit_bias;
- real_t angular_limit_softness;
- real_t angular_limit_relaxation;
+ real_t angular_limit_bias = 0.3;
+ real_t angular_limit_softness = 0.9;
+ real_t angular_limit_relaxation = 1.;
HingeJointData() :
- angular_limit_enabled(false),
+
angular_limit_upper(Math_PI * 0.5),
- angular_limit_lower(-Math_PI * 0.5),
- angular_limit_bias(0.3),
- angular_limit_softness(0.9),
- angular_limit_relaxation(1.) {}
+ angular_limit_lower(-Math_PI * 0.5) {}
};
struct SliderJointData : public JointData {
@@ -457,76 +447,45 @@ public:
virtual bool _get(const StringName &p_name, Variant &r_ret) const;
virtual void _get_property_list(List<PropertyInfo> *p_list) const;
- real_t linear_limit_upper;
- real_t linear_limit_lower;
- real_t linear_limit_softness;
- real_t linear_limit_restitution;
- real_t linear_limit_damping;
- real_t angular_limit_upper;
- real_t angular_limit_lower;
- real_t angular_limit_softness;
- real_t angular_limit_restitution;
- real_t angular_limit_damping;
-
- SliderJointData() :
- linear_limit_upper(1.),
- linear_limit_lower(-1.),
- linear_limit_softness(1.),
- linear_limit_restitution(0.7),
- linear_limit_damping(1.),
- angular_limit_upper(0),
- angular_limit_lower(0),
- angular_limit_softness(1.),
- angular_limit_restitution(0.7),
- angular_limit_damping(1.) {}
+ real_t linear_limit_upper = 1.;
+ real_t linear_limit_lower = -1.;
+ real_t linear_limit_softness = 1.;
+ real_t linear_limit_restitution = 0.7;
+ real_t linear_limit_damping = 1.;
+ real_t angular_limit_upper = 0;
+ real_t angular_limit_lower = 0;
+ real_t angular_limit_softness = 1.;
+ real_t angular_limit_restitution = 0.7;
+ real_t angular_limit_damping = 1.;
+
+ SliderJointData() {}
};
struct SixDOFJointData : public JointData {
struct SixDOFAxisData {
- bool linear_limit_enabled;
- real_t linear_limit_upper;
- real_t linear_limit_lower;
- real_t linear_limit_softness;
- real_t linear_restitution;
- real_t linear_damping;
- bool linear_spring_enabled;
- real_t linear_spring_stiffness;
- real_t linear_spring_damping;
- real_t linear_equilibrium_point;
- bool angular_limit_enabled;
- real_t angular_limit_upper;
- real_t angular_limit_lower;
- real_t angular_limit_softness;
- real_t angular_restitution;
- real_t angular_damping;
- real_t erp;
- bool angular_spring_enabled;
- real_t angular_spring_stiffness;
- real_t angular_spring_damping;
- real_t angular_equilibrium_point;
-
- SixDOFAxisData() :
- linear_limit_enabled(true),
- linear_limit_upper(0),
- linear_limit_lower(0),
- linear_limit_softness(0.7),
- linear_restitution(0.5),
- linear_damping(1.),
- linear_spring_enabled(false),
- linear_spring_stiffness(0),
- linear_spring_damping(0),
- linear_equilibrium_point(0),
- angular_limit_enabled(true),
- angular_limit_upper(0),
- angular_limit_lower(0),
- angular_limit_softness(0.5),
- angular_restitution(0),
- angular_damping(1.),
- erp(0.5),
- angular_spring_enabled(false),
- angular_spring_stiffness(0),
- angular_spring_damping(0.),
- angular_equilibrium_point(0) {}
+ bool linear_limit_enabled = true;
+ real_t linear_limit_upper = 0;
+ real_t linear_limit_lower = 0;
+ real_t linear_limit_softness = 0.7;
+ real_t linear_restitution = 0.5;
+ real_t linear_damping = 1.;
+ bool linear_spring_enabled = false;
+ real_t linear_spring_stiffness = 0;
+ real_t linear_spring_damping = 0;
+ real_t linear_equilibrium_point = 0;
+ bool angular_limit_enabled = true;
+ real_t angular_limit_upper = 0;
+ real_t angular_limit_lower = 0;
+ real_t angular_limit_softness = 0.5;
+ real_t angular_restitution = 0;
+ real_t angular_damping = 1.;
+ real_t erp = 0.5;
+ bool angular_spring_enabled = false;
+ real_t angular_spring_stiffness = 0;
+ real_t angular_spring_damping = 0.;
+ real_t angular_equilibrium_point = 0;
+
+ SixDOFAxisData() {}
};
virtual JointType get_joint_type() { return JOINT_TYPE_6DOF; }
@@ -543,28 +502,28 @@ public:
private:
#ifdef TOOLS_ENABLED
// if false gizmo move body
- bool gizmo_move_joint;
+ bool gizmo_move_joint = false;
#endif
- JointData *joint_data;
+ JointData *joint_data = nullptr;
Transform joint_offset;
RID joint;
- Skeleton3D *parent_skeleton;
+ Skeleton3D *parent_skeleton = nullptr;
Transform body_offset;
Transform body_offset_inverse;
- bool simulate_physics;
- bool _internal_simulate_physics;
- int bone_id;
+ bool simulate_physics = false;
+ bool _internal_simulate_physics = false;
+ int bone_id = -1;
String bone_name;
- real_t bounce;
- real_t mass;
- real_t friction;
- real_t gravity_scale;
- real_t linear_damp;
- real_t angular_damp;
- bool can_sleep;
+ real_t bounce = 0;
+ real_t mass = 1;
+ real_t friction = 1;
+ real_t gravity_scale = 1;
+ real_t linear_damp = -1;
+ real_t angular_damp = -1;
+ bool can_sleep = true;
protected:
bool _set(const StringName &p_name, const Variant &p_value);
diff --git a/scene/3d/physics_joint_3d.cpp b/scene/3d/physics_joint_3d.cpp
index 140d887d9a..b6953fafac 100644
--- a/scene/3d/physics_joint_3d.cpp
+++ b/scene/3d/physics_joint_3d.cpp
@@ -960,8 +960,7 @@ RID Generic6DOFJoint3D::_configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *b
return j;
}
-Generic6DOFJoint3D::Generic6DOFJoint3D() :
- precision(1) {
+Generic6DOFJoint3D::Generic6DOFJoint3D() {
set_param_x(PARAM_LINEAR_LOWER_LIMIT, 0);
set_param_x(PARAM_LINEAR_UPPER_LIMIT, 0);
diff --git a/scene/3d/physics_joint_3d.h b/scene/3d/physics_joint_3d.h
index ce0c7af5d1..38a3f314ba 100644
--- a/scene/3d/physics_joint_3d.h
+++ b/scene/3d/physics_joint_3d.h
@@ -305,7 +305,7 @@ protected:
float params_z[PARAM_MAX];
bool flags_z[FLAG_MAX];
- int precision;
+ int precision = 1;
virtual RID _configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *body_b);
static void _bind_methods();
diff --git a/scene/3d/skeleton_ik_3d.cpp b/scene/3d/skeleton_ik_3d.cpp
index 10bdd71d73..5c0e48a5df 100644
--- a/scene/3d/skeleton_ik_3d.cpp
+++ b/scene/3d/skeleton_ik_3d.cpp
@@ -434,15 +434,7 @@ void SkeletonIK3D::_notification(int p_what) {
}
}
-SkeletonIK3D::SkeletonIK3D() :
- interpolation(1),
- override_tip_basis(true),
- use_magnet(false),
- min_distance(0.01),
- max_iterations(10),
- skeleton(nullptr),
- target_node_override(nullptr),
- task(nullptr) {
+SkeletonIK3D::SkeletonIK3D() {
}
SkeletonIK3D::~SkeletonIK3D() {
diff --git a/scene/3d/skeleton_ik_3d.h b/scene/3d/skeleton_ik_3d.h
index 5fbbe6e9e7..ad2623193b 100644
--- a/scene/3d/skeleton_ik_3d.h
+++ b/scene/3d/skeleton_ik_3d.h
@@ -50,36 +50,30 @@ class FabrikInverseKinematic {
struct ChainItem {
Vector<ChainItem> children;
- ChainItem *parent_item;
+ ChainItem *parent_item = nullptr;
// Bone info
- BoneId bone;
- PhysicalBone3D *pb;
+ BoneId bone = -1;
+ PhysicalBone3D *pb = nullptr;
- real_t length;
+ real_t length = 0;
/// Positions relative to root bone
Transform initial_transform;
Vector3 current_pos;
// Direction from this bone to child
Vector3 current_ori;
- ChainItem() :
- parent_item(nullptr),
- bone(-1),
- pb(nullptr),
- length(0) {}
+ ChainItem() {}
ChainItem *find_child(const BoneId p_bone_id);
ChainItem *add_child(const BoneId p_bone_id);
};
struct ChainTip {
- ChainItem *chain_item;
- const EndEffector *end_effector;
+ ChainItem *chain_item = nullptr;
+ const EndEffector *end_effector = nullptr;
- ChainTip() :
- chain_item(nullptr),
- end_effector(nullptr) {}
+ ChainTip() {}
ChainTip(ChainItem *p_chain_item, const EndEffector *p_end_effector) :
chain_item(p_chain_item),
@@ -100,25 +94,21 @@ class FabrikInverseKinematic {
public:
struct Task {
RID self;
- Skeleton3D *skeleton;
+ Skeleton3D *skeleton = nullptr;
Chain chain;
// Settings
- real_t min_distance;
- int max_iterations;
+ real_t min_distance = 0.01;
+ int max_iterations = 10;
// Bone data
- BoneId root_bone;
+ BoneId root_bone = -1;
Vector<EndEffector> end_effectors;
Transform goal_global_transform;
- Task() :
- skeleton(nullptr),
- min_distance(0.01),
- max_iterations(10),
- root_bone(-1) {}
+ Task() {}
};
private:
@@ -146,19 +136,19 @@ class SkeletonIK3D : public Node {
StringName root_bone;
StringName tip_bone;
- real_t interpolation;
+ real_t interpolation = 1;
Transform target;
NodePath target_node_path_override;
- bool override_tip_basis;
- bool use_magnet;
+ bool override_tip_basis = true;
+ bool use_magnet = false;
Vector3 magnet_position;
- real_t min_distance;
- int max_iterations;
+ real_t min_distance = 0.01;
+ int max_iterations = 10;
- Skeleton3D *skeleton;
- Node3D *target_node_override;
- FabrikInverseKinematic::Task *task;
+ Skeleton3D *skeleton = nullptr;
+ Node3D *target_node_override = nullptr;
+ FabrikInverseKinematic::Task *task = nullptr;
protected:
virtual void
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp
index 850ffab292..91b8b5c859 100644
--- a/scene/3d/soft_body_3d.cpp
+++ b/scene/3d/soft_body_3d.cpp
@@ -97,9 +97,7 @@ void SoftBodyRenderingServerHandler::set_aabb(const AABB &p_aabb) {
RS::get_singleton()->mesh_set_custom_aabb(mesh, p_aabb);
}
-SoftBody3D::PinnedPoint::PinnedPoint() :
- point_index(-1),
- spatial_attachment(nullptr) {
+SoftBody3D::PinnedPoint::PinnedPoint() {
}
SoftBody3D::PinnedPoint::PinnedPoint(const PinnedPoint &obj_tocopy) {
@@ -702,13 +700,7 @@ bool SoftBody3D::is_ray_pickable() const {
}
SoftBody3D::SoftBody3D() :
- physics_rid(PhysicsServer3D::get_singleton()->soft_body_create()),
- mesh_owner(false),
- collision_mask(1),
- collision_layer(1),
- simulation_started(false),
- pinned_points_cache_dirty(true),
- ray_pickable(true) {
+ physics_rid(PhysicsServer3D::get_singleton()->soft_body_create()) {
PhysicsServer3D::get_singleton()->body_attach_object_instance_id(physics_rid, get_instance_id());
}
diff --git a/scene/3d/soft_body_3d.h b/scene/3d/soft_body_3d.h
index 7dd5880985..485f7427f8 100644
--- a/scene/3d/soft_body_3d.h
+++ b/scene/3d/soft_body_3d.h
@@ -68,9 +68,9 @@ class SoftBody3D : public MeshInstance3D {
public:
struct PinnedPoint {
- int point_index;
+ int point_index = -1;
NodePath spatial_attachment_path;
- Node3D *spatial_attachment; // Cache
+ Node3D *spatial_attachment = nullptr; // Cache
Vector3 offset;
PinnedPoint();
@@ -83,19 +83,19 @@ private:
RID physics_rid;
- bool mesh_owner;
- uint32_t collision_mask;
- uint32_t collision_layer;
+ bool mesh_owner = false;
+ uint32_t collision_mask = 1;
+ uint32_t collision_layer = 1;
NodePath parent_collision_ignore;
Vector<PinnedPoint> pinned_points;
- bool simulation_started;
- bool pinned_points_cache_dirty;
+ bool simulation_started = false;
+ bool pinned_points_cache_dirty = true;
Ref<ArrayMesh> debug_mesh_cache;
class MeshInstance3D *debug_mesh;
bool capture_input_on_drag;
- bool ray_pickable;
+ bool ray_pickable = true;
void _update_pickable();
diff --git a/scene/3d/spring_arm_3d.cpp b/scene/3d/spring_arm_3d.cpp
index 1410b730fd..f61e6eb2a7 100644
--- a/scene/3d/spring_arm_3d.cpp
+++ b/scene/3d/spring_arm_3d.cpp
@@ -29,18 +29,12 @@
/*************************************************************************/
#include "spring_arm_3d.h"
+
#include "core/engine.h"
#include "scene/3d/collision_object_3d.h"
#include "scene/resources/sphere_shape_3d.h"
#include "servers/physics_server_3d.h"
-SpringArm3D::SpringArm3D() :
- spring_length(1),
- current_spring_length(0),
- keep_child_basis(false),
- mask(1),
- margin(0.01) {}
-
void SpringArm3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
diff --git a/scene/3d/spring_arm_3d.h b/scene/3d/spring_arm_3d.h
index cb8a00ecf9..7f6fe2f1a2 100644
--- a/scene/3d/spring_arm_3d.h
+++ b/scene/3d/spring_arm_3d.h
@@ -38,11 +38,11 @@ class SpringArm3D : public Node3D {
Ref<Shape3D> shape;
Set<RID> excluded_objects;
- float spring_length;
- float current_spring_length;
- bool keep_child_basis;
- uint32_t mask;
- float margin;
+ float spring_length = 1;
+ float current_spring_length = 0;
+ bool keep_child_basis = false;
+ uint32_t mask = 1;
+ float margin = 0.01;
protected:
void _notification(int p_what);
@@ -62,7 +62,7 @@ public:
void set_margin(float p_margin);
float get_margin();
- SpringArm3D();
+ SpringArm3D() {}
private:
void process_spring();
diff --git a/scene/3d/vehicle_body_3d.cpp b/scene/3d/vehicle_body_3d.cpp
index 5c2fa59a21..66fcf0e40b 100644
--- a/scene/3d/vehicle_body_3d.cpp
+++ b/scene/3d/vehicle_body_3d.cpp
@@ -44,7 +44,7 @@ public:
real_t getDiagonal() const { return m_Adiag; }
- btVehicleJacobianEntry(){};
+ btVehicleJacobianEntry() {}
//constraint between two different rigidbodies
btVehicleJacobianEntry(
const Basis &world2A,
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index c134aff707..d709082f62 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -87,41 +87,37 @@ private:
struct TrackNodeCache {
NodePath path;
- uint32_t id;
+ uint32_t id = 0;
RES resource;
- Node *node;
- Node3D *spatial;
- Node2D *node_2d;
- Skeleton3D *skeleton;
- int bone_idx;
+ Node *node = nullptr;
+ Node3D *spatial = nullptr;
+ Node2D *node_2d = nullptr;
+ Skeleton3D *skeleton = nullptr;
+ int bone_idx = -1;
// accumulated transforms
Vector3 loc_accum;
Quat rot_accum;
Vector3 scale_accum;
- uint64_t accum_pass;
+ uint64_t accum_pass = 0;
- bool audio_playing;
- float audio_start;
- float audio_len;
+ bool audio_playing = false;
+ float audio_start = 0.0;
+ float audio_len = 0.0;
- bool animation_playing;
+ bool animation_playing = false;
struct PropertyAnim {
- TrackNodeCache *owner;
- SpecialProperty special; //small optimization
+ TrackNodeCache *owner = nullptr;
+ SpecialProperty special = SP_NONE; //small optimization
Vector<StringName> subpath;
- Object *object;
+ Object *object = nullptr;
Variant value_accum;
- uint64_t accum_pass;
+ uint64_t accum_pass = 0;
Variant capture;
- PropertyAnim() :
- owner(nullptr),
- special(SP_NONE),
- object(nullptr),
- accum_pass(0) {}
+ PropertyAnim() {}
};
Map<StringName, PropertyAnim> property_anim;
@@ -129,32 +125,17 @@ private:
struct BezierAnim {
Vector<StringName> bezier_property;
- TrackNodeCache *owner;
- float bezier_accum;
- Object *object;
- uint64_t accum_pass;
-
- BezierAnim() :
- owner(nullptr),
- bezier_accum(0.0),
- object(nullptr),
- accum_pass(0) {}
+ TrackNodeCache *owner = nullptr;
+ float bezier_accum = 0.0;
+ Object *object = nullptr;
+ uint64_t accum_pass = 0;
+
+ BezierAnim() {}
};
Map<StringName, BezierAnim> bezier_anim;
- TrackNodeCache() :
- id(0),
- node(nullptr),
- spatial(nullptr),
- node_2d(nullptr),
- skeleton(nullptr),
- bone_idx(-1),
- accum_pass(0),
- audio_playing(false),
- audio_start(0.0),
- audio_len(0.0),
- animation_playing(false) {}
+ TrackNodeCache() {}
};
struct TrackNodeCacheKey {
diff --git a/scene/debugger/scene_debugger.h b/scene/debugger/scene_debugger.h
index e295510960..e8521d6a20 100644
--- a/scene/debugger/scene_debugger.h
+++ b/scene/debugger/scene_debugger.h
@@ -100,7 +100,7 @@ public:
void serialize(Array &r_arr);
void deserialize(const Array &p_arr);
SceneDebuggerTree(Node *p_root);
- SceneDebuggerTree(){};
+ SceneDebuggerTree() {}
};
class LiveEditor {
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index bedcef2df2..7490101ee3 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "label.h"
+
#include "core/print_string.h"
#include "core/project_settings.h"
#include "core/translation.h"
@@ -693,24 +694,8 @@ void Label::_bind_methods() {
}
Label::Label(const String &p_text) {
-
- align = ALIGN_LEFT;
- valign = VALIGN_TOP;
- xl_text = "";
- word_cache = nullptr;
- word_cache_dirty = true;
- autowrap = false;
- line_count = 0;
- set_v_size_flags(0);
- clip = false;
set_mouse_filter(MOUSE_FILTER_IGNORE);
- total_char_cache = 0;
- visible_chars = -1;
- percent_visible = 1;
- lines_skipped = 0;
- max_lines_visible = -1;
set_text(p_text);
- uppercase = false;
set_v_size_flags(SIZE_SHRINK_CENTER);
}
diff --git a/scene/gui/label.h b/scene/gui/label.h
index ba6e627c58..0f84b01604 100644
--- a/scene/gui/label.h
+++ b/scene/gui/label.h
@@ -55,15 +55,15 @@ public:
};
private:
- Align align;
- VAlign valign;
+ Align align = ALIGN_LEFT;
+ VAlign valign = VALIGN_TOP;
String text;
String xl_text;
- bool autowrap;
- bool clip;
+ bool autowrap = false;
+ bool clip = false;
Size2 minsize;
- int line_count;
- bool uppercase;
+ int line_count = 0;
+ bool uppercase = false;
int get_longest_line_width() const;
@@ -73,30 +73,23 @@ private:
CHAR_NEWLINE = -1,
CHAR_WRAPLINE = -2
};
- int char_pos; // if -1, then newline
- int word_len;
- int pixel_width;
- int space_count;
- WordCache *next;
- WordCache() {
- char_pos = 0;
- word_len = 0;
- pixel_width = 0;
- next = 0;
- space_count = 0;
- }
+ int char_pos = 0; // if -1, then newline
+ int word_len = 0;
+ int pixel_width = 0;
+ int space_count = 0;
+ WordCache *next = nullptr;
};
- bool word_cache_dirty;
+ bool word_cache_dirty = true;
void regenerate_word_cache();
- float percent_visible;
+ float percent_visible = 1;
- WordCache *word_cache;
- int total_char_cache;
- int visible_chars;
- int lines_skipped;
- int max_lines_visible;
+ WordCache *word_cache = nullptr;
+ int total_char_cache = 0;
+ int visible_chars = -1;
+ int lines_skipped = 0;
+ int max_lines_visible = -1;
protected:
void _notification(int p_what);
diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h
index 5f1798cc2a..805659376a 100644
--- a/scene/main/canvas_item.h
+++ b/scene/main/canvas_item.h
@@ -277,7 +277,7 @@ public:
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
// Save and restore a CanvasItem state
- virtual void _edit_set_state(const Dictionary &p_state){};
+ virtual void _edit_set_state(const Dictionary &p_state) {}
virtual Dictionary _edit_get_state() const { return Dictionary(); };
// Used to move the node
@@ -290,18 +290,18 @@ public:
// Used to rotate the node
virtual bool _edit_use_rotation() const { return false; };
- virtual void _edit_set_rotation(float p_rotation){};
+ virtual void _edit_set_rotation(float p_rotation) {}
virtual float _edit_get_rotation() const { return 0.0; };
// Used to resize/move the node
virtual bool _edit_use_rect() const { return false; }; // MAYBE REPLACE BY A _edit_get_editmode()
- virtual void _edit_set_rect(const Rect2 &p_rect){};
+ virtual void _edit_set_rect(const Rect2 &p_rect) {}
virtual Rect2 _edit_get_rect() const { return Rect2(0, 0, 0, 0); };
virtual Size2 _edit_get_minimum_size() const { return Size2(-1, -1); }; // LOOKS WEIRD
// Used to set a pivot
virtual bool _edit_use_pivot() const { return false; };
- virtual void _edit_set_pivot(const Point2 &p_pivot){};
+ virtual void _edit_set_pivot(const Point2 &p_pivot) {}
virtual Point2 _edit_get_pivot() const { return Point2(); };
virtual Transform2D _edit_get_transform() const;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index e9827d521b..58024dab38 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -173,7 +173,7 @@ class TooltipPanel : public PopupPanel {
GDCLASS(TooltipPanel, PopupPanel);
public:
- TooltipPanel(){};
+ TooltipPanel() {}
};
class TooltipLabel : public Label {
@@ -181,7 +181,7 @@ class TooltipLabel : public Label {
GDCLASS(TooltipLabel, Label);
public:
- TooltipLabel(){};
+ TooltipLabel() {}
};
Viewport::GUI::GUI() {
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 02ea5b24b8..4647c38e04 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -1117,11 +1117,7 @@ void Environment::_bind_methods() {
BIND_ENUM_CONSTANT(SSAO_BLUR_3x3);
}
-Environment::Environment() :
- bg_mode(BG_CLEAR_COLOR),
- tone_mapper(TONE_MAPPER_LINEAR),
- ssao_blur(SSAO_BLUR_3x3),
- glow_blend_mode(GLOW_BLEND_MODE_ADDITIVE) {
+Environment::Environment() {
environment = RS::get_singleton()->environment_create();
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index 02434bc592..6d00560634 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -90,7 +90,7 @@ public:
private:
RID environment;
- BGMode bg_mode;
+ BGMode bg_mode = BG_CLEAR_COLOR;
Ref<Sky> bg_sky;
float bg_sky_custom_fov;
Vector3 sky_rotation;
@@ -105,7 +105,7 @@ private:
AmbientSource ambient_source;
ReflectionSource reflection_source;
- ToneMapper tone_mapper;
+ ToneMapper tone_mapper = TONE_MAPPER_LINEAR;
float tonemap_exposure;
float tonemap_white;
bool tonemap_auto_exposure;
@@ -132,7 +132,7 @@ private:
float ssao_bias;
float ssao_direct_light_affect;
float ssao_ao_channel_affect;
- SSAOBlur ssao_blur;
+ SSAOBlur ssao_blur = SSAO_BLUR_3x3;
float ssao_edge_sharpness;
bool glow_enabled;
@@ -141,7 +141,7 @@ private:
float glow_strength;
float glow_mix;
float glow_bloom;
- GlowBlendMode glow_blend_mode;
+ GlowBlendMode glow_blend_mode = GLOW_BLEND_MODE_ADDITIVE;
float glow_hdr_bleed_threshold;
float glow_hdr_bleed_scale;
float glow_hdr_luminance_cap;
diff --git a/scene/resources/physics_material.cpp b/scene/resources/physics_material.cpp
index 8ac0191452..89fbf7a248 100644
--- a/scene/resources/physics_material.cpp
+++ b/scene/resources/physics_material.cpp
@@ -69,9 +69,3 @@ void PhysicsMaterial::set_absorbent(bool p_val) {
absorbent = p_val;
emit_changed();
}
-
-PhysicsMaterial::PhysicsMaterial() :
- friction(1),
- rough(false),
- bounce(0),
- absorbent(false) {}
diff --git a/scene/resources/physics_material.h b/scene/resources/physics_material.h
index f4a77d9854..1fac3fa6ef 100644
--- a/scene/resources/physics_material.h
+++ b/scene/resources/physics_material.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef physics_material_override_H
-#define physics_material_override_H
+#ifndef PHYSICS_MATERIAL_H
+#define PHYSICS_MATERIAL_H
#include "core/resource.h"
#include "servers/physics_server_3d.h"
@@ -40,10 +40,10 @@ class PhysicsMaterial : public Resource {
OBJ_SAVE_TYPE(PhysicsMaterial);
RES_BASE_EXTENSION("phymat");
- real_t friction;
- bool rough;
- real_t bounce;
- bool absorbent;
+ real_t friction = 1;
+ bool rough = false;
+ real_t bounce = 0;
+ bool absorbent = false;
protected:
static void _bind_methods();
@@ -69,7 +69,7 @@ public:
return absorbent ? -bounce : bounce;
}
- PhysicsMaterial();
+ PhysicsMaterial() {}
};
-#endif // physics_material_override_H
+#endif // PHYSICS_MATERIAL_H
diff --git a/scene/resources/shape_3d.cpp b/scene/resources/shape_3d.cpp
index f4a5d91e52..97d03b3cfc 100644
--- a/scene/resources/shape_3d.cpp
+++ b/scene/resources/shape_3d.cpp
@@ -109,19 +109,13 @@ void Shape3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0.001,10,0.001"), "set_margin", "get_margin");
}
-Shape3D::Shape3D() :
- margin(0.04) {
-
- ERR_PRINT("Constructor must not be called!");
+Shape3D::Shape3D() {
+ ERR_PRINT("Default constructor must not be called!");
}
Shape3D::Shape3D(RID p_shape) :
- margin(0.04) {
-
- shape = p_shape;
-}
+ shape(p_shape) {}
Shape3D::~Shape3D() {
-
PhysicsServer3D::get_singleton()->free(shape);
}
diff --git a/scene/resources/shape_3d.h b/scene/resources/shape_3d.h
index e7a516412d..6516868fd5 100644
--- a/scene/resources/shape_3d.h
+++ b/scene/resources/shape_3d.h
@@ -41,7 +41,7 @@ class Shape3D : public Resource {
OBJ_SAVE_TYPE(Shape3D);
RES_BASE_EXTENSION("shape");
RID shape;
- real_t margin;
+ real_t margin = 0.04;
Ref<ArrayMesh> debug_mesh_cache;
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index 05b43dfb89..5f01959253 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -48,13 +48,10 @@ public:
Ref<Shape2D> shape;
Transform2D shape_transform;
Vector2 autotile_coord;
- bool one_way_collision;
- float one_way_collision_margin;
+ bool one_way_collision = false;
+ float one_way_collision_margin = 1.0;
- ShapeData() {
- one_way_collision = false;
- one_way_collision_margin = 1.0;
- }
+ ShapeData() {}
};
enum BitmaskMode {
@@ -92,22 +89,18 @@ public:
};
struct AutotileData {
- BitmaskMode bitmask_mode;
- Size2 size;
- int spacing;
- Vector2 icon_coord;
+ BitmaskMode bitmask_mode = BITMASK_2X2;
+ // Default size to prevent invalid value
+ Size2 size = Size2(64, 64);
+ Vector2 icon_coord = Vector2(0, 0);
+ int spacing = 0;
Map<Vector2, uint32_t> flags;
Map<Vector2, Ref<OccluderPolygon2D>> occluder_map;
Map<Vector2, Ref<NavigationPolygon>> navpoly_map;
Map<Vector2, int> priority_map;
Map<Vector2, int> z_index_map;
- // Default size to prevent invalid value
- explicit AutotileData() :
- bitmask_mode(BITMASK_2X2),
- size(64, 64),
- spacing(0),
- icon_coord(0, 0) {}
+ explicit AutotileData() {}
};
private:
@@ -124,16 +117,13 @@ private:
Vector2 navigation_polygon_offset;
Ref<NavigationPolygon> navigation_polygon;
Ref<ShaderMaterial> material;
- TileMode tile_mode;
- Color modulate;
+ TileMode tile_mode = SINGLE_TILE;
+ // Default modulate for back-compat
+ Color modulate = Color(1, 1, 1);
AutotileData autotile_data;
- int z_index;
+ int z_index = 0;
- // Default modulate for back-compat
- explicit TileData() :
- tile_mode(SINGLE_TILE),
- modulate(1, 1, 1),
- z_index(0) {}
+ explicit TileData() {}
};
Map<int, TileData> tile_map;