summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/fbx/fbx_document.cpp9
-rw-r--r--modules/gdscript/gdscript_lambda_callable.cpp4
-rw-r--r--modules/gdscript/gdscript_parser.cpp4
-rw-r--r--modules/gdscript/language_server/gdscript_language_protocol.cpp6
-rw-r--r--modules/gltf/extensions/gltf_document_extension.cpp50
-rw-r--r--modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.cpp2
-rw-r--r--modules/gltf/extensions/physics/gltf_physics_shape.cpp2
-rw-r--r--modules/gltf/gltf_document.cpp24
-rw-r--r--modules/mono/csharp_script.cpp2
-rw-r--r--modules/mono/godotsharp_dirs.cpp2
-rw-r--r--modules/noise/tests/test_noise_texture_2d.h4
-rw-r--r--modules/noise/tests/test_noise_texture_3d.h4
-rw-r--r--modules/regex/tests/test_regex.h50
-rw-r--r--modules/upnp/upnp.cpp12
-rw-r--r--modules/zip/zip_packer.cpp2
-rw-r--r--modules/zip/zip_reader.cpp2
16 files changed, 89 insertions, 90 deletions
diff --git a/modules/fbx/fbx_document.cpp b/modules/fbx/fbx_document.cpp
index 4e1a00cad6..8d4d0234da 100644
--- a/modules/fbx/fbx_document.cpp
+++ b/modules/fbx/fbx_document.cpp
@@ -875,7 +875,7 @@ Error FBXDocument::_parse_meshes(Ref<FBXState> p_state) {
const int material = int(fbx_material->typed_id);
ERR_FAIL_INDEX_V(material, p_state->materials.size(), ERR_FILE_CORRUPT);
Ref<Material> mat3d = p_state->materials[material];
- ERR_FAIL_NULL_V(mat3d, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(mat3d.is_null(), ERR_FILE_CORRUPT);
Ref<BaseMaterial3D> base_material = mat3d;
if (has_vertex_color && base_material.is_valid()) {
@@ -891,7 +891,7 @@ Error FBXDocument::_parse_meshes(Ref<FBXState> p_state) {
}
mat = mat3d;
}
- ERR_FAIL_NULL_V(mat, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(mat.is_null(), ERR_FILE_CORRUPT);
mat_name = mat->get_name();
}
import_mesh->add_surface(primitive, array, morphs,
@@ -1056,7 +1056,7 @@ GLTFImageIndex FBXDocument::_parse_image_save_image(Ref<FBXState> p_state, const
}
Error FBXDocument::_parse_images(Ref<FBXState> p_state, const String &p_base_path) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
const ufbx_scene *fbx_scene = p_state->scene.get();
for (int texture_i = 0; texture_i < static_cast<int>(fbx_scene->texture_files.count); texture_i++) {
@@ -2118,7 +2118,6 @@ Error FBXDocument::_parse(Ref<FBXState> p_state, String p_path, Ref<FileAccess>
Node *FBXDocument::generate_scene(Ref<GLTFState> p_state, float p_bake_fps, bool p_trimming, bool p_remove_immutable_tracks) {
Ref<FBXState> state = p_state;
ERR_FAIL_COND_V(state.is_null(), nullptr);
- ERR_FAIL_NULL_V(state, nullptr);
ERR_FAIL_INDEX_V(0, state->root_nodes.size(), nullptr);
p_state->set_bake_fps(p_bake_fps);
GLTFNodeIndex fbx_root = state->root_nodes.write[0];
@@ -2246,7 +2245,7 @@ Error FBXDocument::append_from_file(String p_path, Ref<GLTFState> p_state, uint3
Error err;
Ref<FileAccess> file = FileAccess::open(p_path, FileAccess::READ, &err);
ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN);
- ERR_FAIL_NULL_V(file, ERR_FILE_CANT_OPEN);
+ ERR_FAIL_COND_V(file.is_null(), ERR_FILE_CANT_OPEN);
String base_path = p_base_path;
if (base_path.is_empty()) {
base_path = p_path.get_base_dir();
diff --git a/modules/gdscript/gdscript_lambda_callable.cpp b/modules/gdscript/gdscript_lambda_callable.cpp
index 2162a727b3..2de5811bca 100644
--- a/modules/gdscript/gdscript_lambda_callable.cpp
+++ b/modules/gdscript/gdscript_lambda_callable.cpp
@@ -150,7 +150,7 @@ void GDScriptLambdaCallable::call(const Variant **p_arguments, int p_argcount, V
GDScriptLambdaCallable::GDScriptLambdaCallable(Ref<GDScript> p_script, GDScriptFunction *p_function, const Vector<Variant> &p_captures) :
function(p_function) {
- ERR_FAIL_NULL(p_script.ptr());
+ ERR_FAIL_COND(p_script.is_null());
ERR_FAIL_NULL(p_function);
script = p_script;
captures = p_captures;
@@ -282,7 +282,7 @@ void GDScriptLambdaSelfCallable::call(const Variant **p_arguments, int p_argcoun
GDScriptLambdaSelfCallable::GDScriptLambdaSelfCallable(Ref<RefCounted> p_self, GDScriptFunction *p_function, const Vector<Variant> &p_captures) :
function(p_function) {
- ERR_FAIL_NULL(p_self.ptr());
+ ERR_FAIL_COND(p_self.is_null());
ERR_FAIL_NULL(p_function);
reference = p_self;
object = p_self.ptr();
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 582305d900..b6db6a940b 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -4795,9 +4795,9 @@ String GDScriptParser::DataType::to_string() const {
return class_type->fqcn;
case SCRIPT: {
if (is_meta_type) {
- return script_type != nullptr ? script_type->get_class_name().operator String() : "";
+ return script_type.is_valid() ? script_type->get_class_name().operator String() : "";
}
- String name = script_type != nullptr ? script_type->get_name() : "";
+ String name = script_type.is_valid() ? script_type->get_name() : "";
if (!name.is_empty()) {
return name;
}
diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp
index 03d830741b..b636dbe580 100644
--- a/modules/gdscript/language_server/gdscript_language_protocol.cpp
+++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp
@@ -196,7 +196,7 @@ Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) {
ERR_FAIL_COND_V_MSG(!clients.has(latest_client_id), ret.to_json(),
vformat("GDScriptLanguageProtocol: Can't initialize invalid peer '%d'.", latest_client_id));
Ref<LSPeer> peer = clients.get(latest_client_id);
- if (peer != nullptr) {
+ if (peer.is_valid()) {
String msg = Variant(request).to_json_string();
msg = format_output(msg);
(*peer)->res_queue.push_back(msg.utf8());
@@ -298,7 +298,7 @@ void GDScriptLanguageProtocol::notify_client(const String &p_method, const Varia
}
ERR_FAIL_COND(!clients.has(p_client_id));
Ref<LSPeer> peer = clients.get(p_client_id);
- ERR_FAIL_NULL(peer);
+ ERR_FAIL_COND(peer.is_null());
Dictionary message = make_notification(p_method, p_params);
String msg = Variant(message).to_json_string();
@@ -319,7 +319,7 @@ void GDScriptLanguageProtocol::request_client(const String &p_method, const Vari
}
ERR_FAIL_COND(!clients.has(p_client_id));
Ref<LSPeer> peer = clients.get(p_client_id);
- ERR_FAIL_NULL(peer);
+ ERR_FAIL_COND(peer.is_null());
Dictionary message = make_request(p_method, p_params, next_server_id);
next_server_id++;
diff --git a/modules/gltf/extensions/gltf_document_extension.cpp b/modules/gltf/extensions/gltf_document_extension.cpp
index 9fdd6034a9..c6540ebb22 100644
--- a/modules/gltf/extensions/gltf_document_extension.cpp
+++ b/modules/gltf/extensions/gltf_document_extension.cpp
@@ -56,7 +56,7 @@ void GLTFDocumentExtension::_bind_methods() {
// Import process.
Error GLTFDocumentExtension::import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_import_preflight, p_state, p_extensions, err);
return err;
@@ -69,16 +69,16 @@ Vector<String> GLTFDocumentExtension::get_supported_extensions() {
}
Error GLTFDocumentExtension::parse_node_extensions(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &p_extensions) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_gltf_node.is_null(), ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_parse_node_extensions, p_state, p_gltf_node, p_extensions, err);
return err;
}
Error GLTFDocumentExtension::parse_image_data(Ref<GLTFState> p_state, const PackedByteArray &p_image_data, const String &p_mime_type, Ref<Image> r_image) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- ERR_FAIL_NULL_V(r_image, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(r_image.is_null(), ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_parse_image_data, p_state, p_image_data, p_mime_type, r_image, err);
return err;
@@ -91,31 +91,31 @@ String GLTFDocumentExtension::get_image_file_extension() {
}
Error GLTFDocumentExtension::parse_texture_json(Ref<GLTFState> p_state, const Dictionary &p_texture_json, Ref<GLTFTexture> r_gltf_texture) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- ERR_FAIL_NULL_V(r_gltf_texture, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(r_gltf_texture.is_null(), ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_parse_texture_json, p_state, p_texture_json, r_gltf_texture, err);
return err;
}
Node3D *GLTFDocumentExtension::generate_scene_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Node *p_scene_parent) {
- ERR_FAIL_NULL_V(p_state, nullptr);
- ERR_FAIL_NULL_V(p_gltf_node, nullptr);
+ ERR_FAIL_COND_V(p_state.is_null(), nullptr);
+ ERR_FAIL_COND_V(p_gltf_node.is_null(), nullptr);
Node3D *ret_node = nullptr;
GDVIRTUAL_CALL(_generate_scene_node, p_state, p_gltf_node, p_scene_parent, ret_node);
return ret_node;
}
Error GLTFDocumentExtension::import_post_parse(Ref<GLTFState> p_state) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_import_post_parse, p_state, err);
return err;
}
Error GLTFDocumentExtension::import_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &r_dict, Node *p_node) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_gltf_node.is_null(), ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_import_node, p_state, p_gltf_node, r_dict, p_node, err);
@@ -124,7 +124,7 @@ Error GLTFDocumentExtension::import_node(Ref<GLTFState> p_state, Ref<GLTFNode> p
Error GLTFDocumentExtension::import_post(Ref<GLTFState> p_state, Node *p_root) {
ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_import_post, p_state, p_root, err);
return err;
@@ -139,14 +139,14 @@ Error GLTFDocumentExtension::export_preflight(Ref<GLTFState> p_state, Node *p_ro
}
void GLTFDocumentExtension::convert_scene_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Node *p_scene_node) {
- ERR_FAIL_NULL(p_state);
- ERR_FAIL_NULL(p_gltf_node);
+ ERR_FAIL_COND(p_state.is_null());
+ ERR_FAIL_COND(p_gltf_node.is_null());
ERR_FAIL_NULL(p_scene_node);
GDVIRTUAL_CALL(_convert_scene_node, p_state, p_gltf_node, p_scene_node);
}
Error GLTFDocumentExtension::export_preserialize(Ref<GLTFState> p_state) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_export_preserialize, p_state, err);
return err;
@@ -160,38 +160,38 @@ Vector<String> GLTFDocumentExtension::get_saveable_image_formats() {
PackedByteArray GLTFDocumentExtension::serialize_image_to_bytes(Ref<GLTFState> p_state, Ref<Image> p_image, Dictionary p_image_dict, const String &p_image_format, float p_lossy_quality) {
PackedByteArray ret;
- ERR_FAIL_NULL_V(p_state, ret);
- ERR_FAIL_NULL_V(p_image, ret);
+ ERR_FAIL_COND_V(p_state.is_null(), ret);
+ ERR_FAIL_COND_V(p_image.is_null(), ret);
GDVIRTUAL_CALL(_serialize_image_to_bytes, p_state, p_image, p_image_dict, p_image_format, p_lossy_quality, ret);
return ret;
}
Error GLTFDocumentExtension::save_image_at_path(Ref<GLTFState> p_state, Ref<Image> p_image, const String &p_file_path, const String &p_image_format, float p_lossy_quality) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- ERR_FAIL_NULL_V(p_image, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_image.is_null(), ERR_INVALID_PARAMETER);
Error ret = OK;
GDVIRTUAL_CALL(_save_image_at_path, p_state, p_image, p_file_path, p_image_format, p_lossy_quality, ret);
return ret;
}
Error GLTFDocumentExtension::serialize_texture_json(Ref<GLTFState> p_state, Dictionary p_texture_json, Ref<GLTFTexture> p_gltf_texture, const String &p_image_format) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- ERR_FAIL_NULL_V(p_gltf_texture, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_gltf_texture.is_null(), ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_serialize_texture_json, p_state, p_texture_json, p_gltf_texture, p_image_format, err);
return err;
}
Error GLTFDocumentExtension::export_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &r_dict, Node *p_node) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
- ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_gltf_node.is_null(), ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_export_node, p_state, p_gltf_node, r_dict, p_node, err);
return err;
}
Error GLTFDocumentExtension::export_post(Ref<GLTFState> p_state) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
Error err = OK;
GDVIRTUAL_CALL(_export_post, p_state, err);
return err;
diff --git a/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.cpp b/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.cpp
index 64117349e0..cde30bce18 100644
--- a/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.cpp
+++ b/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.cpp
@@ -45,7 +45,7 @@ void GLTFDocumentExtensionConvertImporterMesh::_copy_meta(Object *p_src_object,
Error GLTFDocumentExtensionConvertImporterMesh::import_post(Ref<GLTFState> p_state, Node *p_root) {
ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
List<Node *> queue;
queue.push_back(p_root);
List<Node *> delete_queue;
diff --git a/modules/gltf/extensions/physics/gltf_physics_shape.cpp b/modules/gltf/extensions/physics/gltf_physics_shape.cpp
index 0340eb11b5..0f2246ce18 100644
--- a/modules/gltf/extensions/physics/gltf_physics_shape.cpp
+++ b/modules/gltf/extensions/physics/gltf_physics_shape.cpp
@@ -229,7 +229,7 @@ Ref<GLTFPhysicsShape> GLTFPhysicsShape::from_resource(const Ref<Shape3D> &p_shap
}
Ref<Shape3D> GLTFPhysicsShape::to_resource(bool p_cache_shapes) {
- if (!p_cache_shapes || _shape_cache == nullptr) {
+ if (!p_cache_shapes || _shape_cache.is_null()) {
if (shape_type == "box") {
Ref<BoxShape3D> box;
box.instantiate();
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index 69973a34dd..4653df7afe 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -299,8 +299,8 @@ Error GLTFDocument::_parse_json(const String &p_path, Ref<GLTFState> p_state) {
}
Error GLTFDocument::_parse_glb(Ref<FileAccess> p_file, Ref<GLTFState> p_state) {
- ERR_FAIL_NULL_V(p_file, ERR_INVALID_PARAMETER);
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_file.is_null(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
ERR_FAIL_COND_V(p_file->get_position() != 0, ERR_FILE_CANT_READ);
uint32_t magic = p_file->get_32();
ERR_FAIL_COND_V(magic != 0x46546C67, ERR_FILE_UNRECOGNIZED); //glTF
@@ -3282,7 +3282,7 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> p_state) {
const int material = p["material"];
ERR_FAIL_INDEX_V(material, p_state->materials.size(), ERR_FILE_CORRUPT);
Ref<Material> mat3d = p_state->materials[material];
- ERR_FAIL_NULL_V(mat3d, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(mat3d.is_null(), ERR_FILE_CORRUPT);
Ref<BaseMaterial3D> base_material = mat3d;
if (has_vertex_color && base_material.is_valid()) {
@@ -3298,7 +3298,7 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> p_state) {
}
mat = mat3d;
}
- ERR_FAIL_NULL_V(mat, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(mat.is_null(), ERR_FILE_CORRUPT);
mat_name = mat->get_name();
}
import_mesh->add_surface(primitive, array, morphs,
@@ -3601,7 +3601,7 @@ void GLTFDocument::_parse_image_save_image(Ref<GLTFState> p_state, const Vector<
}
Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_path) {
- ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
if (!p_state->json.has("images")) {
return OK;
}
@@ -6967,14 +6967,14 @@ Dictionary _serialize_texture_transform_uv(Vector2 p_offset, Vector2 p_scale) {
}
Dictionary GLTFDocument::_serialize_texture_transform_uv1(Ref<BaseMaterial3D> p_material) {
- ERR_FAIL_NULL_V(p_material, Dictionary());
+ ERR_FAIL_COND_V(p_material.is_null(), Dictionary());
Vector3 offset = p_material->get_uv1_offset();
Vector3 scale = p_material->get_uv1_scale();
return _serialize_texture_transform_uv(Vector2(offset.x, offset.y), Vector2(scale.x, scale.y));
}
Dictionary GLTFDocument::_serialize_texture_transform_uv2(Ref<BaseMaterial3D> p_material) {
- ERR_FAIL_NULL_V(p_material, Dictionary());
+ ERR_FAIL_COND_V(p_material.is_null(), Dictionary());
Vector3 offset = p_material->get_uv2_offset();
Vector3 scale = p_material->get_uv2_scale();
return _serialize_texture_transform_uv(Vector2(offset.x, offset.y), Vector2(scale.x, scale.y));
@@ -7345,7 +7345,7 @@ Error GLTFDocument::_parse_gltf_state(Ref<GLTFState> p_state, const String &p_se
PackedByteArray GLTFDocument::generate_buffer(Ref<GLTFState> p_state) {
Ref<GLTFState> state = p_state;
- ERR_FAIL_NULL_V(state, PackedByteArray());
+ ERR_FAIL_COND_V(state.is_null(), PackedByteArray());
// For buffers, set the state filename to an empty string, but
// don't touch the base path, in case the user set it manually.
state->filename = "";
@@ -7357,7 +7357,7 @@ PackedByteArray GLTFDocument::generate_buffer(Ref<GLTFState> p_state) {
Error GLTFDocument::write_to_filesystem(Ref<GLTFState> p_state, const String &p_path) {
Ref<GLTFState> state = p_state;
- ERR_FAIL_NULL_V(state, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(state.is_null(), ERR_INVALID_PARAMETER);
state->base_path = p_path.get_base_dir();
state->filename = p_path.get_file();
Error err = _serialize(state);
@@ -7373,7 +7373,7 @@ Error GLTFDocument::write_to_filesystem(Ref<GLTFState> p_state, const String &p_
Node *GLTFDocument::generate_scene(Ref<GLTFState> p_state, float p_bake_fps, bool p_trimming, bool p_remove_immutable_tracks) {
Ref<GLTFState> state = p_state;
- ERR_FAIL_NULL_V(state, nullptr);
+ ERR_FAIL_COND_V(state.is_null(), nullptr);
ERR_FAIL_INDEX_V(0, state->root_nodes.size(), nullptr);
Error err = OK;
p_state->set_bake_fps(p_bake_fps);
@@ -7491,7 +7491,7 @@ Error GLTFDocument::append_from_file(String p_path, Ref<GLTFState> p_state, uint
Error err;
Ref<FileAccess> file = FileAccess::open(p_path, FileAccess::READ, &err);
ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN);
- ERR_FAIL_NULL_V(file, ERR_FILE_CANT_OPEN);
+ ERR_FAIL_COND_V(file.is_null(), ERR_FILE_CANT_OPEN);
String base_path = p_base_path;
if (base_path.is_empty()) {
base_path = p_path.get_base_dir();
@@ -7508,7 +7508,7 @@ Error GLTFDocument::append_from_file(String p_path, Ref<GLTFState> p_state, uint
}
Error GLTFDocument::_parse_gltf_extensions(Ref<GLTFState> p_state) {
- ERR_FAIL_NULL_V(p_state, ERR_PARSE_ERROR);
+ ERR_FAIL_COND_V(p_state.is_null(), ERR_PARSE_ERROR);
if (p_state->json.has("extensionsUsed")) {
Vector<String> ext_array = p_state->json["extensionsUsed"];
p_state->extensions_used = ext_array;
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 6d561c1566..177859f270 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -2796,7 +2796,7 @@ Ref<Resource> ResourceFormatLoaderCSharpScript::load(const String &p_path, const
if (GDMonoCache::godot_api_cache_updated) {
GDMonoCache::managed_callbacks.ScriptManagerBridge_GetOrCreateScriptBridgeForPath(&p_path, &scr);
- ERR_FAIL_NULL_V_MSG(scr, Ref<Resource>(), "Could not create C# script '" + real_path + "'.");
+ ERR_FAIL_COND_V_MSG(scr.is_null(), Ref<Resource>(), "Could not create C# script '" + real_path + "'.");
} else {
scr = Ref<CSharpScript>(memnew(CSharpScript));
}
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
index 80e44011be..3935854a29 100644
--- a/modules/mono/godotsharp_dirs.cpp
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -194,7 +194,7 @@ private:
if (!has_data) {
// 3. Extract the data to a temporary location to load from there.
Ref<DirAccess> da = DirAccess::create_for_path(packed_path);
- ERR_FAIL_NULL(da);
+ ERR_FAIL_COND(da.is_null());
ERR_FAIL_COND(da->copy_dir(packed_path, data_dir_root) != OK);
}
api_assemblies_dir = data_dir_root;
diff --git a/modules/noise/tests/test_noise_texture_2d.h b/modules/noise/tests/test_noise_texture_2d.h
index 938e8fd6ab..0d18d66e74 100644
--- a/modules/noise/tests/test_noise_texture_2d.h
+++ b/modules/noise/tests/test_noise_texture_2d.h
@@ -135,7 +135,7 @@ TEST_CASE("[NoiseTexture][SceneTree] Getter and setter") {
noise_texture->set_noise(noise);
CHECK(noise_texture->get_noise() == noise);
noise_texture->set_noise(nullptr);
- CHECK(noise_texture->get_noise() == nullptr);
+ CHECK(noise_texture->get_noise().is_null());
noise_texture->set_width(8);
noise_texture->set_height(4);
@@ -190,7 +190,7 @@ TEST_CASE("[NoiseTexture][SceneTree] Getter and setter") {
noise_texture->set_color_ramp(gradient);
CHECK(noise_texture->get_color_ramp() == gradient);
noise_texture->set_color_ramp(nullptr);
- CHECK(noise_texture->get_color_ramp() == nullptr);
+ CHECK(noise_texture->get_color_ramp().is_null());
}
TEST_CASE("[NoiseTexture2D][SceneTree] Generating a basic noise texture with mipmaps and color ramp modulation") {
diff --git a/modules/noise/tests/test_noise_texture_3d.h b/modules/noise/tests/test_noise_texture_3d.h
index b708eac43b..434cd20a08 100644
--- a/modules/noise/tests/test_noise_texture_3d.h
+++ b/modules/noise/tests/test_noise_texture_3d.h
@@ -133,7 +133,7 @@ TEST_CASE("[NoiseTexture][SceneTree] Getter and setter") {
noise_texture->set_noise(noise);
CHECK(noise_texture->get_noise() == noise);
noise_texture->set_noise(nullptr);
- CHECK(noise_texture->get_noise() == nullptr);
+ CHECK(noise_texture->get_noise().is_null());
noise_texture->set_width(8);
noise_texture->set_height(4);
@@ -174,7 +174,7 @@ TEST_CASE("[NoiseTexture][SceneTree] Getter and setter") {
noise_texture->set_color_ramp(gradient);
CHECK(noise_texture->get_color_ramp() == gradient);
noise_texture->set_color_ramp(nullptr);
- CHECK(noise_texture->get_color_ramp() == nullptr);
+ CHECK(noise_texture->get_color_ramp().is_null());
}
TEST_CASE("[NoiseTexture3D][SceneTree] Generating a basic noise texture with mipmaps and color ramp modulation") {
diff --git a/modules/regex/tests/test_regex.h b/modules/regex/tests/test_regex.h
index af58e2487b..7e8e456341 100644
--- a/modules/regex/tests/test_regex.h
+++ b/modules/regex/tests/test_regex.h
@@ -80,32 +80,32 @@ TEST_CASE("[RegEx] Searching") {
REQUIRE(re.is_valid());
Ref<RegExMatch> match = re.search(s);
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_string(0) == "ea");
match = re.search(s, 1, 2);
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_string(0) == "e");
match = re.search(s, 2, 4);
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_string(0) == "a");
match = re.search(s, 3, 5);
- CHECK(match == nullptr);
+ CHECK(match.is_null());
match = re.search(s, 6, 2);
- CHECK(match == nullptr);
+ CHECK(match.is_null());
const Array all_results = re.search_all(s);
CHECK(all_results.size() == 2);
match = all_results[0];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_string(0) == "ea");
match = all_results[1];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_string(0) == "i");
CHECK(re.compile(numerics) == OK);
CHECK(re.is_valid());
- CHECK(re.search(s) == nullptr);
+ CHECK(re.search(s).is_null());
CHECK(re.search_all(s).size() == 0);
}
@@ -168,7 +168,7 @@ TEST_CASE("[RegEx] Uninitialized use") {
RegEx re;
ERR_PRINT_OFF;
- CHECK(re.search(s) == nullptr);
+ CHECK(re.search(s).is_null());
CHECK(re.search_all(s).size() == 0);
CHECK(re.sub(s, "") == "");
CHECK(re.get_group_count() == 0);
@@ -237,10 +237,10 @@ TEST_CASE("[RegEx] Invalid end position") {
const Array all_results = re.search_all(s, 0, 10);
CHECK(all_results.size() == 2);
match = all_results[0];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_string(0) == String("o"));
match = all_results[1];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_string(0) == String("o"));
CHECK(re.sub(s, "", true, 0, 10) == "Gdt");
@@ -251,7 +251,7 @@ TEST_CASE("[RegEx] Get match string list") {
RegEx re("(Go)(dot)");
Ref<RegExMatch> match = re.search(s);
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
PackedStringArray result;
result.append("Godot");
result.append("Go");
@@ -265,14 +265,14 @@ TEST_CASE("[RegEx] Match start and end positions") {
RegEx re1("pattern");
REQUIRE(re1.is_valid());
Ref<RegExMatch> match = re1.search(s);
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start(0) == 6);
CHECK(match->get_end(0) == 13);
RegEx re2("(?<vowel>[aeiou])");
REQUIRE(re2.is_valid());
match = re2.search(s);
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start("vowel") == 2);
CHECK(match->get_end("vowel") == 3);
}
@@ -307,7 +307,7 @@ TEST_CASE("[RegEx] Simple lookahead") {
RegEx re("o(?=t)");
REQUIRE(re.is_valid());
Ref<RegExMatch> match = re.search(s);
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start(0) == 3);
CHECK(match->get_end(0) == 4);
}
@@ -325,12 +325,12 @@ TEST_CASE("[RegEx] Lookahead groups empty matches") {
CHECK(all_results.size() == 2);
match = all_results[0];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_string(0) == String(""));
CHECK(match->get_string(1) == String("12"));
match = all_results[1];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_string(0) == String(""));
CHECK(match->get_string(1) == String("2"));
}
@@ -341,7 +341,7 @@ TEST_CASE("[RegEx] Simple lookbehind") {
RegEx re("(?<=d)o");
REQUIRE(re.is_valid());
Ref<RegExMatch> match = re.search(s);
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start(0) == 3);
CHECK(match->get_end(0) == 4);
}
@@ -355,22 +355,22 @@ TEST_CASE("[RegEx] Simple lookbehind search all") {
CHECK(all_results.size() == 4);
Ref<RegExMatch> match = all_results[0];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start(0) == 1);
CHECK(match->get_end(0) == 2);
match = all_results[1];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start(0) == 3);
CHECK(match->get_end(0) == 4);
match = all_results[2];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start(0) == 7);
CHECK(match->get_end(0) == 8);
match = all_results[3];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start(0) == 9);
CHECK(match->get_end(0) == 10);
}
@@ -386,7 +386,7 @@ TEST_CASE("[RegEx] Lookbehind groups empty matches") {
CHECK(all_results.size() == 3);
match = all_results[0];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start(0) == 2);
CHECK(match->get_end(0) == 2);
CHECK(match->get_start(1) == 1);
@@ -395,7 +395,7 @@ TEST_CASE("[RegEx] Lookbehind groups empty matches") {
CHECK(match->get_string(1) == String("b"));
match = all_results[1];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start(0) == 6);
CHECK(match->get_end(0) == 6);
CHECK(match->get_start(1) == 5);
@@ -404,7 +404,7 @@ TEST_CASE("[RegEx] Lookbehind groups empty matches") {
CHECK(match->get_string(1) == String("b"));
match = all_results[2];
- REQUIRE(match != nullptr);
+ REQUIRE(match.is_valid());
CHECK(match->get_start(0) == 8);
CHECK(match->get_end(0) == 8);
CHECK(match->get_start(1) == 7);
diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp
index 70f0ea346b..6bdb261b50 100644
--- a/modules/upnp/upnp.cpp
+++ b/modules/upnp/upnp.cpp
@@ -229,14 +229,14 @@ Ref<UPNPDevice> UPNP::get_device(int index) const {
}
void UPNP::add_device(Ref<UPNPDevice> device) {
- ERR_FAIL_NULL(device);
+ ERR_FAIL_COND(device.is_null());
devices.push_back(device);
}
void UPNP::set_device(int index, Ref<UPNPDevice> device) {
ERR_FAIL_INDEX(index, devices.size());
- ERR_FAIL_NULL(device);
+ ERR_FAIL_COND(device.is_null());
devices.set(index, device);
}
@@ -257,7 +257,7 @@ Ref<UPNPDevice> UPNP::get_gateway() const {
for (int i = 0; i < devices.size(); i++) {
Ref<UPNPDevice> dev = get_device(i);
- if (dev != nullptr && dev->is_valid_gateway()) {
+ if (dev.is_valid() && dev->is_valid_gateway()) {
return dev;
}
}
@@ -292,7 +292,7 @@ bool UPNP::is_discover_ipv6() const {
String UPNP::query_external_address() const {
Ref<UPNPDevice> dev = get_gateway();
- if (dev == nullptr) {
+ if (dev.is_null()) {
return "";
}
@@ -302,7 +302,7 @@ String UPNP::query_external_address() const {
int UPNP::add_port_mapping(int port, int port_internal, String desc, String proto, int duration) const {
Ref<UPNPDevice> dev = get_gateway();
- if (dev == nullptr) {
+ if (dev.is_null()) {
return UPNP_RESULT_NO_GATEWAY;
}
@@ -312,7 +312,7 @@ int UPNP::add_port_mapping(int port, int port_internal, String desc, String prot
int UPNP::delete_port_mapping(int port, String proto) const {
Ref<UPNPDevice> dev = get_gateway();
- if (dev == nullptr) {
+ if (dev.is_null()) {
return UPNP_RESULT_NO_GATEWAY;
}
diff --git a/modules/zip/zip_packer.cpp b/modules/zip/zip_packer.cpp
index e96d9da7a9..4e182f9787 100644
--- a/modules/zip/zip_packer.cpp
+++ b/modules/zip/zip_packer.cpp
@@ -48,7 +48,7 @@ Error ZIPPacker::close() {
Error err = zipClose(zf, nullptr) == ZIP_OK ? OK : FAILED;
if (err == OK) {
- DEV_ASSERT(fa == nullptr);
+ DEV_ASSERT(fa.is_null());
zf = nullptr;
}
diff --git a/modules/zip/zip_reader.cpp b/modules/zip/zip_reader.cpp
index 123d1e5d46..76f48edb69 100644
--- a/modules/zip/zip_reader.cpp
+++ b/modules/zip/zip_reader.cpp
@@ -48,7 +48,7 @@ Error ZIPReader::close() {
Error err = unzClose(uzf) == UNZ_OK ? OK : FAILED;
if (err == OK) {
- DEV_ASSERT(fa == nullptr);
+ DEV_ASSERT(fa.is_null());
uzf = nullptr;
}