diff options
Diffstat (limited to 'modules')
24 files changed, 112 insertions, 70 deletions
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp index 435069e25c..10a71d65df 100644 --- a/modules/bullet/area_bullet.cpp +++ b/modules/bullet/area_bullet.cpp @@ -89,7 +89,7 @@ void AreaBullet::dispatch_callbacks() { // This object's last shape being removed. overlapping_shape.other_object->on_exit_area(this); } - overlapping_shapes.remove(i); // Remove after callback + overlapping_shapes.remove_at(i); // Remove after callback break; case OVERLAP_STATE_INSIDE: { if (overlapping_shape.other_object->getType() == TYPE_RIGID_BODY) { @@ -188,7 +188,7 @@ void AreaBullet::remove_object_overlaps(CollisionObjectBullet *p_object) { // Reverse order so items can be removed. for (int i = overlapping_shapes.size() - 1; i >= 0; i--) { if (overlapping_shapes[i].other_object == p_object) { - overlapping_shapes.remove(i); + overlapping_shapes.remove_at(i); } } } diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index 987a45ad5f..cbb746800d 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -273,7 +273,7 @@ void RigidCollisionObjectBullet::remove_shape_full(ShapeBullet *p_shape) { for (int i = shapes.size() - 1; 0 <= i; --i) { if (p_shape == shapes[i].shape) { internal_shape_destroy(i); - shapes.remove(i); + shapes.remove_at(i); } } reload_shapes(); @@ -282,7 +282,7 @@ void RigidCollisionObjectBullet::remove_shape_full(ShapeBullet *p_shape) { void RigidCollisionObjectBullet::remove_shape_full(int p_index) { ERR_FAIL_INDEX(p_index, get_shape_count()); internal_shape_destroy(p_index); - shapes.remove(p_index); + shapes.remove_at(p_index); reload_shapes(); } diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index 3a2370ff31..c0ffffa364 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -442,7 +442,7 @@ void SoftBodyBullet::unpin_node(int p_node_index) { } const int id = search_node_pinned(p_node_index); if (-1 != id) { - pinned_nodes.remove(id); + pinned_nodes.remove_at(id); } } diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp index a7742ef415..a70e153abd 100644 --- a/modules/csg/csg.cpp +++ b/modules/csg/csg.cpp @@ -933,7 +933,7 @@ void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector<int> &p_segment_ merge_faces_idx.sort(); merge_faces_idx.reverse(); for (int i = 0; i < merge_faces_idx.size(); ++i) { - faces.remove(merge_faces_idx[i]); + faces.remove_at(merge_faces_idx[i]); } if (degenerate_points.size() == 0) { @@ -983,7 +983,7 @@ void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector<int> &p_segment_ // If new vertex snaps to degenerate vertex, just delete this face. if (degenerate_idx == opposite_vertex_idx) { - faces.remove(face_idx); + faces.remove_at(face_idx); // Update index. --face_idx; break; @@ -999,7 +999,7 @@ void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector<int> &p_segment_ right_face.vertex_idx[0] = opposite_vertex_idx; right_face.vertex_idx[1] = face.vertex_idx[face_edge_idx]; right_face.vertex_idx[2] = degenerate_idx; - faces.remove(face_idx); + faces.remove_at(face_idx); faces.insert(face_idx, right_face); faces.insert(face_idx, left_face); @@ -1070,7 +1070,7 @@ void CSGBrushOperation::Build2DFaces::_find_edge_intersections(const Vector2 p_s // If new vertex snaps to opposite vertex, just delete this face. if (new_vertex_idx == opposite_vertex_idx) { - faces.remove(face_idx); + faces.remove_at(face_idx); // Update index. --face_idx; break; @@ -1092,7 +1092,7 @@ void CSGBrushOperation::Build2DFaces::_find_edge_intersections(const Vector2 p_s right_face.vertex_idx[0] = opposite_vertex_idx; right_face.vertex_idx[1] = face.vertex_idx[face_edge_idx]; right_face.vertex_idx[2] = new_vertex_idx; - faces.remove(face_idx); + faces.remove_at(face_idx); faces.insert(face_idx, right_face); faces.insert(face_idx, left_face); @@ -1162,7 +1162,7 @@ int CSGBrushOperation::Build2DFaces::_insert_point(const Vector2 &p_point) { // If new vertex snaps to opposite vertex, just delete this face. if (new_vertex_idx == opposite_vertex_idx) { - faces.remove(face_idx); + faces.remove_at(face_idx); // Update index. --face_idx; break; @@ -1187,7 +1187,7 @@ int CSGBrushOperation::Build2DFaces::_insert_point(const Vector2 &p_point) { right_face.vertex_idx[0] = opposite_vertex_idx; right_face.vertex_idx[1] = face.vertex_idx[face_edge_idx]; right_face.vertex_idx[2] = new_vertex_idx; - faces.remove(face_idx); + faces.remove_at(face_idx); faces.insert(face_idx, right_face); faces.insert(face_idx, left_face); @@ -1222,7 +1222,7 @@ int CSGBrushOperation::Build2DFaces::_insert_point(const Vector2 &p_point) { new_face.vertex_idx[2] = new_vertex_idx; faces.push_back(new_face); } - faces.remove(face_idx); + faces.remove_at(face_idx); // No need to check other faces. break; diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index 9c8adb4cf1..33f4198ac1 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -4,10 +4,10 @@ Built-in GDScript functions. </brief_description> <description> - List of core built-in GDScript functions. Math functions and other utilities. Everything else is provided by objects. (Keywords: builtin, built in, global functions.) + A list of GDScript-specific utility functions accessed in any script. + For the list of the global functions and constants see [@GlobalScope]. </description> <tutorials> - <link title="Random number generation">$DOCS_URL/tutorials/math/random_number_generation.html</link> </tutorials> <methods> <method name="Color8"> diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 68da588c3d..b76c2c0437 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -427,7 +427,7 @@ void GDScript::_add_doc(const DocData::ClassDoc &p_inner_class) { } else { for (int i = 0; i < docs.size(); i++) { if (docs[i].name == p_inner_class.name) { - docs.remove(i); + docs.remove_at(i); break; } } @@ -2131,7 +2131,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b const GDScriptParser::ClassNode *inner_class = subclass->members[i].m_class; if (inner_class->identifier->name == extend_classes[0]) { - extend_classes.remove(0); + extend_classes.remove_at(0); found = true; subclass = inner_class; break; diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index cd8fd361c5..1ecde53dd0 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -3001,7 +3001,7 @@ void GDScriptAnalyzer::reduce_preload(GDScriptParser::PreloadNode *p_preload) { // TODO: Don't load if validating: use completion cache. p_preload->resource = ResourceLoader::load(p_preload->resolved_path); if (p_preload->resource.is_null()) { - push_error(vformat(R"(Could not p_preload resource file "%s".)", p_preload->resolved_path), p_preload->path); + push_error(vformat(R"(Could not preload resource file "%s".)", p_preload->resolved_path), p_preload->path); } } } diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index bde6783322..41b2d2191c 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -741,20 +741,22 @@ void GDScriptParser::parse_class_member(T *(GDScriptParser::*p_parse_function)() if (member->identifier != nullptr) { if (!((String)member->identifier->name).is_empty()) { // Enums may be unnamed. + +#ifdef DEBUG_ENABLED List<MethodInfo> gdscript_funcs; GDScriptLanguage::get_singleton()->get_public_functions(&gdscript_funcs); for (MethodInfo &info : gdscript_funcs) { if (info.name == member->identifier->name) { - push_error(vformat(R"(%s "%s" has the same name as a built-in function.)", p_member_kind.capitalize(), member->identifier->name), member->identifier); - return; + push_warning(member->identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_member_kind, member->identifier->name, "built-in function"); } } + if (Variant::has_utility_function(member->identifier->name)) { + push_warning(member->identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_member_kind, member->identifier->name, "built-in function"); + } +#endif + if (current_class->members_indices.has(member->identifier->name)) { push_error(vformat(R"(%s "%s" has the same name as a previously declared %s.)", p_member_kind.capitalize(), member->identifier->name, current_class->get_member(member->identifier->name).get_type_name()), member->identifier); - } else if (Variant::has_utility_function(member->identifier->name)) { - push_error(vformat(R"(%s "%s" has the same name as a built-in function.)", p_member_kind.capitalize(), member->identifier->name), member->identifier); - } else if (ClassDB::class_exists(member->identifier->name)) { - push_error(vformat(R"(%s "%s" has the same name as a global class.)", p_member_kind.capitalize(), member->identifier->name), member->identifier); } else { current_class->add_member(member); } @@ -827,21 +829,18 @@ GDScriptParser::VariableNode *GDScriptParser::parse_variable(bool p_allow_proper GDScriptParser::IdentifierNode *identifier = parse_identifier(); +#ifdef DEBUG_ENABLED List<MethodInfo> gdscript_funcs; GDScriptLanguage::get_singleton()->get_public_functions(&gdscript_funcs); for (MethodInfo &info : gdscript_funcs) { if (info.name == identifier->name) { - push_error(vformat(R"(Local var "%s" has the same name as a built-in function.)", identifier->name), identifier); - return nullptr; + push_warning(identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, "local variable", identifier->name, "built-in function"); } } if (Variant::has_utility_function(identifier->name)) { - push_error(vformat(R"(Local var "%s" has the same name as a built-in function.)", identifier->name), identifier); - return nullptr; - } else if (ClassDB::class_exists(identifier->name)) { - push_error(vformat(R"(Local var "%s" has the same name as a global class.)", identifier->name), identifier); - return nullptr; + push_warning(identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, "local variable", identifier->name, "built-in function"); } +#endif VariableNode *variable = alloc_node<VariableNode>(); variable->identifier = identifier; @@ -1099,22 +1098,20 @@ GDScriptParser::ParameterNode *GDScriptParser::parse_parameter() { } GDScriptParser::IdentifierNode *identifier = parse_identifier(); - +#ifdef DEBUG_ENABLED List<MethodInfo> gdscript_funcs; GDScriptLanguage::get_singleton()->get_public_functions(&gdscript_funcs); for (MethodInfo &info : gdscript_funcs) { if (info.name == identifier->name) { - push_error(vformat(R"(Parameter "%s" has the same name as a built-in function.)", identifier->name), identifier); - return nullptr; + push_warning(identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, "parameter", identifier->name, "built-in function"); } } if (Variant::has_utility_function(identifier->name)) { - push_error(vformat(R"(Parameter "%s" has the same name as a built-in function.)", identifier->name), identifier); - return nullptr; + push_warning(identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, "parameter", identifier->name, "built-in function"); } else if (ClassDB::class_exists(identifier->name)) { - push_error(vformat(R"(Parameter "%s" has the same name as a global class.)", identifier->name), identifier); - return nullptr; + push_warning(identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, "parameter", identifier->name, "global class"); } +#endif ParameterNode *parameter = alloc_node<ParameterNode>(); parameter->identifier = identifier; @@ -1195,8 +1192,10 @@ GDScriptParser::EnumNode *GDScriptParser::parse_enum() { HashMap<StringName, int> elements; +#ifdef DEBUG_ENABLED List<MethodInfo> gdscript_funcs; GDScriptLanguage::get_singleton()->get_public_functions(&gdscript_funcs); +#endif do { if (check(GDScriptTokenizer::Token::BRACE_CLOSE)) { @@ -1205,20 +1204,18 @@ GDScriptParser::EnumNode *GDScriptParser::parse_enum() { if (consume(GDScriptTokenizer::Token::IDENTIFIER, R"(Expected identifier for enum key.)")) { EnumNode::Value item; GDScriptParser::IdentifierNode *identifier = parse_identifier(); - +#ifdef DEBUG_ENABLED for (MethodInfo &info : gdscript_funcs) { if (info.name == identifier->name) { - push_error(vformat(R"(Enum member "%s" has the same name as a built-in function.)", identifier->name), identifier); - return nullptr; + push_warning(identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, "enum member", identifier->name, "built-in function"); } } if (Variant::has_utility_function(identifier->name)) { - push_error(vformat(R"(Enum member "%s" has the same name as a built-in function.)", identifier->name), identifier); - return nullptr; + push_warning(identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, "enum member", identifier->name, "built-in function"); } else if (ClassDB::class_exists(identifier->name)) { - push_error(vformat(R"(Enum member "%s" has the same name as a global class.)", identifier->name), identifier); - return nullptr; + push_warning(identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, "enum member", identifier->name, "global class"); } +#endif item.identifier = identifier; item.parent_enum = enum_node; item.line = previous.start_line; @@ -3417,7 +3414,7 @@ bool GDScriptParser::validate_annotation_arguments(AnnotationNode *p_annotation) p_annotation->resolved_arguments.push_back(r); if (error.error != Callable::CallError::CALL_OK) { push_error(vformat(R"(Expected %s as argument %d of annotation "%s").)", Variant::get_type_name(parameter.type), i + 1, p_annotation->name)); - p_annotation->resolved_arguments.remove(p_annotation->resolved_arguments.size() - 1); + p_annotation->resolved_arguments.remove_at(p_annotation->resolved_arguments.size() - 1); return false; } break; @@ -3441,7 +3438,7 @@ bool GDScriptParser::validate_annotation_arguments(AnnotationNode *p_annotation) p_annotation->resolved_arguments.push_back(r); if (error.error != Callable::CallError::CALL_OK) { push_error(vformat(R"(Expected %s as argument %d of annotation "%s").)", Variant::get_type_name(parameter.type), i + 1, p_annotation->name)); - p_annotation->resolved_arguments.remove(p_annotation->resolved_arguments.size() - 1); + p_annotation->resolved_arguments.remove_at(p_annotation->resolved_arguments.size() - 1); return false; } break; diff --git a/modules/gdscript/gdscript_warning.cpp b/modules/gdscript/gdscript_warning.cpp index 7a483a16ba..a351bd6dad 100644 --- a/modules/gdscript/gdscript_warning.cpp +++ b/modules/gdscript/gdscript_warning.cpp @@ -148,6 +148,10 @@ String GDScriptWarning::get_message() const { case EMPTY_FILE: { return "Empty script file."; } + case SHADOWED_GLOBAL_IDENTIFIER: { + CHECK_SYMBOLS(3); + return vformat(R"(The %s '%s' has the same name as a %s.)", symbols[0], symbols[1], symbols[2]); + } case WARNING_MAX: break; // Can't happen, but silences warning } @@ -194,6 +198,7 @@ String GDScriptWarning::get_name_from_code(Code p_code) { "ASSERT_ALWAYS_FALSE", "REDUNDANT_AWAIT", "EMPTY_FILE", + "SHADOWED_GLOBAL_IDENTIFIER", }; static_assert((sizeof(names) / sizeof(*names)) == WARNING_MAX, "Amount of warning types don't match the amount of warning names."); diff --git a/modules/gdscript/gdscript_warning.h b/modules/gdscript/gdscript_warning.h index 8de46b08c1..d05f47efe7 100644 --- a/modules/gdscript/gdscript_warning.h +++ b/modules/gdscript/gdscript_warning.h @@ -69,6 +69,7 @@ public: ASSERT_ALWAYS_FALSE, // Expression for assert argument is always false. REDUNDANT_AWAIT, // await is used but expression is synchronous (not a signal nor a coroutine). EMPTY_FILE, // A script file is empty. + SHADOWED_GLOBAL_IDENTIFIER, // A global class or function has the same name as variable. WARNING_MAX, }; diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp index 5cf1e0fc5f..578943696e 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.cpp +++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp @@ -115,7 +115,7 @@ Error GDScriptLanguageProtocol::LSPeer::send_data() { // Response sent if (res_sent >= c_res.size() - 1) { res_sent = 0; - res_queue.remove(0); + res_queue.remove_at(0); } } return OK; diff --git a/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.gd b/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.gd new file mode 100644 index 0000000000..3c64be571b --- /dev/null +++ b/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.gd @@ -0,0 +1,2 @@ +func test(): + var abs = "This variable has the same name as the built-in function." diff --git a/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.out b/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.out new file mode 100644 index 0000000000..f2b29e5bad --- /dev/null +++ b/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.out @@ -0,0 +1,9 @@ +GDTEST_OK +>> WARNING +>> Line: 2 +>> SHADOWED_GLOBAL_IDENTIFIER +>> The local variable 'abs' has the same name as a built-in function. +>> WARNING +>> Line: 2 +>> UNUSED_VARIABLE +>> The local variable 'abs' is declared but never used in the block. If this is intended, prefix it with an underscore: '_abs' diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index fac1e61b18..f3317aeada 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -6115,7 +6115,10 @@ void GLTFDocument::_convert_mesh_instances(Ref<GLTFState> state) { int bone_cnt = skeleton->get_bone_count(); ERR_FAIL_COND(bone_cnt != gltf_skeleton->joints.size()); - ObjectID gltf_skin_key = skin->get_instance_id(); + ObjectID gltf_skin_key; + if (skin.is_valid()) { + gltf_skin_key = skin->get_instance_id(); + } ObjectID gltf_skel_key = godot_skeleton->get_instance_id(); GLTFSkinIndex skin_gltf_i = -1; GLTFNodeIndex root_gltf_i = -1; diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 544f2a7584..0ceb45d425 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -788,11 +788,7 @@ bool CSharpLanguage::is_assembly_reloading_needed() { GDMonoAssembly *proj_assembly = gdmono->get_project_assembly(); - String appname = ProjectSettings::get_singleton()->get("application/config/name"); - String appname_safe = OS::get_singleton()->get_safe_dir_name(appname); - if (appname_safe.is_empty()) { - appname_safe = "UnnamedProject"; - } + String appname_safe = ProjectSettings::get_singleton()->get_safe_project_name(); appname_safe += ".dll"; diff --git a/modules/mono/glue/collections_glue.cpp b/modules/mono/glue/collections_glue.cpp index 86976de244..e367ecb7d6 100644 --- a/modules/mono/glue/collections_glue.cpp +++ b/modules/mono/glue/collections_glue.cpp @@ -144,7 +144,7 @@ void godot_icall_Array_Insert(Array *ptr, int32_t index, MonoObject *item) { MonoBoolean godot_icall_Array_Remove(Array *ptr, MonoObject *item) { int idx = ptr->find(GDMonoMarshal::mono_object_to_variant(item)); if (idx >= 0) { - ptr->remove(idx); + ptr->remove_at(idx); return true; } return false; @@ -155,7 +155,7 @@ void godot_icall_Array_RemoveAt(Array *ptr, int32_t index) { GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range()); return; } - ptr->remove(index); + ptr->remove_at(index); } int32_t godot_icall_Array_Resize(Array *ptr, int32_t new_size) { diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp index f600f07c87..ac3422187f 100644 --- a/modules/navigation/godot_navigation_server.cpp +++ b/modules/navigation/godot_navigation_server.cpp @@ -150,8 +150,8 @@ COMMAND_2(map_set_active, RID, p_map, bool, p_active) { } else { int map_index = active_maps.find(map); ERR_FAIL_COND(map_index < 0); - active_maps.remove(map_index); - active_maps_update_id.remove(map_index); + active_maps.remove_at(map_index); + active_maps_update_id.remove_at(map_index); } } @@ -469,8 +469,8 @@ COMMAND_1(free, RID, p_object) { } int map_index = active_maps.find(map); - active_maps.remove(map_index); - active_maps_update_id.remove(map_index); + active_maps.remove_at(map_index); + active_maps_update_id.remove_at(map_index); map_owner.free(p_object); } else if (region_owner.owns(p_object)) { diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 1adaef4d84..f480c86088 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -2148,7 +2148,7 @@ void TextServerAdvanced::font_remove_texture(RID p_font_rid, const Vector2i &p_s ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); ERR_FAIL_INDEX(p_texture_index, fd->cache[size]->textures.size()); - fd->cache[size]->textures.remove(p_texture_index); + fd->cache[size]->textures.remove_at(p_texture_index); } void TextServerAdvanced::font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) { diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 80ae10c005..5c06051211 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -1326,7 +1326,7 @@ void TextServerFallback::font_remove_texture(RID p_font_rid, const Vector2i &p_s ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); ERR_FAIL_INDEX(p_texture_index, fd->cache[size]->textures.size()); - fd->cache[size]->textures.remove(p_texture_index); + fd->cache[size]->textures.remove_at(p_texture_index); } void TextServerFallback::font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) { diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp index 88d92b0083..64823deaba 100644 --- a/modules/upnp/upnp.cpp +++ b/modules/upnp/upnp.cpp @@ -257,7 +257,7 @@ void UPNP::set_device(int index, Ref<UPNPDevice> device) { void UPNP::remove_device(int index) { ERR_FAIL_INDEX(index, devices.size()); - devices.remove(index); + devices.remove_at(index); } void UPNP::clear_devices() { diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp index e8b25b58b6..13dd1f7bc7 100644 --- a/modules/visual_script/editor/visual_script_editor.cpp +++ b/modules/visual_script/editor/visual_script_editor.cpp @@ -1262,6 +1262,23 @@ void VisualScriptEditor::_member_edited() { undo_redo->create_action(TTR("Rename Variable")); undo_redo->add_do_method(script.ptr(), "rename_variable", name, new_name); undo_redo->add_undo_method(script.ptr(), "rename_variable", new_name, name); + + // Also fix all variable setter & getter calls + List<int> lst; + script->get_node_list(&lst); + for (int &P : lst) { + Ref<VisualScriptPropertySet> pset = script->get_node(P); + if (pset.is_valid() && pset->get_property() == name) { + undo_redo->add_do_method(pset.ptr(), "set_property", new_name); + undo_redo->add_undo_method(pset.ptr(), "set_property", name); + } + Ref<VisualScriptPropertyGet> pget = script->get_node(P); + if (pget.is_valid() && pget->get_property() == name) { + undo_redo->add_do_method(pget.ptr(), "set_property", new_name); + undo_redo->add_undo_method(pget.ptr(), "set_property", name); + } + } + undo_redo->add_do_method(this, "_update_members"); undo_redo->add_undo_method(this, "_update_members"); undo_redo->add_do_method(this, "_update_graph"); @@ -1278,6 +1295,18 @@ void VisualScriptEditor::_member_edited() { undo_redo->create_action(TTR("Rename Signal")); undo_redo->add_do_method(script.ptr(), "rename_custom_signal", name, new_name); undo_redo->add_undo_method(script.ptr(), "rename_custom_signal", new_name, name); + + // Also fix all signal emitting nodes + List<int> lst; + script->get_node_list(&lst); + for (int &P : lst) { + Ref<VisualScriptEmitSignal> psig = script->get_node(P); + if (psig.is_valid() && psig->get_signal() == name) { + undo_redo->add_do_method(psig.ptr(), "set_signal", new_name); + undo_redo->add_undo_method(psig.ptr(), "set_signal", name); + } + } + undo_redo->add_do_method(this, "_update_members"); undo_redo->add_undo_method(this, "_update_members"); undo_redo->add_do_method(this, "emit_signal", "edited_script_changed"); diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 700cc85672..34d8c0b1e6 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -661,7 +661,7 @@ void VisualScript::custom_signal_remove_argument(const StringName &p_func, int p ERR_FAIL_COND(instances.size()); ERR_FAIL_COND(!custom_signals.has(p_func)); ERR_FAIL_INDEX(p_argidx, custom_signals[p_func].size()); - custom_signals[p_func].remove(p_argidx); + custom_signals[p_func].remove_at(p_argidx); } int VisualScript::custom_signal_get_argument_count(const StringName &p_func) const { diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp index 55c707890f..699042ffa6 100644 --- a/modules/visual_script/visual_script_expression.cpp +++ b/modules/visual_script/visual_script_expression.cpp @@ -1190,7 +1190,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() { op->nodes[1] = nullptr; expression.write[i].is_op = false; expression.write[i].node = op; - expression.remove(i + 1); + expression.remove_at(i + 1); } } else { @@ -1222,8 +1222,8 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() { //replace all 3 nodes by this operator and make it an expression expression.write[next_op - 1].node = op; - expression.remove(next_op); - expression.remove(next_op); + expression.remove_at(next_op); + expression.remove_at(next_op); } } diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 471d8ef0ae..b0af030981 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -253,7 +253,7 @@ String VisualScriptFunction::get_argument_name(int p_argidx) const { void VisualScriptFunction::remove_argument(int p_argidx) { ERR_FAIL_INDEX(p_argidx, arguments.size()); - arguments.remove(p_argidx); + arguments.remove_at(p_argidx); ports_changed_notify(); } @@ -623,7 +623,7 @@ void VisualScriptLists::remove_input_data_port(int p_argidx) { ERR_FAIL_INDEX(p_argidx, inputports.size()); - inputports.remove(p_argidx); + inputports.remove_at(p_argidx); ports_changed_notify(); notify_property_list_changed(); @@ -679,7 +679,7 @@ void VisualScriptLists::remove_output_data_port(int p_argidx) { ERR_FAIL_INDEX(p_argidx, outputports.size()); - outputports.remove(p_argidx); + outputports.remove_at(p_argidx); ports_changed_notify(); notify_property_list_changed(); |