diff options
author | lupoDharkael <izhe@hotmail.es> | 2020-04-02 01:20:12 +0200 |
---|---|---|
committer | lupoDharkael <izhe@hotmail.es> | 2020-04-02 13:38:00 +0200 |
commit | 95a1400a2ac9de1a29fa305f45b928ce8e3044bd (patch) | |
tree | be0cd59e5a90926e9d653fed9f3b1b77e735ca2f /scene | |
parent | 5f11e1557156617366d2c316a97716172103980d (diff) |
Replace NULL with nullptr
Diffstat (limited to 'scene')
118 files changed, 860 insertions, 860 deletions
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 4cedfc0c20..fc34f967ce 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -652,7 +652,7 @@ void AnimatedSprite2D::_reset_timeout() { void AnimatedSprite2D::set_animation(const StringName &p_animation) { - ERR_FAIL_COND_MSG(frames == NULL, vformat("There is no animation with name '%s'.", p_animation)); + ERR_FAIL_COND_MSG(frames == nullptr, vformat("There is no animation with name '%s'.", p_animation)); ERR_FAIL_COND_MSG(frames->get_animation_names().find(p_animation) == -1, vformat("There is no animation with name '%s'.", p_animation)); if (animation == p_animation) diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index 4ccff07416..c46b6eeb5c 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -407,8 +407,8 @@ void Area2D::set_monitoring(bool p_enable) { PhysicsServer2D::get_singleton()->area_set_area_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_area_inout); } else { - PhysicsServer2D::get_singleton()->area_set_monitor_callback(get_rid(), NULL, StringName()); - PhysicsServer2D::get_singleton()->area_set_area_monitor_callback(get_rid(), NULL, StringName()); + PhysicsServer2D::get_singleton()->area_set_monitor_callback(get_rid(), nullptr, StringName()); + PhysicsServer2D::get_singleton()->area_set_area_monitor_callback(get_rid(), nullptr, StringName()); _clear_monitoring(); } } diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 6d8d981974..d8af14a3fb 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -264,7 +264,7 @@ void Camera2D::_notification(int p_what) { } remove_from_group(group_name); remove_from_group(canvas_group_name); - viewport = NULL; + viewport = nullptr; } break; case NOTIFICATION_DRAW: { @@ -433,7 +433,7 @@ void Camera2D::clear_current() { current = false; if (is_inside_tree()) { - get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, group_name, "_make_current", (Object *)(NULL)); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, group_name, "_make_current", (Object *)nullptr); } } @@ -794,7 +794,7 @@ Camera2D::Camera2D() { first = true; smoothing_enabled = false; limit_smoothing_enabled = false; - custom_viewport = NULL; + custom_viewport = nullptr; process_mode = CAMERA2D_PROCESS_IDLE; diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 5535043432..d82f4a2f2b 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -233,7 +233,7 @@ Transform2D CollisionObject2D::shape_owner_get_transform(uint32_t p_owner) const Object *CollisionObject2D::shape_owner_get_owner(uint32_t p_owner) const { - ERR_FAIL_COND_V(!shapes.has(p_owner), NULL); + ERR_FAIL_COND_V(!shapes.has(p_owner), nullptr); return shapes[p_owner].owner; } diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h index 8874f61bb7..e931f20f40 100644 --- a/scene/2d/collision_object_2d.h +++ b/scene/2d/collision_object_2d.h @@ -60,7 +60,7 @@ class CollisionObject2D : public Node2D { disabled = false; one_way_collision = false; one_way_collision_margin = 0; - owner = NULL; + owner = nullptr; } }; diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 5880045e90..1e48b2d67f 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -129,7 +129,7 @@ void CollisionPolygon2D::_notification(int p_what) { parent->remove_shape_owner(owner_id); } owner_id = 0; - parent = NULL; + parent = nullptr; } break; case NOTIFICATION_DRAW: { @@ -319,7 +319,7 @@ CollisionPolygon2D::CollisionPolygon2D() { aabb = Rect2(-10, -10, 20, 20); build_mode = BUILD_SOLIDS; set_notify_local_transform(true); - parent = NULL; + parent = nullptr; owner_id = 0; disabled = false; one_way_collision = false; diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index cb2953cc15..b1dbc57c94 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -96,7 +96,7 @@ void CollisionShape2D::_notification(int p_what) { parent->remove_shape_owner(owner_id); } owner_id = 0; - parent = NULL; + parent = nullptr; } break; case NOTIFICATION_DRAW: { @@ -249,7 +249,7 @@ CollisionShape2D::CollisionShape2D() { rect = Rect2(-Point2(10, 10), Point2(20, 20)); set_notify_local_transform(true); owner_id = 0; - parent = NULL; + parent = nullptr; disabled = false; one_way_collision = false; one_way_collision_margin = 1.0; diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 47465f727e..0a6b091a51 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -976,7 +976,7 @@ void CPUParticles2D::_update_particle_data_buffer() { int pc = particles.size(); int *ow; - int *order = NULL; + int *order = nullptr; float *w = particle_data.ptrw(); const Particle *r = particles.ptr(); diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index 6cbb0d2a39..4d49f4762f 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -49,8 +49,8 @@ void Joint2D::_update_joint(bool p_only_free) { if (p_only_free || !is_inside_tree()) return; - Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)NULL; - Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)NULL; + Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)nullptr; + Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)nullptr; if (!node_a || !node_b) return; diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp index 3385f2fbe0..6b06f2227a 100644 --- a/scene/2d/line_builder.cpp +++ b/scene/2d/line_builder.cpp @@ -95,9 +95,9 @@ static inline Vector2 interpolate(const Rect2 &r, const Vector2 &v) { LineBuilder::LineBuilder() { joint_mode = Line2D::LINE_JOINT_SHARP; width = 10; - curve = NULL; + curve = nullptr; default_color = Color(0.4, 0.5, 1); - gradient = NULL; + gradient = nullptr; sharp_limit = 2.f; round_precision = 8; begin_cap_mode = Line2D::LINE_CAP_NONE; @@ -147,8 +147,8 @@ void LineBuilder::build() { float current_distance1 = 0.f; float total_distance = 0.f; float width_factor = 1.f; - _interpolate_color = gradient != NULL; - bool retrieve_curve = curve != NULL; + _interpolate_color = gradient != nullptr; + bool retrieve_curve = curve != nullptr; bool distance_required = _interpolate_color || retrieve_curve || texture_mode == Line2D::LINE_TEXTURE_TILE || diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp index c70d5ab1fe..32da46e8a8 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation_agent_2d.cpp @@ -98,12 +98,12 @@ void NavigationAgent2D::_notification(int p_what) { // Search the navigation node and set it { - Navigation2D *nav = NULL; + Navigation2D *nav = nullptr; Node *p = get_parent(); - while (p != NULL) { + while (p != nullptr) { nav = Object::cast_to<Navigation2D>(p); - if (nav != NULL) - p = NULL; + if (nav != nullptr) + p = nullptr; else p = p->get_parent(); } @@ -114,8 +114,8 @@ void NavigationAgent2D::_notification(int p_what) { set_physics_process_internal(true); } break; case NOTIFICATION_EXIT_TREE: { - agent_parent = NULL; - set_navigation(NULL); + agent_parent = nullptr; + set_navigation(nullptr); set_physics_process_internal(false); } break; case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { @@ -134,8 +134,8 @@ void NavigationAgent2D::_notification(int p_what) { } NavigationAgent2D::NavigationAgent2D() : - agent_parent(NULL), - navigation(NULL), + agent_parent(nullptr), + navigation(nullptr), agent(RID()), target_desired_distance(1.0), path_max_distance(3.0), @@ -160,12 +160,12 @@ void NavigationAgent2D::set_navigation(Navigation2D *p_nav) { return; // Pointless navigation = p_nav; - NavigationServer2D::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid()); + NavigationServer2D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid()); } void NavigationAgent2D::set_navigation_node(Node *p_nav) { Navigation2D *nav = Object::cast_to<Navigation2D>(p_nav); - ERR_FAIL_COND(nav == NULL); + ERR_FAIL_COND(nav == nullptr); set_navigation(nav); } @@ -225,7 +225,7 @@ Vector2 NavigationAgent2D::get_target_location() const { Vector2 NavigationAgent2D::get_next_location() { update_navigation(); if (navigation_path.size() == 0) { - ERR_FAIL_COND_V(agent_parent == NULL, Vector2()); + ERR_FAIL_COND_V(agent_parent == nullptr, Vector2()); return agent_parent->get_global_transform().get_origin(); } else { return navigation_path[nav_path_index]; @@ -233,7 +233,7 @@ Vector2 NavigationAgent2D::get_next_location() { } real_t NavigationAgent2D::distance_to_target() const { - ERR_FAIL_COND_V(agent_parent == NULL, 0.0); + ERR_FAIL_COND_V(agent_parent == nullptr, 0.0); return agent_parent->get_global_transform().get_origin().distance_to(target_location); } @@ -288,8 +288,8 @@ String NavigationAgent2D::get_configuration_warning() const { void NavigationAgent2D::update_navigation() { - if (agent_parent == NULL) return; - if (navigation == NULL) return; + if (agent_parent == nullptr) return; + if (navigation == nullptr) return; if (update_frame_id == Engine::get_singleton()->get_physics_frames()) return; update_frame_id = Engine::get_singleton()->get_physics_frames(); diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp index 4c6e777e73..50d02ca507 100644 --- a/scene/2d/navigation_obstacle_2d.cpp +++ b/scene/2d/navigation_obstacle_2d.cpp @@ -49,12 +49,12 @@ void NavigationObstacle2D::_notification(int p_what) { // Search the navigation node and set it { - Navigation2D *nav = NULL; + Navigation2D *nav = nullptr; Node *p = get_parent(); - while (p != NULL) { + while (p != nullptr) { nav = Object::cast_to<Navigation2D>(p); - if (nav != NULL) - p = NULL; + if (nav != nullptr) + p = nullptr; else p = p->get_parent(); } @@ -65,7 +65,7 @@ void NavigationObstacle2D::_notification(int p_what) { set_physics_process_internal(true); } break; case NOTIFICATION_EXIT_TREE: { - set_navigation(NULL); + set_navigation(nullptr); set_physics_process_internal(false); } break; case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { @@ -79,7 +79,7 @@ void NavigationObstacle2D::_notification(int p_what) { } NavigationObstacle2D::NavigationObstacle2D() : - navigation(NULL), + navigation(nullptr), agent(RID()) { agent = NavigationServer2D::get_singleton()->agent_create(); } @@ -94,12 +94,12 @@ void NavigationObstacle2D::set_navigation(Navigation2D *p_nav) { return; // Pointless navigation = p_nav; - NavigationServer2D::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid()); + NavigationServer2D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid()); } void NavigationObstacle2D::set_navigation_node(Node *p_nav) { Navigation2D *nav = Object::cast_to<Navigation2D>(p_nav); - ERR_FAIL_COND(nav == NULL); + ERR_FAIL_COND(nav == nullptr); set_navigation(nav); } diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index f0839b4597..d77fd5b097 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_region_2d.cpp @@ -281,7 +281,7 @@ void NavigationPolygon::make_polygons_from_outlines() { for (int l = 0; l < olsize2; l++) { - if (Geometry::segment_intersects_segment_2d(r[0], outside_point, r2[l], r2[(l + 1) % olsize2], NULL)) { + if (Geometry::segment_intersects_segment_2d(r[0], outside_point, r2[l], r2[(l + 1) % olsize2], nullptr)) { interscount++; } } @@ -449,7 +449,7 @@ void NavigationRegion2D::_notification(int p_what) { NavigationServer2D::get_singleton()->region_set_map(region, RID()); } - navigation = NULL; + navigation = nullptr; } break; case NOTIFICATION_DRAW: { @@ -574,7 +574,7 @@ NavigationRegion2D::NavigationRegion2D() { set_notify_transform(true); region = NavigationServer2D::get_singleton()->region_create(); - navigation = NULL; + navigation = nullptr; } NavigationRegion2D::~NavigationRegion2D() { diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 3e807f12dc..d55b21bc24 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -242,7 +242,7 @@ void PathFollow2D::_notification(int p_what) { } break; case NOTIFICATION_EXIT_TREE: { - path = NULL; + path = nullptr; } break; } } @@ -421,7 +421,7 @@ PathFollow2D::PathFollow2D() { offset = 0; h_offset = 0; v_offset = 0; - path = NULL; + path = nullptr; rotate = true; cubic = true; loop = true; diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index d866906ca5..21dc9537ec 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -362,7 +362,7 @@ struct _RigidBody2DInOut { bool RigidBody2D::_test_motion(const Vector2 &p_motion, bool p_infinite_inertia, float p_margin, const Ref<PhysicsTestMotionResult2D> &p_result) { - PhysicsServer2D::MotionResult *r = NULL; + PhysicsServer2D::MotionResult *r = nullptr; if (p_result.is_valid()) r = p_result->get_result_ptr(); return PhysicsServer2D::get_singleton()->body_test_motion(get_rid(), get_global_transform(), p_motion, p_infinite_inertia, p_margin, r); @@ -474,7 +474,7 @@ void RigidBody2D::_direct_state_changed(Object *p_state) { contact_monitor->locked = false; } - state = NULL; + state = nullptr; } void RigidBody2D::set_mode(Mode p_mode) { @@ -780,7 +780,7 @@ void RigidBody2D::set_contact_monitor(bool p_enabled) { } memdelete(contact_monitor); - contact_monitor = NULL; + contact_monitor = nullptr; } else { contact_monitor = memnew(ContactMonitor); @@ -790,7 +790,7 @@ void RigidBody2D::set_contact_monitor(bool p_enabled) { bool RigidBody2D::is_contact_monitor_enabled() const { - return contact_monitor != NULL; + return contact_monitor != nullptr; } void RigidBody2D::_notification(int p_what) { @@ -950,14 +950,14 @@ RigidBody2D::RigidBody2D() : angular_damp = -1; max_contacts_reported = 0; - state = NULL; + state = nullptr; angular_velocity = 0; sleeping = false; ccd_mode = CCD_MODE_DISABLED; custom_integrator = false; - contact_monitor = NULL; + contact_monitor = nullptr; can_sleep = true; PhysicsServer2D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed"); @@ -1281,7 +1281,7 @@ void KinematicBody2D::set_sync_to_physics(bool p_enable) { set_only_update_transform_changes(true); set_notify_local_transform(true); } else { - PhysicsServer2D::get_singleton()->body_set_force_integration_callback(get_rid(), NULL, ""); + PhysicsServer2D::get_singleton()->body_set_force_integration_callback(get_rid(), nullptr, ""); set_only_update_transform_changes(false); set_notify_local_transform(false); } @@ -1368,12 +1368,12 @@ KinematicBody2D::KinematicBody2D() : } KinematicBody2D::~KinematicBody2D() { if (motion_cache.is_valid()) { - motion_cache->owner = NULL; + motion_cache->owner = nullptr; } for (int i = 0; i < slide_colliders.size(); i++) { if (slide_colliders[i].is_valid()) { - slide_colliders.write[i]->owner = NULL; + slide_colliders.write[i]->owner = nullptr; } } } @@ -1394,7 +1394,7 @@ Vector2 KinematicCollision2D::get_remainder() const { return collision.remainder; } Object *KinematicCollision2D::get_local_shape() const { - if (!owner) return NULL; + if (!owner) return nullptr; uint32_t ownerid = owner->shape_find_owner(collision.local_shape); return owner->shape_owner_get_owner(ownerid); } @@ -1405,7 +1405,7 @@ Object *KinematicCollision2D::get_collider() const { return ObjectDB::get_instance(collision.collider); } - return NULL; + return nullptr; } ObjectID KinematicCollision2D::get_collider_id() const { @@ -1422,7 +1422,7 @@ Object *KinematicCollision2D::get_collider_shape() const { } } - return NULL; + return nullptr; } int KinematicCollision2D::get_collider_shape_index() const { @@ -1468,5 +1468,5 @@ KinematicCollision2D::KinematicCollision2D() { collision.collider_shape = 0; collision.local_shape = 0; - owner = NULL; + owner = nullptr; } diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 8d20053c6e..84c1828b47 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -103,7 +103,7 @@ void Polygon2D::_notification(int p_what) { if (polygon.size() < 3) return; - Skeleton2D *skeleton_node = NULL; + Skeleton2D *skeleton_node = nullptr; if (has_node(skeleton)) { skeleton_node = Object::cast_to<Skeleton2D>(get_node(skeleton)); } diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index ed971b1c3a..9d6c7304ce 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -79,7 +79,7 @@ bool RayCast2D::is_colliding() const { Object *RayCast2D::get_collider() const { if (against.is_null()) - return NULL; + return nullptr; return ObjectDB::get_instance(against); } diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp index 2be6b6a75c..86c9ff6076 100644 --- a/scene/2d/skeleton_2d.cpp +++ b/scene/2d/skeleton_2d.cpp @@ -35,7 +35,7 @@ void Bone2D::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { Node *parent = get_parent(); parent_bone = Object::cast_to<Bone2D>(parent); - skeleton = NULL; + skeleton = nullptr; while (parent) { skeleton = Object::cast_to<Skeleton2D>(parent); if (skeleton) @@ -73,9 +73,9 @@ void Bone2D::_notification(int p_what) { } } skeleton->_make_bone_setup_dirty(); - skeleton = NULL; + skeleton = nullptr; } - parent_bone = NULL; + parent_bone = nullptr; } } void Bone2D::_bind_methods() { @@ -157,8 +157,8 @@ String Bone2D::get_configuration_warning() const { } Bone2D::Bone2D() { - skeleton = NULL; - parent_bone = NULL; + skeleton = nullptr; + parent_bone = nullptr; skeleton_index = -1; default_length = 16; set_notify_local_transform(true); @@ -257,8 +257,8 @@ int Skeleton2D::get_bone_count() const { Bone2D *Skeleton2D::get_bone(int p_idx) { - ERR_FAIL_COND_V(!is_inside_tree(), NULL); - ERR_FAIL_INDEX_V(p_idx, bones.size(), NULL); + ERR_FAIL_COND_V(!is_inside_tree(), nullptr); + ERR_FAIL_INDEX_V(p_idx, bones.size(), nullptr); return bones[p_idx].bone; } diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index c468389040..1cf12e4421 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -103,8 +103,8 @@ void TileMap::_notification(int p_what) { q.occluder_instances.clear(); } - collision_parent = NULL; - navigation = NULL; + collision_parent = nullptr; + navigation = nullptr; } break; @@ -314,7 +314,7 @@ void TileMap::_add_shape(int &shape_idx, const Quadrant &p_q, const Ref<Shape2D> int real_index = collision_parent->shape_owner_get_shape_index(p_q.shape_owner_id, shape_idx); RID rid = collision_parent->get_rid(); - if (Object::cast_to<Area2D>(collision_parent) != NULL) { + if (Object::cast_to<Area2D>(collision_parent) != nullptr) { ps->area_set_shape_transform(rid, real_index, get_transform() * xform); } else { ps->body_set_shape_transform(rid, real_index, get_transform() * xform); @@ -921,7 +921,7 @@ void TileMap::make_bitmask_area_dirty(const Vector2 &p_pos) { for (int x = p_pos.x - 1; x <= p_pos.x + 1; x++) { for (int y = p_pos.y - 1; y <= p_pos.y + 1; y++) { PosKey p(x, y); - if (dirty_bitmask.find(p) == NULL) { + if (dirty_bitmask.find(p) == nullptr) { dirty_bitmask.push_back(p); } } @@ -962,7 +962,7 @@ void TileMap::update_cell_bitmask(int p_x, int p_y) { ERR_FAIL_COND_MSG(tile_set.is_null(), "Cannot update cell bitmask if Tileset is not open."); PosKey p(p_x, p_y); Map<PosKey, Cell>::Element *E = tile_map.find(p); - if (E != NULL) { + if (E != nullptr) { int id = get_cell(p_x, p_y); if (tile_set->tile_get_tile_mode(id) == TileSet::AUTO_TILE) { uint16_t mask = 0; @@ -1368,7 +1368,7 @@ void TileMap::set_collision_use_parent(bool p_use_parent) { if (use_parent && is_inside_tree()) { collision_parent = Object::cast_to<CollisionObject2D>(get_parent()); } else { - collision_parent = NULL; + collision_parent = nullptr; } _recreate_quadrants(); @@ -1959,9 +1959,9 @@ TileMap::TileMap() { mode = MODE_SQUARE; half_offset = HALF_OFFSET_DISABLED; use_parent = false; - collision_parent = NULL; + collision_parent = nullptr; use_kinematic = false; - navigation = NULL; + navigation = nullptr; y_sort_mode = false; compatibility_mode = false; centered_textures = false; diff --git a/scene/3d/area_3d.cpp b/scene/3d/area_3d.cpp index 5b02a91793..17ae553e5e 100644 --- a/scene/3d/area_3d.cpp +++ b/scene/3d/area_3d.cpp @@ -301,8 +301,8 @@ void Area3D::set_monitoring(bool p_enable) { PhysicsServer3D::get_singleton()->area_set_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_body_inout); PhysicsServer3D::get_singleton()->area_set_area_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_area_inout); } else { - PhysicsServer3D::get_singleton()->area_set_monitor_callback(get_rid(), NULL, StringName()); - PhysicsServer3D::get_singleton()->area_set_area_monitor_callback(get_rid(), NULL, StringName()); + PhysicsServer3D::get_singleton()->area_set_monitor_callback(get_rid(), nullptr, StringName()); + PhysicsServer3D::get_singleton()->area_set_area_monitor_callback(get_rid(), nullptr, StringName()); _clear_monitoring(); } } diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index ce7c885a40..537c094ceb 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -40,14 +40,14 @@ void ARVRCamera::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { // need to find our ARVROrigin parent and let it know we're its camera! ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent()); - if (origin != NULL) { + if (origin != nullptr) { origin->set_tracked_camera(this); } }; break; case NOTIFICATION_EXIT_TREE: { // need to find our ARVROrigin parent and let it know we're no longer its camera! ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent()); - if (origin != NULL) { + if (origin != nullptr) { origin->clear_tracked_camera_if(this); } }; break; @@ -60,7 +60,7 @@ String ARVRCamera::get_configuration_warning() const { // must be child node of ARVROrigin! ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent()); - if (origin == NULL) { + if (origin == nullptr) { return TTR("ARVRCamera must have an ARVROrigin node as its parent."); }; @@ -192,7 +192,7 @@ void ARVRController::_notification(int p_what) { // find the tracker for our controller ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id); - if (tracker == NULL) { + if (tracker == nullptr) { // this controller is currently turned off is_active = false; button_states = 0; @@ -279,7 +279,7 @@ String ARVRController::get_controller_name(void) const { ERR_FAIL_NULL_V(arvr_server, String()); ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id); - if (tracker == NULL) { + if (tracker == nullptr) { return String("Not connected"); }; @@ -292,7 +292,7 @@ int ARVRController::get_joystick_id() const { ERR_FAIL_NULL_V(arvr_server, 0); ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id); - if (tracker == NULL) { + if (tracker == nullptr) { // No tracker? no joystick id... (0 is our first joystick) return -1; }; @@ -324,7 +324,7 @@ real_t ARVRController::get_rumble() const { ERR_FAIL_NULL_V(arvr_server, 0.0); ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id); - if (tracker == NULL) { + if (tracker == nullptr) { return 0.0; }; @@ -337,7 +337,7 @@ void ARVRController::set_rumble(real_t p_rumble) { ERR_FAIL_NULL(arvr_server); ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id); - if (tracker != NULL) { + if (tracker != nullptr) { tracker->set_rumble(p_rumble); }; }; @@ -356,7 +356,7 @@ ARVRPositionalTracker::TrackerHand ARVRController::get_hand() const { ERR_FAIL_NULL_V(arvr_server, ARVRPositionalTracker::TRACKER_HAND_UNKNOWN); ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id); - if (tracker == NULL) { + if (tracker == nullptr) { return ARVRPositionalTracker::TRACKER_HAND_UNKNOWN; }; @@ -369,7 +369,7 @@ String ARVRController::get_configuration_warning() const { // must be child node of ARVROrigin! ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent()); - if (origin == NULL) { + if (origin == nullptr) { return TTR("ARVRController must have an ARVROrigin node as its parent."); }; @@ -407,7 +407,7 @@ void ARVRAnchor::_notification(int p_what) { // find the tracker for our anchor ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_ANCHOR, anchor_id); - if (tracker == NULL) { + if (tracker == nullptr) { // this anchor is currently not available is_active = false; } else { @@ -479,7 +479,7 @@ String ARVRAnchor::get_anchor_name(void) const { ERR_FAIL_NULL_V(arvr_server, String()); ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_ANCHOR, anchor_id); - if (tracker == NULL) { + if (tracker == nullptr) { return String("Not connected"); }; @@ -496,7 +496,7 @@ String ARVRAnchor::get_configuration_warning() const { // must be child node of ARVROrigin! ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent()); - if (origin == NULL) { + if (origin == nullptr) { return TTR("ARVRAnchor must have an ARVROrigin node as its parent."); }; @@ -535,7 +535,7 @@ String ARVROrigin::get_configuration_warning() const { if (!is_visible() || !is_inside_tree()) return String(); - if (tracked_camera == NULL) + if (tracked_camera == nullptr) return TTR("ARVROrigin requires an ARVRCamera child node."); return String(); @@ -553,7 +553,7 @@ void ARVROrigin::set_tracked_camera(ARVRCamera *p_tracked_camera) { void ARVROrigin::clear_tracked_camera_if(ARVRCamera *p_tracked_camera) { if (tracked_camera == p_tracked_camera) { - tracked_camera = NULL; + tracked_camera = nullptr; }; }; @@ -591,7 +591,7 @@ void ARVROrigin::_notification(int p_what) { // check if we have a primary interface Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface(); - if (arvr_interface.is_valid() && tracked_camera != NULL) { + if (arvr_interface.is_valid() && tracked_camera != nullptr) { // get our positioning transform for our headset Transform t = arvr_interface->get_transform_for_eye(ARVRInterface::EYE_MONO, Transform()); @@ -613,7 +613,7 @@ void ARVROrigin::_notification(int p_what) { }; ARVROrigin::ARVROrigin() { - tracked_camera = NULL; + tracked_camera = nullptr; }; ARVROrigin::~ARVROrigin(){ diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 9f5170fa98..097368853e 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -401,7 +401,7 @@ void AudioStreamPlayer3D::_notification(int p_what) { PhysicsDirectSpaceState3D::ShapeResult sr[MAX_INTERSECT_AREAS]; int areas = space_state->intersect_point(global_pos, sr, MAX_INTERSECT_AREAS, Set<RID>(), area_mask, false, true); - Area3D *area = NULL; + Area3D *area = nullptr; for (int i = 0; i < areas; i++) { if (!sr[i].collider) diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h index 1cce0c77d5..13e08339e2 100644 --- a/scene/3d/audio_stream_player_3d.h +++ b/scene/3d/audio_stream_player_3d.h @@ -82,7 +82,7 @@ private: Output() { filter_gain = 0; - viewport = NULL; + viewport = nullptr; reverb_bus_index = -1; bus_index = -1; } diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index 05e3f3fefa..6bde56104e 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -193,9 +193,9 @@ BakedLightmapData::~BakedLightmapData() { /////////////////////////// -BakedLightmap::BakeBeginFunc BakedLightmap::bake_begin_function = NULL; -BakedLightmap::BakeStepFunc BakedLightmap::bake_step_function = NULL; -BakedLightmap::BakeEndFunc BakedLightmap::bake_end_function = NULL; +BakedLightmap::BakeBeginFunc BakedLightmap::bake_begin_function = nullptr; +BakedLightmap::BakeStepFunc BakedLightmap::bake_step_function = nullptr; +BakedLightmap::BakeEndFunc BakedLightmap::bake_end_function = nullptr; void BakedLightmap::set_bake_cell_size(float p_cell_size) { bake_cell_size = p_cell_size; diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 7980c15f89..30ab4d463b 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -138,7 +138,7 @@ void Camera3D::_notification(int p_what) { if (viewport) { viewport->_camera_remove(this); - viewport = NULL; + viewport = nullptr; } } break; @@ -241,7 +241,7 @@ void Camera3D::clear_current(bool p_enable_next) { return; if (get_viewport()->get_camera() == this) { - get_viewport()->_camera_set(NULL); + get_viewport()->_camera_set(nullptr); if (p_enable_next) { get_viewport()->_camera_make_next_current(this); @@ -703,7 +703,7 @@ Camera3D::Camera3D() { near = 0; far = 0; current = false; - viewport = NULL; + viewport = nullptr; force_change = false; mode = PROJECTION_PERSPECTIVE; set_perspective(70.0, 0.05, 100.0); diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp index 6ee0512546..e6cd7bfe7e 100644 --- a/scene/3d/collision_object_3d.cpp +++ b/scene/3d/collision_object_3d.cpp @@ -245,7 +245,7 @@ Transform CollisionObject3D::shape_owner_get_transform(uint32_t p_owner) const { Object *CollisionObject3D::shape_owner_get_owner(uint32_t p_owner) const { - ERR_FAIL_COND_V(!shapes.has(p_owner), NULL); + ERR_FAIL_COND_V(!shapes.has(p_owner), nullptr); return shapes[p_owner].owner; } diff --git a/scene/3d/collision_object_3d.h b/scene/3d/collision_object_3d.h index 6a70f56caa..67d3aed3c8 100644 --- a/scene/3d/collision_object_3d.h +++ b/scene/3d/collision_object_3d.h @@ -56,7 +56,7 @@ class CollisionObject3D : public Node3D { ShapeData() { disabled = false; - owner = NULL; + owner = nullptr; } }; diff --git a/scene/3d/collision_polygon_3d.cpp b/scene/3d/collision_polygon_3d.cpp index 982205137b..66bd903eeb 100644 --- a/scene/3d/collision_polygon_3d.cpp +++ b/scene/3d/collision_polygon_3d.cpp @@ -112,7 +112,7 @@ void CollisionPolygon3D::_notification(int p_what) { parent->remove_shape_owner(owner_id); } owner_id = 0; - parent = NULL; + parent = nullptr; } break; } } @@ -201,7 +201,7 @@ CollisionPolygon3D::CollisionPolygon3D() { aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2)); depth = 1.0; set_notify_local_transform(true); - parent = NULL; + parent = nullptr; owner_id = 0; disabled = false; } diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp index 6aecfd08cc..a66e84ac3c 100644 --- a/scene/3d/collision_shape_3d.cpp +++ b/scene/3d/collision_shape_3d.cpp @@ -105,7 +105,7 @@ void CollisionShape3D::_notification(int p_what) { parent->remove_shape_owner(owner_id); } owner_id = 0; - parent = NULL; + parent = nullptr; } break; } } @@ -200,8 +200,8 @@ CollisionShape3D::CollisionShape3D() { //indicator = RenderingServer::get_singleton()->mesh_create(); disabled = false; - debug_shape = NULL; - parent = NULL; + debug_shape = nullptr; + parent = nullptr; owner_id = 0; set_notify_local_transform(true); } @@ -217,7 +217,7 @@ void CollisionShape3D::_update_debug_shape() { if (debug_shape) { debug_shape->queue_delete(); - debug_shape = NULL; + debug_shape = nullptr; } Ref<Shape3D> s = get_shape(); diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index 2226b0ed83..12c105b0f4 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -208,13 +208,13 @@ String CPUParticles3D::get_configuration_warning() const { if (get_mesh().is_valid()) { mesh_found = true; for (int j = 0; j < get_mesh()->get_surface_count(); j++) { - anim_material_found = Object::cast_to<ShaderMaterial>(get_mesh()->surface_get_material(j).ptr()) != NULL; + anim_material_found = Object::cast_to<ShaderMaterial>(get_mesh()->surface_get_material(j).ptr()) != nullptr; StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(get_mesh()->surface_get_material(j).ptr()); anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES); } } - anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != NULL; + anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != nullptr; StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(get_material_override().ptr()); anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES); @@ -1022,7 +1022,7 @@ void CPUParticles3D::_update_particle_data_buffer() { int pc = particles.size(); int *ow; - int *order = NULL; + int *order = nullptr; float *w = particle_data.ptrw(); const Particle *r = particles.ptr(); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 607b176cdd..6d571ee4f2 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -403,9 +403,9 @@ void GIProbe::_find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes) { } } -GIProbe::BakeBeginFunc GIProbe::bake_begin_function = NULL; -GIProbe::BakeStepFunc GIProbe::bake_step_function = NULL; -GIProbe::BakeEndFunc GIProbe::bake_end_function = NULL; +GIProbe::BakeBeginFunc GIProbe::bake_begin_function = nullptr; +GIProbe::BakeStepFunc GIProbe::bake_step_function = nullptr; +GIProbe::BakeEndFunc GIProbe::bake_end_function = nullptr; Vector3i GIProbe::get_estimated_cell_size() const { static const int subdiv_value[SUBDIV_MAX] = { 6, 7, 8, 9 }; @@ -512,7 +512,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) { void GIProbe::_debug_bake() { - bake(NULL, true); + bake(nullptr, true); } AABB GIProbe::get_aabb() const { diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index c00ee2cb73..28b533e82d 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -161,7 +161,7 @@ public: Vector3 get_extents() const; Vector3i get_estimated_cell_size() const; - void bake(Node *p_from_node = NULL, bool p_create_visual_debug = false); + void bake(Node *p_from_node = nullptr, bool p_create_visual_debug = false); virtual AABB get_aabb() const; virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const; diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index 8646d4f290..7744c477cb 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -253,7 +253,7 @@ String GPUParticles3D::get_configuration_warning() const { if (draw_passes[i].is_valid()) { meshes_found = true; for (int j = 0; j < draw_passes[i]->get_surface_count(); j++) { - anim_material_found = Object::cast_to<ShaderMaterial>(draw_passes[i]->surface_get_material(j).ptr()) != NULL; + anim_material_found = Object::cast_to<ShaderMaterial>(draw_passes[i]->surface_get_material(j).ptr()) != nullptr; StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(draw_passes[i]->surface_get_material(j).ptr()); anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES); } @@ -261,7 +261,7 @@ String GPUParticles3D::get_configuration_warning() const { } } - anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != NULL; + anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != nullptr; StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(get_material_override().ptr()); anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES); diff --git a/scene/3d/listener_3d.cpp b/scene/3d/listener_3d.cpp index f352eb24b1..426e34ea80 100644 --- a/scene/3d/listener_3d.cpp +++ b/scene/3d/listener_3d.cpp @@ -131,7 +131,7 @@ void Listener3D::clear_current() { return; if (get_viewport()->get_listener() == this) { - get_viewport()->_listener_set(NULL); + get_viewport()->_listener_set(nullptr); get_viewport()->_listener_make_next_current(this); } } diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index 30aabf6e00..d56a095a5b 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -217,11 +217,11 @@ Vector<Face3> MeshInstance3D::get_faces(uint32_t p_usage_flags) const { Node *MeshInstance3D::create_trimesh_collision_node() { if (mesh.is_null()) - return NULL; + return nullptr; Ref<Shape3D> shape = mesh->create_trimesh_shape(); if (shape.is_null()) - return NULL; + return nullptr; StaticBody3D *static_body = memnew(StaticBody3D); CollisionShape3D *cshape = memnew(CollisionShape3D); @@ -247,11 +247,11 @@ void MeshInstance3D::create_trimesh_collision() { Node *MeshInstance3D::create_convex_collision_node() { if (mesh.is_null()) - return NULL; + return nullptr; Ref<Shape3D> shape = mesh->create_convex_shape(); if (shape.is_null()) - return NULL; + return nullptr; StaticBody3D *static_body = memnew(StaticBody3D); CollisionShape3D *cshape = memnew(CollisionShape3D); diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp index a131684a8a..0449ab15b7 100644 --- a/scene/3d/navigation_agent_3d.cpp +++ b/scene/3d/navigation_agent_3d.cpp @@ -106,12 +106,12 @@ void NavigationAgent3D::_notification(int p_what) { // Search the navigation node and set it { - Navigation3D *nav = NULL; + Navigation3D *nav = nullptr; Node *p = get_parent(); - while (p != NULL) { + while (p != nullptr) { nav = Object::cast_to<Navigation3D>(p); - if (nav != NULL) - p = NULL; + if (nav != nullptr) + p = nullptr; else p = p->get_parent(); } @@ -122,8 +122,8 @@ void NavigationAgent3D::_notification(int p_what) { set_physics_process_internal(true); } break; case NOTIFICATION_EXIT_TREE: { - agent_parent = NULL; - set_navigation(NULL); + agent_parent = nullptr; + set_navigation(nullptr); set_physics_process_internal(false); } break; case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { @@ -142,8 +142,8 @@ void NavigationAgent3D::_notification(int p_what) { } NavigationAgent3D::NavigationAgent3D() : - agent_parent(NULL), - navigation(NULL), + agent_parent(nullptr), + navigation(nullptr), agent(RID()), target_desired_distance(1.0), navigation_height_offset(0.0), @@ -170,12 +170,12 @@ void NavigationAgent3D::set_navigation(Navigation3D *p_nav) { return; // Pointless navigation = p_nav; - NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid()); + NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid()); } void NavigationAgent3D::set_navigation_node(Node *p_nav) { Navigation3D *nav = Object::cast_to<Navigation3D>(p_nav); - ERR_FAIL_COND(nav == NULL); + ERR_FAIL_COND(nav == nullptr); set_navigation(nav); } @@ -244,7 +244,7 @@ Vector3 NavigationAgent3D::get_target_location() const { Vector3 NavigationAgent3D::get_next_location() { update_navigation(); if (navigation_path.size() == 0) { - ERR_FAIL_COND_V(agent_parent == NULL, Vector3()); + ERR_FAIL_COND_V(agent_parent == nullptr, Vector3()); return agent_parent->get_global_transform().origin; } else { return navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0); @@ -252,7 +252,7 @@ Vector3 NavigationAgent3D::get_next_location() { } real_t NavigationAgent3D::distance_to_target() const { - ERR_FAIL_COND_V(agent_parent == NULL, 0.0); + ERR_FAIL_COND_V(agent_parent == nullptr, 0.0); return agent_parent->get_global_transform().origin.distance_to(target_location); } @@ -306,8 +306,8 @@ String NavigationAgent3D::get_configuration_warning() const { void NavigationAgent3D::update_navigation() { - if (agent_parent == NULL) return; - if (navigation == NULL) return; + if (agent_parent == nullptr) return; + if (navigation == nullptr) return; if (update_frame_id == Engine::get_singleton()->get_physics_frames()) return; update_frame_id = Engine::get_singleton()->get_physics_frames(); diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp index fa976e5d18..2ee2008799 100644 --- a/scene/3d/navigation_obstacle_3d.cpp +++ b/scene/3d/navigation_obstacle_3d.cpp @@ -49,12 +49,12 @@ void NavigationObstacle3D::_notification(int p_what) { // Search the navigation node and set it { - Navigation3D *nav = NULL; + Navigation3D *nav = nullptr; Node *p = get_parent(); - while (p != NULL) { + while (p != nullptr) { nav = Object::cast_to<Navigation3D>(p); - if (nav != NULL) - p = NULL; + if (nav != nullptr) + p = nullptr; else p = p->get_parent(); } @@ -65,7 +65,7 @@ void NavigationObstacle3D::_notification(int p_what) { set_physics_process_internal(true); } break; case NOTIFICATION_EXIT_TREE: { - set_navigation(NULL); + set_navigation(nullptr); set_physics_process_internal(false); } break; case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { @@ -87,7 +87,7 @@ void NavigationObstacle3D::_notification(int p_what) { } NavigationObstacle3D::NavigationObstacle3D() : - navigation(NULL), + navigation(nullptr), agent(RID()) { agent = NavigationServer3D::get_singleton()->agent_create(); } @@ -102,12 +102,12 @@ void NavigationObstacle3D::set_navigation(Navigation3D *p_nav) { return; // Pointless navigation = p_nav; - NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid()); + NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid()); } void NavigationObstacle3D::set_navigation_node(Node *p_nav) { Navigation3D *nav = Object::cast_to<Navigation3D>(p_nav); - ERR_FAIL_COND(nav == NULL); + ERR_FAIL_COND(nav == nullptr); set_navigation(nav); } diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index 08c0fbf4d1..043b816033 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -123,9 +123,9 @@ void NavigationRegion3D::_notification(int p_what) { if (debug_view) { debug_view->queue_delete(); - debug_view = NULL; + debug_view = nullptr; } - navigation = NULL; + navigation = nullptr; } break; } } @@ -184,18 +184,18 @@ void _bake_navigation_mesh(void *p_user_data) { } void NavigationRegion3D::bake_navigation_mesh() { - ERR_FAIL_COND(bake_thread != NULL); + ERR_FAIL_COND(bake_thread != nullptr); BakeThreadsArgs *args = memnew(BakeThreadsArgs); args->nav_region = this; bake_thread = Thread::create(_bake_navigation_mesh, args); - ERR_FAIL_COND(bake_thread == NULL); + ERR_FAIL_COND(bake_thread == nullptr); } void NavigationRegion3D::_bake_finished(Ref<NavigationMesh> p_nav_mesh) { set_navigation_mesh(p_nav_mesh); - bake_thread = NULL; + bake_thread = nullptr; } String NavigationRegion3D::get_configuration_warning() const { @@ -247,9 +247,9 @@ NavigationRegion3D::NavigationRegion3D() { set_notify_transform(true); region = NavigationServer3D::get_singleton()->region_create(); - navigation = NULL; - debug_view = NULL; - bake_thread = NULL; + navigation = nullptr; + debug_view = nullptr; + bake_thread = nullptr; } NavigationRegion3D::~NavigationRegion3D() { diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp index 7f444d59bf..0b7407e049 100644 --- a/scene/3d/node_3d.cpp +++ b/scene/3d/node_3d.cpp @@ -134,7 +134,7 @@ void Node3D::_notification(int p_what) { if (data.parent) data.C = data.parent->data.children.push_back(this); else - data.C = NULL; + data.C = nullptr; if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) { @@ -158,14 +158,14 @@ void Node3D::_notification(int p_what) { get_tree()->xform_change_list.remove(&xform_change); if (data.C) data.parent->data.children.erase(data.C); - data.parent = NULL; - data.C = NULL; + data.parent = nullptr; + data.C = nullptr; data.toplevel_active = false; } break; case NOTIFICATION_ENTER_WORLD: { data.inside_world = true; - data.viewport = NULL; + data.viewport = nullptr; Node *parent = get_parent(); while (parent && !data.viewport) { data.viewport = Object::cast_to<Viewport>(parent); @@ -176,7 +176,7 @@ void Node3D::_notification(int p_what) { if (get_script_instance()) { - get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0); + get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, nullptr, 0); } #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint() && get_tree()->is_node_being_edited(this)) { @@ -208,10 +208,10 @@ void Node3D::_notification(int p_what) { if (get_script_instance()) { - get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_world, NULL, 0); + get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_world, nullptr, 0); } - data.viewport = NULL; + data.viewport = nullptr; data.inside_world = false; } break; @@ -829,7 +829,7 @@ Node3D::Node3D() : data.toplevel = false; data.toplevel_active = false; data.scale = Vector3(1, 1, 1); - data.viewport = NULL; + data.viewport = nullptr; data.inside_world = false; data.visible = true; data.disable_scale = false; @@ -840,8 +840,8 @@ Node3D::Node3D() : #endif data.notify_local_transform = false; data.notify_transform = false; - data.parent = NULL; - data.C = NULL; + data.parent = nullptr; + data.C = nullptr; } Node3D::~Node3D() { diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp index 0f1f9bb8a7..f06135f53d 100644 --- a/scene/3d/path_3d.cpp +++ b/scene/3d/path_3d.cpp @@ -229,7 +229,7 @@ void PathFollow3D::_notification(int p_what) { } break; case NOTIFICATION_EXIT_TREE: { - path = NULL; + path = nullptr; } break; } } @@ -409,7 +409,7 @@ PathFollow3D::PathFollow3D() { delta_offset = 0; h_offset = 0; v_offset = 0; - path = NULL; + path = nullptr; rotation_mode = ROTATION_XYZ; cubic = true; loop = true; diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 37981f914c..2b6eb8ac8a 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -474,7 +474,7 @@ void RigidBody3D::_direct_state_changed(Object *p_state) { contact_monitor->locked = false; } - state = NULL; + state = nullptr; } void RigidBody3D::_notification(int p_what) { @@ -744,7 +744,7 @@ void RigidBody3D::set_contact_monitor(bool p_enabled) { } memdelete(contact_monitor); - contact_monitor = NULL; + contact_monitor = nullptr; } else { contact_monitor = memnew(ContactMonitor); @@ -754,7 +754,7 @@ void RigidBody3D::set_contact_monitor(bool p_enabled) { bool RigidBody3D::is_contact_monitor_enabled() const { - return contact_monitor != NULL; + return contact_monitor != nullptr; } void RigidBody3D::set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool p_lock) { @@ -910,7 +910,7 @@ RigidBody3D::RigidBody3D() : mass = 1; max_contacts_reported = 0; - state = NULL; + state = nullptr; gravity_scale = 1; linear_damp = -1; @@ -921,7 +921,7 @@ RigidBody3D::RigidBody3D() : ccd = false; custom_integrator = false; - contact_monitor = NULL; + contact_monitor = nullptr; can_sleep = true; PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed"); @@ -1321,12 +1321,12 @@ KinematicBody3D::KinematicBody3D() : KinematicBody3D::~KinematicBody3D() { if (motion_cache.is_valid()) { - motion_cache->owner = NULL; + motion_cache->owner = nullptr; } for (int i = 0; i < slide_colliders.size(); i++) { if (slide_colliders[i].is_valid()) { - slide_colliders.write[i]->owner = NULL; + slide_colliders.write[i]->owner = nullptr; } } } @@ -1346,7 +1346,7 @@ Vector3 KinematicCollision3D::get_remainder() const { return collision.remainder; } Object *KinematicCollision3D::get_local_shape() const { - if (!owner) return NULL; + if (!owner) return nullptr; uint32_t ownerid = owner->shape_find_owner(collision.local_shape); return owner->shape_owner_get_owner(ownerid); } @@ -1357,7 +1357,7 @@ Object *KinematicCollision3D::get_collider() const { return ObjectDB::get_instance(collision.collider); } - return NULL; + return nullptr; } ObjectID KinematicCollision3D::get_collider_id() const { @@ -1374,7 +1374,7 @@ Object *KinematicCollision3D::get_collider_shape() const { } } - return NULL; + return nullptr; } int KinematicCollision3D::get_collider_shape_index() const { @@ -1420,7 +1420,7 @@ KinematicCollision3D::KinematicCollision3D() { collision.collider_shape = 0; collision.local_shape = 0; - owner = NULL; + owner = nullptr; } /////////////////////////////////////// @@ -2078,7 +2078,7 @@ void PhysicalBone3D::_notification(int p_what) { parent_skeleton->unbind_physical_bone_from_bone(bone_id); } } - parent_skeleton = NULL; + parent_skeleton = nullptr; if (joint.is_valid()) { PhysicsServer3D::get_singleton()->free(joint); joint = RID(); @@ -2181,7 +2181,7 @@ void PhysicalBone3D::_bind_methods() { Skeleton3D *PhysicalBone3D::find_skeleton_parent(Node *p_parent) { if (!p_parent) { - return NULL; + return nullptr; } Skeleton3D *s = Object::cast_to<Skeleton3D>(p_parent); return s ? s : find_skeleton_parent(p_parent->get_parent()); @@ -2333,7 +2333,7 @@ void PhysicalBone3D::set_joint_type(JointType p_joint_type) { if (joint_data) memdelete(joint_data); - joint_data = NULL; + joint_data = nullptr; switch (p_joint_type) { case JOINT_TYPE_PIN: joint_data = memnew(PinJointData); @@ -2501,8 +2501,8 @@ PhysicalBone3D::PhysicalBone3D() : #ifdef TOOLS_ENABLED gizmo_move_joint(false), #endif - joint_data(NULL), - parent_skeleton(NULL), + joint_data(nullptr), + parent_skeleton(nullptr), simulate_physics(false), _internal_simulate_physics(false), bone_id(-1), @@ -2588,7 +2588,7 @@ void PhysicalBone3D::_stop_physics_simulation() { PhysicsServer3D::get_singleton()->body_set_collision_mask(get_rid(), 0); } if (_internal_simulate_physics) { - PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), NULL, ""); + PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), nullptr, ""); parent_skeleton->set_bone_global_pose_override(bone_id, Transform(), 0.0, false); set_as_toplevel(false); _internal_simulate_physics = false; diff --git a/scene/3d/physics_joint_3d.cpp b/scene/3d/physics_joint_3d.cpp index f6b3e79300..591c17a91e 100644 --- a/scene/3d/physics_joint_3d.cpp +++ b/scene/3d/physics_joint_3d.cpp @@ -45,8 +45,8 @@ void Joint3D::_update_joint(bool p_only_free) { if (p_only_free || !is_inside_tree()) return; - Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)NULL; - Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)NULL; + Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)nullptr; + Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)nullptr; PhysicsBody3D *body_a = Object::cast_to<PhysicsBody3D>(node_a); PhysicsBody3D *body_b = Object::cast_to<PhysicsBody3D>(node_b); diff --git a/scene/3d/ray_cast_3d.cpp b/scene/3d/ray_cast_3d.cpp index d00af3b128..a18da61656 100644 --- a/scene/3d/ray_cast_3d.cpp +++ b/scene/3d/ray_cast_3d.cpp @@ -81,7 +81,7 @@ bool RayCast3D::is_colliding() const { Object *RayCast3D::get_collider() const { if (against.is_null()) - return NULL; + return nullptr; return ObjectDB::get_instance(against); } @@ -387,7 +387,7 @@ void RayCast3D::_clear_debug_shape() { else memdelete(mi); - debug_shape = NULL; + debug_shape = nullptr; } RayCast3D::RayCast3D() { @@ -398,7 +398,7 @@ RayCast3D::RayCast3D() { against_shape = 0; collision_mask = 1; cast_to = Vector3(0, -1, 0); - debug_shape = NULL; + debug_shape = nullptr; exclude_parent_body = true; collide_with_areas = false; collide_with_bodies = true; diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp index 1b05641c9d..59a6e23005 100644 --- a/scene/3d/skeleton_3d.cpp +++ b/scene/3d/skeleton_3d.cpp @@ -685,19 +685,19 @@ void Skeleton3D::bind_physical_bone_to_bone(int p_bone, PhysicalBone3D *p_physic void Skeleton3D::unbind_physical_bone_from_bone(int p_bone) { ERR_FAIL_INDEX(p_bone, bones.size()); - bones.write[p_bone].physical_bone = NULL; + bones.write[p_bone].physical_bone = nullptr; _rebuild_physical_bones_cache(); } PhysicalBone3D *Skeleton3D::get_physical_bone(int p_bone) { - ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL); + ERR_FAIL_INDEX_V(p_bone, bones.size(), nullptr); return bones[p_bone].physical_bone; } PhysicalBone3D *Skeleton3D::get_physical_bone_parent(int p_bone) { - ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL); + ERR_FAIL_INDEX_V(p_bone, bones.size(), nullptr); if (bones[p_bone].cache_parent_physical_bone) { return bones[p_bone].cache_parent_physical_bone; @@ -707,11 +707,11 @@ PhysicalBone3D *Skeleton3D::get_physical_bone_parent(int p_bone) { } PhysicalBone3D *Skeleton3D::_get_physical_bone_parent(int p_bone) { - ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL); + ERR_FAIL_INDEX_V(p_bone, bones.size(), nullptr); const int parent_bone = bones[p_bone].parent; if (0 > parent_bone) { - return NULL; + return nullptr; } PhysicalBone3D *pb = bones[parent_bone].physical_bone; diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h index 2ae04aa575..08b8691658 100644 --- a/scene/3d/skeleton_3d.h +++ b/scene/3d/skeleton_3d.h @@ -112,8 +112,8 @@ private: global_pose_override_amount = 0; global_pose_override_reset = false; #ifndef _3D_DISABLED - physical_bone = NULL; - cache_parent_physical_bone = NULL; + physical_bone = nullptr; + cache_parent_physical_bone = nullptr; #endif // _3D_DISABLED } }; diff --git a/scene/3d/skeleton_ik_3d.cpp b/scene/3d/skeleton_ik_3d.cpp index a6c3e25399..7366290ed3 100644 --- a/scene/3d/skeleton_ik_3d.cpp +++ b/scene/3d/skeleton_ik_3d.cpp @@ -42,7 +42,7 @@ FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::find_child return &children.write[i]; } } - return NULL; + return nullptr; } FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::add_child(const BoneId p_bone_id) { @@ -65,7 +65,7 @@ bool FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain chain.chain_root.initial_transform = p_task->skeleton->get_bone_global_pose(chain.chain_root.bone); chain.chain_root.current_pos = chain.chain_root.initial_transform.origin; chain.chain_root.pb = p_task->skeleton->get_physical_bone(chain.chain_root.bone); - chain.middle_chain_item = NULL; + chain.middle_chain_item = nullptr; // Holds all IDs that are composing a single chain in reverse order Vector<BoneId> chain_ids; @@ -119,7 +119,7 @@ bool FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain } if (!middle_chain_item_id) - chain.middle_chain_item = NULL; + chain.middle_chain_item = nullptr; // Initialize current tip chain.tips.write[x].chain_item = sub_chain; @@ -226,14 +226,14 @@ void FabrikInverseKinematic::solve_simple_forwards(Chain &r_chain, bool p_solve_ if (p_solve_magnet && sub_chain_root == r_chain.middle_chain_item) { // In case of magnet solving this is the tip - sub_chain_root = NULL; + sub_chain_root = nullptr; } else { sub_chain_root = &child; } } else { // Is tip - sub_chain_root = NULL; + sub_chain_root = nullptr; } } } @@ -251,7 +251,7 @@ FabrikInverseKinematic::Task *FabrikInverseKinematic::create_simple_task(Skeleto if (!build_chain(task)) { free_task(task); - return NULL; + return nullptr; } return task; @@ -328,7 +328,7 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove if (!ci->children.empty()) ci = &ci->children.write[0]; else - ci = NULL; + ci = nullptr; } } @@ -432,14 +432,14 @@ SkeletonIK3D::SkeletonIK3D() : use_magnet(false), min_distance(0.01), max_iterations(10), - skeleton(NULL), - target_node_override(NULL), - task(NULL) { + skeleton(nullptr), + target_node_override(nullptr), + task(nullptr) { } SkeletonIK3D::~SkeletonIK3D() { FabrikInverseKinematic::free_task(task); - task = NULL; + task = nullptr; } void SkeletonIK3D::set_root_bone(const StringName &p_root_bone) { @@ -479,7 +479,7 @@ const Transform &SkeletonIK3D::get_target_transform() const { void SkeletonIK3D::set_target_node(const NodePath &p_node) { target_node_path_override = p_node; - target_node_override = NULL; + target_node_override = nullptr; reload_goal(); } @@ -550,7 +550,7 @@ Transform SkeletonIK3D::_get_target_transform() { void SkeletonIK3D::reload_chain() { FabrikInverseKinematic::free_task(task); - task = NULL; + task = nullptr; if (!skeleton) return; diff --git a/scene/3d/skeleton_ik_3d.h b/scene/3d/skeleton_ik_3d.h index ebfebd1e66..5fbbe6e9e7 100644 --- a/scene/3d/skeleton_ik_3d.h +++ b/scene/3d/skeleton_ik_3d.h @@ -64,9 +64,9 @@ class FabrikInverseKinematic { Vector3 current_ori; ChainItem() : - parent_item(NULL), + parent_item(nullptr), bone(-1), - pb(NULL), + pb(nullptr), length(0) {} ChainItem *find_child(const BoneId p_bone_id); @@ -78,8 +78,8 @@ class FabrikInverseKinematic { const EndEffector *end_effector; ChainTip() : - chain_item(NULL), - end_effector(NULL) {} + chain_item(nullptr), + end_effector(nullptr) {} ChainTip(ChainItem *p_chain_item, const EndEffector *p_end_effector) : chain_item(p_chain_item), @@ -115,7 +115,7 @@ public: Transform goal_global_transform; Task() : - skeleton(NULL), + skeleton(nullptr), min_distance(0.01), max_iterations(10), root_bone(-1) {} diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp index 6d2808cfce..6092818252 100644 --- a/scene/3d/soft_body_3d.cpp +++ b/scene/3d/soft_body_3d.cpp @@ -99,7 +99,7 @@ void SoftBodyRenderingServerHandler::set_aabb(const AABB &p_aabb) { SoftBody3D::PinnedPoint::PinnedPoint() : point_index(-1), - spatial_attachment(NULL) { + spatial_attachment(nullptr) { } SoftBody3D::PinnedPoint::PinnedPoint(const PinnedPoint &obj_tocopy) { @@ -454,7 +454,7 @@ void SoftBody3D::prepare_physics_server() { if (get_mesh().is_valid()) PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, get_mesh()); else - PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, NULL); + PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, nullptr); return; } @@ -466,7 +466,7 @@ void SoftBody3D::prepare_physics_server() { RS::get_singleton()->connect("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh)); } else { - PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, NULL); + PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, nullptr); if (RS::get_singleton()->is_connected("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh))) { RS::get_singleton()->disconnect("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh)); } @@ -808,7 +808,7 @@ void SoftBody3D::_remove_pinned_point(int p_point_index) { int SoftBody3D::_get_pinned_point(int p_point_index, SoftBody3D::PinnedPoint *&r_point) const { const int id = _has_pinned_point(p_point_index); if (-1 == id) { - r_point = NULL; + r_point = nullptr; return -1; } else { r_point = const_cast<SoftBody3D::PinnedPoint *>(&pinned_points.ptr()[id]); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 360e95e76a..85e5ebc475 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -83,8 +83,8 @@ void SpriteBase3D::_notification(int p_what) { if (parent_sprite) { parent_sprite->children.erase(pI); - pI = NULL; - parent_sprite = NULL; + pI = nullptr; + parent_sprite = nullptr; } } } @@ -364,8 +364,8 @@ SpriteBase3D::SpriteBase3D() { centered = true; hflip = false; vflip = false; - parent_sprite = NULL; - pI = NULL; + parent_sprite = nullptr; + pI = nullptr; for (int i = 0; i < FLAG_MAX; i++) flags[i] = i == FLAG_TRANSPARENT || i == FLAG_DOUBLE_SIDED; @@ -441,7 +441,7 @@ void Sprite3D::_draw() { // Properly setup UVs for impostor textures (AtlasTexture). Ref<AtlasTexture> atlas_tex = texture; - if (atlas_tex != NULL) { + if (atlas_tex != nullptr) { src_tsize[0] = atlas_tex->get_atlas()->get_width(); src_tsize[1] = atlas_tex->get_atlas()->get_height(); } @@ -775,7 +775,7 @@ void AnimatedSprite3D::_draw() { // Properly setup UVs for impostor textures (AtlasTexture). Ref<AtlasTexture> atlas_tex = texture; - if (atlas_tex != NULL) { + if (atlas_tex != nullptr) { src_tsize[0] = atlas_tex->get_atlas()->get_width(); src_tsize[1] = atlas_tex->get_atlas()->get_height(); } diff --git a/scene/3d/vehicle_body_3d.cpp b/scene/3d/vehicle_body_3d.cpp index ac7608a3d5..5c2fa59a21 100644 --- a/scene/3d/vehicle_body_3d.cpp +++ b/scene/3d/vehicle_body_3d.cpp @@ -99,7 +99,7 @@ void VehicleWheel3D::_notification(int p_what) { if (!cb) return; cb->wheels.erase(this); - body = NULL; + body = nullptr; } } @@ -385,7 +385,7 @@ VehicleWheel3D::VehicleWheel3D() { m_clippedInvContactDotSuspension = 1.0; m_raycastInfo.m_isInContact = false; - body = NULL; + body = nullptr; } void VehicleBody3D::_update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirectBodyState3D *s) { @@ -454,7 +454,7 @@ real_t VehicleBody3D::_ray_cast(int p_idx, PhysicsDirectBodyState3D *s) { bool col = ss->intersect_ray(source, target, rr, exclude); - wheel.m_raycastInfo.m_groundObject = 0; + wheel.m_raycastInfo.m_groundObject = nullptr; if (col) { param = source.distance_to(rr.position) / source.distance_to(target); @@ -917,7 +917,7 @@ void VehicleBody3D::_direct_state_changed(Object *p_state) { wheel.m_deltaRotation *= real_t(0.99); //damping of rotation when not in contact } - state = NULL; + state = nullptr; } void VehicleBody3D::set_engine_force(float p_engine_force) { @@ -988,7 +988,7 @@ VehicleBody3D::VehicleBody3D() { engine_force = 0; brake = 0; - state = NULL; + state = nullptr; ccd = false; exclude.insert(get_rid()); diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 8ba7a38628..570735ad87 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -41,7 +41,7 @@ StringName AnimationNodeAnimation::get_animation() const { return animation; } -Vector<String> (*AnimationNodeAnimation::get_editable_animation_list)() = NULL; +Vector<String> (*AnimationNodeAnimation::get_editable_animation_list)() = nullptr; void AnimationNodeAnimation::get_parameter_list(List<PropertyInfo> *r_list) const { r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", 0)); diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp index 79a7c36e7f..ab8be47b4d 100644 --- a/scene/animation/animation_cache.cpp +++ b/scene/animation/animation_cache.cpp @@ -287,7 +287,7 @@ void AnimationCache::set_all(float p_time, float p_delta) { if (!args.size()) { - call_track(i, name, NULL, 0, err); + call_track(i, name, nullptr, 0, err); } else { Vector<const Variant *> argptrs; @@ -332,7 +332,7 @@ void AnimationCache::set_root(Node *p_root) { AnimationCache::AnimationCache() { - root = NULL; + root = nullptr; cache_dirty = true; cache_valid = false; } diff --git a/scene/animation/animation_cache.h b/scene/animation/animation_cache.h index 20147f060b..23312ca7ec 100644 --- a/scene/animation/animation_cache.h +++ b/scene/animation/animation_cache.h @@ -50,12 +50,12 @@ class AnimationCache : public Object { Vector<StringName> subpath; bool valid; Path() { - object = NULL; - skeleton = NULL; - node = NULL; + object = nullptr; + skeleton = nullptr; + node = nullptr; bone_idx = -1; valid = false; - spatial = NULL; + spatial = nullptr; } }; diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index 05c5e86491..9f5e06c43d 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -225,7 +225,7 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *p_sta } //find the last cost transition - List<int>::Element *least_cost_transition = NULL; + List<int>::Element *least_cost_transition = nullptr; float least_cost = 1e20; for (List<int>::Element *E = open_list.front(); E; E = E->next()) { @@ -530,7 +530,7 @@ void AnimationNodeStateMachine::get_parameter_list(List<PropertyInfo> *r_list) c List<StringName> advance_conditions; for (int i = 0; i < transitions.size(); i++) { StringName ac = transitions[i].transition->get_advance_condition_name(); - if (ac != StringName() && advance_conditions.find(ac) == NULL) { + if (ac != StringName() && advance_conditions.find(ac) == nullptr) { advance_conditions.push_back(ac); } } diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 6c870682a6..00f0dce0d6 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -244,7 +244,7 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) { for (int i = 0; i < a->get_track_count(); i++) { - p_anim->node_cache.write[i] = NULL; + p_anim->node_cache.write[i] = nullptr; RES resource; Vector<StringName> leftover_path; Node *child = parent->get_node_and_resource(a->track_get_path(i), resource, leftover_path); @@ -293,13 +293,13 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) { p_anim->node_cache[i]->bone_idx = p_anim->node_cache[i]->skeleton->find_bone(bone_name); if (p_anim->node_cache[i]->bone_idx < 0) { // broken track (nonexistent bone) - p_anim->node_cache[i]->skeleton = NULL; - p_anim->node_cache[i]->spatial = NULL; + p_anim->node_cache[i]->skeleton = nullptr; + p_anim->node_cache[i]->spatial = nullptr; ERR_CONTINUE(p_anim->node_cache[i]->bone_idx < 0); } } else { // no property, just use spatialnode - p_anim->node_cache[i]->skeleton = NULL; + p_anim->node_cache[i]->skeleton = nullptr; } } } @@ -830,7 +830,7 @@ void AnimationPlayer::_animation_process2(float p_delta, bool p_started) { c.seeked = false; } - List<Blend>::Element *prev = NULL; + List<Blend>::Element *prev = nullptr; for (List<Blend>::Element *E = c.blend.back(); E; E = prev) { Blend &b = E->get(); @@ -1296,7 +1296,7 @@ void AnimationPlayer::stop(bool p_reset) { Playback &c = playback; c.blend.clear(); if (p_reset) { - c.current.from = NULL; + c.current.from = nullptr; c.current.speed_scale = 1; c.current.pos = 0; } diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 32bed6f4d6..c134aff707 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -118,9 +118,9 @@ private: Variant capture; PropertyAnim() : - owner(NULL), + owner(nullptr), special(SP_NONE), - object(NULL), + object(nullptr), accum_pass(0) {} }; @@ -135,9 +135,9 @@ private: uint64_t accum_pass; BezierAnim() : - owner(NULL), + owner(nullptr), bezier_accum(0.0), - object(NULL), + object(nullptr), accum_pass(0) {} }; @@ -145,10 +145,10 @@ private: TrackNodeCache() : id(0), - node(NULL), - spatial(NULL), - node_2d(NULL), - skeleton(NULL), + node(nullptr), + spatial(nullptr), + node_2d(nullptr), + skeleton(nullptr), bone_idx(-1), accum_pass(0), audio_playing(false), @@ -212,7 +212,7 @@ private: pos = 0; speed_scale = 1.0; - from = NULL; + from = nullptr; } }; diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 0e1089cc6a..f8b3ca291b 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -128,8 +128,8 @@ float AnimationNode::_pre_process(const StringName &p_base_path, AnimationNode * float t = process(p_time, p_seek); - state = NULL; - parent = NULL; + state = nullptr; + parent = nullptr; base_path = StringName(); connections.clear(); @@ -164,7 +164,7 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p //inputs.write[p_input].last_pass = state->last_pass; float activity = 0; - float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), NULL, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity); + float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), nullptr, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity); Vector<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path); @@ -202,7 +202,7 @@ float AnimationNode::_blend_node(const StringName &p_subpath, const Vector<Strin blendw[i] = 0.0; //all to zero by default } - const NodePath *K = NULL; + const NodePath *K = nullptr; while ((K = filter.next(K))) { if (!state->track_map.has(*K)) { continue; @@ -316,7 +316,7 @@ String AnimationNode::get_caption() const { void AnimationNode::add_input(const String &p_name) { //root nodes can't add inputs - ERR_FAIL_COND(Object::cast_to<AnimationRootNode>(this) != NULL); + ERR_FAIL_COND(Object::cast_to<AnimationRootNode>(this) != nullptr); Input input; ERR_FAIL_COND(p_name.find(".") != -1 || p_name.find("/") != -1); input.name = p_name; @@ -374,7 +374,7 @@ Array AnimationNode::_get_filters() const { Array paths; - const NodePath *K = NULL; + const NodePath *K = nullptr; while ((K = filter.next(K))) { paths.push_back(String(*K)); //use strings, so sorting is possible } @@ -453,8 +453,8 @@ void AnimationNode::_bind_methods() { AnimationNode::AnimationNode() { - state = NULL; - parent = NULL; + state = nullptr; + parent = nullptr; filter_enabled = false; } @@ -558,17 +558,17 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { NodePath path = anim->track_get_path(i); Animation::TrackType track_type = anim->track_get_type(i); - TrackCache *track = NULL; + TrackCache *track = nullptr; if (track_cache.has(path)) { track = track_cache.get(path); } //if not valid, delete track - if (track && (track->type != track_type || ObjectDB::get_instance(track->object_id) == NULL)) { + if (track && (track->type != track_type || ObjectDB::get_instance(track->object_id) == nullptr)) { playing_caches.erase(track); memdelete(track); track_cache.erase(path); - track = NULL; + track = nullptr; } if (!track) { @@ -615,7 +615,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { TrackCacheTransform *track_xform = memnew(TrackCacheTransform); track_xform->spatial = spatial; - track_xform->skeleton = NULL; + track_xform->skeleton = nullptr; track_xform->bone_idx = -1; if (path.get_subname_count() == 1 && Object::cast_to<Skeleton3D>(spatial)) { @@ -700,7 +700,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { List<NodePath> to_delete; - const NodePath *K = NULL; + const NodePath *K = nullptr; while ((K = track_cache.next(K))) { TrackCache *tc = track_cache[*K]; if (tc->setup_pass != setup_pass) { @@ -717,7 +717,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { state.track_map.clear(); - K = NULL; + K = nullptr; int idx = 0; while ((K = track_cache.next(K))) { state.track_map[*K] = idx; @@ -733,7 +733,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { void AnimationTree::_clear_caches() { - const NodePath *K = NULL; + const NodePath *K = nullptr; while ((K = track_cache.next(K))) { memdelete(track_cache[*K]); } @@ -829,11 +829,11 @@ void AnimationTree::_process_graph(float p_delta) { if (started) { //if started, seek - root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, NULL, &state, 0, true, Vector<StringName>()); + root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, nullptr, &state, 0, true, Vector<StringName>()); started = false; } - root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, NULL, &state, p_delta, false, Vector<StringName>()); + root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, nullptr, &state, p_delta, false, Vector<StringName>()); } if (!state.valid) { @@ -1224,7 +1224,7 @@ void AnimationTree::_process_graph(float p_delta) { { // finally, set the tracks - const NodePath *K = NULL; + const NodePath *K = nullptr; while ((K = track_cache.next(K))) { TrackCache *track = track_cache[*K]; if (track->process_pass != process_pass) diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index faf4333f1d..d558170f23 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -101,7 +101,7 @@ public: Array _get_filters() const; void _set_filters(const Array &p_filters); friend class AnimationNodeBlendTree; - float _blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true, float *r_max = NULL); + float _blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true, float *r_max = nullptr); protected: void blend_animation(const StringName &p_animation, float p_time, float p_delta, bool p_seeked, float p_blend); @@ -186,7 +186,7 @@ private: root_motion = false; setup_pass = 0; process_pass = 0; - object = NULL; + object = nullptr; } virtual ~TrackCache() {} }; @@ -202,9 +202,9 @@ private: TrackCacheTransform() { type = Animation::TYPE_TRANSFORM; - spatial = NULL; + spatial = nullptr; bone_idx = -1; - skeleton = NULL; + skeleton = nullptr; } }; diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 628568afbb..bc28c38e2c 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -297,7 +297,7 @@ Variant Tween::_get_initial_val(const InterpolateData &p_data) const { case TARGETING_METHOD: { // Get the object that is being targeted Object *object = ObjectDB::get_instance(p_data.target_id); - ERR_FAIL_COND_V(object == NULL, p_data.initial_val); + ERR_FAIL_COND_V(object == nullptr, p_data.initial_val); // Are we targeting a property or a method? Variant initial_val; @@ -309,7 +309,7 @@ Variant Tween::_get_initial_val(const InterpolateData &p_data) const { } else { // Call the method and get the initial value from it Callable::CallError error; - initial_val = object->call(p_data.target_key[0], NULL, 0, error); + initial_val = object->call(p_data.target_key[0], nullptr, 0, error); ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, p_data.initial_val); } return initial_val; @@ -329,7 +329,7 @@ Variant Tween::_get_final_val(const InterpolateData &p_data) const { case FOLLOW_METHOD: { // Get the object that is being followed Object *target = ObjectDB::get_instance(p_data.target_id); - ERR_FAIL_COND_V(target == NULL, p_data.initial_val); + ERR_FAIL_COND_V(target == nullptr, p_data.initial_val); // We want to figure out the final value Variant final_val; @@ -341,7 +341,7 @@ Variant Tween::_get_final_val(const InterpolateData &p_data) const { } else { // We're looking at a method. Call the method on the target object Callable::CallError error; - final_val = target->call(p_data.target_key[0], NULL, 0, error); + final_val = target->call(p_data.target_key[0], nullptr, 0, error); ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, p_data.initial_val); } @@ -371,7 +371,7 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) { case FOLLOW_METHOD: { // We're following an object, so grab that instance Object *target = ObjectDB::get_instance(p_data.target_id); - ERR_FAIL_COND_V(target == NULL, p_data.initial_val); + ERR_FAIL_COND_V(target == nullptr, p_data.initial_val); // We want to figure out the final value Variant final_val; @@ -383,7 +383,7 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) { } else { // We're looking at a method. Call the method on the target object Callable::CallError error; - final_val = target->call(p_data.target_key[0], NULL, 0, error); + final_val = target->call(p_data.target_key[0], nullptr, 0, error); ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, p_data.initial_val); } @@ -607,7 +607,7 @@ bool Tween::_apply_tween_value(InterpolateData &p_data, Variant &value) { // Get the object we want to apply the new value to Object *object = ObjectDB::get_instance(p_data.id); - ERR_FAIL_COND_V(object == NULL, false); + ERR_FAIL_COND_V(object == nullptr, false); // What kind of data are we mutating? switch (p_data.type) { @@ -634,7 +634,7 @@ bool Tween::_apply_tween_value(InterpolateData &p_data, Variant &value) { object->call(p_data.key[0], (const Variant **)arg, 1, error); } else { // Don't pass any argument - object->call(p_data.key[0], NULL, 0, error); + object->call(p_data.key[0], nullptr, 0, error); } // Did we get an error from the function call? @@ -700,7 +700,7 @@ void Tween::_tween_process(float p_delta) { // Get the target object for this interpolation Object *object = ObjectDB::get_instance(data.id); - if (object == NULL) + if (object == nullptr) continue; // Are we still delaying this tween? @@ -860,7 +860,7 @@ void Tween::reset(Object *p_object, StringName p_key) { // Get the target object InterpolateData &data = E->get(); Object *object = ObjectDB::get_instance(data.id); - if (object == NULL) + if (object == nullptr) continue; // Do we have the correct object and key? @@ -901,7 +901,7 @@ void Tween::stop(Object *p_object, StringName p_key) { // Get the object the tween is targeting InterpolateData &data = E->get(); Object *object = ObjectDB::get_instance(data.id); - if (object == NULL) + if (object == nullptr) continue; // Is this the correct object and does it have the given key? @@ -937,7 +937,7 @@ void Tween::resume(Object *p_object, StringName p_key) { // Grab the object InterpolateData &data = E->get(); Object *object = ObjectDB::get_instance(data.id); - if (object == NULL) + if (object == nullptr) continue; // If the object and string key match, activate it @@ -975,7 +975,7 @@ void Tween::remove(Object *p_object, StringName p_key) { // Get the target object InterpolateData &data = E->get(); Object *object = ObjectDB::get_instance(data.id); - if (object == NULL) + if (object == nullptr) continue; // If the target object and string key match, queue it for removal @@ -1264,7 +1264,7 @@ void Tween::_build_interpolation(InterpolateType p_interpolation_type, Object *p // Validate and apply interpolation data // Give it the object - ERR_FAIL_COND_MSG(p_object == NULL, "Invalid object provided to Tween."); + ERR_FAIL_COND_MSG(p_object == nullptr, "Invalid object provided to Tween."); data.id = p_object->get_instance_id(); // Validate the initial and final values @@ -1335,7 +1335,7 @@ void Tween::interpolate_property(Object *p_object, NodePath p_property, Variant if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); // Build the interpolation data - _build_interpolation(INTER_PROPERTY, p_object, &p_property, NULL, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); + _build_interpolation(INTER_PROPERTY, p_object, &p_property, nullptr, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); } void Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { @@ -1350,7 +1350,7 @@ void Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_ if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); // Build the interpolation data - _build_interpolation(INTER_METHOD, p_object, NULL, &p_method, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); + _build_interpolation(INTER_METHOD, p_object, nullptr, &p_method, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); } void Tween::interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE) { @@ -1361,7 +1361,7 @@ void Tween::interpolate_callback(Object *p_object, real_t p_duration, String p_c } // Check that the target object is valid - ERR_FAIL_COND(p_object == NULL); + ERR_FAIL_COND(p_object == nullptr); // Duration cannot be negative ERR_FAIL_COND(p_duration < 0); @@ -1418,7 +1418,7 @@ void Tween::interpolate_deferred_callback(Object *p_object, real_t p_duration, S } // Check that the target object is valid - ERR_FAIL_COND(p_object == NULL); + ERR_FAIL_COND(p_object == nullptr); // No negative durations allowed ERR_FAIL_COND(p_duration < 0); @@ -1486,8 +1486,8 @@ void Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); // Confirm the source and target objects are valid - ERR_FAIL_COND(p_object == NULL); - ERR_FAIL_COND(p_target == NULL); + ERR_FAIL_COND(p_object == nullptr); + ERR_FAIL_COND(p_target == nullptr); // No negative durations ERR_FAIL_COND(p_duration < 0); @@ -1547,8 +1547,8 @@ void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); // Verify the source and target objects are valid - ERR_FAIL_COND(p_object == NULL); - ERR_FAIL_COND(p_target == NULL); + ERR_FAIL_COND(p_object == nullptr); + ERR_FAIL_COND(p_target == nullptr); // No negative durations ERR_FAIL_COND(p_duration < 0); @@ -1566,7 +1566,7 @@ void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi // Call the method to get the target value Callable::CallError error; - Variant target_val = p_target->call(p_target_method, NULL, 0, error); + Variant target_val = p_target->call(p_target_method, nullptr, 0, error); ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK); // Convert target INT values to FLOAT as they are better for interpolation @@ -1610,8 +1610,8 @@ void Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_ if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); // Verify both objects are valid - ERR_FAIL_COND(p_object == NULL); - ERR_FAIL_COND(p_initial == NULL); + ERR_FAIL_COND(p_object == nullptr); + ERR_FAIL_COND(p_initial == nullptr); // No negative durations ERR_FAIL_COND(p_duration < 0); @@ -1676,8 +1676,8 @@ void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); // Make sure the given objects are valid - ERR_FAIL_COND(p_object == NULL); - ERR_FAIL_COND(p_initial == NULL); + ERR_FAIL_COND(p_object == nullptr); + ERR_FAIL_COND(p_initial == nullptr); // No negative durations ERR_FAIL_COND(p_duration < 0); @@ -1695,7 +1695,7 @@ void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in // Call the method to get the initial value Callable::CallError error; - Variant initial_val = p_initial->call(p_initial_method, NULL, 0, error); + Variant initial_val = p_initial->call(p_initial_method, nullptr, 0, error); ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK); // Convert initial INT values to FLOAT as they aer better for interpolation diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp index 2582bab200..f612944a62 100644 --- a/scene/audio/audio_stream_player.cpp +++ b/scene/audio/audio_stream_player.cpp @@ -36,7 +36,7 @@ void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames, int p_amount) { int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus); - AudioFrame *targets[4] = { NULL, NULL, NULL, NULL }; + AudioFrame *targets[4] = { nullptr, nullptr, nullptr, nullptr }; if (AudioServer::get_singleton()->get_speaker_mode() == AudioServer::SPEAKER_MODE_STEREO) { targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 0); diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index 359f936793..8cb63c4ab5 100644 --- a/scene/debugger/scene_debugger.cpp +++ b/scene/debugger/scene_debugger.cpp @@ -40,7 +40,7 @@ void SceneDebugger::initialize() { #ifdef DEBUG_ENABLED LiveEditor::singleton = memnew(LiveEditor); - EngineDebugger::register_message_capture("scene", EngineDebugger::Capture(NULL, SceneDebugger::parse_message)); + EngineDebugger::register_message_capture("scene", EngineDebugger::Capture(nullptr, SceneDebugger::parse_message)); #endif } @@ -51,7 +51,7 @@ void SceneDebugger::deinitialize() { if (EngineDebugger::has_capture("scene")) EngineDebugger::unregister_message_capture("scene"); memdelete(LiveEditor::singleton); - LiveEditor::singleton = NULL; + LiveEditor::singleton = nullptr; } #endif } @@ -279,7 +279,7 @@ SceneDebuggerObject::SceneDebuggerObject(ObjectID p_id) { } } else if (Script *s = Object::cast_to<Script>(obj)) { // Add script constants (no instance). - _parse_script_properties(s, NULL); + _parse_script_properties(s, nullptr); } // Add base object properties. @@ -373,7 +373,7 @@ void SceneDebuggerObject::serialize(Array &r_arr, int p_max_size) { var = res->get_path(); } else { //only send information that can be sent.. int len = 0; //test how big is this to encode - encode_variant(var, NULL, len); + encode_variant(var, nullptr, len); if (len > p_max_size) { //limit to max size hint = PROPERTY_HINT_OBJECT_TOO_BIG; hint_string = ""; @@ -478,7 +478,7 @@ void SceneDebuggerTree::deserialize(const Array &p_arr) { } /// LiveEditor -LiveEditor *LiveEditor::singleton = NULL; +LiveEditor *LiveEditor::singleton = nullptr; LiveEditor *LiveEditor::get_singleton() { return singleton; } @@ -515,7 +515,7 @@ void LiveEditor::_node_set_func(int p_id, const StringName &p_prop, const Varian return; NodePath np = live_edit_node_path_cache[p_id]; - Node *base = NULL; + Node *base = nullptr; if (scene_tree->root->has_node(live_edit_root)) base = scene_tree->root->get_node(live_edit_root); @@ -553,7 +553,7 @@ void LiveEditor::_node_call_func(int p_id, const StringName &p_method, VARIANT_A return; NodePath np = live_edit_node_path_cache[p_id]; - Node *base = NULL; + Node *base = nullptr; if (scene_tree->root->has_node(live_edit_root)) base = scene_tree->root->get_node(live_edit_root); @@ -626,7 +626,7 @@ void LiveEditor::_create_node_func(const NodePath &p_parent, const String &p_typ if (!scene_tree) return; - Node *base = NULL; + Node *base = nullptr; if (scene_tree->root->has_node(live_edit_root)) base = scene_tree->root->get_node(live_edit_root); @@ -664,7 +664,7 @@ void LiveEditor::_instance_node_func(const NodePath &p_parent, const String &p_p if (!ps.is_valid()) return; - Node *base = NULL; + Node *base = nullptr; if (scene_tree->root->has_node(live_edit_root)) base = scene_tree->root->get_node(live_edit_root); @@ -697,7 +697,7 @@ void LiveEditor::_remove_node_func(const NodePath &p_at) { if (!scene_tree) return; - Node *base = NULL; + Node *base = nullptr; if (scene_tree->root->has_node(live_edit_root)) base = scene_tree->root->get_node(live_edit_root); @@ -728,7 +728,7 @@ void LiveEditor::_remove_and_keep_node_func(const NodePath &p_at, ObjectID p_kee if (!scene_tree) return; - Node *base = NULL; + Node *base = nullptr; if (scene_tree->root->has_node(live_edit_root)) base = scene_tree->root->get_node(live_edit_root); @@ -762,7 +762,7 @@ void LiveEditor::_restore_node_func(ObjectID p_id, const NodePath &p_at, int p_a if (!scene_tree) return; - Node *base = NULL; + Node *base = nullptr; if (scene_tree->root->has_node(live_edit_root)) base = scene_tree->root->get_node(live_edit_root); @@ -808,7 +808,7 @@ void LiveEditor::_duplicate_node_func(const NodePath &p_at, const String &p_new_ if (!scene_tree) return; - Node *base = NULL; + Node *base = nullptr; if (scene_tree->root->has_node(live_edit_root)) base = scene_tree->root->get_node(live_edit_root); @@ -841,7 +841,7 @@ void LiveEditor::_reparent_node_func(const NodePath &p_at, const NodePath &p_new if (!scene_tree) return; - Node *base = NULL; + Node *base = nullptr; if (scene_tree->root->has_node(live_edit_root)) base = scene_tree->root->get_node(live_edit_root); diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index a05ac08e9d..1cdc6f8057 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -498,7 +498,7 @@ BaseButton *ButtonGroup::get_pressed_button() { return E->get(); } - return NULL; + return nullptr; } void ButtonGroup::_bind_methods() { diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 2ec9bb2292..5e0f4c91e8 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -80,7 +80,7 @@ void ColorPicker::_notification(int p_what) { } break; case NOTIFICATION_WM_CLOSE_REQUEST: { - if (screen != NULL && screen->is_visible()) + if (screen != nullptr && screen->is_visible()) screen->hide(); } break; } @@ -275,7 +275,7 @@ void ColorPicker::_text_type_toggled() { c_text->set_editable(false); } else { text_type->set_text("#"); - text_type->set_icon(NULL); + text_type->set_icon(nullptr); c_text->set_editable(true); } @@ -732,7 +732,7 @@ ColorPicker::ColorPicker() : changing_color = false; presets_enabled = true; presets_visible = true; - screen = NULL; + screen = nullptr; HBoxContainer *hb_edit = memnew(HBoxContainer); add_child(hb_edit); @@ -1024,8 +1024,8 @@ ColorPickerButton::ColorPickerButton() { // Initialization is now done deferred, // this improves performance in the inspector as the color picker // can be expensive to initialize. - picker = NULL; - popup = NULL; + picker = nullptr; + popup = nullptr; edit_alpha = true; set_toggle_mode(true); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 0d982dbc02..de6233f359 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -455,13 +455,13 @@ void Control::remove_child_notify(Node *p_child) { Control *child_c = Object::cast_to<Control>(p_child); if (child_c && (child_c->data.theme_owner || child_c->data.theme_owner_window) && child_c->data.theme.is_null()) { - _propagate_theme_changed(child_c, NULL, NULL); + _propagate_theme_changed(child_c, nullptr, nullptr); } Window *child_w = Object::cast_to<Window>(p_child); if (child_w && (child_w->theme_owner || child_w->theme_owner_window) && child_w->theme.is_null()) { - _propagate_theme_changed(child_w, NULL, NULL); + _propagate_theme_changed(child_w, nullptr, nullptr); } } @@ -495,7 +495,7 @@ void Control::_notification(int p_notification) { data.parent = Object::cast_to<Control>(get_parent()); Node *parent = this; //meh - Control *parent_control = NULL; + Control *parent_control = nullptr; bool subwindow = false; while (parent) { @@ -548,7 +548,7 @@ void Control::_notification(int p_notification) { if (data.parent_canvas_item) { data.parent_canvas_item->disconnect("item_rect_changed", callable_mp(this, &Control::_size_changed)); - data.parent_canvas_item = NULL; + data.parent_canvas_item = nullptr; } else if (!is_set_as_toplevel()) { //disconnect viewport get_viewport()->disconnect("size_changed", callable_mp(this, &Control::_size_changed)); @@ -556,11 +556,11 @@ void Control::_notification(int p_notification) { if (data.RI) { get_viewport()->_gui_remove_root_control(data.RI); - data.RI = NULL; + data.RI = nullptr; } - data.parent = NULL; - data.parent_canvas_item = NULL; + data.parent = nullptr; + data.parent_canvas_item = nullptr; /* if (data.theme_owner && data.theme.is_null()) { data.theme_owner=NULL; @@ -621,7 +621,7 @@ void Control::_notification(int p_notification) { if (!is_visible_in_tree()) { - if (get_viewport() != NULL) + if (get_viewport() != nullptr) get_viewport()->_gui_hid_control(this); //remove key focus @@ -753,7 +753,7 @@ Size2 Control::get_minimum_size() const { if (si) { Callable::CallError ce; - Variant s = si->call(SceneStringNames::get_singleton()->_get_minimum_size, NULL, 0, ce); + Variant s = si->call(SceneStringNames::get_singleton()->_get_minimum_size, nullptr, 0, ce); if (ce.error == Callable::CallError::CALL_OK) return s; } @@ -799,8 +799,8 @@ bool Control::_find_theme_item(Control *p_theme_owner, Window *p_theme_owner_win theme_owner_window = parent_w->theme_owner_window; } else { - theme_owner = NULL; - theme_owner_window = NULL; + theme_owner = nullptr; + theme_owner_window = nullptr; } } } @@ -843,8 +843,8 @@ bool Control::_has_theme_item(Control *p_theme_owner, Window *p_theme_owner_wind theme_owner_window = parent_w->theme_owner_window; } else { - theme_owner = NULL; - theme_owner_window = NULL; + theme_owner = nullptr; + theme_owner_window = nullptr; } } } @@ -1034,37 +1034,37 @@ int Control::get_constants(Control *p_theme_owner, Window *p_theme_owner_window, bool Control::has_theme_icon_override(const StringName &p_name) const { const Ref<Texture2D> *tex = data.icon_override.getptr(p_name); - return tex != NULL; + return tex != nullptr; } bool Control::has_theme_shader_override(const StringName &p_name) const { const Ref<Shader> *sdr = data.shader_override.getptr(p_name); - return sdr != NULL; + return sdr != nullptr; } bool Control::has_theme_stylebox_override(const StringName &p_name) const { const Ref<StyleBox> *style = data.style_override.getptr(p_name); - return style != NULL; + return style != nullptr; } bool Control::has_theme_font_override(const StringName &p_name) const { const Ref<Font> *font = data.font_override.getptr(p_name); - return font != NULL; + return font != nullptr; } bool Control::has_theme_color_override(const StringName &p_name) const { const Color *color = data.color_override.getptr(p_name); - return color != NULL; + return color != nullptr; } bool Control::has_theme_constant_override(const StringName &p_name) const { const int *constant = data.constant_override.getptr(p_name); - return constant != NULL; + return constant != nullptr; } bool Control::has_theme_icon(const StringName &p_name, const StringName &p_type) const { @@ -1890,17 +1890,17 @@ void Control::set_focus_mode(FocusMode p_focus_mode) { static Control *_next_control(Control *p_from) { if (p_from->is_set_as_toplevel()) - return NULL; // can't go above + return nullptr; // can't go above Control *parent = Object::cast_to<Control>(p_from->get_parent()); if (!parent) { - return NULL; + return nullptr; } int next = p_from->get_position_in_parent(); - ERR_FAIL_INDEX_V(next, parent->get_child_count(), NULL); + ERR_FAIL_INDEX_V(next, parent->get_child_count(), nullptr); for (int i = (next + 1); i < parent->get_child_count(); i++) { Control *c = Object::cast_to<Control>(parent->get_child(i)); @@ -1927,9 +1927,9 @@ Control *Control::find_next_valid_focus() const { Control *c; if (n) { c = Object::cast_to<Control>(n); - ERR_FAIL_COND_V_MSG(!c, NULL, "Next focus node is not a control: " + n->get_name() + "."); + ERR_FAIL_COND_V_MSG(!c, nullptr, "Next focus node is not a control: " + n->get_name() + "."); } else { - return NULL; + return nullptr; } if (c->is_visible() && c->get_focus_mode() != FOCUS_NONE) return c; @@ -1937,7 +1937,7 @@ Control *Control::find_next_valid_focus() const { // find next child - Control *next_child = NULL; + Control *next_child = nullptr; for (int i = 0; i < from->get_child_count(); i++) { @@ -1974,7 +1974,7 @@ Control *Control::find_next_valid_focus() const { } if (next_child == this) // no next control-> - return (get_focus_mode() == FOCUS_ALL) ? next_child : NULL; + return (get_focus_mode() == FOCUS_ALL) ? next_child : nullptr; if (next_child) { if (next_child->get_focus_mode() == FOCUS_ALL) return next_child; @@ -1983,12 +1983,12 @@ Control *Control::find_next_valid_focus() const { break; } - return NULL; + return nullptr; } static Control *_prev_control(Control *p_from) { - Control *child = NULL; + Control *child = nullptr; for (int i = p_from->get_child_count() - 1; i >= 0; i--) { Control *c = Object::cast_to<Control>(p_from->get_child(i)); @@ -2018,9 +2018,9 @@ Control *Control::find_prev_valid_focus() const { Control *c; if (n) { c = Object::cast_to<Control>(n); - ERR_FAIL_COND_V_MSG(!c, NULL, "Previous focus node is not a control: " + n->get_name() + "."); + ERR_FAIL_COND_V_MSG(!c, nullptr, "Previous focus node is not a control: " + n->get_name() + "."); } else { - return NULL; + return nullptr; } if (c->is_visible() && c->get_focus_mode() != FOCUS_NONE) return c; @@ -2028,7 +2028,7 @@ Control *Control::find_prev_valid_focus() const { // find prev child - Control *prev_child = NULL; + Control *prev_child = nullptr; if (from->is_set_as_toplevel() || !Object::cast_to<Control>(from->get_parent())) { @@ -2060,7 +2060,7 @@ Control *Control::find_prev_valid_focus() const { } if (prev_child == this) // no prev control-> - return (get_focus_mode() == FOCUS_ALL) ? prev_child : NULL; + return (get_focus_mode() == FOCUS_ALL) ? prev_child : nullptr; if (prev_child->get_focus_mode() == FOCUS_ALL) return prev_child; @@ -2068,7 +2068,7 @@ Control *Control::find_prev_valid_focus() const { from = prev_child; } - return NULL; + return nullptr; } Control::FocusMode Control::get_focus_mode() const { @@ -2221,7 +2221,7 @@ Control *Control::make_custom_tooltip(const String &p_text) const { if (get_script_instance()) { return const_cast<Control *>(this)->call("_make_custom_tooltip", p_text); } - return NULL; + return nullptr; } void Control::set_default_cursor_shape(CursorShape p_shape) { @@ -2288,19 +2288,19 @@ NodePath Control::get_focus_previous() const { Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) { - ERR_FAIL_INDEX_V((int)p_margin, 4, NULL); + ERR_FAIL_INDEX_V((int)p_margin, 4, nullptr); if (p_count >= MAX_NEIGHBOUR_SEARCH_COUNT) - return NULL; + return nullptr; if (!data.focus_neighbour[p_margin].is_empty()) { - Control *c = NULL; + Control *c = nullptr; Node *n = get_node(data.focus_neighbour[p_margin]); if (n) { c = Object::cast_to<Control>(n); - ERR_FAIL_COND_V_MSG(!c, NULL, "Neighbor focus node is not a control: " + n->get_name() + "."); + ERR_FAIL_COND_V_MSG(!c, nullptr, "Neighbor focus node is not a control: " + n->get_name() + "."); } else { - return NULL; + return nullptr; } bool valid = true; if (!c->is_visible()) @@ -2315,7 +2315,7 @@ Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) { } float dist = 1e7; - Control *result = NULL; + Control *result = nullptr; Point2 points[4]; @@ -2357,7 +2357,7 @@ Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) { } if (!base) - return NULL; + return nullptr; _window_find_focus_neighbour(vdir, base, points, maxd, dist, &result); @@ -2515,7 +2515,7 @@ Control::MouseFilter Control::get_mouse_filter() const { Control *Control::get_focus_owner() const { - ERR_FAIL_COND_V(!is_inside_tree(), NULL); + ERR_FAIL_COND_V(!is_inside_tree(), nullptr); return get_viewport()->_gui_get_focus_owner(); } @@ -2991,19 +2991,19 @@ void Control::_bind_methods() { } Control::Control() { - data.parent = NULL; + data.parent = nullptr; data.mouse_filter = MOUSE_FILTER_STOP; - data.RI = NULL; - data.theme_owner = NULL; - data.theme_owner_window = NULL; + data.RI = nullptr; + data.theme_owner = nullptr; + data.theme_owner_window = nullptr; data.default_cursor = CURSOR_ARROW; data.h_size_flags = SIZE_FILL; data.v_size_flags = SIZE_FILL; data.expand = 1; data.rotation = 0; - data.parent_canvas_item = NULL; + data.parent_canvas_item = nullptr; data.scale = Vector2(1, 1); data.block_minimum_size_adjust = false; diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index a4f0338f00..6be74d8d29 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -34,11 +34,11 @@ #include "core/print_string.h" #include "scene/gui/label.h" -FileDialog::GetIconFunc FileDialog::get_icon_func = NULL; -FileDialog::GetIconFunc FileDialog::get_large_icon_func = NULL; +FileDialog::GetIconFunc FileDialog::get_icon_func = nullptr; +FileDialog::GetIconFunc FileDialog::get_large_icon_func = nullptr; -FileDialog::RegisterFunc FileDialog::register_func = NULL; -FileDialog::RegisterFunc FileDialog::unregister_func = NULL; +FileDialog::RegisterFunc FileDialog::register_func = nullptr; +FileDialog::RegisterFunc FileDialog::unregister_func = nullptr; VBoxContainer *FileDialog::get_vbox() { return vbox; @@ -195,7 +195,7 @@ void FileDialog::_action_pressed() { if (mode == FILE_MODE_OPEN_FILES) { - TreeItem *ti = tree->get_next_selected(NULL); + TreeItem *ti = tree->get_next_selected(nullptr); String fbase = dir_access->get_current_dir(); Vector<String> files; @@ -543,7 +543,7 @@ void FileDialog::update_file_list() { files.pop_front(); } - if (tree->get_root() && tree->get_root()->get_children() && tree->get_selected() == NULL) + if (tree->get_root() && tree->get_root()->get_children() && tree->get_selected() == nullptr) tree->get_root()->get_children()->select(0); } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index fd7935b376..e37e93e2a9 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -854,7 +854,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { if (in_box) gn->set_selected(box_selection_mode_aditive); else - gn->set_selected(previus_selected.find(gn) != NULL); + gn->set_selected(previus_selected.find(gn) != nullptr); } top_layer->update(); @@ -872,7 +872,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { if (!gn) continue; - gn->set_selected(previus_selected.find(gn) != NULL); + gn->set_selected(previus_selected.find(gn) != nullptr); } top_layer->update(); } else { @@ -922,7 +922,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { if (b->get_button_index() == BUTTON_LEFT && b->is_pressed()) { - GraphNode *gn = NULL; + GraphNode *gn = nullptr; for (int i = get_child_count() - 1; i >= 0; i--) { @@ -1323,7 +1323,7 @@ GraphEdit::GraphEdit() { set_focus_mode(FOCUS_ALL); awaiting_scroll_offset_update = false; - top_layer = NULL; + top_layer = nullptr; top_layer = memnew(GraphEditFilter(this)); add_child(top_layer); top_layer->set_mouse_filter(MOUSE_FILTER_PASS); diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index c28a60ff87..5dbc5bc50d 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -593,7 +593,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) { Ref<InputEventMouseButton> mb = p_ev; if (mb.is_valid()) { - ERR_FAIL_COND_MSG(get_parent_control() == NULL, "GraphNode must be the child of a GraphEdit node."); + ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node."); if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 1ffc9712cc..bedcef2df2 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -282,7 +282,7 @@ void Label::_notification(int p_what) { from = from->next; } - wc = to ? to->next : 0; + wc = to ? to->next : nullptr; line++; } } @@ -404,7 +404,7 @@ void Label::regenerate_word_cache() { line_count = 1; total_char_cache = 0; - WordCache *last = NULL; + WordCache *last = nullptr; for (int i = 0; i <= xl_text.length(); i++) { @@ -447,7 +447,7 @@ void Label::regenerate_word_cache() { } if (i < xl_text.length() && xl_text[i] == ' ') { - if (line_width > 0 || last == NULL || last->char_pos != WordCache::CHAR_WRAPLINE) { + if (line_width > 0 || last == nullptr || last->char_pos != WordCache::CHAR_WRAPLINE) { space_count++; line_width += space_width; } else { @@ -697,7 +697,7 @@ Label::Label(const String &p_text) { align = ALIGN_LEFT; valign = VALIGN_TOP; xl_text = ""; - word_cache = NULL; + word_cache = nullptr; word_cache_dirty = true; autowrap = false; line_count = 0; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 6c5f77f874..b9b7560f2e 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -630,7 +630,7 @@ void LineEdit::drop_data(const Point2 &p_point, const Variant &p_data) { int selected = selection.end - selection.begin; Ref<Font> font = get_theme_font("font"); - if (font != NULL) { + if (font != nullptr) { for (int i = selection.begin; i < selection.end; i++) cached_width -= font->get_char_size(pass ? secret_character[0] : text[i]).width; } @@ -1001,7 +1001,7 @@ void LineEdit::paste_text() { } void LineEdit::undo() { - if (undo_stack_pos == NULL) { + if (undo_stack_pos == nullptr) { if (undo_stack.size() <= 1) { return; } @@ -1023,7 +1023,7 @@ void LineEdit::undo() { } void LineEdit::redo() { - if (undo_stack_pos == NULL) { + if (undo_stack_pos == nullptr) { return; } if (undo_stack_pos == undo_stack.back()) { @@ -1096,7 +1096,7 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) { while (ofs < text.length()) { int char_w = 0; - if (font != NULL) { + if (font != nullptr) { char_w = font->get_char_size(pass ? secret_character[0] : text[ofs]).width; } pixel_ofs += char_w; @@ -1148,7 +1148,7 @@ int LineEdit::get_cursor_pixel_pos() { } while (ofs < cursor_pos) { - if (font != NULL) { + if (font != nullptr) { pixel_ofs += font->get_char_size(pass ? secret_character[0] : text[ofs]).width; } ofs++; @@ -1207,7 +1207,7 @@ void LineEdit::delete_char() { if ((text.length() <= 0) || (cursor_pos == 0)) return; Ref<Font> font = get_theme_font("font"); - if (font != NULL) { + if (font != nullptr) { cached_width -= font->get_char_size(pass ? secret_character[0] : text[cursor_pos - 1]).width; } @@ -1226,7 +1226,7 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) { if (text.size() > 0) { Ref<Font> font = get_theme_font("font"); - if (font != NULL) { + if (font != nullptr) { for (int i = p_from_column; i < p_to_column; i++) cached_width -= font->get_char_size(pass ? secret_character[0] : text[i]).width; } @@ -1709,7 +1709,7 @@ void LineEdit::_emit_text_change() { void LineEdit::update_cached_width() { Ref<Font> font = get_theme_font("font"); cached_width = 0; - if (font != NULL) { + if (font != nullptr) { String text = get_text(); for (int i = 0; i < text.length(); i++) { cached_width += font->get_char_size(pass ? secret_character[0] : text[i]).width; @@ -1720,7 +1720,7 @@ void LineEdit::update_cached_width() { void LineEdit::update_placeholder_width() { Ref<Font> font = get_theme_font("font"); cached_placeholder_width = 0; - if (font != NULL) { + if (font != nullptr) { for (int i = 0; i < placeholder_translated.length(); i++) { cached_placeholder_width += font->get_char_size(placeholder_translated[i]).width; } @@ -1729,7 +1729,7 @@ void LineEdit::update_placeholder_width() { void LineEdit::_clear_redo() { _create_undo_state(); - if (undo_stack_pos == NULL) { + if (undo_stack_pos == nullptr) { return; } @@ -1744,7 +1744,7 @@ void LineEdit::_clear_redo() { void LineEdit::_clear_undo_stack() { undo_stack.clear(); - undo_stack_pos = NULL; + undo_stack_pos = nullptr; _create_undo_state(); } @@ -1865,7 +1865,7 @@ void LineEdit::_bind_methods() { LineEdit::LineEdit() { - undo_stack_pos = NULL; + undo_stack_pos = nullptr; _create_undo_state(); align = ALIGN_LEFT; cached_width = 0; diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index adc5f81465..ab2f64e1b4 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -236,7 +236,7 @@ void Range::_unref_shared() { shared->owners.erase(this); if (shared->owners.size() == 0) { memdelete(shared); - shared = NULL; + shared = nullptr; } } } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index d17eec4050..5fb2243aff 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -53,7 +53,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) { return p_item->subitems.front()->get(); } else if (!p_item->parent) { - return NULL; + return nullptr; } else if (p_item->E->next()) { return p_item->E->next()->get(); @@ -66,7 +66,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) { if (p_item->parent) return p_item->E->next()->get(); else - return NULL; + return nullptr; } } else { @@ -74,7 +74,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) { return p_item->subitems.front()->get(); } else if (p_item->type == ITEM_FRAME) { - return NULL; + return nullptr; } else if (p_item->E->next()) { return p_item->E->next()->get(); @@ -87,11 +87,11 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) { if (p_item->type != ITEM_FRAME) return p_item->E->next()->get(); else - return NULL; + return nullptr; } } - return NULL; + return nullptr; } RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) { @@ -101,7 +101,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) { return p_item->subitems.back()->get(); } else if (!p_item->parent) { - return NULL; + return nullptr; } else if (p_item->E->prev()) { return p_item->E->prev()->get(); @@ -114,7 +114,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) { if (p_item->parent) return p_item->E->prev()->get(); else - return NULL; + return nullptr; } } else { @@ -122,7 +122,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) { return p_item->subitems.back()->get(); } else if (p_item->type == ITEM_FRAME) { - return NULL; + return nullptr; } else if (p_item->E->prev()) { return p_item->E->prev()->get(); @@ -135,11 +135,11 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) { if (p_item->type != ITEM_FRAME) return p_item->E->prev()->get(); else - return NULL; + return nullptr; } } - return NULL; + return nullptr; } Rect2 RichTextLabel::_get_text_rect() { @@ -158,7 +158,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & ci = get_canvas_item(); if (r_click_item) - *r_click_item = NULL; + *r_click_item = nullptr; } Line &l = p_frame->lines.write[p_line]; Item *it = l.from; @@ -356,7 +356,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & Color font_color_shadow; bool underline = false; bool strikethrough = false; - ItemFade *fade = NULL; + ItemFade *fade = nullptr; int it_char_start = p_char_count; Vector<ItemFX *> fx_stack = Vector<ItemFX *>(); @@ -915,7 +915,7 @@ void RichTextLabel::_update_scroll() { void RichTextLabel::_update_fx(RichTextLabel::ItemFrame *p_frame, float p_delta_time) { Item *it = p_frame; while (it) { - ItemFX *ifx = NULL; + ItemFX *ifx = nullptr; if (it->type == ITEM_CUSTOMFX || it->type == ITEM_SHAKE || it->type == ITEM_WAVE || it->type == ITEM_TORNADO || it->type == ITEM_RAINBOW) { ifx = static_cast<ItemFX *>(it); @@ -928,7 +928,7 @@ void RichTextLabel::_update_fx(RichTextLabel::ItemFrame *p_frame, float p_delta_ ifx->elapsed_time += p_delta_time; - ItemShake *shake = NULL; + ItemShake *shake = nullptr; if (it->type == ITEM_SHAKE) { shake = static_cast<ItemShake *>(it); @@ -952,7 +952,7 @@ void RichTextLabel::_notification(int p_what) { case NOTIFICATION_MOUSE_EXIT: { if (meta_hovering) { - meta_hovering = NULL; + meta_hovering = nullptr; emit_signal("meta_hover_ended", current_meta); current_meta = false; update(); @@ -1022,7 +1022,7 @@ void RichTextLabel::_notification(int p_what) { visible_line_count = 0; while (y < size.height && from_line < main->lines.size()) { - visible_line_count += _process_line(main, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_DRAW, base_font, base_color, font_color_shadow, use_outline, shadow_ofs, Point2i(), NULL, NULL, NULL, total_chars); + visible_line_count += _process_line(main, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_DRAW, base_font, base_color, font_color_shadow, use_outline, shadow_ofs, Point2i(), nullptr, nullptr, nullptr, total_chars); total_chars += main->lines[from_line].char_count; from_line++; @@ -1040,7 +1040,7 @@ void RichTextLabel::_notification(int p_what) { void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item **r_click_item, int *r_click_char, bool *r_outside) { if (r_click_item) - *r_click_item = NULL; + *r_click_item = nullptr; Rect2 text_rect = _get_text_rect(); int ofs = vscroll->get_value(); @@ -1086,11 +1086,11 @@ Control::CursorShape RichTextLabel::get_cursor_shape(const Point2 &p_pos) const return CURSOR_ARROW; //invalid int line = 0; - Item *item = NULL; + Item *item = nullptr; bool outside; ((RichTextLabel *)(this))->_find_click(main, p_pos, &item, &line, &outside); - if (item && !outside && ((RichTextLabel *)(this))->_find_meta(item, NULL)) + if (item && !outside && ((RichTextLabel *)(this))->_find_meta(item, nullptr)) return CURSOR_POINTING_HAND; return CURSOR_ARROW; @@ -1108,7 +1108,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { if (b->is_pressed() && !b->is_doubleclick()) { scroll_updated = false; int line = 0; - Item *item = NULL; + Item *item = nullptr; bool outside; _find_click(main, b->get_position(), &item, &line, &outside); @@ -1122,9 +1122,9 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { // Erase previous selection. if (selection.active) { - selection.from = NULL; + selection.from = nullptr; selection.from_char = '\0'; - selection.to = NULL; + selection.to = nullptr; selection.to_char = '\0'; selection.active = false; @@ -1136,7 +1136,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { //doubleclick: select word int line = 0; - Item *item = NULL; + Item *item = nullptr; bool outside; _find_click(main, b->get_position(), &item, &line, &outside); @@ -1163,11 +1163,11 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { } } else if (!b->is_pressed()) { - selection.click = NULL; + selection.click = nullptr; if (!b->is_doubleclick() && !scroll_updated) { int line = 0; - Item *item = NULL; + Item *item = nullptr; bool outside; _find_click(main, b->get_position(), &item, &line, &outside); @@ -1276,7 +1276,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { return; int line = 0; - Item *item = NULL; + Item *item = nullptr; bool outside; _find_click(main, m->get_position(), &item, &line, &outside); @@ -1325,7 +1325,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { emit_signal("meta_hover_started", meta); } } else if (meta_hovering) { - meta_hovering = NULL; + meta_hovering = nullptr; emit_signal("meta_hover_ended", current_meta); current_meta = false; } @@ -1641,7 +1641,7 @@ void RichTextLabel::_add_item(Item *p_item, bool p_enter, bool p_ensure_newline) } } - if (current_frame->lines[current_frame->lines.size() - 1].from == NULL) { + if (current_frame->lines[current_frame->lines.size() - 1].from == nullptr) { current_frame->lines.write[current_frame->lines.size() - 1].from = p_item; } p_item->line = current_frame->lines.size() - 1; @@ -1938,7 +1938,7 @@ void RichTextLabel::push_cell() { item->cell = true; item->parent_line = item->parent_frame->lines.size() - 1; item->lines.resize(1); - item->lines.write[0].from = NULL; + item->lines.write[0].from = nullptr; item->first_invalid_line = 0; } @@ -1969,7 +1969,7 @@ void RichTextLabel::clear() { main->lines.resize(1); main->first_invalid_line = 0; update(); - selection.click = NULL; + selection.click = nullptr; selection.active = false; current_idx = 1; @@ -2953,7 +2953,7 @@ RichTextLabel::RichTextLabel() { tab_size = 4; default_align = ALIGN_LEFT; underline_meta = true; - meta_hovering = NULL; + meta_hovering = nullptr; override_selected_font_color = false; scroll_visible = false; @@ -2977,7 +2977,7 @@ RichTextLabel::RichTextLabel() { current_idx = 1; use_bbcode = false; - selection.click = NULL; + selection.click = nullptr; selection.active = false; selection.enabled = false; diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index 495e839958..7f2b5facb9 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -98,7 +98,7 @@ private: int maximum_width; Line() { - from = NULL; + from = nullptr; char_count = 0; } }; @@ -119,8 +119,8 @@ private: } Item() { - parent = NULL; - E = NULL; + parent = nullptr; + E = nullptr; line = 0; index = 0; type = ITEM_FRAME; @@ -137,7 +137,7 @@ private: ItemFrame() { type = ITEM_FRAME; - parent_frame = NULL; + parent_frame = nullptr; cell = false; parent_line = 0; } @@ -370,8 +370,8 @@ private: int visible_characters; float percent_visible; - int _process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Color &p_font_color_shadow, bool p_shadow_as_outline, const Point2 &shadow_ofs, const Point2i &p_click_pos = Point2i(), Item **r_click_item = NULL, int *r_click_char = NULL, bool *r_outside = NULL, int p_char_count = 0); - void _find_click(ItemFrame *p_frame, const Point2i &p_click, Item **r_click_item = NULL, int *r_click_char = NULL, bool *r_outside = NULL); + int _process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Color &p_font_color_shadow, bool p_shadow_as_outline, const Point2 &shadow_ofs, const Point2i &p_click_pos = Point2i(), Item **r_click_item = nullptr, int *r_click_char = nullptr, bool *r_outside = nullptr, int p_char_count = 0); + void _find_click(ItemFrame *p_frame, const Point2i &p_click, Item **r_click_item = nullptr, int *r_click_char = nullptr, bool *r_outside = nullptr); Ref<Font> _find_font(Item *p_item); int _find_margin(Item *p_item, const Ref<Font> &p_base_font); @@ -379,7 +379,7 @@ private: Color _find_color(Item *p_item, const Color &p_default_color); bool _find_underline(Item *p_item); bool _find_strikethrough(Item *p_item); - bool _find_meta(Item *p_item, Variant *r_meta, ItemMeta **r_item = NULL); + bool _find_meta(Item *p_item, Variant *r_meta, ItemMeta **r_item = nullptr); bool _find_layout_subitem(Item *from, Item *to); bool _find_by_type(Item *p_item, ItemType p_type); void _fetch_item_fx_stack(Item *p_item, Vector<ItemFX *> &r_stack); diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 5e9541730e..1c63c25e28 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -308,7 +308,7 @@ void ScrollBar::_notification(int p_what) { drag_node->disconnect("tree_exiting", callable_mp(this, &ScrollBar::_drag_node_exit)); } - drag_node = NULL; + drag_node = nullptr; } if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) { @@ -542,7 +542,7 @@ void ScrollBar::_drag_node_exit() { if (drag_node) { drag_node->disconnect("gui_input", callable_mp(this, &ScrollBar::_drag_node_input)); } - drag_node = NULL; + drag_node = nullptr; } void ScrollBar::_drag_node_input(const Ref<InputEvent> &p_input) { @@ -616,7 +616,7 @@ void ScrollBar::set_drag_node(const NodePath &p_path) { } } - drag_node = NULL; + drag_node = nullptr; drag_node_path = p_path; if (is_inside_tree()) { @@ -662,7 +662,7 @@ ScrollBar::ScrollBar(Orientation p_orientation) { orientation = p_orientation; highlight = HIGHLIGHT_NONE; custom_step = -1; - drag_node = NULL; + drag_node = nullptr; drag.active = false; diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index ccfa8ebf63..8572d570fb 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -60,7 +60,7 @@ void SpinBox::_text_entered(const String &p_string) { return; } - Variant value = expr->execute(Array(), NULL, false); + Variant value = expr->execute(Array(), nullptr, false); if (value.get_type() != Variant::NIL) { set_value(value); _value_changed(0); diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index 4eb614a9ac..de892a4fb9 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -50,7 +50,7 @@ Control *SplitContainer::_getch(int p_idx) const { idx++; } - return NULL; + return nullptr; } void SplitContainer::_resort() { diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 7cecbf7fa2..de80049862 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -602,7 +602,7 @@ Control *TabContainer::get_tab_control(int p_idx) const { if (p_idx >= 0 && p_idx < tabs.size()) return tabs[p_idx]; else - return NULL; + return nullptr; } Control *TabContainer::get_current_tab_control() const { @@ -611,7 +611,7 @@ Control *TabContainer::get_current_tab_control() const { if (current >= 0 && current < tabs.size()) return tabs[current]; else - return NULL; + return nullptr; } void TabContainer::remove_child_notify(Node *p_child) { @@ -1041,7 +1041,7 @@ TabContainer::TabContainer() { previous = 0; align = ALIGN_CENTER; tabs_visible = true; - popup = NULL; + popup = nullptr; drag_to_rearrange_enabled = false; tabs_rearrange_group = -1; use_hidden_tabs_for_min_size = false; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 7071652f2a..36e35897d1 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2186,7 +2186,7 @@ Vector2i TextEdit::_get_cursor_pixel_pos() { int x = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width + cache.info_gutter_width - cursor.x_ofs; int ix = 0; while (ix < rows2[0].size() && ix < cursor.column) { - if (cache.font != NULL) { + if (cache.font != nullptr) { x += cache.font->get_char_size(rows2[0].get(ix)).width; } ix++; @@ -3990,7 +3990,7 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i text.set_breakpoint(p_line, false); text.set_hidden(p_line, false); - text.set_info_icon(p_line, NULL, ""); + text.set_info_icon(p_line, nullptr, ""); } text.set_line_wrap_amount(p_line, -1); @@ -6087,7 +6087,7 @@ void TextEdit::_do_text_op(const TextOperation &p_op, bool p_reverse) { void TextEdit::_clear_redo() { - if (undo_stack_pos == NULL) + if (undo_stack_pos == nullptr) return; // Nothing to clear. _push_current_op(); @@ -6103,7 +6103,7 @@ void TextEdit::undo() { _push_current_op(); - if (undo_stack_pos == NULL) { + if (undo_stack_pos == nullptr) { if (!undo_stack.size()) return; // Nothing to undo. @@ -6152,7 +6152,7 @@ void TextEdit::redo() { _push_current_op(); - if (undo_stack_pos == NULL) + if (undo_stack_pos == nullptr) return; // Nothing to do. deselect(); @@ -6184,7 +6184,7 @@ void TextEdit::clear_undo_history() { saved_version = 0; current_op.type = TextOperation::TYPE_NONE; - undo_stack_pos = NULL; + undo_stack_pos = nullptr; undo_stack.clear(); } @@ -6633,8 +6633,8 @@ void TextEdit::_update_completion_candidates() { const CharType *tgt = &option.display[0]; const CharType *tgt_lower = &display_lower[0]; - const CharType *ssq_last_tgt = NULL; - const CharType *ssq_lower_last_tgt = NULL; + const CharType *ssq_last_tgt = nullptr; + const CharType *ssq_lower_last_tgt = nullptr; for (; *tgt; tgt++, tgt_lower++) { if (*ssq == *tgt) { @@ -6701,7 +6701,7 @@ void TextEdit::query_code_comple() { bool ignored = completion_active && !completion_options.empty(); if (ignored) { ScriptCodeCompletionOption::Kind kind = ScriptCodeCompletionOption::KIND_PLAIN_TEXT; - const ScriptCodeCompletionOption *previous_option = NULL; + const ScriptCodeCompletionOption *previous_option = nullptr; for (int i = 0; i < completion_options.size(); i++) { const ScriptCodeCompletionOption ¤t_option = completion_options[i]; if (!previous_option) { @@ -7259,7 +7259,7 @@ TextEdit::TextEdit() { wrap_at = 0; wrap_right_offset = 10; set_focus_mode(FOCUS_ALL); - syntax_highlighter = NULL; + syntax_highlighter = nullptr; _update_caches(); cache.row_height = 1; cache.line_spacing = 1; @@ -7323,7 +7323,7 @@ TextEdit::TextEdit() { current_op.type = TextOperation::TYPE_NONE; undo_enabled = true; - undo_stack_pos = NULL; + undo_stack_pos = nullptr; setting_text = false; last_dblclk = 0; current_op.version = 0; @@ -7333,7 +7333,7 @@ TextEdit::TextEdit() { completion_enabled = false; completion_active = false; completion_line_ofs = 0; - tooltip_obj = NULL; + tooltip_obj = nullptr; line_numbers = false; line_numbers_zero_padded = false; line_length_guidelines = false; @@ -7394,7 +7394,7 @@ Map<int, TextEdit::HighlighterInfo> TextEdit::_get_line_syntax_highlighting(int return syntax_highlighting_cache[p_line]; } - if (syntax_highlighter != NULL) { + if (syntax_highlighter != nullptr) { Map<int, HighlighterInfo> color_map = syntax_highlighter->_get_line_syntax_highlighting(p_line); syntax_highlighting_cache[p_line] = color_map; return color_map; @@ -7508,7 +7508,7 @@ Map<int, TextEdit::HighlighterInfo> TextEdit::_get_line_syntax_highlighting(int if (col) { for (int k = j - 1; k >= 0; k--) { if (str[k] == '.') { - col = NULL; // Member indexing not allowed. + col = nullptr; // Member indexing not allowed. break; } else if (str[k] > 32) { break; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 7d096f7897..ef8c39d32f 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -530,7 +530,7 @@ private: protected: virtual String get_tooltip(const Point2 &p_pos) const; - void _insert_text(int p_line, int p_char, const String &p_text, int *r_end_line = NULL, int *r_end_char = NULL); + void _insert_text(int p_line, int p_char, const String &p_text, int *r_end_line = nullptr, int *r_end_char = nullptr); void _remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column); void _insert_text_at_cursor(const String &p_text); void _gui_input(const Ref<InputEvent> &p_gui_input); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 87425b49cd..a7acaae8df 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -71,7 +71,7 @@ void TreeItem::move_to_bottom() { parent->children = next; } last->next = this; - next = NULL; + next = nullptr; } Size2 TreeItem::Cell::get_icon_size() const { @@ -371,7 +371,7 @@ TreeItem *TreeItem::get_next() { TreeItem *TreeItem::get_prev() { if (!parent || parent->children == this) - return NULL; + return nullptr; TreeItem *prev = parent->children; while (prev && prev->next != this) @@ -400,7 +400,7 @@ TreeItem *TreeItem::get_prev_visible(bool p_wrap) { current = current->parent; if (current == tree->root && tree->hide_root) { - return NULL; + return nullptr; } else if (!current) { if (p_wrap) { current = this; @@ -410,7 +410,7 @@ TreeItem *TreeItem::get_prev_visible(bool p_wrap) { temp = temp->get_next_visible(); } } else { - return NULL; + return nullptr; } } } else { @@ -450,7 +450,7 @@ TreeItem *TreeItem::get_next_visible(bool p_wrap) { if (p_wrap) return tree->root; else - return NULL; + return nullptr; } else { current = current->next; } @@ -472,7 +472,7 @@ void TreeItem::remove_child(TreeItem *p_item) { *c = (*c)->next; - aux->parent = NULL; + aux->parent = nullptr; return; } @@ -890,11 +890,11 @@ void TreeItem::clear_children() { TreeItem *aux = c; c = c->get_next(); - aux->parent = 0; // so it won't try to recursively autoremove from me in here + aux->parent = nullptr; // so it won't try to recursively autoremove from me in here memdelete(aux); } - children = 0; + children = nullptr; }; TreeItem::TreeItem(Tree *p_tree) { @@ -904,9 +904,9 @@ TreeItem::TreeItem(Tree *p_tree) { disable_folding = false; custom_min_height = 0; - parent = 0; // parent item - next = 0; // next in list - children = 0; //child items + parent = nullptr; // parent item + next = nullptr; // next in list + children = nullptr; //child items } TreeItem::~TreeItem() { @@ -918,29 +918,29 @@ TreeItem::~TreeItem() { if (tree && tree->root == this) { - tree->root = 0; + tree->root = nullptr; } if (tree && tree->popup_edited_item == this) { - tree->popup_edited_item = NULL; + tree->popup_edited_item = nullptr; tree->pressing_for_editor = false; } if (tree && tree->cache.hover_item == this) { - tree->cache.hover_item = NULL; + tree->cache.hover_item = nullptr; } if (tree && tree->selected_item == this) - tree->selected_item = NULL; + tree->selected_item = nullptr; if (tree && tree->drop_mode_over == this) - tree->drop_mode_over = NULL; + tree->drop_mode_over = nullptr; if (tree && tree->single_select_defer == this) - tree->single_select_defer = NULL; + tree->single_select_defer = nullptr; if (tree && tree->edited_item == this) { - tree->edited_item = NULL; + tree->edited_item = nullptr; tree->pressing_for_editor = false; } } @@ -1498,7 +1498,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 int parent_ofs = p_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin); Point2i root_pos = Point2i(root_ofs, children_pos.y + label_h / 2) - cache.offset + p_draw_ofs; - if (c->get_children() != NULL) + if (c->get_children() != nullptr) root_pos -= Point2i(cache.arrow->get_width(), 0); float line_width = 1.0; @@ -2131,7 +2131,7 @@ void Tree::popup_select(int p_option) { void Tree::_go_left() { if (selected_col == 0) { - if (selected_item->get_children() != NULL && !selected_item->is_collapsed()) { + if (selected_item->get_children() != nullptr && !selected_item->is_collapsed()) { selected_item->set_collapsed(true); } else { if (columns.size() == 1) { // goto parent with one column @@ -2160,7 +2160,7 @@ void Tree::_go_left() { void Tree::_go_right() { if (selected_col == (columns.size() - 1)) { - if (selected_item->get_children() != NULL && selected_item->is_collapsed()) { + if (selected_item->get_children() != nullptr && selected_item->is_collapsed()) { selected_item->set_collapsed(false); } else if (selected_item->get_next_visible()) { selected_col = 0; @@ -2181,7 +2181,7 @@ void Tree::_go_right() { } void Tree::_go_up() { - TreeItem *prev = NULL; + TreeItem *prev = nullptr; if (!selected_item) { prev = get_last_item(); selected_col = 0; @@ -2221,7 +2221,7 @@ void Tree::_go_up() { } void Tree::_go_down() { - TreeItem *next = NULL; + TreeItem *next = nullptr; if (!selected_item) { if (root) { @@ -2324,7 +2324,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { if (!cursor_can_exit_tree) accept_event(); - TreeItem *next = NULL; + TreeItem *next = nullptr; if (!selected_item) return; next = selected_item; @@ -2362,7 +2362,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { if (!cursor_can_exit_tree) accept_event(); - TreeItem *prev = NULL; + TreeItem *prev = nullptr; if (!selected_item) return; prev = selected_item; @@ -2584,7 +2584,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { if (single_select_defer) { select_single_item(single_select_defer, root, single_select_defer_column); - single_select_defer = NULL; + single_select_defer = nullptr; } range_click_timer->stop(); @@ -2609,7 +2609,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { pressing_for_editor = false; } - if (cache.click_type == Cache::CLICK_BUTTON && cache.click_item != NULL) { + if (cache.click_type == Cache::CLICK_BUTTON && cache.click_item != nullptr) { // make sure in case of wrong reference after reconstructing whole TreeItems cache.click_item = get_item_at_position(cache.click_pos); emit_signal("button_pressed", cache.click_item, cache.click_column, cache.click_id); @@ -2617,7 +2617,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { cache.click_type = Cache::CLICK_NONE; cache.click_index = -1; cache.click_id = -1; - cache.click_item = NULL; + cache.click_item = nullptr; cache.click_column = 0; if (drag_touching) { @@ -2711,7 +2711,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { } if (b->get_button_index() == BUTTON_LEFT) { - if (get_item_at_position(b->get_position()) == NULL && !b->get_shift() && !b->get_control() && !b->get_command()) + if (get_item_at_position(b->get_position()) == nullptr && !b->get_shift() && !b->get_control() && !b->get_command()) emit_signal("nothing_selected"); } } @@ -2946,7 +2946,7 @@ void Tree::_notification(int p_what) { } if (p_what == NOTIFICATION_DRAG_BEGIN) { - single_select_defer = NULL; + single_select_defer = nullptr; if (cache.scroll_speed > 0) { scrolling = true; set_physics_process_internal(true); @@ -3076,7 +3076,7 @@ void Tree::_notification(int p_what) { if (p_what == NOTIFICATION_RESIZED || p_what == NOTIFICATION_TRANSFORM_CHANGED) { - if (popup_edited_item != NULL) { + if (popup_edited_item != nullptr) { Rect2 rect = popup_edited_item->get_meta("__focus_rect"); Vector2 ofs(0, (text_editor->get_size().height - rect.size.height) / 2); Point2i textedpos = get_global_position() + rect.position - ofs; @@ -3097,18 +3097,18 @@ Size2 Tree::get_minimum_size() const { TreeItem *Tree::create_item(TreeItem *p_parent, int p_idx) { - ERR_FAIL_COND_V(blocked > 0, NULL); + ERR_FAIL_COND_V(blocked > 0, nullptr); - TreeItem *ti = NULL; + TreeItem *ti = nullptr; if (p_parent) { // Append or insert a new item to the given parent. ti = memnew(TreeItem(this)); - ERR_FAIL_COND_V(!ti, NULL); + ERR_FAIL_COND_V(!ti, nullptr); ti->cells.resize(columns.size()); - TreeItem *prev = NULL; + TreeItem *prev = nullptr; TreeItem *c = p_parent->children; int idx = 0; @@ -3132,7 +3132,7 @@ TreeItem *Tree::create_item(TreeItem *p_parent, int p_idx) { if (!root) { // No root exists, make the given item the new root. ti = memnew(TreeItem(this)); - ERR_FAIL_COND_V(!ti, NULL); + ERR_FAIL_COND_V(!ti, nullptr); ti->cells.resize(columns.size()); root = ti; @@ -3227,7 +3227,7 @@ void Tree::deselect_all() { ERR_FAIL_COND(item == prev_item); } - selected_item = NULL; + selected_item = nullptr; selected_col = -1; update(); @@ -3235,7 +3235,7 @@ void Tree::deselect_all() { bool Tree::is_anything_selected() { - return (selected_item != NULL); + return (selected_item != nullptr); } void Tree::clear() { @@ -3253,12 +3253,12 @@ void Tree::clear() { if (root) { memdelete(root); - root = NULL; + root = nullptr; }; - selected_item = NULL; - edited_item = NULL; - popup_edited_item = NULL; + selected_item = nullptr; + edited_item = nullptr; + popup_edited_item = nullptr; update(); }; @@ -3315,10 +3315,10 @@ TreeItem *Tree::get_next_selected(TreeItem *p_item) { /* if (!p_item) - return NULL; + return nullptr; */ if (!root) - return NULL; + return nullptr; while (true) { @@ -3338,8 +3338,8 @@ TreeItem *Tree::get_next_selected(TreeItem *p_item) { while (!p_item->next) { p_item = p_item->parent; - if (p_item == NULL) - return NULL; + if (p_item == nullptr) + return nullptr; } p_item = p_item->next; @@ -3351,7 +3351,7 @@ TreeItem *Tree::get_next_selected(TreeItem *p_item) { return p_item; } - return NULL; + return nullptr; } int Tree::get_column_width(int p_column) const { @@ -3458,7 +3458,7 @@ int Tree::get_item_offset(TreeItem *p_item) const { while (!it->next) { it = it->parent; - if (it == NULL) + if (it == nullptr) return 0; } @@ -3626,7 +3626,7 @@ TreeItem *Tree::_search_item_text(TreeItem *p_at, const String &p_find, int *r_c break; } - return NULL; + return nullptr; } TreeItem *Tree::search_item_text(const String &p_find, int *r_col, bool p_selectable) { @@ -3636,7 +3636,7 @@ TreeItem *Tree::search_item_text(const String &p_find, int *r_col, bool p_select if (!from) from = root; if (!from) - return NULL; + return nullptr; return _search_item_text(from->get_next_visible(true), p_find, r_col, p_selectable); } @@ -3649,7 +3649,7 @@ TreeItem *Tree::get_item_with_text(const String &p_find) const { } } } - return NULL; + return nullptr; } void Tree::_do_incr_search(const String &p_add) { @@ -3703,7 +3703,7 @@ TreeItem *Tree::_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_ pos.x -= w; } - return NULL; + return nullptr; } else { pos.y -= h; @@ -3714,7 +3714,7 @@ TreeItem *Tree::_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_ } if (p_item->is_collapsed()) - return NULL; // do not try children, it's collapsed + return nullptr; // do not try children, it's collapsed TreeItem *n = p_item->get_children(); while (n) { @@ -3728,7 +3728,7 @@ TreeItem *Tree::_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_ n = n->get_next(); } - return NULL; + return nullptr; } int Tree::get_column_at_position(const Point2 &p_pos) const { @@ -3790,7 +3790,7 @@ TreeItem *Tree::get_item_at_position(const Point2 &p_pos) const { pos -= cache.bg->get_offset(); pos.y -= _get_title_button_height(); if (pos.y < 0) - return NULL; + return nullptr; if (h_scroll->is_visible_in_tree()) pos.x += h_scroll->get_value(); @@ -3806,7 +3806,7 @@ TreeItem *Tree::get_item_at_position(const Point2 &p_pos) const { } } - return NULL; + return nullptr; } String Tree::get_tooltip(const Point2 &p_pos) const { @@ -3883,7 +3883,7 @@ void Tree::set_drop_mode_flags(int p_flags) { return; drop_mode_flags = p_flags; if (drop_mode_flags == 0) { - drop_mode_over = NULL; + drop_mode_over = nullptr; } update(); @@ -4015,17 +4015,17 @@ Tree::Tree() { selected_col = 0; columns.resize(1); - selected_item = NULL; - edited_item = NULL; + selected_item = nullptr; + edited_item = nullptr; selected_col = -1; edited_col = -1; hide_root = false; select_mode = SELECT_SINGLE; - root = 0; - popup_menu = NULL; - popup_edited_item = NULL; - text_editor = NULL; + root = nullptr; + popup_menu = nullptr; + popup_edited_item = nullptr; + text_editor = nullptr; set_focus_mode(FOCUS_ALL); popup_menu = memnew(PopupMenu); @@ -4078,7 +4078,7 @@ Tree::Tree() { cache.hover_index = -1; cache.click_index = -1; cache.click_id = -1; - cache.click_item = NULL; + cache.click_item = nullptr; cache.click_column = 0; cache.hover_cell = -1; last_keypress = 0; @@ -4098,9 +4098,9 @@ Tree::Tree() { hide_folding = false; drop_mode_flags = 0; - drop_mode_over = NULL; + drop_mode_over = nullptr; drop_mode_section = 0; - single_select_defer = NULL; + single_select_defer = nullptr; scrolling = false; allow_rmb_select = false; @@ -4108,7 +4108,7 @@ Tree::Tree() { set_clip_contents(true); - cache.hover_item = NULL; + cache.hover_item = nullptr; cache.hover_cell = -1; allow_reselect = false; diff --git a/scene/gui/tree.h b/scene/gui/tree.h index becbe76598..87c2588a12 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -383,7 +383,7 @@ private: //void draw_item_text(String p_text,const Ref<Texture2D>& p_icon,int p_icon_max_w,bool p_tool,Rect2i p_rect,const Color& p_color); void draw_item_rect(const TreeItem::Cell &p_cell, const Rect2i &p_rect, const Color &p_color, const Color &p_icon_color); int draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 &p_draw_size, TreeItem *p_item); - void select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_col, TreeItem *p_prev = NULL, bool *r_in_range = NULL, bool p_force_deselect = false); + void select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_col, TreeItem *p_prev = nullptr, bool *r_in_range = nullptr, bool p_force_deselect = false); int propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool p_doubleclick, TreeItem *p_item, int p_button, const Ref<InputEventWithModifiers> &p_mod); void _text_editor_enter(String p_text); void _text_editor_modal_close(); @@ -584,7 +584,7 @@ public: bool edit_selected(); // First item that starts with the text, from the current focused item down and wraps around. - TreeItem *search_item_text(const String &p_find, int *r_col = NULL, bool p_selectable = false); + TreeItem *search_item_text(const String &p_find, int *r_col = nullptr, bool p_selectable = false); // First item that matches the whole text, from the first item down. TreeItem *get_item_with_text(const String &p_find) const; diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index 4a415415f1..6fb5cbacbd 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -43,9 +43,9 @@ #include "servers/rendering_server.h" Mutex CanvasItemMaterial::material_mutex; -SelfList<CanvasItemMaterial>::List *CanvasItemMaterial::dirty_materials = NULL; +SelfList<CanvasItemMaterial>::List *CanvasItemMaterial::dirty_materials = nullptr; Map<CanvasItemMaterial::MaterialKey, CanvasItemMaterial::ShaderData> CanvasItemMaterial::shader_map; -CanvasItemMaterial::ShaderNames *CanvasItemMaterial::shader_names = NULL; +CanvasItemMaterial::ShaderNames *CanvasItemMaterial::shader_names = nullptr; void CanvasItemMaterial::init_shaders() { @@ -62,7 +62,7 @@ void CanvasItemMaterial::finish_shaders() { memdelete(dirty_materials); memdelete(shader_names); - dirty_materials = NULL; + dirty_materials = nullptr; } void CanvasItemMaterial::_update_shader() { @@ -411,7 +411,7 @@ void CanvasItem::hide() { _change_notify("visible"); } -CanvasItem *CanvasItem::current_item_drawn = NULL; +CanvasItem *CanvasItem::current_item_drawn = nullptr; CanvasItem *CanvasItem::get_current_item_drawn() { return current_item_drawn; } @@ -435,9 +435,9 @@ void CanvasItem::_update_callback() { notification(NOTIFICATION_DRAW); emit_signal(SceneStringNames::get_singleton()->draw); if (get_script_instance()) { - get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_draw, NULL, 0); + get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_draw, nullptr, 0); } - current_item_drawn = NULL; + current_item_drawn = nullptr; drawing = false; } //todo updating = false @@ -504,7 +504,7 @@ void CanvasItem::_enter_canvas() { Node *n = this; - canvas_layer = NULL; + canvas_layer = nullptr; while (n) { @@ -554,7 +554,7 @@ void CanvasItem::_exit_canvas() { notification(NOTIFICATION_EXIT_CANVAS, true); //reverse the notification RenderingServer::get_singleton()->canvas_item_set_parent(canvas_item, RID()); - canvas_layer = NULL; + canvas_layer = nullptr; group = ""; } @@ -617,7 +617,7 @@ void CanvasItem::_notification(int p_what) { _exit_canvas(); if (C) { Object::cast_to<CanvasItem>(get_parent())->children_items.erase(C); - C = NULL; + C = nullptr; } if (window) { window->disconnect(SceneStringNames::get_singleton()->visibility_changed, callable_mp(this, &CanvasItem::_window_visibility_changed)); @@ -703,7 +703,7 @@ bool CanvasItem::is_set_as_toplevel() const { CanvasItem *CanvasItem::get_parent_item() const { if (toplevel) - return NULL; + return nullptr; return Object::cast_to<CanvasItem>(get_parent()); } @@ -1470,7 +1470,7 @@ CanvasItem::CanvasItem() : behind = false; block_transform_notify = false; //viewport=NULL; - canvas_layer = NULL; + canvas_layer = nullptr; use_parent_material = false; global_invalid = true; notify_local_transform = false; @@ -1481,7 +1481,7 @@ CanvasItem::CanvasItem() : texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR; texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED; - C = NULL; + C = nullptr; } CanvasItem::~CanvasItem() { diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index e6a665d035..15f64390de 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -320,13 +320,13 @@ void CanvasLayer::_bind_methods() { CanvasLayer::CanvasLayer() { - vp = NULL; + vp = nullptr; scale = Vector2(1, 1); rot = 0; locrotscale_dirty = false; layer = 1; canvas = RS::get_singleton()->canvas_create(); - custom_viewport = NULL; + custom_viewport = nullptr; sort_index = 0; follow_viewport = false; diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index fee2ada76d..dc0da015ac 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -162,12 +162,12 @@ void HTTPRequest::cancel_request() { thread_request_quit = true; Thread::wait_to_finish(thread); memdelete(thread); - thread = NULL; + thread = nullptr; } if (file) { memdelete(file); - file = NULL; + file = nullptr; } client->close(); body.resize(0); @@ -566,7 +566,7 @@ void HTTPRequest::_bind_methods() { HTTPRequest::HTTPRequest() { - thread = NULL; + thread = nullptr; port = 80; redirections = 0; @@ -583,7 +583,7 @@ HTTPRequest::HTTPRequest() { thread_done = false; downloaded = 0; body_size_limit = -1; - file = NULL; + file = nullptr; timer = memnew(Timer); timer->set_one_shot(true); diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp index fe238af1c4..78958a7a1c 100644 --- a/scene/main/instance_placeholder.cpp +++ b/scene/main/instance_placeholder.cpp @@ -77,11 +77,11 @@ String InstancePlaceholder::get_instance_path() const { Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene> &p_custom_scene) { - ERR_FAIL_COND_V(!is_inside_tree(), NULL); + ERR_FAIL_COND_V(!is_inside_tree(), nullptr); Node *base = get_parent(); if (!base) - return NULL; + return nullptr; Ref<PackedScene> ps; if (p_custom_scene.is_valid()) @@ -90,10 +90,10 @@ Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene ps = ResourceLoader::load(path, "PackedScene"); if (!ps.is_valid()) - return NULL; + return nullptr; Node *scene = ps->instance(); if (!scene) - return NULL; + return nullptr; scene->set_name(get_name()); int pos = get_position_in_parent(); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index b882b9ead6..6b46ffd8ad 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -82,7 +82,7 @@ void Node::_notification(int p_notification) { if (data.parent) data.pause_owner = data.parent->data.pause_owner; else - data.pause_owner = NULL; + data.pause_owner = nullptr; } else { data.pause_owner = this; } @@ -112,17 +112,17 @@ void Node::_notification(int p_notification) { if (data.unhandled_key_input) remove_from_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_id())); - data.pause_owner = NULL; + data.pause_owner = nullptr; if (data.path_cache) { memdelete(data.path_cache); - data.path_cache = NULL; + data.path_cache = nullptr; } } break; case NOTIFICATION_PATH_CHANGED: { if (data.path_cache) { memdelete(data.path_cache); - data.path_cache = NULL; + data.path_cache = nullptr; } } break; case NOTIFICATION_READY: { @@ -149,7 +149,7 @@ void Node::_notification(int p_notification) { set_physics_process(true); } - get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0); + get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, nullptr, 0); } } break; @@ -158,11 +158,11 @@ void Node::_notification(int p_notification) { } break; case NOTIFICATION_PREDELETE: { - set_owner(NULL); + set_owner(nullptr); while (data.owned.size()) { - data.owned.front()->get()->set_owner(NULL); + data.owned.front()->get()->set_owner(nullptr); } if (data.parent) { @@ -226,7 +226,7 @@ void Node::_propagate_enter_tree() { if (get_script_instance()) { - get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_tree, NULL, 0); + get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_tree, nullptr, 0); } emit_signal(SceneStringNames::get_singleton()->tree_entered); @@ -278,7 +278,7 @@ void Node::_propagate_exit_tree() { if (get_script_instance()) { - get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_tree, NULL, 0); + get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_tree, nullptr, 0); } emit_signal(SceneStringNames::get_singleton()->tree_exiting); @@ -290,17 +290,17 @@ void Node::_propagate_exit_tree() { for (Map<StringName, GroupData>::Element *E = data.grouped.front(); E; E = E->next()) { data.tree->remove_from_group(E->key(), this); - E->get().group = NULL; + E->get().group = nullptr; } - data.viewport = NULL; + data.viewport = nullptr; if (data.tree) data.tree->tree_changed(); data.inside_tree = false; data.ready_notified = false; - data.tree = NULL; + data.tree = nullptr; data.depth = -1; } @@ -423,7 +423,7 @@ void Node::set_pause_mode(PauseMode p_mode) { if ((data.pause_mode == PAUSE_MODE_INHERIT) == prev_inherits) return; ///nothing changed - Node *owner = NULL; + Node *owner = nullptr; if (data.pause_mode == PAUSE_MODE_INHERIT) { @@ -914,7 +914,7 @@ void Node::set_process_priority(int p_priority) { data.process_priority = p_priority; // Make sure we are in SceneTree. - if (data.tree == NULL) { + if (data.tree == nullptr) { return; } @@ -1295,7 +1295,7 @@ void Node::_propagate_validate_owner() { if (!found) { data.owner->data.owned.erase(data.OW); - data.owner = NULL; + data.owner = nullptr; } } @@ -1336,7 +1336,7 @@ void Node::remove_child(Node *p_child) { //if (data.scene) { does not matter - p_child->_set_tree(NULL); + p_child->_set_tree(nullptr); //} remove_child_notify(p_child); @@ -1354,7 +1354,7 @@ void Node::remove_child(Node *p_child) { children[i]->notification(NOTIFICATION_MOVED_IN_PARENT); } - p_child->data.parent = NULL; + p_child->data.parent = nullptr; p_child->data.pos = -1; // validate owner @@ -1371,7 +1371,7 @@ int Node::get_child_count() const { } Node *Node::get_child(int p_index) const { - ERR_FAIL_INDEX_V(p_index, data.children.size(), NULL); + ERR_FAIL_INDEX_V(p_index, data.children.size(), nullptr); return data.children[p_index]; } @@ -1386,19 +1386,19 @@ Node *Node::_get_child_by_name(const StringName &p_name) const { return cd[i]; } - return NULL; + return nullptr; } Node *Node::get_node_or_null(const NodePath &p_path) const { if (p_path.is_empty()) { - return NULL; + return nullptr; } - ERR_FAIL_COND_V_MSG(!data.inside_tree && p_path.is_absolute(), NULL, "Can't use get_node() with absolute paths from outside the active scene tree."); + ERR_FAIL_COND_V_MSG(!data.inside_tree && p_path.is_absolute(), nullptr, "Can't use get_node() with absolute paths from outside the active scene tree."); - Node *current = NULL; - Node *root = NULL; + Node *current = nullptr; + Node *root = nullptr; if (!p_path.is_absolute()) { current = const_cast<Node *>(this); //start from this @@ -1412,7 +1412,7 @@ Node *Node::get_node_or_null(const NodePath &p_path) const { for (int i = 0; i < p_path.get_name_count(); i++) { StringName name = p_path.get_name(i); - Node *next = NULL; + Node *next = nullptr; if (name == SceneStringNames::get_singleton()->dot) { // . @@ -1420,18 +1420,18 @@ Node *Node::get_node_or_null(const NodePath &p_path) const { } else if (name == SceneStringNames::get_singleton()->doubledot) { // .. - if (current == NULL || !current->data.parent) - return NULL; + if (current == nullptr || !current->data.parent) + return nullptr; next = current->data.parent; - } else if (current == NULL) { + } else if (current == nullptr) { if (name == root->get_name()) next = root; } else { - next = NULL; + next = nullptr; for (int j = 0; j < current->data.children.size(); j++) { @@ -1443,8 +1443,8 @@ Node *Node::get_node_or_null(const NodePath &p_path) const { break; } } - if (next == NULL) { - return NULL; + if (next == nullptr) { + return nullptr; }; } current = next; @@ -1456,13 +1456,13 @@ Node *Node::get_node_or_null(const NodePath &p_path) const { Node *Node::get_node(const NodePath &p_path) const { Node *node = get_node_or_null(p_path); - ERR_FAIL_COND_V_MSG(!node, NULL, "Node not found: " + p_path + "."); + ERR_FAIL_COND_V_MSG(!node, nullptr, "Node not found: " + p_path + "."); return node; } bool Node::has_node(const NodePath &p_path) const { - return get_node_or_null(p_path) != NULL; + return get_node_or_null(p_path) != nullptr; } Node *Node::find_node(const String &p_mask, bool p_recursive, bool p_owned) const { @@ -1482,7 +1482,7 @@ Node *Node::find_node(const String &p_mask, bool p_recursive, bool p_owned) cons if (ret) return ret; } - return NULL; + return nullptr; } Node *Node::get_parent() const { @@ -1500,7 +1500,7 @@ Node *Node::find_parent(const String &p_mask) const { p = p->data.parent; } - return NULL; + return nullptr; } bool Node::is_a_parent_of(const Node *p_node) const { @@ -1607,8 +1607,8 @@ void Node::set_owner(Node *p_owner) { if (data.owner) { data.owner->data.owned.erase(data.OW); - data.OW = NULL; - data.owner = NULL; + data.OW = nullptr; + data.owner = nullptr; } ERR_FAIL_COND(p_owner == this); @@ -1663,7 +1663,7 @@ Node *Node::find_common_parent_with(const Node *p_node) const { } if (!common_parent) - return NULL; + return nullptr; return const_cast<Node *>(common_parent); } @@ -1762,7 +1762,7 @@ void Node::add_to_group(const StringName &p_identifier, bool p_persistent) { if (data.tree) { gd.group = data.tree->add_to_group(p_identifier, this); } else { - gd.group = NULL; + gd.group = nullptr; } gd.persistent = p_persistent; @@ -1935,7 +1935,7 @@ void Node::remove_and_skip() { continue; remove_child(c_node); - c_node->_propagate_replace_owner(this, NULL); + c_node->_propagate_replace_owner(this, nullptr); children.push_back(c_node); clear = false; break; @@ -1949,7 +1949,7 @@ void Node::remove_and_skip() { Node *c_node = children.front()->get(); data.parent->add_child(c_node); - c_node->_propagate_replace_owner(NULL, new_owner); + c_node->_propagate_replace_owner(nullptr, new_owner); children.pop_front(); } @@ -2049,7 +2049,7 @@ int Node::get_position_in_parent() const { Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const { - Node *node = NULL; + Node *node = nullptr; bool instanced = false; @@ -2063,25 +2063,25 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const } else if ((p_flags & DUPLICATE_USE_INSTANCING) && get_filename() != String()) { Ref<PackedScene> res = ResourceLoader::load(get_filename()); - ERR_FAIL_COND_V(res.is_null(), NULL); + ERR_FAIL_COND_V(res.is_null(), nullptr); PackedScene::GenEditState ges = PackedScene::GEN_EDIT_STATE_DISABLED; #ifdef TOOLS_ENABLED if (p_flags & DUPLICATE_FROM_EDITOR) ges = PackedScene::GEN_EDIT_STATE_INSTANCE; #endif node = res->instance(ges); - ERR_FAIL_COND_V(!node, NULL); + ERR_FAIL_COND_V(!node, nullptr); instanced = true; } else { Object *obj = ClassDB::instance(get_class()); - ERR_FAIL_COND_V(!obj, NULL); + ERR_FAIL_COND_V(!obj, nullptr); node = Object::cast_to<Node>(obj); if (!node) memdelete(obj); - ERR_FAIL_COND_V(!node, NULL); + ERR_FAIL_COND_V(!node, nullptr); } if (get_filename() != "") { //an instance @@ -2189,7 +2189,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const if (!dup) { memdelete(node); - return NULL; + return nullptr; } node->add_child(dup); @@ -2204,14 +2204,14 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const if (!parent) { memdelete(node); - return NULL; + return nullptr; } Node *dup = E->get()->_duplicate(p_flags, r_duplimap); if (!dup) { memdelete(node); - return NULL; + return nullptr; } parent->add_child(dup); @@ -2256,7 +2256,7 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p if (get_owner() != get_parent()->get_owner()) return; - Node *node = NULL; + Node *node = nullptr; if (get_filename() != "") { @@ -2369,15 +2369,15 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const { Node *Node::duplicate_and_reown(const Map<Node *, Node *> &p_reown_map) const { - ERR_FAIL_COND_V(get_filename() != "", NULL); + ERR_FAIL_COND_V(get_filename() != "", nullptr); Object *obj = ClassDB::instance(get_class()); - ERR_FAIL_COND_V_MSG(!obj, NULL, "Node: Could not duplicate: " + String(get_class()) + "."); + ERR_FAIL_COND_V_MSG(!obj, nullptr, "Node: Could not duplicate: " + String(get_class()) + "."); Node *node = Object::cast_to<Node>(obj); if (!node) { memdelete(obj); - ERR_FAIL_V_MSG(NULL, "Node: Could not duplicate: " + String(get_class()) + "."); + ERR_FAIL_V_MSG(nullptr, "Node: Could not duplicate: " + String(get_class()) + "."); } node->set_name(get_name()); @@ -2591,7 +2591,7 @@ Node *Node::get_node_and_resource(const NodePath &p_path, RES &r_res, Vector<Str r_res = RES(); r_leftover_subpath = Vector<StringName>(); if (!node) - return NULL; + return nullptr; if (p_path.get_subname_count()) { @@ -2601,7 +2601,7 @@ Node *Node::get_node_and_resource(const NodePath &p_path, RES &r_res, Vector<Str Variant new_res_v = j == 0 ? node->get(p_path.get_subname(j)) : r_res->get(p_path.get_subname(j)); if (new_res_v.get_type() == Variant::NIL) { // Found nothing on that path - return NULL; + return nullptr; } RES new_res = new_res_v; @@ -2623,8 +2623,8 @@ Node *Node::get_node_and_resource(const NodePath &p_path, RES &r_res, Vector<Str void Node::_set_tree(SceneTree *p_tree) { - SceneTree *tree_changed_a = NULL; - SceneTree *tree_changed_b = NULL; + SceneTree *tree_changed_a = nullptr; + SceneTree *tree_changed_b = nullptr; //ERR_FAIL_COND(p_scene && data.parent && !data.parent->data.scene); //nobug if both are null @@ -3012,8 +3012,8 @@ Node::Node() { data.pos = -1; data.depth = -1; data.blocked = 0; - data.parent = NULL; - data.tree = NULL; + data.parent = nullptr; + data.tree = nullptr; data.physics_process = false; data.idle_process = false; data.process_priority = 0; @@ -3022,18 +3022,18 @@ Node::Node() { data.inside_tree = false; data.ready_notified = false; - data.owner = NULL; - data.OW = NULL; + data.owner = nullptr; + data.OW = nullptr; data.input = false; data.unhandled_input = false; data.unhandled_key_input = false; data.pause_mode = PAUSE_MODE_INHERIT; - data.pause_owner = NULL; + data.pause_owner = nullptr; data.network_master = 1; //server by default - data.path_cache = NULL; + data.path_cache = nullptr; data.parent_owned = false; data.in_constructor = true; - data.viewport = NULL; + data.viewport = nullptr; data.use_placeholder = false; data.display_folded = false; data.ready_first = true; diff --git a/scene/main/node.h b/scene/main/node.h index cf25a92be6..292ec0e291 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -180,7 +180,7 @@ private: void _duplicate_signals(const Node *p_original, Node *p_copy) const; void _duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p_reown_map) const; - Node *_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap = NULL) const; + Node *_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap = nullptr) const; Array _get_children() const; Array _get_groups() const; @@ -286,7 +286,7 @@ public: Node *find_parent(const String &p_mask) const; _FORCE_INLINE_ SceneTree *get_tree() const { - ERR_FAIL_COND_V(!data.tree, NULL); + ERR_FAIL_COND_V(!data.tree, nullptr); return data.tree; } diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 15c0a7666e..41f31617d2 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -112,7 +112,7 @@ void SceneTree::node_added(Node *p_node) { void SceneTree::node_removed(Node *p_node) { if (current_scene == p_node) { - current_scene = NULL; + current_scene = nullptr; } emit_signal(node_removed_name, p_node); if (call_lock > 0) @@ -539,10 +539,10 @@ void SceneTree::finish() { MainLoop::finish(); if (root) { - root->_set_tree(NULL); + root->_set_tree(nullptr); root->_propagate_after_exit_tree(); memdelete(root); //delete root - root = NULL; + root = nullptr; } // cleanup timers @@ -1037,7 +1037,7 @@ Node *SceneTree::get_edited_scene_root() const { #ifdef TOOLS_ENABLED return edited_scene_root; #else - return NULL; + return nullptr; #endif } @@ -1056,7 +1056,7 @@ void SceneTree::_change_scene(Node *p_to) { if (current_scene) { memdelete(current_scene); - current_scene = NULL; + current_scene = nullptr; } // If we're quitting, abort. @@ -1082,7 +1082,7 @@ Error SceneTree::change_scene(const String &p_path) { } Error SceneTree::change_scene_to(const Ref<PackedScene> &p_scene) { - Node *new_scene = NULL; + Node *new_scene = nullptr; if (p_scene.is_valid()) { new_scene = p_scene->instance(); ERR_FAIL_COND_V(!new_scene, ERR_CANT_CREATE); @@ -1321,7 +1321,7 @@ void SceneTree::_bind_methods() { BIND_ENUM_CONSTANT(GROUP_CALL_UNIQUE); } -SceneTree *SceneTree::singleton = NULL; +SceneTree *SceneTree::singleton = nullptr; SceneTree::IdleCallback SceneTree::idle_callbacks[SceneTree::MAX_IDLE_CALLBACKS]; int SceneTree::idle_callback_count = 0; @@ -1372,7 +1372,7 @@ void SceneTree::get_argument_options(const StringName &p_function, int p_idx, Li SceneTree::SceneTree() { - if (singleton == NULL) singleton = this; + if (singleton == nullptr) singleton = this; _quit = false; accept_quit = true; quit_on_go_back = true; @@ -1392,7 +1392,7 @@ SceneTree::SceneTree() { physics_process_time = 1; idle_process_time = 1; - root = NULL; + root = nullptr; pause = false; current_frame = 0; current_event = 0; @@ -1419,7 +1419,7 @@ SceneTree::SceneTree() { //root->set_world_2d( Ref<World2D>( memnew( World2D ))); root->set_as_audio_listener(true); root->set_as_audio_listener_2d(true); - current_scene = NULL; + current_scene = nullptr; int msaa_mode = GLOBAL_DEF("rendering/quality/filters/msaa", 0); ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x,AndroidVR 2x,AndroidVR 4x")); @@ -1463,16 +1463,16 @@ SceneTree::SceneTree() { root->connect("focus_entered", callable_mp(this, &SceneTree::_main_window_focus_in)); #ifdef TOOLS_ENABLED - edited_scene_root = NULL; + edited_scene_root = nullptr; #endif } SceneTree::~SceneTree() { if (root) { - root->_set_tree(NULL); + root->_set_tree(nullptr); root->_propagate_after_exit_tree(); memdelete(root); } - if (singleton == this) singleton = NULL; + if (singleton == this) singleton = nullptr; } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index b95e81a702..7b860df352 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -61,7 +61,7 @@ void ViewportTexture::setup_local_to_scene() { vp->viewport_textures.erase(this); } - vp = NULL; + vp = nullptr; Node *local_scene = get_local_scene(); if (!local_scene) { @@ -148,7 +148,7 @@ void ViewportTexture::_bind_methods() { ViewportTexture::ViewportTexture() { - vp = NULL; + vp = nullptr; set_local_to_scene(true); } @@ -190,17 +190,17 @@ Viewport::GUI::GUI() { embedding_subwindows = false; dragging = false; - mouse_focus = NULL; + mouse_focus = nullptr; forced_mouse_focus = false; - mouse_click_grabber = NULL; + mouse_click_grabber = nullptr; mouse_focus_mask = 0; - key_focus = NULL; - mouse_over = NULL; - drag_mouse_over = NULL; + key_focus = nullptr; + mouse_over = nullptr; + drag_mouse_over = nullptr; - tooltip = NULL; - tooltip_popup = NULL; - tooltip_label = NULL; + tooltip = nullptr; + tooltip_popup = nullptr; + tooltip_label = nullptr; } ///////////////////////////////////// @@ -455,7 +455,7 @@ void Viewport::_notification(int p_what) { parent = get_parent()->get_viewport(); RenderingServer::get_singleton()->viewport_set_parent_viewport(viewport, parent->get_viewport_rid()); } else { - parent = NULL; + parent = nullptr; } current_canvas = find_world_2d()->get_canvas(); @@ -489,10 +489,10 @@ void Viewport::_notification(int p_what) { case NOTIFICATION_READY: { #ifndef _3D_DISABLED if (listeners.size() && !listener) { - Listener3D *first = NULL; + Listener3D *first = nullptr; for (Set<Listener3D *>::Element *E = listeners.front(); E; E = E->next()) { - if (first == NULL || first->is_greater_than(E->get())) { + if (first == nullptr || first->is_greater_than(E->get())) { first = E->get(); } } @@ -503,10 +503,10 @@ void Viewport::_notification(int p_what) { if (cameras.size() && !camera) { //there are cameras but no current camera, pick first in tree and make it current - Camera3D *first = NULL; + Camera3D *first = nullptr; for (Set<Camera3D *>::Element *E = cameras.front(); E; E = E->next()) { - if (first == NULL || first->is_greater_than(E->get())) { + if (first == nullptr || first->is_greater_than(E->get())) { first = E->get(); } } @@ -586,7 +586,7 @@ void Viewport::_notification(int p_what) { #ifndef _3D_DISABLED Vector2 last_pos(1e20, 1e20); - CollisionObject3D *last_object = NULL; + CollisionObject3D *last_object = nullptr; ObjectID last_id; #endif PhysicsDirectSpaceState3D::RayResult result; @@ -1059,7 +1059,7 @@ void Viewport::_listener_remove(Listener3D *p_listener) { listeners.erase(p_listener); if (listener == p_listener) { - listener = NULL; + listener = nullptr; } } @@ -1073,14 +1073,14 @@ void Viewport::_listener_make_next_current(Listener3D *p_exclude) { continue; if (!E->get()->is_inside_tree()) continue; - if (listener != NULL) + if (listener != nullptr) return; E->get()->make_current(); } } else { // Attempt to reset listener to the camera position - if (camera != NULL) { + if (camera != nullptr) { _update_listener(); _camera_transform_changed_notify(); } @@ -1134,7 +1134,7 @@ void Viewport::_camera_remove(Camera3D *p_camera) { cameras.erase(p_camera); if (camera == p_camera) { camera->notification(Camera3D::NOTIFICATION_LOST_CURRENT); - camera = NULL; + camera = nullptr; } } @@ -1147,7 +1147,7 @@ void Viewport::_camera_make_next_current(Camera3D *p_exclude) { continue; if (!E->get()->is_inside_tree()) continue; - if (camera != NULL) + if (camera != nullptr) return; E->get()->make_current(); @@ -1528,12 +1528,12 @@ void Viewport::_gui_sort_roots() { void Viewport::_gui_cancel_tooltip() { - gui.tooltip = NULL; + gui.tooltip = nullptr; gui.tooltip_timer = -1; if (gui.tooltip_popup) { gui.tooltip_popup->queue_delete(); - gui.tooltip_popup = NULL; - gui.tooltip_label = NULL; + gui.tooltip_popup = nullptr; + gui.tooltip_label = nullptr; } } @@ -1571,7 +1571,7 @@ void Viewport::_gui_show_tooltip() { return; } - Control *which = NULL; + Control *which = nullptr; String tooltip = _gui_get_tooltip(gui.tooltip, gui.tooltip->get_global_transform().xform_inv(gui.tooltip_pos), &which); tooltip = tooltip.strip_edges(); if (tooltip.length() == 0) @@ -1579,8 +1579,8 @@ void Viewport::_gui_show_tooltip() { if (gui.tooltip_popup) { memdelete(gui.tooltip_popup); - gui.tooltip_popup = NULL; - gui.tooltip_label = NULL; + gui.tooltip_popup = nullptr; + gui.tooltip_label = nullptr; } if (!which) { @@ -1651,7 +1651,7 @@ void Viewport::_gui_call_input(Control *p_control, const Ref<InputEvent> &p_inpu Ref<InputEventPanGesture> pn = p_input; cant_stop_me_now = pn.is_valid() || cant_stop_me_now; - bool ismouse = ev.is_valid() || Object::cast_to<InputEventMouseMotion>(*p_input) != NULL; + bool ismouse = ev.is_valid() || Object::cast_to<InputEventMouseMotion>(*p_input) != nullptr; CanvasItem *ci = p_control; while (ci) { @@ -1741,23 +1741,23 @@ Control *Viewport::_gui_find_control(const Point2 &p_global) { return ret; } - return NULL; + return nullptr; } Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_global, const Transform2D &p_xform, Transform2D &r_inv_xform) { if (Object::cast_to<Viewport>(p_node)) - return NULL; + return nullptr; if (!p_node->is_visible()) { //return _find_next_visible_control_at_pos(p_node,p_global,r_inv_xform); - return NULL; //canvas item hidden, discard + return nullptr; //canvas item hidden, discard } Transform2D matrix = p_xform * p_node->get_transform(); // matrix.basis_determinant() == 0.0f implies that node does not exist on scene if (matrix.basis_determinant() == 0.0f) - return NULL; + return nullptr; Control *c = Object::cast_to<Control>(p_node); @@ -1776,7 +1776,7 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_ } if (!c) - return NULL; + return nullptr; matrix.affine_invert(); @@ -1785,7 +1785,7 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_ r_inv_xform = matrix; return c; } else - return NULL; + return nullptr; } bool Viewport::_gui_drop(Control *p_at_control, Point2 p_at_pos, bool p_just_check) { @@ -1938,7 +1938,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { if (gui.drag_preview) { memdelete(gui.drag_preview); - gui.drag_preview = NULL; + gui.drag_preview = nullptr; } _propagate_viewport_notification(this, NOTIFICATION_DRAG_END); //change mouse accordingly @@ -1957,7 +1957,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { if (gui.drag_preview && mb->get_button_index() == BUTTON_LEFT) { memdelete(gui.drag_preview); - gui.drag_preview = NULL; + gui.drag_preview = nullptr; } gui.drag_data = Variant(); @@ -1985,7 +1985,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { //disable mouse focus if needed before calling input, this makes popups on mouse press event work better, as the release will never be received otherwise if (gui.mouse_focus_mask == 0) { - gui.mouse_focus = NULL; + gui.mouse_focus = nullptr; gui.forced_mouse_focus = false; } @@ -2011,7 +2011,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { gui.last_mouse_pos = mpos; - Control *over = NULL; + Control *over = nullptr; // D&D if (!gui.drag_attempted && gui.mouse_focus && mm->get_button_mask() & BUTTON_MASK_LEFT) { @@ -2031,15 +2031,15 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { gui.drag_data = control->get_drag_data(control->get_global_transform_with_canvas().affine_inverse().xform(mpos) - gui.drag_accum); if (gui.drag_data.get_type() != Variant::NIL) { - gui.mouse_focus = NULL; + gui.mouse_focus = nullptr; gui.forced_mouse_focus = false; gui.mouse_focus_mask = 0; break; } else { - if (gui.drag_preview != NULL) { + if (gui.drag_preview != nullptr) { ERR_PRINT("Don't set a drag preview and return null data. Preview was deleted and drag request ignored."); memdelete(gui.drag_preview); - gui.drag_preview = NULL; + gui.drag_preview = nullptr; } gui.dragging = false; } @@ -2395,7 +2395,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { } } - Control *from = gui.key_focus ? gui.key_focus : NULL; //hmm + Control *from = gui.key_focus ? gui.key_focus : nullptr; //hmm //keyboard focus //if (from && p_event->is_pressed() && !p_event->get_alt() && !p_event->get_metakey() && !p_event->key->get_command()) { @@ -2405,7 +2405,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { bool mods = k.is_valid() && (k->get_control() || k->get_alt() || k->get_shift() || k->get_metakey()); if (from && p_event->is_pressed()) { - Control *next = NULL; + Control *next = nullptr; InputFilter *input = InputFilter::get_singleton(); @@ -2463,7 +2463,7 @@ void Viewport::_gui_force_drag(Control *p_base, const Variant &p_data, Control * gui.dragging = true; gui.drag_data = p_data; - gui.mouse_focus = NULL; + gui.mouse_focus = nullptr; if (p_control) { _gui_set_drag_preview(p_base, p_control); @@ -2475,7 +2475,7 @@ void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) { ERR_FAIL_NULL(p_control); ERR_FAIL_COND(!Object::cast_to<Control>((Object *)p_control)); ERR_FAIL_COND(p_control->is_inside_tree()); - ERR_FAIL_COND(p_control->get_parent() != NULL); + ERR_FAIL_COND(p_control->get_parent() != nullptr); if (gui.drag_preview) { memdelete(gui.drag_preview); @@ -2519,9 +2519,9 @@ void Viewport::_gui_hid_control(Control *p_control) { if (gui.key_focus == p_control) _gui_remove_focus(); if (gui.mouse_over == p_control) - gui.mouse_over = NULL; + gui.mouse_over = nullptr; if (gui.drag_mouse_over == p_control) - gui.drag_mouse_over = NULL; + gui.drag_mouse_over = nullptr; if (gui.tooltip == p_control) _gui_cancel_tooltip(); } @@ -2529,28 +2529,28 @@ void Viewport::_gui_hid_control(Control *p_control) { void Viewport::_gui_remove_control(Control *p_control) { if (gui.mouse_focus == p_control) { - gui.mouse_focus = NULL; + gui.mouse_focus = nullptr; gui.forced_mouse_focus = false; gui.mouse_focus_mask = 0; } if (gui.last_mouse_focus == p_control) { - gui.last_mouse_focus = NULL; + gui.last_mouse_focus = nullptr; } if (gui.key_focus == p_control) - gui.key_focus = NULL; + gui.key_focus = nullptr; if (gui.mouse_over == p_control) - gui.mouse_over = NULL; + gui.mouse_over = nullptr; if (gui.drag_mouse_over == p_control) - gui.drag_mouse_over = NULL; + gui.drag_mouse_over = nullptr; if (gui.tooltip == p_control) - gui.tooltip = NULL; + gui.tooltip = nullptr; } void Viewport::_gui_remove_focus() { if (gui.key_focus) { Node *f = gui.key_focus; - gui.key_focus = NULL; + gui.key_focus = nullptr; f->notification(Control::NOTIFICATION_FOCUS_EXIT, true); } } @@ -2583,7 +2583,7 @@ void Viewport::_drop_mouse_focus() { Control *c = gui.mouse_focus; int mask = gui.mouse_focus_mask; - gui.mouse_focus = NULL; + gui.mouse_focus = nullptr; gui.forced_mouse_focus = false; gui.mouse_focus_mask = 0; @@ -2645,7 +2645,7 @@ void Viewport::_post_gui_grab_click_focus() { // Redundant grab requests were made return; } - gui.mouse_click_grabber = NULL; + gui.mouse_click_grabber = nullptr; if (gui.mouse_focus) { @@ -3063,7 +3063,7 @@ void Viewport::unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coor get_tree()->_call_input_pause(unhandled_input_group, "_unhandled_input", ev, this); //call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"unhandled_input","_unhandled_input",ev); - if (!is_input_handled() && Object::cast_to<InputEventKey>(*ev) != NULL) { + if (!is_input_handled() && Object::cast_to<InputEventKey>(*ev) != nullptr) { get_tree()->_call_input_pause(unhandled_key_input_group, "_unhandled_key_input", ev, this); //call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"unhandled_key_input","_unhandled_key_input",ev); } @@ -3539,11 +3539,11 @@ Viewport::Viewport() { //internal_listener_2d = SpatialSound2DServer::get_singleton()->listener_create(); audio_listener_2d = false; transparent_bg = false; - parent = NULL; - listener = NULL; - camera = NULL; + parent = nullptr; + listener = nullptr; + camera = nullptr; override_canvas_transform = false; - canvas_layers.insert(NULL); // This eases picking code (interpreted as the canvas of the Viewport) + canvas_layers.insert(nullptr); // This eases picking code (interpreted as the canvas of the Viewport) gen_mipmaps = false; @@ -3577,15 +3577,15 @@ Viewport::Viewport() { gui.tooltip_delay = GLOBAL_DEF("gui/timers/tooltip_delay_sec", 0.5); ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/tooltip_delay_sec", PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater")); // No negative numbers - gui.tooltip = NULL; - gui.tooltip_label = NULL; - gui.drag_preview = NULL; + gui.tooltip = nullptr; + gui.tooltip_label = nullptr; + gui.drag_preview = nullptr; gui.drag_attempted = false; gui.canvas_sort_index = 0; gui.roots_order_dirty = false; - gui.mouse_focus = NULL; + gui.mouse_focus = nullptr; gui.forced_mouse_focus = false; - gui.last_mouse_focus = NULL; + gui.last_mouse_focus = nullptr; gui.subwindow_focused = nullptr; gui.subwindow_drag = SUB_WINDOW_DRAG_DISABLED; @@ -3612,7 +3612,7 @@ Viewport::~Viewport() { //erase itself from viewport textures for (Set<ViewportTexture *>::Element *E = viewport_textures.front(); E; E = E->next()) { - E->get()->vp = NULL; + E->get()->vp = nullptr; } RenderingServer::get_singleton()->free(viewport); } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index d0b22b5553..8982869783 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -374,7 +374,7 @@ private: void _gui_remove_root_control(List<Control *>::Element *RI); - String _gui_get_tooltip(Control *p_control, const Vector2 &p_pos, Control **r_which = NULL); + String _gui_get_tooltip(Control *p_control, const Vector2 &p_pos, Control **r_which = nullptr); void _gui_cancel_tooltip(); void _gui_show_tooltip(); diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 406f130b71..45982e0e93 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1108,13 +1108,13 @@ void Window::remove_child_notify(Node *p_child) { Control *child_c = Object::cast_to<Control>(p_child); if (child_c && (child_c->data.theme_owner || child_c->data.theme_owner_window) && child_c->data.theme.is_null()) { - Control::_propagate_theme_changed(child_c, NULL, NULL); + Control::_propagate_theme_changed(child_c, nullptr, nullptr); } Window *child_w = Object::cast_to<Window>(p_child); if (child_w && (child_w->theme_owner || child_w->theme_owner_window) && child_w->theme.is_null()) { - Control::_propagate_theme_changed(child_w, NULL, NULL); + Control::_propagate_theme_changed(child_w, nullptr, nullptr); } if (is_inside_tree() && wrap_controls) { diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 06b65e4b4a..d630a1f3ee 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -482,7 +482,7 @@ void AudioStreamSample::set_data(const Vector<uint8_t> &p_data) { AudioServer::get_singleton()->lock(); if (data) { memfree(data); - data = NULL; + data = nullptr; data_bytes = 0; } @@ -654,14 +654,14 @@ AudioStreamSample::AudioStreamSample() { loop_begin = 0; loop_end = 0; mix_rate = 44100; - data = NULL; + data = nullptr; data_bytes = 0; } AudioStreamSample::~AudioStreamSample() { if (data) { memfree(data); - data = NULL; + data = nullptr; data_bytes = 0; } } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 0c45779307..e6f09eb034 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -890,9 +890,9 @@ void make_default_theme(bool p_hidpi, Ref<Font> p_font) { void clear_default_theme() { - Theme::set_project_default(NULL); - Theme::set_default(NULL); - Theme::set_default_icon(NULL); - Theme::set_default_style(NULL); - Theme::set_default_font(NULL); + Theme::set_project_default(nullptr); + Theme::set_default(nullptr); + Theme::set_default_icon(nullptr); + Theme::set_default_style(nullptr); + Theme::set_default_font(nullptr); } diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 108b1d0d5a..a613b01376 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -107,7 +107,7 @@ DynamicFontData::DynamicFontData() { antialiased = true; force_autohinter = false; hinting = DynamicFontData::HINTING_NORMAL; - font_mem = NULL; + font_mem = nullptr; font_mem_size = 0; } @@ -124,7 +124,7 @@ Error DynamicFontAtSize::_load() { ERR_FAIL_COND_V_MSG(error != 0, ERR_CANT_CREATE, "Error initializing FreeType."); // FT_OPEN_STREAM is extremely slow only on Android. - if (OS::get_singleton()->get_name() == "Android" && font->font_mem == NULL && font->font_path != String()) { + if (OS::get_singleton()->get_name() == "Android" && font->font_mem == nullptr && font->font_path != String()) { // cache font only once for each font->font_path if (_fontdata.has(font->font_path)) { @@ -148,7 +148,7 @@ Error DynamicFontAtSize::_load() { } } - if (font->font_mem == NULL && font->font_path != String()) { + if (font->font_mem == nullptr && font->font_path != String()) { FileAccess *f = FileAccess::open(font->font_path, FileAccess::READ); if (!f) { @@ -157,7 +157,7 @@ Error DynamicFontAtSize::_load() { } memset(&stream, 0, sizeof(FT_StreamRec)); - stream.base = NULL; + stream.base = nullptr; stream.size = f->get_len(); stream.pos = 0; stream.descriptor.pointer = f; @@ -245,7 +245,7 @@ float DynamicFontAtSize::get_descent() const { const Pair<const DynamicFontAtSize::Character *, DynamicFontAtSize *> DynamicFontAtSize::_find_char_with_font(CharType p_char, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks) const { const Character *chr = char_map.getptr(p_char); - ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(NULL, NULL))); + ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(nullptr, nullptr))); if (!chr->found) { @@ -269,7 +269,7 @@ const Pair<const DynamicFontAtSize::Character *, DynamicFontAtSize *> DynamicFon //not found, try 0xFFFD to display 'not found'. const_cast<DynamicFontAtSize *>(this)->_update_char(0xFFFD); chr = char_map.getptr(0xFFFD); - ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(NULL, NULL))); + ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(nullptr, nullptr))); } return Pair<const Character *, DynamicFontAtSize *>(chr, const_cast<DynamicFontAtSize *>(this)); @@ -565,7 +565,7 @@ DynamicFontAtSize::Character DynamicFontAtSize::_make_outline_char(CharType p_ch goto cleanup_stroker; if (FT_Glyph_Stroke(&glyph, stroker, 1) != 0) goto cleanup_glyph; - if (FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 1) != 0) + if (FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, nullptr, 1) != 0) goto cleanup_glyph; glyph_bitmap = (FT_BitmapGlyph)glyph; @@ -992,7 +992,7 @@ void DynamicFont::_bind_methods() { Mutex DynamicFont::dynamic_font_mutex; -SelfList<DynamicFont>::List *DynamicFont::dynamic_fonts = NULL; +SelfList<DynamicFont>::List *DynamicFont::dynamic_fonts = nullptr; DynamicFont::DynamicFont() : font_list(this) { @@ -1021,7 +1021,7 @@ void DynamicFont::initialize_dynamic_fonts() { void DynamicFont::finish_dynamic_fonts() { memdelete(dynamic_fonts); - dynamic_fonts = NULL; + dynamic_fonts = nullptr; } void DynamicFont::update_oversampling() { diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 88b1df039e..9e628fc35a 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -302,7 +302,7 @@ VARIANT_ENUM_CAST(DynamicFont::SpacingType); class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 6fa52e6f05..2203f8d1be 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -345,7 +345,7 @@ void Environment::_validate_property(PropertyInfo &property) const { "ssao_", "glow_", "adjustment_", - NULL + nullptr }; @@ -354,7 +354,7 @@ void Environment::_validate_property(PropertyInfo &property) const { "tonemap_", "ss_reflections_", "ssao_", - NULL + nullptr }; diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 8914cf8097..192eefbf6a 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -128,7 +128,7 @@ Vector<int> BitmapFont::_get_chars() const { Vector<int> chars; - const CharType *key = NULL; + const CharType *key = nullptr; while ((key = char_map.next(key))) { @@ -382,7 +382,7 @@ Vector<CharType> BitmapFont::get_char_keys() const { Vector<CharType> chars; chars.resize(char_map.size()); - const CharType *ct = NULL; + const CharType *ct = nullptr; int count = 0; while ((ct = char_map.next(ct))) { @@ -528,7 +528,7 @@ Size2 Font::get_wordwrap_string_size(const String &p_string, float p_width) cons void BitmapFont::set_fallback(const Ref<BitmapFont> &p_fallback) { - for (Ref<BitmapFont> fallback_child = p_fallback; fallback_child != NULL; fallback_child = fallback_child->get_fallback()) { + for (Ref<BitmapFont> fallback_child = p_fallback; fallback_child != nullptr; fallback_child = fallback_child->get_fallback()) { ERR_FAIL_COND_MSG(fallback_child == this, "Can't set as fallback one of its parents to prevent crashes due to recursive loop."); } diff --git a/scene/resources/font.h b/scene/resources/font.h index 076532f390..ce75f27e2a 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -200,7 +200,7 @@ public: class ResourceFormatLoaderBMFont : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index f52b755ed3..84c1c9d734 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -40,7 +40,7 @@ void Material::set_next_pass(const Ref<Material> &p_pass) { - for (Ref<Material> pass_child = p_pass; pass_child != NULL; pass_child = pass_child->get_next_pass()) { + for (Ref<Material> pass_child = p_pass; pass_child != nullptr; pass_child = pass_child->get_next_pass()) { ERR_FAIL_COND_MSG(pass_child == this, "Can't set as next_pass one of its parents to prevent crashes due to recursive loop."); } @@ -290,9 +290,9 @@ ShaderMaterial::~ShaderMaterial() { ///////////////////////////////// Mutex BaseMaterial3D::material_mutex; -SelfList<BaseMaterial3D>::List *BaseMaterial3D::dirty_materials = NULL; +SelfList<BaseMaterial3D>::List *BaseMaterial3D::dirty_materials = nullptr; Map<BaseMaterial3D::MaterialKey, BaseMaterial3D::ShaderData> BaseMaterial3D::shader_map; -BaseMaterial3D::ShaderNames *BaseMaterial3D::shader_names = NULL; +BaseMaterial3D::ShaderNames *BaseMaterial3D::shader_names = nullptr; void BaseMaterial3D::init_shaders() { @@ -375,7 +375,7 @@ void BaseMaterial3D::finish_shaders() { } memdelete(dirty_materials); - dirty_materials = NULL; + dirty_materials = nullptr; memdelete(shader_names); } @@ -2641,7 +2641,7 @@ bool StandardMaterial3D::_set(const StringName &p_name, const Variant &p_value) { "depth_flip_binormal", "heightmap_flip_binormal" }, { "depth_texture", "heightmap_texture" }, - { NULL, NULL }, + { nullptr, nullptr }, }; int idx = 0; diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index b37b7f9751..6bb5be15f3 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -37,7 +37,7 @@ #include <stdlib.h> -Mesh::ConvexDecompositionFunc Mesh::convex_composition_function = NULL; +Mesh::ConvexDecompositionFunc Mesh::convex_composition_function = nullptr; Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { @@ -372,7 +372,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { ERR_FAIL_COND_V(arrays.size() != ARRAY_MAX, Ref<ArrayMesh>()); { - int *ir = NULL; + int *ir = nullptr; Vector<int> indices = arrays[ARRAY_INDEX]; bool has_indices = false; Vector<Vector3> vertices = arrays[ARRAY_VERTEX]; @@ -1359,7 +1359,7 @@ void ArrayMesh::regen_normalmaps() { } //dirty hack -bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) = NULL; +bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) = nullptr; struct ArrayMeshLightmapSurface { diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index 8b7f8288b8..76d96786bc 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -58,30 +58,30 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf const Vector3 *vr = varray.ptr(); - const Vector3 *nr = NULL; + const Vector3 *nr = nullptr; if (arrays[Mesh::ARRAY_NORMAL].get_type() != Variant::NIL) nr = arrays[Mesh::ARRAY_NORMAL].operator Vector<Vector3>().ptr(); - const real_t *ta = NULL; + const real_t *ta = nullptr; if (arrays[Mesh::ARRAY_TANGENT].get_type() != Variant::NIL) ta = arrays[Mesh::ARRAY_TANGENT].operator Vector<real_t>().ptr(); - const Vector2 *uv = NULL; + const Vector2 *uv = nullptr; if (arrays[Mesh::ARRAY_TEX_UV].get_type() != Variant::NIL) uv = arrays[Mesh::ARRAY_TEX_UV].operator Vector<Vector2>().ptr(); - const Vector2 *uv2 = NULL; + const Vector2 *uv2 = nullptr; if (arrays[Mesh::ARRAY_TEX_UV2].get_type() != Variant::NIL) uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator Vector<Vector2>().ptr(); - const Color *col = NULL; + const Color *col = nullptr; if (arrays[Mesh::ARRAY_COLOR].get_type() != Variant::NIL) col = arrays[Mesh::ARRAY_COLOR].operator Vector<Color>().ptr(); - const int *bo = NULL; + const int *bo = nullptr; if (arrays[Mesh::ARRAY_BONES].get_type() != Variant::NIL) bo = arrays[Mesh::ARRAY_BONES].operator Vector<int>().ptr(); - const real_t *we = NULL; + const real_t *we = nullptr; if (arrays[Mesh::ARRAY_WEIGHTS].get_type() != Variant::NIL) we = arrays[Mesh::ARRAY_WEIGHTS].operator Vector<real_t>().ptr(); @@ -202,43 +202,43 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) { v.resize(vcount); Vector3 *vr = v.ptrw(); - Vector3 *nr = NULL; + Vector3 *nr = nullptr; if (format & Mesh::ARRAY_FORMAT_NORMAL) { n.resize(vcount); nr = n.ptrw(); } - real_t *ta = NULL; + real_t *ta = nullptr; if (format & Mesh::ARRAY_FORMAT_TANGENT) { t.resize(vcount * 4); ta = t.ptrw(); } - Vector2 *uv = NULL; + Vector2 *uv = nullptr; if (format & Mesh::ARRAY_FORMAT_TEX_UV) { u.resize(vcount); uv = u.ptrw(); } - Vector2 *uv2 = NULL; + Vector2 *uv2 = nullptr; if (format & Mesh::ARRAY_FORMAT_TEX_UV2) { u2.resize(vcount); uv2 = u2.ptrw(); } - Color *col = NULL; + Color *col = nullptr; if (format & Mesh::ARRAY_FORMAT_COLOR) { c.resize(vcount); col = c.ptrw(); } - int *bo = NULL; + int *bo = nullptr; if (format & Mesh::ARRAY_FORMAT_BONES) { b.resize(vcount * 4); bo = b.ptrw(); } - real_t *we = NULL; + real_t *we = nullptr; if (format & Mesh::ARRAY_FORMAT_WEIGHTS) { w.resize(vcount * 4); we = w.ptrw(); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 549c29a7f3..633771506e 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -51,25 +51,25 @@ Node *SceneState::instance(GenEditState p_edit_state) const { // nodes where instancing failed (because something is missing) List<Node *> stray_instances; -#define NODE_FROM_ID(p_name, p_id) \ - Node *p_name; \ - if (p_id & FLAG_ID_IS_PATH) { \ - NodePath np = node_paths[p_id & FLAG_MASK]; \ - p_name = ret_nodes[0]->get_node_or_null(np); \ - } else { \ - ERR_FAIL_INDEX_V(p_id &FLAG_MASK, nc, NULL); \ - p_name = ret_nodes[p_id & FLAG_MASK]; \ +#define NODE_FROM_ID(p_name, p_id) \ + Node *p_name; \ + if (p_id & FLAG_ID_IS_PATH) { \ + NodePath np = node_paths[p_id & FLAG_MASK]; \ + p_name = ret_nodes[0]->get_node_or_null(np); \ + } else { \ + ERR_FAIL_INDEX_V(p_id &FLAG_MASK, nc, nullptr); \ + p_name = ret_nodes[p_id & FLAG_MASK]; \ } int nc = nodes.size(); - ERR_FAIL_COND_V(nc == 0, NULL); + ERR_FAIL_COND_V(nc == 0, nullptr); - const StringName *snames = NULL; + const StringName *snames = nullptr; int sname_count = names.size(); if (sname_count) snames = &names[0]; - const Variant *props = NULL; + const Variant *props = nullptr; int prop_count = variants.size(); if (prop_count) props = &variants[0]; @@ -88,11 +88,11 @@ Node *SceneState::instance(GenEditState p_edit_state) const { const NodeData &n = nd[i]; - Node *parent = NULL; + Node *parent = nullptr; if (i > 0) { - ERR_FAIL_COND_V_MSG(n.parent == -1, NULL, vformat("Invalid scene: node %s does not specify its parent node.", snames[n.name])); + ERR_FAIL_COND_V_MSG(n.parent == -1, nullptr, vformat("Invalid scene: node %s does not specify its parent node.", snames[n.name])); NODE_FROM_ID(nparent, n.parent); #ifdef DEBUG_ENABLED if (!nparent && (n.parent & FLAG_ID_IS_PATH)) { @@ -103,14 +103,14 @@ Node *SceneState::instance(GenEditState p_edit_state) const { parent = nparent; } - Node *node = NULL; + Node *node = nullptr; if (i == 0 && base_scene_idx >= 0) { //scene inheritance on root node Ref<PackedScene> sdata = props[base_scene_idx]; - ERR_FAIL_COND_V(!sdata.is_valid(), NULL); + ERR_FAIL_COND_V(!sdata.is_valid(), nullptr); node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); //only main gets main edit state - ERR_FAIL_COND_V(!node, NULL); + ERR_FAIL_COND_V(!node, nullptr); if (p_edit_state != GEN_EDIT_STATE_DISABLED) { node->set_scene_inherited_state(sdata->get_state()); } @@ -123,9 +123,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const { if (disable_placeholders) { Ref<PackedScene> sdata = ResourceLoader::load(path, "PackedScene"); - ERR_FAIL_COND_V(!sdata.is_valid(), NULL); + ERR_FAIL_COND_V(!sdata.is_valid(), nullptr); node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); - ERR_FAIL_COND_V(!node, NULL); + ERR_FAIL_COND_V(!node, nullptr); } else { InstancePlaceholder *ip = memnew(InstancePlaceholder); ip->set_instance_path(path); @@ -134,9 +134,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const { node->set_scene_instance_load_placeholder(true); } else { Ref<PackedScene> sdata = props[n.instance & FLAG_MASK]; - ERR_FAIL_COND_V(!sdata.is_valid(), NULL); + ERR_FAIL_COND_V(!sdata.is_valid(), nullptr); node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); - ERR_FAIL_COND_V(!node, NULL); + ERR_FAIL_COND_V(!node, nullptr); } } else if (n.type == TYPE_INSTANCED) { @@ -155,7 +155,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { if (!Object::cast_to<Node>(obj)) { if (obj) { memdelete(obj); - obj = NULL; + obj = nullptr; } WARN_PRINT(String("Warning node of type " + snames[n.type].operator String() + " does not exist.").ascii().get_data()); if (n.parent >= 0 && n.parent < nc && ret_nodes[n.parent]) { @@ -193,8 +193,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const { for (int j = 0; j < nprop_count; j++) { bool valid; - ERR_FAIL_INDEX_V(nprops[j].name, sname_count, NULL); - ERR_FAIL_INDEX_V(nprops[j].value, prop_count, NULL); + ERR_FAIL_INDEX_V(nprops[j].name, sname_count, nullptr); + ERR_FAIL_INDEX_V(nprops[j].value, prop_count, nullptr); if (snames[nprops[j].name] == CoreStringNames::get_singleton()->_script) { //work around to avoid old script variables from disappearing, should be the proper fix to: @@ -260,7 +260,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { //groups for (int j = 0; j < n.groups.size(); j++) { - ERR_FAIL_INDEX_V(n.groups[j], sname_count, NULL); + ERR_FAIL_INDEX_V(n.groups[j], sname_count, nullptr); node->add_to_group(snames[n.groups[j]], true); } @@ -315,8 +315,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const { for (int i = 0; i < cc; i++) { const ConnectionData &c = cdata[i]; - //ERR_FAIL_INDEX_V( c.from, nc, NULL ); - //ERR_FAIL_INDEX_V( c.to, nc, NULL ); + //ERR_FAIL_INDEX_V( c.from, nc, nullptr ); + //ERR_FAIL_INDEX_V( c.to, nc, nullptr ); NODE_FROM_ID(cfrom, c.from); NODE_FROM_ID(cto, c.to); @@ -450,7 +450,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map nd.instance = _vm_get_variant(instance, variant_map); } } - n = NULL; + n = nullptr; } else { if (n->get_filename() != String()) { //is an instance @@ -773,7 +773,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName } } - nl = NULL; + nl = nullptr; } else { if (nl->get_filename() != String()) { //is an instance @@ -896,7 +896,7 @@ Error SceneState::pack(Node *p_scene) { } variants.resize(variant_map.size()); - const Variant *K = NULL; + const Variant *K = nullptr; while ((K = variant_map.next(K))) { int idx = variant_map[*K]; @@ -1689,12 +1689,12 @@ bool PackedScene::can_instance() const { Node *PackedScene::instance(GenEditState p_edit_state) const { #ifndef TOOLS_ENABLED - ERR_FAIL_COND_V_MSG(p_edit_state != GEN_EDIT_STATE_DISABLED, NULL, "Edit state is only for editors, does not work without tools compiled."); + ERR_FAIL_COND_V_MSG(p_edit_state != GEN_EDIT_STATE_DISABLED, nullptr, "Edit state is only for editors, does not work without tools compiled."); #endif Node *s = state->instance((SceneState::GenEditState)p_edit_state); if (!s) - return NULL; + return nullptr; if (p_edit_state != GEN_EDIT_STATE_DISABLED) { s->set_scene_instance_state(state); diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp index 63766c1756..83430aef9e 100644 --- a/scene/resources/particles_material.cpp +++ b/scene/resources/particles_material.cpp @@ -31,9 +31,9 @@ #include "particles_material.h" Mutex ParticlesMaterial::material_mutex; -SelfList<ParticlesMaterial>::List *ParticlesMaterial::dirty_materials = NULL; +SelfList<ParticlesMaterial>::List *ParticlesMaterial::dirty_materials = nullptr; Map<ParticlesMaterial::MaterialKey, ParticlesMaterial::ShaderData> ParticlesMaterial::shader_map; -ParticlesMaterial::ShaderNames *ParticlesMaterial::shader_names = NULL; +ParticlesMaterial::ShaderNames *ParticlesMaterial::shader_names = nullptr; void ParticlesMaterial::init_shaders() { @@ -104,7 +104,7 @@ void ParticlesMaterial::init_shaders() { void ParticlesMaterial::finish_shaders() { memdelete(dirty_materials); - dirty_materials = NULL; + dirty_materials = nullptr; memdelete(shader_names); } diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp index eff0721cef..c3daedf918 100644 --- a/scene/resources/polygon_path_finder.cpp +++ b/scene/resources/polygon_path_finder.cpp @@ -42,7 +42,7 @@ bool PolygonPathFinder::_is_point_inside(const Vector2 &p_point) const { Vector2 a = points[e.points[0]].pos; Vector2 b = points[e.points[1]].pos; - if (Geometry::segment_intersects_segment_2d(a, b, p_point, outside_point, NULL)) { + if (Geometry::segment_intersects_segment_2d(a, b, p_point, outside_point, nullptr)) { crosses++; } } @@ -119,7 +119,7 @@ void PolygonPathFinder::setup(const Vector<Vector2> &p_points, const Vector<int> Vector2 a = points[e.points[0]].pos; Vector2 b = points[e.points[1]].pos; - if (Geometry::segment_intersects_segment_2d(a, b, from, to, NULL)) { + if (Geometry::segment_intersects_segment_2d(a, b, from, to, nullptr)) { valid = false; break; } @@ -209,7 +209,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector Vector2 a = points[e.points[0]].pos; Vector2 b = points[e.points[1]].pos; - if (Geometry::segment_intersects_segment_2d(a, b, from, to, NULL)) { + if (Geometry::segment_intersects_segment_2d(a, b, from, to, nullptr)) { can_see_eachother = false; break; } @@ -268,7 +268,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector e.points[0] != ignore_from_edge.points[0] && e.points[1] != ignore_from_edge.points[0]) { - if (Geometry::segment_intersects_segment_2d(a, b, from, points[i].pos, NULL)) { + if (Geometry::segment_intersects_segment_2d(a, b, from, points[i].pos, nullptr)) { valid_a = false; } } @@ -281,7 +281,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector e.points[0] != ignore_to_edge.points[0] && e.points[1] != ignore_to_edge.points[0]) { - if (Geometry::segment_intersects_segment_2d(a, b, to, points[i].pos, NULL)) { + if (Geometry::segment_intersects_segment_2d(a, b, to, points[i].pos, nullptr)) { valid_b = false; } } diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 0792af2143..46e8575018 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -164,7 +164,7 @@ void PrimitiveMesh::surface_set_material(int p_idx, const Ref<Material> &p_mater } Ref<Material> PrimitiveMesh::surface_get_material(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx, 1, NULL); + ERR_FAIL_INDEX_V(p_idx, 1, nullptr); return material; } diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 238bdf05ef..5068bb548f 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -795,7 +795,7 @@ Error ResourceLoaderText::rename_dependencies(FileAccess *p_f, const String &p_p ignore_resource_parsing = true; //FileAccess - FileAccess *fw = NULL; + FileAccess *fw = nullptr; String base_path = local_path.get_base_dir(); @@ -961,7 +961,7 @@ void ResourceLoaderText::open(FileAccess *p_f, bool p_skip_first_tag) { rp.ext_func = _parse_ext_resources; rp.sub_func = _parse_sub_resources; - rp.func = NULL; + rp.func = nullptr; rp.userdata = this; } @@ -1392,7 +1392,7 @@ Error ResourceFormatLoaderText::rename_dependencies(const String &p_path, const return loader.rename_dependencies(f, p_path, p_map); } -ResourceFormatLoaderText *ResourceFormatLoaderText::singleton = NULL; +ResourceFormatLoaderText *ResourceFormatLoaderText::singleton = nullptr; Error ResourceFormatLoaderText::convert_file_to_binary(const String &p_src_path, const String &p_dst_path) { @@ -1674,7 +1674,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r RES res = E->get(); ERR_CONTINUE(!resource_set.has(res)); - bool main = (E->next() == NULL); + bool main = (E->next() == nullptr); if (main && packed_scene.is_valid()) break; //save as a scene @@ -1880,7 +1880,7 @@ void ResourceFormatSaverText::get_recognized_extensions(const RES &p_resource, L p_extensions->push_back("tres"); //text resource } -ResourceFormatSaverText *ResourceFormatSaverText::singleton = NULL; +ResourceFormatSaverText *ResourceFormatSaverText::singleton = nullptr; ResourceFormatSaverText::ResourceFormatSaverText() { singleton = this; } diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h index 2425ac7f6c..fbbd2e3346 100644 --- a/scene/resources/resource_format_text.h +++ b/scene/resources/resource_format_text.h @@ -134,7 +134,7 @@ public: class ResourceFormatLoaderText : public ResourceFormatLoader { public: static ResourceFormatLoaderText *singleton; - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const; virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; diff --git a/scene/resources/shader.h b/scene/resources/shader.h index e65457ed76..cf0cec362c 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -84,7 +84,7 @@ public: _FORCE_INLINE_ StringName remap_param(const StringName &p_param) const { if (params_cache_dirty) - get_param_list(NULL); + get_param_list(nullptr); const Map<StringName, StringName>::Element *E = params_cache.find(p_param); if (E) @@ -102,7 +102,7 @@ VARIANT_ENUM_CAST(Shader::Mode); class ResourceFormatLoaderShader : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/shape_2d.cpp b/scene/resources/shape_2d.cpp index 7984dadbc5..4fe585053a 100644 --- a/scene/resources/shape_2d.cpp +++ b/scene/resources/shape_2d.cpp @@ -50,13 +50,13 @@ bool Shape2D::collide_with_motion(const Transform2D &p_local_xform, const Vector ERR_FAIL_COND_V(p_shape.is_null(), false); int r; - return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, p_local_motion, p_shape->get_rid(), p_shape_xform, p_shape_motion, NULL, 0, r); + return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, p_local_motion, p_shape->get_rid(), p_shape_xform, p_shape_motion, nullptr, 0, r); } bool Shape2D::collide(const Transform2D &p_local_xform, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform) { ERR_FAIL_COND_V(p_shape.is_null(), false); int r; - return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, Vector2(), p_shape->get_rid(), p_shape_xform, Vector2(), NULL, 0, r); + return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, Vector2(), p_shape->get_rid(), p_shape_xform, Vector2(), nullptr, 0, r); } Array Shape2D::collide_with_motion_and_get_contacts(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_shape_motion) { diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index fee6bd1b54..4b392e23b7 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -854,7 +854,7 @@ void SurfaceTool::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, cons const tbool bIsOrientationPreserving, const int iFace, const int iVert) { TangentGenerationContextUserData &triangle_data = *reinterpret_cast<TangentGenerationContextUserData *>(pContext->m_pUserData); - Vertex *vtx = NULL; + Vertex *vtx = nullptr; if (triangle_data.indices.size() > 0) { int index = triangle_data.indices[iFace * 3 + iVert]->get(); if (index < triangle_data.vertices.size()) { @@ -864,7 +864,7 @@ void SurfaceTool::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, cons vtx = &triangle_data.vertices[iFace * 3 + iVert]->get(); } - if (vtx != NULL) { + if (vtx != nullptr) { vtx->tangent = Vector3(fvTangent[0], fvTangent[1], fvTangent[2]); vtx->binormal = Vector3(-fvBiTangent[0], -fvBiTangent[1], -fvBiTangent[2]); // for some reason these are reversed, something with the coordinate system in Godot } @@ -882,7 +882,7 @@ void SurfaceTool::generate_tangents() { mkif.m_getPosition = mikktGetPosition; mkif.m_getTexCoord = mikktGetTexCoord; mkif.m_setTSpace = mikktSetTSpaceDefault; - mkif.m_setTSpaceBasic = NULL; + mkif.m_setTSpaceBasic = nullptr; SMikkTSpaceContext msc; msc.m_pInterface = &mkif; diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 74b6a16d41..749dff24f2 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -525,9 +525,9 @@ void StreamTexture::_requested_normal(void *p_ud) { request_normal_callback(stex); } -StreamTexture::TextureFormatRequestCallback StreamTexture::request_3d_callback = NULL; -StreamTexture::TextureFormatRoughnessRequestCallback StreamTexture::request_roughness_callback = NULL; -StreamTexture::TextureFormatRequestCallback StreamTexture::request_normal_callback = NULL; +StreamTexture::TextureFormatRequestCallback StreamTexture::request_3d_callback = nullptr; +StreamTexture::TextureFormatRoughnessRequestCallback StreamTexture::request_roughness_callback = nullptr; +StreamTexture::TextureFormatRequestCallback StreamTexture::request_normal_callback = nullptr; Image::Format StreamTexture::get_format() const { @@ -637,7 +637,7 @@ Error StreamTexture::load(const String &p_path) { RS::get_singleton()->texture_set_detect_3d_callback(texture, _requested_3d, this); } else { //print_line("not requesting detect 3D at " + p_path); - RS::get_singleton()->texture_set_detect_3d_callback(texture, NULL, NULL); + RS::get_singleton()->texture_set_detect_3d_callback(texture, nullptr, nullptr); } if (request_roughness) { @@ -645,7 +645,7 @@ Error StreamTexture::load(const String &p_path) { RS::get_singleton()->texture_set_detect_roughness_callback(texture, _requested_roughness, this); } else { //print_line("not requesting detect srgb at " + p_path); - RS::get_singleton()->texture_set_detect_roughness_callback(texture, NULL, NULL); + RS::get_singleton()->texture_set_detect_roughness_callback(texture, nullptr, nullptr); } if (request_normal) { @@ -653,7 +653,7 @@ Error StreamTexture::load(const String &p_path) { RS::get_singleton()->texture_set_detect_normal_callback(texture, _requested_normal, this); } else { //print_line("not requesting detect normal at " + p_path); - RS::get_singleton()->texture_set_detect_normal_callback(texture, NULL, NULL); + RS::get_singleton()->texture_set_detect_normal_callback(texture, nullptr, nullptr); } #endif @@ -1869,7 +1869,7 @@ AnimatedTexture::AnimatedTexture() { #ifndef NO_THREADS rw_lock = RWLock::create(); #else - rw_lock = NULL; + rw_lock = nullptr; #endif } diff --git a/scene/resources/texture.h b/scene/resources/texture.h index c3bbbd5ee6..18f70baa07 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -213,7 +213,7 @@ public: class ResourceFormatLoaderStreamTexture : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; @@ -421,7 +421,7 @@ public: COMPRESSION_UNCOMPRESSED }; - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index d67f5f9ff2..98ebf048dc 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -230,11 +230,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { List<PropertyInfo> list; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = icon_map.next(key))) { - const StringName *key2 = NULL; + const StringName *key2 = nullptr; while ((key2 = icon_map[*key].next(key2))) { @@ -242,11 +242,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { } } - key = NULL; + key = nullptr; while ((key = style_map.next(key))) { - const StringName *key2 = NULL; + const StringName *key2 = nullptr; while ((key2 = style_map[*key].next(key2))) { @@ -254,11 +254,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { } } - key = NULL; + key = nullptr; while ((key = font_map.next(key))) { - const StringName *key2 = NULL; + const StringName *key2 = nullptr; while ((key2 = font_map[*key].next(key2))) { @@ -266,11 +266,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { } } - key = NULL; + key = nullptr; while ((key = color_map.next(key))) { - const StringName *key2 = NULL; + const StringName *key2 = nullptr; while ((key2 = color_map[*key].next(key2))) { @@ -278,11 +278,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { } } - key = NULL; + key = nullptr; while ((key = constant_map.next(key))) { - const StringName *key2 = NULL; + const StringName *key2 = nullptr; while ((key2 = constant_map[*key].next(key2))) { @@ -417,7 +417,7 @@ void Theme::get_icon_list(StringName p_type, List<StringName> *p_list) const { if (!icon_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = icon_map[p_type].next(key))) { @@ -440,7 +440,7 @@ Ref<Shader> Theme::get_shader(const StringName &p_name, const StringName &p_type if (shader_map.has(p_type) && shader_map[p_type].has(p_name) && shader_map[p_type][p_name].is_valid()) { return shader_map[p_type][p_name]; } else { - return NULL; + return nullptr; } } @@ -464,7 +464,7 @@ void Theme::get_shader_list(const StringName &p_type, List<StringName> *p_list) if (!shader_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = shader_map[p_type].next(key))) { @@ -530,7 +530,7 @@ void Theme::get_stylebox_list(StringName p_type, List<StringName> *p_list) const if (!style_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = style_map[p_type].next(key))) { @@ -541,7 +541,7 @@ void Theme::get_stylebox_list(StringName p_type, List<StringName> *p_list) const void Theme::get_stylebox_types(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = style_map.next(key))) { p_list->push_back(*key); } @@ -604,7 +604,7 @@ void Theme::get_font_list(StringName p_type, List<StringName> *p_list) const { if (!font_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = font_map[p_type].next(key))) { @@ -654,7 +654,7 @@ void Theme::get_color_list(StringName p_type, List<StringName> *p_list) const { if (!color_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = color_map[p_type].next(key))) { @@ -704,7 +704,7 @@ void Theme::get_constant_list(StringName p_type, List<StringName> *p_list) const if (!constant_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = constant_map[p_type].next(key))) { @@ -716,9 +716,9 @@ void Theme::clear() { //these need disconnecting { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = icon_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = icon_map[*K].next(L))) { Ref<Texture2D> icon = icon_map[*K][*L]; if (icon.is_valid()) { @@ -729,9 +729,9 @@ void Theme::clear() { } { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = style_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = style_map[*K].next(L))) { Ref<StyleBox> style = style_map[*K][*L]; if (style.is_valid()) { @@ -742,9 +742,9 @@ void Theme::clear() { } { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = font_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = font_map[*K].next(L))) { Ref<Font> font = font_map[*K][*L]; if (font.is_valid()) { @@ -781,9 +781,9 @@ void Theme::copy_theme(const Ref<Theme> &p_other) { //these need reconnecting, so add normally { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = p_other->icon_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = p_other->icon_map[*K].next(L))) { set_icon(*L, *K, p_other->icon_map[*K][*L]); } @@ -791,9 +791,9 @@ void Theme::copy_theme(const Ref<Theme> &p_other) { } { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = p_other->style_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = p_other->style_map[*K].next(L))) { set_stylebox(*L, *K, p_other->style_map[*K][*L]); } @@ -801,9 +801,9 @@ void Theme::copy_theme(const Ref<Theme> &p_other) { } { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = p_other->font_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = p_other->font_map[*K].next(L))) { set_font(*L, *K, p_other->font_map[*K][*L]); } @@ -825,35 +825,35 @@ void Theme::get_type_list(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); Set<StringName> types; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = icon_map.next(key))) { types.insert(*key); } - key = NULL; + key = nullptr; while ((key = style_map.next(key))) { types.insert(*key); } - key = NULL; + key = nullptr; while ((key = font_map.next(key))) { types.insert(*key); } - key = NULL; + key = nullptr; while ((key = color_map.next(key))) { types.insert(*key); } - key = NULL; + key = nullptr; while ((key = constant_map.next(key))) { diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 27305cfff1..6f8a53be1a 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -620,7 +620,7 @@ Vector2 TileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2()); //First try to forward selection to script if (p_tilemap_node->get_class_name() == "TileMap") { - if (get_script_instance() != NULL) { + if (get_script_instance() != nullptr) { if (get_script_instance()->has_method("_forward_subtile_selection")) { Variant ret = get_script_instance()->call("_forward_subtile_selection", p_id, p_bitmask, p_tilemap_node, p_tile_location); if (ret.get_type() == Variant::VECTOR2) { @@ -681,7 +681,7 @@ Vector2 TileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tilem ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2()); //First try to forward selection to script - if (get_script_instance() != NULL) { + if (get_script_instance() != nullptr) { if (get_script_instance()->has_method("_forward_atlas_subtile_selection")) { Variant ret = get_script_instance()->call("_forward_atlas_subtile_selection", p_id, p_tilemap_node, p_tile_location); if (ret.get_type() == Variant::VECTOR2) { @@ -1108,7 +1108,7 @@ bool TileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) { if (p_drawn_id == p_neighbor_id) { return true; - } else if (get_script_instance() != NULL) { + } else if (get_script_instance() != nullptr) { if (get_script_instance()->has_method("_is_tile_bound")) { Variant ret = get_script_instance()->call("_is_tile_bound", p_drawn_id, p_neighbor_id); if (ret.get_type() == Variant::BOOL) { diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 5252c560a4..05b43dfb89 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -194,8 +194,8 @@ public: void autotile_set_bitmask(int p_id, Vector2 p_coord, uint32_t p_flag); uint32_t autotile_get_bitmask(int p_id, Vector2 p_coord); const Map<Vector2, uint32_t> &autotile_get_bitmask_map(int p_id); - Vector2 autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node = NULL, const Vector2 &p_tile_location = Vector2()); - Vector2 atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node = NULL, const Vector2 &p_tile_location = Vector2()); + Vector2 autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node = nullptr, const Vector2 &p_tile_location = Vector2()); + Vector2 atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node = nullptr, const Vector2 &p_tile_location = Vector2()); void tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape); Ref<Shape2D> tile_get_shape(int p_id, int p_shape_id) const; diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index f9fcda3ac0..f70f54412b 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -881,7 +881,7 @@ VisualShader::RenderModeEnums VisualShader::render_mode_enums[] = { { Shader::MODE_SPATIAL, "diffuse" }, { Shader::MODE_SPATIAL, "specular" }, { Shader::MODE_CANVAS_ITEM, "blend" }, - { Shader::MODE_CANVAS_ITEM, NULL } + { Shader::MODE_CANVAS_ITEM, nullptr } }; static const char *type_string[VisualShader::TYPE_MAX] = { @@ -1085,12 +1085,12 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const { } p_list->push_back(PropertyInfo(Variant::VECTOR2, prop_name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - if (Object::cast_to<VisualShaderNodeGroupBase>(E->get().node.ptr()) != NULL) { + if (Object::cast_to<VisualShaderNodeGroupBase>(E->get().node.ptr()) != nullptr) { p_list->push_back(PropertyInfo(Variant::VECTOR2, prop_name + "/size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/input_ports", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/output_ports", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); } - if (Object::cast_to<VisualShaderNodeExpression>(E->get().node.ptr()) != NULL) { + if (Object::cast_to<VisualShaderNodeExpression>(E->get().node.ptr()) != nullptr) { p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/expression", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); } } @@ -1687,7 +1687,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = { { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "sky_coords", "vec3(SKY_COORDS, 0.0)" }, { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, - { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL }, + { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, nullptr, nullptr }, }; const VisualShaderNodeInput::Port VisualShaderNodeInput::preview_ports[] = { @@ -1736,7 +1736,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::preview_ports[] = { { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "1.0" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "vec3(0.0, 0.0, 1.0)" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, - { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL }, + { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, nullptr, nullptr }, }; int VisualShaderNodeInput::get_input_port_count() const { @@ -2034,7 +2034,7 @@ const VisualShaderNodeOutput::Port VisualShaderNodeOutput::ports[] = { { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR" }, { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "ALPHA" }, - { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL }, + { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, nullptr, nullptr }, }; int VisualShaderNodeOutput::get_input_port_count() const { @@ -2565,7 +2565,7 @@ void VisualShaderNodeGroupBase::set_control(Control *p_control, int p_index) { } Control *VisualShaderNodeGroupBase::get_control(int p_index) { - ERR_FAIL_COND_V(!controls.has(p_index), NULL); + ERR_FAIL_COND_V(!controls.has(p_index), nullptr); return controls[p_index]; } diff --git a/scene/resources/world_3d.cpp b/scene/resources/world_3d.cpp index a33f850755..dee00dd82a 100644 --- a/scene/resources/world_3d.cpp +++ b/scene/resources/world_3d.cpp @@ -365,7 +365,7 @@ World3D::World3D() { ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_angular_damp", PropertyInfo(Variant::FLOAT, "physics/3d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater")); #ifdef _3D_DISABLED - indexer = NULL; + indexer = nullptr; #else indexer = memnew(SpatialIndexer); #endif diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 1f0365dab9..ad996e7d50 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -30,7 +30,7 @@ #include "scene_string_names.h" -SceneStringNames *SceneStringNames::singleton = NULL; +SceneStringNames *SceneStringNames::singleton = nullptr; SceneStringNames::SceneStringNames() { diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index e255ebb3cb..58e8c28454 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -44,7 +44,7 @@ class SceneStringNames { static void create() { singleton = memnew(SceneStringNames); } static void free() { memdelete(singleton); - singleton = NULL; + singleton = nullptr; } SceneStringNames(); |