diff options
Diffstat (limited to 'scene/resources')
28 files changed, 169 insertions, 184 deletions
diff --git a/scene/resources/animation.h b/scene/resources/animation.h index 36d5df52df..e4e5177a8c 100644 --- a/scene/resources/animation.h +++ b/scene/resources/animation.h @@ -84,7 +84,10 @@ private: float transition; float time; // time in secs - Key() { transition = 1; } + Key() { + transition = 1; + time = 0; + } }; // transform key holds either Vector3 or Quaternion diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 06b65e4b4a..d630a1f3ee 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -482,7 +482,7 @@ void AudioStreamSample::set_data(const Vector<uint8_t> &p_data) { AudioServer::get_singleton()->lock(); if (data) { memfree(data); - data = NULL; + data = nullptr; data_bytes = 0; } @@ -654,14 +654,14 @@ AudioStreamSample::AudioStreamSample() { loop_begin = 0; loop_end = 0; mix_rate = 44100; - data = NULL; + data = nullptr; data_bytes = 0; } AudioStreamSample::~AudioStreamSample() { if (data) { memfree(data); - data = NULL; + data = nullptr; data_bytes = 0; } } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 0c45779307..e6f09eb034 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -890,9 +890,9 @@ void make_default_theme(bool p_hidpi, Ref<Font> p_font) { void clear_default_theme() { - Theme::set_project_default(NULL); - Theme::set_default(NULL); - Theme::set_default_icon(NULL); - Theme::set_default_style(NULL); - Theme::set_default_font(NULL); + Theme::set_project_default(nullptr); + Theme::set_default(nullptr); + Theme::set_default_icon(nullptr); + Theme::set_default_style(nullptr); + Theme::set_default_font(nullptr); } diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 107f07ec7d..a613b01376 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -107,7 +107,7 @@ DynamicFontData::DynamicFontData() { antialiased = true; force_autohinter = false; hinting = DynamicFontData::HINTING_NORMAL; - font_mem = NULL; + font_mem = nullptr; font_mem_size = 0; } @@ -124,7 +124,7 @@ Error DynamicFontAtSize::_load() { ERR_FAIL_COND_V_MSG(error != 0, ERR_CANT_CREATE, "Error initializing FreeType."); // FT_OPEN_STREAM is extremely slow only on Android. - if (OS::get_singleton()->get_name() == "Android" && font->font_mem == NULL && font->font_path != String()) { + if (OS::get_singleton()->get_name() == "Android" && font->font_mem == nullptr && font->font_path != String()) { // cache font only once for each font->font_path if (_fontdata.has(font->font_path)) { @@ -148,7 +148,7 @@ Error DynamicFontAtSize::_load() { } } - if (font->font_mem == NULL && font->font_path != String()) { + if (font->font_mem == nullptr && font->font_path != String()) { FileAccess *f = FileAccess::open(font->font_path, FileAccess::READ); if (!f) { @@ -157,7 +157,7 @@ Error DynamicFontAtSize::_load() { } memset(&stream, 0, sizeof(FT_StreamRec)); - stream.base = NULL; + stream.base = nullptr; stream.size = f->get_len(); stream.pos = 0; stream.descriptor.pointer = f; @@ -245,7 +245,7 @@ float DynamicFontAtSize::get_descent() const { const Pair<const DynamicFontAtSize::Character *, DynamicFontAtSize *> DynamicFontAtSize::_find_char_with_font(CharType p_char, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks) const { const Character *chr = char_map.getptr(p_char); - ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(NULL, NULL))); + ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(nullptr, nullptr))); if (!chr->found) { @@ -269,7 +269,7 @@ const Pair<const DynamicFontAtSize::Character *, DynamicFontAtSize *> DynamicFon //not found, try 0xFFFD to display 'not found'. const_cast<DynamicFontAtSize *>(this)->_update_char(0xFFFD); chr = char_map.getptr(0xFFFD); - ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(NULL, NULL))); + ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(nullptr, nullptr))); } return Pair<const Character *, DynamicFontAtSize *>(chr, const_cast<DynamicFontAtSize *>(this)); @@ -565,7 +565,7 @@ DynamicFontAtSize::Character DynamicFontAtSize::_make_outline_char(CharType p_ch goto cleanup_stroker; if (FT_Glyph_Stroke(&glyph, stroker, 1) != 0) goto cleanup_glyph; - if (FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 1) != 0) + if (FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, nullptr, 1) != 0) goto cleanup_glyph; glyph_bitmap = (FT_BitmapGlyph)glyph; @@ -992,11 +992,12 @@ void DynamicFont::_bind_methods() { Mutex DynamicFont::dynamic_font_mutex; -SelfList<DynamicFont>::List *DynamicFont::dynamic_fonts = NULL; +SelfList<DynamicFont>::List *DynamicFont::dynamic_fonts = nullptr; DynamicFont::DynamicFont() : font_list(this) { + valid = false; cache_id.size = 16; outline_cache_id.size = 16; spacing_top = 0; @@ -1020,7 +1021,7 @@ void DynamicFont::initialize_dynamic_fonts() { void DynamicFont::finish_dynamic_fonts() { memdelete(dynamic_fonts); - dynamic_fonts = NULL; + dynamic_fonts = nullptr; } void DynamicFont::update_oversampling() { diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 88b1df039e..9e628fc35a 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -302,7 +302,7 @@ VARIANT_ENUM_CAST(DynamicFont::SpacingType); class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 6fa52e6f05..835fef81e1 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -345,7 +345,7 @@ void Environment::_validate_property(PropertyInfo &property) const { "ssao_", "glow_", "adjustment_", - NULL + nullptr }; @@ -354,7 +354,7 @@ void Environment::_validate_property(PropertyInfo &property) const { "tonemap_", "ss_reflections_", "ssao_", - NULL + nullptr }; @@ -389,7 +389,7 @@ void Environment::_validate_property(PropertyInfo &property) const { void Environment::set_ssr_enabled(bool p_enable) { ssr_enabled = p_enable; - RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance); _change_notify(); } @@ -401,7 +401,7 @@ bool Environment::is_ssr_enabled() const { void Environment::set_ssr_max_steps(int p_steps) { ssr_max_steps = p_steps; - RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance); } int Environment::get_ssr_max_steps() const { @@ -411,7 +411,7 @@ int Environment::get_ssr_max_steps() const { void Environment::set_ssr_fade_in(float p_fade_in) { ssr_fade_in = p_fade_in; - RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance); } float Environment::get_ssr_fade_in() const { @@ -421,7 +421,7 @@ float Environment::get_ssr_fade_in() const { void Environment::set_ssr_fade_out(float p_fade_out) { ssr_fade_out = p_fade_out; - RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance); } float Environment::get_ssr_fade_out() const { @@ -431,23 +431,13 @@ float Environment::get_ssr_fade_out() const { void Environment::set_ssr_depth_tolerance(float p_depth_tolerance) { ssr_depth_tolerance = p_depth_tolerance; - RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance); } float Environment::get_ssr_depth_tolerance() const { return ssr_depth_tolerance; } -void Environment::set_ssr_rough(bool p_enable) { - - ssr_roughness = p_enable; - RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); -} -bool Environment::is_ssr_rough() const { - - return ssr_roughness; -} - void Environment::set_ssao_enabled(bool p_enable) { ssao_enabled = p_enable; @@ -981,16 +971,12 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_ssr_depth_tolerance", "depth_tolerance"), &Environment::set_ssr_depth_tolerance); ClassDB::bind_method(D_METHOD("get_ssr_depth_tolerance"), &Environment::get_ssr_depth_tolerance); - ClassDB::bind_method(D_METHOD("set_ssr_rough", "rough"), &Environment::set_ssr_rough); - ClassDB::bind_method(D_METHOD("is_ssr_rough"), &Environment::is_ssr_rough); - ADD_GROUP("SS Reflections", "ss_reflections_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ss_reflections_enabled"), "set_ssr_enabled", "is_ssr_enabled"); ADD_PROPERTY(PropertyInfo(Variant::INT, "ss_reflections_max_steps", PROPERTY_HINT_RANGE, "1,512,1"), "set_ssr_max_steps", "get_ssr_max_steps"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ss_reflections_fade_in", PROPERTY_HINT_EXP_EASING), "set_ssr_fade_in", "get_ssr_fade_in"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ss_reflections_fade_out", PROPERTY_HINT_EXP_EASING), "set_ssr_fade_out", "get_ssr_fade_out"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ss_reflections_depth_tolerance", PROPERTY_HINT_RANGE, "0.1,128,0.1"), "set_ssr_depth_tolerance", "get_ssr_depth_tolerance"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ss_reflections_roughness"), "set_ssr_rough", "is_ssr_rough"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ss_reflections_depth_tolerance", PROPERTY_HINT_RANGE, "0.01,128,0.1"), "set_ssr_depth_tolerance", "get_ssr_depth_tolerance"); ClassDB::bind_method(D_METHOD("set_ssao_enabled", "enabled"), &Environment::set_ssao_enabled); ClassDB::bind_method(D_METHOD("is_ssao_enabled"), &Environment::is_ssao_enabled); @@ -1173,7 +1159,6 @@ Environment::Environment() : ssr_fade_in = 0.15; ssr_fade_out = 2.0; ssr_depth_tolerance = 0.2; - ssr_roughness = true; ssao_enabled = false; ssao_radius = 1; diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 83f9a3f509..02434bc592 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -125,7 +125,6 @@ private: float ssr_fade_in; float ssr_fade_out; float ssr_depth_tolerance; - bool ssr_roughness; bool ssao_enabled; float ssao_radius; @@ -257,9 +256,6 @@ public: void set_ssr_depth_tolerance(float p_depth_tolerance); float get_ssr_depth_tolerance() const; - void set_ssr_rough(bool p_enable); - bool is_ssr_rough() const; - void set_ssao_enabled(bool p_enable); bool is_ssao_enabled() const; diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 8914cf8097..192eefbf6a 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -128,7 +128,7 @@ Vector<int> BitmapFont::_get_chars() const { Vector<int> chars; - const CharType *key = NULL; + const CharType *key = nullptr; while ((key = char_map.next(key))) { @@ -382,7 +382,7 @@ Vector<CharType> BitmapFont::get_char_keys() const { Vector<CharType> chars; chars.resize(char_map.size()); - const CharType *ct = NULL; + const CharType *ct = nullptr; int count = 0; while ((ct = char_map.next(ct))) { @@ -528,7 +528,7 @@ Size2 Font::get_wordwrap_string_size(const String &p_string, float p_width) cons void BitmapFont::set_fallback(const Ref<BitmapFont> &p_fallback) { - for (Ref<BitmapFont> fallback_child = p_fallback; fallback_child != NULL; fallback_child = fallback_child->get_fallback()) { + for (Ref<BitmapFont> fallback_child = p_fallback; fallback_child != nullptr; fallback_child = fallback_child->get_fallback()) { ERR_FAIL_COND_MSG(fallback_child == this, "Can't set as fallback one of its parents to prevent crashes due to recursive loop."); } diff --git a/scene/resources/font.h b/scene/resources/font.h index 076532f390..ce75f27e2a 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -200,7 +200,7 @@ public: class ResourceFormatLoaderBMFont : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index f52b755ed3..84c1c9d734 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -40,7 +40,7 @@ void Material::set_next_pass(const Ref<Material> &p_pass) { - for (Ref<Material> pass_child = p_pass; pass_child != NULL; pass_child = pass_child->get_next_pass()) { + for (Ref<Material> pass_child = p_pass; pass_child != nullptr; pass_child = pass_child->get_next_pass()) { ERR_FAIL_COND_MSG(pass_child == this, "Can't set as next_pass one of its parents to prevent crashes due to recursive loop."); } @@ -290,9 +290,9 @@ ShaderMaterial::~ShaderMaterial() { ///////////////////////////////// Mutex BaseMaterial3D::material_mutex; -SelfList<BaseMaterial3D>::List *BaseMaterial3D::dirty_materials = NULL; +SelfList<BaseMaterial3D>::List *BaseMaterial3D::dirty_materials = nullptr; Map<BaseMaterial3D::MaterialKey, BaseMaterial3D::ShaderData> BaseMaterial3D::shader_map; -BaseMaterial3D::ShaderNames *BaseMaterial3D::shader_names = NULL; +BaseMaterial3D::ShaderNames *BaseMaterial3D::shader_names = nullptr; void BaseMaterial3D::init_shaders() { @@ -375,7 +375,7 @@ void BaseMaterial3D::finish_shaders() { } memdelete(dirty_materials); - dirty_materials = NULL; + dirty_materials = nullptr; memdelete(shader_names); } @@ -2641,7 +2641,7 @@ bool StandardMaterial3D::_set(const StringName &p_name, const Variant &p_value) { "depth_flip_binormal", "heightmap_flip_binormal" }, { "depth_texture", "heightmap_texture" }, - { NULL, NULL }, + { nullptr, nullptr }, }; int idx = 0; diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index b37b7f9751..6bb5be15f3 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -37,7 +37,7 @@ #include <stdlib.h> -Mesh::ConvexDecompositionFunc Mesh::convex_composition_function = NULL; +Mesh::ConvexDecompositionFunc Mesh::convex_composition_function = nullptr; Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { @@ -372,7 +372,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { ERR_FAIL_COND_V(arrays.size() != ARRAY_MAX, Ref<ArrayMesh>()); { - int *ir = NULL; + int *ir = nullptr; Vector<int> indices = arrays[ARRAY_INDEX]; bool has_indices = false; Vector<Vector3> vertices = arrays[ARRAY_VERTEX]; @@ -1359,7 +1359,7 @@ void ArrayMesh::regen_normalmaps() { } //dirty hack -bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) = NULL; +bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) = nullptr; struct ArrayMeshLightmapSurface { diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index 8b7f8288b8..76d96786bc 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -58,30 +58,30 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf const Vector3 *vr = varray.ptr(); - const Vector3 *nr = NULL; + const Vector3 *nr = nullptr; if (arrays[Mesh::ARRAY_NORMAL].get_type() != Variant::NIL) nr = arrays[Mesh::ARRAY_NORMAL].operator Vector<Vector3>().ptr(); - const real_t *ta = NULL; + const real_t *ta = nullptr; if (arrays[Mesh::ARRAY_TANGENT].get_type() != Variant::NIL) ta = arrays[Mesh::ARRAY_TANGENT].operator Vector<real_t>().ptr(); - const Vector2 *uv = NULL; + const Vector2 *uv = nullptr; if (arrays[Mesh::ARRAY_TEX_UV].get_type() != Variant::NIL) uv = arrays[Mesh::ARRAY_TEX_UV].operator Vector<Vector2>().ptr(); - const Vector2 *uv2 = NULL; + const Vector2 *uv2 = nullptr; if (arrays[Mesh::ARRAY_TEX_UV2].get_type() != Variant::NIL) uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator Vector<Vector2>().ptr(); - const Color *col = NULL; + const Color *col = nullptr; if (arrays[Mesh::ARRAY_COLOR].get_type() != Variant::NIL) col = arrays[Mesh::ARRAY_COLOR].operator Vector<Color>().ptr(); - const int *bo = NULL; + const int *bo = nullptr; if (arrays[Mesh::ARRAY_BONES].get_type() != Variant::NIL) bo = arrays[Mesh::ARRAY_BONES].operator Vector<int>().ptr(); - const real_t *we = NULL; + const real_t *we = nullptr; if (arrays[Mesh::ARRAY_WEIGHTS].get_type() != Variant::NIL) we = arrays[Mesh::ARRAY_WEIGHTS].operator Vector<real_t>().ptr(); @@ -202,43 +202,43 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) { v.resize(vcount); Vector3 *vr = v.ptrw(); - Vector3 *nr = NULL; + Vector3 *nr = nullptr; if (format & Mesh::ARRAY_FORMAT_NORMAL) { n.resize(vcount); nr = n.ptrw(); } - real_t *ta = NULL; + real_t *ta = nullptr; if (format & Mesh::ARRAY_FORMAT_TANGENT) { t.resize(vcount * 4); ta = t.ptrw(); } - Vector2 *uv = NULL; + Vector2 *uv = nullptr; if (format & Mesh::ARRAY_FORMAT_TEX_UV) { u.resize(vcount); uv = u.ptrw(); } - Vector2 *uv2 = NULL; + Vector2 *uv2 = nullptr; if (format & Mesh::ARRAY_FORMAT_TEX_UV2) { u2.resize(vcount); uv2 = u2.ptrw(); } - Color *col = NULL; + Color *col = nullptr; if (format & Mesh::ARRAY_FORMAT_COLOR) { c.resize(vcount); col = c.ptrw(); } - int *bo = NULL; + int *bo = nullptr; if (format & Mesh::ARRAY_FORMAT_BONES) { b.resize(vcount * 4); bo = b.ptrw(); } - real_t *we = NULL; + real_t *we = nullptr; if (format & Mesh::ARRAY_FORMAT_WEIGHTS) { w.resize(vcount * 4); we = w.ptrw(); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 549c29a7f3..633771506e 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -51,25 +51,25 @@ Node *SceneState::instance(GenEditState p_edit_state) const { // nodes where instancing failed (because something is missing) List<Node *> stray_instances; -#define NODE_FROM_ID(p_name, p_id) \ - Node *p_name; \ - if (p_id & FLAG_ID_IS_PATH) { \ - NodePath np = node_paths[p_id & FLAG_MASK]; \ - p_name = ret_nodes[0]->get_node_or_null(np); \ - } else { \ - ERR_FAIL_INDEX_V(p_id &FLAG_MASK, nc, NULL); \ - p_name = ret_nodes[p_id & FLAG_MASK]; \ +#define NODE_FROM_ID(p_name, p_id) \ + Node *p_name; \ + if (p_id & FLAG_ID_IS_PATH) { \ + NodePath np = node_paths[p_id & FLAG_MASK]; \ + p_name = ret_nodes[0]->get_node_or_null(np); \ + } else { \ + ERR_FAIL_INDEX_V(p_id &FLAG_MASK, nc, nullptr); \ + p_name = ret_nodes[p_id & FLAG_MASK]; \ } int nc = nodes.size(); - ERR_FAIL_COND_V(nc == 0, NULL); + ERR_FAIL_COND_V(nc == 0, nullptr); - const StringName *snames = NULL; + const StringName *snames = nullptr; int sname_count = names.size(); if (sname_count) snames = &names[0]; - const Variant *props = NULL; + const Variant *props = nullptr; int prop_count = variants.size(); if (prop_count) props = &variants[0]; @@ -88,11 +88,11 @@ Node *SceneState::instance(GenEditState p_edit_state) const { const NodeData &n = nd[i]; - Node *parent = NULL; + Node *parent = nullptr; if (i > 0) { - ERR_FAIL_COND_V_MSG(n.parent == -1, NULL, vformat("Invalid scene: node %s does not specify its parent node.", snames[n.name])); + ERR_FAIL_COND_V_MSG(n.parent == -1, nullptr, vformat("Invalid scene: node %s does not specify its parent node.", snames[n.name])); NODE_FROM_ID(nparent, n.parent); #ifdef DEBUG_ENABLED if (!nparent && (n.parent & FLAG_ID_IS_PATH)) { @@ -103,14 +103,14 @@ Node *SceneState::instance(GenEditState p_edit_state) const { parent = nparent; } - Node *node = NULL; + Node *node = nullptr; if (i == 0 && base_scene_idx >= 0) { //scene inheritance on root node Ref<PackedScene> sdata = props[base_scene_idx]; - ERR_FAIL_COND_V(!sdata.is_valid(), NULL); + ERR_FAIL_COND_V(!sdata.is_valid(), nullptr); node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); //only main gets main edit state - ERR_FAIL_COND_V(!node, NULL); + ERR_FAIL_COND_V(!node, nullptr); if (p_edit_state != GEN_EDIT_STATE_DISABLED) { node->set_scene_inherited_state(sdata->get_state()); } @@ -123,9 +123,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const { if (disable_placeholders) { Ref<PackedScene> sdata = ResourceLoader::load(path, "PackedScene"); - ERR_FAIL_COND_V(!sdata.is_valid(), NULL); + ERR_FAIL_COND_V(!sdata.is_valid(), nullptr); node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); - ERR_FAIL_COND_V(!node, NULL); + ERR_FAIL_COND_V(!node, nullptr); } else { InstancePlaceholder *ip = memnew(InstancePlaceholder); ip->set_instance_path(path); @@ -134,9 +134,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const { node->set_scene_instance_load_placeholder(true); } else { Ref<PackedScene> sdata = props[n.instance & FLAG_MASK]; - ERR_FAIL_COND_V(!sdata.is_valid(), NULL); + ERR_FAIL_COND_V(!sdata.is_valid(), nullptr); node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); - ERR_FAIL_COND_V(!node, NULL); + ERR_FAIL_COND_V(!node, nullptr); } } else if (n.type == TYPE_INSTANCED) { @@ -155,7 +155,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { if (!Object::cast_to<Node>(obj)) { if (obj) { memdelete(obj); - obj = NULL; + obj = nullptr; } WARN_PRINT(String("Warning node of type " + snames[n.type].operator String() + " does not exist.").ascii().get_data()); if (n.parent >= 0 && n.parent < nc && ret_nodes[n.parent]) { @@ -193,8 +193,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const { for (int j = 0; j < nprop_count; j++) { bool valid; - ERR_FAIL_INDEX_V(nprops[j].name, sname_count, NULL); - ERR_FAIL_INDEX_V(nprops[j].value, prop_count, NULL); + ERR_FAIL_INDEX_V(nprops[j].name, sname_count, nullptr); + ERR_FAIL_INDEX_V(nprops[j].value, prop_count, nullptr); if (snames[nprops[j].name] == CoreStringNames::get_singleton()->_script) { //work around to avoid old script variables from disappearing, should be the proper fix to: @@ -260,7 +260,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { //groups for (int j = 0; j < n.groups.size(); j++) { - ERR_FAIL_INDEX_V(n.groups[j], sname_count, NULL); + ERR_FAIL_INDEX_V(n.groups[j], sname_count, nullptr); node->add_to_group(snames[n.groups[j]], true); } @@ -315,8 +315,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const { for (int i = 0; i < cc; i++) { const ConnectionData &c = cdata[i]; - //ERR_FAIL_INDEX_V( c.from, nc, NULL ); - //ERR_FAIL_INDEX_V( c.to, nc, NULL ); + //ERR_FAIL_INDEX_V( c.from, nc, nullptr ); + //ERR_FAIL_INDEX_V( c.to, nc, nullptr ); NODE_FROM_ID(cfrom, c.from); NODE_FROM_ID(cto, c.to); @@ -450,7 +450,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map nd.instance = _vm_get_variant(instance, variant_map); } } - n = NULL; + n = nullptr; } else { if (n->get_filename() != String()) { //is an instance @@ -773,7 +773,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName } } - nl = NULL; + nl = nullptr; } else { if (nl->get_filename() != String()) { //is an instance @@ -896,7 +896,7 @@ Error SceneState::pack(Node *p_scene) { } variants.resize(variant_map.size()); - const Variant *K = NULL; + const Variant *K = nullptr; while ((K = variant_map.next(K))) { int idx = variant_map[*K]; @@ -1689,12 +1689,12 @@ bool PackedScene::can_instance() const { Node *PackedScene::instance(GenEditState p_edit_state) const { #ifndef TOOLS_ENABLED - ERR_FAIL_COND_V_MSG(p_edit_state != GEN_EDIT_STATE_DISABLED, NULL, "Edit state is only for editors, does not work without tools compiled."); + ERR_FAIL_COND_V_MSG(p_edit_state != GEN_EDIT_STATE_DISABLED, nullptr, "Edit state is only for editors, does not work without tools compiled."); #endif Node *s = state->instance((SceneState::GenEditState)p_edit_state); if (!s) - return NULL; + return nullptr; if (p_edit_state != GEN_EDIT_STATE_DISABLED) { s->set_scene_instance_state(state); diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp index 63766c1756..83430aef9e 100644 --- a/scene/resources/particles_material.cpp +++ b/scene/resources/particles_material.cpp @@ -31,9 +31,9 @@ #include "particles_material.h" Mutex ParticlesMaterial::material_mutex; -SelfList<ParticlesMaterial>::List *ParticlesMaterial::dirty_materials = NULL; +SelfList<ParticlesMaterial>::List *ParticlesMaterial::dirty_materials = nullptr; Map<ParticlesMaterial::MaterialKey, ParticlesMaterial::ShaderData> ParticlesMaterial::shader_map; -ParticlesMaterial::ShaderNames *ParticlesMaterial::shader_names = NULL; +ParticlesMaterial::ShaderNames *ParticlesMaterial::shader_names = nullptr; void ParticlesMaterial::init_shaders() { @@ -104,7 +104,7 @@ void ParticlesMaterial::init_shaders() { void ParticlesMaterial::finish_shaders() { memdelete(dirty_materials); - dirty_materials = NULL; + dirty_materials = nullptr; memdelete(shader_names); } diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp index eff0721cef..c3daedf918 100644 --- a/scene/resources/polygon_path_finder.cpp +++ b/scene/resources/polygon_path_finder.cpp @@ -42,7 +42,7 @@ bool PolygonPathFinder::_is_point_inside(const Vector2 &p_point) const { Vector2 a = points[e.points[0]].pos; Vector2 b = points[e.points[1]].pos; - if (Geometry::segment_intersects_segment_2d(a, b, p_point, outside_point, NULL)) { + if (Geometry::segment_intersects_segment_2d(a, b, p_point, outside_point, nullptr)) { crosses++; } } @@ -119,7 +119,7 @@ void PolygonPathFinder::setup(const Vector<Vector2> &p_points, const Vector<int> Vector2 a = points[e.points[0]].pos; Vector2 b = points[e.points[1]].pos; - if (Geometry::segment_intersects_segment_2d(a, b, from, to, NULL)) { + if (Geometry::segment_intersects_segment_2d(a, b, from, to, nullptr)) { valid = false; break; } @@ -209,7 +209,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector Vector2 a = points[e.points[0]].pos; Vector2 b = points[e.points[1]].pos; - if (Geometry::segment_intersects_segment_2d(a, b, from, to, NULL)) { + if (Geometry::segment_intersects_segment_2d(a, b, from, to, nullptr)) { can_see_eachother = false; break; } @@ -268,7 +268,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector e.points[0] != ignore_from_edge.points[0] && e.points[1] != ignore_from_edge.points[0]) { - if (Geometry::segment_intersects_segment_2d(a, b, from, points[i].pos, NULL)) { + if (Geometry::segment_intersects_segment_2d(a, b, from, points[i].pos, nullptr)) { valid_a = false; } } @@ -281,7 +281,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector e.points[0] != ignore_to_edge.points[0] && e.points[1] != ignore_to_edge.points[0]) { - if (Geometry::segment_intersects_segment_2d(a, b, to, points[i].pos, NULL)) { + if (Geometry::segment_intersects_segment_2d(a, b, to, points[i].pos, nullptr)) { valid_b = false; } } diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 0792af2143..46e8575018 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -164,7 +164,7 @@ void PrimitiveMesh::surface_set_material(int p_idx, const Ref<Material> &p_mater } Ref<Material> PrimitiveMesh::surface_get_material(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx, 1, NULL); + ERR_FAIL_INDEX_V(p_idx, 1, nullptr); return material; } diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 238bdf05ef..5068bb548f 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -795,7 +795,7 @@ Error ResourceLoaderText::rename_dependencies(FileAccess *p_f, const String &p_p ignore_resource_parsing = true; //FileAccess - FileAccess *fw = NULL; + FileAccess *fw = nullptr; String base_path = local_path.get_base_dir(); @@ -961,7 +961,7 @@ void ResourceLoaderText::open(FileAccess *p_f, bool p_skip_first_tag) { rp.ext_func = _parse_ext_resources; rp.sub_func = _parse_sub_resources; - rp.func = NULL; + rp.func = nullptr; rp.userdata = this; } @@ -1392,7 +1392,7 @@ Error ResourceFormatLoaderText::rename_dependencies(const String &p_path, const return loader.rename_dependencies(f, p_path, p_map); } -ResourceFormatLoaderText *ResourceFormatLoaderText::singleton = NULL; +ResourceFormatLoaderText *ResourceFormatLoaderText::singleton = nullptr; Error ResourceFormatLoaderText::convert_file_to_binary(const String &p_src_path, const String &p_dst_path) { @@ -1674,7 +1674,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r RES res = E->get(); ERR_CONTINUE(!resource_set.has(res)); - bool main = (E->next() == NULL); + bool main = (E->next() == nullptr); if (main && packed_scene.is_valid()) break; //save as a scene @@ -1880,7 +1880,7 @@ void ResourceFormatSaverText::get_recognized_extensions(const RES &p_resource, L p_extensions->push_back("tres"); //text resource } -ResourceFormatSaverText *ResourceFormatSaverText::singleton = NULL; +ResourceFormatSaverText *ResourceFormatSaverText::singleton = nullptr; ResourceFormatSaverText::ResourceFormatSaverText() { singleton = this; } diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h index 2425ac7f6c..fbbd2e3346 100644 --- a/scene/resources/resource_format_text.h +++ b/scene/resources/resource_format_text.h @@ -134,7 +134,7 @@ public: class ResourceFormatLoaderText : public ResourceFormatLoader { public: static ResourceFormatLoaderText *singleton; - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const; virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; diff --git a/scene/resources/shader.h b/scene/resources/shader.h index e65457ed76..cf0cec362c 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -84,7 +84,7 @@ public: _FORCE_INLINE_ StringName remap_param(const StringName &p_param) const { if (params_cache_dirty) - get_param_list(NULL); + get_param_list(nullptr); const Map<StringName, StringName>::Element *E = params_cache.find(p_param); if (E) @@ -102,7 +102,7 @@ VARIANT_ENUM_CAST(Shader::Mode); class ResourceFormatLoaderShader : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/shape_2d.cpp b/scene/resources/shape_2d.cpp index 7984dadbc5..4fe585053a 100644 --- a/scene/resources/shape_2d.cpp +++ b/scene/resources/shape_2d.cpp @@ -50,13 +50,13 @@ bool Shape2D::collide_with_motion(const Transform2D &p_local_xform, const Vector ERR_FAIL_COND_V(p_shape.is_null(), false); int r; - return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, p_local_motion, p_shape->get_rid(), p_shape_xform, p_shape_motion, NULL, 0, r); + return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, p_local_motion, p_shape->get_rid(), p_shape_xform, p_shape_motion, nullptr, 0, r); } bool Shape2D::collide(const Transform2D &p_local_xform, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform) { ERR_FAIL_COND_V(p_shape.is_null(), false); int r; - return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, Vector2(), p_shape->get_rid(), p_shape_xform, Vector2(), NULL, 0, r); + return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, Vector2(), p_shape->get_rid(), p_shape_xform, Vector2(), nullptr, 0, r); } Array Shape2D::collide_with_motion_and_get_contacts(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_shape_motion) { diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index fee6bd1b54..4b392e23b7 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -854,7 +854,7 @@ void SurfaceTool::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, cons const tbool bIsOrientationPreserving, const int iFace, const int iVert) { TangentGenerationContextUserData &triangle_data = *reinterpret_cast<TangentGenerationContextUserData *>(pContext->m_pUserData); - Vertex *vtx = NULL; + Vertex *vtx = nullptr; if (triangle_data.indices.size() > 0) { int index = triangle_data.indices[iFace * 3 + iVert]->get(); if (index < triangle_data.vertices.size()) { @@ -864,7 +864,7 @@ void SurfaceTool::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, cons vtx = &triangle_data.vertices[iFace * 3 + iVert]->get(); } - if (vtx != NULL) { + if (vtx != nullptr) { vtx->tangent = Vector3(fvTangent[0], fvTangent[1], fvTangent[2]); vtx->binormal = Vector3(-fvBiTangent[0], -fvBiTangent[1], -fvBiTangent[2]); // for some reason these are reversed, something with the coordinate system in Godot } @@ -882,7 +882,7 @@ void SurfaceTool::generate_tangents() { mkif.m_getPosition = mikktGetPosition; mkif.m_getTexCoord = mikktGetTexCoord; mkif.m_setTSpace = mikktSetTSpaceDefault; - mkif.m_setTSpaceBasic = NULL; + mkif.m_setTSpaceBasic = nullptr; SMikkTSpaceContext msc; msc.m_pInterface = &mkif; diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 74b6a16d41..749dff24f2 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -525,9 +525,9 @@ void StreamTexture::_requested_normal(void *p_ud) { request_normal_callback(stex); } -StreamTexture::TextureFormatRequestCallback StreamTexture::request_3d_callback = NULL; -StreamTexture::TextureFormatRoughnessRequestCallback StreamTexture::request_roughness_callback = NULL; -StreamTexture::TextureFormatRequestCallback StreamTexture::request_normal_callback = NULL; +StreamTexture::TextureFormatRequestCallback StreamTexture::request_3d_callback = nullptr; +StreamTexture::TextureFormatRoughnessRequestCallback StreamTexture::request_roughness_callback = nullptr; +StreamTexture::TextureFormatRequestCallback StreamTexture::request_normal_callback = nullptr; Image::Format StreamTexture::get_format() const { @@ -637,7 +637,7 @@ Error StreamTexture::load(const String &p_path) { RS::get_singleton()->texture_set_detect_3d_callback(texture, _requested_3d, this); } else { //print_line("not requesting detect 3D at " + p_path); - RS::get_singleton()->texture_set_detect_3d_callback(texture, NULL, NULL); + RS::get_singleton()->texture_set_detect_3d_callback(texture, nullptr, nullptr); } if (request_roughness) { @@ -645,7 +645,7 @@ Error StreamTexture::load(const String &p_path) { RS::get_singleton()->texture_set_detect_roughness_callback(texture, _requested_roughness, this); } else { //print_line("not requesting detect srgb at " + p_path); - RS::get_singleton()->texture_set_detect_roughness_callback(texture, NULL, NULL); + RS::get_singleton()->texture_set_detect_roughness_callback(texture, nullptr, nullptr); } if (request_normal) { @@ -653,7 +653,7 @@ Error StreamTexture::load(const String &p_path) { RS::get_singleton()->texture_set_detect_normal_callback(texture, _requested_normal, this); } else { //print_line("not requesting detect normal at " + p_path); - RS::get_singleton()->texture_set_detect_normal_callback(texture, NULL, NULL); + RS::get_singleton()->texture_set_detect_normal_callback(texture, nullptr, nullptr); } #endif @@ -1869,7 +1869,7 @@ AnimatedTexture::AnimatedTexture() { #ifndef NO_THREADS rw_lock = RWLock::create(); #else - rw_lock = NULL; + rw_lock = nullptr; #endif } diff --git a/scene/resources/texture.h b/scene/resources/texture.h index c3bbbd5ee6..18f70baa07 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -213,7 +213,7 @@ public: class ResourceFormatLoaderStreamTexture : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; @@ -421,7 +421,7 @@ public: COMPRESSION_UNCOMPRESSED }; - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index d67f5f9ff2..98ebf048dc 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -230,11 +230,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { List<PropertyInfo> list; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = icon_map.next(key))) { - const StringName *key2 = NULL; + const StringName *key2 = nullptr; while ((key2 = icon_map[*key].next(key2))) { @@ -242,11 +242,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { } } - key = NULL; + key = nullptr; while ((key = style_map.next(key))) { - const StringName *key2 = NULL; + const StringName *key2 = nullptr; while ((key2 = style_map[*key].next(key2))) { @@ -254,11 +254,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { } } - key = NULL; + key = nullptr; while ((key = font_map.next(key))) { - const StringName *key2 = NULL; + const StringName *key2 = nullptr; while ((key2 = font_map[*key].next(key2))) { @@ -266,11 +266,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { } } - key = NULL; + key = nullptr; while ((key = color_map.next(key))) { - const StringName *key2 = NULL; + const StringName *key2 = nullptr; while ((key2 = color_map[*key].next(key2))) { @@ -278,11 +278,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { } } - key = NULL; + key = nullptr; while ((key = constant_map.next(key))) { - const StringName *key2 = NULL; + const StringName *key2 = nullptr; while ((key2 = constant_map[*key].next(key2))) { @@ -417,7 +417,7 @@ void Theme::get_icon_list(StringName p_type, List<StringName> *p_list) const { if (!icon_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = icon_map[p_type].next(key))) { @@ -440,7 +440,7 @@ Ref<Shader> Theme::get_shader(const StringName &p_name, const StringName &p_type if (shader_map.has(p_type) && shader_map[p_type].has(p_name) && shader_map[p_type][p_name].is_valid()) { return shader_map[p_type][p_name]; } else { - return NULL; + return nullptr; } } @@ -464,7 +464,7 @@ void Theme::get_shader_list(const StringName &p_type, List<StringName> *p_list) if (!shader_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = shader_map[p_type].next(key))) { @@ -530,7 +530,7 @@ void Theme::get_stylebox_list(StringName p_type, List<StringName> *p_list) const if (!style_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = style_map[p_type].next(key))) { @@ -541,7 +541,7 @@ void Theme::get_stylebox_list(StringName p_type, List<StringName> *p_list) const void Theme::get_stylebox_types(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = style_map.next(key))) { p_list->push_back(*key); } @@ -604,7 +604,7 @@ void Theme::get_font_list(StringName p_type, List<StringName> *p_list) const { if (!font_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = font_map[p_type].next(key))) { @@ -654,7 +654,7 @@ void Theme::get_color_list(StringName p_type, List<StringName> *p_list) const { if (!color_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = color_map[p_type].next(key))) { @@ -704,7 +704,7 @@ void Theme::get_constant_list(StringName p_type, List<StringName> *p_list) const if (!constant_map.has(p_type)) return; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = constant_map[p_type].next(key))) { @@ -716,9 +716,9 @@ void Theme::clear() { //these need disconnecting { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = icon_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = icon_map[*K].next(L))) { Ref<Texture2D> icon = icon_map[*K][*L]; if (icon.is_valid()) { @@ -729,9 +729,9 @@ void Theme::clear() { } { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = style_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = style_map[*K].next(L))) { Ref<StyleBox> style = style_map[*K][*L]; if (style.is_valid()) { @@ -742,9 +742,9 @@ void Theme::clear() { } { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = font_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = font_map[*K].next(L))) { Ref<Font> font = font_map[*K][*L]; if (font.is_valid()) { @@ -781,9 +781,9 @@ void Theme::copy_theme(const Ref<Theme> &p_other) { //these need reconnecting, so add normally { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = p_other->icon_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = p_other->icon_map[*K].next(L))) { set_icon(*L, *K, p_other->icon_map[*K][*L]); } @@ -791,9 +791,9 @@ void Theme::copy_theme(const Ref<Theme> &p_other) { } { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = p_other->style_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = p_other->style_map[*K].next(L))) { set_stylebox(*L, *K, p_other->style_map[*K][*L]); } @@ -801,9 +801,9 @@ void Theme::copy_theme(const Ref<Theme> &p_other) { } { - const StringName *K = NULL; + const StringName *K = nullptr; while ((K = p_other->font_map.next(K))) { - const StringName *L = NULL; + const StringName *L = nullptr; while ((L = p_other->font_map[*K].next(L))) { set_font(*L, *K, p_other->font_map[*K][*L]); } @@ -825,35 +825,35 @@ void Theme::get_type_list(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); Set<StringName> types; - const StringName *key = NULL; + const StringName *key = nullptr; while ((key = icon_map.next(key))) { types.insert(*key); } - key = NULL; + key = nullptr; while ((key = style_map.next(key))) { types.insert(*key); } - key = NULL; + key = nullptr; while ((key = font_map.next(key))) { types.insert(*key); } - key = NULL; + key = nullptr; while ((key = color_map.next(key))) { types.insert(*key); } - key = NULL; + key = nullptr; while ((key = constant_map.next(key))) { diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 27305cfff1..6f8a53be1a 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -620,7 +620,7 @@ Vector2 TileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2()); //First try to forward selection to script if (p_tilemap_node->get_class_name() == "TileMap") { - if (get_script_instance() != NULL) { + if (get_script_instance() != nullptr) { if (get_script_instance()->has_method("_forward_subtile_selection")) { Variant ret = get_script_instance()->call("_forward_subtile_selection", p_id, p_bitmask, p_tilemap_node, p_tile_location); if (ret.get_type() == Variant::VECTOR2) { @@ -681,7 +681,7 @@ Vector2 TileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tilem ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2()); //First try to forward selection to script - if (get_script_instance() != NULL) { + if (get_script_instance() != nullptr) { if (get_script_instance()->has_method("_forward_atlas_subtile_selection")) { Variant ret = get_script_instance()->call("_forward_atlas_subtile_selection", p_id, p_tilemap_node, p_tile_location); if (ret.get_type() == Variant::VECTOR2) { @@ -1108,7 +1108,7 @@ bool TileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) { if (p_drawn_id == p_neighbor_id) { return true; - } else if (get_script_instance() != NULL) { + } else if (get_script_instance() != nullptr) { if (get_script_instance()->has_method("_is_tile_bound")) { Variant ret = get_script_instance()->call("_is_tile_bound", p_drawn_id, p_neighbor_id); if (ret.get_type() == Variant::BOOL) { diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 5252c560a4..05b43dfb89 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -194,8 +194,8 @@ public: void autotile_set_bitmask(int p_id, Vector2 p_coord, uint32_t p_flag); uint32_t autotile_get_bitmask(int p_id, Vector2 p_coord); const Map<Vector2, uint32_t> &autotile_get_bitmask_map(int p_id); - Vector2 autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node = NULL, const Vector2 &p_tile_location = Vector2()); - Vector2 atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node = NULL, const Vector2 &p_tile_location = Vector2()); + Vector2 autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node = nullptr, const Vector2 &p_tile_location = Vector2()); + Vector2 atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node = nullptr, const Vector2 &p_tile_location = Vector2()); void tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape); Ref<Shape2D> tile_get_shape(int p_id, int p_shape_id) const; diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index c47e80c807..f70f54412b 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -881,7 +881,7 @@ VisualShader::RenderModeEnums VisualShader::render_mode_enums[] = { { Shader::MODE_SPATIAL, "diffuse" }, { Shader::MODE_SPATIAL, "specular" }, { Shader::MODE_CANVAS_ITEM, "blend" }, - { Shader::MODE_CANVAS_ITEM, NULL } + { Shader::MODE_CANVAS_ITEM, nullptr } }; static const char *type_string[VisualShader::TYPE_MAX] = { @@ -1085,12 +1085,12 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const { } p_list->push_back(PropertyInfo(Variant::VECTOR2, prop_name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - if (Object::cast_to<VisualShaderNodeGroupBase>(E->get().node.ptr()) != NULL) { + if (Object::cast_to<VisualShaderNodeGroupBase>(E->get().node.ptr()) != nullptr) { p_list->push_back(PropertyInfo(Variant::VECTOR2, prop_name + "/size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/input_ports", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/output_ports", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); } - if (Object::cast_to<VisualShaderNodeExpression>(E->get().node.ptr()) != NULL) { + if (Object::cast_to<VisualShaderNodeExpression>(E->get().node.ptr()) != nullptr) { p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/expression", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); } } @@ -1478,7 +1478,7 @@ void VisualShader::_bind_methods() { ClassDB::bind_method(D_METHOD("remove_node", "type", "id"), &VisualShader::remove_node); ClassDB::bind_method(D_METHOD("is_node_connection", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::is_node_connection); - ClassDB::bind_method(D_METHOD("can_connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::is_node_connection); + ClassDB::bind_method(D_METHOD("can_connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::can_connect_nodes); ClassDB::bind_method(D_METHOD("connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::connect_nodes); ClassDB::bind_method(D_METHOD("disconnect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::disconnect_nodes); @@ -1687,7 +1687,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = { { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "sky_coords", "vec3(SKY_COORDS, 0.0)" }, { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, - { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL }, + { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, nullptr, nullptr }, }; const VisualShaderNodeInput::Port VisualShaderNodeInput::preview_ports[] = { @@ -1736,7 +1736,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::preview_ports[] = { { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "1.0" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "vec3(0.0, 0.0, 1.0)" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, - { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL }, + { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, nullptr, nullptr }, }; int VisualShaderNodeInput::get_input_port_count() const { @@ -2034,7 +2034,7 @@ const VisualShaderNodeOutput::Port VisualShaderNodeOutput::ports[] = { { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR" }, { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "ALPHA" }, - { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL }, + { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, nullptr, nullptr }, }; int VisualShaderNodeOutput::get_input_port_count() const { @@ -2565,7 +2565,7 @@ void VisualShaderNodeGroupBase::set_control(Control *p_control, int p_index) { } Control *VisualShaderNodeGroupBase::get_control(int p_index) { - ERR_FAIL_COND_V(!controls.has(p_index), NULL); + ERR_FAIL_COND_V(!controls.has(p_index), nullptr); return controls[p_index]; } diff --git a/scene/resources/world_3d.cpp b/scene/resources/world_3d.cpp index 8e45b22cbf..dee00dd82a 100644 --- a/scene/resources/world_3d.cpp +++ b/scene/resources/world_3d.cpp @@ -348,7 +348,7 @@ void World3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_effects", PROPERTY_HINT_RESOURCE_TYPE, "CameraEffects"), "set_camera_effects", "get_camera_effects"); ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); ADD_PROPERTY(PropertyInfo(Variant::_RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState3D", 0), "", "get_direct_space_state"); } World3D::World3D() { @@ -365,7 +365,7 @@ World3D::World3D() { ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_angular_damp", PropertyInfo(Variant::FLOAT, "physics/3d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater")); #ifdef _3D_DISABLED - indexer = NULL; + indexer = nullptr; #else indexer = memnew(SpatialIndexer); #endif |