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 --- modules/assimp/editor_scene_importer_assimp.cpp | 68 ++--- modules/assimp/editor_scene_importer_assimp.h | 2 +- modules/assimp/import_state.h | 10 +- modules/assimp/import_utils.h | 10 +- modules/basis_universal/register_types.cpp | 6 +- modules/basis_universal/texture_basisu.cpp | 2 +- modules/bmp/image_loader_bmp.cpp | 4 +- modules/bmp/register_types.cpp | 2 +- modules/bullet/area_bullet.h | 2 +- modules/bullet/bullet_physics_server.cpp | 34 +-- modules/bullet/bullet_physics_server.h | 2 +- modules/bullet/bullet_utilities.h | 2 +- modules/bullet/collision_object_bullet.cpp | 12 +- modules/bullet/collision_object_bullet.h | 8 +- modules/bullet/constraint_bullet.cpp | 4 +- modules/bullet/constraint_bullet.h | 2 +- modules/bullet/godot_collision_configuration.cpp | 4 +- modules/bullet/godot_result_callbacks.cpp | 4 +- modules/bullet/rigid_body_bullet.cpp | 20 +- modules/bullet/rigid_body_bullet.h | 4 +- modules/bullet/shape_bullet.cpp | 8 +- modules/bullet/soft_body_bullet.cpp | 6 +- modules/bullet/space_bullet.cpp | 56 ++-- modules/bullet/space_bullet.h | 10 +- modules/csg/csg_shape.cpp | 52 ++-- modules/dds/texture_loader_dds.h | 2 +- modules/enet/networked_multiplayer_enet.cpp | 28 +- modules/etc/image_etc.cpp | 2 +- modules/etc/texture_loader_pkm.h | 2 +- modules/gdnative/android/android_gdn.cpp | 6 +- modules/gdnative/arvr/arvr_interface_gdnative.cpp | 60 ++--- modules/gdnative/gdnative.cpp | 14 +- modules/gdnative/gdnative/gdnative.cpp | 8 +- .../gdnative/gdnative_library_editor_plugin.cpp | 2 +- .../include/pluginscript/godot_pluginscript.h | 12 +- modules/gdnative/nativescript/api_generator.cpp | 14 +- .../gdnative/nativescript/godot_nativescript.cpp | 14 +- modules/gdnative/nativescript/nativescript.cpp | 32 +-- modules/gdnative/nativescript/nativescript.h | 8 +- modules/gdnative/net/multiplayer_peer_gdnative.cpp | 30 +-- modules/gdnative/net/packet_peer_gdnative.cpp | 10 +- modules/gdnative/net/stream_peer_gdnative.cpp | 12 +- .../pluginscript/pluginscript_instance.cpp | 2 +- .../gdnative/pluginscript/pluginscript_instance.h | 2 +- .../gdnative/pluginscript/pluginscript_language.h | 2 +- .../gdnative/pluginscript/pluginscript_loader.cpp | 2 +- .../gdnative/pluginscript/pluginscript_loader.h | 2 +- .../gdnative/pluginscript/pluginscript_script.cpp | 32 +-- .../videodecoder/video_stream_gdnative.cpp | 48 ++-- .../gdnative/videodecoder/video_stream_gdnative.h | 8 +- modules/gdnavigation/gd_navigation_server.cpp | 84 +++--- modules/gdnavigation/nav_map.cpp | 24 +- modules/gdnavigation/nav_region.cpp | 4 +- modules/gdnavigation/nav_utils.h | 6 +- .../gdnavigation/navigation_mesh_editor_plugin.cpp | 8 +- modules/gdnavigation/navigation_mesh_generator.cpp | 34 +-- modules/gdnavigation/register_types.cpp | 2 +- modules/gdnavigation/rvo_agent.cpp | 4 +- modules/gdscript/gdscript.cpp | 60 ++--- modules/gdscript/gdscript.h | 8 +- modules/gdscript/gdscript_compiler.cpp | 28 +- modules/gdscript/gdscript_editor.cpp | 90 +++---- modules/gdscript/gdscript_function.cpp | 58 ++--- modules/gdscript/gdscript_function.h | 4 +- modules/gdscript/gdscript_functions.cpp | 6 +- modules/gdscript/gdscript_parser.cpp | 284 ++++++++++----------- modules/gdscript/gdscript_parser.h | 24 +- modules/gdscript/gdscript_tokenizer.cpp | 10 +- .../language_server/gdscript_extend_parser.cpp | 16 +- .../language_server/gdscript_language_protocol.cpp | 16 +- .../language_server/gdscript_language_server.cpp | 8 +- .../language_server/gdscript_text_document.cpp | 6 +- .../language_server/gdscript_workspace.cpp | 20 +- modules/gdscript/register_types.cpp | 2 +- modules/gridmap/grid_map.cpp | 4 +- modules/gridmap/grid_map_editor_plugin.cpp | 6 +- modules/hdr/register_types.cpp | 2 +- modules/jpg/register_types.cpp | 2 +- modules/jsonrpc/jsonrpc.cpp | 2 +- modules/mbedtls/crypto_mbedtls.cpp | 26 +- modules/mbedtls/crypto_mbedtls.h | 4 +- modules/mbedtls/dtls_server_mbedtls.cpp | 2 +- modules/mbedtls/packet_peer_mbed_dtls.cpp | 16 +- modules/mbedtls/ssl_context_mbedtls.cpp | 14 +- modules/mbedtls/stream_peer_mbedtls.cpp | 14 +- modules/mobile_vr/mobile_vr_interface.cpp | 2 +- modules/mono/class_db_api_json.cpp | 10 +- modules/mono/csharp_script.cpp | 172 ++++++------- modules/mono/csharp_script.h | 8 +- modules/mono/editor/bindings_generator.cpp | 40 +-- modules/mono/editor/bindings_generator.h | 18 +- modules/mono/editor/csharp_project.cpp | 4 +- modules/mono/editor/editor_internal_calls.cpp | 18 +- modules/mono/editor/godotsharp_export.cpp | 10 +- modules/mono/glue/base_object_glue.cpp | 14 +- modules/mono/glue/collections_glue.cpp | 26 +- modules/mono/glue/gd_glue.cpp | 18 +- modules/mono/glue/glue_header.h | 2 +- modules/mono/managed_callable.cpp | 4 +- modules/mono/mono_gc_handle.cpp | 2 +- modules/mono/mono_gc_handle.h | 2 +- modules/mono/mono_gd/gd_mono.cpp | 92 +++---- modules/mono/mono_gd/gd_mono.h | 6 +- modules/mono/mono_gd/gd_mono_assembly.cpp | 46 ++-- modules/mono/mono_gd/gd_mono_cache.cpp | 164 ++++++------ modules/mono/mono_gd/gd_mono_class.cpp | 78 +++--- modules/mono/mono_gd/gd_mono_field.cpp | 10 +- modules/mono/mono_gd/gd_mono_internals.cpp | 4 +- modules/mono/mono_gd/gd_mono_log.cpp | 8 +- modules/mono/mono_gd/gd_mono_marshal.cpp | 42 +-- modules/mono/mono_gd/gd_mono_marshal.h | 4 +- modules/mono/mono_gd/gd_mono_method.cpp | 30 +-- modules/mono/mono_gd/gd_mono_method.h | 6 +- modules/mono/mono_gd/gd_mono_method_thunk.h | 50 ++-- modules/mono/mono_gd/gd_mono_property.cpp | 32 +-- modules/mono/mono_gd/gd_mono_property.h | 6 +- modules/mono/mono_gd/gd_mono_utils.cpp | 104 ++++---- modules/mono/mono_gd/gd_mono_utils.h | 8 +- modules/mono/mono_gd/managed_type.h | 2 +- modules/mono/mono_gd/support/android_support.cpp | 60 ++--- modules/mono/register_types.cpp | 4 +- modules/mono/signal_awaiter_utils.cpp | 4 +- modules/mono/utils/mono_reg_utils.cpp | 6 +- modules/mono/utils/osx_utils.cpp | 6 +- modules/mono/utils/path_utils.cpp | 10 +- modules/mono/utils/string_utils.cpp | 2 +- modules/opensimplex/noise_texture.cpp | 4 +- modules/pvr/texture_loader_pvr.cpp | 2 +- modules/pvr/texture_loader_pvr.h | 2 +- modules/regex/regex.cpp | 26 +- modules/stb_vorbis/audio_stream_ogg_vorbis.cpp | 12 +- modules/stb_vorbis/resource_importer_ogg_vorbis.h | 2 +- modules/svg/image_loader_svg.cpp | 4 +- modules/svg/image_loader_svg.h | 2 +- modules/svg/register_types.cpp | 2 +- modules/tga/image_loader_tga.cpp | 2 +- modules/tga/register_types.cpp | 2 +- modules/theora/video_stream_theora.cpp | 14 +- modules/theora/video_stream_theora.h | 2 +- modules/tinyexr/image_loader_tinyexr.cpp | 6 +- modules/tinyexr/register_types.cpp | 4 +- modules/upnp/upnp.cpp | 24 +- modules/upnp/upnp_device.cpp | 8 +- modules/vhacd/register_types.cpp | 2 +- modules/visual_script/register_types.cpp | 4 +- modules/visual_script/visual_script.cpp | 38 +-- modules/visual_script/visual_script.h | 4 +- .../visual_script/visual_script_builtin_funcs.cpp | 4 +- modules/visual_script/visual_script_editor.cpp | 22 +- modules/visual_script/visual_script_expression.cpp | 66 ++--- modules/visual_script/visual_script_expression.h | 2 +- modules/visual_script/visual_script_func_nodes.cpp | 56 ++-- modules/visual_script/visual_script_nodes.cpp | 8 +- .../visual_script_property_selector.cpp | 24 +- .../visual_script/visual_script_yield_nodes.cpp | 18 +- modules/webm/video_stream_webm.cpp | 34 +-- modules/webm/video_stream_webm.h | 2 +- modules/webp/image_loader_webp.cpp | 10 +- modules/webp/register_types.cpp | 2 +- modules/webrtc/webrtc_data_channel_gdnative.cpp | 36 +-- modules/webrtc/webrtc_data_channel_js.cpp | 4 +- modules/webrtc/webrtc_multiplayer.cpp | 2 +- modules/webrtc/webrtc_peer_connection.cpp | 4 +- modules/webrtc/webrtc_peer_connection_gdnative.cpp | 24 +- modules/webrtc/webrtc_peer_connection_js.cpp | 2 +- modules/websocket/emws_server.cpp | 2 +- modules/websocket/packet_buffer.h | 4 +- modules/websocket/websocket_macros.h | 4 +- modules/websocket/websocket_multiplayer_peer.cpp | 10 +- modules/websocket/wsl_client.cpp | 4 +- modules/websocket/wsl_peer.cpp | 20 +- modules/websocket/wsl_peer.h | 6 +- modules/websocket/wsl_server.cpp | 2 +- modules/xatlas_unwrap/register_types.cpp | 4 +- 174 files changed, 1631 insertions(+), 1631 deletions(-) (limited to 'modules') diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp index d163512bb3..cc74674eff 100644 --- a/modules/assimp/editor_scene_importer_assimp.cpp +++ b/modules/assimp/editor_scene_importer_assimp.cpp @@ -62,7 +62,7 @@ aiBone *get_bone_by_name(const aiScene *scene, aiString bone_name) { } } - return NULL; + return nullptr; } void EditorSceneImporterAssimp::get_extensions(List *r_extensions) const { @@ -149,7 +149,7 @@ Node *EditorSceneImporterAssimp::import_scene(const String &p_path, uint32_t p_f 0; aiScene *scene = (aiScene *)importer.ReadFile(s_path.c_str(), post_process_Steps); - ERR_FAIL_COND_V_MSG(scene == NULL, NULL, String("Open Asset Import failed to open: ") + String(importer.GetErrorString())); + ERR_FAIL_COND_V_MSG(scene == nullptr, nullptr, String("Open Asset Import failed to open: ") + String(importer.GetErrorString())); return _generate_scene(p_path, scene, p_flags, p_bake_fps, max_bone_weights); } @@ -284,7 +284,7 @@ T EditorSceneImporterAssimp::_interpolate_track(const Vector &p_times, co aiBone *EditorSceneImporterAssimp::get_bone_from_stack(ImportState &state, aiString name) { List::Element *iter; - aiBone *bone = NULL; + aiBone *bone = nullptr; for (iter = state.bone_stack.front(); iter; iter = iter->next()) { bone = (aiBone *)iter->get(); @@ -294,32 +294,32 @@ aiBone *EditorSceneImporterAssimp::get_bone_from_stack(ImportState &state, aiStr } } - return NULL; + return nullptr; } Node3D * EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, const uint32_t p_flags, int p_bake_fps, const int32_t p_max_bone_weights) { - ERR_FAIL_COND_V(scene == NULL, NULL); + ERR_FAIL_COND_V(scene == nullptr, nullptr); ImportState state; state.path = p_path; state.assimp_scene = scene; state.max_bone_weights = p_max_bone_weights; - state.animation_player = NULL; + state.animation_player = nullptr; // populate light map for (unsigned int l = 0; l < scene->mNumLights; l++) { aiLight *ai_light = scene->mLights[l]; - ERR_CONTINUE(ai_light == NULL); + ERR_CONTINUE(ai_light == nullptr); state.light_cache[AssimpUtils::get_assimp_string(ai_light->mName)] = l; } // fill camera cache for (unsigned int c = 0; c < scene->mNumCameras; c++) { aiCamera *ai_camera = scene->mCameras[c]; - ERR_CONTINUE(ai_camera == NULL); + ERR_CONTINUE(ai_camera == nullptr); state.camera_cache[AssimpUtils::get_assimp_string(ai_camera->mName)] = c; } @@ -333,7 +333,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, RegenerateBoneStack(state); - Node *last_valid_parent = NULL; + Node *last_valid_parent = nullptr; List::Element *iter; for (iter = state.nodes.front(); iter; iter = iter->next()) { @@ -343,7 +343,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, String node_name = AssimpUtils::get_assimp_string(element_assimp_node->mName); //print_verbose("node: " + node_name); - Node3D *spatial = NULL; + Node3D *spatial = nullptr; Transform transform = AssimpUtils::assimp_matrix_transform(element_assimp_node->mTransformation); // retrieve this node bone @@ -361,13 +361,13 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, if (!state.armature_skeletons.has(element_assimp_node)) { state.armature_skeletons.insert(element_assimp_node, skeleton); } - } else if (bone != NULL) { + } else if (bone != nullptr) { continue; } else { spatial = memnew(Node3D); } - ERR_CONTINUE_MSG(spatial == NULL, "FBX Import - are we out of ram?"); + ERR_CONTINUE_MSG(spatial == nullptr, "FBX Import - are we out of ram?"); // we on purpose set the transform and name after creating the node. spatial->set_name(node_name); @@ -387,7 +387,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, if (parent_lookup) { Node3D *parent_node = parent_lookup->value(); - ERR_FAIL_COND_V_MSG(parent_node == NULL, state.root, + ERR_FAIL_COND_V_MSG(parent_node == nullptr, state.root, "Parent node invalid even though lookup successful, out of ram?"); if (spatial != state.root) { @@ -434,7 +434,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, aiNode *parent_node = bone_node->mParent; String bone_name = AssimpUtils::get_anim_string_from_assimp(bone->mName); - ERR_CONTINUE_MSG(armature_for_bone == NULL, "Armature for bone invalid: " + bone_name); + ERR_CONTINUE_MSG(armature_for_bone == nullptr, "Armature for bone invalid: " + bone_name); Skeleton3D *skeleton = state.armature_skeletons[armature_for_bone]; state.skeleton_bone_map[bone] = skeleton; @@ -454,7 +454,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, skeleton->set_bone_rest(boneIdx, pform); skeleton->set_bone_pose(boneIdx, pform); - if (parent_node != NULL) { + if (parent_node != nullptr) { int parent_bone_id = skeleton->find_bone(AssimpUtils::get_anim_string_from_assimp(parent_node->mName)); int current_bone_id = boneIdx; skeleton->set_bone_parent(current_bone_id, parent_bone_id); @@ -470,8 +470,8 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, const aiNode *assimp_node = key_value_pair->key(); Node3D *mesh_template = key_value_pair->value(); - ERR_CONTINUE(assimp_node == NULL); - ERR_CONTINUE(mesh_template == NULL); + ERR_CONTINUE(assimp_node == nullptr); + ERR_CONTINUE(mesh_template == nullptr); Node *parent_node = mesh_template->get_parent(); @@ -479,7 +479,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, continue; } - if (parent_node == NULL) { + if (parent_node == nullptr) { print_error("Found invalid parent node!"); continue; // root node } @@ -661,7 +661,7 @@ Node *EditorSceneImporterAssimp::get_node_by_name(ImportState &state, String nam return node; } } - return NULL; + return nullptr; } /* Bone stack is a fifo handler for multiple armatures since armatures aren't a thing in assimp (yet) */ @@ -691,7 +691,7 @@ void EditorSceneImporterAssimp::RegenerateBoneStack(ImportState &state, aiMesh * // iterate over all the bones on the mesh for this node only! for (unsigned int boneIndex = 0; boneIndex < mesh->mNumBones; boneIndex++) { aiBone *bone = mesh->mBones[boneIndex]; - if (state.bone_stack.find(bone) == NULL) { + if (state.bone_stack.find(bone) == nullptr) { state.bone_stack.push_back(bone); } } @@ -711,7 +711,7 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim print_verbose("import animation: " + name); float ticks_per_second = anim->mTicksPerSecond; - if (state.assimp_scene->mMetaData != NULL && Math::is_equal_approx(ticks_per_second, 0.0f)) { + if (state.assimp_scene->mMetaData != nullptr && Math::is_equal_approx(ticks_per_second, 0.0f)) { int32_t time_mode = 0; state.assimp_scene->mMetaData->Get("TimeMode", time_mode); ticks_per_second = AssimpUtils::get_fbx_fps(time_mode, state.assimp_scene); @@ -747,9 +747,9 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim continue; //do not bother } - Skeleton3D *skeleton = NULL; + Skeleton3D *skeleton = nullptr; NodePath node_path; - aiBone *bone = NULL; + aiBone *bone = nullptr; // Import skeleton bone animation for this track // Any bone will do, no point in processing more than just what is in the skeleton @@ -806,7 +806,7 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim Node *item = get_node_by_name(state, mesh_name); ERR_CONTINUE_MSG(!item, "failed to look up node by name"); const MeshInstance3D *mesh_instance = Object::cast_to(item); - ERR_CONTINUE(mesh_instance == NULL); + ERR_CONTINUE(mesh_instance == nullptr); String base_path = state.root->get_path_to(mesh_instance); @@ -940,7 +940,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat } // Work out normal calculations? - this needs work it doesn't work properly on huestos - if (ai_mesh->mNormals != NULL) { + if (ai_mesh->mNormals != nullptr) { const aiVector3D normals = ai_mesh->mNormals[j]; const Vector3 godot_normal = Vector3(normals.x, normals.y, normals.z); st->add_normal(godot_normal); @@ -1325,8 +1325,8 @@ EditorSceneImporterAssimp::create_mesh(ImportState &state, const aiNode *assimp_ mesh_key += itos(surface_indices[i]); } - Skeleton3D *skeleton = NULL; - aiNode *armature = NULL; + Skeleton3D *skeleton = nullptr; + aiNode *armature = nullptr; if (!state.mesh_cache.has(mesh_key)) { mesh = _generate_mesh_from_surface_indices(state, surface_indices, assimp_node, skin, skeleton); @@ -1411,9 +1411,9 @@ Node3D *EditorSceneImporterAssimp::create_light( ImportState &state, const String &node_name, Transform &look_at_transform) { - Light3D *light = NULL; + Light3D *light = nullptr; aiLight *assimp_light = state.assimp_scene->mLights[state.light_cache[node_name]]; - ERR_FAIL_COND_V(!assimp_light, NULL); + ERR_FAIL_COND_V(!assimp_light, nullptr); if (assimp_light->mType == aiLightSource_DIRECTIONAL) { light = memnew(DirectionalLight3D); @@ -1422,7 +1422,7 @@ Node3D *EditorSceneImporterAssimp::create_light( } else if (assimp_light->mType == aiLightSource_SPOT) { light = memnew(SpotLight3D); } - ERR_FAIL_COND_V(light == NULL, NULL); + ERR_FAIL_COND_V(light == nullptr, nullptr); if (assimp_light->mType != aiLightSource_POINT) { Vector3 pos = Vector3( @@ -1458,10 +1458,10 @@ Node3D *EditorSceneImporterAssimp::create_camera( const String &node_name, Transform &look_at_transform) { aiCamera *camera = state.assimp_scene->mCameras[state.camera_cache[node_name]]; - ERR_FAIL_COND_V(!camera, NULL); + ERR_FAIL_COND_V(!camera, nullptr); Camera3D *camera_node = memnew(Camera3D); - ERR_FAIL_COND_V(!camera_node, NULL); + ERR_FAIL_COND_V(!camera_node, nullptr); float near = camera->mClipPlaneNear; if (Math::is_equal_approx(near, 0.0f)) { near = 0.1f; @@ -1483,7 +1483,7 @@ void EditorSceneImporterAssimp::_generate_node( ImportState &state, const aiNode *assimp_node) { - ERR_FAIL_COND(assimp_node == NULL); + ERR_FAIL_COND(assimp_node == nullptr); state.nodes.push_back(assimp_node); String parent_name = AssimpUtils::get_assimp_string(assimp_node->mParent->mName); @@ -1498,7 +1498,7 @@ void EditorSceneImporterAssimp::_generate_node( // is this an armature // parent null // and this is the first bone :) - if (parent_bone == NULL && current_bone) { + if (parent_bone == nullptr && current_bone) { state.armature_nodes.push_back(assimp_node->mParent); print_verbose("found valid armature: " + parent_name); } diff --git a/modules/assimp/editor_scene_importer_assimp.h b/modules/assimp/editor_scene_importer_assimp.h index 5059138b64..ab00a6c3aa 100644 --- a/modules/assimp/editor_scene_importer_assimp.h +++ b/modules/assimp/editor_scene_importer_assimp.h @@ -138,7 +138,7 @@ public: virtual void get_extensions(List *r_extensions) const; virtual uint32_t get_import_flags() const; - virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List *r_missing_deps, Error *r_err = NULL); + virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List *r_missing_deps, Error *r_err = nullptr); Ref load_image(ImportState &state, const aiScene *p_scene, String p_path); static void RegenerateBoneStack(ImportState &state); diff --git a/modules/assimp/import_state.h b/modules/assimp/import_state.h index b16366b38c..cda1a854f0 100644 --- a/modules/assimp/import_state.h +++ b/modules/assimp/import_state.h @@ -118,12 +118,12 @@ struct RecursiveState { bone(_bone) {} Transform node_transform; - Skeleton3D *skeleton = NULL; - Node3D *new_node = NULL; + Skeleton3D *skeleton = nullptr; + Node3D *new_node = nullptr; String node_name; - aiNode *assimp_node = NULL; - Node *parent_node = NULL; - aiBone *bone = NULL; + aiNode *assimp_node = nullptr; + Node *parent_node = nullptr; + aiBone *bone = nullptr; }; } // namespace AssimpImporter diff --git a/modules/assimp/import_utils.h b/modules/assimp/import_utils.h index 30c00f8765..f78931add3 100644 --- a/modules/assimp/import_utils.h +++ b/modules/assimp/import_utils.h @@ -233,7 +233,7 @@ public: static Transform _get_global_assimp_node_transform(const aiNode *p_current_node) { aiNode const *current_node = p_current_node; Transform xform; - while (current_node != NULL) { + while (current_node != nullptr) { xform = assimp_matrix_transform(current_node->mTransformation) * xform; current_node = current_node->mParent; } @@ -319,7 +319,7 @@ public: */ static void set_texture_mapping_mode(aiTextureMapMode *map_mode, Ref texture) { ERR_FAIL_COND(texture.is_null()); - ERR_FAIL_COND(map_mode == NULL); + ERR_FAIL_COND(map_mode == nullptr); // FIXME: Commented out during Vulkan port. /* aiTextureMapMode tex_mode = map_mode[0]; @@ -358,13 +358,13 @@ public: print_verbose("Open Asset Import: Loading embedded texture " + filename); if (tex->mHeight == 0) { if (tex->CheckFormat("png")) { - ERR_FAIL_COND_V(Image::_png_mem_loader_func == NULL, Ref()); + ERR_FAIL_COND_V(Image::_png_mem_loader_func == nullptr, Ref()); Ref img = Image::_png_mem_loader_func((uint8_t *)tex->pcData, tex->mWidth); ERR_FAIL_COND_V(img.is_null(), Ref()); state.path_to_image_cache.insert(p_path, img); return img; } else if (tex->CheckFormat("jpg")) { - ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == NULL, Ref()); + ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == nullptr, Ref()); Ref img = Image::_jpg_mem_loader_func((uint8_t *)tex->pcData, tex->mWidth); ERR_FAIL_COND_V(img.is_null(), Ref()); state.path_to_image_cache.insert(p_path, img); @@ -440,7 +440,7 @@ public: String &path, AssimpImageData &image_state) { aiString ai_filename = aiString(); - if (AI_SUCCESS == ai_material->GetTexture(texture_type, 0, &ai_filename, NULL, NULL, NULL, NULL, image_state.map_mode)) { + if (AI_SUCCESS == ai_material->GetTexture(texture_type, 0, &ai_filename, nullptr, nullptr, nullptr, nullptr, image_state.map_mode)) { return CreateAssimpTexture(state, ai_filename, filename, path, image_state); } diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index 5784341d80..f31c889a6d 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -229,7 +229,7 @@ static Ref basis_universal_unpacker(const Vector &p_buffer) { ptr += 4; size -= 4; - basist::basisu_transcoder tr(NULL); + basist::basisu_transcoder tr(nullptr); ERR_FAIL_COND_V(!tr.validate_header(ptr, size), image); @@ -282,7 +282,7 @@ void unregister_basis_universal_types() { #ifdef TOOLS_ENABLED delete sel_codebook; - Image::basis_universal_packer = NULL; + Image::basis_universal_packer = nullptr; #endif - Image::basis_universal_unpacker = NULL; + Image::basis_universal_unpacker = nullptr; } diff --git a/modules/basis_universal/texture_basisu.cpp b/modules/basis_universal/texture_basisu.cpp index 9c3cdac36c..2ed0340927 100644 --- a/modules/basis_universal/texture_basisu.cpp +++ b/modules/basis_universal/texture_basisu.cpp @@ -105,7 +105,7 @@ void TextureBasisU::set_basisu_data(const Vector& p_data) { imgfmt = Image::FORMAT_ETC2_RGBA8; }; - basist::basisu_transcoder tr(NULL); + basist::basisu_transcoder tr(nullptr); ERR_FAIL_COND(!tr.validate_header(ptr, size)); diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp index 71e5076e78..ea2b2b548f 100644 --- a/modules/bmp/image_loader_bmp.cpp +++ b/modules/bmp/image_loader_bmp.cpp @@ -38,7 +38,7 @@ Error ImageLoaderBMP::convert_to_image(Ref p_image, Error err = OK; - if (p_buffer == NULL) + if (p_buffer == nullptr) err = FAILED; if (err == OK) { @@ -151,7 +151,7 @@ Error ImageLoaderBMP::convert_to_image(Ref p_image, line -= line_width; } - if (p_color_buffer == NULL || color_table_size == 0) { // regular pixels + if (p_color_buffer == nullptr || color_table_size == 0) { // regular pixels p_image->create(width, height, 0, Image::FORMAT_RGBA8, data); diff --git a/modules/bmp/register_types.cpp b/modules/bmp/register_types.cpp index d5cc6c5eb3..6220e956d6 100644 --- a/modules/bmp/register_types.cpp +++ b/modules/bmp/register_types.cpp @@ -32,7 +32,7 @@ #include "image_loader_bmp.h" -static ImageLoaderBMP *image_loader_bmp = NULL; +static ImageLoaderBMP *image_loader_bmp = nullptr; void register_bmp_types() { image_loader_bmp = memnew(ImageLoaderBMP); diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h index 56977d4451..0272350510 100644 --- a/modules/bullet/area_bullet.h +++ b/modules/bullet/area_bullet.h @@ -65,7 +65,7 @@ public: OverlapState state; OverlappingObjectData() : - object(NULL), + object(nullptr), state(OVERLAP_STATE_ENTER) {} OverlappingObjectData(CollisionObjectBullet *p_object, OverlapState p_state) : object(p_object), diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index 5f7860e797..2705c749a2 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -86,7 +86,7 @@ BulletPhysicsServer3D::BulletPhysicsServer3D() : BulletPhysicsServer3D::~BulletPhysicsServer3D() {} RID BulletPhysicsServer3D::shape_create(ShapeType p_shape) { - ShapeBullet *shape = NULL; + ShapeBullet *shape = nullptr; switch (p_shape) { case SHAPE_PLANE: { @@ -216,7 +216,7 @@ real_t BulletPhysicsServer3D::space_get_param(RID p_space, SpaceParameter p_para PhysicsDirectSpaceState3D *BulletPhysicsServer3D::space_get_direct_state(RID p_space) { SpaceBullet *space = space_owner.getornull(p_space); - ERR_FAIL_COND_V(!space, NULL); + ERR_FAIL_COND_V(!space, nullptr); return space->get_direct_state(); } @@ -252,7 +252,7 @@ RID BulletPhysicsServer3D::area_create() { void BulletPhysicsServer3D::area_set_space(RID p_area, RID p_space) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); - SpaceBullet *space = NULL; + SpaceBullet *space = nullptr; if (p_space.is_valid()) { space = space_owner.getornull(p_space); ERR_FAIL_COND(!space); @@ -463,7 +463,7 @@ RID BulletPhysicsServer3D::body_create(BodyMode p_mode, bool p_init_sleeping) { void BulletPhysicsServer3D::body_set_space(RID p_body, RID p_space) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); - SpaceBullet *space = NULL; + SpaceBullet *space = nullptr; if (p_space.is_valid()) { space = space_owner.getornull(p_space); @@ -861,7 +861,7 @@ bool BulletPhysicsServer3D::body_is_ray_pickable(RID p_body) const { PhysicsDirectBodyState3D *BulletPhysicsServer3D::body_get_direct_state(RID p_body) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); - ERR_FAIL_COND_V(!body, NULL); + ERR_FAIL_COND_V(!body, nullptr); return BulletPhysicsDirectBodyState3D::get_singleton(body); } @@ -900,7 +900,7 @@ void BulletPhysicsServer3D::soft_body_update_rendering_server(RID p_body, class void BulletPhysicsServer3D::soft_body_set_space(RID p_body, RID p_space) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); - SpaceBullet *space = NULL; + SpaceBullet *space = nullptr; if (p_space.is_valid()) { space = space_owner.getornull(p_space); @@ -1214,7 +1214,7 @@ RID BulletPhysicsServer3D::joint_create_pin(RID p_body_A, const Vector3 &p_local JointAssertSpace(body_A, "A", RID()); - RigidBodyBullet *body_B = NULL; + RigidBodyBullet *body_B = nullptr; if (p_body_B.is_valid()) { body_B = rigid_body_owner.getornull(p_body_B); JointAssertSpace(body_B, "B", RID()); @@ -1282,7 +1282,7 @@ RID BulletPhysicsServer3D::joint_create_hinge(RID p_body_A, const Transform &p_h ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); - RigidBodyBullet *body_B = NULL; + RigidBodyBullet *body_B = nullptr; if (p_body_B.is_valid()) { body_B = rigid_body_owner.getornull(p_body_B); JointAssertSpace(body_B, "B", RID()); @@ -1302,7 +1302,7 @@ RID BulletPhysicsServer3D::joint_create_hinge_simple(RID p_body_A, const Vector3 ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); - RigidBodyBullet *body_B = NULL; + RigidBodyBullet *body_B = nullptr; if (p_body_B.is_valid()) { body_B = rigid_body_owner.getornull(p_body_B); JointAssertSpace(body_B, "B", RID()); @@ -1354,7 +1354,7 @@ RID BulletPhysicsServer3D::joint_create_slider(RID p_body_A, const Transform &p_ ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); - RigidBodyBullet *body_B = NULL; + RigidBodyBullet *body_B = nullptr; if (p_body_B.is_valid()) { body_B = rigid_body_owner.getornull(p_body_B); JointAssertSpace(body_B, "B", RID()); @@ -1390,7 +1390,7 @@ RID BulletPhysicsServer3D::joint_create_cone_twist(RID p_body_A, const Transform ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); - RigidBodyBullet *body_B = NULL; + RigidBodyBullet *body_B = nullptr; if (p_body_B.is_valid()) { body_B = rigid_body_owner.getornull(p_body_B); JointAssertSpace(body_B, "B", RID()); @@ -1424,7 +1424,7 @@ RID BulletPhysicsServer3D::joint_create_generic_6dof(RID p_body_A, const Transfo ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); - RigidBodyBullet *body_B = NULL; + RigidBodyBullet *body_B = nullptr; if (p_body_B.is_valid()) { body_B = rigid_body_owner.getornull(p_body_B); JointAssertSpace(body_B, "B", RID()); @@ -1503,7 +1503,7 @@ void BulletPhysicsServer3D::free(RID p_rid) { RigidBodyBullet *body = rigid_body_owner.getornull(p_rid); - body->set_space(NULL); + body->set_space(nullptr); body->remove_all_shapes(true, true); @@ -1514,7 +1514,7 @@ void BulletPhysicsServer3D::free(RID p_rid) { SoftBodyBullet *body = soft_body_owner.getornull(p_rid); - body->set_space(NULL); + body->set_space(nullptr); soft_body_owner.free(p_rid); bulletdelete(body); @@ -1523,7 +1523,7 @@ void BulletPhysicsServer3D::free(RID p_rid) { AreaBullet *area = area_owner.getornull(p_rid); - area->set_space(NULL); + area->set_space(nullptr); area->remove_all_shapes(true, true); @@ -1592,7 +1592,7 @@ CollisionObjectBullet *BulletPhysicsServer3D::get_collisin_object(RID p_object) if (soft_body_owner.owns(p_object)) { return soft_body_owner.getornull(p_object); } - return NULL; + return nullptr; } RigidCollisionObjectBullet *BulletPhysicsServer3D::get_rigid_collisin_object(RID p_object) const { @@ -1602,5 +1602,5 @@ RigidCollisionObjectBullet *BulletPhysicsServer3D::get_rigid_collisin_object(RID if (area_owner.owns(p_object)) { return area_owner.getornull(p_object); } - return NULL; + return nullptr; } diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h index 1269dac78b..ea9c5e589e 100644 --- a/modules/bullet/bullet_physics_server.h +++ b/modules/bullet/bullet_physics_server.h @@ -254,7 +254,7 @@ public: // this function only works on physics process, errors and returns null otherwise virtual PhysicsDirectBodyState3D *body_get_direct_state(RID p_body); - virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true); + virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true); virtual int body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin = 0.001); /* SOFT BODY API */ diff --git a/modules/bullet/bullet_utilities.h b/modules/bullet/bullet_utilities.h index 968cb38ba2..a5e33d9829 100644 --- a/modules/bullet/bullet_utilities.h +++ b/modules/bullet/bullet_utilities.h @@ -41,6 +41,6 @@ #define bulletdelete(cl) \ { \ delete cl; \ - cl = NULL; \ + cl = nullptr; \ } #endif diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index 0ce57811d7..1b72c2f577 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -96,10 +96,10 @@ CollisionObjectBullet::CollisionObjectBullet(Type p_type) : collisionsEnabled(true), m_isStatic(false), ray_pickable(false), - bt_collision_object(NULL), + bt_collision_object(nullptr), body_scale(1., 1., 1.), force_shape_reset(false), - space(NULL), + space(nullptr), isTransformChanged(false) {} CollisionObjectBullet::~CollisionObjectBullet() { @@ -227,7 +227,7 @@ void CollisionObjectBullet::notify_transform_changed() { RigidCollisionObjectBullet::RigidCollisionObjectBullet(Type p_type) : CollisionObjectBullet(p_type), - mainShape(NULL) { + mainShape(nullptr) { } RigidCollisionObjectBullet::~RigidCollisionObjectBullet() { @@ -332,7 +332,7 @@ bool RigidCollisionObjectBullet::is_shape_disabled(int p_index) { void RigidCollisionObjectBullet::shape_changed(int p_shape_index) { ShapeWrapper &shp = shapes.write[p_shape_index]; if (shp.bt_shape == mainShape) { - mainShape = NULL; + mainShape = nullptr; } bulletdelete(shp.bt_shape); reload_shapes(); @@ -345,7 +345,7 @@ void RigidCollisionObjectBullet::reload_shapes() { bulletdelete(mainShape); } - mainShape = NULL; + mainShape = nullptr; ShapeWrapper *shpWrapper; const int shape_count = shapes.size(); @@ -398,7 +398,7 @@ void RigidCollisionObjectBullet::internal_shape_destroy(int p_index, bool p_perm ShapeWrapper &shp = shapes.write[p_index]; shp.shape->remove_owner(this, p_permanentlyFromThisBody); if (shp.bt_shape == mainShape) { - mainShape = NULL; + mainShape = nullptr; } bulletdelete(shp.bt_shape); } diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h index 42ba4aa907..25176458a7 100644 --- a/modules/bullet/collision_object_bullet.h +++ b/modules/bullet/collision_object_bullet.h @@ -76,20 +76,20 @@ public: bool active; ShapeWrapper() : - shape(NULL), - bt_shape(NULL), + shape(nullptr), + bt_shape(nullptr), active(true) {} ShapeWrapper(ShapeBullet *p_shape, const btTransform &p_transform, bool p_active) : shape(p_shape), - bt_shape(NULL), + bt_shape(nullptr), active(p_active) { set_transform(p_transform); } ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active) : shape(p_shape), - bt_shape(NULL), + bt_shape(nullptr), active(p_active) { set_transform(p_transform); } diff --git a/modules/bullet/constraint_bullet.cpp b/modules/bullet/constraint_bullet.cpp index 7e90e2b488..469b58521e 100644 --- a/modules/bullet/constraint_bullet.cpp +++ b/modules/bullet/constraint_bullet.cpp @@ -38,8 +38,8 @@ */ ConstraintBullet::ConstraintBullet() : - space(NULL), - constraint(NULL), + space(nullptr), + constraint(nullptr), disabled_collisions_between_bodies(true) {} void ConstraintBullet::setup(btTypedConstraint *p_constraint) { diff --git a/modules/bullet/constraint_bullet.h b/modules/bullet/constraint_bullet.h index 89ad150257..1946807bad 100644 --- a/modules/bullet/constraint_bullet.h +++ b/modules/bullet/constraint_bullet.h @@ -64,7 +64,7 @@ public: public: virtual ~ConstraintBullet() { bulletdelete(constraint); - constraint = NULL; + constraint = nullptr; } _FORCE_INLINE_ btTypedConstraint *get_bt_constraint() { return constraint; } diff --git a/modules/bullet/godot_collision_configuration.cpp b/modules/bullet/godot_collision_configuration.cpp index f3e3a01a52..8e29845a36 100644 --- a/modules/bullet/godot_collision_configuration.cpp +++ b/modules/bullet/godot_collision_configuration.cpp @@ -42,7 +42,7 @@ GodotCollisionConfiguration::GodotCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) : btDefaultCollisionConfiguration(constructionInfo) { - void *mem = NULL; + void *mem = nullptr; mem = btAlignedAlloc(sizeof(GodotRayWorldAlgorithm::CreateFunc), 16); m_rayWorldCF = new (mem) GodotRayWorldAlgorithm::CreateFunc(world); @@ -98,7 +98,7 @@ btCollisionAlgorithmCreateFunc *GodotCollisionConfiguration::getClosestPointsAlg GodotSoftCollisionConfiguration::GodotSoftCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) : btSoftBodyRigidBodyCollisionConfiguration(constructionInfo) { - void *mem = NULL; + void *mem = nullptr; mem = btAlignedAlloc(sizeof(GodotRayWorldAlgorithm::CreateFunc), 16); m_rayWorldCF = new (mem) GodotRayWorldAlgorithm::CreateFunc(world); diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp index ad054e3027..ad20a7e451 100644 --- a/modules/bullet/godot_result_callbacks.cpp +++ b/modules/bullet/godot_result_callbacks.cpp @@ -112,7 +112,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID result.rid = gObj->get_self(); result.collider_id = gObj->get_instance_id(); - result.collider = result.collider_id.is_null() ? NULL : ObjectDB::get_instance(result.collider_id); + result.collider = result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(result.collider_id); ++count; return 1; // not used by bullet @@ -220,7 +220,7 @@ btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, con } result.collider_id = colObj->get_instance_id(); - result.collider = result.collider_id.is_null() ? NULL : ObjectDB::get_instance(result.collider_id); + result.collider = result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(result.collider_id); result.rid = colObj->get_self(); ++m_count; } diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index 6f799843de..fc4e1d57de 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -48,7 +48,7 @@ @author AndreaCatania */ -BulletPhysicsDirectBodyState3D *BulletPhysicsDirectBodyState3D::singleton = NULL; +BulletPhysicsDirectBodyState3D *BulletPhysicsDirectBodyState3D::singleton = nullptr; Vector3 BulletPhysicsDirectBodyState3D::get_total_gravity() const { Vector3 gVec; @@ -241,7 +241,7 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() { } break; default: WARN_PRINT("This shape is not supported for kinematic collision."); - shapes.write[i].shape = NULL; + shapes.write[i].shape = nullptr; } } } @@ -257,7 +257,7 @@ void RigidBodyBullet::KinematicUtilities::just_delete_shapes(int new_size) { RigidBodyBullet::RigidBodyBullet() : RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_RIGID_BODY), - kinematic_utilities(NULL), + kinematic_utilities(nullptr), locked_axis(0), mass(1), gravity_scale(1), @@ -274,13 +274,13 @@ RigidBodyBullet::RigidBodyBullet() : countGravityPointSpaces(0), isScratchedSpaceOverrideModificator(false), previousActiveState(true), - force_integration_callback(NULL) { + force_integration_callback(nullptr) { godotMotionState = bulletnew(GodotMotionState(this)); // Initial properties const btVector3 localInertia(0, 0, 0); - btRigidBody::btRigidBodyConstructionInfo cInfo(mass, godotMotionState, NULL, localInertia); + btRigidBody::btRigidBodyConstructionInfo cInfo(mass, godotMotionState, nullptr, localInertia); btBody = bulletnew(btRigidBody(cInfo)); reload_shapes(); @@ -291,7 +291,7 @@ RigidBodyBullet::RigidBodyBullet() : areasWhereIam.resize(maxAreasWhereIam); for (int i = areasWhereIam.size() - 1; 0 <= i; --i) { - areasWhereIam.write[i] = NULL; + areasWhereIam.write[i] = nullptr; } btBody->setSleepingThresholds(0.2, 0.2); @@ -315,7 +315,7 @@ void RigidBodyBullet::init_kinematic_utilities() { void RigidBodyBullet::destroy_kinematic_utilities() { if (kinematic_utilities) { memdelete(kinematic_utilities); - kinematic_utilities = NULL; + kinematic_utilities = nullptr; } } @@ -392,7 +392,7 @@ void RigidBodyBullet::set_force_integration_callback(ObjectID p_id, const String if (force_integration_callback) { memdelete(force_integration_callback); - force_integration_callback = NULL; + force_integration_callback = nullptr; } if (p_id.is_valid()) { @@ -847,7 +847,7 @@ void RigidBodyBullet::on_enter_area(AreaBullet *p_area) { } for (int i = 0; i < areaWhereIamCount; ++i) { - if (NULL == areasWhereIam[i]) { + if (nullptr == areasWhereIam[i]) { // This area has the highest priority areasWhereIam.write[i] = p_area; break; @@ -894,7 +894,7 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) { } --areaWhereIamCount; - areasWhereIam.write[areaWhereIamCount] = NULL; // Even if this is not required, I clear the last element to be safe + areasWhereIam.write[areaWhereIamCount] = nullptr; // Even if this is not required, I clear the last element to be safe if (PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) { scratch_space_override_modificator(); } diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h index b73e132103..95491b1e62 100644 --- a/modules/bullet/rigid_body_bullet.h +++ b/modules/bullet/rigid_body_bullet.h @@ -68,7 +68,7 @@ public: static void destroySingleton() { memdelete(singleton); - singleton = NULL; + singleton = nullptr; } static void singleton_setDeltaTime(real_t p_deltaTime) { @@ -166,7 +166,7 @@ public: btTransform transform; KinematicShape() : - shape(NULL) {} + shape(nullptr) {} bool is_active() const { return shape; } }; diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index 6b73525d10..8ac26a0fdb 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -138,7 +138,7 @@ btScaledBvhTriangleMeshShape *ShapeBullet::create_shape_concave(btBvhTriangleMes if (p_mesh_shape) { return bulletnew(btScaledBvhTriangleMeshShape(p_mesh_shape, p_local_scaling)); } else { - return NULL; + return nullptr; } } @@ -362,7 +362,7 @@ btCollisionShape *ConvexPolygonShapeBullet::create_bt_shape(const btVector3 &p_i ConcavePolygonShapeBullet::ConcavePolygonShapeBullet() : ShapeBullet(), - meshShape(NULL) {} + meshShape(nullptr) {} ConcavePolygonShapeBullet::~ConcavePolygonShapeBullet() { if (meshShape) { @@ -425,7 +425,7 @@ void ConcavePolygonShapeBullet::setup(Vector p_faces) { btGenerateInternalEdgeInfo(meshShape, triangleInfoMap); } } else { - meshShape = NULL; + meshShape = nullptr; ERR_PRINT("The faces count are 0, the mesh shape cannot be created"); } notifyShapeChanged(); @@ -434,7 +434,7 @@ void ConcavePolygonShapeBullet::setup(Vector p_faces) { btCollisionShape *ConcavePolygonShapeBullet::create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge) { btCollisionShape *cs = ShapeBullet::create_shape_concave(meshShape); if (!cs) - // This is necessary since if 0 faces the creation of concave return NULL + // This is necessary since if 0 faces the creation of concave return null cs = ShapeBullet::create_shape_empty(); cs->setLocalScaling(p_implicit_scale); prepare(cs); diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index 2984bf9c2b..236bdc7c8a 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -37,7 +37,7 @@ SoftBodyBullet::SoftBodyBullet() : CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY), - bt_soft_body(NULL), + bt_soft_body(nullptr), isScratched(false), simulation_precision(5), total_mass(1.), @@ -144,7 +144,7 @@ void SoftBodyBullet::destroy_soft_body() { } destroyBulletCollisionObject(); - bt_soft_body = NULL; + bt_soft_body = nullptr; } void SoftBodyBullet::set_soft_transform(const Transform &p_transform) { @@ -404,7 +404,7 @@ void SoftBodyBullet::setup_soft_body() { // Soft body setup setupBulletCollisionObject(bt_soft_body); - bt_soft_body->m_worldInfo = NULL; // Remove fake world info + bt_soft_body->m_worldInfo = nullptr; // Remove fake world info bt_soft_body->getCollisionShape()->setMargin(0.01); bt_soft_body->setCollisionFlags(bt_soft_body->getCollisionFlags() & (~(btCollisionObject::CF_KINEMATIC_OBJECT | btCollisionObject::CF_STATIC_OBJECT))); diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index b1ff418748..1659664ff9 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -108,7 +108,7 @@ bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const V r_result.shape = btResult.m_shapeId; r_result.rid = gObj->get_self(); r_result.collider_id = gObj->get_instance_id(); - r_result.collider = r_result.collider_id.is_null() ? NULL : ObjectDB::get_instance(r_result.collider_id); + r_result.collider = r_result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(r_result.collider_id); } else { WARN_PRINT("The raycast performed has hit a collision object that is not part of Godot scene, please check it."); } @@ -309,7 +309,7 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_ btPointCollector result; btGjkPairDetector gjk_pair_detector(&point_shape, convex_shape, space->gjk_simplex_solver, space->gjk_epa_pen_solver); - gjk_pair_detector.getClosestPoints(input, result, 0); + gjk_pair_detector.getClosestPoints(input, result, nullptr); if (out_distance > result.m_distance) { out_distance = result.m_distance; @@ -332,14 +332,14 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_ } SpaceBullet::SpaceBullet() : - broadphase(NULL), - collisionConfiguration(NULL), - dispatcher(NULL), - solver(NULL), - dynamicsWorld(NULL), - soft_body_world_info(NULL), - ghostPairCallback(NULL), - godotFilterCallback(NULL), + broadphase(nullptr), + collisionConfiguration(nullptr), + dispatcher(nullptr), + solver(nullptr), + dynamicsWorld(nullptr), + soft_body_world_info(nullptr), + ghostPairCallback(nullptr), + godotFilterCallback(nullptr), gravityDirection(0, -1, 0), gravityMagnitude(10), contactDebugCount(0), @@ -511,7 +511,7 @@ void SpaceBullet::remove_soft_body(SoftBodyBullet *p_body) { if (is_using_soft_world()) { if (p_body->get_bt_soft_body()) { static_cast(dynamicsWorld)->removeSoftBody(p_body->get_bt_soft_body()); - p_body->get_bt_soft_body()->m_worldInfo = NULL; + p_body->get_bt_soft_body()->m_worldInfo = nullptr; } } } @@ -539,7 +539,7 @@ void SpaceBullet::remove_all_collision_objects() { for (int i = dynamicsWorld->getNumCollisionObjects() - 1; 0 <= i; --i) { btCollisionObject *btObj = dynamicsWorld->getCollisionObjectArray()[i]; CollisionObjectBullet *colObj = static_cast(btObj->getUserPointer()); - colObj->set_space(NULL); + colObj->set_space(nullptr); } } @@ -636,8 +636,8 @@ void SpaceBullet::destroy_world() { /// The world elements (like: Collision Objects, Constraints, Shapes) are managed by godot - dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(NULL); - dynamicsWorld->getPairCache()->setOverlapFilterCallback(NULL); + dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(nullptr); + dynamicsWorld->getPairCache()->setOverlapFilterCallback(nullptr); bulletdelete(ghostPairCallback); bulletdelete(godotFilterCallback); @@ -645,7 +645,7 @@ void SpaceBullet::destroy_world() { // Deallocate world dynamicsWorld->~btDiscreteDynamicsWorld(); free(dynamicsWorld); - dynamicsWorld = NULL; + dynamicsWorld = nullptr; bulletdelete(solver); bulletdelete(broadphase); @@ -741,7 +741,7 @@ void SpaceBullet::check_ghost_overlaps() { static_cast(other_body_shape), gjk_simplex_solver, gjk_epa_pen_solver); - gjk_pair_detector.getClosestPoints(gjk_input, result, 0); + gjk_pair_detector.getClosestPoints(gjk_input, result, nullptr); if (0 >= result.m_distance) { hasOverlap = true; @@ -750,10 +750,10 @@ void SpaceBullet::check_ghost_overlaps() { } else { - btCollisionObjectWrapper obA(NULL, area_shape, area->get_bt_ghost(), gjk_input.m_transformA, -1, y); - btCollisionObjectWrapper obB(NULL, other_body_shape, otherObject->get_bt_collision_object(), gjk_input.m_transformB, -1, z); + btCollisionObjectWrapper obA(nullptr, area_shape, area->get_bt_ghost(), gjk_input.m_transformA, -1, y); + btCollisionObjectWrapper obB(nullptr, other_body_shape, otherObject->get_bt_collision_object(), gjk_input.m_transformB, -1, z); - btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS); + btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, nullptr, BT_CONTACT_POINT_ALGORITHMS); if (!algorithm) continue; @@ -885,8 +885,8 @@ void SpaceBullet::update_gravity() { #include "scene/3d/immediate_geometry.h" -static ImmediateGeometry3D *motionVec(NULL); -static ImmediateGeometry3D *normalLine(NULL); +static ImmediateGeometry3D *motionVec(nullptr); +static ImmediateGeometry3D *normalLine(nullptr); static Ref red_mat; static Ref blue_mat; #endif @@ -951,7 +951,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f Vector3 sup_line; B_TO_G(body_safe_position.getOrigin(), sup_line); motionVec->clear(); - motionVec->begin(Mesh::PRIMITIVE_LINES, NULL); + motionVec->begin(Mesh::PRIMITIVE_LINES, nullptr); motionVec->add_vertex(sup_line); motionVec->add_vertex(sup_line + p_motion * 10); motionVec->end(); @@ -1028,7 +1028,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f Vector3 sup_line2; B_TO_G(motion, sup_line2); normalLine->clear(); - normalLine->begin(Mesh::PRIMITIVE_LINES, NULL); + normalLine->begin(Mesh::PRIMITIVE_LINES, nullptr); normalLine->add_vertex(r_result->collision_point); normalLine->add_vertex(r_result->collision_point + r_result->collision_normal * 10); normalLine->end(); @@ -1124,7 +1124,7 @@ public: if (cs->getNumChildShapes() > 1) { const btDbvt *tree = cs->getDynamicAabbTree(); - ERR_FAIL_COND_V(tree == NULL, true); + ERR_FAIL_COND_V(tree == nullptr, true); // Transform bounds into compound shape local space const btTransform other_in_compound_space = co->getWorldTransform().inverse(); @@ -1275,7 +1275,7 @@ bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const bt // Perform GJK test btPointCollector result; btGjkPairDetector gjk_pair_detector(p_shapeA, p_shapeB, gjk_simplex_solver, gjk_epa_pen_solver); - gjk_pair_detector.getClosestPoints(gjk_input, result, 0); + gjk_pair_detector.getClosestPoints(gjk_input, result, nullptr); if (0 > result.m_distance) { // Has penetration r_delta_recover_movement += result.m_normalOnBInWorld * (result.m_distance * -1 * p_recover_movement_scale); @@ -1302,10 +1302,10 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC btTransform tA(p_transformA); - btCollisionObjectWrapper obA(NULL, p_shapeA, p_objectA, tA, -1, p_shapeId_A); - btCollisionObjectWrapper obB(NULL, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B); + btCollisionObjectWrapper obA(nullptr, p_shapeA, p_objectA, tA, -1, p_shapeId_A); + btCollisionObjectWrapper obB(nullptr, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B); - btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS); + btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, nullptr, BT_CONTACT_POINT_ALGORITHMS); if (algorithm) { GodotDeepPenetrationContactResultCallback contactPointResult(&obA, &obB); //discrete collision detection query diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h index fce715b48d..f9a8c063fd 100644 --- a/modules/bullet/space_bullet.h +++ b/modules/bullet/space_bullet.h @@ -79,7 +79,7 @@ public: virtual int intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false); virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, bool p_pick_ray = false); virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, float p_margin, ShapeResult *r_results, int p_result_max, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false); - virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &r_closest_safe, float &r_closest_unsafe, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = NULL); + virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &r_closest_safe, float &r_closest_unsafe, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = nullptr); /// Returns the list of contacts pairs in this order: Local contact, other body contact virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false); virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, float p_margin, ShapeRestInfo *r_info, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false); @@ -201,17 +201,17 @@ private: pointWorld(0, 0, 0), penetration_distance(1e20), other_compound_shape_index(0), - other_collision_object(NULL), + other_collision_object(nullptr), local_shape_most_recovered(0) {} }; - bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL); + bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = nullptr); /// This is an API that recover a kinematic object from penetration /// This allow only Convex Convex test and it always use GJK algorithm, With this API we don't benefit of Bullet special accelerated functions - bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL); + bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = nullptr); /// This is an API that recover a kinematic object from penetration /// Using this we leave Bullet to select the best algorithm, For example GJK in case we have Convex Convex, or a Bullet accelerated algorithm - bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL); + bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = nullptr); int add_separation_result(PhysicsServer3D::SeparationResult *r_results, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const; int recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer3D::SeparationResult *r_results); diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 1ed48a573c..5557da3014 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -156,7 +156,7 @@ CSGBrush *CSGShape3D::_get_brush() { if (brush) { memdelete(brush); } - brush = NULL; + brush = nullptr; CSGBrush *n = _build_brush(); @@ -427,7 +427,7 @@ void CSGShape3D::_update_shape() { 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; @@ -536,7 +536,7 @@ void CSGShape3D::_notification(int p_what) { if (parent) parent->_make_dirty(); - parent = NULL; + parent = nullptr; if (use_collision && is_root_shape() && root_collision_instance.is_valid()) { PhysicsServer3D::get_singleton()->free(root_collision_instance); @@ -636,8 +636,8 @@ void CSGShape3D::_bind_methods() { CSGShape3D::CSGShape3D() { operation = OPERATION_UNION; - parent = NULL; - brush = NULL; + parent = nullptr; + brush = nullptr; dirty = false; snap = 0.001; use_collision = false; @@ -650,14 +650,14 @@ CSGShape3D::CSGShape3D() { CSGShape3D::~CSGShape3D() { if (brush) { memdelete(brush); - brush = NULL; + brush = nullptr; } } ////////////////////////////////// CSGBrush *CSGCombiner3D::_build_brush() { - return NULL; //does not build anything + return nullptr; //does not build anything } CSGCombiner3D::CSGCombiner3D() { @@ -713,7 +713,7 @@ CSGPrimitive3D::CSGPrimitive3D() { CSGBrush *CSGMesh3D::_build_brush() { if (!mesh.is_valid()) - return NULL; + return nullptr; Vector vertices; Vector smooth; @@ -731,7 +731,7 @@ CSGBrush *CSGMesh3D::_build_brush() { if (arrays.size() == 0) { _make_dirty(); - ERR_FAIL_COND_V(arrays.size() == 0, NULL); + ERR_FAIL_COND_V(arrays.size() == 0, nullptr); } Vector avertices = arrays[Mesh::ARRAY_VERTEX]; @@ -741,13 +741,13 @@ CSGBrush *CSGMesh3D::_build_brush() { const Vector3 *vr = avertices.ptr(); Vector anormals = arrays[Mesh::ARRAY_NORMAL]; - const Vector3 *nr = NULL; + const Vector3 *nr = nullptr; if (anormals.size()) { nr = anormals.ptr(); } Vector auvs = arrays[Mesh::ARRAY_TEX_UV]; - const Vector2 *uvr = NULL; + const Vector2 *uvr = nullptr; if (auvs.size()) { uvr = auvs.ptr(); } @@ -853,7 +853,7 @@ CSGBrush *CSGMesh3D::_build_brush() { } if (vertices.size() == 0) - return NULL; + return nullptr; return _create_brush_from_arrays(vertices, uvs, smooth, materials); } @@ -1535,7 +1535,7 @@ CSGBrush *CSGTorus3D::_build_brush() { float max_radius = outer_radius; if (min_radius == max_radius) - return NULL; //sorry, can't + return nullptr; //sorry, can't if (min_radius > max_radius) { SWAP(min_radius, max_radius); @@ -1760,7 +1760,7 @@ CSGBrush *CSGPolygon3D::_build_brush() { // set our bounding box if (polygon.size() < 3) - return NULL; + return nullptr; Vector final_polygon = polygon; @@ -1771,9 +1771,9 @@ CSGBrush *CSGPolygon3D::_build_brush() { Vector triangles = Geometry::triangulate_polygon(final_polygon); if (triangles.size() < 3) - return NULL; + return nullptr; - Path3D *path = NULL; + Path3D *path = nullptr; Ref curve; // get bounds for our polygon @@ -1796,32 +1796,32 @@ CSGBrush *CSGPolygon3D::_build_brush() { if (mode == MODE_PATH) { if (!has_node(path_node)) - return NULL; + return nullptr; Node *n = get_node(path_node); if (!n) - return NULL; + return nullptr; path = Object::cast_to(n); if (!path) - return NULL; + return nullptr; if (path != path_cache) { if (path_cache) { path_cache->disconnect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited)); path_cache->disconnect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed)); - path_cache = NULL; + path_cache = nullptr; } path_cache = path; path_cache->connect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited)); path_cache->connect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed)); - path_cache = NULL; + path_cache = nullptr; } curve = path->get_curve(); if (curve.is_null()) - return NULL; + return nullptr; if (curve->get_baked_length() <= 0) - return NULL; + return nullptr; } CSGBrush *brush = memnew(CSGBrush); @@ -2232,7 +2232,7 @@ void CSGPolygon3D::_notification(int p_what) { if (path_cache) { path_cache->disconnect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited)); path_cache->disconnect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed)); - path_cache = NULL; + path_cache = nullptr; } } } @@ -2257,7 +2257,7 @@ void CSGPolygon3D::_path_changed() { } void CSGPolygon3D::_path_exited() { - path_cache = NULL; + path_cache = nullptr; } void CSGPolygon3D::_bind_methods() { @@ -2483,5 +2483,5 @@ CSGPolygon3D::CSGPolygon3D() { path_local = false; path_continuous_u = false; path_joined = false; - path_cache = NULL; + path_cache = nullptr; } diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h index de8088af90..5b89f16277 100644 --- a/modules/dds/texture_loader_dds.h +++ b/modules/dds/texture_loader_dds.h @@ -36,7 +36,7 @@ class ResourceFormatDDS : 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 *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/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index 406eb467f0..444ffae713 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -154,7 +154,7 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por p_in_bandwidth /* limit incoming bandwidth if > 0 */, p_out_bandwidth /* limit outgoing bandwidth if > 0 */); } else { - host = enet_host_create(NULL /* create a client host */, + host = enet_host_create(nullptr /* create a client host */, 1 /* only allow 1 outgoing connection */, channel_count /* allow up to channel_count to be used */, p_in_bandwidth /* limit incoming bandwidth if > 0 */, @@ -197,7 +197,7 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por // Initiate connection, allocating enough channels ENetPeer *peer = enet_host_connect(host, &address, channel_count, unique_id); - if (peer == NULL) { + if (peer == nullptr) { enet_host_destroy(host); ERR_FAIL_COND_V_MSG(!peer, ERR_CANT_CREATE, "Couldn't connect to the ENet multiplayer server."); } @@ -276,12 +276,12 @@ void NetworkedMultiplayerENet::poll() { if (E->key() == *new_id) continue; // Send existing peers to new peer - ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE); + ENetPacket *packet = enet_packet_create(nullptr, 8, ENET_PACKET_FLAG_RELIABLE); encode_uint32(SYSMSG_ADD_PEER, &packet->data[0]); encode_uint32(E->key(), &packet->data[4]); enet_peer_send(event.peer, SYSCH_CONFIG, packet); // Send the new peer to existing peers - packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE); + packet = enet_packet_create(nullptr, 8, ENET_PACKET_FLAG_RELIABLE); encode_uint32(SYSMSG_ADD_PEER, &packet->data[0]); encode_uint32(*new_id, &packet->data[4]); enet_peer_send(E->get(), SYSCH_CONFIG, packet); @@ -320,7 +320,7 @@ void NetworkedMultiplayerENet::poll() { if (E->key() == *id) continue; - ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE); + ENetPacket *packet = enet_packet_create(nullptr, 8, ENET_PACKET_FLAG_RELIABLE); encode_uint32(SYSMSG_REMOVE_PEER, &packet->data[0]); encode_uint32(*id, &packet->data[4]); enet_peer_send(E->get(), SYSCH_CONFIG, packet); @@ -346,7 +346,7 @@ void NetworkedMultiplayerENet::poll() { switch (msg) { case SYSMSG_ADD_PEER: { - peer_map[id] = NULL; + peer_map[id] = nullptr; emit_signal("peer_connected", id); } break; @@ -502,7 +502,7 @@ void NetworkedMultiplayerENet::disconnect_peer(int p_peer, bool now) { continue; } - ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE); + ENetPacket *packet = enet_packet_create(nullptr, 8, ENET_PACKET_FLAG_RELIABLE); encode_uint32(SYSMSG_REMOVE_PEER, &packet->data[0]); encode_uint32(p_peer, &packet->data[4]); enet_peer_send(E->get(), SYSCH_CONFIG, packet); @@ -568,7 +568,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer if (transfer_channel > SYSCH_CONFIG) channel = transfer_channel; - Map::Element *E = NULL; + Map::Element *E = nullptr; if (target_peer != 0) { @@ -576,7 +576,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer ERR_FAIL_COND_V_MSG(!E, ERR_INVALID_PARAMETER, vformat("Invalid target peer: %d", target_peer)); } - ENetPacket *packet = enet_packet_create(NULL, p_buffer_size + 8, packet_flags); + ENetPacket *packet = enet_packet_create(nullptr, p_buffer_size + 8, packet_flags); encode_uint32(unique_id, &packet->data[0]); // Source ID encode_uint32(target_peer, &packet->data[4]); // Dest ID copymem(&packet->data[8], p_buffer, p_buffer_size); @@ -625,7 +625,7 @@ void NetworkedMultiplayerENet::_pop_current_packet() { if (current_packet.packet) { enet_packet_destroy(current_packet.packet); - current_packet.packet = NULL; + current_packet.packet = nullptr; current_packet.from = 0; current_packet.channel = -1; } @@ -771,7 +771,7 @@ void NetworkedMultiplayerENet::_setup_compressor() { case COMPRESS_NONE: { - enet_host_compress(host, NULL); + enet_host_compress(host, nullptr); } break; case COMPRESS_RANGE_CODER: { enet_host_compress_with_range_coder(host); @@ -794,7 +794,7 @@ IP_Address NetworkedMultiplayerENet::get_peer_address(int p_peer_id) const { ERR_FAIL_COND_V_MSG(!peer_map.has(p_peer_id), IP_Address(), vformat("Peer ID %d not found in the list of peers.", p_peer_id)); ERR_FAIL_COND_V_MSG(!is_server() && p_peer_id != 1, IP_Address(), "Can't get the address of peers other than the server (ID -1) when acting as a client."); - ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == NULL, IP_Address(), vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id)); + ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == nullptr, IP_Address(), vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id)); IP_Address out; #ifdef GODOT_ENET @@ -810,7 +810,7 @@ int NetworkedMultiplayerENet::get_peer_port(int p_peer_id) const { ERR_FAIL_COND_V_MSG(!peer_map.has(p_peer_id), 0, vformat("Peer ID %d not found in the list of peers.", p_peer_id)); ERR_FAIL_COND_V_MSG(!is_server() && p_peer_id != 1, 0, "Can't get the address of peers other than the server (ID -1) when acting as a client."); - ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == NULL, 0, vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id)); + ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == nullptr, 0, vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id)); #ifdef GODOT_ENET return peer_map[p_peer_id]->address.port; #else @@ -910,7 +910,7 @@ NetworkedMultiplayerENet::NetworkedMultiplayerENet() { server_relay = true; unique_id = 0; target_peer = 0; - current_packet.packet = NULL; + current_packet.packet = nullptr; transfer_mode = TRANSFER_MODE_RELIABLE; channel_count = SYSCH_MAX; transfer_channel = -1; diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp index b3f7b1d94f..223830f445 100644 --- a/modules/etc/image_etc.cpp +++ b/modules/etc/image_etc.cpp @@ -192,7 +192,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f src_rgba_f[j] = Etc::ColorFloatRGBA::ConvertFromRGBA8(src[si], src[si + 1], src[si + 2], src[si + 3]); } - unsigned char *etc_data = NULL; + unsigned char *etc_data = nullptr; unsigned int etc_data_len = 0; unsigned int extended_width = 0, extended_height = 0; Etc::Encode((float *)src_rgba_f, mipmap_w, mipmap_h, etc2comp_etc_format, error_metric, effort, num_cpus, num_cpus, &etc_data, &etc_data_len, &extended_width, &extended_height, &encoding_time); diff --git a/modules/etc/texture_loader_pkm.h b/modules/etc/texture_loader_pkm.h index d6011993e3..989e203994 100644 --- a/modules/etc/texture_loader_pkm.h +++ b/modules/etc/texture_loader_pkm.h @@ -36,7 +36,7 @@ class ResourceFormatPKM : 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 *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/modules/gdnative/android/android_gdn.cpp b/modules/gdnative/android/android_gdn.cpp index 6e0358342f..bc39be1813 100644 --- a/modules/gdnative/android/android_gdn.cpp +++ b/modules/gdnative/android/android_gdn.cpp @@ -50,7 +50,7 @@ JNIEnv *GDAPI godot_android_get_env() { #ifdef __ANDROID__ return ThreadAndroid::get_env(); #else - return NULL; + return nullptr; #endif } @@ -59,7 +59,7 @@ jobject GDAPI godot_android_get_activity() { OS_Android *os_android = (OS_Android *)OS::get_singleton(); return os_android->get_godot_java()->get_activity(); #else - return NULL; + return nullptr; #endif } @@ -68,7 +68,7 @@ jobject GDAPI godot_android_get_surface() { OS_Android *os_android = (OS_Android *)OS::get_singleton(); return os_android->get_godot_java()->get_surface(); #else - return NULL; + return nullptr; #endif } diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp index faa891e624..f14691027a 100644 --- a/modules/gdnative/arvr/arvr_interface_gdnative.cpp +++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp @@ -42,15 +42,15 @@ ARVRInterfaceGDNative::ARVRInterfaceGDNative() { print_verbose("Construct gdnative interface\n"); // we won't have our data pointer until our library gets set - data = NULL; + data = nullptr; - interface = NULL; + interface = nullptr; } ARVRInterfaceGDNative::~ARVRInterfaceGDNative() { print_verbose("Destruct gdnative interface\n"); - if (interface != NULL && is_initialized()) { + if (interface != nullptr && is_initialized()) { uninitialize(); }; @@ -59,10 +59,10 @@ ARVRInterfaceGDNative::~ARVRInterfaceGDNative() { } void ARVRInterfaceGDNative::cleanup() { - if (interface != NULL) { + if (interface != nullptr) { interface->destructor(data); - data = NULL; - interface = NULL; + data = nullptr; + interface = nullptr; } } @@ -81,7 +81,7 @@ void ARVRInterfaceGDNative::set_interface(const godot_arvr_interface_gdnative *p StringName ARVRInterfaceGDNative::get_name() const { - ERR_FAIL_COND_V(interface == NULL, StringName()); + ERR_FAIL_COND_V(interface == nullptr, StringName()); godot_string result = interface->get_name(data); @@ -95,7 +95,7 @@ StringName ARVRInterfaceGDNative::get_name() const { int ARVRInterfaceGDNative::get_capabilities() const { int capabilities; - ERR_FAIL_COND_V(interface == NULL, 0); // 0 = None + ERR_FAIL_COND_V(interface == nullptr, 0); // 0 = None capabilities = interface->get_capabilities(data); @@ -104,21 +104,21 @@ int ARVRInterfaceGDNative::get_capabilities() const { bool ARVRInterfaceGDNative::get_anchor_detection_is_enabled() const { - ERR_FAIL_COND_V(interface == NULL, false); + ERR_FAIL_COND_V(interface == nullptr, false); return interface->get_anchor_detection_is_enabled(data); } void ARVRInterfaceGDNative::set_anchor_detection_is_enabled(bool p_enable) { - ERR_FAIL_COND(interface == NULL); + ERR_FAIL_COND(interface == nullptr); interface->set_anchor_detection_is_enabled(data, p_enable); } int ARVRInterfaceGDNative::get_camera_feed_id() { - ERR_FAIL_COND_V(interface == NULL, 0); + ERR_FAIL_COND_V(interface == nullptr, 0); if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 1))) { return (unsigned int)interface->get_camera_feed_id(data); @@ -130,7 +130,7 @@ int ARVRInterfaceGDNative::get_camera_feed_id() { bool ARVRInterfaceGDNative::is_stereo() { bool stereo; - ERR_FAIL_COND_V(interface == NULL, false); + ERR_FAIL_COND_V(interface == nullptr, false); stereo = interface->is_stereo(data); @@ -139,13 +139,13 @@ bool ARVRInterfaceGDNative::is_stereo() { bool ARVRInterfaceGDNative::is_initialized() const { - ERR_FAIL_COND_V(interface == NULL, false); + ERR_FAIL_COND_V(interface == nullptr, false); return interface->is_initialized(data); } bool ARVRInterfaceGDNative::initialize() { - ERR_FAIL_COND_V(interface == NULL, false); + ERR_FAIL_COND_V(interface == nullptr, false); bool initialized = interface->initialize(data); @@ -153,7 +153,7 @@ bool ARVRInterfaceGDNative::initialize() { // if we successfully initialize our interface and we don't have a primary interface yet, this becomes our primary interface ARVRServer *arvr_server = ARVRServer::get_singleton(); - if ((arvr_server != NULL) && (arvr_server->get_primary_interface() == NULL)) { + if ((arvr_server != nullptr) && (arvr_server->get_primary_interface() == nullptr)) { arvr_server->set_primary_interface(this); }; }; @@ -162,10 +162,10 @@ bool ARVRInterfaceGDNative::initialize() { } void ARVRInterfaceGDNative::uninitialize() { - ERR_FAIL_COND(interface == NULL); + ERR_FAIL_COND(interface == nullptr); ARVRServer *arvr_server = ARVRServer::get_singleton(); - if (arvr_server != NULL) { + if (arvr_server != nullptr) { // Whatever happens, make sure this is no longer our primary interface arvr_server->clear_primary_interface_if(this); } @@ -175,7 +175,7 @@ void ARVRInterfaceGDNative::uninitialize() { Size2 ARVRInterfaceGDNative::get_render_targetsize() { - ERR_FAIL_COND_V(interface == NULL, Size2()); + ERR_FAIL_COND_V(interface == nullptr, Size2()); godot_vector2 result = interface->get_render_targetsize(data); Vector2 *vec = (Vector2 *)&result; @@ -186,7 +186,7 @@ Size2 ARVRInterfaceGDNative::get_render_targetsize() { Transform ARVRInterfaceGDNative::get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform) { Transform *ret; - ERR_FAIL_COND_V(interface == NULL, Transform()); + ERR_FAIL_COND_V(interface == nullptr, Transform()); godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform); @@ -198,7 +198,7 @@ Transform ARVRInterfaceGDNative::get_transform_for_eye(ARVRInterface::Eyes p_eye CameraMatrix ARVRInterfaceGDNative::get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) { CameraMatrix cm; - ERR_FAIL_COND_V(interface == NULL, CameraMatrix()); + ERR_FAIL_COND_V(interface == nullptr, CameraMatrix()); interface->fill_projection_for_eye(data, (godot_real *)cm.matrix, (godot_int)p_eye, p_aspect, p_z_near, p_z_far); @@ -207,7 +207,7 @@ CameraMatrix ARVRInterfaceGDNative::get_projection_for_eye(ARVRInterface::Eyes p unsigned int ARVRInterfaceGDNative::get_external_texture_for_eye(ARVRInterface::Eyes p_eye) { - ERR_FAIL_COND_V(interface == NULL, 0); + ERR_FAIL_COND_V(interface == nullptr, 0); if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 1))) { return (unsigned int)interface->get_external_texture_for_eye(data, (godot_int)p_eye); @@ -218,19 +218,19 @@ unsigned int ARVRInterfaceGDNative::get_external_texture_for_eye(ARVRInterface:: void ARVRInterfaceGDNative::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) { - ERR_FAIL_COND(interface == NULL); + ERR_FAIL_COND(interface == nullptr); interface->commit_for_eye(data, (godot_int)p_eye, (godot_rid *)&p_render_target, (godot_rect2 *)&p_screen_rect); } void ARVRInterfaceGDNative::process() { - ERR_FAIL_COND(interface == NULL); + ERR_FAIL_COND(interface == nullptr); interface->process(data); } void ARVRInterfaceGDNative::notification(int p_what) { - ERR_FAIL_COND(interface == NULL); + ERR_FAIL_COND(interface == nullptr); // this is only available in interfaces that implement 1.1 or later if ((interface->version.major > 1) || ((interface->version.major == 1) && (interface->version.minor > 0))) { @@ -265,7 +265,7 @@ godot_transform GDAPI godot_arvr_get_reference_frame() { Transform *reference_frame_ptr = (Transform *)&reference_frame; ARVRServer *arvr_server = ARVRServer::get_singleton(); - if (arvr_server != NULL) { + if (arvr_server != nullptr) { *reference_frame_ptr = arvr_server->get_reference_frame(); } else { godot_transform_new_identity(&reference_frame); @@ -360,7 +360,7 @@ void GDAPI godot_arvr_remove_controller(godot_int p_controller_id) { ERR_FAIL_NULL(input); ARVRPositionalTracker *remove_tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); - if (remove_tracker != NULL) { + if (remove_tracker != nullptr) { // unset our joystick if applicable int joyid = remove_tracker->get_joy_id(); if (joyid != -1) { @@ -379,7 +379,7 @@ void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_ ERR_FAIL_NULL(arvr_server); ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker != NULL) { + if (tracker != nullptr) { Transform *transform = (Transform *)p_transform; if (p_tracks_orientation) { tracker->set_orientation(transform->basis); @@ -398,7 +398,7 @@ void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int ERR_FAIL_NULL(input); ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker != NULL) { + if (tracker != nullptr) { int joyid = tracker->get_joy_id(); if (joyid != -1) { input->joy_button(joyid, p_button, p_is_pressed); @@ -414,7 +414,7 @@ void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p ERR_FAIL_NULL(input); ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker != NULL) { + if (tracker != nullptr) { int joyid = tracker->get_joy_id(); if (joyid != -1) { InputFilter::JoyAxis jx; @@ -430,7 +430,7 @@ godot_real GDAPI godot_arvr_get_controller_rumble(godot_int p_controller_id) { ERR_FAIL_NULL_V(arvr_server, 0.0); ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker != NULL) { + if (tracker != nullptr) { return tracker->get_rumble(); } diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 0457a42f30..d3426044ec 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -248,7 +248,7 @@ void GDNativeLibrary::_bind_methods() { } GDNative::GDNative() { - native_handle = NULL; + native_handle = nullptr; initialized = false; } @@ -338,7 +338,7 @@ bool GDNative::initialize() { if (err || !library_init) { OS::get_singleton()->close_dynamic_library(native_handle); - native_handle = NULL; + native_handle = nullptr; ERR_PRINT("Failed to obtain " + library->get_symbol_prefix() + "gdnative_init symbol"); return false; } @@ -408,7 +408,7 @@ bool GDNative::terminate() { Error error = get_symbol(library->get_symbol_prefix() + terminate_symbol, library_terminate); if (error || !library_terminate) { OS::get_singleton()->close_dynamic_library(native_handle); - native_handle = NULL; + native_handle = nullptr; initialized = false; return true; } @@ -426,7 +426,7 @@ bool GDNative::terminate() { // GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path); OS::get_singleton()->close_dynamic_library(native_handle); - native_handle = NULL; + native_handle = nullptr; return true; } @@ -466,7 +466,7 @@ Variant GDNative::call_native(StringName p_native_call_type, StringName p_proced p_procedure_name, procedure_handle); - if (err != OK || procedure_handle == NULL) { + if (err != OK || procedure_handle == nullptr) { return Variant(); } @@ -544,11 +544,11 @@ Error GDNativeLibraryResourceSaver::save(const String &p_path, const RES &p_reso } bool GDNativeLibraryResourceSaver::recognize(const RES &p_resource) const { - return Object::cast_to(*p_resource) != NULL; + return Object::cast_to(*p_resource) != nullptr; } void GDNativeLibraryResourceSaver::get_recognized_extensions(const RES &p_resource, List *p_extensions) const { - if (Object::cast_to(*p_resource) != NULL) { + if (Object::cast_to(*p_resource) != nullptr) { p_extensions->push_back("gdnlib"); } } diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp index d996b006a5..3175340448 100644 --- a/modules/gdnative/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative/gdnative.cpp @@ -95,7 +95,7 @@ godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classnam ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(StringName(p_classname)); if (class_info) return (godot_class_constructor)class_info->creation_func; - return NULL; + return nullptr; } godot_dictionary GDAPI godot_get_global_constants() { @@ -173,14 +173,14 @@ godot_object GDAPI *godot_instance_from_id(godot_int p_instance_id) { void *godot_get_class_tag(const godot_string_name *p_class) { StringName class_name = *(StringName *)p_class; ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(class_name); - return class_info ? class_info->class_ptr : NULL; + return class_info ? class_info->class_ptr : nullptr; } godot_object *godot_object_cast_to(const godot_object *p_object, void *p_class_tag) { - if (!p_object) return NULL; + if (!p_object) return nullptr; Object *o = (Object *)p_object; - return o->is_class_ptr(p_class_tag) ? (godot_object *)o : NULL; + return o->is_class_ptr(p_class_tag) ? (godot_object *)o : nullptr; } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp index 9b4c3c794e..10ddd79d3a 100644 --- a/modules/gdnative/gdnative_library_editor_plugin.cpp +++ b/modules/gdnative/gdnative_library_editor_plugin.cpp @@ -119,7 +119,7 @@ void GDNativeLibraryEditor::_update_tree() { new_arch->set_expand_right(0, true); new_arch->set_metadata(1, E->key()); - platform->set_collapsed(collapsed_items.find(E->get().name) != NULL); + platform->set_collapsed(collapsed_items.find(E->get().name) != nullptr); } filter->set_text(text); } diff --git a/modules/gdnative/include/pluginscript/godot_pluginscript.h b/modules/gdnative/include/pluginscript/godot_pluginscript.h index 341e7f9e2b..406c3ba663 100644 --- a/modules/gdnative/include/pluginscript/godot_pluginscript.h +++ b/modules/gdnative/include/pluginscript/godot_pluginscript.h @@ -60,7 +60,7 @@ typedef struct { //this is used by script languages that keep a reference counter of their own //you can make make Ref<> not die when it reaches zero, so deleting the reference //depends entirely from the script. - // Note: You can set those function pointer to NULL if not needed. + // Note: You can set those function pointer to nullptr if not needed. void (*refcount_incremented)(godot_pluginscript_instance_data *p_data); bool (*refcount_decremented)(godot_pluginscript_instance_data *p_data); // return true if it can die } godot_pluginscript_instance_desc; @@ -119,18 +119,18 @@ typedef struct { const char *name; const char *type; const char *extension; - const char **recognized_extensions; // NULL terminated array + const char **recognized_extensions; // nullptr terminated array godot_pluginscript_language_data *(*init)(); void (*finish)(godot_pluginscript_language_data *p_data); - const char **reserved_words; // NULL terminated array - const char **comment_delimiters; // NULL terminated array - const char **string_delimiters; // NULL terminated array + const char **reserved_words; // nullptr terminated array + const char **comment_delimiters; // nullptr terminated array + const char **string_delimiters; // nullptr terminated array godot_bool has_named_classes; godot_bool supports_builtin_mode; godot_string (*get_template_source_code)(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name); godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_packed_string_array *r_functions); - int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be NULL + int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be nullptr godot_string (*make_function)(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_packed_string_array *p_args); godot_error (*complete_code)(godot_pluginscript_language_data *p_data, const godot_string *p_code, const godot_string *p_path, godot_object *p_owner, godot_array *r_options, godot_bool *r_force, godot_string *r_call_hint); void (*auto_indent_code)(godot_pluginscript_language_data *p_data, godot_string *p_code, int p_from_line, int p_to_line); diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index 11fe746e90..3c0cfd0484 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -46,7 +46,7 @@ static Error save_file(const String &p_path, const List &p_content) { ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE); - for (const List::Element *e = p_content.front(); e != NULL; e = e->next()) { + for (const List::Element *e = p_content.front(); e != nullptr; e = e->next()) { file->store_string(e->get()); } @@ -197,7 +197,7 @@ List generate_c_api_classes() { api.push_back(global_constants_api); } - for (List::Element *e = classes.front(); e != NULL; e = e->next()) { + for (List::Element *e = classes.front(); e != nullptr; e = e->next()) { StringName class_name = e->get(); ClassAPI class_api; @@ -229,7 +229,7 @@ List generate_c_api_classes() { List constant; ClassDB::get_integer_constant_list(class_name, &constant, true); constant.sort_custom(); - for (List::Element *c = constant.front(); c != NULL; c = c->next()) { + for (List::Element *c = constant.front(); c != nullptr; c = c->next()) { ConstantAPI constant_api; constant_api.constant_name = c->get(); constant_api.constant_value = ClassDB::get_integer_constant(class_name, c->get()); @@ -284,7 +284,7 @@ List generate_c_api_classes() { ClassDB::get_property_list(class_name, &properties, true); properties.sort_custom(); - for (List::Element *p = properties.front(); p != NULL; p = p->next()) { + for (List::Element *p = properties.front(); p != nullptr; p = p->next()) { PropertyAPI property_api; property_api.name = p->get().name; @@ -312,7 +312,7 @@ List generate_c_api_classes() { ClassDB::get_method_list(class_name, &methods, true); methods.sort_custom(); - for (List::Element *m = methods.front(); m != NULL; m = m->next()) { + for (List::Element *m = methods.front(); m != nullptr; m = m->next()) { MethodAPI method_api; MethodBind *method_bind = ClassDB::get_method(class_name, m->get().name); MethodInfo &method_info = m->get(); @@ -392,7 +392,7 @@ List generate_c_api_classes() { enum_api.name = E->get(); ClassDB::get_enum_constants(class_name, E->get(), &value_names, true); for (List::Element *val_e = value_names.front(); val_e; val_e = val_e->next()) { - int int_val = ClassDB::get_integer_constant(class_name, val_e->get(), NULL); + int int_val = ClassDB::get_integer_constant(class_name, val_e->get(), nullptr); enum_api.values.push_back(Pair(int_val, val_e->get())); } enum_api.values.sort_custom>(); @@ -417,7 +417,7 @@ static List generate_c_api_json(const List &p_api) { source.push_back("[\n"); - for (const List::Element *c = p_api.front(); c != NULL; c = c->next()) { + for (const List::Element *c = p_api.front(); c != nullptr; c = c->next()) { ClassAPI api = c->get(); source.push_back("\t{\n"); diff --git a/modules/gdnative/nativescript/godot_nativescript.cpp b/modules/gdnative/nativescript/godot_nativescript.cpp index f953206a34..0502458b4f 100644 --- a/modules/gdnative/nativescript/godot_nativescript.cpp +++ b/modules/gdnative/nativescript/godot_nativescript.cpp @@ -77,7 +77,7 @@ void GDAPI godot_nativescript_register_class(void *p_gdnative_handle, const char } } else { - desc.base_data = NULL; + desc.base_data = nullptr; desc.base_native_type = p_base; } @@ -111,7 +111,7 @@ void GDAPI godot_nativescript_register_tool_class(void *p_gdnative_handle, const } } else { - desc.base_data = NULL; + desc.base_data = nullptr; desc.base_native_type = p_base; } @@ -210,11 +210,11 @@ void GDAPI godot_nativescript_register_signal(void *p_gdnative_handle, const cha void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance) { Object *instance = (Object *)p_instance; if (!instance) - return NULL; + return nullptr; if (instance->get_script_instance() && instance->get_script_instance()->get_language() == NativeScriptLanguage::get_singleton()) { return ((NativeScriptInstance *)instance->get_script_instance())->userdata; } - return NULL; + return nullptr; } /* @@ -319,18 +319,18 @@ const void GDAPI *godot_nativescript_get_type_tag(const godot_object *p_object) const Object *o = (Object *)p_object; if (!o->get_script_instance()) { - return NULL; + return nullptr; } else { NativeScript *script = Object::cast_to(o->get_script_instance()->get_script().ptr()); if (!script) { - return NULL; + return nullptr; } if (script->get_script_desc()) return script->get_script_desc()->type_tag; } - return NULL; + return nullptr; } int GDAPI godot_nativescript_register_instance_binding_data_functions(godot_instance_binding_functions p_binding_functions) { diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 80aebaccd1..bf458c15ee 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -204,7 +204,7 @@ ScriptInstance *NativeScript::instance_create(Object *p_this) { NativeScriptDesc *script_data = get_script_desc(); if (!script_data) { - return NULL; + return nullptr; } NativeScriptInstance *nsi = memnew(NativeScriptInstance); @@ -214,7 +214,7 @@ ScriptInstance *NativeScript::instance_create(Object *p_this) { #ifndef TOOLS_ENABLED if (!ScriptServer::is_scripting_enabled()) { - nsi->userdata = NULL; + nsi->userdata = nullptr; } else { nsi->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data); } @@ -240,7 +240,7 @@ PlaceHolderScriptInstance *NativeScript::placeholder_instance_create(Object *p_t return sins; #else - return NULL; + return nullptr; #endif } @@ -738,7 +738,7 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::Cal r_error.error = Callable::CallError::CALL_OK; REF ref; - Object *owner = NULL; + Object *owner = nullptr; if (!(script_data->base_native_type == "")) { owner = ClassDB::instance(script_data->base_native_type); @@ -886,7 +886,7 @@ void NativeScriptInstance::get_property_list(List *p_properties) c E->get().method.method_data, userdata, 0, - NULL); + nullptr); Variant res = *(Variant *)&result; godot_variant_destroy(&result); @@ -1007,7 +1007,7 @@ void NativeScriptInstance::notification(int p_notification) { String NativeScriptInstance::to_string(bool *r_valid) { if (has_method(CoreStringNames::get_singleton()->_to_string)) { Callable::CallError ce; - Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce); + Variant ret = call(CoreStringNames::get_singleton()->_to_string, nullptr, 0, ce); if (ce.error == Callable::CallError::CALL_OK) { if (ret.get_type() != Variant::STRING) { if (r_valid) @@ -1026,7 +1026,7 @@ String NativeScriptInstance::to_string(bool *r_valid) { void NativeScriptInstance::refcount_incremented() { Callable::CallError err; - call("_refcount_incremented", NULL, 0, err); + call("_refcount_incremented", nullptr, 0, err); if (err.error != Callable::CallError::CALL_OK && err.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) { ERR_PRINT("Failed to invoke _refcount_incremented - should not happen"); } @@ -1034,7 +1034,7 @@ void NativeScriptInstance::refcount_incremented() { bool NativeScriptInstance::refcount_decremented() { Callable::CallError err; - Variant ret = call("_refcount_decremented", NULL, 0, err); + Variant ret = call("_refcount_decremented", nullptr, 0, err); if (err.error != Callable::CallError::CALL_OK && err.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) { ERR_PRINT("Failed to invoke _refcount_decremented - should not happen"); return true; // assume we can destroy the object @@ -1525,14 +1525,14 @@ void NativeScriptLanguage::unregister_binding_functions(int p_idx) { } void *NativeScriptLanguage::get_instance_binding_data(int p_idx, Object *p_object) { - ERR_FAIL_INDEX_V(p_idx, binding_functions.size(), NULL); + ERR_FAIL_INDEX_V(p_idx, binding_functions.size(), nullptr); - ERR_FAIL_COND_V_MSG(!binding_functions[p_idx].first, NULL, "Tried to get binding data for a nativescript binding that does not exist."); + ERR_FAIL_COND_V_MSG(!binding_functions[p_idx].first, nullptr, "Tried to get binding data for a nativescript binding that does not exist."); Vector *binding_data = (Vector *)p_object->get_script_instance_binding(lang_idx); if (!binding_data) - return NULL; // should never happen. + return nullptr; // should never happen. if (binding_data->size() <= p_idx) { // okay, add new elements here. @@ -1541,7 +1541,7 @@ void *NativeScriptLanguage::get_instance_binding_data(int p_idx, Object *p_objec binding_data->resize(p_idx + 1); for (int i = old_size; i <= p_idx; i++) { - (*binding_data).write[i] = NULL; + (*binding_data).write[i] = nullptr; } } @@ -1563,7 +1563,7 @@ void *NativeScriptLanguage::alloc_instance_binding_data(Object *p_object) { binding_data->resize(binding_functions.size()); for (int i = 0; i < binding_functions.size(); i++) { - (*binding_data).write[i] = NULL; + (*binding_data).write[i] = nullptr; } binding_instances.insert(binding_data); @@ -1652,12 +1652,12 @@ void NativeScriptLanguage::set_global_type_tag(int p_idx, StringName p_class_nam const void *NativeScriptLanguage::get_global_type_tag(int p_idx, StringName p_class_name) const { if (!global_type_tags.has(p_idx)) - return NULL; + return nullptr; const HashMap &tags = global_type_tags[p_idx]; if (!tags.has(p_class_name)) - return NULL; + return nullptr; const void *tag = tags.get(p_class_name); @@ -1956,7 +1956,7 @@ Error ResourceFormatSaverNativeScript::save(const String &p_path, const RES &p_r } bool ResourceFormatSaverNativeScript::recognize(const RES &p_resource) const { - return Object::cast_to(*p_resource) != NULL; + return Object::cast_to(*p_resource) != nullptr; } void ResourceFormatSaverNativeScript::get_recognized_extensions(const RES &p_resource, List *p_extensions) const { diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index aba3f6b2d0..75bbb42664 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -95,7 +95,7 @@ struct NativeScriptDesc { base(), base_native_type(), documentation(), - type_tag(NULL) { + type_tag(nullptr) { zeromem(&create_func, sizeof(godot_instance_create_func)); zeromem(&destroy_func, sizeof(godot_instance_destroy_func)); } @@ -341,7 +341,7 @@ public: virtual void get_comment_delimiters(List *p_delimiters) const; virtual void get_string_delimiters(List *p_delimiters) const; virtual Ref