From 95a1400a2ac9de1a29fa305f45b928ce8e3044bd Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Thu, 2 Apr 2020 01:20:12 +0200 Subject: Replace NULL with nullptr --- editor/plugins/abstract_polygon_2d_editor.cpp | 8 +-- editor/plugins/animation_blend_space_1d_editor.cpp | 2 +- editor/plugins/animation_blend_space_2d_editor.cpp | 4 +- .../plugins/animation_blend_tree_editor_plugin.cpp | 10 ++-- editor/plugins/animation_player_editor_plugin.cpp | 18 +++---- editor/plugins/animation_state_machine_editor.cpp | 4 +- editor/plugins/animation_tree_editor_plugin.cpp | 2 +- editor/plugins/asset_library_editor_plugin.cpp | 8 +-- editor/plugins/baked_lightmap_editor_plugin.cpp | 12 ++--- editor/plugins/camera_3d_editor_plugin.cpp | 12 ++--- editor/plugins/canvas_item_editor_plugin.cpp | 30 +++++------ editor/plugins/canvas_item_editor_plugin.h | 2 +- .../plugins/collision_polygon_2d_editor_plugin.cpp | 2 +- .../plugins/collision_polygon_3d_editor_plugin.cpp | 8 +-- .../plugins/collision_shape_2d_editor_plugin.cpp | 10 ++-- editor/plugins/cpu_particles_2d_editor_plugin.cpp | 2 +- editor/plugins/cpu_particles_3d_editor_plugin.cpp | 4 +- editor/plugins/curve_editor_plugin.cpp | 2 +- editor/plugins/gi_probe_editor_plugin.cpp | 12 ++--- editor/plugins/gpu_particles_2d_editor_plugin.cpp | 2 +- editor/plugins/gpu_particles_3d_editor_plugin.cpp | 6 +-- editor/plugins/gradient_editor_plugin.cpp | 2 +- editor/plugins/item_list_editor_plugin.cpp | 16 +++--- editor/plugins/light_occluder_2d_editor_plugin.cpp | 2 +- editor/plugins/line_2d_editor_plugin.cpp | 2 +- editor/plugins/mesh_editor_plugin.cpp | 2 +- editor/plugins/mesh_instance_3d_editor_plugin.cpp | 6 +-- editor/plugins/multimesh_editor_plugin.cpp | 6 +-- .../plugins/navigation_polygon_editor_plugin.cpp | 2 +- editor/plugins/node_3d_editor_plugin.cpp | 58 +++++++++++----------- editor/plugins/node_3d_editor_plugin.h | 10 ++-- editor/plugins/path_2d_editor_plugin.cpp | 10 ++-- editor/plugins/path_3d_editor_plugin.cpp | 8 +-- editor/plugins/path_3d_editor_plugin.h | 2 +- editor/plugins/physical_bone_3d_editor_plugin.cpp | 8 +-- editor/plugins/polygon_2d_editor_plugin.cpp | 6 +-- .../plugins/resource_preloader_editor_plugin.cpp | 2 +- editor/plugins/root_motion_editor_plugin.cpp | 6 +-- editor/plugins/script_editor_plugin.cpp | 50 +++++++++---------- editor/plugins/script_text_editor.cpp | 20 ++++---- editor/plugins/shader_editor_plugin.cpp | 2 +- editor/plugins/skeleton_2d_editor_plugin.cpp | 4 +- editor/plugins/skeleton_3d_editor_plugin.cpp | 6 +-- editor/plugins/skeleton_3d_editor_plugin.h | 2 +- editor/plugins/skeleton_ik_3d_editor_plugin.cpp | 2 +- editor/plugins/sprite_2d_editor_plugin.cpp | 4 +- editor/plugins/style_box_editor_plugin.cpp | 2 +- editor/plugins/text_editor.cpp | 12 ++--- editor/plugins/texture_editor_plugin.cpp | 2 +- editor/plugins/texture_region_editor_plugin.cpp | 40 +++++++-------- editor/plugins/tile_map_editor_plugin.cpp | 16 +++--- editor/plugins/tile_set_editor_plugin.cpp | 4 +- editor/plugins/version_control_editor_plugin.cpp | 8 +-- editor/plugins/visual_shader_editor_plugin.cpp | 36 +++++++------- 54 files changed, 259 insertions(+), 259 deletions(-) (limited to 'editor/plugins') diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index e3e9eae31a..c26daa3857 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -218,7 +218,7 @@ void AbstractPolygon2DEditor::_notification(int p_what) { void AbstractPolygon2DEditor::_node_removed(Node *p_node) { if (p_node == _get_node()) { - edit(NULL); + edit(nullptr); hide(); canvas_item_editor->update_viewport(); @@ -690,7 +690,7 @@ void AbstractPolygon2DEditor::edit(Node *p_polygon) { canvas_item_editor->update_viewport(); } else { - _set_node(NULL); + _set_node(nullptr); } } @@ -801,7 +801,7 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_edge_point(c AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wip_destructive) { - canvas_item_editor = NULL; + canvas_item_editor = nullptr; editor = p_editor; undo_redo = EditorNode::get_undo_redo(); @@ -854,7 +854,7 @@ void AbstractPolygon2DEditorPlugin::make_visible(bool p_visible) { } else { polygon_editor->hide(); - polygon_editor->edit(NULL); + polygon_editor->edit(nullptr); } } diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 86c43ea9ab..eb50df2166 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -589,7 +589,7 @@ void AnimationNodeBlendSpace1DEditor::edit(const Ref &p_node) { } } -AnimationNodeBlendSpace1DEditor *AnimationNodeBlendSpace1DEditor::singleton = NULL; +AnimationNodeBlendSpace1DEditor *AnimationNodeBlendSpace1DEditor::singleton = nullptr; AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { singleton = this; diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 843beacfd6..4343535eb6 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -810,7 +810,7 @@ void AnimationNodeBlendSpace2DEditor::_open_editor() { } void AnimationNodeBlendSpace2DEditor::_removed_from_graph() { - EditorNode::get_singleton()->edit_item(NULL); + EditorNode::get_singleton()->edit_item(nullptr); } void AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled() { @@ -833,7 +833,7 @@ void AnimationNodeBlendSpace2DEditor::_bind_methods() { ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendSpace2DEditor::_removed_from_graph); } -AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = NULL; +AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = nullptr; AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 4491c002e3..54c60aba71 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -579,7 +579,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref &ano for (Set::Element *E = paths.front(); E; E = E->next()) { NodePath path = E->get(); - TreeItem *ti = NULL; + TreeItem *ti = nullptr; String accum; for (int i = 0; i < path.get_name_count(); i++) { String name = path.get_name(i); @@ -608,7 +608,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref &ano } } - Node *node = NULL; + Node *node = nullptr; if (base->has_node(accum)) { node = base->get_node(accum); } @@ -710,7 +710,7 @@ void AnimationNodeBlendTreeEditor::_edit_filters(const String &p_which) { void AnimationNodeBlendTreeEditor::_removed_from_graph() { if (is_visible()) { - EditorNode::get_singleton()->edit_item(NULL); + EditorNode::get_singleton()->edit_item(nullptr); } } @@ -756,7 +756,7 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) { } AnimationTree *graph_player = AnimationTreeEditor::get_singleton()->get_tree(); - AnimationPlayer *player = NULL; + AnimationPlayer *player = nullptr; if (graph_player->has_node(graph_player->get_animation_player())) { player = Object::cast_to(graph_player->get_node(graph_player->get_animation_player())); } @@ -802,7 +802,7 @@ void AnimationNodeBlendTreeEditor::_bind_methods() { ClassDB::bind_method("_update_filters", &AnimationNodeBlendTreeEditor::_update_filters); } -AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = NULL; +AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = nullptr; void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref p_node) { diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 0b0f93bcb5..d96a3b0bab 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -46,12 +46,12 @@ void AnimationPlayerEditor::_node_removed(Node *p_node) { if (player && player == p_node) { - player = NULL; + player = nullptr; set_process(false); track_editor->set_animation(Ref()); - track_editor->set_root(NULL); + track_editor->set_root(nullptr); track_editor->show_select_node_warning(true); _update_player(); } @@ -299,7 +299,7 @@ void AnimationPlayerEditor::_animation_selected(int p_which) { } else { track_editor->set_animation(Ref()); - track_editor->set_root(NULL); + track_editor->set_root(nullptr); } autoplay->set_pressed(current == player->get_autoplay()); @@ -407,7 +407,7 @@ void AnimationPlayerEditor::_animation_save_as(const Ref &p_resource) file->set_current_path(p_resource->get_path()); if (extensions.size()) { String ext = p_resource->get_path().get_extension().to_lower(); - if (extensions.find(ext) == NULL) { + if (extensions.find(ext) == nullptr) { file->set_current_path(p_resource->get_path().replacen("." + ext, "." + extensions.front()->get())); } } @@ -729,7 +729,7 @@ void AnimationPlayerEditor::_animation_edit() { } } else { track_editor->set_animation(Ref()); - track_editor->set_root(NULL); + track_editor->set_root(nullptr); } } @@ -845,10 +845,10 @@ void AnimationPlayerEditor::_update_player() { frame->set_editable(animlist.size() != 0); animation->set_disabled(animlist.size() == 0); autoplay->set_disabled(animlist.size() == 0); - tool_anim->set_disabled(player == NULL); + tool_anim->set_disabled(player == nullptr); onion_toggle->set_disabled(animlist.size() == 0); onion_skinning->set_disabled(animlist.size() == 0); - pin->set_disabled(player == NULL); + pin->set_disabled(player == nullptr); if (!player) { AnimationPlayerEditor::singleton->get_track_editor()->update_keying(); @@ -1549,7 +1549,7 @@ void AnimationPlayerEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_stop_onion_skinning"), &AnimationPlayerEditor::_stop_onion_skinning); } -AnimationPlayerEditor *AnimationPlayerEditor::singleton = NULL; +AnimationPlayerEditor *AnimationPlayerEditor::singleton = nullptr; AnimationPlayer *AnimationPlayerEditor::get_player() const { @@ -1565,7 +1565,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay set_focus_mode(FOCUS_ALL); - player = NULL; + player = nullptr; HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 8ff8c92f4d..9267c0df5c 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1082,7 +1082,7 @@ void AnimationNodeStateMachineEditor::_open_editor(const String &p_name) { void AnimationNodeStateMachineEditor::_removed_from_graph() { - EditorNode::get_singleton()->edit_item(NULL); + EditorNode::get_singleton()->edit_item(nullptr); } void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) { @@ -1241,7 +1241,7 @@ void AnimationNodeStateMachineEditor::_bind_methods() { ClassDB::bind_method("_open_editor", &AnimationNodeStateMachineEditor::_open_editor); } -AnimationNodeStateMachineEditor *AnimationNodeStateMachineEditor::singleton = NULL; +AnimationNodeStateMachineEditor *AnimationNodeStateMachineEditor::singleton = nullptr; AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 605696aa75..e771c5610f 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -169,7 +169,7 @@ void AnimationTreeEditor::_notification(int p_what) { void AnimationTreeEditor::_bind_methods() { } -AnimationTreeEditor *AnimationTreeEditor::singleton = NULL; +AnimationTreeEditor *AnimationTreeEditor::singleton = nullptr; void AnimationTreeEditor::add_plugin(AnimationTreeNodeEditorPlugin *p_editor) { ERR_FAIL_COND(p_editor->get_parent()); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 3b104e34b2..14c44b7973 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -635,7 +635,7 @@ void EditorAssetLibrary::_install_asset() { EditorAssetLibraryItemDownload *d = Object::cast_to(downloads_hb->get_child(i)); if (d && d->get_asset_id() == description->get_asset_id()) { - if (EditorNode::get_singleton() != NULL) + if (EditorNode::get_singleton() != nullptr) EditorNode::get_singleton()->show_warning(TTR("Download for this asset is already in progress!")); return; } @@ -1305,7 +1305,7 @@ void EditorAssetLibrary::_asset_file_selected(const String &p_file) { if (asset_installer) { memdelete(asset_installer); - asset_installer = NULL; + asset_installer = nullptr; } asset_installer = memnew(EditorAssetInstaller); @@ -1500,7 +1500,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { error_tr->set_v_size_flags(Control::SIZE_SHRINK_CENTER); error_hb->add_child(error_tr); - description = NULL; + description = nullptr; set_process(true); set_process_unhandled_input(true); @@ -1520,7 +1520,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { add_child(asset_open); asset_open->connect("file_selected", callable_mp(this, &EditorAssetLibrary::_asset_file_selected)); - asset_installer = NULL; + asset_installer = nullptr; } /////// diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp index 6bc9562c5a..ba161244d6 100644 --- a/editor/plugins/baked_lightmap_editor_plugin.cpp +++ b/editor/plugins/baked_lightmap_editor_plugin.cpp @@ -81,25 +81,25 @@ void BakedLightmapEditorPlugin::make_visible(bool p_visible) { } } -EditorProgress *BakedLightmapEditorPlugin::tmp_progress = NULL; +EditorProgress *BakedLightmapEditorPlugin::tmp_progress = nullptr; void BakedLightmapEditorPlugin::bake_func_begin(int p_steps) { - ERR_FAIL_COND(tmp_progress != NULL); + ERR_FAIL_COND(tmp_progress != nullptr); tmp_progress = memnew(EditorProgress("bake_lightmaps", TTR("Bake Lightmaps"), p_steps, true)); } bool BakedLightmapEditorPlugin::bake_func_step(int p_step, const String &p_description) { - ERR_FAIL_COND_V(tmp_progress == NULL, false); + ERR_FAIL_COND_V(tmp_progress == nullptr, false); return tmp_progress->step(p_description, p_step, false); } void BakedLightmapEditorPlugin::bake_func_end() { - ERR_FAIL_COND(tmp_progress == NULL); + ERR_FAIL_COND(tmp_progress == nullptr); memdelete(tmp_progress); - tmp_progress = NULL; + tmp_progress = nullptr; } void BakedLightmapEditorPlugin::_bind_methods() { @@ -116,7 +116,7 @@ BakedLightmapEditorPlugin::BakedLightmapEditorPlugin(EditorNode *p_node) { bake->hide(); bake->connect("pressed", this, "_bake"); add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake); - lightmap = NULL; + lightmap = nullptr; BakedLightmap::bake_begin_function = bake_func_begin; BakedLightmap::bake_step_function = bake_func_step; diff --git a/editor/plugins/camera_3d_editor_plugin.cpp b/editor/plugins/camera_3d_editor_plugin.cpp index 759f01135e..8bc1374269 100644 --- a/editor/plugins/camera_3d_editor_plugin.cpp +++ b/editor/plugins/camera_3d_editor_plugin.cpp @@ -35,15 +35,15 @@ void Camera3DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; - Node3DEditor::get_singleton()->set_custom_camera(NULL); + node = nullptr; + Node3DEditor::get_singleton()->set_custom_camera(nullptr); hide(); } } void Camera3DEditor::_pressed() { - Node *sn = (node && preview->is_pressed()) ? node : NULL; + Node *sn = (node && preview->is_pressed()) ? node : nullptr; Node3DEditor::get_singleton()->set_custom_camera(sn); } @@ -56,13 +56,13 @@ void Camera3DEditor::edit(Node *p_camera) { if (!node) { preview->set_pressed(false); - Node3DEditor::get_singleton()->set_custom_camera(NULL); + Node3DEditor::get_singleton()->set_custom_camera(nullptr); } else { if (preview->is_pressed()) Node3DEditor::get_singleton()->set_custom_camera(p_camera); else - Node3DEditor::get_singleton()->set_custom_camera(NULL); + Node3DEditor::get_singleton()->set_custom_camera(nullptr); } } @@ -98,7 +98,7 @@ void Camera3DEditorPlugin::make_visible(bool p_visible) { if (p_visible) { //Node3DEditor::get_singleton()->set_can_preview(Object::cast_to(p_object)); } else { - Node3DEditor::get_singleton()->set_can_preview(NULL); + Node3DEditor::get_singleton()->set_can_preview(nullptr); } } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index c7ddcd5e46..d8b9fb4d8f 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -503,7 +503,7 @@ Object *CanvasItemEditor::_get_editor_data(Object *p_what) { CanvasItem *ci = Object::cast_to(p_what); if (!ci) - return NULL; + return nullptr; return memnew(CanvasItemEditorSelectedItem); } @@ -667,7 +667,7 @@ void CanvasItemEditor::_get_bones_at_pos(const Point2 &p_pos, Vector<_SelectResu Node2D *from_node = Object::cast_to(ObjectDB::get_instance(E->key().from)); Vector bone_shape; - if (!_get_bone_shape(&bone_shape, NULL, E)) + if (!_get_bone_shape(&bone_shape, nullptr, E)) continue; // Check if the point is inside the Polygon2D @@ -1343,7 +1343,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref &p_event) { if (drag_selection.size() == 1) { new_pos = snap_point(drag_from, SNAP_NODE_SIDES | SNAP_NODE_CENTER | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, drag_selection[0]); } else { - new_pos = snap_point(drag_from, SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, NULL, drag_selection); + new_pos = snap_point(drag_from, SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, nullptr, drag_selection); } for (List::Element *E = drag_selection.front(); E; E = E->next()) { CanvasItem *canvas_item = E->get(); @@ -2031,7 +2031,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { Vector> all_bones_ik_states; for (List::Element *E = drag_selection.front(); E; E = E->next()) { List bones_ik_states; - _save_canvas_item_ik_chain(E->get(), NULL, &bones_ik_states); + _save_canvas_item_ik_chain(E->get(), nullptr, &bones_ik_states); all_bones_ik_states.push_back(bones_ik_states); } @@ -2046,7 +2046,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { previous_pos = _get_encompassing_rect_from_list(drag_selection).position; } - Point2 new_pos = snap_point(previous_pos + (drag_to - drag_from), SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL | SNAP_NODE_PARENT | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES, 0, NULL, drag_selection); + Point2 new_pos = snap_point(previous_pos + (drag_to - drag_from), SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL | SNAP_NODE_PARENT | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES, 0, nullptr, drag_selection); if (drag_type == DRAG_MOVE_X) { new_pos.y = previous_pos.y; @@ -2133,7 +2133,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { Vector> all_bones_ik_states; for (List::Element *E = drag_selection.front(); E; E = E->next()) { List bones_ik_states; - _save_canvas_item_ik_chain(E->get(), NULL, &bones_ik_states); + _save_canvas_item_ik_chain(E->get(), nullptr, &bones_ik_states); all_bones_ik_states.push_back(bones_ik_states); } @@ -2299,7 +2299,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref &p_event) { return true; // Find the item to select - CanvasItem *canvas_item = NULL; + CanvasItem *canvas_item = nullptr; // Retrieve the bones Vector<_SelectResult> selection = Vector<_SelectResult>(); @@ -5800,7 +5800,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { call_deferred("set_state", get_state()); } -CanvasItemEditor *CanvasItemEditor::singleton = NULL; +CanvasItemEditor *CanvasItemEditor::singleton = nullptr; void CanvasItemEditorPlugin::edit(Object *p_object) { @@ -5886,8 +5886,8 @@ void CanvasItemEditorViewport::_create_preview(const Vector &files) cons ERR_FAIL_COND(res.is_null()); Ref texture = Ref(Object::cast_to(*res)); Ref scene = Ref(Object::cast_to(*res)); - if (texture != NULL || scene != NULL) { - if (texture != NULL) { + if (texture != nullptr || scene != nullptr) { + if (texture != nullptr) { Sprite2D *sprite = memnew(Sprite2D); sprite->set_texture(texture); sprite->set_modulate(Color(1, 1, 1, 0.7f)); @@ -5953,7 +5953,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", child); editor_data->get_undo_redo().add_do_method(child, "set_owner", editor->get_edited_scene()); editor_data->get_undo_redo().add_do_reference(child); - editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)NULL); + editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)nullptr); } if (parent) { @@ -6064,7 +6064,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { continue; } Ref scene = Ref(Object::cast_to(*res)); - if (scene != NULL && scene.is_valid()) { + if (scene != nullptr && scene.is_valid()) { if (!target_node) { // Without root node act the same as "Load Inherited Scene" Error err = EditorNode::get_singleton()->load_scene(path, false, true); @@ -6079,7 +6079,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { } } else { Ref texture = Ref(Object::cast_to(*res)); - if (texture != NULL && texture.is_valid()) { + if (texture != nullptr && texture.is_valid()) { Node *child; if (default_type == "Light2D") child = memnew(Light2D); @@ -6209,7 +6209,7 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p list.push_back(root_node); } else { drop_pos = p_point; - target_node = NULL; + target_node = nullptr; } } @@ -6258,7 +6258,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte types.push_back("TextureRect"); types.push_back("NinePatchRect"); - target_node = NULL; + target_node = nullptr; editor = p_node; editor_data = editor->get_scene_tree_dock()->get_editor_data(); canvas_item_editor = p_canvas_item_editor; diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 34965868e0..9f1a92f563 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -613,7 +613,7 @@ public: SNAP_DEFAULT = SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL, }; - Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, unsigned int p_forced_modes = 0, const CanvasItem *p_self_canvas_item = NULL, List p_other_nodes_exceptions = List()); + Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, unsigned int p_forced_modes = 0, const CanvasItem *p_self_canvas_item = nullptr, List p_other_nodes_exceptions = List()); float snap_angle(float p_target, float p_start = 0) const; Transform2D get_canvas_transform() const { return transform; } diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 3d32c0b698..87e9987aa1 100644 --- a/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -42,7 +42,7 @@ void CollisionPolygon2DEditor::_set_node(Node *p_polygon) { CollisionPolygon2DEditor::CollisionPolygon2DEditor(EditorNode *p_editor) : AbstractPolygon2DEditor(p_editor) { - node = NULL; + node = nullptr; } CollisionPolygon2DEditorPlugin::CollisionPolygon2DEditorPlugin(EditorNode *p_node) : diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.cpp b/editor/plugins/collision_polygon_3d_editor_plugin.cpp index 5b35a4826c..26adc5156b 100644 --- a/editor/plugins/collision_polygon_3d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_3d_editor_plugin.cpp @@ -66,7 +66,7 @@ void CollisionPolygon3DEditor::_notification(int p_what) { void CollisionPolygon3DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; if (imgeom->get_parent() == p_node) p_node->remove_child(imgeom); hide(); @@ -507,7 +507,7 @@ void CollisionPolygon3DEditor::edit(Node *p_collision_polygon) { prev_depth = -1; } else { - node = NULL; + node = nullptr; if (imgeom->get_parent()) imgeom->get_parent()->remove_child(imgeom); @@ -523,7 +523,7 @@ void CollisionPolygon3DEditor::_bind_methods() { CollisionPolygon3DEditor::CollisionPolygon3DEditor(EditorNode *p_editor) { - node = NULL; + node = nullptr; editor = p_editor; undo_redo = EditorNode::get_undo_redo(); @@ -591,7 +591,7 @@ void Polygon3DEditorPlugin::make_visible(bool p_visible) { } else { collision_polygon_editor->hide(); - collision_polygon_editor->edit(NULL); + collision_polygon_editor->edit(nullptr); } } diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 2d1d6de574..594dd0d0cb 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -42,7 +42,7 @@ void CollisionShape2DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; } } @@ -561,7 +561,7 @@ void CollisionShape2DEditor::edit(Node *p_node) { edit_handle = -1; shape_type = -1; - node = NULL; + node = nullptr; } canvas_item_editor->update_viewport(); @@ -574,8 +574,8 @@ void CollisionShape2DEditor::_bind_methods() { CollisionShape2DEditor::CollisionShape2DEditor(EditorNode *p_editor) { - node = NULL; - canvas_item_editor = NULL; + node = nullptr; + canvas_item_editor = nullptr; editor = p_editor; undo_redo = p_editor->get_undo_redo(); @@ -597,7 +597,7 @@ bool CollisionShape2DEditorPlugin::handles(Object *p_obj) const { void CollisionShape2DEditorPlugin::make_visible(bool visible) { if (!visible) { - edit(NULL); + edit(nullptr); } } diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 022663a61d..b005519a5e 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -251,7 +251,7 @@ void CPUParticles2DEditorPlugin::_bind_methods() { CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) { - particles = NULL; + particles = nullptr; editor = p_node; undo_redo = editor->get_undo_redo(); diff --git a/editor/plugins/cpu_particles_3d_editor_plugin.cpp b/editor/plugins/cpu_particles_3d_editor_plugin.cpp index 887e9e48df..0c2fbaf62a 100644 --- a/editor/plugins/cpu_particles_3d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_3d_editor_plugin.cpp @@ -35,7 +35,7 @@ void CPUParticles3DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; hide(); } } @@ -128,7 +128,7 @@ void CPUParticles3DEditorPlugin::make_visible(bool p_visible) { } else { particles_editor->particles_editor_hb->hide(); particles_editor->hide(); - particles_editor->edit(NULL); + particles_editor->edit(nullptr); } } diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 0fd8ea4fb5..71c5a78e0b 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -755,7 +755,7 @@ void CurveEditor::_bind_methods() { bool EditorInspectorPluginCurve::can_handle(Object *p_object) { - return Object::cast_to(p_object) != NULL; + return Object::cast_to(p_object) != nullptr; } void EditorInspectorPluginCurve::parse_begin(Object *p_object) { diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp index 908a32fdb6..6a171c4703 100644 --- a/editor/plugins/gi_probe_editor_plugin.cpp +++ b/editor/plugins/gi_probe_editor_plugin.cpp @@ -113,25 +113,25 @@ void GIProbeEditorPlugin::make_visible(bool p_visible) { } } -EditorProgress *GIProbeEditorPlugin::tmp_progress = NULL; +EditorProgress *GIProbeEditorPlugin::tmp_progress = nullptr; void GIProbeEditorPlugin::bake_func_begin(int p_steps) { - ERR_FAIL_COND(tmp_progress != NULL); + ERR_FAIL_COND(tmp_progress != nullptr); tmp_progress = memnew(EditorProgress("bake_gi", TTR("Bake GI Probe"), p_steps)); } void GIProbeEditorPlugin::bake_func_step(int p_step, const String &p_description) { - ERR_FAIL_COND(tmp_progress == NULL); + ERR_FAIL_COND(tmp_progress == nullptr); tmp_progress->step(p_description, p_step, false); } void GIProbeEditorPlugin::bake_func_end() { - ERR_FAIL_COND(tmp_progress == NULL); + ERR_FAIL_COND(tmp_progress == nullptr); memdelete(tmp_progress); - tmp_progress = NULL; + tmp_progress = nullptr; } void GIProbeEditorPlugin::_giprobe_save_path_and_bake(const String &p_path) { @@ -163,7 +163,7 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { bake_hb->add_child(bake_info); add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake_hb); - gi_probe = NULL; + gi_probe = nullptr; probe_file = memnew(EditorFileDialog); probe_file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); probe_file->add_filter("*.res"); diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp index 89bff7ccab..29c47a2b67 100644 --- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp @@ -360,7 +360,7 @@ void GPUParticles2DEditorPlugin::_bind_methods() { GPUParticles2DEditorPlugin::GPUParticles2DEditorPlugin(EditorNode *p_node) { - particles = NULL; + particles = nullptr; editor = p_node; undo_redo = editor->get_undo_redo(); diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.cpp b/editor/plugins/gpu_particles_3d_editor_plugin.cpp index 655f03b7e0..534a228098 100644 --- a/editor/plugins/gpu_particles_3d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_3d_editor_plugin.cpp @@ -236,7 +236,7 @@ GPUParticles3DEditorBase::GPUParticles3DEditorBase() { void GPUParticles3DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; hide(); } } @@ -424,7 +424,7 @@ void GPUParticles3DEditor::_bind_methods() { GPUParticles3DEditor::GPUParticles3DEditor() { - node = NULL; + node = nullptr; particles_editor_hb = memnew(HBoxContainer); Node3DEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb); options = memnew(MenuButton); @@ -476,7 +476,7 @@ void GPUParticles3DEditorPlugin::make_visible(bool p_visible) { } else { particles_editor->particles_editor_hb->hide(); particles_editor->hide(); - particles_editor->edit(NULL); + particles_editor->edit(nullptr); } } diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp index 54b7840124..67de610ae7 100644 --- a/editor/plugins/gradient_editor_plugin.cpp +++ b/editor/plugins/gradient_editor_plugin.cpp @@ -79,7 +79,7 @@ GradientEditor::GradientEditor() { bool EditorInspectorPluginGradient::can_handle(Object *p_object) { - return Object::cast_to(p_object) != NULL; + return Object::cast_to(p_object) != nullptr; } void EditorInspectorPluginGradient::parse_begin(Object *p_object) { diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp index 9ae4d2ae9d..1dbc78804b 100644 --- a/editor/plugins/item_list_editor_plugin.cpp +++ b/editor/plugins/item_list_editor_plugin.cpp @@ -163,7 +163,7 @@ void ItemListOptionButtonPlugin::erase(int p_idx) { ItemListOptionButtonPlugin::ItemListOptionButtonPlugin() { - ob = NULL; + ob = nullptr; } /////////////////////////////////////////////////////////////// @@ -205,7 +205,7 @@ void ItemListPopupMenuPlugin::erase(int p_idx) { ItemListPopupMenuPlugin::ItemListPopupMenuPlugin() { - pp = NULL; + pp = nullptr; } /////////////////////////////////////////////////////////////// @@ -244,7 +244,7 @@ void ItemListItemListPlugin::erase(int p_idx) { ItemListItemListPlugin::ItemListItemListPlugin() { - pp = NULL; + pp = nullptr; } /////////////////////////////////////////////////////////////// @@ -254,7 +254,7 @@ ItemListItemListPlugin::ItemListItemListPlugin() { void ItemListEditor::_node_removed(Node *p_node) { if (p_node == item_list) { - item_list = NULL; + item_list = nullptr; hide(); dialog->hide(); } @@ -311,7 +311,7 @@ void ItemListEditor::edit(Node *p_item_list) { if (!item_list) { selected_idx = -1; - property_editor->edit(NULL); + property_editor->edit(nullptr); return; } @@ -329,7 +329,7 @@ void ItemListEditor::edit(Node *p_item_list) { } selected_idx = -1; - property_editor->edit(NULL); + property_editor->edit(nullptr); } bool ItemListEditor::handles(Object *p_object) const { @@ -349,7 +349,7 @@ void ItemListEditor::_bind_methods() { ItemListEditor::ItemListEditor() { selected_idx = -1; - item_list = NULL; + item_list = nullptr; toolbar_button = memnew(ToolButton); toolbar_button->set_text(TTR("Items")); @@ -408,7 +408,7 @@ void ItemListEditorPlugin::make_visible(bool p_visible) { } else { item_list_editor->hide(); - item_list_editor->edit(NULL); + item_list_editor->edit(nullptr); } } diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp index 22df287f97..f8550a884b 100644 --- a/editor/plugins/light_occluder_2d_editor_plugin.cpp +++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp @@ -112,7 +112,7 @@ void LightOccluder2DEditor::_create_resource() { LightOccluder2DEditor::LightOccluder2DEditor(EditorNode *p_editor) : AbstractPolygon2DEditor(p_editor) { - node = NULL; + node = nullptr; } LightOccluder2DEditorPlugin::LightOccluder2DEditorPlugin(EditorNode *p_node) : diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp index 4ac9d0af3b..5b887390a6 100644 --- a/editor/plugins/line_2d_editor_plugin.cpp +++ b/editor/plugins/line_2d_editor_plugin.cpp @@ -64,7 +64,7 @@ void Line2DEditor::_action_set_polygon(int p_idx, const Variant &p_previous, con Line2DEditor::Line2DEditor(EditorNode *p_editor) : AbstractPolygon2DEditor(p_editor) { - node = NULL; + node = nullptr; } Line2DEditorPlugin::Line2DEditorPlugin(EditorNode *p_node) : diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index a8b455fdd2..5e657c3b71 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -173,7 +173,7 @@ MeshEditor::MeshEditor() { bool EditorInspectorPluginMesh::can_handle(Object *p_object) { - return Object::cast_to(p_object) != NULL; + return Object::cast_to(p_object) != nullptr; } void EditorInspectorPluginMesh::parse_begin(Object *p_object) { diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index ccefdcd28f..7819f62bc7 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -40,7 +40,7 @@ void MeshInstance3DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; options->hide(); } } @@ -337,7 +337,7 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) { const Vector2 *r = uv.ptr(); Vector indices = a[Mesh::ARRAY_INDEX]; - const int *ri = NULL; + const int *ri = nullptr; int ic; @@ -511,7 +511,7 @@ void MeshInstance3DEditorPlugin::make_visible(bool p_visible) { } else { mesh_editor->options->hide(); - mesh_editor->edit(NULL); + mesh_editor->edit(nullptr); } } diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index 3257db8751..4f482c2b43 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -37,7 +37,7 @@ void MultiMeshEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; hide(); } } @@ -371,7 +371,7 @@ MultiMeshEditor::MultiMeshEditor() { populate_dialog->add_child(std); std->connect("selected", callable_mp(this, &MultiMeshEditor::_browsed)); - _last_pp_node = NULL; + _last_pp_node = nullptr; err_dialog = memnew(AcceptDialog); add_child(err_dialog); @@ -394,7 +394,7 @@ void MultiMeshEditorPlugin::make_visible(bool p_visible) { } else { multimesh_editor->options->hide(); - multimesh_editor->edit(NULL); + multimesh_editor->edit(nullptr); } } diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp index 6671d0b6b4..e41b32ac86 100644 --- a/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -123,7 +123,7 @@ void NavigationPolygonEditor::_create_resource() { NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) : AbstractPolygon2DEditor(p_editor) { - node = NULL; + node = nullptr; } NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) : diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 01868ba77e..afd8d2d075 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -501,7 +501,7 @@ ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, b Node *edited_scene = get_tree()->get_edited_scene_root(); ObjectID closest; - Node *item = NULL; + Node *item = nullptr; float closest_dist = 1e20; int selected_handle = -1; @@ -588,7 +588,7 @@ void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, bool &r_inclu Vector3 normal; int handle = -1; - bool inters = seg->intersect_ray(camera, p_pos, point, normal, NULL, p_alt_select); + bool inters = seg->intersect_ray(camera, p_pos, point, normal, nullptr, p_alt_select); if (!inters) continue; @@ -2273,7 +2273,7 @@ static bool is_shortcut_pressed(const String &p_path) { return false; } InputEventKey *k = Object::cast_to(shortcut->get_shortcut().ptr()); - if (k == NULL) { + if (k == nullptr) { return false; } const InputFilter &input = *InputFilter::get_singleton(); @@ -2386,11 +2386,11 @@ void Node3DEditorViewport::_notification(int p_what) { _update_freelook(delta); Node *scene_root = editor->get_scene_tree_dock()->get_editor_data()->get_edited_scene_root(); - if (previewing_cinema && scene_root != NULL) { + if (previewing_cinema && scene_root != nullptr) { Camera3D *cam = scene_root->get_viewport()->get_camera(); - if (cam != NULL && cam != previewing) { + if (cam != nullptr && cam != previewing) { //then switch the viewport's camera to the scene's viewport camera - if (previewing != NULL) { + if (previewing != nullptr) { previewing->disconnect("tree_exited", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene)); } previewing = cam; @@ -2950,7 +2950,7 @@ void Node3DEditorViewport::_menu_option(int p_option) { if (current) { preview_camera->hide(); } else { - if (previewing != NULL) + if (previewing != nullptr) preview_camera->show(); } } break; @@ -3137,7 +3137,7 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) { if (!p_activate) { previewing->disconnect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene)); - previewing = NULL; + previewing = nullptr; RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore if (!preview) preview_camera->hide(); @@ -3157,10 +3157,10 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) { void Node3DEditorViewport::_toggle_cinema_preview(bool p_activate) { previewing_cinema = p_activate; if (!previewing_cinema) { - if (previewing != NULL) + if (previewing != nullptr) previewing->disconnect("tree_exited", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene)); - previewing = NULL; + previewing = nullptr; RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore preview_camera->set_pressed(false); if (!preview) { @@ -3503,7 +3503,7 @@ Vector3 Node3DEditorViewport::_get_instance_position(const Point2 &p_pos) const Vector3 hit_point; Vector3 hit_normal; - bool inters = seg->intersect_ray(camera, p_pos, hit_point, hit_normal, NULL, false); + bool inters = seg->intersect_ray(camera, p_pos, hit_point, hit_normal, nullptr, false); if (!inters) continue; @@ -3568,8 +3568,8 @@ void Node3DEditorViewport::_create_preview(const Vector &files) const { ERR_CONTINUE(res.is_null()); Ref scene = Ref(Object::cast_to(*res)); Ref mesh = Ref(Object::cast_to(*res)); - if (mesh != NULL || scene != NULL) { - if (mesh != NULL) { + if (mesh != nullptr || scene != nullptr) { + if (mesh != nullptr) { MeshInstance3D *mesh_instance = memnew(MeshInstance3D); mesh_instance->set_mesh(mesh); preview_node->add_child(mesh_instance); @@ -3620,10 +3620,10 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po Ref scene = Ref(Object::cast_to(*res)); Ref mesh = Ref(Object::cast_to(*res)); - Node *instanced_scene = NULL; + Node *instanced_scene = nullptr; - if (mesh != NULL || scene != NULL) { - if (mesh != NULL) { + if (mesh != nullptr || scene != nullptr) { + if (mesh != nullptr) { MeshInstance3D *mesh_instance = memnew(MeshInstance3D); mesh_instance->set_mesh(mesh); mesh_instance->set_name(path.get_file().get_basename()); @@ -3637,7 +3637,7 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po } } - if (instanced_scene == NULL) { + if (instanced_scene == nullptr) { return false; } @@ -3648,7 +3648,7 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po } } - if (scene != NULL) { + if (scene != nullptr) { instanced_scene->set_filename(ProjectSettings::get_singleton()->localize_path(path)); } @@ -3689,7 +3689,7 @@ void Node3DEditorViewport::_perform_drop_data() { } Ref scene = Ref(Object::cast_to(*res)); Ref mesh = Ref(Object::cast_to(*res)); - if (mesh != NULL || scene != NULL) { + if (mesh != nullptr || scene != nullptr) { bool success = _create_instance(target_node, path, drop_pos); if (!success) { error_files.push_back(path); @@ -3964,10 +3964,10 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito preview_camera->set_h_size_flags(0); preview_camera->hide(); preview_camera->connect("toggled", callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview)); - previewing = NULL; + previewing = nullptr; gizmo_scale = 1.0; - preview_node = NULL; + preview_node = nullptr; info_label = memnew(Label); info_label->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE); @@ -4030,7 +4030,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito surface->add_child(top_right_vbox); - accept = NULL; + accept = nullptr; freelook_active = false; freelook_speed = EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_base_speed"); @@ -4393,7 +4393,7 @@ Node3DEditorViewportContainer::Node3DEditorViewportContainer() { /////////////////////////////////////////////////////////////////// -Node3DEditor *Node3DEditor::singleton = NULL; +Node3DEditor *Node3DEditor::singleton = nullptr; Node3DEditorSelectedItem::~Node3DEditorSelectedItem() { @@ -4479,7 +4479,7 @@ Object *Node3DEditor::_get_editor_data(Object *p_what) { Node3D *sp = Object::cast_to(p_what); if (!sp) - return NULL; + return nullptr; Node3DEditorSelectedItem *si = memnew(Node3DEditorSelectedItem); @@ -5903,7 +5903,7 @@ void Node3DEditor::_toggle_maximize_view(Object *p_viewport) { void Node3DEditor::_node_removed(Node *p_node) { if (p_node == selected) - selected = NULL; + selected = nullptr; } void Node3DEditor::_register_all_gizmos() { @@ -5979,7 +5979,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { undo_redo = p_editor->get_undo_redo(); VBoxContainer *vbc = this; - custom_camera = NULL; + custom_camera = nullptr; singleton = this; editor = p_editor; editor_selection = editor->get_editor_selection(); @@ -6315,7 +6315,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { scenario_debug = RenderingServer::SCENARIO_DEBUG_DISABLED; - selected = NULL; + selected = nullptr; set_process_unhandled_key_input(true); add_to_group("_spatial_editor_group"); @@ -6761,8 +6761,8 @@ EditorNode3DGizmoPlugin::EditorNode3DGizmoPlugin() { EditorNode3DGizmoPlugin::~EditorNode3DGizmoPlugin() { for (int i = 0; i < current_gizmos.size(); ++i) { - current_gizmos[i]->set_plugin(NULL); - current_gizmos[i]->get_spatial_node()->set_gizmo(NULL); + current_gizmos[i]->set_plugin(nullptr); + current_gizmos[i]->get_spatial_node()->set_gizmo(nullptr); } if (Node3DEditor::get_singleton()) { Node3DEditor::get_singleton()->update_all_gizmos(); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 4b9f5a605b..e485edae02 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -123,7 +123,7 @@ public: Ref get_plugin() const { return gizmo_plugin; } Vector3 get_handle_pos(int p_idx) const; bool intersect_frustum(const Camera3D *p_camera, const Vector &p_frustum); - bool intersect_ray(Camera3D *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false); + bool intersect_ray(Camera3D *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = nullptr, bool p_sec_first = false); virtual void clear(); virtual void create(); @@ -295,7 +295,7 @@ private: void _clear_selected(); void _select_clicked(bool p_append, bool p_single, bool p_allow_locked = false); void _select(Node *p_node, bool p_append, bool p_single); - ObjectID _select_ray(const Point2 &p_pos, bool p_append, bool &r_includes_current, int *r_gizmo_handle = NULL, bool p_alt_select = false); + ObjectID _select_ray(const Point2 &p_pos, bool p_append, bool &r_includes_current, int *r_gizmo_handle = nullptr, bool p_alt_select = false); void _find_items_at_pos(const Point2 &p_pos, bool &r_includes_current, Vector<_RayResult> &results, bool p_alt_select = false); Vector3 _get_ray_pos(const Vector2 &p_pos) const; Vector3 _get_ray(const Vector2 &p_pos) const; @@ -487,7 +487,7 @@ public: RID sbox_instance; Node3DEditorSelectedItem() { - sp = NULL; + sp = nullptr; last_xform_dirty = true; } ~Node3DEditorSelectedItem(); @@ -761,7 +761,7 @@ public: Ref get_scale_plane_gizmo(int idx) const { return scale_plane_gizmo[idx]; } void update_transform_gizmo(); - void update_all_gizmos(Node *p_node = NULL); + void update_all_gizmos(Node *p_node = nullptr); void snap_selected_nodes_to_floor(); void select_gizmo_highlight_axis(int p_axis); void set_custom_camera(Node *p_camera) { custom_camera = p_camera; } @@ -788,7 +788,7 @@ public: void set_can_preview(Camera3D *p_preview); Node3DEditorViewport *get_editor_viewport(int p_idx) { - ERR_FAIL_INDEX_V(p_idx, static_cast(VIEWPORTS_COUNT), NULL); + ERR_FAIL_INDEX_V(p_idx, static_cast(VIEWPORTS_COUNT), nullptr); return viewports[p_idx]; } diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 75c5fcb994..4516b7035b 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -56,7 +56,7 @@ void Path2DEditor::_notification(int p_what) { void Path2DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; hide(); } } @@ -288,7 +288,7 @@ bool Path2DEditor::forward_gui_input(const Ref &p_event) { Vector2 gpoint = mm->get_position(); Ref curve = node->get_curve(); - if (curve == NULL) return true; + if (curve == nullptr) return true; if (curve->get_point_count() < 2) return true; // Find edge @@ -449,7 +449,7 @@ void Path2DEditor::edit(Node *p_path2d) { // node may have been deleted at this point if (node && node->is_connected("visibility_changed", callable_mp(this, &Path2DEditor::_node_visibility_changed))) node->disconnect("visibility_changed", callable_mp(this, &Path2DEditor::_node_visibility_changed)); - node = NULL; + node = nullptr; } } @@ -532,7 +532,7 @@ void Path2DEditor::_handle_option_pressed(int p_option) { Path2DEditor::Path2DEditor(EditorNode *p_editor) { - canvas_item_editor = NULL; + canvas_item_editor = nullptr; editor = p_editor; undo_redo = editor->get_undo_redo(); mirror_handle_angle = true; @@ -620,7 +620,7 @@ void Path2DEditorPlugin::make_visible(bool p_visible) { path2d_editor->hide(); path2d_editor->base_hb->hide(); - path2d_editor->edit(NULL); + path2d_editor->edit(nullptr); } } diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index cf8ddb84cd..3ee8225418 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -460,7 +460,7 @@ void Path3DEditorPlugin::edit(Object *p_object) { } } else { Path3D *pre = path; - path = NULL; + path = nullptr; if (pre) { pre->get_curve()->emit_signal("changed"); } @@ -494,7 +494,7 @@ void Path3DEditorPlugin::make_visible(bool p_visible) { { Path3D *pre = path; - path = NULL; + path = nullptr; if (pre && pre->get_curve().is_valid()) { pre->get_curve()->emit_signal("changed"); } @@ -553,11 +553,11 @@ void Path3DEditorPlugin::_notification(int p_what) { void Path3DEditorPlugin::_bind_methods() { } -Path3DEditorPlugin *Path3DEditorPlugin::singleton = NULL; +Path3DEditorPlugin *Path3DEditorPlugin::singleton = nullptr; Path3DEditorPlugin::Path3DEditorPlugin(EditorNode *p_node) { - path = NULL; + path = nullptr; editor = p_node; singleton = this; mirror_handle_angle = true; diff --git a/editor/plugins/path_3d_editor_plugin.h b/editor/plugins/path_3d_editor_plugin.h index 15804faa47..715f8d1bb5 100644 --- a/editor/plugins/path_3d_editor_plugin.h +++ b/editor/plugins/path_3d_editor_plugin.h @@ -50,7 +50,7 @@ public: virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false); virtual void redraw(); - PathNode3DGizmo(Path3D *p_path = NULL); + PathNode3DGizmo(Path3D *p_path = nullptr); }; class PathNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { diff --git a/editor/plugins/physical_bone_3d_editor_plugin.cpp b/editor/plugins/physical_bone_3d_editor_plugin.cpp index dd6d7b109b..6d38f7f318 100644 --- a/editor/plugins/physical_bone_3d_editor_plugin.cpp +++ b/editor/plugins/physical_bone_3d_editor_plugin.cpp @@ -49,7 +49,7 @@ void PhysicalBone3DEditor::_set_move_joint() { PhysicalBone3DEditor::PhysicalBone3DEditor(EditorNode *p_editor) : editor(p_editor), - selected(NULL) { + selected(nullptr) { spatial_editor_hb = memnew(HBoxContainer); spatial_editor_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -90,7 +90,7 @@ void PhysicalBone3DEditor::show() { PhysicalBone3DEditorPlugin::PhysicalBone3DEditorPlugin(EditorNode *p_editor) : editor(p_editor), - selected(NULL), + selected(nullptr), physical_bone_editor(editor) {} void PhysicalBone3DEditorPlugin::make_visible(bool p_visible) { @@ -100,8 +100,8 @@ void PhysicalBone3DEditorPlugin::make_visible(bool p_visible) { } else { physical_bone_editor.hide(); - physical_bone_editor.set_selected(NULL); - selected = NULL; + physical_bone_editor.set_selected(nullptr); + selected = nullptr; } } diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index a5bd5aed6b..1f7a5b9968 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -107,7 +107,7 @@ void Polygon2DEditor::_notification(int p_what) { void Polygon2DEditor::_sync_bones() { - Skeleton2D *skeleton = NULL; + Skeleton2D *skeleton = nullptr; if (!node->has_node(node->get_skeleton())) { error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node")); error->popup_centered(); @@ -1031,7 +1031,7 @@ void Polygon2DEditor::_uv_draw() { uvs = node->get_polygon(); } - const float *weight_r = NULL; + const float *weight_r = nullptr; if (uv_edit_mode[3]->is_pressed()) { int bone_selected = -1; @@ -1249,7 +1249,7 @@ Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const { Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : AbstractPolygon2DEditor(p_editor) { - node = NULL; + node = nullptr; snap_offset = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_offset", Vector2()); snap_step = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_step", Vector2(10, 10)); use_snap = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_enabled", false); diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 8def56f968..852feeb675 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -181,7 +181,7 @@ void ResourcePreloaderEditor::_update_library() { tree->clear(); tree->set_hide_root(true); - TreeItem *root = tree->create_item(NULL); + TreeItem *root = tree->create_item(nullptr); List rnames; preloader->get_resource_list(&rnames); diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 516c52a8a4..67e836082d 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -88,7 +88,7 @@ void EditorPropertyRootMotion::_node_assign() { for (Set::Element *E = paths.front(); E; E = E->next()) { NodePath path = E->get(); - TreeItem *ti = NULL; + TreeItem *ti = nullptr; String accum; for (int i = 0; i < path.get_name_count(); i++) { String name = path.get_name(i); @@ -117,7 +117,7 @@ void EditorPropertyRootMotion::_node_assign() { } } - Node *node = NULL; + Node *node = nullptr; if (base->has_node(accum)) { node = base->get_node(accum); } @@ -212,7 +212,7 @@ void EditorPropertyRootMotion::update_property() { } assign->set_flat(true); - Node *base_node = NULL; + Node *base_node = nullptr; if (base_hint != NodePath()) { if (get_tree()->get_root()->has_node(base_hint)) { base_node = get_tree()->get_root()->get_node(base_hint); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 0e867f7b16..ff97e6bfd6 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -193,7 +193,7 @@ void ScriptEditorQuickOpen::_update_search() { } } - get_ok()->set_disabled(root->get_children() == NULL); + get_ok()->set_disabled(root->get_children() == nullptr); } void ScriptEditorQuickOpen::_confirmed() { @@ -252,7 +252,7 @@ ScriptEditorQuickOpen::ScriptEditorQuickOpen() { ///////////////////////////////// -ScriptEditor *ScriptEditor::script_editor = NULL; +ScriptEditor *ScriptEditor::script_editor = nullptr; /*** SCRIPT EDITOR ******/ @@ -321,7 +321,7 @@ void ScriptEditor::_set_execution(REF p_script, int p_line) { if (!se) continue; - if ((script != NULL && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) { + if ((script != nullptr && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) { se->set_executing_line(p_line); } } @@ -337,7 +337,7 @@ void ScriptEditor::_clear_execution(REF p_script) { if (!se) continue; - if ((script != NULL && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) { + if ((script != nullptr && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) { se->clear_executing_line(); } } @@ -348,7 +348,7 @@ ScriptEditorBase *ScriptEditor::_get_current_editor() const { int selected = tab_container->get_current_tab(); if (selected < 0 || selected >= tab_container->get_child_count()) - return NULL; + return nullptr; return Object::cast_to(tab_container->get_child(selected)); } @@ -434,7 +434,7 @@ void ScriptEditor::_go_to_tab(int p_idx) { Object::cast_to(c)->ensure_focus(); Ref