summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/config/engine.cpp2
-rw-r--r--core/config/project_settings.cpp4
-rw-r--r--core/core_bind.cpp34
-rw-r--r--core/core_bind.h6
-rw-r--r--core/debugger/debugger_marshalls.cpp2
-rw-r--r--core/debugger/remote_debugger.cpp2
-rw-r--r--core/extension/extension_api_dump.cpp34
-rw-r--r--core/extension/gdnative_interface.cpp3
-rw-r--r--core/extension/native_extension.cpp2
-rw-r--r--core/input/input.cpp2
-rw-r--r--core/input/input_map.cpp4
-rw-r--r--core/io/dir_access.cpp6
-rw-r--r--core/io/image_loader.cpp2
-rw-r--r--core/io/ip.cpp2
-rw-r--r--core/io/json.cpp2
-rw-r--r--core/io/marshalls.cpp6
-rw-r--r--core/io/multiplayer_api.cpp2
-rw-r--r--core/io/packed_data_container.cpp4
-rw-r--r--core/io/resource.cpp10
-rw-r--r--core/io/resource_format_binary.cpp23
-rw-r--r--core/io/resource_importer.cpp8
-rw-r--r--core/io/resource_loader.cpp6
-rw-r--r--core/io/resource_loader.h8
-rw-r--r--core/io/resource_saver.cpp4
-rw-r--r--core/io/resource_uid.cpp2
-rw-r--r--core/math/face3.h4
-rw-r--r--core/math/geometry_3d.h2
-rw-r--r--core/math/quick_hull.cpp4
-rw-r--r--core/object/class_db.cpp30
-rw-r--r--core/object/object.cpp14
-rw-r--r--core/object/script_language.cpp12
-rw-r--r--core/os/main_loop.cpp4
-rw-r--r--core/os/main_loop.h4
-rw-r--r--core/os/pool_allocator.h2
-rw-r--r--core/register_core_types.cpp2
-rw-r--r--core/string/optimized_translation.cpp2
-rw-r--r--core/string/translation.cpp2
-rw-r--r--core/string/translation_po.cpp12
-rw-r--r--core/string/ustring.cpp2
-rw-r--r--core/templates/command_queue_mt.h2
-rw-r--r--core/templates/rid_owner.h2
-rw-r--r--core/templates/set.h7
-rw-r--r--core/variant/callable.cpp2
-rw-r--r--core/variant/variant.cpp2
-rw-r--r--core/variant/variant.h2
-rw-r--r--core/variant/variant_call.cpp4
-rw-r--r--core/variant/variant_parser.cpp2
-rw-r--r--core/variant/variant_setget.cpp4
-rw-r--r--core/variant/variant_utility.cpp2
-rw-r--r--doc/classes/Control.xml2
-rw-r--r--doc/classes/EditorNode3DGizmoPlugin.xml4
-rw-r--r--doc/classes/MethodTweener.xml2
-rw-r--r--doc/classes/Node3D.xml2
-rw-r--r--doc/classes/RDShaderFile.xml6
-rw-r--r--doc/classes/RDShaderSPIRV.xml (renamed from doc/classes/RDShaderBytecode.xml)2
-rw-r--r--doc/classes/RenderingDevice.xml24
-rw-r--r--doc/classes/ResourceUID.xml8
-rw-r--r--doc/classes/SceneTree.xml2
-rw-r--r--doc/classes/Skeleton2D.xml2
-rw-r--r--doc/classes/SkeletonModification2D.xml4
-rw-r--r--doc/classes/SkeletonModification2DCCDIK.xml2
-rw-r--r--doc/classes/SkeletonModification2DJiggle.xml12
-rw-r--r--doc/classes/SkeletonModification2DTwoBoneIK.xml2
-rw-r--r--doc/classes/SkeletonModificationStack2D.xml2
-rw-r--r--doc/classes/TextEdit.xml2
-rw-r--r--doc/classes/Tween.xml4
-rw-r--r--doc/classes/Tweener.xml2
-rw-r--r--drivers/unix/net_socket_posix.cpp2
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp519
-rw-r--r--drivers/vulkan/rendering_device_vulkan.h10
-rw-r--r--editor/animation_bezier_editor.cpp4
-rw-r--r--editor/animation_track_editor.cpp12
-rw-r--r--editor/code_editor.cpp2
-rw-r--r--editor/connections_dialog.cpp2
-rw-r--r--editor/create_dialog.cpp2
-rw-r--r--editor/debugger/script_editor_debugger.cpp2
-rw-r--r--editor/dependency_editor.cpp8
-rw-r--r--editor/doc_tools.cpp32
-rw-r--r--editor/editor_audio_buses.cpp4
-rw-r--r--editor/editor_autoload_settings.cpp18
-rw-r--r--editor/editor_data.cpp12
-rw-r--r--editor/editor_export.cpp14
-rw-r--r--editor/editor_feature_profile.cpp4
-rw-r--r--editor/editor_file_dialog.cpp2
-rw-r--r--editor/editor_file_system.cpp34
-rw-r--r--editor/editor_folding.cpp4
-rw-r--r--editor/editor_inspector.cpp18
-rw-r--r--editor/editor_layouts_dialog.cpp2
-rw-r--r--editor/editor_node.cpp57
-rw-r--r--editor/editor_path.cpp2
-rw-r--r--editor/editor_resource_picker.cpp10
-rw-r--r--editor/editor_run.cpp4
-rw-r--r--editor/editor_settings.cpp14
-rw-r--r--editor/filesystem_dock.cpp8
-rw-r--r--editor/groups_editor.cpp4
-rw-r--r--editor/icons/ImmediateGeometry3D.svg1
-rw-r--r--editor/import/resource_importer_obj.cpp2
-rw-r--r--editor/import/resource_importer_scene.cpp18
-rw-r--r--editor/import/scene_import_settings.cpp8
-rw-r--r--editor/import/scene_importer_mesh.cpp2
-rw-r--r--editor/import_defaults_editor.cpp6
-rw-r--r--editor/import_dock.cpp24
-rw-r--r--editor/inspector_dock.cpp2
-rw-r--r--editor/localization_editor.cpp8
-rw-r--r--editor/multi_node_edit.cpp4
-rw-r--r--editor/plugin_config_dialog.cpp2
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp6
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp6
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp20
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp8
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp10
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp8
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/editor_preview_plugins.cpp2
-rw-r--r--editor/plugins/gpu_particles_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/material_editor_plugin.cpp12
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp2
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp289
-rw-r--r--editor/plugins/node_3d_editor_plugin.h2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp4
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp16
-rw-r--r--editor/plugins/script_text_editor.cpp22
-rw-r--r--editor/plugins/shader_editor_plugin.cpp6
-rw-r--r--editor/plugins/shader_file_editor_plugin.cpp6
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp4
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp4
-rw-r--r--editor/plugins/theme_editor_plugin.cpp86
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp2
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp3
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp36
-rw-r--r--editor/project_export.cpp2
-rw-r--r--editor/project_manager.cpp10
-rw-r--r--editor/project_settings_editor.cpp8
-rw-r--r--editor/property_editor.cpp12
-rw-r--r--editor/property_selector.cpp2
-rw-r--r--editor/scene_tree_dock.cpp23
-rw-r--r--editor/script_create_dialog.cpp6
-rw-r--r--editor/settings_config_dialog.cpp4
-rw-r--r--editor/translations/af.po4
-rw-r--r--editor/translations/ar.po30
-rw-r--r--editor/translations/az.po4
-rw-r--r--editor/translations/bg.po5
-rw-r--r--editor/translations/bn.po4
-rw-r--r--editor/translations/br.po4
-rw-r--r--editor/translations/ca.po5
-rw-r--r--editor/translations/cs.po15
-rw-r--r--editor/translations/da.po4
-rw-r--r--editor/translations/de.po5
-rw-r--r--editor/translations/editor.pot6
-rw-r--r--editor/translations/el.po5
-rw-r--r--editor/translations/eo.po4
-rw-r--r--editor/translations/es.po19
-rw-r--r--editor/translations/es_AR.po5
-rw-r--r--editor/translations/et.po12
-rw-r--r--editor/translations/eu.po4
-rw-r--r--editor/translations/fa.po4
-rw-r--r--editor/translations/fi.po5
-rw-r--r--editor/translations/fil.po4
-rw-r--r--editor/translations/fr.po17
-rw-r--r--editor/translations/ga.po4
-rw-r--r--editor/translations/gl.po4
-rw-r--r--editor/translations/he.po5
-rw-r--r--editor/translations/hi.po4
-rw-r--r--editor/translations/hr.po14
-rw-r--r--editor/translations/hu.po5
-rw-r--r--editor/translations/id.po5
-rw-r--r--editor/translations/is.po4
-rw-r--r--editor/translations/it.po204
-rw-r--r--editor/translations/ja.po5
-rw-r--r--editor/translations/ka.po4
-rw-r--r--editor/translations/km.po4
-rw-r--r--editor/translations/ko.po9
-rw-r--r--editor/translations/lt.po4
-rw-r--r--editor/translations/lv.po4
-rw-r--r--editor/translations/mi.po4
-rw-r--r--editor/translations/mk.po4
-rw-r--r--editor/translations/ml.po4
-rw-r--r--editor/translations/mr.po4
-rw-r--r--editor/translations/ms.po51
-rw-r--r--editor/translations/nb.po4
-rw-r--r--editor/translations/nl.po14
-rw-r--r--editor/translations/or.po4
-rw-r--r--editor/translations/pl.po13
-rw-r--r--editor/translations/pr.po4
-rw-r--r--editor/translations/pt.po5
-rw-r--r--editor/translations/pt_BR.po5
-rw-r--r--editor/translations/ro.po5
-rw-r--r--editor/translations/ru.po10
-rw-r--r--editor/translations/si.po4
-rw-r--r--editor/translations/sk.po5
-rw-r--r--editor/translations/sl.po5
-rw-r--r--editor/translations/sq.po4
-rw-r--r--editor/translations/sr_Cyrl.po4
-rw-r--r--editor/translations/sr_Latn.po4
-rw-r--r--editor/translations/sv.po4
-rw-r--r--editor/translations/ta.po4
-rw-r--r--editor/translations/te.po4
-rw-r--r--editor/translations/th.po5
-rw-r--r--editor/translations/tr.po5
-rw-r--r--editor/translations/tt.po4
-rw-r--r--editor/translations/tzm.po4
-rw-r--r--editor/translations/uk.po5
-rw-r--r--editor/translations/ur_PK.po4
-rw-r--r--editor/translations/vi.po4
-rw-r--r--editor/translations/zh_CN.po19
-rw-r--r--editor/translations/zh_HK.po4
-rw-r--r--editor/translations/zh_TW.po5
-rw-r--r--main/main_timer_sync.cpp26
-rw-r--r--main/main_timer_sync.h22
-rw-r--r--main/performance.cpp8
-rw-r--r--main/performance.h12
-rw-r--r--misc/dist/windows/modpath.pas2
-rw-r--r--modules/camera/camera_osx.h2
-rw-r--r--modules/camera/camera_osx.mm2
-rw-r--r--modules/fbx/fbx_parser/ByteSwapper.h2
-rw-r--r--modules/fbx/fbx_parser/FBXDocument.cpp2
-rw-r--r--modules/gdnative/gdnative.cpp8
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp2
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp2
-rw-r--r--modules/gdnative/register_types.cpp6
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp16
-rw-r--r--modules/gdscript/gdscript.cpp47
-rw-r--r--modules/gdscript/gdscript_compiler.cpp2
-rw-r--r--modules/gdscript/gdscript_editor.cpp40
-rw-r--r--modules/gdscript/gdscript_parser.cpp10
-rw-r--r--modules/gdscript/gdscript_parser.h2
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.cpp12
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.cpp4
-rw-r--r--modules/gdscript/language_server/lsp.hpp52
-rw-r--r--modules/glslang/register_types.cpp2
-rw-r--r--modules/gridmap/grid_map.cpp2
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp8
-rw-r--r--modules/lightmapper_rd/lightmapper_rd.cpp16
-rw-r--r--modules/mono/class_db_api_json.cpp12
-rw-r--r--modules/mono/csharp_script.cpp119
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs14
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs8
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs36
-rw-r--r--modules/mono/editor/bindings_generator.cpp137
-rw-r--r--modules/mono/editor/code_completion.cpp18
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs222
-rw-r--r--modules/mono/glue/base_object_glue.cpp2
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp2
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_class.cpp8
-rw-r--r--modules/text_server_adv/text_server_adv.cpp4
-rw-r--r--modules/text_server_fb/text_server_fb.cpp2
-rw-r--r--modules/visual_script/visual_script.cpp8
-rw-r--r--modules/visual_script/visual_script_editor.cpp38
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp2
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp24
-rw-r--r--modules/visual_script/visual_script_nodes.cpp20
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp6
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp4
-rw-r--r--modules/webrtc/webrtc_multiplayer_peer.cpp10
-rw-r--r--modules/websocket/emws_client.cpp2
-rw-r--r--modules/websocket/wsl_server.cpp4
-rw-r--r--modules/webxr/doc_classes/WebXRInterface.xml2
-rw-r--r--platform/android/java/lib/src/com/google/android/vending/licensing/Obfuscator.java2
-rw-r--r--platform/iphone/godot_view_gesture_recognizer.h2
-rw-r--r--platform/javascript/js/libs/audio.worklet.js2
-rw-r--r--platform/linuxbsd/display_server_x11.cpp2
-rw-r--r--platform/linuxbsd/os_linuxbsd.cpp2
-rw-r--r--platform/osx/export/export.cpp5
-rw-r--r--platform/osx/joypad_osx.cpp3
-rw-r--r--platform/osx/os_osx.mm2
-rw-r--r--platform/windows/detect.py1
-rw-r--r--scene/2d/physics_body_2d.cpp2
-rw-r--r--scene/2d/tile_map.cpp11
-rw-r--r--scene/3d/gpu_particles_collision_3d.cpp2
-rw-r--r--scene/3d/mesh_instance_3d.cpp2
-rw-r--r--scene/3d/physics_body_3d.cpp2
-rw-r--r--scene/3d/proximity_group_3d.cpp1
-rw-r--r--scene/3d/skeleton_3d.cpp2
-rw-r--r--scene/3d/soft_body_3d.cpp2
-rw-r--r--scene/animation/animation_blend_tree.cpp4
-rw-r--r--scene/animation/animation_node_state_machine.cpp6
-rw-r--r--scene/animation/animation_player.cpp8
-rw-r--r--scene/animation/animation_tree.cpp8
-rw-r--r--scene/animation/tween.cpp8
-rw-r--r--scene/debugger/scene_debugger.cpp4
-rw-r--r--scene/gui/code_edit.cpp6
-rw-r--r--scene/gui/control.cpp80
-rw-r--r--scene/gui/control.h2
-rw-r--r--scene/gui/file_dialog.cpp2
-rw-r--r--scene/gui/graph_edit.cpp10
-rw-r--r--scene/gui/menu_button.cpp45
-rw-r--r--scene/gui/menu_button.h2
-rw-r--r--scene/gui/popup_menu.cpp4
-rw-r--r--scene/main/http_request.cpp4
-rw-r--r--scene/main/instance_placeholder.cpp4
-rw-r--r--scene/main/node.cpp16
-rw-r--r--scene/main/scene_tree.cpp24
-rw-r--r--scene/main/scene_tree.h20
-rw-r--r--scene/main/timer.cpp8
-rw-r--r--scene/main/timer.h10
-rw-r--r--scene/main/viewport.cpp2
-rw-r--r--scene/main/window.cpp2
-rw-r--r--scene/register_scene_types.cpp1
-rw-r--r--scene/resources/curve.cpp4
-rw-r--r--scene/resources/immediate_mesh.cpp2
-rw-r--r--scene/resources/material.cpp2
-rw-r--r--scene/resources/navigation_mesh.cpp4
-rw-r--r--scene/resources/packed_scene.cpp12
-rw-r--r--scene/resources/resource_format_text.cpp6
-rw-r--r--scene/resources/sprite_frames.cpp2
-rw-r--r--scene/resources/syntax_highlighter.cpp2
-rw-r--r--scene/resources/theme.cpp2
-rw-r--r--scene/resources/tile_set.cpp12
-rw-r--r--scene/resources/visual_shader.cpp4
-rw-r--r--servers/physics_2d/body_2d_sw.cpp2
-rw-r--r--servers/physics_3d/joints/generic_6dof_joint_3d_sw.h4
-rw-r--r--servers/physics_3d/joints/slider_joint_3d_sw.cpp2
-rw-r--r--servers/register_server_types.cpp2
-rw-r--r--servers/rendering/renderer_rd/cluster_builder_rd.h2
-rw-r--r--servers/rendering/renderer_rd/effects_rd.cpp3
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp2
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.cpp2
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.cpp6
-rw-r--r--servers/rendering/renderer_rd/shader_compiler_rd.cpp8
-rw-r--r--servers/rendering/renderer_rd/shader_rd.cpp175
-rw-r--r--servers/rendering/renderer_rd/shader_rd.h2
-rw-r--r--servers/rendering/renderer_rd/shaders/particles_copy.glsl2
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl2
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl2
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl2
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl2
-rw-r--r--servers/rendering/renderer_rd/shaders/sdfgi_direct_light.glsl8
-rw-r--r--servers/rendering/renderer_rd/shaders/sdfgi_integrate.glsl4
-rw-r--r--servers/rendering/renderer_rd/shaders/sdfgi_preprocess.glsl6
-rw-r--r--servers/rendering/renderer_scene_cull.cpp8
-rw-r--r--servers/rendering/rendering_device.cpp81
-rw-r--r--servers/rendering/rendering_device.h36
-rw-r--r--servers/rendering/rendering_device_binds.cpp4
-rw-r--r--servers/rendering/rendering_device_binds.h48
-rw-r--r--servers/rendering/shader_language.cpp81
-rw-r--r--servers/rendering/shader_language.h16
-rw-r--r--servers/rendering_server.cpp2
-rw-r--r--servers/xr/xr_interface.h2
-rw-r--r--tests/test_class_db.h6
-rw-r--r--tests/test_math.cpp2
-rw-r--r--tests/test_physics_2d.cpp2
-rw-r--r--tests/test_physics_3d.cpp4
-rw-r--r--tests/test_render.cpp6
348 files changed, 2565 insertions, 1944 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index c03c872f17..0b5b5627af 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -214,7 +214,7 @@ bool Engine::has_singleton(const String &p_name) const {
}
void Engine::get_singletons(List<Singleton> *p_singletons) {
- for (Singleton &E : singletons) {
+ for (const Singleton &E : singletons) {
p_singletons->push_back(E);
}
}
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 22acb23bce..c5e6c6d685 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -800,7 +800,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
if (E->key() != "") {
file->store_string("[" + E->key() + "]\n\n");
}
- for (String &F : E->get()) {
+ for (const String &F : E->get()) {
String key = F;
if (E->key() != "") {
key = E->key() + "/" + key;
@@ -928,7 +928,7 @@ Vector<String> ProjectSettings::get_optimizer_presets() const {
ProjectSettings::get_singleton()->get_property_list(&pi);
Vector<String> names;
- for (PropertyInfo &E : pi) {
+ for (const PropertyInfo &E : pi) {
if (!E.name.begins_with("optimizer_presets/")) {
continue;
}
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index 7a1ba63233..9e96d4b079 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -75,7 +75,7 @@ Vector<String> _ResourceLoader::get_recognized_extensions_for_type(const String
List<String> exts;
ResourceLoader::get_recognized_extensions_for_type(p_type, &exts);
Vector<String> ret;
- for (String &E : exts) {
+ for (const String &E : exts) {
ret.push_back(E);
}
@@ -91,7 +91,7 @@ PackedStringArray _ResourceLoader::get_dependencies(const String &p_path) {
ResourceLoader::get_dependencies(p_path, &deps);
PackedStringArray ret;
- for (String &E : deps) {
+ for (const String &E : deps) {
ret.push_back(E);
}
@@ -141,7 +141,7 @@ Vector<String> _ResourceSaver::get_recognized_extensions(const RES &p_resource)
List<String> exts;
ResourceSaver::get_recognized_extensions(p_resource, &exts);
Vector<String> ret;
- for (String &E : exts) {
+ for (const String &E : exts) {
ret.push_back(E);
}
return ret;
@@ -268,7 +268,7 @@ String _OS::get_name() const {
Vector<String> _OS::get_cmdline_args() {
List<String> cmdline = OS::get_singleton()->get_cmdline_args();
Vector<String> cmdlinev;
- for (String &E : cmdline) {
+ for (const String &E : cmdline) {
cmdlinev.push_back(E);
}
@@ -355,20 +355,20 @@ void _OS::print_all_textures_by_size() {
List<Ref<Resource>> rsrc;
ResourceCache::get_cached_resources(&rsrc);
- for (Ref<Resource> E : rsrc) {
- if (!E->is_class("ImageTexture")) {
+ for (Ref<Resource> &res : rsrc) {
+ if (!res->is_class("ImageTexture")) {
continue;
}
- Size2 size = E->call("get_size");
- int fmt = E->call("get_format");
+ Size2 size = res->call("get_size");
+ int fmt = res->call("get_format");
_OSCoreBindImg img;
img.size = size;
img.fmt = fmt;
- img.path = E->get_path();
+ img.path = res->get_path();
img.vram = Image::get_image_data_size(img.size.width, img.size.height, Image::Format(img.fmt));
- img.id = E->get_instance_id();
+ img.id = res->get_instance_id();
total += img.vram;
imgs.push_back(img);
}
@@ -387,7 +387,7 @@ void _OS::print_resources_by_type(const Vector<String> &p_types) {
List<Ref<Resource>> resources;
ResourceCache::get_cached_resources(&resources);
- for (Ref<Resource> r : resources) {
+ for (const Ref<Resource> &r : resources) {
bool found = false;
for (int i = 0; i < p_types.size(); i++) {
@@ -1822,7 +1822,7 @@ PackedStringArray _ClassDB::get_class_list() const {
PackedStringArray ret;
ret.resize(classes.size());
int idx = 0;
- for (StringName &E : classes) {
+ for (const StringName &E : classes) {
ret.set(idx++, E);
}
@@ -1836,7 +1836,7 @@ PackedStringArray _ClassDB::get_inheriters_from_class(const StringName &p_class)
PackedStringArray ret;
ret.resize(classes.size());
int idx = 0;
- for (StringName &E : classes) {
+ for (const StringName &E : classes) {
ret.set(idx++, E);
}
@@ -1891,7 +1891,7 @@ Array _ClassDB::get_signal_list(StringName p_class, bool p_no_inheritance) const
ClassDB::get_signal_list(p_class, &signals, p_no_inheritance);
Array ret;
- for (MethodInfo &E : signals) {
+ for (const MethodInfo &E : signals) {
ret.push_back(E.operator Dictionary());
}
@@ -1902,7 +1902,7 @@ Array _ClassDB::get_property_list(StringName p_class, bool p_no_inheritance) con
List<PropertyInfo> plist;
ClassDB::get_property_list(p_class, &plist, p_no_inheritance);
Array ret;
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
ret.push_back(E.operator Dictionary());
}
@@ -1935,7 +1935,7 @@ Array _ClassDB::get_method_list(StringName p_class, bool p_no_inheritance) const
ClassDB::get_method_list(p_class, &methods, p_no_inheritance);
Array ret;
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
#ifdef DEBUG_METHODS_ENABLED
ret.push_back(E.operator Dictionary());
#else
@@ -1955,7 +1955,7 @@ PackedStringArray _ClassDB::get_integer_constant_list(const StringName &p_class,
PackedStringArray ret;
ret.resize(constants.size());
int idx = 0;
- for (String &E : constants) {
+ for (const String &E : constants) {
ret.set(idx++, E);
}
diff --git a/core/core_bind.h b/core/core_bind.h
index 43f74dc9bd..1574c36d3c 100644
--- a/core/core_bind.h
+++ b/core/core_bind.h
@@ -58,9 +58,9 @@ public:
};
enum CacheMode {
- CACHE_MODE_IGNORE, //resource and subresources do not use path cache, no path is set into resource.
- CACHE_MODE_REUSE, //resource and subresources use patch cache, reuse existing loaded resources instead of loading from disk when available
- CACHE_MODE_REPLACE, //resource and and subresource use path cache, but replace existing loaded resources when available with information from disk
+ CACHE_MODE_IGNORE, // Resource and subresources do not use path cache, no path is set into resource.
+ CACHE_MODE_REUSE, // Resource and subresources use patch cache, reuse existing loaded resources instead of loading from disk when available.
+ CACHE_MODE_REPLACE, // Resource and subresource use path cache, but replace existing loaded resources when available with information from disk.
};
static _ResourceLoader *get_singleton() { return singleton; }
diff --git a/core/debugger/debugger_marshalls.cpp b/core/debugger/debugger_marshalls.cpp
index b832dd58d5..2353a6ebf8 100644
--- a/core/debugger/debugger_marshalls.cpp
+++ b/core/debugger/debugger_marshalls.cpp
@@ -40,7 +40,7 @@ Array DebuggerMarshalls::ResourceUsage::serialize() {
Array arr;
arr.push_back(infos.size() * 4);
- for (ResourceInfo &E : infos) {
+ for (const ResourceInfo &E : infos) {
arr.push_back(E.path);
arr.push_back(E.format);
arr.push_back(E.type);
diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp
index 7d3abc9b46..0add12ff3d 100644
--- a/core/debugger/remote_debugger.cpp
+++ b/core/debugger/remote_debugger.cpp
@@ -427,7 +427,7 @@ void RemoteDebugger::_send_resource_usage() {
List<RS::TextureInfo> tinfo;
RS::get_singleton()->texture_debug_usage(&tinfo);
- for (RS::TextureInfo &E : tinfo) {
+ for (const RS::TextureInfo &E : tinfo) {
DebuggerMarshalls::ResourceInfo info;
info.path = E.path;
info.vram = E.bytes;
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp
index cc2974cbdb..660e215478 100644
--- a/core/extension/extension_api_dump.cpp
+++ b/core/extension/extension_api_dump.cpp
@@ -94,8 +94,8 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
{ Variant::NODE_PATH, ptrsize_32, ptrsize_64, ptrsize_32, ptrsize_64 },
{ Variant::RID, sizeof(uint64_t), sizeof(uint64_t), sizeof(uint64_t), sizeof(uint64_t) },
{ Variant::OBJECT, ptrsize_32, ptrsize_64, ptrsize_32, ptrsize_64 },
- { Variant::CALLABLE, sizeof(Callable), sizeof(Callable), sizeof(Callable), sizeof(Callable) }, //harcoded align
- { Variant::SIGNAL, sizeof(Signal), sizeof(Signal), sizeof(Signal), sizeof(Signal) }, //harcoded align
+ { Variant::CALLABLE, sizeof(Callable), sizeof(Callable), sizeof(Callable), sizeof(Callable) }, // Hardcoded align.
+ { Variant::SIGNAL, sizeof(Signal), sizeof(Signal), sizeof(Signal), sizeof(Signal) }, // Hardcoded align.
{ Variant::DICTIONARY, ptrsize_32, ptrsize_64, ptrsize_32, ptrsize_64 },
{ Variant::ARRAY, ptrsize_32, ptrsize_64, ptrsize_32, ptrsize_64 },
{ Variant::PACKED_BYTE_ARRAY, ptrsize_32, ptrsize_64, ptrsize_32, ptrsize_64 },
@@ -146,7 +146,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
}
{
- //member offsets sizes
+ // Member offsets sizes.
struct {
Variant::Type type;
const char *member;
@@ -180,7 +180,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
{ Variant::QUATERNION, "w", 3 * sizeof(float), 3 * sizeof(float), 3 * sizeof(double), 3 * sizeof(double) },
{ Variant::AABB, "position", 0, 0, 0, 0 },
{ Variant::AABB, "size", vec3_elems * sizeof(float), vec3_elems * sizeof(float), vec3_elems * sizeof(double), vec3_elems * sizeof(double) },
- //rememer that basis vectors are flipped!
+ // Remember that basis vectors are flipped!
{ Variant::BASIS, "x", 0, 0, 0, 0 },
{ Variant::BASIS, "y", vec3_elems * sizeof(float), vec3_elems * sizeof(float), vec3_elems * sizeof(double), vec3_elems * sizeof(double) },
{ Variant::BASIS, "z", vec3_elems * 2 * sizeof(float), vec3_elems * 2 * sizeof(float), vec3_elems * 2 * sizeof(double), vec3_elems * 2 * sizeof(double) },
@@ -251,7 +251,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
}
{
- // global enums and constants
+ // Global enums and constants.
Array constants;
Map<String, List<Pair<String, int>>> enum_list;
@@ -276,7 +276,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
Dictionary d1;
d1["name"] = E->key();
Array values;
- for (Pair<String, int> &F : E->get()) {
+ for (const Pair<String, int> &F : E->get()) {
Dictionary d2;
d2["name"] = F.first;
d2["value"] = F.second;
@@ -294,7 +294,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
List<StringName> utility_func_names;
Variant::get_utility_function_list(&utility_func_names);
- for (StringName &name : utility_func_names) {
+ for (const StringName &name : utility_func_names) {
Dictionary func;
func["name"] = String(name);
if (Variant::has_utility_function_return_value(name)) {
@@ -362,7 +362,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
List<StringName> member_names;
Variant::get_member_list(type, &member_names);
- for (StringName &member_name : member_names) {
+ for (const StringName &member_name : member_names) {
Dictionary d2;
d2["name"] = String(member_name);
d2["type"] = Variant::get_type_name(Variant::get_member_type(type, member_name));
@@ -378,7 +378,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
List<StringName> constant_names;
Variant::get_constants_for_type(type, &constant_names);
- for (StringName &constant_name : constant_names) {
+ for (const StringName &constant_name : constant_names) {
Dictionary d2;
d2["name"] = String(constant_name);
Variant constant = Variant::get_constant_value(type, constant_name);
@@ -417,7 +417,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
List<StringName> method_names;
Variant::get_builtin_method_list(type, &method_names);
- for (StringName &method_name : method_names) {
+ for (const StringName &method_name : method_names) {
Dictionary d2;
d2["name"] = String(method_name);
if (Variant::has_builtin_method_return_value(type, method_name)) {
@@ -499,7 +499,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
class_list.sort_custom<StringName::AlphCompare>();
- for (StringName &class_name : class_list) {
+ for (const StringName &class_name : class_list) {
Dictionary d;
d["name"] = String(class_name);
d["is_refcounted"] = ClassDB::is_parent_class(class_name, "RefCounted");
@@ -520,7 +520,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
Array constants;
List<String> constant_list;
ClassDB::get_integer_constant_list(class_name, &constant_list, true);
- for (String &F : constant_list) {
+ for (const String &F : constant_list) {
StringName enum_name = ClassDB::get_integer_constant_enum(class_name, F);
if (enum_name != StringName()) {
continue; //enums will be handled on their own
@@ -542,7 +542,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
Array enums;
List<StringName> enum_list;
ClassDB::get_enum_list(class_name, &enum_list, true);
- for (StringName &F : enum_list) {
+ for (const StringName &F : enum_list) {
Dictionary d2;
d2["name"] = String(F);
@@ -570,7 +570,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
Array methods;
List<MethodInfo> method_list;
ClassDB::get_method_list(class_name, &method_list, true);
- for (MethodInfo &F : method_list) {
+ for (const MethodInfo &F : method_list) {
StringName method_name = F.name;
if (F.flags & METHOD_FLAG_VIRTUAL) {
//virtual method
@@ -687,7 +687,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
Array signals;
List<MethodInfo> signal_list;
ClassDB::get_signal_list(class_name, &signal_list, true);
- for (MethodInfo &F : signal_list) {
+ for (const MethodInfo &F : signal_list) {
StringName signal_name = F.name;
Dictionary d2;
d2["name"] = String(signal_name);
@@ -723,7 +723,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
Array properties;
List<PropertyInfo> property_list;
ClassDB::get_property_list(class_name, &property_list, true);
- for (PropertyInfo &F : property_list) {
+ for (const PropertyInfo &F : property_list) {
if (F.usage & PROPERTY_USAGE_CATEGORY || F.usage & PROPERTY_USAGE_GROUP || F.usage & PROPERTY_USAGE_SUBGROUP) {
continue; //not real properties
}
@@ -766,7 +766,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
List<Engine::Singleton> singleton_list;
Engine::get_singleton()->get_singletons(&singleton_list);
- for (Engine::Singleton &s : singleton_list) {
+ for (const Engine::Singleton &s : singleton_list) {
Dictionary d;
d["name"] = s.name;
if (s.class_name != StringName()) {
diff --git a/core/extension/gdnative_interface.cpp b/core/extension/gdnative_interface.cpp
index 8f68b8d848..88fff342ee 100644
--- a/core/extension/gdnative_interface.cpp
+++ b/core/extension/gdnative_interface.cpp
@@ -281,8 +281,9 @@ static GDNativeBool gdnative_variant_has_key(const GDNativeVariantPtr p_self, co
const Variant *self = (const Variant *)p_self;
const Variant *key = (const Variant *)p_key;
bool valid;
- return self->has_key(*key, valid);
+ bool ret = self->has_key(*key, valid);
*r_valid = valid;
+ return ret;
}
static void gdnative_variant_get_type_name(GDNativeVariantType p_type, GDNativeStringPtr r_ret) {
diff --git a/core/extension/native_extension.cpp b/core/extension/native_extension.cpp
index 5f91e61102..16bc28e0a2 100644
--- a/core/extension/native_extension.cpp
+++ b/core/extension/native_extension.cpp
@@ -351,7 +351,7 @@ RES NativeExtensionResourceLoader::load(const String &p_path, const String &p_or
String library_path;
- for (String &E : libraries) {
+ for (const String &E : libraries) {
Vector<String> tags = E.split(".");
bool all_tags_met = true;
for (int i = 0; i < tags.size(); i++) {
diff --git a/core/input/input.cpp b/core/input/input.cpp
index e30e7c814f..c205726b0a 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -174,7 +174,7 @@ void Input::get_argument_options(const StringName &p_function, int p_idx, List<S
List<PropertyInfo> pinfo;
ProjectSettings::get_singleton()->get_property_list(&pinfo);
- for (PropertyInfo &pi : pinfo) {
+ for (const PropertyInfo &pi : pinfo) {
if (!pi.name.begins_with("input/")) {
continue;
}
diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp
index 0c8705b263..6714705bb5 100644
--- a/core/input/input_map.cpp
+++ b/core/input/input_map.cpp
@@ -65,7 +65,7 @@ String InputMap::_suggest_actions(const StringName &p_action) const {
float closest_similarity = 0.0;
// Find the most action with the most similar name.
- for (StringName &action : actions) {
+ for (const StringName &action : actions) {
const float similarity = String(action).similarity(p_action);
if (similarity > closest_similarity) {
@@ -261,7 +261,7 @@ void InputMap::load_from_project_settings() {
List<PropertyInfo> pinfo;
ProjectSettings::get_singleton()->get_property_list(&pinfo);
- for (PropertyInfo &pi : pinfo) {
+ for (const PropertyInfo &pi : pinfo) {
if (!pi.name.begins_with("input/")) {
continue;
}
diff --git a/core/io/dir_access.cpp b/core/io/dir_access.cpp
index e30a8dfdd0..8234adea06 100644
--- a/core/io/dir_access.cpp
+++ b/core/io/dir_access.cpp
@@ -93,7 +93,7 @@ static Error _erase_recursive(DirAccess *da) {
da->list_dir_end();
- for (String &E : dirs) {
+ for (const String &E : dirs) {
Error err = da->change_dir(E);
if (err == OK) {
err = _erase_recursive(da);
@@ -114,7 +114,7 @@ static Error _erase_recursive(DirAccess *da) {
}
}
- for (String &E : files) {
+ for (const String &E : files) {
Error err = da->remove(da->get_current_dir().plus_file(E));
if (err) {
return err;
@@ -362,7 +362,7 @@ Error DirAccess::_copy_dir(DirAccess *p_target_da, String p_to, int p_chmod_flag
list_dir_end();
- for (String &rel_path : dirs) {
+ for (const String &rel_path : dirs) {
String target_dir = p_to + rel_path;
if (!p_target_da->dir_exists(target_dir)) {
Error err = p_target_da->make_dir(target_dir);
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index b0bd328d21..b9fc416f65 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -35,7 +35,7 @@
bool ImageFormatLoader::recognize(const String &p_extension) const {
List<String> extensions;
get_recognized_extensions(&extensions);
- for (String &E : extensions) {
+ for (const String &E : extensions) {
if (E.nocasecmp_to(p_extension) == 0) {
return true;
}
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index 132c69b7da..cd1b6d1994 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -252,7 +252,7 @@ Array IP::_get_local_addresses() const {
Array addresses;
List<IPAddress> ip_addresses;
get_local_addresses(&ip_addresses);
- for (IPAddress &E : ip_addresses) {
+ for (const IPAddress &E : ip_addresses) {
addresses.push_back(E);
}
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 0381b78172..5823afbdcd 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -122,7 +122,7 @@ String JSON::_stringify(const Variant &p_var, const String &p_indent, int p_cur_
}
bool first_key = true;
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
if (first_key) {
first_key = false;
} else {
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 34d37dc99b..4a1d3e5212 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -1358,7 +1358,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
obj->get_property_list(&props);
int pc = 0;
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -1372,7 +1372,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4;
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -1418,7 +1418,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
List<Variant> keys;
d.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
/*
CharString utf8 = E->->utf8();
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index ee49335f55..80610e12cb 100644
--- a/core/io/multiplayer_api.cpp
+++ b/core/io/multiplayer_api.cpp
@@ -917,7 +917,7 @@ void MultiplayerAPI::_del_peer(int p_id) {
// Some refactoring is needed to make this faster and do paths GC.
List<NodePath> keys;
path_send_cache.get_key_list(&keys);
- for (NodePath &E : keys) {
+ for (const NodePath &E : keys) {
PathSentCache *psc = path_send_cache.getptr(E);
psc->confirmed_peers.erase(p_id);
}
diff --git a/core/io/packed_data_container.cpp b/core/io/packed_data_container.cpp
index ec43ea9311..4a76f0191d 100644
--- a/core/io/packed_data_container.cpp
+++ b/core/io/packed_data_container.cpp
@@ -268,7 +268,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
d.get_key_list(&keys);
List<DictKey> sortk;
- for (Variant &key : keys) {
+ for (const Variant &key : keys) {
DictKey dk;
dk.hash = key.hash();
dk.key = key;
@@ -278,7 +278,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
sortk.sort();
int idx = 0;
- for (DictKey &E : sortk) {
+ for (const DictKey &E : sortk) {
encode_uint32(E.hash, &tmpdata.write[pos + 8 + idx * 12 + 0]);
uint32_t ofs = _pack(E.key, tmpdata, string_cache);
encode_uint32(ofs, &tmpdata.write[pos + 8 + idx * 12 + 4]);
diff --git a/core/io/resource.cpp b/core/io/resource.cpp
index 695988bd71..727611a573 100644
--- a/core/io/resource.cpp
+++ b/core/io/resource.cpp
@@ -165,7 +165,7 @@ Error Resource::copy_from(const Ref<Resource> &p_resource) {
List<PropertyInfo> pi;
p_resource->get_property_list(&pi);
- for (PropertyInfo &E : pi) {
+ for (const PropertyInfo &E : pi) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -201,7 +201,7 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
r->local_scene = p_for_scene;
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -233,7 +233,7 @@ void Resource::configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, R
local_scene = p_for_scene;
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -259,7 +259,7 @@ Ref<Resource> Resource::duplicate(bool p_subresources) const {
Ref<Resource> r = (Resource *)ClassDB::instantiate(get_class());
ERR_FAIL_COND_V(r.is_null(), Ref<Resource>());
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -317,7 +317,7 @@ uint32_t Resource::hash_edited_version() const {
List<PropertyInfo> plist;
get_property_list(&plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (E.usage & PROPERTY_USAGE_STORAGE && E.type == Variant::OBJECT && E.hint == PROPERTY_HINT_RESOURCE_TYPE) {
RES res = get(E.name);
if (res.is_valid()) {
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 81ba5cc68d..a3ebc32cc5 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -935,7 +935,7 @@ void ResourceLoaderBinary::open(FileAccess *p_f, bool p_no_resources, bool p_kee
// If a UID is found and the path is valid, it will be used, otherwise, it falls back to the path.
er.path = ResourceUID::get_singleton()->get_id_path(er.uid);
} else {
- WARN_PRINT(String(res_path + ": In external resouce #" + itos(i) + ", invalid UUID: " + ResourceUID::get_singleton()->id_to_text(er.uid) + " - using text path instead: " + er.path).utf8().get_data());
+ WARN_PRINT(String(res_path + ": In external resource #" + itos(i) + ", invalid UUID: " + ResourceUID::get_singleton()->id_to_text(er.uid) + " - using text path instead: " + er.path).utf8().get_data());
}
}
}
@@ -1054,7 +1054,7 @@ void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String
extensions.sort();
- for (String &E : extensions) {
+ for (const String &E : extensions) {
String ext = E.to_lower();
p_extensions->push_back(ext);
}
@@ -1065,7 +1065,7 @@ void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_exten
ClassDB::get_resource_base_extensions(&extensions);
extensions.sort();
- for (String &E : extensions) {
+ for (const String &E : extensions) {
String ext = E.to_lower();
p_extensions->push_back(ext);
}
@@ -1603,7 +1603,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia
List<Variant> keys;
d.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
/*
if (!_check_type(dict[E]))
continue;
@@ -1760,7 +1760,7 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant
res->get_property_list(&property_list);
- for (PropertyInfo &E : property_list) {
+ for (const PropertyInfo &E : property_list) {
if (E.usage & PROPERTY_USAGE_STORAGE) {
Variant value = res->get(E.name);
if (E.usage & PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT) {
@@ -1798,7 +1798,7 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant
Dictionary d = p_variant;
List<Variant> keys;
d.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
_find_resources(E);
Variant v = d[E];
_find_resources(v);
@@ -1909,14 +1909,14 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
List<ResourceData> resources;
{
- for (RES &E : saved_resources) {
+ for (const RES &E : saved_resources) {
ResourceData &rd = resources.push_back(ResourceData())->get();
rd.type = E->get_class();
List<PropertyInfo> property_list;
E->get_property_list(&property_list);
- for (PropertyInfo &F : property_list) {
+ for (const PropertyInfo &F : property_list) {
if (skip_editor && F.name.begins_with("__editor")) {
continue;
}
@@ -2024,15 +2024,14 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
Vector<uint64_t> ofs_table;
//now actually save the resources
- for (ResourceData &rd : resources) {
+ for (const ResourceData &rd : resources) {
ofs_table.push_back(f->get_position());
save_unicode_string(f, rd.type);
f->store_32(rd.properties.size());
- for (Property &F : rd.properties) {
- Property &p = F;
+ for (const Property &p : rd.properties) {
f->store_32(p.name_idx);
- write_variant(f, p.value, resource_map, external_resources, string_map, F.pi);
+ write_variant(f, p.value, resource_map, external_resources, string_map, p.pi);
}
}
diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp
index e7c0176e5a..1e166015b0 100644
--- a/core/io/resource_importer.cpp
+++ b/core/io/resource_importer.cpp
@@ -148,7 +148,7 @@ void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extension
for (int i = 0; i < importers.size(); i++) {
List<String> local_exts;
importers[i]->get_recognized_extensions(&local_exts);
- for (String &F : local_exts) {
+ for (const String &F : local_exts) {
if (!found.has(F)) {
p_extensions->push_back(F);
found.insert(F);
@@ -177,7 +177,7 @@ void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_
List<String> local_exts;
importers[i]->get_recognized_extensions(&local_exts);
- for (String &F : local_exts) {
+ for (const String &F : local_exts) {
if (!found.has(F)) {
p_extensions->push_back(F);
found.insert(F);
@@ -385,7 +385,7 @@ void ResourceFormatImporter::get_importers_for_extension(const String &p_extensi
for (int i = 0; i < importers.size(); i++) {
List<String> local_exts;
importers[i]->get_recognized_extensions(&local_exts);
- for (String &F : local_exts) {
+ for (const String &F : local_exts) {
if (p_extension.to_lower() == F) {
r_importers->push_back(importers[i]);
}
@@ -406,7 +406,7 @@ Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_extension(const St
for (int i = 0; i < importers.size(); i++) {
List<String> local_exts;
importers[i]->get_recognized_extensions(&local_exts);
- for (String &F : local_exts) {
+ for (const String &F : local_exts) {
if (p_extension.to_lower() == F && importers[i]->get_priority() > priority) {
importer = importers[i];
priority = importers[i]->get_priority();
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 7e69b2ecab..d02d827443 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -58,7 +58,7 @@ bool ResourceFormatLoader::recognize_path(const String &p_path, const String &p_
get_recognized_extensions_for_type(p_for_type, &extensions);
}
- for (String &E : extensions) {
+ for (const String &E : extensions) {
if (E.nocasecmp_to(extension) == 0) {
return true;
}
@@ -937,7 +937,7 @@ void ResourceLoader::load_translation_remaps() {
Dictionary remaps = ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps");
List<Variant> keys;
remaps.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
Array langs = remaps[E];
Vector<String> lang_remaps;
lang_remaps.resize(langs.size());
@@ -1030,7 +1030,7 @@ void ResourceLoader::add_custom_loaders() {
List<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes);
- for (StringName &class_name : global_classes) {
+ for (const StringName &class_name : global_classes) {
StringName base_class = ScriptServer::get_global_class_native_base(class_name);
if (base_class == custom_loader_base_class) {
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index b9e234fdd2..e525e80a9d 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -40,9 +40,9 @@ class ResourceFormatLoader : public RefCounted {
public:
enum CacheMode {
- CACHE_MODE_IGNORE, //resource and subresources do not use path cache, no path is set into resource.
- CACHE_MODE_REUSE, //resource and subresources use patch cache, reuse existing loaded resources instead of loading from disk when available
- CACHE_MODE_REPLACE, //resource and and subresource use path cache, but replace existing loaded resources when available with information from disk
+ CACHE_MODE_IGNORE, // Resource and subresources do not use path cache, no path is set into resource.
+ CACHE_MODE_REUSE, // Resource and subresources use patch cache, reuse existing loaded resources instead of loading from disk when available.
+ CACHE_MODE_REPLACE, // Resource and subresource use path cache, but replace existing loaded resources when available with information from disk.
};
protected:
@@ -108,7 +108,7 @@ private:
friend class ResourceFormatImporter;
friend class ResourceInteractiveLoader;
- //internal load function
+ // Internal load function.
static RES _load(const String &p_path, const String &p_original_path, const String &p_type_hint, ResourceFormatLoader::CacheMode p_cache_mode, Error *r_error, bool p_use_sub_threads, float *r_progress);
static ResourceLoadedCallback _loaded_callback;
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 6158f421d1..564de5ee69 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -95,7 +95,7 @@ Error ResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t
bool recognized = false;
saver[i]->get_recognized_extensions(p_resource, &extensions);
- for (String &E : extensions) {
+ for (const String &E : extensions) {
if (E.nocasecmp_to(extension) == 0) {
recognized = true;
}
@@ -237,7 +237,7 @@ void ResourceSaver::add_custom_savers() {
List<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes);
- for (StringName &class_name : global_classes) {
+ for (const StringName &class_name : global_classes) {
StringName base_class = ScriptServer::get_global_class_native_base(class_name);
if (base_class == custom_saver_base_class) {
diff --git a/core/io/resource_uid.cpp b/core/io/resource_uid.cpp
index d4e8fcb6b0..97d683f415 100644
--- a/core/io/resource_uid.cpp
+++ b/core/io/resource_uid.cpp
@@ -249,7 +249,7 @@ void ResourceUID::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_id", "id", "path"), &ResourceUID::add_id);
ClassDB::bind_method(D_METHOD("set_id", "id", "path"), &ResourceUID::set_id);
ClassDB::bind_method(D_METHOD("get_id_path", "id"), &ResourceUID::get_id_path);
- ClassDB::bind_method(D_METHOD("remove_id", "id", "path"), &ResourceUID::remove_id);
+ ClassDB::bind_method(D_METHOD("remove_id", "id"), &ResourceUID::remove_id);
BIND_CONSTANT(INVALID_ID)
}
diff --git a/core/math/face3.h b/core/math/face3.h
index 5091b338ef..9e9026e54e 100644
--- a/core/math/face3.h
+++ b/core/math/face3.h
@@ -50,8 +50,8 @@ public:
/**
*
* @param p_plane plane used to split the face
- * @param p_res array of at least 3 faces, amount used in functio return
- * @param p_is_point_over array of at least 3 booleans, determining which face is over the plane, amount used in functio return
+ * @param p_res array of at least 3 faces, amount used in function return
+ * @param p_is_point_over array of at least 3 booleans, determining which face is over the plane, amount used in function return
* @param _epsilon constant used for numerical error rounding, to add "thickness" to the plane (so coplanar points can happen)
* @return amount of faces generated by the split, either 0 (means no split possible), 2 or 3
*/
diff --git a/core/math/geometry_3d.h b/core/math/geometry_3d.h
index 4ef9b4dbe6..766689e222 100644
--- a/core/math/geometry_3d.h
+++ b/core/math/geometry_3d.h
@@ -40,7 +40,7 @@ class Geometry3D {
public:
static void get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2, Vector3 &c1, Vector3 &c2) {
-// Do the function 'd' as defined by pb. I think is is dot product of some sort.
+// Do the function 'd' as defined by pb. I think it's a dot product of some sort.
#define d_of(m, n, o, p) ((m.x - n.x) * (o.x - p.x) + (m.y - n.y) * (o.y - p.y) + (m.z - n.z) * (o.z - p.z))
// Calculate the parametric position on the 2 curves, mua and mub.
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index 9b506269ea..0960fe19a6 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -336,7 +336,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
Map<Edge, RetFaceConnect> ret_edges;
List<Geometry3D::MeshData::Face> ret_faces;
- for (Face &E : faces) {
+ for (const Face &E : faces) {
Geometry3D::MeshData::Face f;
f.plane = E.plane;
@@ -439,7 +439,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
r_mesh.faces.resize(ret_faces.size());
int idx = 0;
- for (Geometry3D::MeshData::Face &E : ret_faces) {
+ for (const Geometry3D::MeshData::Face &E : ret_faces) {
r_mesh.faces.write[idx++] = E;
}
r_mesh.edges.resize(ret_edges.size());
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp
index 57495a4fbd..c6ba39be94 100644
--- a/core/object/class_db.cpp
+++ b/core/object/class_db.cpp
@@ -359,7 +359,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
//must be alphabetically sorted for hash to compute
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
ClassInfo *t = classes.getptr(E);
ERR_FAIL_COND_V_MSG(!t, 0, "Cannot get class '" + String(E) + "'.");
if (t->api != p_api || !t->exposed) {
@@ -388,7 +388,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
snames.sort_custom<StringName::AlphCompare>();
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
MethodBind *mb = t->method_map[F];
hash = hash_djb2_one_64(mb->get_name().hash(), hash);
hash = hash_djb2_one_64(mb->get_argument_count(), hash);
@@ -426,7 +426,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
snames.sort_custom<StringName::AlphCompare>();
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
hash = hash_djb2_one_64(F.hash(), hash);
hash = hash_djb2_one_64(t->constant_map[F], hash);
}
@@ -444,7 +444,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
snames.sort_custom<StringName::AlphCompare>();
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
MethodInfo &mi = t->signal_map[F];
hash = hash_djb2_one_64(F.hash(), hash);
for (int i = 0; i < mi.arguments.size(); i++) {
@@ -465,7 +465,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
snames.sort_custom<StringName::AlphCompare>();
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
PropertySetGet *psg = t->property_setget.getptr(F);
ERR_FAIL_COND_V(!psg, 0);
@@ -476,7 +476,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
}
//property list
- for (PropertyInfo &F : t->property_list) {
+ for (const PropertyInfo &F : t->property_list) {
hash = hash_djb2_one_64(F.name.hash(), hash);
hash = hash_djb2_one_64(F.type, hash);
hash = hash_djb2_one_64(F.hint, hash);
@@ -619,11 +619,11 @@ void ClassDB::get_method_list(const StringName &p_class, List<MethodInfo> *p_met
#ifdef DEBUG_METHODS_ENABLED
- for (MethodInfo &E : type->virtual_methods) {
+ for (const MethodInfo &E : type->virtual_methods) {
p_methods->push_back(E);
}
- for (StringName &E : type->method_order) {
+ for (const StringName &E : type->method_order) {
if (p_exclude_from_properties && type->methods_in_properties.has(E)) {
continue;
}
@@ -763,7 +763,7 @@ void ClassDB::get_integer_constant_list(const StringName &p_class, List<String>
while (type) {
#ifdef DEBUG_METHODS_ENABLED
- for (StringName &E : type->constant_order) {
+ for (const StringName &E : type->constant_order) {
p_constants->push_back(E);
}
#else
@@ -1073,10 +1073,12 @@ void ClassDB::get_property_list(const StringName &p_class, List<PropertyInfo> *p
ClassInfo *type = classes.getptr(p_class);
ClassInfo *check = type;
while (check) {
- for (PropertyInfo pi : check->property_list) {
+ for (const PropertyInfo &pi : check->property_list) {
if (p_validator) {
- p_validator->_validate_property(pi);
- p_list->push_back(pi);
+ // Making a copy as we may modify it.
+ PropertyInfo pi_mut = pi;
+ p_validator->_validate_property(pi_mut);
+ p_list->push_back(pi_mut);
} else {
p_list->push_back(pi);
}
@@ -1428,7 +1430,7 @@ void ClassDB::get_virtual_methods(const StringName &p_class, List<MethodInfo> *p
ClassInfo *type = classes.getptr(p_class);
ClassInfo *check = type;
while (check) {
- for (MethodInfo &E : check->virtual_methods) {
+ for (const MethodInfo &E : check->virtual_methods) {
p_methods->push_back(E);
}
@@ -1533,7 +1535,7 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
if (c) {
List<PropertyInfo> plist;
c->get_property_list(&plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (E.usage & (PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR)) {
if (!default_values[p_class].has(E.name)) {
Variant v = c->get(E.name);
diff --git a/core/object/object.cpp b/core/object/object.cpp
index 0e397d8518..d552d5e5e0 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -969,7 +969,7 @@ Vector<StringName> Object::_get_meta_list_bind() const {
List<Variant> keys;
metadata.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
_metaret.push_back(E);
}
@@ -979,7 +979,7 @@ Vector<StringName> Object::_get_meta_list_bind() const {
void Object::get_meta_list(List<StringName> *p_list) const {
List<Variant> keys;
metadata.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
p_list->push_back(E);
}
}
@@ -1184,7 +1184,7 @@ Array Object::_get_signal_list() const {
get_signal_list(&signal_list);
Array ret;
- for (MethodInfo &E : signal_list) {
+ for (const MethodInfo &E : signal_list) {
ret.push_back(Dictionary(E));
}
@@ -1197,7 +1197,7 @@ Array Object::_get_signal_connection_list(const String &p_signal) const {
Array ret;
- for (Connection &c : conns) {
+ for (const Connection &c : conns) {
if (c.signal.get_name() == p_signal) {
ret.push_back(c);
}
@@ -1499,7 +1499,7 @@ void Object::_clear_internal_resource_paths(const Variant &p_var) {
List<Variant> keys;
d.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
_clear_internal_resource_paths(E);
_clear_internal_resource_paths(d[E]);
}
@@ -1530,7 +1530,7 @@ void Object::clear_internal_resource_paths() {
get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
_clear_internal_resource_paths(get(E.name));
}
}
@@ -1665,7 +1665,7 @@ void Object::get_translatable_strings(List<String> *p_strings) const {
List<PropertyInfo> plist;
get_property_list(&plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (!(E.usage & PROPERTY_USAGE_INTERNATIONALIZED)) {
continue;
}
diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp
index 5aa032192e..0fb8c7350c 100644
--- a/core/object/script_language.cpp
+++ b/core/object/script_language.cpp
@@ -63,7 +63,7 @@ Array Script::_get_script_property_list() {
Array ret;
List<PropertyInfo> list;
get_script_property_list(&list);
- for (PropertyInfo &E : list) {
+ for (const PropertyInfo &E : list) {
ret.append(E.operator Dictionary());
}
return ret;
@@ -73,7 +73,7 @@ Array Script::_get_script_method_list() {
Array ret;
List<MethodInfo> list;
get_script_method_list(&list);
- for (MethodInfo &E : list) {
+ for (const MethodInfo &E : list) {
ret.append(E.operator Dictionary());
}
return ret;
@@ -83,7 +83,7 @@ Array Script::_get_script_signal_list() {
Array ret;
List<MethodInfo> list;
get_script_signal_list(&list);
- for (MethodInfo &E : list) {
+ for (const MethodInfo &E : list) {
ret.append(E.operator Dictionary());
}
return ret;
@@ -257,7 +257,7 @@ void ScriptServer::get_global_class_list(List<StringName> *r_global_classes) {
classes.push_back(*K);
}
classes.sort_custom<StringName::AlphCompare>();
- for (StringName &E : classes) {
+ for (const StringName &E : classes) {
r_global_classes->push_back(E);
}
}
@@ -266,7 +266,7 @@ void ScriptServer::save_global_classes() {
List<StringName> gc;
get_global_class_list(&gc);
Array gcarr;
- for (StringName &E : gc) {
+ for (const StringName &E : gc) {
Dictionary d;
d["class"] = E;
d["language"] = global_classes[E].language;
@@ -297,7 +297,7 @@ void ScriptServer::save_global_classes() {
void ScriptInstance::get_property_state(List<Pair<StringName, Variant>> &state) {
List<PropertyInfo> pinfo;
get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.usage & PROPERTY_USAGE_STORAGE) {
Pair<StringName, Variant> p;
p.first = E.name;
diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp
index 016d9d0a09..3c0e56f5a8 100644
--- a/core/os/main_loop.cpp
+++ b/core/os/main_loop.cpp
@@ -66,7 +66,7 @@ void MainLoop::initialize() {
}
}
-bool MainLoop::physics_process(float p_time) {
+bool MainLoop::physics_process(double p_time) {
if (get_script_instance()) {
return get_script_instance()->call("_physics_process", p_time);
}
@@ -74,7 +74,7 @@ bool MainLoop::physics_process(float p_time) {
return false;
}
-bool MainLoop::process(float p_time) {
+bool MainLoop::process(double p_time) {
if (get_script_instance()) {
return get_script_instance()->call("_process", p_time);
}
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index 34e944709b..b42e9b18ff 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -60,8 +60,8 @@ public:
};
virtual void initialize();
- virtual bool physics_process(float p_time);
- virtual bool process(float p_time);
+ virtual bool physics_process(double p_time);
+ virtual bool process(double p_time);
virtual void finalize();
void set_initialize_script(const Ref<Script> &p_initialize_script);
diff --git a/core/os/pool_allocator.h b/core/os/pool_allocator.h
index 15e50dac90..49f433ba97 100644
--- a/core/os/pool_allocator.h
+++ b/core/os/pool_allocator.h
@@ -37,7 +37,7 @@
@author Juan Linietsky <reduzio@gmail.com>
* Generic Pool Allocator.
* This is a generic memory pool allocator, with locking, compacting and alignment. (@TODO alignment)
- * It used as a standard way to manage alloction in a specific region of memory, such as texture memory,
+ * It used as a standard way to manage allocation in a specific region of memory, such as texture memory,
* audio sample memory, or just any kind of memory overall.
* (@TODO) abstraction should be greater, because in many platforms, you need to manage a nonreachable memory.
*/
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index c088390cf0..3d1cb4a8e1 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -297,7 +297,7 @@ void register_core_singletons() {
}
void register_core_extensions() {
- //harcoded for now
+ // Hardcoded for now.
if (ProjectSettings::get_singleton()->has_setting("native_extensions/paths")) {
Vector<String> paths = ProjectSettings::get_singleton()->get("native_extensions/paths");
for (int i = 0; i < paths.size(); i++) {
diff --git a/core/string/optimized_translation.cpp b/core/string/optimized_translation.cpp
index cf0b8d10db..5863bd1c46 100644
--- a/core/string/optimized_translation.cpp
+++ b/core/string/optimized_translation.cpp
@@ -66,7 +66,7 @@ void OptimizedTranslation::generate(const Ref<Translation> &p_from) {
int total_compression_size = 0;
int total_string_size = 0;
- for (StringName &E : keys) {
+ for (const StringName &E : keys) {
//hash string
CharString cs = E.operator String().utf8();
uint32_t h = hash(0, cs.get_data());
diff --git a/core/string/translation.cpp b/core/string/translation.cpp
index 981954c8ae..19d23fd375 100644
--- a/core/string/translation.cpp
+++ b/core/string/translation.cpp
@@ -841,7 +841,7 @@ Vector<String> Translation::_get_message_list() const {
void Translation::_set_messages(const Dictionary &p_messages) {
List<Variant> keys;
p_messages.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
translation_map[E] = p_messages[E];
}
}
diff --git a/core/string/translation_po.cpp b/core/string/translation_po.cpp
index afd3b76588..1da00aa54b 100644
--- a/core/string/translation_po.cpp
+++ b/core/string/translation_po.cpp
@@ -47,7 +47,7 @@ void TranslationPO::print_translation_map() {
List<StringName> context_l;
translation_map.get_key_list(&context_l);
- for (StringName &ctx : context_l) {
+ for (const StringName &ctx : context_l) {
file->store_line(" ===== Context: " + String::utf8(String(ctx).utf8()) + " ===== ");
const HashMap<StringName, Vector<StringName>> &inner_map = translation_map[ctx];
@@ -73,7 +73,7 @@ Dictionary TranslationPO::_get_messages() const {
List<StringName> context_l;
translation_map.get_key_list(&context_l);
- for (StringName &ctx : context_l) {
+ for (const StringName &ctx : context_l) {
const HashMap<StringName, Vector<StringName>> &id_str_map = translation_map[ctx];
Dictionary d2;
@@ -96,7 +96,7 @@ void TranslationPO::_set_messages(const Dictionary &p_messages) {
List<Variant> context_l;
p_messages.get_key_list(&context_l);
- for (Variant &ctx : context_l) {
+ for (const Variant &ctx : context_l) {
const Dictionary &id_str_map = p_messages[ctx];
HashMap<StringName, Vector<StringName>> temp_map;
@@ -118,7 +118,7 @@ Vector<String> TranslationPO::_get_message_list() const {
get_message_list(&msgs);
Vector<String> v;
- for (StringName &E : msgs) {
+ for (const StringName &E : msgs) {
v.push_back(E);
}
@@ -278,7 +278,7 @@ void TranslationPO::get_message_list(List<StringName> *r_messages) const {
List<StringName> context_l;
translation_map.get_key_list(&context_l);
- for (StringName &E : context_l) {
+ for (const StringName &E : context_l) {
if (String(E) != "") {
continue;
}
@@ -297,7 +297,7 @@ int TranslationPO::get_message_count() const {
translation_map.get_key_list(&context_l);
int count = 0;
- for (StringName &E : context_l) {
+ for (const StringName &E : context_l) {
count += translation_map[E].size();
}
return count;
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index dbb8dc8283..7beecdb6b5 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -3421,7 +3421,7 @@ String String::format(const Variant &values, String placeholder) const {
List<Variant> keys;
d.get_key_list(&keys);
- for (Variant &key : keys) {
+ for (const Variant &key : keys) {
new_string = new_string.replace(placeholder.replace("_", key), d[key]);
}
} else {
diff --git a/core/templates/command_queue_mt.h b/core/templates/command_queue_mt.h
index acc46da0d5..519a896ffc 100644
--- a/core/templates/command_queue_mt.h
+++ b/core/templates/command_queue_mt.h
@@ -321,7 +321,7 @@ class CommandQueueMT {
DECL_CMD(0)
SPACE_SEP_LIST(DECL_CMD, 15)
- /* comands that return */
+ // Commands that return.
DECL_CMD_RET(0)
SPACE_SEP_LIST(DECL_CMD_RET, 15)
diff --git a/core/templates/rid_owner.h b/core/templates/rid_owner.h
index 4f5c74ca46..8d139551ef 100644
--- a/core/templates/rid_owner.h
+++ b/core/templates/rid_owner.h
@@ -101,7 +101,7 @@ class RID_Alloc : public RID_AllocBase {
//initialize
for (uint32_t i = 0; i < elements_in_chunk; i++) {
- //dont initialize chunk
+ // Don't initialize chunk.
validator_chunks[chunk_count][i] = 0xFFFFFFFF;
free_list_chunks[chunk_count][i] = alloc_count + i;
}
diff --git a/core/templates/set.h b/core/templates/set.h
index 245c174862..9261d2d3d2 100644
--- a/core/templates/set.h
+++ b/core/templates/set.h
@@ -71,6 +71,9 @@ public:
Element *prev() {
return _prev;
}
+ T &get() {
+ return value;
+ }
const T &get() const {
return value;
};
@@ -118,8 +121,8 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const Iterator &b) const { return E == b.E; }
- _FORCE_INLINE_ bool operator!=(const Iterator &b) const { return E != b.E; }
+ _FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return E == b.E; }
+ _FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return E != b.E; }
_FORCE_INLINE_ ConstIterator(const Element *p_E) { E = p_E; }
_FORCE_INLINE_ ConstIterator() {}
diff --git a/core/variant/callable.cpp b/core/variant/callable.cpp
index 2a3a9a4f1a..f487e718f4 100644
--- a/core/variant/callable.cpp
+++ b/core/variant/callable.cpp
@@ -407,7 +407,7 @@ Array Signal::get_connections() const {
object->get_signal_connection_list(name, &connections);
Array arr;
- for (Object::Connection &E : connections) {
+ for (const Object::Connection &E : connections) {
arr.push_back(E);
}
return arr;
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index 12b6465005..97a1b4c02a 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -1681,7 +1681,7 @@ String Variant::stringify(List<const void *> &stack) const {
Vector<_VariantStrPair> pairs;
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
_VariantStrPair sp;
sp.key = E.stringify(stack);
sp.value = d[E].stringify(stack);
diff --git a/core/variant/variant.h b/core/variant/variant.h
index 6d1b4da9e8..4dc706e853 100644
--- a/core/variant/variant.h
+++ b/core/variant/variant.h
@@ -253,7 +253,7 @@ private:
true, //PACKED_COLOR_ARRAY,
};
- if (unlikely(needs_deinit[type])) { //make it fast for types that dont need deinit
+ if (unlikely(needs_deinit[type])) { // Make it fast for types that don't need deinit.
_clear_internal();
}
type = NIL;
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index a9645da045..f8538f71d3 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -1124,7 +1124,7 @@ bool Variant::has_builtin_method_return_value(Variant::Type p_type, const String
void Variant::get_builtin_method_list(Variant::Type p_type, List<StringName> *p_list) {
ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX);
- for (StringName &E : builtin_method_names[p_type]) {
+ for (const StringName &E : builtin_method_names[p_type]) {
p_list->push_back(E);
}
}
@@ -1188,7 +1188,7 @@ void Variant::get_method_list(List<MethodInfo> *p_list) const {
obj->get_method_list(p_list);
}
} else {
- for (StringName &E : builtin_method_names[type]) {
+ for (const StringName &E : builtin_method_names[type]) {
const VariantBuiltInMethodInfo *method = builtin_method_info[type].lookup_ptr(E);
ERR_CONTINUE(!method);
diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp
index dc92ac8ac4..50c48fd386 100644
--- a/core/variant/variant_parser.cpp
+++ b/core/variant/variant_parser.cpp
@@ -1586,7 +1586,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
List<PropertyInfo> props;
obj->get_property_list(&props);
bool first = true;
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (E.usage & PROPERTY_USAGE_STORAGE || E.usage & PROPERTY_USAGE_SCRIPT_VARIABLE) {
//must be serialized
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp
index 62228ea87c..ae3c7685fd 100644
--- a/core/variant/variant_setget.cpp
+++ b/core/variant/variant_setget.cpp
@@ -1093,7 +1093,7 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const {
const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem);
List<Variant> keys;
dic->get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
if (E.get_type() == Variant::STRING) {
p_list->push_back(PropertyInfo(Variant::STRING, E));
}
@@ -1106,7 +1106,7 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const {
} else {
List<StringName> members;
get_member_list(type, &members);
- for (StringName &E : members) {
+ for (const StringName &E : members) {
PropertyInfo pi;
pi.name = E;
pi.type = get_member_type(type, E);
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index e9fa952af3..64f07e075e 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -1397,7 +1397,7 @@ uint32_t Variant::get_utility_function_hash(const StringName &p_name) {
}
void Variant::get_utility_function_list(List<StringName> *r_functions) {
- for (StringName &E : utility_function_name_table) {
+ for (const StringName &E : utility_function_name_table) {
r_functions->push_back(E);
}
}
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 79b3788449..5c0856cb6a 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -1229,11 +1229,13 @@
<signal name="mouse_entered">
<description>
Emitted when the mouse enters the control's [code]Rect[/code] area, provided its [member mouse_filter] lets the event reach it.
+ [b]Note:[/b] [signal mouse_entered] will not be emitted if the mouse enters a child [Control] node before entering the parent's [code]Rect[/code] area, at least until the mouse is moved to reach the parent's [code]Rect[/code] area.
</description>
</signal>
<signal name="mouse_exited">
<description>
Emitted when the mouse leaves the control's [code]Rect[/code] area, provided its [member mouse_filter] lets the event reach it.
+ [b]Note:[/b] [signal mouse_exited] will be emitted if the mouse enters a child [Control] node, even if the mouse cursor is still inside the parent's [code]Rect[/code] area.
</description>
</signal>
<signal name="resized">
diff --git a/doc/classes/EditorNode3DGizmoPlugin.xml b/doc/classes/EditorNode3DGizmoPlugin.xml
index 10d6bd8bc8..6152487eaf 100644
--- a/doc/classes/EditorNode3DGizmoPlugin.xml
+++ b/doc/classes/EditorNode3DGizmoPlugin.xml
@@ -46,7 +46,7 @@
</argument>
<description>
Override this method to commit a group of subgizmos being edited (see [method _subgizmos_intersect_ray] and [method _subgizmos_intersect_frustum]). This usually means creating an [UndoRedo] action for the change, using the current transforms as "do" and the [code]restore[/code] transforms as "undo".
- If the [code]cancel[/code] argument is [code]true[/code], the [code]restore[/code] transforms should be directly set, without any [UndoRedo] action. Called for this plugin's active gizmos.
+ If the [code]cancel[/code] argument is [code]true[/code], the [code]restore[/code] transforms should be directly set, without any [UndoRedo] action. As with all subgizmo methods, transforms are given in local space respect to the gizmo's Node3D. Called for this plugin's active gizmos.
</description>
</method>
<method name="_create_gizmo" qualifiers="virtual">
@@ -103,7 +103,7 @@
<argument index="1" name="id" type="int">
</argument>
<description>
- Override this method to return the current transform of a subgizmo. This transform will be requested at the start of an edit and used in the [code]restore[/code] argument in [method _commit_subgizmos]. Called for this plugin's active gizmos.
+ Override this method to return the current transform of a subgizmo. As with all subgizmo methods, the transform should be in local space respect to the gizmo's Node3D. This transform will be requested at the start of an edit and used in the [code]restore[/code] argument in [method _commit_subgizmos]. Called for this plugin's active gizmos.
</description>
</method>
<method name="_has_gizmo" qualifiers="virtual">
diff --git a/doc/classes/MethodTweener.xml b/doc/classes/MethodTweener.xml
index 42b91abf93..3badeb164b 100644
--- a/doc/classes/MethodTweener.xml
+++ b/doc/classes/MethodTweener.xml
@@ -4,7 +4,7 @@
Interpolates an abstract value and supplies it to a method called over time.
</brief_description>
<description>
- [MethodTweener] is similar to a combination of [CallbackTweener] and [PropertyTweener]. It calls a method providing an interpolated value as a paramater. See [method Tween.tween_method] for more usage information.
+ [MethodTweener] is similar to a combination of [CallbackTweener] and [PropertyTweener]. It calls a method providing an interpolated value as a parameter. See [method Tween.tween_method] for more usage information.
[b]Note:[/b] [method Tween.tween_method] is the only correct way to create [MethodTweener]. Any [MethodTweener] created manually will not function correctly.
</description>
<tutorials>
diff --git a/doc/classes/Node3D.xml b/doc/classes/Node3D.xml
index 9c05ed1ef6..8cb331a578 100644
--- a/doc/classes/Node3D.xml
+++ b/doc/classes/Node3D.xml
@@ -335,7 +335,7 @@
Local space [Transform3D] of this node, with respect to the parent node.
</member>
<member name="visibility_parent" type="NodePath" setter="set_visibility_parent" getter="get_visibility_parent" default="NodePath(&quot;&quot;)">
- Defines the visibility range parent for this node and its subtree. The visibility parent must be a GeometryInstance3D. Any visual instance will only be visible if the visibility parent (and all of its visibility ancestors) is hidden by being closer to the camera than its own [member GeometryInstance3D.visibility_range_begin]. Nodes hidden via the [member Node3D.visible] property are essentially removed from the visibility dependency tree, so dependant instances will not take the hidden node or its ancestors into account.
+ Defines the visibility range parent for this node and its subtree. The visibility parent must be a GeometryInstance3D. Any visual instance will only be visible if the visibility parent (and all of its visibility ancestors) is hidden by being closer to the camera than its own [member GeometryInstance3D.visibility_range_begin]. Nodes hidden via the [member Node3D.visible] property are essentially removed from the visibility dependency tree, so dependent instances will not take the hidden node or its ancestors into account.
</member>
<member name="visible" type="bool" setter="set_visible" getter="is_visible" default="true">
If [code]true[/code], this node is drawn. The node is only visible if all of its antecedents are visible as well (in other words, [method is_visible_in_tree] must return [code]true[/code]).
diff --git a/doc/classes/RDShaderFile.xml b/doc/classes/RDShaderFile.xml
index 346a97a1c0..dab2b9822f 100644
--- a/doc/classes/RDShaderFile.xml
+++ b/doc/classes/RDShaderFile.xml
@@ -7,8 +7,8 @@
<tutorials>
</tutorials>
<methods>
- <method name="get_bytecode" qualifiers="const">
- <return type="RDShaderBytecode">
+ <method name="get_spirv" qualifiers="const">
+ <return type="RDShaderSPIRV">
</return>
<argument index="0" name="version" type="StringName" default="&amp;&quot;&quot;">
</argument>
@@ -24,7 +24,7 @@
<method name="set_bytecode">
<return type="void">
</return>
- <argument index="0" name="bytecode" type="RDShaderBytecode">
+ <argument index="0" name="bytecode" type="RDShaderSPIRV">
</argument>
<argument index="1" name="version" type="StringName" default="&amp;&quot;&quot;">
</argument>
diff --git a/doc/classes/RDShaderBytecode.xml b/doc/classes/RDShaderSPIRV.xml
index 20bf9bdd72..c9aefe31dc 100644
--- a/doc/classes/RDShaderBytecode.xml
+++ b/doc/classes/RDShaderSPIRV.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RDShaderBytecode" inherits="Resource" version="4.0">
+<class name="RDShaderSPIRV" inherits="Resource" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml
index 901a985961..c73c2ddfd7 100644
--- a/doc/classes/RenderingDevice.xml
+++ b/doc/classes/RenderingDevice.xml
@@ -635,8 +635,16 @@
<description>
</description>
</method>
- <method name="shader_compile_from_source">
- <return type="RDShaderBytecode">
+ <method name="shader_compile_binary_from_spirv">
+ <return type="PackedByteArray">
+ </return>
+ <argument index="0" name="spirv_data" type="RDShaderSPIRV">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="shader_compile_spirv_from_source">
+ <return type="RDShaderSPIRV">
</return>
<argument index="0" name="shader_source" type="RDShaderSource">
</argument>
@@ -645,10 +653,18 @@
<description>
</description>
</method>
- <method name="shader_create">
+ <method name="shader_create_from_bytecode">
<return type="RID">
</return>
- <argument index="0" name="shader_data" type="RDShaderBytecode">
+ <argument index="0" name="binary_data" type="PackedByteArray">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="shader_create_from_spirv">
+ <return type="PackedByteArray">
+ </return>
+ <argument index="0" name="spirv_data" type="RDShaderSPIRV">
</argument>
<description>
</description>
diff --git a/doc/classes/ResourceUID.xml b/doc/classes/ResourceUID.xml
index 407aed72b2..9fe61d8008 100644
--- a/doc/classes/ResourceUID.xml
+++ b/doc/classes/ResourceUID.xml
@@ -47,6 +47,14 @@
<description>
</description>
</method>
+ <method name="remove_id">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_id">
<return type="void">
</return>
diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml
index bf51b4dfa7..9930665d26 100644
--- a/doc/classes/SceneTree.xml
+++ b/doc/classes/SceneTree.xml
@@ -132,7 +132,7 @@
<return type="Array">
</return>
<description>
- Returns an array of currently exising [Tween]s in the [SceneTree] (both running and paused).
+ Returns an array of currently existing [Tween]s in the [SceneTree] (both running and paused).
</description>
</method>
<method name="has_group" qualifiers="const">
diff --git a/doc/classes/Skeleton2D.xml b/doc/classes/Skeleton2D.xml
index 6665a4a9f6..1ae39dfc07 100644
--- a/doc/classes/Skeleton2D.xml
+++ b/doc/classes/Skeleton2D.xml
@@ -73,7 +73,7 @@
</argument>
<description>
Sets the local pose transform, [code]pose[/code], for the bone at [code]bone_idx[/code].
- [code]amount[/code] is the interpolation strengh that will be used when applying the pose, and [code]persistent[/code] determines if the applied pose will remain.
+ [code]amount[/code] is the interpolation strength that will be used when applying the pose, and [code]persistent[/code] determines if the applied pose will remain.
[b]Note:[/b] The pose transform needs to be a local transform relative to the [Bone2D] node at [code]bone_idx[/code]!
</description>
</method>
diff --git a/doc/classes/SkeletonModification2D.xml b/doc/classes/SkeletonModification2D.xml
index 8596dac76e..dfd0256d9b 100644
--- a/doc/classes/SkeletonModification2D.xml
+++ b/doc/classes/SkeletonModification2D.xml
@@ -14,7 +14,7 @@
<return type="void">
</return>
<description>
- Used for drawing [b]editor-only[/b] modification gizmos. This function will only be called in the Godot editor and can be overriden to draw custom gizmos.
+ Used for drawing [b]editor-only[/b] modification gizmos. This function will only be called in the Godot editor and can be overridden to draw custom gizmos.
[b]Note:[/b] You will need to use the Skeleton2D from [method SkeletonModificationStack2D.get_skeleton] and it's draw functions, as the [SkeletonModification2D] resource cannot draw on its own.
</description>
</method>
@@ -96,7 +96,7 @@
If [code]true[/code], the modification's [method _execute] function will be called by the [SkeletonModificationStack2D].
</member>
<member name="execution_mode" type="int" setter="set_execution_mode" getter="get_execution_mode" default="0">
- The execution mode for the modification. This tells the modification stack when to execute the modification. Some modifications have settings that are only availible in certain execution modes.
+ The execution mode for the modification. This tells the modification stack when to execute the modification. Some modifications have settings that are only available in certain execution modes.
</member>
</members>
<constants>
diff --git a/doc/classes/SkeletonModification2DCCDIK.xml b/doc/classes/SkeletonModification2DCCDIK.xml
index 014d366a42..1a74905df2 100644
--- a/doc/classes/SkeletonModification2DCCDIK.xml
+++ b/doc/classes/SkeletonModification2DCCDIK.xml
@@ -4,7 +4,7 @@
A modification that uses CCDIK to manipulate a series of bones to reach a target in 2D.
</brief_description>
<description>
- This [SkeletonModification2D] uses an algorithm called [b]C[/b]yclic [b]C[/b]oordinate [b]D[/b]escent [b]I[/b]nverse [b]K[/b]inematics, or CCDIK, to maniuplate a chain of bones in a [Skeleton2D] so it reaches a defined target.
+ This [SkeletonModification2D] uses an algorithm called [b]C[/b]yclic [b]C[/b]oordinate [b]D[/b]escent [b]I[/b]nverse [b]K[/b]inematics, or CCDIK, to manipulate a chain of bones in a [Skeleton2D] so it reaches a defined target.
CCDIK works by rotating a set of bones, typically called a "bone chain", on a single axis. Each bone is rotated to face the target from the tip (by default), which over a chain of bones allow it to rotate properly to reach the target. Because the bones only rotate on a single axis, CCDIK [i]can[/i] look more robotic than other IK solvers.
[b]Note:[/b] The CCDIK modifier has [code]ccdik_joints[/code], which are the data objects that hold the data for each joint in the CCDIK chain. This is different from a bone! CCDIK joints hold the data needed for each bone in the bone chain used by CCDIK.
CCDIK also fully supports angle constraints, allowing for more control over how a solution is met.
diff --git a/doc/classes/SkeletonModification2DJiggle.xml b/doc/classes/SkeletonModification2DJiggle.xml
index ae46acd0d0..da25191dc0 100644
--- a/doc/classes/SkeletonModification2DJiggle.xml
+++ b/doc/classes/SkeletonModification2DJiggle.xml
@@ -69,7 +69,7 @@
<argument index="0" name="joint_idx" type="int">
</argument>
<description>
- Returns a boolean that indiciates whether the joint at [code]joint_idx[/code] is overriding the default Jiggle joint data defined in the modification.
+ Returns a boolean that indicates whether the joint at [code]joint_idx[/code] is overriding the default Jiggle joint data defined in the modification.
</description>
</method>
<method name="get_jiggle_joint_stiffness" qualifiers="const">
@@ -87,7 +87,7 @@
<argument index="0" name="joint_idx" type="int">
</argument>
<description>
- Returns a boolean that indiciates whether the joint at [code]joint_idx[/code] is using gravity or not.
+ Returns a boolean that indicates whether the joint at [code]joint_idx[/code] is using gravity or not.
</description>
</method>
<method name="get_use_colliders" qualifiers="const">
@@ -206,19 +206,19 @@
</methods>
<members>
<member name="damping" type="float" setter="set_damping" getter="get_damping" default="0.75">
- The default amount of dampening applied to the Jiggle joints, if they are not overriden. Higher values lead to more of the calculated velocity being applied.
+ The default amount of dampening applied to the Jiggle joints, if they are not overridden. Higher values lead to more of the calculated velocity being applied.
</member>
<member name="gravity" type="Vector2" setter="set_gravity" getter="get_gravity" default="Vector2(0, 6)">
- The default amount of gravity applied to the Jiggle joints, if they are not overriden.
+ The default amount of gravity applied to the Jiggle joints, if they are not overridden.
</member>
<member name="jiggle_data_chain_length" type="int" setter="set_jiggle_data_chain_length" getter="get_jiggle_data_chain_length" default="0">
The amount of Jiggle joints in the Jiggle modification.
</member>
<member name="mass" type="float" setter="set_mass" getter="get_mass" default="0.75">
- The default amount of mass assigned to the Jiggle joints, if they are not overriden. Higher values lead to faster movements and more overshooting.
+ The default amount of mass assigned to the Jiggle joints, if they are not overridden. Higher values lead to faster movements and more overshooting.
</member>
<member name="stiffness" type="float" setter="set_stiffness" getter="get_stiffness" default="3.0">
- The default amount of stiffness assigned to the Jiggle joints, if they are not overriden. Higher values act more like springs, quickly moving into the correct position.
+ The default amount of stiffness assigned to the Jiggle joints, if they are not overridden. Higher values act more like springs, quickly moving into the correct position.
</member>
<member name="target_nodepath" type="NodePath" setter="set_target_node" getter="get_target_node" default="NodePath(&quot;&quot;)">
The NodePath to the node that is the target for the Jiggle modification. This node is what the Jiggle chain will attempt to rotate the bone chain to.
diff --git a/doc/classes/SkeletonModification2DTwoBoneIK.xml b/doc/classes/SkeletonModification2DTwoBoneIK.xml
index 554515556b..0eecfa635c 100644
--- a/doc/classes/SkeletonModification2DTwoBoneIK.xml
+++ b/doc/classes/SkeletonModification2DTwoBoneIK.xml
@@ -4,7 +4,7 @@
A modification that rotates two bones using the law of cosigns to reach the target.
</brief_description>
<description>
- This [SkeletonModification2D] uses an algorithm typically called TwoBoneIK. This algorithm works by leveraging the law of cosigns and the lengths of the bones to figure out what rotation the bones currently have, and what rotation they need to make a complete triangle, where the first bone, the second bone, and the target form the three verticies of the triangle. Because the algorithm works by making a triangle, it can only opperate on two bones.
+ This [SkeletonModification2D] uses an algorithm typically called TwoBoneIK. This algorithm works by leveraging the law of cosigns and the lengths of the bones to figure out what rotation the bones currently have, and what rotation they need to make a complete triangle, where the first bone, the second bone, and the target form the three vertices of the triangle. Because the algorithm works by making a triangle, it can only operate on two bones.
TwoBoneIK is great for arms, legs, and really any joints that can be represented by just two bones that bend to reach a target. This solver is more lightweight than [SkeletonModification2DFABRIK], but gives similar, natural looking results.
</description>
<tutorials>
diff --git a/doc/classes/SkeletonModificationStack2D.xml b/doc/classes/SkeletonModificationStack2D.xml
index 35b899fe08..4ffd2c33fb 100644
--- a/doc/classes/SkeletonModificationStack2D.xml
+++ b/doc/classes/SkeletonModificationStack2D.xml
@@ -54,7 +54,7 @@
<return type="bool">
</return>
<description>
- Returns a boolean that indiciates whether the modification stack is setup and can execute.
+ Returns a boolean that indicates whether the modification stack is setup and can execute.
</description>
</method>
<method name="get_modification" qualifiers="const">
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index e51bf42bdb..8d5f8f951c 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -127,7 +127,7 @@
<return type="Vector2">
</return>
<description>
- Gets the caret pixel draw poistion.
+ Gets the caret pixel draw position.
</description>
</method>
<method name="get_first_non_whitespace_column" qualifiers="const">
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml
index 253822cf32..4efb0a3309 100644
--- a/doc/classes/Tween.xml
+++ b/doc/classes/Tween.xml
@@ -125,7 +125,7 @@
<return type="Tween">
</return>
<description>
- Makes the next [Tweener] run parallely to the previous one. Example:
+ Makes the next [Tweener] run parallelly to the previous one. Example:
[codeblock]
var tween = create_tween()
tween.tween_property(...)
@@ -175,7 +175,7 @@
<argument index="0" name="parallel" type="bool" default="true">
</argument>
<description>
- If [code]parallel[/code] is [code]true[/code], the [Tweener]s appended after this method will by default run simultanously, as opposed to sequentially.
+ If [code]parallel[/code] is [code]true[/code], the [Tweener]s appended after this method will by default run simultaneously, as opposed to sequentially.
</description>
</method>
<method name="set_pause_mode">
diff --git a/doc/classes/Tweener.xml b/doc/classes/Tweener.xml
index 5cd502ced9..a3279502e0 100644
--- a/doc/classes/Tweener.xml
+++ b/doc/classes/Tweener.xml
@@ -13,7 +13,7 @@
<signals>
<signal name="finished">
<description>
- Emited when the [Tweener] has just finished its job.
+ Emitted when the [Tweener] has just finished its job.
</description>
</signal>
</signals>
diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp
index 4c33feb52c..e01c6a0e0f 100644
--- a/drivers/unix/net_socket_posix.cpp
+++ b/drivers/unix/net_socket_posix.cpp
@@ -269,7 +269,7 @@ _FORCE_INLINE_ Error NetSocketPosix::_change_multicast_group(IPAddress p_ip, Str
break; // IPv6 uses index.
}
- for (IPAddress &F : c.ip_addresses) {
+ for (const IPAddress &F : c.ip_addresses) {
if (!F.is_ipv4()) {
continue; // Wrong IP type
}
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 48e4be498b..9ee2a28240 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -31,11 +31,14 @@
#include "rendering_device_vulkan.h"
#include "core/config/project_settings.h"
+#include "core/io/compression.h"
#include "core/io/file_access.h"
+#include "core/io/marshalls.h"
#include "core/os/os.h"
#include "core/templates/hashfuncs.h"
#include "drivers/vulkan/vulkan_context.h"
+#include "thirdparty/misc/smolv.h"
#include "thirdparty/spirv-reflect/spirv_reflect.h"
//#define FORCE_FULL_BARRIER
@@ -4360,53 +4363,87 @@ bool RenderingDeviceVulkan::_uniform_add_binding(Vector<Vector<VkDescriptorSetLa
}
#endif
-RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages) {
- //descriptor layouts
- Vector<Vector<VkDescriptorSetLayoutBinding>> set_bindings;
- Vector<Vector<UniformInfo>> uniform_info;
- Shader::PushConstant push_constant;
- push_constant.push_constant_size = 0;
- push_constant.push_constants_vk_stage = 0;
+#define SHADER_BINARY_VERSION 1
- uint32_t vertex_input_mask = 0;
+String RenderingDeviceVulkan::shader_get_binary_cache_key() const {
+ return "Vulkan-SV" + itos(SHADER_BINARY_VERSION);
+}
- uint32_t fragment_outputs = 0;
+struct RenderingDeviceVulkanShaderBinaryDataBinding {
+ uint32_t type;
+ uint32_t binding;
+ uint32_t stages;
+ uint32_t length; //size of arrays (in total elements), or ubos (in bytes * total elements)
+};
- uint32_t stages_processed = 0;
+struct RenderingDeviceVulkanShaderBinarySpecializationConstant {
+ uint32_t type;
+ uint32_t constant_id;
+ union {
+ uint32_t int_value;
+ float float_value;
+ bool bool_value;
+ };
+ uint32_t stage_flags;
+};
- Vector<Shader::SpecializationConstant> specialization_constants;
+struct RenderingDeviceVulkanShaderBinaryData {
+ uint32_t vertex_input_mask;
+ uint32_t fragment_outputs;
+ uint32_t specialization_constant_count;
+ uint32_t is_compute;
+ uint32_t compute_local_size[3];
+ uint32_t set_count;
+ uint32_t push_constant_size;
+ uint32_t push_constants_vk_stage;
+ uint32_t stage_count;
+};
- bool is_compute = false;
+Vector<uint8_t> RenderingDeviceVulkan::shader_compile_binary_from_spirv(const Vector<ShaderStageSPIRVData> &p_spirv) {
+ RenderingDeviceVulkanShaderBinaryData binary_data;
+ binary_data.vertex_input_mask = 0;
+ binary_data.fragment_outputs = 0;
+ binary_data.specialization_constant_count = 0;
+ binary_data.is_compute = 0;
+ binary_data.compute_local_size[0] = 0;
+ binary_data.compute_local_size[1] = 0;
+ binary_data.compute_local_size[2] = 0;
+ binary_data.set_count = 0;
+ binary_data.push_constant_size = 0;
+ binary_data.push_constants_vk_stage = 0;
+
+ Vector<Vector<RenderingDeviceVulkanShaderBinaryDataBinding>> uniform_info; //set bindings
+ Vector<RenderingDeviceVulkanShaderBinarySpecializationConstant> specialization_constants;
- uint32_t compute_local_size[3] = { 0, 0, 0 };
+ uint32_t stages_processed = 0;
- for (int i = 0; i < p_stages.size(); i++) {
- if (p_stages[i].shader_stage == SHADER_STAGE_COMPUTE) {
- is_compute = true;
- ERR_FAIL_COND_V_MSG(p_stages.size() != 1, RID(),
+ for (int i = 0; i < p_spirv.size(); i++) {
+ if (p_spirv[i].shader_stage == SHADER_STAGE_COMPUTE) {
+ binary_data.is_compute = true;
+ ERR_FAIL_COND_V_MSG(p_spirv.size() != 1, Vector<uint8_t>(),
"Compute shaders can only receive one stage, dedicated to compute.");
}
- ERR_FAIL_COND_V_MSG(stages_processed & (1 << p_stages[i].shader_stage), RID(),
- "Stage " + String(shader_stage_names[p_stages[i].shader_stage]) + " submitted more than once.");
+ ERR_FAIL_COND_V_MSG(stages_processed & (1 << p_spirv[i].shader_stage), Vector<uint8_t>(),
+ "Stage " + String(shader_stage_names[p_spirv[i].shader_stage]) + " submitted more than once.");
{
SpvReflectShaderModule module;
- const uint8_t *spirv = p_stages[i].spir_v.ptr();
- SpvReflectResult result = spvReflectCreateShaderModule(p_stages[i].spir_v.size(), spirv, &module);
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed parsing shader.");
-
- if (is_compute) {
- compute_local_size[0] = module.entry_points->local_size.x;
- compute_local_size[1] = module.entry_points->local_size.y;
- compute_local_size[2] = module.entry_points->local_size.z;
+ const uint8_t *spirv = p_spirv[i].spir_v.ptr();
+ SpvReflectResult result = spvReflectCreateShaderModule(p_spirv[i].spir_v.size(), spirv, &module);
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed parsing shader.");
+
+ if (binary_data.is_compute) {
+ binary_data.compute_local_size[0] = module.entry_points->local_size.x;
+ binary_data.compute_local_size[1] = module.entry_points->local_size.y;
+ binary_data.compute_local_size[2] = module.entry_points->local_size.z;
}
uint32_t binding_count = 0;
result = spvReflectEnumerateDescriptorBindings(&module, &binding_count, nullptr);
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed enumerating descriptor bindings.");
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed enumerating descriptor bindings.");
- uint32_t stage = p_stages[i].shader_stage;
+ uint32_t stage = p_spirv[i].shader_stage;
if (binding_count > 0) {
//Parse bindings
@@ -4415,56 +4452,47 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
bindings.resize(binding_count);
result = spvReflectEnumerateDescriptorBindings(&module, &binding_count, bindings.ptrw());
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed getting descriptor bindings.");
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed getting descriptor bindings.");
for (uint32_t j = 0; j < binding_count; j++) {
const SpvReflectDescriptorBinding &binding = *bindings[j];
- VkDescriptorSetLayoutBinding layout_binding;
- UniformInfo info;
+ RenderingDeviceVulkanShaderBinaryDataBinding info;
bool need_array_dimensions = false;
bool need_block_size = false;
switch (binding.descriptor_type) {
case SPV_REFLECT_DESCRIPTOR_TYPE_SAMPLER: {
- layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
info.type = UNIFORM_TYPE_SAMPLER;
need_array_dimensions = true;
} break;
case SPV_REFLECT_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
- layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
info.type = UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
need_array_dimensions = true;
} break;
case SPV_REFLECT_DESCRIPTOR_TYPE_SAMPLED_IMAGE: {
- layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
info.type = UNIFORM_TYPE_TEXTURE;
need_array_dimensions = true;
} break;
case SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_IMAGE: {
- layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
info.type = UNIFORM_TYPE_IMAGE;
need_array_dimensions = true;
} break;
case SPV_REFLECT_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: {
- layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER;
info.type = UNIFORM_TYPE_TEXTURE_BUFFER;
need_array_dimensions = true;
} break;
case SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: {
- layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
info.type = UNIFORM_TYPE_IMAGE_BUFFER;
need_array_dimensions = true;
} break;
case SPV_REFLECT_DESCRIPTOR_TYPE_UNIFORM_BUFFER: {
- layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
info.type = UNIFORM_TYPE_UNIFORM_BUFFER;
need_block_size = true;
} break;
case SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_BUFFER: {
- layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
info.type = UNIFORM_TYPE_STORAGE_BUFFER;
need_block_size = true;
} break;
@@ -4477,7 +4505,6 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
continue;
} break;
case SPV_REFLECT_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: {
- layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
info.type = UNIFORM_TYPE_INPUT_ATTACHMENT;
} break;
case SPV_REFLECT_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: {
@@ -4499,42 +4526,35 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
}
}
- layout_binding.descriptorCount = info.length;
-
} else if (need_block_size) {
info.length = binding.block.size;
- layout_binding.descriptorCount = 1;
} else {
info.length = 0;
- layout_binding.descriptorCount = 1;
}
info.binding = binding.binding;
uint32_t set = binding.set;
- //print_line("Stage: " + String(shader_stage_names[stage]) + " set=" + itos(set) + " binding=" + itos(info.binding) + " type=" + shader_uniform_names[info.type] + " length=" + itos(info.length));
-
- ERR_FAIL_COND_V_MSG(set >= MAX_UNIFORM_SETS, RID(),
+ ERR_FAIL_COND_V_MSG(set >= MAX_UNIFORM_SETS, Vector<uint8_t>(),
"On shader stage '" + String(shader_stage_names[stage]) + "', uniform '" + binding.name + "' uses a set (" + itos(set) + ") index larger than what is supported (" + itos(MAX_UNIFORM_SETS) + ").");
- ERR_FAIL_COND_V_MSG(set >= limits.maxBoundDescriptorSets, RID(),
+ ERR_FAIL_COND_V_MSG(set >= limits.maxBoundDescriptorSets, Vector<uint8_t>(),
"On shader stage '" + String(shader_stage_names[stage]) + "', uniform '" + binding.name + "' uses a set (" + itos(set) + ") index larger than what is supported by the hardware (" + itos(limits.maxBoundDescriptorSets) + ").");
- if (set < (uint32_t)set_bindings.size()) {
+ if (set < (uint32_t)uniform_info.size()) {
//check if this already exists
bool exists = false;
- for (int k = 0; k < set_bindings[set].size(); k++) {
- if (set_bindings[set][k].binding == (uint32_t)info.binding) {
+ for (int k = 0; k < uniform_info[set].size(); k++) {
+ if (uniform_info[set][k].binding == (uint32_t)info.binding) {
//already exists, verify that it's the same type
- ERR_FAIL_COND_V_MSG(set_bindings[set][k].descriptorType != layout_binding.descriptorType, RID(),
+ ERR_FAIL_COND_V_MSG(uniform_info[set][k].type != info.type, Vector<uint8_t>(),
"On shader stage '" + String(shader_stage_names[stage]) + "', uniform '" + binding.name + "' trying to re-use location for set=" + itos(set) + ", binding=" + itos(info.binding) + " with different uniform type.");
//also, verify that it's the same size
- ERR_FAIL_COND_V_MSG(set_bindings[set][k].descriptorCount != layout_binding.descriptorCount || uniform_info[set][k].length != info.length, RID(),
+ ERR_FAIL_COND_V_MSG(uniform_info[set][k].length != info.length, Vector<uint8_t>(),
"On shader stage '" + String(shader_stage_names[stage]) + "', uniform '" + binding.name + "' trying to re-use location for set=" + itos(set) + ", binding=" + itos(info.binding) + " with different uniform size.");
//just append stage mask and return
- set_bindings.write[set].write[k].stageFlags |= shader_stage_masks[stage];
uniform_info.write[set].write[k].stages |= 1 << stage;
exists = true;
}
@@ -4545,19 +4565,12 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
}
}
- layout_binding.binding = info.binding;
- layout_binding.stageFlags = shader_stage_masks[stage];
- layout_binding.pImmutableSamplers = nullptr; //no support for this yet
-
info.stages = 1 << stage;
- info.binding = info.binding;
- if (set >= (uint32_t)set_bindings.size()) {
- set_bindings.resize(set + 1);
+ if (set >= (uint32_t)uniform_info.size()) {
uniform_info.resize(set + 1);
}
- set_bindings.write[set].push_back(layout_binding);
uniform_info.write[set].push_back(info);
}
}
@@ -4567,41 +4580,41 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
uint32_t sc_count = 0;
result = spvReflectEnumerateSpecializationConstants(&module, &sc_count, nullptr);
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed enumerating specialization constants.");
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed enumerating specialization constants.");
if (sc_count) {
Vector<SpvReflectSpecializationConstant *> spec_constants;
spec_constants.resize(sc_count);
result = spvReflectEnumerateSpecializationConstants(&module, &sc_count, spec_constants.ptrw());
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed obtaining specialization constants.");
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed obtaining specialization constants.");
for (uint32_t j = 0; j < sc_count; j++) {
int32_t existing = -1;
- Shader::SpecializationConstant sconst;
- sconst.constant.constant_id = spec_constants[j]->constant_id;
+ RenderingDeviceVulkanShaderBinarySpecializationConstant sconst;
+ sconst.constant_id = spec_constants[j]->constant_id;
switch (spec_constants[j]->constant_type) {
case SPV_REFLECT_SPECIALIZATION_CONSTANT_BOOL: {
- sconst.constant.type = PIPELINE_SPECIALIZATION_CONSTANT_TYPE_BOOL;
- sconst.constant.bool_value = spec_constants[j]->default_value.int_bool_value != 0;
+ sconst.type = PIPELINE_SPECIALIZATION_CONSTANT_TYPE_BOOL;
+ sconst.bool_value = spec_constants[j]->default_value.int_bool_value != 0;
} break;
case SPV_REFLECT_SPECIALIZATION_CONSTANT_INT: {
- sconst.constant.type = PIPELINE_SPECIALIZATION_CONSTANT_TYPE_INT;
- sconst.constant.int_value = spec_constants[j]->default_value.int_bool_value;
+ sconst.type = PIPELINE_SPECIALIZATION_CONSTANT_TYPE_INT;
+ sconst.int_value = spec_constants[j]->default_value.int_bool_value;
} break;
case SPV_REFLECT_SPECIALIZATION_CONSTANT_FLOAT: {
- sconst.constant.type = PIPELINE_SPECIALIZATION_CONSTANT_TYPE_FLOAT;
- sconst.constant.float_value = spec_constants[j]->default_value.float_value;
+ sconst.type = PIPELINE_SPECIALIZATION_CONSTANT_TYPE_FLOAT;
+ sconst.float_value = spec_constants[j]->default_value.float_value;
} break;
}
- sconst.stage_flags = 1 << p_stages[i].shader_stage;
+ sconst.stage_flags = 1 << p_spirv[i].shader_stage;
for (int k = 0; k < specialization_constants.size(); k++) {
- if (specialization_constants[k].constant.constant_id == sconst.constant.constant_id) {
- ERR_FAIL_COND_V_MSG(specialization_constants[k].constant.type != sconst.constant.type, RID(), "More than one specialization constant used for id (" + itos(sconst.constant.constant_id) + "), but their types differ.");
- ERR_FAIL_COND_V_MSG(specialization_constants[k].constant.int_value != sconst.constant.int_value, RID(), "More than one specialization constant used for id (" + itos(sconst.constant.constant_id) + "), but their default values differ.");
+ if (specialization_constants[k].constant_id == sconst.constant_id) {
+ ERR_FAIL_COND_V_MSG(specialization_constants[k].type != sconst.type, Vector<uint8_t>(), "More than one specialization constant used for id (" + itos(sconst.constant_id) + "), but their types differ.");
+ ERR_FAIL_COND_V_MSG(specialization_constants[k].int_value != sconst.int_value, Vector<uint8_t>(), "More than one specialization constant used for id (" + itos(sconst.constant_id) + "), but their default values differ.");
existing = k;
break;
}
@@ -4619,20 +4632,20 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
if (stage == SHADER_STAGE_VERTEX) {
uint32_t iv_count = 0;
result = spvReflectEnumerateInputVariables(&module, &iv_count, nullptr);
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed enumerating input variables.");
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed enumerating input variables.");
if (iv_count) {
Vector<SpvReflectInterfaceVariable *> input_vars;
input_vars.resize(iv_count);
result = spvReflectEnumerateInputVariables(&module, &iv_count, input_vars.ptrw());
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed obtaining input variables.");
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed obtaining input variables.");
for (uint32_t j = 0; j < iv_count; j++) {
if (input_vars[j] && input_vars[j]->decoration_flags == 0) { //regular input
- vertex_input_mask |= (1 << uint32_t(input_vars[j]->location));
+ binary_data.vertex_input_mask |= (1 << uint32_t(input_vars[j]->location));
}
}
}
@@ -4641,21 +4654,21 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
if (stage == SHADER_STAGE_FRAGMENT) {
uint32_t ov_count = 0;
result = spvReflectEnumerateOutputVariables(&module, &ov_count, nullptr);
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed enumerating output variables.");
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed enumerating output variables.");
if (ov_count) {
Vector<SpvReflectInterfaceVariable *> output_vars;
output_vars.resize(ov_count);
result = spvReflectEnumerateOutputVariables(&module, &ov_count, output_vars.ptrw());
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed obtaining output variables.");
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed obtaining output variables.");
for (uint32_t j = 0; j < ov_count; j++) {
const SpvReflectInterfaceVariable *refvar = output_vars[j];
if (refvar != nullptr && refvar->built_in != SpvBuiltInFragDepth) {
- fragment_outputs |= 1 << refvar->location;
+ binary_data.fragment_outputs |= 1 << refvar->location;
}
}
}
@@ -4663,18 +4676,18 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
uint32_t pc_count = 0;
result = spvReflectEnumeratePushConstantBlocks(&module, &pc_count, nullptr);
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed enumerating push constants.");
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed enumerating push constants.");
if (pc_count) {
- ERR_FAIL_COND_V_MSG(pc_count > 1, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "': Only one push constant is supported, which should be the same across shader stages.");
+ ERR_FAIL_COND_V_MSG(pc_count > 1, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "': Only one push constant is supported, which should be the same across shader stages.");
Vector<SpvReflectBlockVariable *> pconstants;
pconstants.resize(pc_count);
result = spvReflectEnumeratePushConstantBlocks(&module, &pc_count, pconstants.ptrw());
- ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed obtaining push constants.");
+ ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "' failed obtaining push constants.");
#if 0
if (pconstants[0] == nullptr) {
FileAccess *f = FileAccess::open("res://popo.spv", FileAccess::WRITE);
@@ -4683,11 +4696,11 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
}
#endif
- ERR_FAIL_COND_V_MSG(push_constant.push_constant_size && push_constant.push_constant_size != pconstants[0]->size, RID(),
- "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "': Push constant block must be the same across shader stages.");
+ ERR_FAIL_COND_V_MSG(binary_data.push_constant_size && binary_data.push_constant_size != pconstants[0]->size, Vector<uint8_t>(),
+ "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_spirv[i].shader_stage]) + "': Push constant block must be the same across shader stages.");
- push_constant.push_constant_size = pconstants[0]->size;
- push_constant.push_constants_vk_stage |= shader_stage_masks[stage];
+ binary_data.push_constant_size = pconstants[0]->size;
+ binary_data.push_constants_vk_stage |= shader_stage_masks[stage];
//print_line("Stage: " + String(shader_stage_names[stage]) + " push constant of size=" + itos(push_constant.push_constant_size));
}
@@ -4696,9 +4709,291 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
spvReflectDestroyShaderModule(&module);
}
- stages_processed |= (1 << p_stages[i].shader_stage);
+ stages_processed |= (1 << p_spirv[i].shader_stage);
+ }
+
+ Vector<Vector<uint8_t>> compressed_stages;
+ Vector<uint32_t> smolv_size;
+ Vector<uint32_t> zstd_size; //if 0, stdno t used
+
+ uint32_t stages_binary_size = 0;
+
+ bool strip_debug = false;
+
+ for (int i = 0; i < p_spirv.size(); i++) {
+ smolv::ByteArray smolv;
+ if (!smolv::Encode(p_spirv[i].spir_v.ptr(), p_spirv[i].spir_v.size(), smolv, strip_debug ? smolv::kEncodeFlagStripDebugInfo : 0)) {
+ ERR_FAIL_V_MSG(Vector<uint8_t>(), "Error compressing shader stage :" + String(shader_stage_names[p_spirv[i].shader_stage]));
+ } else {
+ smolv_size.push_back(smolv.size());
+ { //zstd
+ Vector<uint8_t> zstd;
+ zstd.resize(Compression::get_max_compressed_buffer_size(smolv.size(), Compression::MODE_ZSTD));
+ int dst_size = Compression::compress(zstd.ptrw(), &smolv[0], smolv.size(), Compression::MODE_ZSTD);
+
+ if (dst_size > 0 && (uint32_t)dst_size < smolv.size()) {
+ zstd_size.push_back(dst_size);
+ zstd.resize(dst_size);
+ compressed_stages.push_back(zstd);
+ } else {
+ Vector<uint8_t> smv;
+ smv.resize(smolv.size());
+ memcpy(smv.ptrw(), &smolv[0], smolv.size());
+ zstd_size.push_back(0); //not using zstd
+ compressed_stages.push_back(smv);
+ }
+ }
+ }
+ uint32_t s = compressed_stages[i].size();
+ if (s % 4 != 0) {
+ s += 4 - (s % 4);
+ }
+ stages_binary_size += s;
+ }
+
+ binary_data.specialization_constant_count = specialization_constants.size();
+ binary_data.set_count = uniform_info.size();
+ binary_data.stage_count = p_spirv.size();
+
+ uint32_t total_size = sizeof(uint32_t) * 3; //header + version + main datasize;
+ total_size += sizeof(RenderingDeviceVulkanShaderBinaryData);
+
+ for (int i = 0; i < uniform_info.size(); i++) {
+ total_size += sizeof(uint32_t);
+ total_size += uniform_info[i].size() * sizeof(RenderingDeviceVulkanShaderBinaryDataBinding);
+ }
+
+ total_size += sizeof(RenderingDeviceVulkanShaderBinarySpecializationConstant) * specialization_constants.size();
+
+ total_size += compressed_stages.size() * sizeof(uint32_t) * 3; //sizes
+ total_size += stages_binary_size;
+
+ Vector<uint8_t> ret;
+ ret.resize(total_size);
+ uint32_t offset = 0;
+ {
+ uint8_t *binptr = ret.ptrw();
+ binptr[0] = 'G';
+ binptr[1] = 'V';
+ binptr[2] = 'B';
+ binptr[3] = 'D'; //godot vulkan binary data
+ offset += 4;
+ encode_uint32(SHADER_BINARY_VERSION, binptr + offset);
+ offset += sizeof(uint32_t);
+ encode_uint32(sizeof(RenderingDeviceVulkanShaderBinaryData), binptr + offset);
+ offset += sizeof(uint32_t);
+ memcpy(binptr + offset, &binary_data, sizeof(RenderingDeviceVulkanShaderBinaryData));
+ offset += sizeof(RenderingDeviceVulkanShaderBinaryData);
+
+ for (int i = 0; i < uniform_info.size(); i++) {
+ int count = uniform_info[i].size();
+ encode_uint32(count, binptr + offset);
+ offset += sizeof(uint32_t);
+ if (count > 0) {
+ memcpy(binptr + offset, uniform_info[i].ptr(), sizeof(RenderingDeviceVulkanShaderBinaryDataBinding) * count);
+ offset += sizeof(RenderingDeviceVulkanShaderBinaryDataBinding) * count;
+ }
+ }
+
+ if (specialization_constants.size()) {
+ memcpy(binptr + offset, specialization_constants.ptr(), sizeof(RenderingDeviceVulkanShaderBinarySpecializationConstant) * specialization_constants.size());
+ offset += sizeof(RenderingDeviceVulkanShaderBinarySpecializationConstant) * specialization_constants.size();
+ }
+
+ for (int i = 0; i < compressed_stages.size(); i++) {
+ encode_uint32(p_spirv[i].shader_stage, binptr + offset);
+ offset += sizeof(uint32_t);
+ encode_uint32(smolv_size[i], binptr + offset);
+ offset += sizeof(uint32_t);
+ encode_uint32(zstd_size[i], binptr + offset);
+ offset += sizeof(uint32_t);
+ memcpy(binptr + offset, compressed_stages[i].ptr(), compressed_stages[i].size());
+
+ uint32_t s = compressed_stages[i].size();
+
+ if (s % 4 != 0) {
+ s += 4 - (s % 4);
+ }
+
+ offset += s;
+ }
+
+ ERR_FAIL_COND_V(offset != (uint32_t)ret.size(), Vector<uint8_t>());
}
+ return ret;
+}
+
+RID RenderingDeviceVulkan::shader_create_from_bytecode(const Vector<uint8_t> &p_shader_binary) {
+ const uint8_t *binptr = p_shader_binary.ptr();
+ uint32_t binsize = p_shader_binary.size();
+
+ uint32_t read_offset = 0;
+ //consistency check
+ ERR_FAIL_COND_V(binsize < sizeof(uint32_t) * 3 + sizeof(RenderingDeviceVulkanShaderBinaryData), RID());
+ ERR_FAIL_COND_V(binptr[0] != 'G' || binptr[1] != 'V' || binptr[2] != 'B' || binptr[3] != 'D', RID());
+
+ uint32_t bin_version = decode_uint32(binptr + 4);
+ ERR_FAIL_COND_V(bin_version > SHADER_BINARY_VERSION, RID());
+
+ uint32_t bin_data_size = decode_uint32(binptr + 8);
+
+ const RenderingDeviceVulkanShaderBinaryData &binary_data = *(const RenderingDeviceVulkanShaderBinaryData *)(binptr + 12);
+
+ Shader::PushConstant push_constant;
+ push_constant.push_constant_size = binary_data.push_constant_size;
+ push_constant.push_constants_vk_stage = binary_data.push_constants_vk_stage;
+
+ uint32_t vertex_input_mask = binary_data.vertex_input_mask;
+
+ uint32_t fragment_outputs = binary_data.fragment_outputs;
+
+ bool is_compute = binary_data.is_compute;
+
+ uint32_t compute_local_size[3] = { binary_data.compute_local_size[0], binary_data.compute_local_size[1], binary_data.compute_local_size[2] };
+
+ read_offset += sizeof(uint32_t) * 3 + bin_data_size;
+
+ Vector<Vector<VkDescriptorSetLayoutBinding>> set_bindings;
+ Vector<Vector<UniformInfo>> uniform_info;
+
+ set_bindings.resize(binary_data.set_count);
+ uniform_info.resize(binary_data.set_count);
+
+ for (uint32_t i = 0; i < binary_data.set_count; i++) {
+ ERR_FAIL_COND_V(read_offset + sizeof(uint32_t) >= binsize, RID());
+ uint32_t set_count = decode_uint32(binptr + read_offset);
+ read_offset += sizeof(uint32_t);
+ const RenderingDeviceVulkanShaderBinaryDataBinding *set_ptr = (const RenderingDeviceVulkanShaderBinaryDataBinding *)(binptr + read_offset);
+ uint32_t set_size = set_count * sizeof(RenderingDeviceVulkanShaderBinaryDataBinding);
+ ERR_FAIL_COND_V(read_offset + set_size >= binsize, RID());
+
+ for (uint32_t j = 0; j < set_count; j++) {
+ UniformInfo info;
+ info.type = UniformType(set_ptr[j].type);
+ info.length = set_ptr[j].length;
+ info.binding = set_ptr[j].binding;
+ info.stages = set_ptr[j].stages;
+
+ VkDescriptorSetLayoutBinding layout_binding;
+ layout_binding.pImmutableSamplers = nullptr;
+ layout_binding.binding = set_ptr[j].binding;
+ layout_binding.descriptorCount = 1;
+ layout_binding.stageFlags = 0;
+ for (uint32_t k = 0; k < SHADER_STAGE_MAX; k++) {
+ if (set_ptr[j].stages & (1 << k)) {
+ layout_binding.stageFlags |= shader_stage_masks[k];
+ }
+ }
+
+ switch (info.type) {
+ case UNIFORM_TYPE_SAMPLER: {
+ layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
+ layout_binding.descriptorCount = set_ptr[j].length;
+ } break;
+ case UNIFORM_TYPE_SAMPLER_WITH_TEXTURE: {
+ layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
+ layout_binding.descriptorCount = set_ptr[j].length;
+ } break;
+ case UNIFORM_TYPE_TEXTURE: {
+ layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
+ layout_binding.descriptorCount = set_ptr[j].length;
+ } break;
+ case UNIFORM_TYPE_IMAGE: {
+ layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
+ layout_binding.descriptorCount = set_ptr[j].length;
+ } break;
+ case UNIFORM_TYPE_TEXTURE_BUFFER: {
+ layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER;
+ layout_binding.descriptorCount = set_ptr[j].length;
+ } break;
+ case UNIFORM_TYPE_IMAGE_BUFFER: {
+ layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
+ } break;
+ case UNIFORM_TYPE_UNIFORM_BUFFER: {
+ layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
+ } break;
+ case UNIFORM_TYPE_STORAGE_BUFFER: {
+ layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
+ } break;
+ case UNIFORM_TYPE_INPUT_ATTACHMENT: {
+ layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
+ } break;
+ default: {
+ ERR_FAIL_V(RID());
+ }
+ }
+
+ set_bindings.write[i].push_back(layout_binding);
+ uniform_info.write[i].push_back(info);
+ }
+
+ read_offset += set_size;
+ }
+
+ ERR_FAIL_COND_V(read_offset + binary_data.specialization_constant_count * sizeof(RenderingDeviceVulkanShaderBinarySpecializationConstant) >= binsize, RID());
+
+ Vector<Shader::SpecializationConstant> specialization_constants;
+
+ for (uint32_t i = 0; i < binary_data.specialization_constant_count; i++) {
+ const RenderingDeviceVulkanShaderBinarySpecializationConstant &src_sc = *(const RenderingDeviceVulkanShaderBinarySpecializationConstant *)(binptr + read_offset);
+ Shader::SpecializationConstant sc;
+ sc.constant.int_value = src_sc.int_value;
+ sc.constant.type = PipelineSpecializationConstantType(src_sc.type);
+ sc.constant.constant_id = src_sc.constant_id;
+ sc.stage_flags = src_sc.stage_flags;
+ specialization_constants.push_back(sc);
+
+ read_offset += sizeof(RenderingDeviceVulkanShaderBinarySpecializationConstant);
+ }
+
+ Vector<Vector<uint8_t>> stage_spirv_data;
+ Vector<ShaderStage> stage_type;
+
+ for (uint32_t i = 0; i < binary_data.stage_count; i++) {
+ ERR_FAIL_COND_V(read_offset + sizeof(uint32_t) * 3 >= binsize, RID());
+ uint32_t stage = decode_uint32(binptr + read_offset);
+ read_offset += sizeof(uint32_t);
+ uint32_t smolv_size = decode_uint32(binptr + read_offset);
+ read_offset += sizeof(uint32_t);
+ uint32_t zstd_size = decode_uint32(binptr + read_offset);
+ read_offset += sizeof(uint32_t);
+
+ uint32_t buf_size = (zstd_size > 0) ? zstd_size : smolv_size;
+
+ Vector<uint8_t> smolv;
+ const uint8_t *src_smolv = nullptr;
+
+ if (zstd_size > 0) {
+ //decompress to smolv
+ smolv.resize(smolv_size);
+ int dec_smolv_size = Compression::decompress(smolv.ptrw(), smolv.size(), binptr + read_offset, zstd_size, Compression::MODE_ZSTD);
+ ERR_FAIL_COND_V(dec_smolv_size != (int32_t)smolv_size, RID());
+ src_smolv = smolv.ptr();
+ } else {
+ src_smolv = binptr + read_offset;
+ }
+
+ Vector<uint8_t> spirv;
+ uint32_t spirv_size = smolv::GetDecodedBufferSize(src_smolv, smolv_size);
+ spirv.resize(spirv_size);
+ if (!smolv::Decode(src_smolv, smolv_size, spirv.ptrw(), spirv_size)) {
+ ERR_FAIL_V_MSG(RID(), "Malformed smolv input uncompressing shader stage:" + String(shader_stage_names[stage]));
+ }
+ stage_spirv_data.push_back(spirv);
+ stage_type.push_back(ShaderStage(stage));
+
+ if (buf_size % 4 != 0) {
+ buf_size += 4 - (buf_size % 4);
+ }
+
+ ERR_FAIL_COND_V(read_offset + buf_size > binsize, RID());
+
+ read_offset += buf_size;
+ }
+
+ ERR_FAIL_COND_V(read_offset != binsize, RID());
+
//all good, let's create modules
_THREAD_SAFE_METHOD_
@@ -4717,13 +5012,13 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
String error_text;
bool success = true;
- for (int i = 0; i < p_stages.size(); i++) {
+ for (int i = 0; i < stage_spirv_data.size(); i++) {
VkShaderModuleCreateInfo shader_module_create_info;
shader_module_create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
shader_module_create_info.pNext = nullptr;
shader_module_create_info.flags = 0;
- shader_module_create_info.codeSize = p_stages[i].spir_v.size();
- const uint8_t *r = p_stages[i].spir_v.ptr();
+ shader_module_create_info.codeSize = stage_spirv_data[i].size();
+ const uint8_t *r = stage_spirv_data[i].ptr();
shader_module_create_info.pCode = (const uint32_t *)r;
@@ -4731,7 +5026,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
VkResult res = vkCreateShaderModule(device, &shader_module_create_info, nullptr, &module);
if (res) {
success = false;
- error_text = "Error (" + itos(res) + ") creating shader module for stage: " + String(shader_stage_names[p_stages[i].shader_stage]);
+ error_text = "Error (" + itos(res) + ") creating shader module for stage: " + String(shader_stage_names[stage_type[i]]);
break;
}
@@ -4747,7 +5042,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
shader_stage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shader_stage.pNext = nullptr;
shader_stage.flags = 0;
- shader_stage.stage = shader_stage_bits[p_stages[i].shader_stage];
+ shader_stage.stage = shader_stage_bits[stage_type[i]];
shader_stage.module = module;
shader_stage.pName = "main";
shader_stage.pSpecializationInfo = nullptr;
@@ -6037,7 +6332,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
specialization_info.resize(pipeline_stages.size());
specialization_map_entries.resize(pipeline_stages.size());
for (int i = 0; i < shader->specialization_constants.size(); i++) {
- //see if overriden
+ //see if overridden
const Shader::SpecializationConstant &sc = shader->specialization_constants[i];
data_ptr[i] = sc.constant.int_value; //just copy the 32 bits
@@ -6181,7 +6476,7 @@ RID RenderingDeviceVulkan::compute_pipeline_create(RID p_shader, const Vector<Pi
specialization_constant_data.resize(shader->specialization_constants.size());
uint32_t *data_ptr = specialization_constant_data.ptrw();
for (int i = 0; i < shader->specialization_constants.size(); i++) {
- //see if overriden
+ //see if overridden
const Shader::SpecializationConstant &sc = shader->specialization_constants[i];
data_ptr[i] = sc.constant.int_value; //just copy the 32 bits
@@ -8542,7 +8837,7 @@ void RenderingDeviceVulkan::_free_rids(T &p_owner, const char *p_type) {
} else {
WARN_PRINT(vformat("%d RIDs of type \"%s\" were leaked.", owned.size(), p_type));
}
- for (RID E : owned) {
+ for (const RID &E : owned) {
free(E);
}
}
@@ -8769,7 +9064,7 @@ void RenderingDeviceVulkan::finalize() {
E = N;
}
//free non shared second, this will avoid an error trying to free unexisting textures due to dependencies.
- for (RID E : owned) {
+ for (const RID &E : owned) {
free(E);
}
}
diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h
index 8b95ff43b8..f9ff61310a 100644
--- a/drivers/vulkan/rendering_device_vulkan.h
+++ b/drivers/vulkan/rendering_device_vulkan.h
@@ -652,8 +652,8 @@ class RenderingDeviceVulkan : public RenderingDevice {
// Basically, you can mix and match pools as you
// like, but you'll run into fragmentation issues.
// Because of this, the recommended approach is to
- // create a a pool for every descriptor set type,
- // as this prevents fragmentation.
+ // create a pool for every descriptor set type, as
+ // this prevents fragmentation.
//
// This is implemented here as a having a list of
// pools (each can contain up to 64 sets) for each
@@ -1083,7 +1083,11 @@ public:
/**** SHADER ****/
/****************/
- virtual RID shader_create(const Vector<ShaderStageData> &p_stages);
+ virtual String shader_get_binary_cache_key() const;
+ virtual Vector<uint8_t> shader_compile_binary_from_spirv(const Vector<ShaderStageSPIRVData> &p_spirv);
+
+ virtual RID shader_create_from_bytecode(const Vector<uint8_t> &p_shader_binary);
+
virtual uint32_t shader_get_vertex_input_attribute_mask(RID p_shader);
/*****************/
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index 0b4f4964c1..1e3140e202 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -898,7 +898,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
// 6-(undo) reinsert overlapped keys
- for (AnimMoveRestore &amr : to_restore) {
+ for (const AnimMoveRestore &amr : to_restore) {
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1);
}
@@ -1090,7 +1090,7 @@ void AnimationBezierTrackEdit::duplicate_selection() {
//reselect duplicated
selection.clear();
- for (Pair<int, float> &E : new_selection_values) {
+ for (const Pair<int, float> &E : new_selection_values) {
int track = E.first;
float time = E.second;
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 2adfc29f74..91835c1866 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -598,7 +598,7 @@ public:
if (ap) {
List<StringName> anims;
ap->get_animation_list(&anims);
- for (StringName &E : anims) {
+ for (const StringName &E : anims) {
if (animations != String()) {
animations += ",";
}
@@ -3356,7 +3356,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
}
insert_frame = Engine::get_singleton()->get_frames_drawn();
- for (InsertData &E : insert_data) {
+ for (const InsertData &E : insert_data) {
//prevent insertion of multiple tracks
if (E.path == p_id.path) {
return; //already inserted a track for this on this frame
@@ -3843,7 +3843,7 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b
List<PropertyInfo> pinfo;
property_info_base.get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.name == leftover_path[leftover_path.size() - 1]) {
return E;
}
@@ -4675,7 +4675,7 @@ void AnimationTrackEditor::_add_method_key(const String &p_method) {
List<MethodInfo> minfo;
base->get_method_list(&minfo);
- for (MethodInfo &E : minfo) {
+ for (const MethodInfo &E : minfo) {
if (E.name == p_method) {
Dictionary d;
d["method"] = p_method;
@@ -5150,7 +5150,7 @@ void AnimationTrackEditor::_anim_duplicate_keys(bool transpose) {
//reselect duplicated
Map<SelectedKey, KeyInfo> new_selection;
- for (Pair<int, float> &E : new_selection_values) {
+ for (const Pair<int, float> &E : new_selection_values) {
int track = E.first;
float time = E.second;
@@ -5541,7 +5541,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
if (cleanup_all->is_pressed()) {
List<StringName> names;
AnimationPlayerEditor::singleton->get_player()->get_animation_list(&names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
_cleanup_animation(AnimationPlayerEditor::singleton->get_player()->get_animation(E));
}
} else {
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 012276fe10..03695419cb 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -854,7 +854,7 @@ void CodeTextEditor::_complete_request() {
return;
}
- for (ScriptCodeCompletionOption &e : entries) {
+ for (const ScriptCodeCompletionOption &e : entries) {
Color font_color = completion_font_color;
if (e.insert_text.begins_with("\"") || e.insert_text.begins_with("\'")) {
font_color = completion_string_color;
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index f5cfe0fe57..c773f51342 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -1023,7 +1023,7 @@ void ConnectionsDock::update_tree() {
List<Object::Connection> connections;
selectedNode->get_signal_connection_list(signal_name, &connections);
- for (Object::Connection &F : connections) {
+ for (const Object::Connection &F : connections) {
Connection cn = F;
if (!(cn.flags & CONNECT_PERSIST)) {
continue;
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index abe17bf427..3389b53317 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -447,7 +447,7 @@ Variant CreateDialog::instance_selected() {
List<PropertyInfo> pinfo;
((Object *)obj)->get_property_list(&pinfo);
- for (PropertyInfo &pi : pinfo) {
+ for (const PropertyInfo &pi : pinfo) {
if (pi.type == Variant::OBJECT && pi.usage & PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT) {
Object *prop = ClassDB::instantiate(pi.class_name);
((Object *)obj)->set(pi.name, prop);
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 8af59a62de..9856fbec74 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -347,7 +347,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
uint64_t total = 0;
- for (DebuggerMarshalls::ResourceInfo &E : usage.infos) {
+ for (const DebuggerMarshalls::ResourceInfo &E : usage.infos) {
TreeItem *it = vmem_tree->create_item(root);
String type = E.type;
int bytes = E.vram;
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 3306fc3b44..069ae2c7f2 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -55,7 +55,7 @@ void DependencyEditor::_load_pressed(Object *p_item, int p_cell, int p_button) {
search->clear_filters();
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type(ti->get_metadata(0), &ext);
- for (String &E : ext) {
+ for (const String &E : ext) {
search->add_filter("*" + E);
}
search->popup_file_dialog();
@@ -120,7 +120,7 @@ void DependencyEditor::_fix_all() {
Map<String, Map<String, String>> candidates;
- for (String &E : missing) {
+ for (const String &E : missing) {
String base = E.get_file();
if (!candidates.has(base)) {
candidates[base] = Map<String, String>();
@@ -166,7 +166,7 @@ void DependencyEditor::_update_list() {
bool broken = false;
- for (String &n : deps) {
+ for (const String &n : deps) {
TreeItem *item = tree->create_item(root);
String path;
String type;
@@ -748,7 +748,7 @@ void OrphanResourcesDialog::_find_to_delete(TreeItem *p_item, List<String> &path
void OrphanResourcesDialog::_delete_confirm() {
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- for (String &E : paths) {
+ for (const String &E : paths) {
da->remove(E);
EditorFileSystem::get_singleton()->update_file(E);
}
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index 9258ff8043..cbd4a1b916 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -266,7 +266,7 @@ void DocTools::generate(bool p_basic_types) {
}
List<PropertyInfo>::Element *EO = own_properties.front();
- for (PropertyInfo &E : properties) {
+ for (const PropertyInfo &E : properties) {
bool inherited = EO == nullptr;
if (EO && EO->get() == E) {
inherited = false;
@@ -367,7 +367,7 @@ void DocTools::generate(bool p_basic_types) {
ClassDB::get_method_list(name, &method_list, true);
method_list.sort();
- for (MethodInfo &E : method_list) {
+ for (const MethodInfo &E : method_list) {
if (E.name == "" || (E.name[0] == '_' && !(E.flags & METHOD_FLAG_VIRTUAL))) {
continue; //hidden, don't count
}
@@ -455,7 +455,7 @@ void DocTools::generate(bool p_basic_types) {
List<String> constant_list;
ClassDB::get_integer_constant_list(name, &constant_list, true);
- for (String &E : constant_list) {
+ for (const String &E : constant_list) {
DocData::ConstantDoc constant;
constant.name = E;
constant.value = itos(ClassDB::get_integer_constant(name, E));
@@ -469,7 +469,7 @@ void DocTools::generate(bool p_basic_types) {
{
List<StringName> l;
Theme::get_default()->get_constant_list(cname, &l);
- for (StringName &E : l) {
+ for (const StringName &E : l) {
DocData::PropertyDoc pd;
pd.name = E;
pd.type = "int";
@@ -479,7 +479,7 @@ void DocTools::generate(bool p_basic_types) {
l.clear();
Theme::get_default()->get_color_list(cname, &l);
- for (StringName &E : l) {
+ for (const StringName &E : l) {
DocData::PropertyDoc pd;
pd.name = E;
pd.type = "Color";
@@ -489,7 +489,7 @@ void DocTools::generate(bool p_basic_types) {
l.clear();
Theme::get_default()->get_icon_list(cname, &l);
- for (StringName &E : l) {
+ for (const StringName &E : l) {
DocData::PropertyDoc pd;
pd.name = E;
pd.type = "Texture2D";
@@ -497,7 +497,7 @@ void DocTools::generate(bool p_basic_types) {
}
l.clear();
Theme::get_default()->get_font_list(cname, &l);
- for (StringName &E : l) {
+ for (const StringName &E : l) {
DocData::PropertyDoc pd;
pd.name = E;
pd.type = "Font";
@@ -505,7 +505,7 @@ void DocTools::generate(bool p_basic_types) {
}
l.clear();
Theme::get_default()->get_font_size_list(cname, &l);
- for (StringName &E : l) {
+ for (const StringName &E : l) {
DocData::PropertyDoc pd;
pd.name = E;
pd.type = "int";
@@ -513,7 +513,7 @@ void DocTools::generate(bool p_basic_types) {
}
l.clear();
Theme::get_default()->get_stylebox_list(cname, &l);
- for (StringName &E : l) {
+ for (const StringName &E : l) {
DocData::PropertyDoc pd;
pd.name = E;
pd.type = "StyleBox";
@@ -621,7 +621,7 @@ void DocTools::generate(bool p_basic_types) {
method_list.push_back(mi);
}
- for (MethodInfo &mi : method_list) {
+ for (const MethodInfo &mi : method_list) {
DocData::MethodDoc method;
method.name = mi.name;
@@ -674,7 +674,7 @@ void DocTools::generate(bool p_basic_types) {
List<PropertyInfo> properties;
v.get_property_list(&properties);
- for (PropertyInfo &pi : properties) {
+ for (const PropertyInfo &pi : properties) {
DocData::PropertyDoc property;
property.name = pi.name;
property.type = Variant::get_type_name(pi.type);
@@ -686,7 +686,7 @@ void DocTools::generate(bool p_basic_types) {
List<StringName> constants;
Variant::get_constants_for_type(Variant::Type(i), &constants);
- for (StringName &E : constants) {
+ for (const StringName &E : constants) {
DocData::ConstantDoc constant;
constant.name = E;
Variant value = Variant::get_constant_value(Variant::Type(i), E);
@@ -721,7 +721,7 @@ void DocTools::generate(bool p_basic_types) {
Engine::get_singleton()->get_singletons(&singletons);
//servers (this is kind of hackish)
- for (Engine::Singleton &s : singletons) {
+ for (const Engine::Singleton &s : singletons) {
DocData::PropertyDoc pd;
if (!s.ptr) {
continue;
@@ -740,7 +740,7 @@ void DocTools::generate(bool p_basic_types) {
List<StringName> utility_functions;
Variant::get_utility_function_list(&utility_functions);
utility_functions.sort_custom<StringName::AlphCompare>();
- for (StringName &E : utility_functions) {
+ for (const StringName &E : utility_functions) {
DocData::MethodDoc md;
md.name = E;
//return
@@ -790,7 +790,7 @@ void DocTools::generate(bool p_basic_types) {
List<MethodInfo> minfo;
lang->get_public_functions(&minfo);
- for (MethodInfo &mi : minfo) {
+ for (const MethodInfo &mi : minfo) {
DocData::MethodDoc md;
md.name = mi.name;
@@ -823,7 +823,7 @@ void DocTools::generate(bool p_basic_types) {
List<Pair<String, Variant>> cinfo;
lang->get_public_constants(&cinfo);
- for (Pair<String, Variant> &E : cinfo) {
+ for (const Pair<String, Variant> &E : cinfo) {
DocData::ConstantDoc cd;
cd.name = E.first;
cd.value = E.second;
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 5a85c8b31b..4a19f007d4 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -920,7 +920,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
List<StringName> effects;
ClassDB::get_inheriters_from_class("AudioEffect", &effects);
effects.sort_custom<StringName::AlphCompare>();
- for (StringName &E : effects) {
+ for (const StringName &E : effects) {
if (!ClassDB::can_instantiate(E)) {
continue;
}
@@ -1331,7 +1331,7 @@ EditorAudioBuses::EditorAudioBuses() {
file_dialog = memnew(EditorFileDialog);
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("AudioBusLayout", &ext);
- for (String &E : ext) {
+ for (const String &E : ext) {
file_dialog->add_filter("*." + E + "; Audio Bus Layout");
}
add_child(file_dialog);
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index e81f788290..fad76682b5 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -46,11 +46,11 @@ void EditorAutoloadSettings::_notification(int p_what) {
ResourceLoader::get_recognized_extensions_for_type("Script", &afn);
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &afn);
- for (String &E : afn) {
+ for (const String &E : afn) {
file_dialog->add_filter("*." + E);
}
- for (AutoLoadInfo &info : autoload_cache) {
+ for (const AutoLoadInfo &info : autoload_cache) {
if (info.node && info.in_editor) {
get_tree()->get_root()->call_deferred(SNAME("add_child"), info.node);
}
@@ -101,7 +101,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
List<String> keywords;
ScriptServer::get_language(i)->get_reserved_words(&keywords);
- for (String &E : keywords) {
+ for (const String &E : keywords) {
if (E == p_name) {
if (r_error) {
*r_error = TTR("Invalid name.") + "\n" + TTR("Keyword cannot be used as an autoload name.");
@@ -378,7 +378,7 @@ void EditorAutoloadSettings::update_autoload() {
Map<String, AutoLoadInfo> to_remove;
List<AutoLoadInfo *> to_add;
- for (AutoLoadInfo &info : autoload_cache) {
+ for (const AutoLoadInfo &info : autoload_cache) {
to_remove.insert(info.name, info);
}
@@ -390,7 +390,7 @@ void EditorAutoloadSettings::update_autoload() {
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
- for (PropertyInfo &pi : props) {
+ for (const PropertyInfo &pi : props) {
if (!pi.name.begins_with("autoload/")) {
continue;
}
@@ -643,7 +643,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &
int i = 0;
- for (AutoLoadInfo &F : autoload_cache) {
+ for (const AutoLoadInfo &F : autoload_cache) {
orders.write[i++] = F.order;
}
@@ -655,7 +655,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &
i = 0;
- for (AutoLoadInfo &F : autoload_cache) {
+ for (const AutoLoadInfo &F : autoload_cache) {
undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + F.name, orders[i++]);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + F.name, F.order);
}
@@ -758,7 +758,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
// Make first cache
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
- for (PropertyInfo &pi : props) {
+ for (const PropertyInfo &pi : props) {
if (!pi.name.begins_with("autoload/")) {
continue;
}
@@ -894,7 +894,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
}
EditorAutoloadSettings::~EditorAutoloadSettings() {
- for (AutoLoadInfo &info : autoload_cache) {
+ for (const AutoLoadInfo &info : autoload_cache) {
if (info.node && !info.in_editor) {
memdelete(info.node);
}
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 9204974d1a..c62e5b75b2 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -299,7 +299,7 @@ void EditorData::copy_object_params(Object *p_object) {
List<PropertyInfo> pinfo;
p_object->get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (!(E.usage & PROPERTY_USAGE_EDITOR) || E.name == "script" || E.name == "scripts") {
continue;
}
@@ -404,7 +404,7 @@ void EditorData::restore_editor_global_states() {
void EditorData::paste_object_params(Object *p_object) {
ERR_FAIL_NULL(p_object);
undo_redo.create_action(TTR("Paste Params"));
- for (PropertyData &E : clipboard) {
+ for (const PropertyData &E : clipboard) {
String name = E.name;
undo_redo.add_do_property(p_object, name, E.value);
undo_redo.add_undo_property(p_object, name, p_object->get(name));
@@ -616,7 +616,7 @@ bool EditorData::check_and_update_scene(int p_idx) {
//transfer selection
List<Node *> new_selection;
- for (Node *E : edited_scene.write[p_idx].selection) {
+ for (const Node *E : edited_scene.write[p_idx].selection) {
NodePath p = edited_scene[p_idx].root->get_path_to(E);
Node *new_node = new_scene->get_node(p);
if (new_node) {
@@ -964,7 +964,7 @@ void EditorData::script_class_save_icon_paths() {
_script_class_icon_paths.get_key_list(&keys);
Dictionary d;
- for (StringName &E : keys) {
+ for (const StringName &E : keys) {
if (ScriptServer::is_global_class(E)) {
d[E] = _script_class_icon_paths[E];
}
@@ -996,7 +996,7 @@ void EditorData::script_class_load_icon_paths() {
List<Variant> keys;
d.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
String name = E.operator String();
_script_class_icon_paths[name] = d[name];
@@ -1076,7 +1076,7 @@ bool EditorSelection::is_selected(Node *p_node) const {
Array EditorSelection::_get_transformable_selected_nodes() {
Array ret;
- for (Node *E : selected_node_list) {
+ for (const Node *E : selected_node_list) {
ret.push_back(E);
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index bec63fc078..b374f56f6d 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -436,7 +436,7 @@ Ref<EditorExportPreset> EditorExportPlatform::create_preset() {
List<ExportOption> options;
get_export_options(&options);
- for (ExportOption &E : options) {
+ for (const ExportOption &E : options) {
preset->properties.push_back(E.option);
preset->values[E.option.name] = E.default_value;
}
@@ -679,7 +679,7 @@ EditorExportPlatform::FeatureContainers EditorExportPlatform::get_feature_contai
platform->get_preset_features(p_preset, &feature_list);
FeatureContainers result;
- for (String &E : feature_list) {
+ for (const String &E : feature_list) {
result.features.insert(E);
result.features_pv.push_back(E);
}
@@ -752,7 +752,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
- for (PropertyInfo &pi : props) {
+ for (const PropertyInfo &pi : props) {
if (!pi.name.begins_with("autoload/")) {
continue;
}
@@ -897,7 +897,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
Set<String> remap_features;
- for (String &F : remaps) {
+ for (const String &F : remaps) {
String remap = F;
String feature = remap.get_slice(".", 1);
if (features.has(feature)) {
@@ -911,7 +911,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
err = OK;
- for (String &F : remaps) {
+ for (const String &F : remaps) {
String remap = F;
if (remap == "path") {
String remapped_path = config->get_value("remap", remap);
@@ -1647,7 +1647,7 @@ void EditorExport::load_config() {
config->get_section_keys(option_section, &options);
- for (String &E : options) {
+ for (const String &E : options) {
Variant value = config->get_value(option_section, E);
preset->set(E, value);
@@ -1689,7 +1689,7 @@ void EditorExport::update_export_presets() {
preset->properties.clear();
preset->values.clear();
- for (EditorExportPlatform::ExportOption &E : options) {
+ for (const EditorExportPlatform::ExportOption &E : options) {
preset->properties.push_back(E.option);
StringName option_name = E.option.name;
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index 1bc852000d..22f44a54bb 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -527,7 +527,7 @@ void EditorFeatureProfileManager::_fill_classes_from(TreeItem *p_parent, const S
ClassDB::get_direct_inheriters_from_class(p_class, &child_classes);
child_classes.sort_custom<StringName::AlphCompare>();
- for (StringName &name : child_classes) {
+ for (const StringName &name : child_classes) {
if (String(name).begins_with("Editor") || ClassDB::get_api_type(name) != ClassDB::API_CORE) {
continue;
}
@@ -596,7 +596,7 @@ void EditorFeatureProfileManager::_class_list_item_selected() {
TreeItem *properties = property_list->create_item(root);
properties->set_text(0, TTR("Class Properties:"));
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
String name = E.name;
if (!(E.usage & PROPERTY_USAGE_EDITOR)) {
continue;
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index f11e8d350d..5ccbed1b49 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -830,7 +830,7 @@ void EditorFileDialog::update_file_list() {
while (!files.is_empty()) {
bool match = patterns.is_empty();
- for (String &E : patterns) {
+ for (const String &E : patterns) {
if (files.front()->get().matchn(E)) {
match = true;
break;
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index d290db6431..78861eff9d 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -126,7 +126,7 @@ Vector<String> EditorFileSystemDirectory::get_file_deps(int p_idx) const {
}
ResourceUID::ID uid = ResourceUID::get_singleton()->text_to_id(dep);
if (uid != ResourceUID::INVALID_ID) {
- //return proper dependency resoure from uid
+ //return proper dependency resource from uid
if (ResourceUID::get_singleton()->has_id(uid)) {
dep = ResourceUID::get_singleton()->get_id_path(uid);
} else {
@@ -484,7 +484,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
memdelete(md5s);
//imported files are gone, reimport
- for (String &E : to_check) {
+ for (const String &E : to_check) {
if (!FileAccess::exists(E)) {
return true;
}
@@ -524,7 +524,7 @@ bool EditorFileSystem::_update_scan_actions() {
Vector<String> reimports;
Vector<String> reloads;
- for (ItemAction &ia : scan_actions) {
+ for (const ItemAction &ia : scan_actions) {
switch (ia.action) {
case ItemAction::ACTION_NONE: {
} break;
@@ -1072,7 +1072,7 @@ void EditorFileSystem::_delete_internal_files(String p_file) {
List<String> paths;
ResourceFormatImporter::get_singleton()->get_internal_resource_path_list(p_file, &paths);
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- for (String &E : paths) {
+ for (const String &E : paths) {
da->remove(E);
}
da->remove(p_file + ".import");
@@ -1413,7 +1413,7 @@ Vector<String> EditorFileSystem::_get_dependencies(const String &p_path) {
ResourceLoader::get_dependencies(p_path, &deps);
Vector<String> ret;
- for (String &E : deps) {
+ for (const String &E : deps) {
ret.push_back(E);
}
@@ -1609,14 +1609,14 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
List<ResourceImporter::ImportOption> options;
importer->get_import_options(&options);
//set default values
- for (ResourceImporter::ImportOption &E : options) {
+ for (const ResourceImporter::ImportOption &E : options) {
source_file_options[p_files[i]][E.option.name] = E.default_value;
}
if (config->has_section("params")) {
List<String> sk;
config->get_section_keys("params", &sk);
- for (String &param : sk) {
+ for (const String &param : sk) {
Variant value = config->get_value("params", param);
//override with whathever is in file
source_file_options[p_files[i]][param] = value;
@@ -1690,7 +1690,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
List<ResourceImporter::ImportOption> options;
importer->get_import_options(&options);
//set default values
- for (ResourceImporter::ImportOption &F : options) {
+ for (const ResourceImporter::ImportOption &F : options) {
String base = F.option.name;
Variant v = F.default_value;
if (source_file_options[file].has(base)) {
@@ -1773,7 +1773,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
if (cf->has_section("params")) {
List<String> sk;
cf->get_section_keys("params", &sk);
- for (String &E : sk) {
+ for (const String &E : sk) {
params[E] = cf->get_value("params", E);
}
}
@@ -1823,7 +1823,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
List<ResourceImporter::ImportOption> opts;
importer->get_import_options(&opts);
- for (ResourceImporter::ImportOption &E : opts) {
+ for (const ResourceImporter::ImportOption &E : opts) {
if (!params.has(E.option.name)) { //this one is not present
params[E.option.name] = E.default_value;
}
@@ -1835,7 +1835,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
List<Variant> v;
d.get_key_list(&v);
- for (Variant &E : v) {
+ for (const Variant &E : v) {
params[E] = d[E];
}
}
@@ -1882,7 +1882,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
//no path
} else if (import_variants.size()) {
//import with variants
- for (String &E : import_variants) {
+ for (const String &E : import_variants) {
String path = base_path.c_escape() + "." + E + "." + importer->get_save_extension();
f->store_line("path." + E + "=\"" + path + "\"");
@@ -1908,7 +1908,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
if (gen_files.size()) {
Array genf;
- for (String &E : gen_files) {
+ for (const String &E : gen_files) {
genf.push_back(E);
dest_paths.push_back(E);
}
@@ -1934,7 +1934,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
//store options in provided order, to avoid file changing. Order is also important because first match is accepted first.
- for (ResourceImporter::ImportOption &E : opts) {
+ for (const ResourceImporter::ImportOption &E : opts) {
String base = E.option.name;
String value;
VariantWriter::write_to_string(params[base], value);
@@ -2171,7 +2171,7 @@ void EditorFileSystem::_move_group_files(EditorFileSystemDirectory *efd, const S
List<String> sk;
config->get_section_keys("params", &sk);
- for (String &param : sk) {
+ for (const String &param : sk) {
//not very clean, but should work
String value = config->get_value("params", param);
if (value == p_group_file) {
@@ -2245,13 +2245,13 @@ void EditorFileSystem::_update_extensions() {
List<String> extensionsl;
ResourceLoader::get_recognized_extensions_for_type("", &extensionsl);
- for (String &E : extensionsl) {
+ for (const String &E : extensionsl) {
valid_extensions.insert(E);
}
extensionsl.clear();
ResourceFormatImporter::get_singleton()->get_recognized_extensions(&extensionsl);
- for (String &E : extensionsl) {
+ for (const String &E : extensionsl) {
import_extensions.insert(E);
}
}
diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp
index 7b7cf0bf48..29e3236ac2 100644
--- a/editor/editor_folding.cpp
+++ b/editor/editor_folding.cpp
@@ -109,7 +109,7 @@ void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p
List<PropertyInfo> plist;
p_node->get_property_list(&plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (E.usage & PROPERTY_USAGE_EDITOR) {
if (E.type == Variant::OBJECT) {
RES res = p_node->get(E.name);
@@ -228,7 +228,7 @@ void EditorFolding::_do_object_unfolds(Object *p_object, Set<RES> &resources) {
Set<String> unfold_group;
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (E.usage & PROPERTY_USAGE_CATEGORY) {
group = "";
group_base = "";
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 9a0dd4e3bc..3db03c0276 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1508,7 +1508,7 @@ String EditorInspector::get_selected_path() const {
}
void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<EditorInspectorPlugin> ped) {
- for (EditorInspectorPlugin::AddedEditor &F : ped->added_editors) {
+ for (const EditorInspectorPlugin::AddedEditor &F : ped->added_editors) {
EditorProperty *ep = Object::cast_to<EditorProperty>(F.property_editor);
current_vbox->add_child(F.property_editor);
@@ -1648,7 +1648,7 @@ void EditorInspector::update_tree() {
Color sscolor = get_theme_color(SNAME("prop_subsection"), SNAME("Editor"));
- for (Ref<EditorInspectorPlugin> ped : valid_plugins) {
+ for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
ped->parse_begin(object);
_parse_added_editors(main_vbox, ped);
}
@@ -1745,7 +1745,7 @@ void EditorInspector::update_tree() {
category->set_tooltip(p.name + "::" + (class_descr_cache[type2] == "" ? "" : class_descr_cache[type2]));
}
- for (Ref<EditorInspectorPlugin> ped : valid_plugins) {
+ for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
ped->parse_category(object, p.name);
_parse_added_editors(main_vbox, ped);
}
@@ -1946,13 +1946,13 @@ void EditorInspector::update_tree() {
doc_hint = descr;
}
- for (Ref<EditorInspectorPlugin> ped : valid_plugins) {
+ for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
bool exclusive = ped->parse_property(object, p.type, p.name, p.hint, p.hint_string, p.usage, wide_editors);
List<EditorInspectorPlugin::AddedEditor> editors = ped->added_editors; //make a copy, since plugins may be used again in a sub-inspector
ped->added_editors.clear();
- for (EditorInspectorPlugin::AddedEditor &F : editors) {
+ for (const EditorInspectorPlugin::AddedEditor &F : editors) {
EditorProperty *ep = Object::cast_to<EditorProperty>(F.property_editor);
if (ep) {
@@ -1970,7 +1970,7 @@ void EditorInspector::update_tree() {
if (F.label != String()) {
ep->set_label(F.label);
} else {
- //use existin one
+ // Use the existing one.
ep->set_label(name);
}
for (int i = 0; i < F.properties.size(); i++) {
@@ -2028,7 +2028,7 @@ void EditorInspector::update_tree() {
}
}
- for (Ref<EditorInspectorPlugin> ped : valid_plugins) {
+ for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
ped->parse_end();
_parse_added_editors(main_vbox, ped);
}
@@ -2391,7 +2391,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) {
Variant to_create;
List<PropertyInfo> pinfo;
object->get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.name == p_path) {
Callable::CallError ce;
Variant::construct(E.type, to_create, nullptr, 0, ce);
@@ -2595,7 +2595,7 @@ void EditorInspector::_update_script_class_properties(const Object &p_object, Li
}
Set<StringName> added;
- for (Ref<Script> s : classes) {
+ for (const Ref<Script> &s : classes) {
String path = s->get_path();
String name = EditorNode::get_editor_data().script_class_get_name(path);
if (name.is_empty()) {
diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp
index 1f70c59e66..0c8660c216 100644
--- a/editor/editor_layouts_dialog.cpp
+++ b/editor/editor_layouts_dialog.cpp
@@ -92,7 +92,7 @@ void EditorLayoutsDialog::_post_popup() {
List<String> layouts;
config.ptr()->get_sections(&layouts);
- for (String &E : layouts) {
+ for (const String &E : layouts) {
layout_names->add_item(E);
}
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ce5f762b13..46d76a946f 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -797,8 +797,8 @@ void EditorNode::_resources_changed(const Vector<String> &p_resources) {
}
if (changed.size()) {
- for (Ref<Resource> E : changed) {
- E->reload_from_file();
+ for (Ref<Resource> &res : changed) {
+ res->reload_from_file();
}
}
}
@@ -914,7 +914,7 @@ void EditorNode::_resources_reimported(const Vector<String> &p_resources) {
}
}
- for (String &E : scenes) {
+ for (const String &E : scenes) {
reload_scene(E);
}
@@ -926,7 +926,7 @@ void EditorNode::_sources_changed(bool p_exist) {
waiting_for_first_scan = false;
// Reload the global shader variables, but this time
- // loading texures, as they are now properly imported.
+ // loading textures, as they are now properly imported.
RenderingServer::get_singleton()->global_variables_load_settings(true);
// Start preview thread now that it's safe.
@@ -1143,7 +1143,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
file->clear_filters();
List<String> preferred;
- for (String &E : extensions) {
+ for (const String &E : extensions) {
if (p_resource->is_class("Script") && (E == "tres" || E == "res")) {
//this serves no purpose and confused people
continue;
@@ -1259,7 +1259,7 @@ void EditorNode::_get_scene_metadata(const String &p_file) {
cf->get_section_keys("editor_states", &esl);
Dictionary md;
- for (String &E : esl) {
+ for (const String &E : esl) {
Variant st = cf->get_value("editor_states", E);
if (st.get_type() != Variant::NIL) {
md[E] = st;
@@ -1295,7 +1295,7 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) {
List<Variant> keys;
md.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
cf->set_value("editor_states", E, md[E]);
}
@@ -1334,7 +1334,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool>
bool ret_changed = false;
List<PropertyInfo> pi;
obj->get_property_list(&pi);
- for (PropertyInfo &E : pi) {
+ for (const PropertyInfo &E : pi) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -1364,7 +1364,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool>
Dictionary d = obj->get(E.name);
List<Variant> keys;
d.get_key_list(&keys);
- for (Variant &F : keys) {
+ for (const Variant &F : keys) {
Variant v = d[F];
RES res = v;
if (_find_and_save_resource(res, processed, flags)) {
@@ -1520,7 +1520,7 @@ static bool _find_edited_resources(const Ref<Resource> &p_resource, Set<Ref<Reso
p_resource->get_property_list(&plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (E.type == Variant::OBJECT && E.usage & PROPERTY_USAGE_STORAGE && !(E.usage & PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT)) {
RES res = p_resource->get(E.name);
if (res.is_null()) {
@@ -1551,11 +1551,11 @@ int EditorNode::_save_external_resources() {
int saved = 0;
List<Ref<Resource>> cached;
ResourceCache::get_cached_resources(&cached);
- for (Ref<Resource> res : cached) {
+ for (const Ref<Resource> &res : cached) {
if (!res->get_path().is_resource_file()) {
continue;
}
- //not only check if this resourec is edited, check contained subresources too
+ //not only check if this resource is edited, check contained subresources too
if (_find_edited_resources(res, edited_subresources)) {
ResourceSaver::save(res->get_path(), res, flg);
saved++;
@@ -1641,7 +1641,7 @@ void EditorNode::_save_scene(String p_file, int idx) {
editor_data.save_editor_external_data();
- for (Ref<AnimatedValuesBackup> E : anim_backups) {
+ for (Ref<AnimatedValuesBackup> &E : anim_backups) {
E->restore();
}
@@ -1883,7 +1883,7 @@ void EditorNode::_dialog_action(String p_file) {
// erase
List<String> keys;
config->get_section_keys(p_file, &keys);
- for (String &E : keys) {
+ for (const String &E : keys) {
config->set_value(p_file, E, Variant());
}
@@ -2532,7 +2532,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
Ref<MeshLibrary> ml(memnew(MeshLibrary));
ResourceSaver::get_recognized_extensions(ml, &extensions);
file_export_lib->clear_filters();
- for (String &E : extensions) {
+ for (const String &E : extensions) {
file_export_lib->add_filter("*." + E);
}
@@ -4054,7 +4054,7 @@ void EditorNode::_build_icon_type_cache() {
List<StringName> tl;
StringName ei = "EditorIcons";
theme_base->get_theme()->get_icon_list(ei, &tl);
- for (StringName &E : tl) {
+ for (const StringName &E : tl) {
if (!ClassDB::class_exists(E)) {
continue;
}
@@ -4783,7 +4783,7 @@ void EditorNode::_update_layouts_menu() {
List<String> layouts;
config.ptr()->get_sections(&layouts);
- for (String &layout : layouts) {
+ for (const String &layout : layouts) {
if (layout == TTR("Default")) {
editor_layouts->remove_item(editor_layouts->get_item_index(SETTINGS_LAYOUT_DEFAULT));
overridden_default_layout = editor_layouts->get_item_count();
@@ -5333,27 +5333,6 @@ void EditorNode::_file_access_close_error_notify(const String &p_str) {
}
void EditorNode::reload_scene(const String &p_path) {
- /*
- * No longer necessary since scenes now reset and reload their internal resource if needed.
- //first of all, reload internal textures, materials, meshes, etc. as they might have changed on disk
-
- List<Ref<Resource>> cached;
- ResourceCache::get_cached_resources(&cached);
- List<Ref<Resource>> to_clear; //clear internal resources from previous scene from being used
- for (Ref<Resource> E : cached) {
- if (E->get_path().begins_with(p_path + "::")) { //subresources of existing scene
- to_clear.push_back(E);
- }
- }
-
- //so reload reloads everything, clear subresources of previous scene
- while (to_clear.front()) {
- to_clear.front()->get()->set_path("");
- to_clear.pop_front();
- }
-
- */
-
int scene_idx = -1;
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
if (editor_data.get_scene_path(i) == p_path) {
@@ -6738,7 +6717,7 @@ EditorNode::EditorNode() {
file_script->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
List<String> sexts;
ResourceLoader::get_recognized_extensions_for_type("Script", &sexts);
- for (String &E : sexts) {
+ for (const String &E : sexts) {
file_script->add_filter("*." + E);
}
gui_base->add_child(file_script);
diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp
index c52861a2a2..f3b3eedccc 100644
--- a/editor/editor_path.cpp
+++ b/editor/editor_path.cpp
@@ -40,7 +40,7 @@ void EditorPath::_add_children_to_popup(Object *p_obj, int p_depth) {
List<PropertyInfo> pinfo;
p_obj->get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (!(E.usage & PROPERTY_USAGE_EDITOR)) {
continue;
}
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index 967f2aa47b..7d809ea656 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -221,7 +221,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
}
Set<String> valid_extensions;
- for (String &E : extensions) {
+ for (const String &E : extensions) {
valid_extensions.insert(E);
}
@@ -260,7 +260,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
List<PropertyInfo> property_list;
edited_resource->get_property_list(&property_list);
List<Pair<String, Variant>> propvalues;
- for (PropertyInfo &pi : property_list) {
+ for (const PropertyInfo &pi : property_list) {
Pair<String, Variant> p;
if (pi.usage & PROPERTY_USAGE_STORAGE) {
p.first = pi.name;
@@ -275,7 +275,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
Ref<Resource> unique_resource = Ref<Resource>(Object::cast_to<Resource>(inst));
ERR_FAIL_COND(unique_resource.is_null());
- for (Pair<String, Variant> &p : propvalues) {
+ for (const Pair<String, Variant> &p : propvalues) {
unique_resource->set(p.first, p.second);
}
@@ -465,11 +465,11 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, Set<String> *
List<StringName> inheriters;
ClassDB::get_inheriters_from_class(base, &inheriters);
- for (StringName &E : inheriters) {
+ for (const StringName &E : inheriters) {
p_vector->insert(E);
}
- for (StringName &E : global_classes) {
+ for (const StringName &E : global_classes) {
if (EditorNode::get_editor_data().script_class_is_parent(E, base)) {
p_vector->insert(E);
}
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index b446f922f6..4fadbf5922 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -228,7 +228,7 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
}
printf("Running: %s", exec.utf8().get_data());
- for (String &E : args) {
+ for (const String &E : args) {
printf(" %s", E.utf8().get_data());
};
printf("\n");
@@ -267,7 +267,7 @@ void EditorRun::stop_child_process(OS::ProcessID p_pid) {
void EditorRun::stop() {
if (status != STATUS_STOP && pids.size() > 0) {
- for (OS::ProcessID &E : pids) {
+ for (const OS::ProcessID &E : pids) {
OS::get_singleton()->kill(E);
}
}
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index a14ab1d4f8..df4469b6fe 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -759,7 +759,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
List<String> keys;
p_extra_config->get_section_keys("presets", &keys);
- for (String &key : keys) {
+ for (const String &key : keys) {
Variant val = p_extra_config->get_value("presets", key);
set(key, val);
}
@@ -1013,7 +1013,7 @@ void EditorSettings::setup_network() {
String selected = "127.0.0.1";
// Check that current remote_host is a valid interface address and populate hints.
- for (IPAddress &ip : local_ip) {
+ for (const IPAddress &ip : local_ip) {
// link-local IPv6 addresses don't work, skipping them
if (String(ip).begins_with("fe80:0:0:0:")) { // fe80::/64
continue;
@@ -1299,7 +1299,7 @@ void EditorSettings::list_text_editor_themes() {
memdelete(d);
custom_themes.sort();
- for (String &E : custom_themes) {
+ for (const String &E : custom_themes) {
themes += "," + E;
}
}
@@ -1328,7 +1328,7 @@ void EditorSettings::load_text_editor_theme() {
List<String> keys;
cf->get_section_keys("color_theme", &keys);
- for (String &key : keys) {
+ for (const String &key : keys) {
String val = cf->get_value("color_theme", key);
// don't load if it's not already there!
@@ -1429,7 +1429,7 @@ float EditorSettings::get_auto_display_scale() const {
return DisplayServer::get_singleton()->screen_get_max_scale();
#else
const int screen = DisplayServer::get_singleton()->window_get_current_screen();
- // Use the smallest dimension to use a correct display scale on portait displays.
+ // Use the smallest dimension to use a correct display scale on portrait displays.
const int smallest_dimension = MIN(DisplayServer::get_singleton()->screen_get_size(screen).x, DisplayServer::get_singleton()->screen_get_size(screen).y);
if (DisplayServer::get_singleton()->screen_get_dpi(screen) >= 192 && smallest_dimension >= 1400) {
// hiDPI display.
@@ -1580,7 +1580,7 @@ void EditorSettings::set_builtin_action_override(const String &p_name, const Arr
int event_idx = 0;
// Check equality of each event.
- for (Ref<InputEvent> E : builtin_events) {
+ for (const Ref<InputEvent> &E : builtin_events) {
if (!E->is_match(p_events[event_idx])) {
same_as_builtin = false;
break;
@@ -1610,7 +1610,7 @@ const Array EditorSettings::get_builtin_action_overrides(const String &p_name) c
Array event_array;
List<Ref<InputEvent>> events_list = AO->get();
- for (Ref<InputEvent> E : events_list) {
+ for (const Ref<InputEvent> &E : events_list) {
event_array.push_back(E);
}
return event_array;
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 225eac36a5..daee61c2dd 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -135,7 +135,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
_sort_file_info_list(file_list);
// Build the tree.
- for (FileInfo &fi : file_list) {
+ for (const FileInfo &fi : file_list) {
TreeItem *file_item = tree->create_item(subdirectory_item);
file_item->set_text(0, fi.name);
file_item->set_structured_text_bidi_override(0, STRUCTURED_TEXT_FILE);
@@ -964,7 +964,7 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit
List<String> importer_exts;
ResourceImporterScene::get_singleton()->get_recognized_extensions(&importer_exts);
String extension = fpath.get_extension();
- for (String &E : importer_exts) {
+ for (const String &E : importer_exts) {
if (extension.nocasecmp_to(E) == 0) {
is_imported = true;
break;
@@ -1237,7 +1237,7 @@ void FileSystemDock::_update_resource_paths_after_move(const Map<String, String>
List<Ref<Resource>> cached;
ResourceCache::get_cached_resources(&cached);
- for (Ref<Resource> r : cached) {
+ for (Ref<Resource> &r : cached) {
String base_path = r->get_path();
String extra_path;
int sep_pos = r->get_path().find("::");
@@ -1413,7 +1413,7 @@ void FileSystemDock::_make_scene_confirm() {
ResourceSaver::get_recognized_extensions(sd, &extensions);
bool extension_correct = false;
- for (String &E : extensions) {
+ for (const String &E : extensions) {
if (E == extension) {
extension_correct = true;
break;
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index deedbe104c..113306fc8a 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -285,7 +285,7 @@ void GroupDialog::_load_groups(Node *p_current) {
List<Node::GroupInfo> gi;
p_current->get_groups(&gi);
- for (Node::GroupInfo &E : gi) {
+ for (const Node::GroupInfo &E : gi) {
if (!E.persistent) {
continue;
}
@@ -627,7 +627,7 @@ void GroupsEditor::update_tree() {
TreeItem *root = tree->create_item();
- for (GroupInfo &gi : groups) {
+ for (const GroupInfo &gi : groups) {
if (!gi.persistent) {
continue;
}
diff --git a/editor/icons/ImmediateGeometry3D.svg b/editor/icons/ImmediateGeometry3D.svg
deleted file mode 100644
index ec5a392a68..0000000000
--- a/editor/icons/ImmediateGeometry3D.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2.9208 1046.4c-.26373.3-.4204.7296-.4204 1.2383 0 1.6277-3.1381-.1781-.33757 2.6703.88382.899 2.6544.6701 3.5382-.2288.88384-.899.88382-2.3565 0-3.2554-1.1002-1.1191-2.2001-1.0845-2.7803-.4244zm2.3802-1.6103 2.4005 2.4416 6.8014-6.9177c.66286-.6742.66286-1.7673 0-2.4415-.66288-.6741-1.7376-.6741-2.4005 0z" fill="#fc7f7f" transform="translate(0 -1036.4)"/></svg>
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 8b6bd8066f..34bc0a7d8d 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -438,7 +438,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
Node3D *scene = memnew(Node3D);
- for (Ref<Mesh> m : meshes) {
+ for (const Ref<Mesh> &m : meshes) {
Ref<EditorSceneImporterMesh> mesh;
mesh.instantiate();
for (int i = 0; i < m->get_surface_count(); i++) {
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index d67950ec9e..e9160f0414 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -312,7 +312,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<E
List<StringName> anims;
ap->get_animation_list(&anims);
- for (StringName &E : anims) {
+ for (const StringName &E : anims) {
Ref<Animation> anim = ap->get_animation(E);
ERR_CONTINUE(anim.is_null());
for (int i = 0; i < anim->get_track_count(); i++) {
@@ -659,7 +659,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref<
}
int idx = 0;
- for (Ref<Shape3D> &E : shapes) {
+ for (const Ref<Shape3D> &E : shapes) {
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(E);
base->add_child(cshape);
@@ -712,7 +712,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref<
//fill node settings for this node with default values
List<ImportOption> iopts;
get_internal_import_options(INTERNAL_IMPORT_CATEGORY_ANIMATION_NODE, &iopts);
- for (ImportOption &E : iopts) {
+ for (const ImportOption &E : iopts) {
if (!node_settings.has(E.option.name)) {
node_settings[E.option.name] = E.default_value;
}
@@ -756,7 +756,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref<
} else {
List<StringName> anims;
ap->get_animation_list(&anims);
- for (StringName &name : anims) {
+ for (const StringName &name : anims) {
Ref<Animation> anim = ap->get_animation(name);
if (p_animation_data.has(name)) {
Dictionary anim_settings = p_animation_data[name];
@@ -764,7 +764,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref<
//fill with default values
List<ImportOption> iopts;
get_internal_import_options(INTERNAL_IMPORT_CATEGORY_ANIMATION, &iopts);
- for (ImportOption &F : iopts) {
+ for (const ImportOption &F : iopts) {
if (!anim_settings.has(F.option.name)) {
anim_settings[F.option.name] = F.default_value;
}
@@ -935,7 +935,7 @@ void ResourceImporterScene::_create_clips(AnimationPlayer *anim, const Array &p_
void ResourceImporterScene::_optimize_animations(AnimationPlayer *anim, float p_max_lin_error, float p_max_ang_error, float p_max_angle) {
List<StringName> anim_names;
anim->get_animation_list(&anim_names);
- for (StringName &E : anim_names) {
+ for (const StringName &E : anim_names) {
Ref<Animation> a = anim->get_animation(E);
a->optimize(p_max_lin_error, p_max_ang_error, Math::deg2rad(p_max_angle));
}
@@ -1045,7 +1045,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
String script_ext_hint;
- for (String &E : script_extentions) {
+ for (const String &E : script_extentions) {
if (script_ext_hint != "") {
script_ext_hint += ",";
}
@@ -1088,7 +1088,7 @@ Node *ResourceImporterScene::import_scene_from_other_importer(EditorSceneImporte
List<String> extensions;
E->get()->get_extensions(&extensions);
- for (String &F : extensions) {
+ for (const String &F : extensions) {
if (F.to_lower() == ext) {
importer = E;
break;
@@ -1118,7 +1118,7 @@ Ref<Animation> ResourceImporterScene::import_animation_from_other_importer(Edito
List<String> extensions;
E->get()->get_extensions(&extensions);
- for (String &F : extensions) {
+ for (const String &F : extensions) {
if (F.to_lower() == ext) {
importer = E;
break;
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index ad271eaf04..19a8f209bb 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -305,7 +305,7 @@ void SceneImportSettings::_fill_scene(Node *p_node, TreeItem *p_parent_item) {
if (anim_node) {
List<StringName> animations;
anim_node->get_animation_list(&animations);
- for (StringName &E : animations) {
+ for (const StringName &E : animations) {
_fill_animation(scene_tree, anim_node->get_animation(E), E, item);
}
}
@@ -394,7 +394,7 @@ void SceneImportSettings::_load_default_subresource_settings(Map<StringName, Var
d = d[p_import_id];
List<ResourceImporterScene::ImportOption> options;
ResourceImporterScene::get_singleton()->get_internal_import_options(p_category, &options);
- for (ResourceImporterScene::ImportOption &E : options) {
+ for (const ResourceImporterScene::ImportOption &E : options) {
String key = E.option.name;
if (d.has(key)) {
settings[key] = d[key];
@@ -440,7 +440,7 @@ void SceneImportSettings::open_settings(const String &p_path) {
if (err == OK) {
List<String> keys;
config->get_section_keys("params", &keys);
- for (String &E : keys) {
+ for (const String &E : keys) {
Variant value = config->get_value("params", E);
if (E == "_subresources") {
base_subresource_settings = value;
@@ -605,7 +605,7 @@ void SceneImportSettings::_select(Tree *p_from, String p_type, String p_id) {
scene_import_settings_data->defaults.clear();
scene_import_settings_data->current.clear();
- for (ResourceImporter::ImportOption &E : options) {
+ for (const ResourceImporter::ImportOption &E : options) {
scene_import_settings_data->defaults[E.option.name] = E.default_value;
//needed for visibility toggling (fails if something is missing)
if (scene_import_settings_data->settings->has(E.option.name)) {
diff --git a/editor/import/scene_importer_mesh.cpp b/editor/import/scene_importer_mesh.cpp
index 5b8f7015fe..0d14347225 100644
--- a/editor/import/scene_importer_mesh.cpp
+++ b/editor/import/scene_importer_mesh.cpp
@@ -79,7 +79,7 @@ void EditorSceneImporterMesh::add_surface(Mesh::PrimitiveType p_primitive, const
List<Variant> lods;
p_lods.get_key_list(&lods);
- for (Variant &E : lods) {
+ for (const Variant &E : lods) {
ERR_CONTINUE(!E.is_num());
Surface::LOD lod;
lod.distance = E;
diff --git a/editor/import_defaults_editor.cpp b/editor/import_defaults_editor.cpp
index 0b12f86882..25bca1d4f4 100644
--- a/editor/import_defaults_editor.cpp
+++ b/editor/import_defaults_editor.cpp
@@ -106,7 +106,7 @@ void ImportDefaultsEditor::_update_importer() {
List<Ref<ResourceImporter>> importer_list;
ResourceFormatImporter::get_singleton()->get_importers(&importer_list);
Ref<ResourceImporter> importer;
- for (Ref<ResourceImporter> E : importer_list) {
+ for (const Ref<ResourceImporter> &E : importer_list) {
if (E->get_visible_name() == importers->get_item_text(importers->get_selected())) {
importer = E;
break;
@@ -125,7 +125,7 @@ void ImportDefaultsEditor::_update_importer() {
d = ProjectSettings::get_singleton()->get("importer_defaults/" + importer->get_importer_name());
}
- for (ResourceImporter::ImportOption &E : options) {
+ for (const ResourceImporter::ImportOption &E : options) {
settings->properties.push_back(E.option);
if (d.has(E.option.name)) {
settings->values[E.option.name] = d[E.option.name];
@@ -166,7 +166,7 @@ void ImportDefaultsEditor::clear() {
List<Ref<ResourceImporter>> importer_list;
ResourceFormatImporter::get_singleton()->get_importers(&importer_list);
Vector<String> names;
- for (Ref<ResourceImporter> E : importer_list) {
+ for (const Ref<ResourceImporter> &E : importer_list) {
String vn = E->get_visible_name();
names.push_back(vn);
}
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index 3927832eb9..648e60a554 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -111,7 +111,7 @@ void ImportDock::set_edit_path(const String &p_path) {
ResourceFormatImporter::get_singleton()->get_importers_for_extension(p_path.get_extension(), &importers);
List<Pair<String, String>> importer_names;
- for (Ref<ResourceImporter> E : importers) {
+ for (const Ref<ResourceImporter> &E : importers) {
importer_names.push_back(Pair<String, String>(E->get_visible_name(), E->get_importer_name()));
}
@@ -119,7 +119,7 @@ void ImportDock::set_edit_path(const String &p_path) {
import_as->clear();
- for (Pair<String, String> &E : importer_names) {
+ for (const Pair<String, String> &E : importer_names) {
import_as->add_item(E.first);
import_as->set_item_metadata(import_as->get_item_count() - 1, E.second);
if (E.second == importer_name) {
@@ -153,7 +153,7 @@ void ImportDock::_update_options(const Ref<ConfigFile> &p_config) {
params->checking = params->paths.size() > 1;
params->checked.clear();
- for (ResourceImporter::ImportOption &E : options) {
+ for (const ResourceImporter::ImportOption &E : options) {
params->properties.push_back(E.option);
if (p_config.is_valid() && p_config->has_section_key("params", E.option.name)) {
params->values[E.option.name] = p_config->get_value("params", E.option.name);
@@ -201,7 +201,7 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) {
List<String> keys;
config->get_section_keys("params", &keys);
- for (String &E : keys) {
+ for (const String &E : keys) {
if (!value_frequency.has(E)) {
value_frequency[E] = Dictionary();
}
@@ -226,7 +226,7 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) {
params->checking = true;
params->checked.clear();
- for (ResourceImporter::ImportOption &E : options) {
+ for (const ResourceImporter::ImportOption &E : options) {
params->properties.push_back(E.option);
if (value_frequency.has(E.option.name)) {
@@ -235,7 +235,7 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) {
List<Variant> v;
d.get_key_list(&v);
Variant value;
- for (Variant &F : v) {
+ for (const Variant &F : v) {
int f = d[F];
if (f > freq) {
value = F;
@@ -254,7 +254,7 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) {
ResourceFormatImporter::get_singleton()->get_importers_for_extension(p_paths[0].get_extension(), &importers);
List<Pair<String, String>> importer_names;
- for (Ref<ResourceImporter> E : importers) {
+ for (const Ref<ResourceImporter> &E : importers) {
importer_names.push_back(Pair<String, String>(E->get_visible_name(), E->get_importer_name()));
}
@@ -262,7 +262,7 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) {
import_as->clear();
- for (Pair<String, String> &E : importer_names) {
+ for (const Pair<String, String> &E : importer_names) {
import_as->add_item(E.first);
import_as->set_item_metadata(import_as->get_item_count() - 1, E.second);
if (E.second == params->importer->get_importer_name()) {
@@ -363,7 +363,7 @@ void ImportDock::_preset_selected(int p_idx) {
if (params->checking) {
params->checked.clear();
}
- for (Variant &E : v) {
+ for (const Variant &E : v) {
params->values[E] = d[E];
if (params->checking) {
params->checked.insert(E);
@@ -384,7 +384,7 @@ void ImportDock::_preset_selected(int p_idx) {
if (params->checking) {
params->checked.clear();
}
- for (ResourceImporter::ImportOption &E : options) {
+ for (const ResourceImporter::ImportOption &E : options) {
params->values[E.option.name] = E.default_value;
if (params->checking) {
params->checked.insert(E.option.name);
@@ -486,7 +486,7 @@ void ImportDock::_reimport() {
if (params->checking && config->get_value("remap", "importer") == params->importer->get_importer_name()) {
//update only what is edited (checkboxes) if the importer is the same
- for (PropertyInfo &E : params->properties) {
+ for (const PropertyInfo &E : params->properties) {
if (params->checked.has(E.name)) {
config->set_value("params", E.name, params->values[E.name]);
}
@@ -498,7 +498,7 @@ void ImportDock::_reimport() {
config->erase_section("params");
}
- for (PropertyInfo &E : params->properties) {
+ for (const PropertyInfo &E : params->properties) {
config->set_value("params", E.name, params->values[E.name]);
}
}
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index b1c601a41c..1973494a2a 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -87,7 +87,7 @@ void InspectorDock::_menu_option(int p_option) {
List<PropertyInfo> props;
current->get_property_list(&props);
Map<RES, RES> duplicates;
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp
index d4b712b6a3..b32ea67d4d 100644
--- a/editor/localization_editor.cpp
+++ b/editor/localization_editor.cpp
@@ -43,13 +43,13 @@ void LocalizationEditor::_notification(int p_what) {
List<String> tfn;
ResourceLoader::get_recognized_extensions_for_type("Translation", &tfn);
- for (String &E : tfn) {
+ for (const String &E : tfn) {
translation_file_open->add_filter("*." + E);
}
List<String> rfn;
ResourceLoader::get_recognized_extensions_for_type("Resource", &rfn);
- for (String &E : rfn) {
+ for (const String &E : rfn) {
translation_res_file_open_dialog->add_filter("*." + E);
translation_res_option_file_open_dialog->add_filter("*." + E);
}
@@ -430,7 +430,7 @@ void LocalizationEditor::_update_pot_file_extensions() {
pot_file_open_dialog->clear_filters();
List<String> translation_parse_file_extensions;
EditorTranslationParser::get_singleton()->get_recognized_extensions(&translation_parse_file_extensions);
- for (String &E : translation_parse_file_extensions) {
+ for (const String &E : translation_parse_file_extensions) {
pot_file_open_dialog->add_filter("*." + E);
}
}
@@ -560,7 +560,7 @@ void LocalizationEditor::update_translations() {
List<Variant> rk;
remaps.get_key_list(&rk);
Vector<String> keys;
- for (Variant &E : rk) {
+ for (const Variant &E : rk) {
keys.push_back(E);
}
keys.sort();
diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp
index 910b242c41..fd4a4334fc 100644
--- a/editor/multi_node_edit.cpp
+++ b/editor/multi_node_edit.cpp
@@ -143,7 +143,7 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const {
List<PropertyInfo> plist;
n->get_property_list(&plist, true);
- for (PropertyInfo &F : plist) {
+ for (const PropertyInfo &F : plist) {
if (F.name == "script") {
continue; //added later manually, since this is intercepted before being set (check Variant Object::get() )
}
@@ -164,7 +164,7 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const {
nc++;
}
- for (PLData *E : data_list) {
+ for (const PLData *E : data_list) {
if (nc == E->uses) {
p_list->push_back(E->info);
}
diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp
index 35b27b25aa..5fe466140b 100644
--- a/editor/plugin_config_dialog.cpp
+++ b/editor/plugin_config_dialog.cpp
@@ -150,7 +150,7 @@ void PluginConfigDialog::_on_required_text_changed(const String &) {
if (script_edit->get_text().get_extension() != ext) {
is_valid = false;
script_validation->set_texture(invalid_icon);
- script_validation->set_tooltip(vformat(TTR("Script extension must match chosen langauge extension (.%s)."), ext));
+ script_validation->set_tooltip(vformat(TTR("Script extension must match chosen language extension (.%s)."), ext));
}
if (script_edit->get_text().get_basename().is_empty()) {
is_valid = false;
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index ab11680e2f..ad2d9866fa 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -72,14 +72,14 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
List<StringName> names;
ap->get_animation_list(&names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E);
animations_to_add.push_back(E);
}
}
}
- for (StringName &E : classes) {
+ for (const StringName &E : classes) {
String name = String(E).replace_first("AnimationNode", "");
if (name == "Animation") {
continue;
@@ -373,7 +373,7 @@ void AnimationNodeBlendSpace1DEditor::_add_menu_type(int p_index) {
open_file->clear_filters();
List<String> filters;
ResourceLoader::get_recognized_extensions_for_type("AnimationRootNode", &filters);
- for (String &E : filters) {
+ for (const String &E : filters) {
open_file->add_filter("*." + E);
}
open_file->popup_file_dialog();
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 3fb90eb4ff..49fcac512b 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -96,14 +96,14 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
if (ap) {
List<StringName> names;
ap->get_animation_list(&names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E);
animations_to_add.push_back(E);
}
}
}
- for (StringName &E : classes) {
+ for (const StringName &E : classes) {
String name = String(E).replace_first("AnimationNode", "");
if (name == "Animation") {
continue; // nope
@@ -295,7 +295,7 @@ void AnimationNodeBlendSpace2DEditor::_add_menu_type(int p_index) {
open_file->clear_filters();
List<String> filters;
ResourceLoader::get_recognized_extensions_for_type("AnimationRootNode", &filters);
- for (String &E : filters) {
+ for (const String &E : filters) {
open_file->add_filter("*." + E);
}
open_file->popup_file_dialog();
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 705a1d0fc0..c94014944c 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -121,7 +121,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
List<StringName> nodes;
blend_tree->get_node_list(&nodes);
- for (StringName &E : nodes) {
+ for (const StringName &E : nodes) {
GraphNode *node = memnew(GraphNode);
graph->add_child(node);
@@ -155,7 +155,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
List<PropertyInfo> pinfo;
agnode->get_parameter_list(&pinfo);
- for (PropertyInfo &F : pinfo) {
+ for (const PropertyInfo &F : pinfo) {
if (!(F.usage & PROPERTY_USAGE_EDITOR)) {
continue;
}
@@ -212,7 +212,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
List<StringName> anims;
ap->get_animation_list(&anims);
- for (StringName &F : anims) {
+ for (const StringName &F : anims) {
mb->get_popup()->add_item(F);
options.push_back(F);
}
@@ -246,7 +246,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
List<AnimationNodeBlendTree::NodeConnection> connections;
blend_tree->get_node_connections(&connections);
- for (AnimationNodeBlendTree::NodeConnection &E : connections) {
+ for (const AnimationNodeBlendTree::NodeConnection &E : connections) {
StringName from = E.output_node;
StringName to = E.input_node;
int to_idx = E.input_index;
@@ -274,7 +274,7 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
open_file->clear_filters();
List<String> filters;
ResourceLoader::get_recognized_extensions_for_type("AnimationNode", &filters);
- for (String &E : filters) {
+ for (const String &E : filters) {
open_file->add_filter("*." + E);
}
open_file->popup_file_dialog();
@@ -394,7 +394,7 @@ void AnimationNodeBlendTreeEditor::_delete_request(const String &p_which) {
List<AnimationNodeBlendTree::NodeConnection> conns;
blend_tree->get_node_connections(&conns);
- for (AnimationNodeBlendTree::NodeConnection &E : conns) {
+ for (const AnimationNodeBlendTree::NodeConnection &E : conns) {
if (E.output_node == p_which || E.input_node == p_which) {
undo_redo->add_undo_method(blend_tree.ptr(), "connect_node", E.input_node, E.input_index, E.output_node);
}
@@ -423,7 +423,7 @@ void AnimationNodeBlendTreeEditor::_delete_nodes_request() {
undo_redo->create_action(TTR("Delete Node(s)"));
- for (StringName &F : to_erase) {
+ for (const StringName &F : to_erase) {
_delete_request(F);
}
@@ -517,7 +517,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
List<StringName> animations;
player->get_animation_list(&animations);
- for (StringName &E : animations) {
+ for (const StringName &E : animations) {
Ref<Animation> anim = player->get_animation(E);
for (int i = 0; i < anim->get_track_count(); i++) {
String track_path = anim->track_get_path(i);
@@ -718,7 +718,7 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
List<AnimationNodeBlendTree::NodeConnection> conns;
blend_tree->get_node_connections(&conns);
- for (AnimationNodeBlendTree::NodeConnection &E : conns) {
+ for (const AnimationNodeBlendTree::NodeConnection &E : conns) {
float activity = 0;
StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + E.input_node;
if (AnimationTreeEditor::get_singleton()->get_tree() && !AnimationTreeEditor::get_singleton()->get_tree()->is_state_invalid()) {
@@ -828,7 +828,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
List<AnimationNodeBlendTree::NodeConnection> connections;
blend_tree->get_node_connections(&connections);
- for (AnimationNodeBlendTree::NodeConnection &E : connections) {
+ for (const AnimationNodeBlendTree::NodeConnection &E : connections) {
StringName from = E.output_node;
StringName to = E.input_node;
int to_idx = E.input_index;
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 1bdbc2980c..4ba9147955 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -350,7 +350,7 @@ void AnimationPlayerEditor::_animation_load() {
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("Animation", &extensions);
- for (String &E : extensions) {
+ for (const String &E : extensions) {
file->add_filter("*." + E + " ; " + E.to_upper());
}
@@ -584,7 +584,7 @@ void AnimationPlayerEditor::_animation_blend() {
blend_editor.next->clear();
blend_editor.next->add_item("", i);
- for (StringName &to : anims) {
+ for (const StringName &to : anims) {
TreeItem *blend = blend_editor.tree->create_item(root);
blend->set_editable(0, false);
blend->set_editable(1, true);
@@ -829,7 +829,7 @@ void AnimationPlayerEditor::_update_player() {
}
int active_idx = -1;
- for (StringName &E : animlist) {
+ for (const StringName &E : animlist) {
Ref<Texture2D> icon;
if (E == player->get_autoplay()) {
if (E == "RESET") {
@@ -965,7 +965,7 @@ void AnimationPlayerEditor::_animation_duplicate() {
Ref<Animation> new_anim = memnew(Animation);
List<PropertyInfo> plist;
anim->get_property_list(&plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (E.usage & PROPERTY_USAGE_STORAGE) {
new_anim->set(E.name, anim->get(E.name));
}
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index bee6af3cbb..a1f96f21bf 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -93,14 +93,14 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
if (ap) {
List<StringName> names;
ap->get_animation_list(&names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E);
animations_to_add.push_back(E);
}
}
}
- for (StringName &E : classes) {
+ for (const StringName &E : classes) {
String name = String(E).replace_first("AnimationNode", "");
if (name == "Animation") {
continue; // nope
@@ -318,7 +318,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
float best_d_x = 1e20;
float best_d_y = 1e20;
- for (StringName &E : nodes) {
+ for (const StringName &E : nodes) {
if (E == selected_node) {
continue;
}
@@ -409,7 +409,7 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) {
open_file->clear_filters();
List<String> filters;
ResourceLoader::get_recognized_extensions_for_type("AnimationRootNode", &filters);
- for (String &E : filters) {
+ for (const String &E : filters) {
open_file->add_filter("*." + E);
}
open_file->popup_file_dialog();
@@ -606,7 +606,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
}
//pre pass nodes so we know the rectangles
- for (StringName &E : nodes) {
+ for (const StringName &E : nodes) {
Ref<AnimationNode> anode = state_machine->get_node(E);
String name = E;
bool needs_editor = EditorNode::get_singleton()->item_has_editor(anode.ptr());
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 67d5600a3c..cd84be0c25 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -215,7 +215,7 @@ Vector<String> AnimationTreeEditor::get_animation_list() {
List<StringName> anims;
ap->get_animation_list(&anims);
Vector<String> ret;
- for (StringName &E : anims) {
+ for (const StringName &E : anims) {
ret.push_back(E);
}
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 8b9e76b402..869a582d96 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -399,7 +399,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig
if ((is_snap_active && snap_other_nodes && (p_modes & SNAP_OTHER_NODES)) || (p_forced_modes & SNAP_OTHER_NODES)) {
Transform2D to_snap_transform = Transform2D();
List<const CanvasItem *> exceptions = List<const CanvasItem *>();
- for (CanvasItem *E : p_other_nodes_exceptions) {
+ for (const CanvasItem *E : p_other_nodes_exceptions) {
exceptions.push_back(E);
}
if (p_self_canvas_item) {
@@ -842,7 +842,7 @@ void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_ite
undo_redo->add_do_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state());
undo_redo->add_undo_method(canvas_item, "_edit_set_state", se->undo_state);
if (commit_bones) {
- for (Dictionary &F : se->pre_drag_bones_undo_state) {
+ for (const Dictionary &F : se->pre_drag_bones_undo_state) {
canvas_item = Object::cast_to<CanvasItem>(canvas_item->get_parent());
undo_redo->add_do_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state());
undo_redo->add_undo_method(canvas_item, "_edit_set_state", F);
@@ -3555,7 +3555,7 @@ void CanvasItemEditor::_draw_hover() {
Point2 pos = transform.xform(hovering_results[i].position) - Point2(0, item_size.y) + (Point2(node_icon->get_size().x, -node_icon->get_size().y) / 4);
// Rectify the position to avoid overlapping items
- for (Rect2 &E : previous_rects) {
+ for (const Rect2 &E : previous_rects) {
if (E.intersects(Rect2(pos, item_size))) {
pos.y = E.get_position().y - item_size.y;
}
@@ -4699,7 +4699,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
}
undo_redo->create_action(TTR("Paste Pose"));
- for (PoseClipboard &E : pose_clipboard) {
+ for (const PoseClipboard &E : pose_clipboard) {
Node2D *n2d = Object::cast_to<Node2D>(ObjectDB::get_instance(E.id));
if (!n2d) {
continue;
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
index 7e0eb89359..6f246c1661 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
@@ -253,7 +253,7 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) {
file = memnew(EditorFileDialog);
List<String> ext;
ImageLoader::get_recognized_extensions(&ext);
- for (String &E : ext) {
+ for (const String &E : ext) {
file->add_filter("*." + E + "; " + E.to_upper());
}
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 19204e3bf8..81c340e9a4 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -490,7 +490,7 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size
Set<String> control_flow_keywords;
Set<String> keywords;
- for (String &E : kwors) {
+ for (const String &E : kwors) {
if (scr->get_language()->is_control_flow_keyword(E)) {
control_flow_keywords.insert(E);
} else {
diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
index 4412d51077..5184e837ce 100644
--- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
@@ -361,7 +361,7 @@ GPUParticles2DEditorPlugin::GPUParticles2DEditorPlugin(EditorNode *p_node) {
file = memnew(EditorFileDialog);
List<String> ext;
ImageLoader::get_recognized_extensions(&ext);
- for (String &E : ext) {
+ for (const String &E : ext) {
file->add_filter("*." + E + "; " + E.to_upper());
}
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index 32d5865d0b..94966d4fe6 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -265,7 +265,7 @@ Ref<Resource> StandardMaterial3DConversionPlugin::convert(const Ref<Resource> &p
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (PropertyInfo &E : params) {
+ for (const PropertyInfo &E : params) {
// Texture parameter has to be treated specially since StandardMaterial3D saved it
// as RID but ShaderMaterial needs Texture itself
Ref<Texture2D> texture = mat->get_texture_by_name(E.name);
@@ -309,7 +309,7 @@ Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (PropertyInfo &E : params) {
+ for (const PropertyInfo &E : params) {
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
smat->set_shader_param(E.name, value);
}
@@ -346,7 +346,7 @@ Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (PropertyInfo &E : params) {
+ for (const PropertyInfo &E : params) {
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
smat->set_shader_param(E.name, value);
}
@@ -383,7 +383,7 @@ Ref<Resource> ProceduralSkyMaterialConversionPlugin::convert(const Ref<Resource>
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (PropertyInfo &E : params) {
+ for (const PropertyInfo &E : params) {
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
smat->set_shader_param(E.name, value);
}
@@ -420,7 +420,7 @@ Ref<Resource> PanoramaSkyMaterialConversionPlugin::convert(const Ref<Resource> &
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (PropertyInfo &E : params) {
+ for (const PropertyInfo &E : params) {
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
smat->set_shader_param(E.name, value);
}
@@ -457,7 +457,7 @@ Ref<Resource> PhysicalSkyMaterialConversionPlugin::convert(const Ref<Resource> &
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (PropertyInfo &E : params) {
+ for (const PropertyInfo &E : params) {
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
smat->set_shader_param(E.name, value);
}
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index 393aaff207..2138f943da 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -4746,7 +4746,7 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Vector3 *tw = tmeshfaces.ptrw();
int tidx = 0;
- for (Face3 &f : faces) {
+ for (const Face3 &f : faces) {
for (int j = 0; j < 3; j++) {
tw[tidx++] = f.vertex[j];
_EdgeKey ek;
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index c66b97b423..3b9c0ff699 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -1423,17 +1423,15 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
_edit.snap = spatial_editor->is_snap_enabled();
_edit.mode = TRANSFORM_NONE;
- //gizmo has priority over everything
-
- bool can_select_gizmos = true;
+ bool can_select_gizmos = spatial_editor->get_single_selected_node();
{
int idx = view_menu->get_popup()->get_item_index(VIEW_GIZMOS);
- can_select_gizmos = view_menu->get_popup()->is_item_checked(idx);
+ can_select_gizmos = can_select_gizmos && view_menu->get_popup()->is_item_checked(idx);
}
- if (can_select_gizmos && spatial_editor->get_single_selected_node()) {
- Node3DEditorSelectedItem *se = editor_selection->get_node_editor_data<Node3DEditorSelectedItem>(spatial_editor->get_single_selected_node());
+ // Gizmo handles
+ if (can_select_gizmos) {
Vector<Ref<Node3DGizmo>> gizmos = spatial_editor->get_single_selected_node()->get_gizmos();
bool intersected_handle = false;
@@ -1444,6 +1442,40 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
continue;
}
+ int gizmo_handle = -1;
+ seg->handles_intersect_ray(camera, _edit.mouse_pos, b->is_shift_pressed(), gizmo_handle);
+ if (gizmo_handle != -1) {
+ _edit.gizmo = seg;
+ _edit.gizmo_handle = gizmo_handle;
+ _edit.gizmo_initial_value = seg->get_handle_value(gizmo_handle);
+ intersected_handle = true;
+ break;
+ }
+ }
+
+ if (intersected_handle) {
+ break;
+ }
+ }
+
+ // Transform gizmo
+ if (_transform_gizmo_select(_edit.mouse_pos)) {
+ break;
+ }
+
+ // Subgizmos
+ if (can_select_gizmos) {
+ Node3DEditorSelectedItem *se = editor_selection->get_node_editor_data<Node3DEditorSelectedItem>(spatial_editor->get_single_selected_node());
+ Vector<Ref<Node3DGizmo>> gizmos = spatial_editor->get_single_selected_node()->get_gizmos();
+
+ bool intersected_subgizmo = false;
+ for (int i = 0; i < gizmos.size(); i++) {
+ Ref<EditorNode3DGizmo> seg = gizmos[i];
+
+ if ((!seg.is_valid())) {
+ continue;
+ }
+
int subgizmo_id = seg->subgizmos_intersect_ray(camera, _edit.mouse_pos);
if (subgizmo_id != -1) {
ERR_CONTINUE(!se);
@@ -1466,30 +1498,16 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
seg->redraw();
spatial_editor->update_transform_gizmo();
- intersected_handle = true;
- break;
- }
-
- int gizmo_handle = -1;
- seg->handles_intersect_ray(camera, _edit.mouse_pos, b->is_shift_pressed(), gizmo_handle);
- if (gizmo_handle != -1) {
- _edit.gizmo = seg;
- _edit.gizmo_handle = gizmo_handle;
- _edit.gizmo_initial_value = seg->get_handle_value(gizmo_handle);
- intersected_handle = true;
+ intersected_subgizmo = true;
break;
}
}
- if (intersected_handle) {
+ if (intersected_subgizmo) {
break;
}
}
- if (_transform_gizmo_select(_edit.mouse_pos)) {
- break;
- }
-
clicked = ObjectID();
if ((spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT && b->is_command_pressed()) || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE) {
@@ -1791,7 +1809,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
Transform3D xform = GE->get();
Transform3D new_xform = _compute_transform(TRANSFORM_SCALE, se->original * xform, xform, motion, snap, local_coords);
if (!local_coords) {
- new_xform = se->original.inverse() * new_xform;
+ new_xform = se->original.affine_inverse() * new_xform;
}
se->gizmo->set_subgizmo_transform(GE->key(), new_xform);
}
@@ -1889,7 +1907,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
for (Map<int, Transform3D>::Element *GE = se->subgizmos.front(); GE; GE = GE->next()) {
Transform3D xform = GE->get();
Transform3D new_xform = _compute_transform(TRANSFORM_TRANSLATE, se->original * xform, xform, motion, snap, local_coords);
- new_xform = se->original.inverse() * new_xform;
+ new_xform = se->original.affine_inverse() * new_xform;
se->gizmo->set_subgizmo_transform(GE->key(), new_xform);
}
} else {
@@ -1977,7 +1995,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
Transform3D new_xform = _compute_transform(TRANSFORM_ROTATE, se->original * xform, xform, compute_axis, angle, local_coords);
if (!local_coords) {
- new_xform = se->original.inverse() * new_xform;
+ new_xform = se->original.affine_inverse() * new_xform;
}
se->gizmo->set_subgizmo_transform(GE->key(), new_xform);
}
@@ -3782,63 +3800,16 @@ Vector3 Node3DEditorViewport::_get_instance_position(const Point2 &p_pos) const
Vector3 world_ray = _get_ray(p_pos);
Vector3 world_pos = _get_ray_pos(p_pos);
- Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(world_pos, world_ray, get_tree()->get_root()->get_world_3d()->get_scenario());
- Set<Ref<EditorNode3DGizmo>> found_gizmos;
-
- float closest_dist = MAX_DISTANCE;
-
Vector3 point = world_pos + world_ray * MAX_DISTANCE;
- Vector3 normal = Vector3(0.0, 0.0, 0.0);
-
- for (int i = 0; i < instances.size(); i++) {
- MeshInstance3D *mesh_instance = Object::cast_to<MeshInstance3D>(ObjectDB::get_instance(instances[i]));
-
- if (!mesh_instance) {
- continue;
- }
-
- Vector<Ref<Node3DGizmo>> gizmos = mesh_instance->get_gizmos();
-
- for (int j = 0; j < gizmos.size(); j++) {
- Ref<EditorNode3DGizmo> seg = gizmos[j];
-
- if ((!seg.is_valid()) || found_gizmos.has(seg)) {
- continue;
- }
- found_gizmos.insert(seg);
-
- Vector3 hit_point;
- Vector3 hit_normal;
- bool inters = seg->intersect_ray(camera, p_pos, hit_point, hit_normal);
-
- if (!inters) {
- continue;
- }
-
- float dist = world_pos.distance_to(hit_point);
-
- if (dist < 0) {
- continue;
- }
+ PhysicsDirectSpaceState3D *ss = get_tree()->get_root()->get_world_3d()->get_direct_space_state();
+ PhysicsDirectSpaceState3D::RayResult result;
- if (dist < closest_dist) {
- closest_dist = dist;
- point = hit_point;
- normal = hit_normal;
- }
- }
+ if (ss->intersect_ray(world_pos, world_pos + world_ray * MAX_DISTANCE, result)) {
+ point = result.position;
}
- Vector3 offset = Vector3();
- for (int i = 0; i < 3; i++) {
- if (normal[i] > 0.0) {
- offset[i] = (preview_bounds->get_size()[i] - (preview_bounds->get_size()[i] + preview_bounds->get_position()[i]));
- } else if (normal[i] < 0.0) {
- offset[i] = -(preview_bounds->get_size()[i] + preview_bounds->get_position()[i]);
- }
- }
- return point + offset;
+ return point;
}
AABB Node3DEditorViewport::_calculate_spatial_bounds(const Node3D *p_parent, bool p_exclude_top_level_transform) {
@@ -4823,7 +4794,9 @@ Object *Node3DEditor::_get_editor_data(Object *p_what) {
RS::get_singleton()->instance_geometry_set_cast_shadows_setting(
si->sbox_instance,
RS::SHADOW_CASTING_SETTING_OFF);
- RS::get_singleton()->instance_set_layer_mask(si->sbox_instance, 1 << Node3DEditorViewport::MISC_TOOL_LAYER);
+ // Use the Edit layer to hide the selection box when View Gizmos is disabled, since it is a bit distracting.
+ // It's still possible to approximately guess what is selected by looking at the manipulation gizmo position.
+ RS::get_singleton()->instance_set_layer_mask(si->sbox_instance, 1 << Node3DEditorViewport::GIZMO_EDIT_LAYER);
RS::get_singleton()->instance_geometry_set_flag(si->sbox_instance, RS::INSTANCE_FLAG_IGNORE_OCCLUSION_CULLING, true);
si->sbox_instance_xray = RenderingServer::get_singleton()->instance_create2(
selection_box_xray->get_rid(),
@@ -4831,7 +4804,9 @@ Object *Node3DEditor::_get_editor_data(Object *p_what) {
RS::get_singleton()->instance_geometry_set_cast_shadows_setting(
si->sbox_instance_xray,
RS::SHADOW_CASTING_SETTING_OFF);
- RS::get_singleton()->instance_set_layer_mask(si->sbox_instance_xray, 1 << Node3DEditorViewport::MISC_TOOL_LAYER);
+ // Use the Edit layer to hide the selection box when View Gizmos is disabled, since it is a bit distracting.
+ // It's still possible to approximately guess what is selected by looking at the manipulation gizmo position.
+ RS::get_singleton()->instance_set_layer_mask(si->sbox_instance_xray, 1 << Node3DEditorViewport::GIZMO_EDIT_LAYER);
RS::get_singleton()->instance_geometry_set_flag(si->sbox_instance, RS::INSTANCE_FLAG_IGNORE_OCCLUSION_CULLING, true);
return si;
@@ -6493,92 +6468,84 @@ void Node3DEditor::_add_environment_to_scene(bool p_already_added_sun) {
undo_redo->commit_action();
}
+void Node3DEditor::_update_theme() {
+ tool_button[Node3DEditor::TOOL_MODE_SELECT]->set_icon(get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons")));
+ tool_button[Node3DEditor::TOOL_MODE_MOVE]->set_icon(get_theme_icon(SNAME("ToolMove"), SNAME("EditorIcons")));
+ tool_button[Node3DEditor::TOOL_MODE_ROTATE]->set_icon(get_theme_icon(SNAME("ToolRotate"), SNAME("EditorIcons")));
+ tool_button[Node3DEditor::TOOL_MODE_SCALE]->set_icon(get_theme_icon(SNAME("ToolScale"), SNAME("EditorIcons")));
+ tool_button[Node3DEditor::TOOL_MODE_LIST_SELECT]->set_icon(get_theme_icon(SNAME("ListSelect"), SNAME("EditorIcons")));
+ tool_button[Node3DEditor::TOOL_LOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Lock"), SNAME("EditorIcons")));
+ tool_button[Node3DEditor::TOOL_UNLOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Unlock"), SNAME("EditorIcons")));
+ tool_button[Node3DEditor::TOOL_GROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Group"), SNAME("EditorIcons")));
+ tool_button[Node3DEditor::TOOL_UNGROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Ungroup"), SNAME("EditorIcons")));
+
+ tool_option_button[Node3DEditor::TOOL_OPT_LOCAL_COORDS]->set_icon(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")));
+ tool_option_button[Node3DEditor::TOOL_OPT_USE_SNAP]->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons")));
+ tool_option_button[Node3DEditor::TOOL_OPT_OVERRIDE_CAMERA]->set_icon(get_theme_icon(SNAME("Camera3D"), SNAME("EditorIcons")));
+
+ view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_theme_icon(SNAME("Panels1"), SNAME("EditorIcons")));
+ view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_theme_icon(SNAME("Panels2"), SNAME("EditorIcons")));
+ view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels2Alt"), SNAME("EditorIcons")));
+ view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), get_theme_icon(SNAME("Panels3"), SNAME("EditorIcons")));
+ view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels3Alt"), SNAME("EditorIcons")));
+ view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_theme_icon(SNAME("Panels4"), SNAME("EditorIcons")));
+
+ sun_button->set_icon(get_theme_icon(SNAME("DirectionalLight3D"), SNAME("EditorIcons")));
+ environ_button->set_icon(get_theme_icon(SNAME("WorldEnvironment"), SNAME("EditorIcons")));
+ sun_environ_settings->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
+
+ sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
+ environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
+}
+
void Node3DEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_READY) {
- tool_button[Node3DEditor::TOOL_MODE_SELECT]->set_icon(get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_MOVE]->set_icon(get_theme_icon(SNAME("ToolMove"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_ROTATE]->set_icon(get_theme_icon(SNAME("ToolRotate"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_SCALE]->set_icon(get_theme_icon(SNAME("ToolScale"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_LIST_SELECT]->set_icon(get_theme_icon(SNAME("ListSelect"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_LOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Lock"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_UNLOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Unlock"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_GROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Group"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_UNGROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Ungroup"), SNAME("EditorIcons")));
-
- tool_option_button[Node3DEditor::TOOL_OPT_LOCAL_COORDS]->set_icon(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")));
- tool_option_button[Node3DEditor::TOOL_OPT_USE_SNAP]->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons")));
- tool_option_button[Node3DEditor::TOOL_OPT_OVERRIDE_CAMERA]->set_icon(get_theme_icon(SNAME("Camera3D"), SNAME("EditorIcons")));
-
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_theme_icon(SNAME("Panels1"), SNAME("EditorIcons")));
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_theme_icon(SNAME("Panels2"), SNAME("EditorIcons")));
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels2Alt"), SNAME("EditorIcons")));
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), get_theme_icon(SNAME("Panels3"), SNAME("EditorIcons")));
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels3Alt"), SNAME("EditorIcons")));
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_theme_icon(SNAME("Panels4"), SNAME("EditorIcons")));
-
- _menu_item_pressed(MENU_VIEW_USE_1_VIEWPORT);
-
- _refresh_menu_icons();
-
- get_tree()->connect("node_removed", callable_mp(this, &Node3DEditor::_node_removed));
- get_tree()->connect("node_added", callable_mp(this, &Node3DEditor::_node_added));
- EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->connect("node_changed", callable_mp(this, &Node3DEditor::_refresh_menu_icons));
- editor_selection->connect("selection_changed", callable_mp(this, &Node3DEditor::_selection_changed));
-
- editor->connect("stop_pressed", callable_mp(this, &Node3DEditor::_update_camera_override_button), make_binds(false));
- editor->connect("play_pressed", callable_mp(this, &Node3DEditor::_update_camera_override_button), make_binds(true));
-
- sun_button->set_icon(get_theme_icon(SNAME("DirectionalLight3D"), SNAME("EditorIcons")));
- environ_button->set_icon(get_theme_icon(SNAME("WorldEnvironment"), SNAME("EditorIcons")));
- sun_environ_settings->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
+ switch (p_what) {
+ case NOTIFICATION_READY: {
+ _menu_item_pressed(MENU_VIEW_USE_1_VIEWPORT);
- _update_preview_environment();
- sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
- environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
+ _refresh_menu_icons();
- sun_state->set_custom_minimum_size(sun_vb->get_combined_minimum_size());
- environ_state->set_custom_minimum_size(environ_vb->get_combined_minimum_size());
- } else if (p_what == NOTIFICATION_ENTER_TREE) {
- _register_all_gizmos();
- _update_gizmos_menu();
- _init_indicators();
- } else if (p_what == NOTIFICATION_THEME_CHANGED) {
- _update_gizmos_menu_theme();
- sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
- environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
- } else if (p_what == NOTIFICATION_EXIT_TREE) {
- _finish_indicators();
- } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- tool_button[Node3DEditor::TOOL_MODE_SELECT]->set_icon(get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_MOVE]->set_icon(get_theme_icon(SNAME("ToolMove"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_ROTATE]->set_icon(get_theme_icon(SNAME("ToolRotate"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_SCALE]->set_icon(get_theme_icon(SNAME("ToolScale"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_LIST_SELECT]->set_icon(get_theme_icon(SNAME("ListSelect"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_LOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Lock"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_UNLOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Unlock"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_GROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Group"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_UNGROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Ungroup"), SNAME("EditorIcons")));
-
- tool_option_button[Node3DEditor::TOOL_OPT_LOCAL_COORDS]->set_icon(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")));
- tool_option_button[Node3DEditor::TOOL_OPT_USE_SNAP]->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons")));
-
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_theme_icon(SNAME("Panels1"), SNAME("EditorIcons")));
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_theme_icon(SNAME("Panels2"), SNAME("EditorIcons")));
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels2Alt"), SNAME("EditorIcons")));
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), get_theme_icon(SNAME("Panels3"), SNAME("EditorIcons")));
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels3Alt"), SNAME("EditorIcons")));
- view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_theme_icon(SNAME("Panels4"), SNAME("EditorIcons")));
-
- // Update grid color by rebuilding grid.
- _finish_grid();
- _init_grid();
- } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
- if (!is_visible() && tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->is_pressed()) {
- EditorDebuggerNode *debugger = EditorDebuggerNode::get_singleton();
+ get_tree()->connect("node_removed", callable_mp(this, &Node3DEditor::_node_removed));
+ get_tree()->connect("node_added", callable_mp(this, &Node3DEditor::_node_added));
+ EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->connect("node_changed", callable_mp(this, &Node3DEditor::_refresh_menu_icons));
+ editor_selection->connect("selection_changed", callable_mp(this, &Node3DEditor::_selection_changed));
- debugger->set_camera_override(EditorDebuggerNode::OVERRIDE_NONE);
- tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_pressed(false);
- }
+ editor->connect("stop_pressed", callable_mp(this, &Node3DEditor::_update_camera_override_button), make_binds(false));
+ editor->connect("play_pressed", callable_mp(this, &Node3DEditor::_update_camera_override_button), make_binds(true));
+
+ _update_preview_environment();
+
+ sun_state->set_custom_minimum_size(sun_vb->get_combined_minimum_size());
+ environ_state->set_custom_minimum_size(environ_vb->get_combined_minimum_size());
+ } break;
+ case NOTIFICATION_ENTER_TREE: {
+ _update_theme();
+ _register_all_gizmos();
+ _update_gizmos_menu();
+ _init_indicators();
+ } break;
+ case NOTIFICATION_EXIT_TREE: {
+ _finish_indicators();
+ } break;
+ case NOTIFICATION_THEME_CHANGED: {
+ _update_theme();
+ _update_gizmos_menu_theme();
+ sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
+ environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
+ } break;
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+ // Update grid color by rebuilding grid.
+ _finish_grid();
+ _init_grid();
+ } break;
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+ if (!is_visible() && tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->is_pressed()) {
+ EditorDebuggerNode *debugger = EditorDebuggerNode::get_singleton();
+
+ debugger->set_camera_override(EditorDebuggerNode::OVERRIDE_NONE);
+ tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_pressed(false);
+ }
+ } break;
}
}
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index 576e4c93d3..0c7a0d14a2 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -723,6 +723,8 @@ private:
void _add_sun_to_scene(bool p_already_added_environment = false);
void _add_environment_to_scene(bool p_already_added_sun = false);
+ void _update_theme();
+
protected:
void _notification(int p_what);
//void _gui_input(InputEvent p_event);
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 0cb5a2e1e4..cbea2405b8 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -181,13 +181,13 @@ void ResourcePreloaderEditor::_update_library() {
preloader->get_resource_list(&rnames);
List<String> names;
- for (StringName &E : rnames) {
+ for (const StringName &E : rnames) {
names.push_back(E);
}
names.sort();
- for (String &E : names) {
+ for (const String &E : names) {
TreeItem *ti = tree->create_item(root);
ti->set_cell_mode(0, TreeItem::CELL_MODE_STRING);
ti->set_editable(0, true);
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index 95e23d0c57..ed91f174d1 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -70,7 +70,7 @@ void EditorPropertyRootMotion::_node_assign() {
List<StringName> animations;
player->get_animation_list(&animations);
- for (StringName &E : animations) {
+ for (const StringName &E : animations) {
Ref<Animation> anim = player->get_animation(E);
for (int i = 0; i < anim->get_track_count(); i++) {
paths.insert(anim->track_get_path(i));
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index ab783c87e9..668a15da37 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -103,7 +103,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color type_color = EDITOR_GET("text_editor/highlighting/engine_type_color");
List<StringName> types;
ClassDB::get_class_list(&types);
- for (StringName &E : types) {
+ for (const StringName &E : types) {
String n = E;
if (n.begins_with("_")) {
n = n.substr(1, n.length());
@@ -115,7 +115,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color usertype_color = EDITOR_GET("text_editor/highlighting/user_type_color");
List<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes);
- for (StringName &E : global_classes) {
+ for (const StringName &E : global_classes) {
highlighter->add_keyword_color(E, usertype_color);
}
@@ -134,7 +134,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color basetype_color = EDITOR_GET("text_editor/highlighting/base_type_color");
List<String> core_types;
script->get_language()->get_core_type_words(&core_types);
- for (String &E : core_types) {
+ for (const String &E : core_types) {
highlighter->add_keyword_color(E, basetype_color);
}
@@ -143,7 +143,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color");
List<String> keywords;
script->get_language()->get_reserved_words(&keywords);
- for (String &E : keywords) {
+ for (const String &E : keywords) {
if (script->get_language()->is_control_flow_keyword(E)) {
highlighter->add_keyword_color(E, control_flow_keyword_color);
} else {
@@ -157,7 +157,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
if (instance_base != StringName()) {
List<PropertyInfo> plist;
ClassDB::get_property_list(instance_base, &plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
String name = E.name;
if (E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP) {
continue;
@@ -170,7 +170,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
List<String> clist;
ClassDB::get_integer_constant_list(instance_base, &clist);
- for (String &E : clist) {
+ for (const String &E : clist) {
highlighter->add_member_keyword_color(E, member_variable_color);
}
}
@@ -179,7 +179,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
List<String> comments;
script->get_language()->get_comment_delimiters(&comments);
- for (String &comment : comments) {
+ for (const String &comment : comments) {
String beg = comment.get_slice(" ", 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
highlighter->add_color_region(beg, end, comment_color, end == "");
@@ -189,7 +189,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color string_color = EDITOR_GET("text_editor/highlighting/string_color");
List<String> strings;
script->get_language()->get_string_delimiters(&strings);
- for (String &string : strings) {
+ for (const String &string : strings) {
String beg = string.get_slice(" ", 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
highlighter->add_color_region(beg, end, string_color, end == "");
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index f9a0f307c3..65459d159d 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -50,7 +50,7 @@ void ConnectionInfoDialog::popup_connections(String p_method, Vector<Node *> p_n
List<Connection> all_connections;
p_nodes[i]->get_signals_connected_to_this(&all_connections);
- for (Connection &connection : all_connections) {
+ for (const Connection &connection : all_connections) {
if (connection.callable.get_method() != p_method) {
continue;
}
@@ -114,7 +114,7 @@ Vector<String> ScriptTextEditor::get_functions() {
if (script->get_language()->validate(text, script->get_path(), &fnc)) {
//if valid rewrite functions to latest
functions.clear();
- for (String &E : fnc) {
+ for (const String &E : fnc) {
functions.push_back(E);
}
}
@@ -201,7 +201,7 @@ void ScriptTextEditor::_set_theme_for_script() {
List<String> strings;
script->get_language()->get_string_delimiters(&strings);
text_edit->clear_string_delimiters();
- for (String &string : strings) {
+ for (const String &string : strings) {
String beg = string.get_slice(" ", 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
text_edit->add_string_delimiter(beg, end, end == "");
@@ -210,7 +210,7 @@ void ScriptTextEditor::_set_theme_for_script() {
List<String> comments;
script->get_language()->get_comment_delimiters(&comments);
text_edit->clear_comment_delimiters();
- for (String &comment : comments) {
+ for (const String &comment : comments) {
String beg = comment.get_slice(" ", 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
text_edit->add_comment_delimiter(beg, end, end == "");
@@ -413,7 +413,7 @@ void ScriptTextEditor::_validate_script() {
}
functions.clear();
- for (String &E : fnc) {
+ for (const String &E : fnc) {
functions.push_back(E);
}
script_is_valid = true;
@@ -428,7 +428,7 @@ void ScriptTextEditor::_validate_script() {
Node *base = get_tree()->get_edited_scene_root();
if (base && missing_connections.size() > 0) {
warnings_panel->push_table(1);
- for (Connection &connection : missing_connections) {
+ for (const Connection &connection : missing_connections) {
String base_path = base->get_name();
String source_path = base == connection.signal.get_object() ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.signal.get_object()));
String target_path = base == connection.callable.get_object() ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.callable.get_object()));
@@ -450,7 +450,7 @@ void ScriptTextEditor::_validate_script() {
// Add script warnings.
warnings_panel->push_table(3);
- for (ScriptLanguage::Warning &w : warnings) {
+ for (const ScriptLanguage::Warning &w : warnings) {
Dictionary ignore_meta;
ignore_meta["line"] = w.start_line;
ignore_meta["code"] = w.string_code.to_lower();
@@ -480,7 +480,7 @@ void ScriptTextEditor::_validate_script() {
errors_panel->clear();
errors_panel->push_table(2);
- for (ScriptLanguage::ScriptError &err : errors) {
+ for (const ScriptLanguage::ScriptError &err : errors) {
errors_panel->push_cell();
errors_panel->push_meta(err.line - 1);
errors_panel->push_color(warnings_panel->get_theme_color(SNAME("error_color"), SNAME("Editor")));
@@ -501,7 +501,7 @@ void ScriptTextEditor::_validate_script() {
if (errors.is_empty()) {
te->set_line_background_color(i, Color(0, 0, 0, 0));
} else {
- for (ScriptLanguage::ScriptError &E : errors) {
+ for (const ScriptLanguage::ScriptError &E : errors) {
bool error_line = i == E.line - 1;
te->set_line_background_color(i, error_line ? marked_line_color : Color(0, 0, 0, 0));
if (error_line) {
@@ -900,7 +900,7 @@ void ScriptTextEditor::_update_connected_methods() {
List<Connection> connections;
nodes[i]->get_signals_connected_to_this(&connections);
- for (Connection &connection : connections) {
+ for (const Connection &connection : connections) {
if (!(connection.flags & CONNECT_PERSIST)) {
continue;
}
@@ -1275,7 +1275,7 @@ void ScriptTextEditor::_edit_option_toggle_inline_comment() {
List<String> comment_delimiters;
script->get_language()->get_comment_delimiters(&comment_delimiters);
- for (String &script_delimiter : comment_delimiters) {
+ for (const String &script_delimiter : comment_delimiters) {
if (script_delimiter.find(" ") == -1) {
delimiter = script_delimiter;
break;
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 6c589ee07c..2c45b96106 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -118,7 +118,7 @@ void ShaderTextEditor::_load_theme_settings() {
const Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color");
const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color");
- for (String &E : keywords) {
+ for (const String &E : keywords) {
if (ShaderLanguage::is_control_flow_keyword(E)) {
syntax_highlighter->add_keyword_color(E, control_flow_keyword_color);
} else {
@@ -144,7 +144,7 @@ void ShaderTextEditor::_load_theme_settings() {
const Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color");
- for (String &E : built_ins) {
+ for (const String &E : built_ins) {
syntax_highlighter->add_keyword_color(E, member_variable_color);
}
@@ -770,7 +770,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
disk_changed->add_child(vbc);
Label *dl = memnew(Label);
- dl->set_text(TTR("This shader has been modified on on disk.\nWhat action should be taken?"));
+ dl->set_text(TTR("This shader has been modified on disk.\nWhat action should be taken?"));
vbc->add_child(dl);
disk_changed->connect("confirmed", callable_mp(this, &ShaderEditor::_reload_shader_from_disk));
diff --git a/editor/plugins/shader_file_editor_plugin.cpp b/editor/plugins/shader_file_editor_plugin.cpp
index 66d2b36be1..1e62261244 100644
--- a/editor/plugins/shader_file_editor_plugin.cpp
+++ b/editor/plugins/shader_file_editor_plugin.cpp
@@ -55,7 +55,7 @@ void ShaderFileEditor::_version_selected(int p_option) {
RD::ShaderStage stage = RD::SHADER_STAGE_MAX;
int first_found = -1;
- Ref<RDShaderBytecode> bytecode = shader_file->get_bytecode(version_txt);
+ Ref<RDShaderSPIRV> bytecode = shader_file->get_spirv(version_txt);
ERR_FAIL_COND(bytecode.is_null());
for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) {
@@ -142,7 +142,7 @@ void ShaderFileEditor::_update_options() {
Ref<Texture2D> icon;
- Ref<RDShaderBytecode> bytecode = shader_file->get_bytecode(version_list[i]);
+ Ref<RDShaderSPIRV> bytecode = shader_file->get_spirv(version_list[i]);
ERR_FAIL_COND(bytecode.is_null());
bool failed = false;
@@ -175,7 +175,7 @@ void ShaderFileEditor::_update_options() {
return;
}
- Ref<RDShaderBytecode> bytecode = shader_file->get_bytecode(current_version);
+ Ref<RDShaderSPIRV> bytecode = shader_file->get_spirv(current_version);
ERR_FAIL_COND(bytecode.is_null());
int first_valid = -1;
int current = -1;
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 486a40a4fd..42f7d23da2 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -365,7 +365,7 @@ void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_
int count = 0;
- for (Ref<Texture2D> &E : resources) {
+ for (const Ref<Texture2D> &E : resources) {
undo_redo->add_do_method(frames, "add_frame", edited_anim, E, p_at_pos == -1 ? -1 : p_at_pos + count);
undo_redo->add_undo_method(frames, "remove_frame", edited_anim, p_at_pos == -1 ? fc : p_at_pos);
count++;
@@ -788,7 +788,7 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
anim_names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : anim_names) {
+ for (const StringName &E : anim_names) {
String name = E;
TreeItem *it = animations->create_item(anim_root);
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 34227ee894..b277f2ab42 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -144,7 +144,7 @@ void TextureRegionEditor::_region_draw() {
}
}
} else if (snap_mode == SNAP_AUTOSLICE) {
- for (Rect2 &r : autoslice_cache) {
+ for (const Rect2 &r : autoslice_cache) {
Vector2 endpoints[4] = {
mtx.basis_xform(r.position),
mtx.basis_xform(r.position + Vector2(r.size.x, 0)),
@@ -327,7 +327,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
}
if (edited_margin < 0 && snap_mode == SNAP_AUTOSLICE) {
Vector2 point = mtx.affine_inverse().xform(Vector2(mb->get_position().x, mb->get_position().y));
- for (Rect2 &E : autoslice_cache) {
+ for (const Rect2 &E : autoslice_cache) {
if (E.has_point(point)) {
rect = E;
if (Input::get_singleton()->is_key_pressed(KEY_CTRL) && !(Input::get_singleton()->is_key_pressed(KEY_SHIFT | KEY_ALT))) {
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 991c298caa..6bcc65e30c 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -65,7 +65,7 @@ void ThemeItemImportTree::_update_items_tree() {
tree_icon_items.clear();
tree_stylebox_items.clear();
- for (StringName &E : types) {
+ for (const StringName &E : types) {
String type_name = (String)E;
TreeItem *type_node = import_items_tree->create_item(root);
@@ -93,7 +93,7 @@ void ThemeItemImportTree::_update_items_tree() {
bool data_type_has_filtered_items = false;
- for (StringName &F : names) {
+ for (const StringName &F : names) {
String item_name = (String)F;
bool is_item_matching_filter = (item_name.findn(filter_text) > -1);
if (!filter_text.is_empty() && !is_matching_filter && !is_item_matching_filter) {
@@ -182,7 +182,7 @@ void ThemeItemImportTree::_update_items_tree() {
bool data_type_any_checked_with_data = false;
filtered_names.sort_custom<StringName::AlphCompare>();
- for (StringName &F : filtered_names) {
+ for (const StringName &F : filtered_names) {
TreeItem *item_node = import_items_tree->create_item(data_type_node);
item_node->set_meta("_can_be_imported", true);
item_node->set_text(0, F);
@@ -754,7 +754,7 @@ void ThemeItemImportTree::_import_selected() {
return;
}
- // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ // Prevent changes from immediately being reported while the operation is still ongoing.
edited_theme->_freeze_change_propagation();
ProgressDialog::get_singleton()->add_task("import_theme_items", TTR("Importing Theme Items"), selected_items.size() + 2);
@@ -1236,7 +1236,7 @@ void ThemeItemEditorDialog::_update_edit_types() {
bool item_reselected = false;
edit_type_list->clear();
int e_idx = 0;
- for (StringName &E : theme_types) {
+ for (const StringName &E : theme_types) {
Ref<Texture2D> item_icon;
if (E == "") {
item_icon = get_theme_icon(SNAME("NodeDisabled"), SNAME("EditorIcons"));
@@ -1318,7 +1318,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
color_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Color Items"));
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(color_root);
item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
@@ -1339,7 +1339,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
constant_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Constant Items"));
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(constant_root);
item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
@@ -1360,7 +1360,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
font_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Font Items"));
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(font_root);
item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
@@ -1381,7 +1381,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
font_size_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Font Size Items"));
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(font_size_root);
item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
@@ -1402,7 +1402,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
icon_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Icon Items"));
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(icon_root);
item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
@@ -1423,7 +1423,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
stylebox_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All StyleBox Items"));
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(stylebox_root);
item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
@@ -1503,11 +1503,11 @@ void ThemeItemEditorDialog::_add_theme_item(Theme::DataType p_data_type, String
void ThemeItemEditorDialog::_remove_data_type_items(Theme::DataType p_data_type, String p_item_type) {
List<StringName> names;
- // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ // Prevent changes from immediately being reported while the operation is still ongoing.
edited_theme->_freeze_change_propagation();
edited_theme->get_theme_item_list(p_data_type, p_item_type, &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
edited_theme->clear_theme_item(p_data_type, E, p_item_type);
}
@@ -1518,7 +1518,7 @@ void ThemeItemEditorDialog::_remove_data_type_items(Theme::DataType p_data_type,
void ThemeItemEditorDialog::_remove_class_items() {
List<StringName> names;
- // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ // Prevent changes from immediately being reported while the operation is still ongoing.
edited_theme->_freeze_change_propagation();
for (int dt = 0; dt < Theme::DATA_TYPE_MAX; dt++) {
@@ -1526,7 +1526,7 @@ void ThemeItemEditorDialog::_remove_class_items() {
names.clear();
Theme::get_default()->get_theme_item_list(data_type, edited_item_type, &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
if (edited_theme->has_theme_item_nocheck(data_type, E, edited_item_type)) {
edited_theme->clear_theme_item(data_type, E, edited_item_type);
}
@@ -1542,7 +1542,7 @@ void ThemeItemEditorDialog::_remove_class_items() {
void ThemeItemEditorDialog::_remove_custom_items() {
List<StringName> names;
- // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ // Prevent changes from immediately being reported while the operation is still ongoing.
edited_theme->_freeze_change_propagation();
for (int dt = 0; dt < Theme::DATA_TYPE_MAX; dt++) {
@@ -1550,7 +1550,7 @@ void ThemeItemEditorDialog::_remove_custom_items() {
names.clear();
edited_theme->get_theme_item_list(data_type, edited_item_type, &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
if (!Theme::get_default()->has_theme_item_nocheck(data_type, E, edited_item_type)) {
edited_theme->clear_theme_item(data_type, E, edited_item_type);
}
@@ -1566,7 +1566,7 @@ void ThemeItemEditorDialog::_remove_custom_items() {
void ThemeItemEditorDialog::_remove_all_items() {
List<StringName> names;
- // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ // Prevent changes from immediately being reported while the operation is still ongoing.
edited_theme->_freeze_change_propagation();
for (int dt = 0; dt < Theme::DATA_TYPE_MAX; dt++) {
@@ -1574,7 +1574,7 @@ void ThemeItemEditorDialog::_remove_all_items() {
names.clear();
edited_theme->get_theme_item_list(data_type, edited_item_type, &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
edited_theme->clear_theme_item(data_type, E, edited_item_type);
}
}
@@ -1927,7 +1927,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog() {
import_another_theme_dialog->set_title(TTR("Select Another Theme Resource:"));
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("Theme", &ext);
- for (String &E : ext) {
+ for (const String &E : ext) {
import_another_theme_dialog->add_filter("*." + E + "; Theme Resource");
}
import_another_file_hb->add_child(import_another_theme_dialog);
@@ -1969,7 +1969,7 @@ void ThemeTypeDialog::_update_add_type_options(const String &p_filter) {
names.sort_custom<StringName::AlphCompare>();
Vector<StringName> unique_names;
- for (StringName &E : names) {
+ for (const StringName &E : names) {
// Filter out undesired values.
if (!p_filter.is_subsequence_ofi(String(E))) {
continue;
@@ -2132,7 +2132,7 @@ void ThemeTypeEditor::_update_type_list() {
bool item_reselected = false;
int e_idx = 0;
- for (StringName &E : theme_types) {
+ for (const StringName &E : theme_types) {
Ref<Texture2D> item_icon;
if (E == "") {
item_icon = get_theme_icon(SNAME("NodeDisabled"), SNAME("EditorIcons"));
@@ -2182,7 +2182,7 @@ OrderedHashMap<StringName, bool> ThemeTypeEditor::_get_type_items(String p_type_
(Theme::get_default().operator->()->*get_list_func)(default_type, &names);
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
items[E] = false;
}
}
@@ -2191,7 +2191,7 @@ OrderedHashMap<StringName, bool> ThemeTypeEditor::_get_type_items(String p_type_
names.clear();
(edited_theme.operator->()->*get_list_func)(p_type_name, &names);
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
items[E] = true;
}
}
@@ -2203,7 +2203,7 @@ OrderedHashMap<StringName, bool> ThemeTypeEditor::_get_type_items(String p_type_
keys.sort_custom<StringName::AlphCompare>();
OrderedHashMap<StringName, bool> ordered_items;
- for (StringName &E : keys) {
+ for (const StringName &E : keys) {
ordered_items[E] = items[E];
}
@@ -2574,13 +2574,13 @@ void ThemeTypeEditor::_add_default_type_items() {
}
updating = true;
- // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ // Prevent changes from immediately being reported while the operation is still ongoing.
edited_theme->_freeze_change_propagation();
{
names.clear();
Theme::get_default()->get_icon_list(default_type, &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
if (!edited_theme->has_icon(E, edited_type)) {
edited_theme->set_icon(E, edited_type, Ref<Texture2D>());
}
@@ -2589,7 +2589,7 @@ void ThemeTypeEditor::_add_default_type_items() {
{
names.clear();
Theme::get_default()->get_stylebox_list(default_type, &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
if (!edited_theme->has_stylebox(E, edited_type)) {
edited_theme->set_stylebox(E, edited_type, Ref<StyleBox>());
}
@@ -2598,7 +2598,7 @@ void ThemeTypeEditor::_add_default_type_items() {
{
names.clear();
Theme::get_default()->get_font_list(default_type, &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
if (!edited_theme->has_font(E, edited_type)) {
edited_theme->set_font(E, edited_type, Ref<Font>());
}
@@ -2607,7 +2607,7 @@ void ThemeTypeEditor::_add_default_type_items() {
{
names.clear();
Theme::get_default()->get_font_size_list(default_type, &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
if (!edited_theme->has_font_size(E, edited_type)) {
edited_theme->set_font_size(E, edited_type, Theme::get_default()->get_font_size(E, default_type));
}
@@ -2616,7 +2616,7 @@ void ThemeTypeEditor::_add_default_type_items() {
{
names.clear();
Theme::get_default()->get_color_list(default_type, &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
if (!edited_theme->has_color(E, edited_type)) {
edited_theme->set_color(E, edited_type, Theme::get_default()->get_color(E, default_type));
}
@@ -2625,7 +2625,7 @@ void ThemeTypeEditor::_add_default_type_items() {
{
names.clear();
Theme::get_default()->get_constant_list(default_type, &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
if (!edited_theme->has_constant(E, edited_type)) {
edited_theme->set_constant(E, edited_type, Theme::get_default()->get_constant(E, default_type));
}
@@ -2876,13 +2876,13 @@ void ThemeTypeEditor::_update_stylebox_from_leading() {
return;
}
- // Prevent changes from immediatelly being reported while the operation is still ongoing.
+ // Prevent changes from immediately being reported while the operation is still ongoing.
edited_theme->_freeze_change_propagation();
List<StringName> names;
edited_theme->get_stylebox_list(edited_type, &names);
List<Ref<StyleBox>> styleboxes;
- for (StringName &E : names) {
+ for (const StringName &E : names) {
if (E == leading_stylebox.item_name) {
continue;
}
@@ -2895,7 +2895,7 @@ void ThemeTypeEditor::_update_stylebox_from_leading() {
List<PropertyInfo> props;
leading_stylebox.stylebox->get_property_list(&props);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -2906,7 +2906,7 @@ void ThemeTypeEditor::_update_stylebox_from_leading() {
continue;
}
- for (Ref<StyleBox> F : styleboxes) {
+ for (const Ref<StyleBox> &F : styleboxes) {
Ref<StyleBox> sb = F;
sb->set(E.name, value);
}
@@ -3301,7 +3301,7 @@ ThemeEditor::ThemeEditor() {
preview_scene_dialog->set_title(TTR("Select UI Scene:"));
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &ext);
- for (String &E : ext) {
+ for (const String &E : ext) {
preview_scene_dialog->add_filter("*." + E + "; Scene");
}
main_hs->add_child(preview_scene_dialog);
@@ -3343,11 +3343,11 @@ bool ThemeEditorPlugin::handles(Object *p_node) const {
List<StringName> names;
edited_theme->get_font_type_list(&types);
- for (StringName &E : types) {
+ for (const StringName &E : types) {
names.clear();
edited_theme->get_font_list(E, &names);
- for (StringName &F : names) {
+ for (const StringName &F : names) {
if (font_item == edited_theme->get_font(F, E)) {
belongs_to_theme = true;
break;
@@ -3360,11 +3360,11 @@ bool ThemeEditorPlugin::handles(Object *p_node) const {
List<StringName> names;
edited_theme->get_stylebox_type_list(&types);
- for (StringName &E : types) {
+ for (const StringName &E : types) {
names.clear();
edited_theme->get_stylebox_list(E, &names);
- for (StringName &F : names) {
+ for (const StringName &F : names) {
if (stylebox_item == edited_theme->get_stylebox(F, E)) {
belongs_to_theme = true;
break;
@@ -3377,11 +3377,11 @@ bool ThemeEditorPlugin::handles(Object *p_node) const {
List<StringName> names;
edited_theme->get_icon_type_list(&types);
- for (StringName &E : types) {
+ for (const StringName &E : types) {
names.clear();
edited_theme->get_icon_list(E, &names);
- for (StringName &F : names) {
+ for (const StringName &F : names) {
if (icon_item == edited_theme->get_icon(F, E)) {
belongs_to_theme = true;
break;
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index dd2922286f..bab55df65a 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -1244,7 +1244,7 @@ void TileDataCollisionEditor::_polygons_changed() {
}
}
- // Remove uneeded properties and their editors.
+ // Remove unneeded properties and their editors.
for (int i = polygon_editor->get_polygon_count(); dummy_object->has_dummy_property(vformat("polygon_%d_one_way", i)); i++) {
dummy_object->remove_dummy_property(vformat("polygon_%d_one_way", i));
}
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 44822bec3a..4a4e81dae3 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -1210,9 +1210,6 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
case DRAG_TYPE_BUCKET: {
undo_redo->create_action(TTR("Paint tiles"));
for (Map<Vector2i, TileMapCell>::Element *E = drag_modified.front(); E; E = E->next()) {
- if (!erase_button->is_pressed() && E->get().source_id == TileSet::INVALID_SOURCE) {
- continue;
- }
undo_redo->add_do_method(tile_map, "set_cell", E->key(), tile_map->get_cell_source_id(E->key()), tile_map->get_cell_atlas_coords(E->key()), tile_map->get_cell_alternative_tile(E->key()));
undo_redo->add_undo_method(tile_map, "set_cell", E->key(), E->get().source_id, E->get().get_atlas_coords(), E->get().alternative_tile);
}
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index ab26e1c380..432f48fa85 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -303,7 +303,7 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
}
// Add only properties that are common to all tiles.
- for (PLData *E : data_list) {
+ for (const PLData *E : data_list) {
if (E->uses == tiles.size()) {
p_list->push_back(E->property_info);
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 7e3244dddf..46818afe45 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -666,7 +666,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
if (valid_left) {
name_left = vsnode->get_input_port_name(i);
port_left = vsnode->get_input_port_type(i);
- for (VisualShader::Connection &E : connections) {
+ for (const VisualShader::Connection &E : connections) {
if (E.to_node == p_id && E.to_port == j) {
port_left_used = true;
}
@@ -899,7 +899,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
expression_box->set_syntax_highlighter(expression_syntax_highlighter);
expression_box->add_theme_color_override("background_color", background_color);
- for (String &E : VisualShaderEditor::get_singleton()->keyword_list) {
+ for (const String &E : VisualShaderEditor::get_singleton()->keyword_list) {
if (ShaderLanguage::is_control_flow_keyword(E)) {
expression_syntax_highlighter->add_keyword_color(E, control_flow_keyword_color);
} else {
@@ -1470,7 +1470,7 @@ void VisualShaderEditor::_update_graph() {
graph_plugin->make_dirty(false);
- for (VisualShader::Connection &E : connections) {
+ for (const VisualShader::Connection &E : connections) {
int from = E.from_node;
int from_idx = E.from_port;
int to = E.to_node;
@@ -1634,7 +1634,7 @@ void VisualShaderEditor::_expand_output_port(int p_node, int p_port, bool p_expa
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (VisualShader::Connection &E : conns) {
+ for (const VisualShader::Connection &E : conns) {
int from_node = E.from_node;
int from_port = E.from_port;
int to_node = E.to_node;
@@ -1708,7 +1708,7 @@ void VisualShaderEditor::_remove_input_port(int p_node, int p_port) {
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (VisualShader::Connection &E : conns) {
+ for (const VisualShader::Connection &E : conns) {
int from_node = E.from_node;
int from_port = E.from_port;
int to_node = E.to_node;
@@ -1757,7 +1757,7 @@ void VisualShaderEditor::_remove_output_port(int p_node, int p_port) {
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (VisualShader::Connection &E : conns) {
+ for (const VisualShader::Connection &E : conns) {
int from_node = E.from_node;
int from_port = E.from_port;
int to_node = E.to_node;
@@ -2518,7 +2518,7 @@ void VisualShaderEditor::_nodes_dragged() {
undo_redo->create_action(TTR("Node(s) Moved"));
- for (DragOp &E : drag_buffer) {
+ for (const DragOp &E : drag_buffer) {
undo_redo->add_do_method(visual_shader.ptr(), "set_node_position", E.type, E.node, E.to);
undo_redo->add_undo_method(visual_shader.ptr(), "set_node_position", E.type, E.node, E.from);
undo_redo->add_do_method(graph_plugin.ptr(), "set_node_position", E.type, E.node, E.to);
@@ -2544,7 +2544,7 @@ void VisualShaderEditor::_connection_request(const String &p_from, int p_from_in
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (VisualShader::Connection &E : conns) {
+ for (const VisualShader::Connection &E : conns) {
if (E.to_node == to && E.to_port == p_to_index) {
undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
@@ -2598,7 +2598,7 @@ void VisualShaderEditor::_delete_nodes(int p_type, const List<int> &p_nodes) {
visual_shader->get_node_connections(type, &conns);
for (const int &F : p_nodes) {
- for (VisualShader::Connection &E : conns) {
+ for (const VisualShader::Connection &E : conns) {
if (E.from_node == F || E.to_node == F) {
undo_redo->add_do_method(graph_plugin.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
}
@@ -2639,7 +2639,7 @@ void VisualShaderEditor::_delete_nodes(int p_type, const List<int> &p_nodes) {
List<VisualShader::Connection> used_conns;
for (const int &F : p_nodes) {
- for (VisualShader::Connection &E : conns) {
+ for (const VisualShader::Connection &E : conns) {
if (E.from_node == F || E.to_node == F) {
bool cancel = false;
for (List<VisualShader::Connection>::Element *R = used_conns.front(); R; R = R->next()) {
@@ -3094,7 +3094,7 @@ void VisualShaderEditor::_notification(int p_what) {
preview_text->add_theme_color_override("background_color", background_color);
- for (String &E : keyword_list) {
+ for (const String &E : keyword_list) {
if (ShaderLanguage::is_control_flow_keyword(E)) {
syntax_highlighter->add_keyword_color(E, control_flow_keyword_color);
} else {
@@ -3249,7 +3249,7 @@ void VisualShaderEditor::_dup_paste_nodes(int p_type, int p_pasted_type, List<in
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(pasted_type, &conns);
- for (VisualShader::Connection &E : conns) {
+ for (const VisualShader::Connection &E : conns) {
if (unsupported_set.has(E.from_node) || unsupported_set.has(E.to_node)) {
continue;
}
@@ -3399,7 +3399,7 @@ void VisualShaderEditor::_input_select_item(Ref<VisualShaderNodeInput> p_input,
if (type_changed) {
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (VisualShader::Connection &E : conns) {
+ for (const VisualShader::Connection &E : conns) {
if (E.from_node == id) {
if (visual_shader->is_port_types_compatible(p_input->get_input_type_by_name(p_name), visual_shader->get_node(type, E.to_node)->get_input_port_type(E.to_port))) {
undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
@@ -3445,7 +3445,7 @@ void VisualShaderEditor::_uniform_select_item(Ref<VisualShaderNodeUniformRef> p_
if (type_changed) {
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (VisualShader::Connection &E : conns) {
+ for (const VisualShader::Connection &E : conns) {
if (E.from_node == id) {
if (visual_shader->is_port_types_compatible(p_uniform_ref->get_uniform_type_by_name(p_name), visual_shader->get_node(type, E.to_node)->get_input_port_type(E.to_port))) {
continue;
@@ -4825,7 +4825,7 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par
Vector<PropertyInfo> pinfo;
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
for (int i = 0; i < properties.size(); i++) {
if (E.name == String(properties[i])) {
pinfo.push_back(E);
@@ -4894,7 +4894,7 @@ void EditorPropertyShaderMode::_option_selected(int p_which) {
VisualShader::Type type = VisualShader::Type(i);
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (VisualShader::Connection &E : conns) {
+ for (const VisualShader::Connection &E : conns) {
if (E.to_node == VisualShader::NODE_ID_OUTPUT) {
undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
}
@@ -4918,7 +4918,7 @@ void EditorPropertyShaderMode::_option_selected(int p_which) {
List<PropertyInfo> props;
visual_shader->get_property_list(&props);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (E.name.begins_with("flags/") || E.name.begins_with("modes/")) {
undo_redo->add_undo_property(visual_shader.ptr(), E.name, visual_shader->get(E.name));
}
@@ -5024,7 +5024,7 @@ void VisualShaderNodePortPreview::_shader_changed() {
if (src_mat && src_mat->get_shader().is_valid()) {
List<PropertyInfo> params;
src_mat->get_shader()->get_param_list(&params);
- for (PropertyInfo &E : params) {
+ for (const PropertyInfo &E : params) {
material->set(E.name, src_mat->get(E.name));
}
}
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 3f320ef12a..fcb714bdf7 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -340,7 +340,7 @@ void ProjectExportDialog::_update_feature_list() {
}
}
- for (String &E : features) {
+ for (const String &E : features) {
fset.insert(E);
}
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 4f9d849bc0..fd4f22425f 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1238,14 +1238,14 @@ void ProjectList::load_projects() {
Set<String> favorites;
// Find favourites...
- for (PropertyInfo &E : properties) {
+ for (const PropertyInfo &E : properties) {
String property_key = E.name;
if (property_key.begins_with("favorite_projects/")) {
favorites.insert(property_key);
}
}
- for (PropertyInfo &E : properties) {
+ for (const PropertyInfo &E : properties) {
// This is actually something like "projects/C:::Documents::Godot::Projects::MyGame"
String property_key = E.name;
if (!property_key.begins_with("projects/")) {
@@ -1582,7 +1582,7 @@ int ProjectList::refresh_project(const String &dir_path) {
String favorite_property_key = "favorite_projects/" + project_key;
bool found = false;
- for (PropertyInfo &E : properties) {
+ for (const PropertyInfo &E : properties) {
String prop = E.name;
if (!found && prop == property_key) {
found = true;
@@ -2188,7 +2188,7 @@ void ProjectManager::_scan_begin(const String &p_base) {
_scan_dir(p_base, &projects);
print_line("Found " + itos(projects.size()) + " projects.");
- for (String &E : projects) {
+ for (const String &E : projects) {
String proj = get_project_key_from_path(E);
EditorSettings::get_singleton()->set("projects/" + proj, E);
}
@@ -2625,7 +2625,7 @@ ProjectManager::ProjectManager() {
Vector<String> editor_languages;
List<PropertyInfo> editor_settings_properties;
EditorSettings::get_singleton()->get_property_list(&editor_settings_properties);
- for (PropertyInfo &pi : editor_settings_properties) {
+ for (const PropertyInfo &pi : editor_settings_properties) {
if (pi.name == "interface/editor/editor_language") {
editor_languages = pi.hint_string.split(",");
break;
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index bc44fccfa0..b8ccab78dd 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -229,7 +229,7 @@ void ProjectSettingsEditor::_add_feature_overrides() {
for (int i = 0; i < ee->get_export_platform_count(); i++) {
List<String> p;
ee->get_export_platform(i)->get_platform_features(&p);
- for (String &E : p) {
+ for (const String &E : p) {
presets.insert(E);
}
}
@@ -237,7 +237,7 @@ void ProjectSettingsEditor::_add_feature_overrides() {
for (int i = 0; i < ee->get_export_preset_count(); i++) {
List<String> p;
ee->get_export_preset(i)->get_platform()->get_preset_features(ee->get_export_preset(i), &p);
- for (String &E : p) {
+ for (const String &E : p) {
presets.insert(E);
}
@@ -391,7 +391,7 @@ void ProjectSettingsEditor::_action_reordered(const String &p_action_name, const
undo_redo->create_action(TTR("Update Input Action Order"));
- for (PropertyInfo &prop : props) {
+ for (const PropertyInfo &prop : props) {
// Skip builtins and non-inputs
if (ProjectSettings::get_singleton()->is_builtin_setting(prop.name) || !prop.name.begins_with("input/")) {
continue;
@@ -444,7 +444,7 @@ void ProjectSettingsEditor::_update_action_map_editor() {
ProjectSettings::get_singleton()->get_property_list(&props);
const Ref<Texture2D> builtin_icon = get_theme_icon(SNAME("PinPressed"), SNAME("EditorIcons"));
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
const String property_name = E.name;
if (!property_name.begins_with("input/")) {
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 6fc77500c3..7338588d56 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -143,7 +143,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
}
Set<String> valid_extensions;
- for (String &E : extensions) {
+ for (const String &E : extensions) {
valid_extensions.insert(E);
}
@@ -179,7 +179,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
res_orig->get_property_list(&property_list);
List<Pair<String, Variant>> propvalues;
- for (PropertyInfo &pi : property_list) {
+ for (const PropertyInfo &pi : property_list) {
Pair<String, Variant> p;
if (pi.usage & PROPERTY_USAGE_STORAGE) {
p.first = pi.name;
@@ -197,7 +197,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
ERR_FAIL_COND(res.is_null());
- for (Pair<String, Variant> &p : propvalues) {
+ for (const Pair<String, Variant> &p : propvalues) {
res->set(p.first, p.second);
}
@@ -1291,7 +1291,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
ResourceLoader::get_recognized_extensions_for_type(type, &extensions);
file->clear_filters();
- for (String &E : extensions) {
+ for (const String &E : extensions) {
file->add_filter("*." + E + " ; " + E.to_upper());
}
@@ -1319,7 +1319,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
res_orig->get_property_list(&property_list);
List<Pair<String, Variant>> propvalues;
- for (PropertyInfo &pi : property_list) {
+ for (const PropertyInfo &pi : property_list) {
Pair<String, Variant> p;
if (pi.usage & PROPERTY_USAGE_STORAGE) {
p.first = pi.name;
@@ -1333,7 +1333,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
ERR_FAIL_COND(res.is_null());
- for (Pair<String, Variant> &p : propvalues) {
+ for (const Pair<String, Variant> &p : propvalues) {
res->set(p.first, p.second);
}
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 471fec76f2..a1deae92a4 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -156,7 +156,7 @@ void PropertySelector::_update_search() {
search_options->get_theme_icon(SNAME("PackedColorArray"), SNAME("EditorIcons"))
};
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (E.usage == PROPERTY_USAGE_CATEGORY) {
if (category && category->get_first_child() == nullptr) {
memdelete(category); //old category was unused
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 2586a36966..c4d47c7594 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1531,7 +1531,7 @@ void SceneTreeDock::perform_node_renames(Node *p_base, Map<Node *, NodePath> *p_
List<PropertyInfo> properties;
p_base->get_property_list(&properties);
- for (PropertyInfo &E : properties) {
+ for (const PropertyInfo &E : properties) {
if (!(E.usage & (PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR))) {
continue;
}
@@ -1557,7 +1557,7 @@ void SceneTreeDock::perform_node_renames(Node *p_base, Map<Node *, NodePath> *p_
Map<Node *, NodePath>::Element *found_root_path = p_renames->find(root);
NodePath new_root_path = found_root_path ? found_root_path->get() : root->get_path();
if (!new_root_path.is_empty()) { // No renaming if root node is deleted.
- for (StringName &E : anims) {
+ for (const StringName &E : anims) {
Ref<Animation> anim = ap->get_animation(E);
if (!r_rem_anims->has(anim)) {
r_rem_anims->insert(anim, Set<int>());
@@ -2271,7 +2271,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop
List<PropertyInfo> pinfo;
n->get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -2308,12 +2308,11 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop
List<MethodInfo> sl;
n->get_signal_list(&sl);
- for (MethodInfo &E : sl) {
+ for (const MethodInfo &E : sl) {
List<Object::Connection> cl;
n->get_signal_connection_list(E.name, &cl);
- for (Object::Connection &F : cl) {
- Object::Connection &c = F;
+ for (const Object::Connection &c : cl) {
if (!(c.flags & Object::CONNECT_PERSIST)) {
continue;
}
@@ -2519,13 +2518,13 @@ void SceneTreeDock::_files_dropped(Vector<String> p_files, NodePath p_to, int p_
List<PropertyInfo> pinfo;
node->get_property_list(&pinfo);
- for (PropertyInfo &p : pinfo) {
+ for (const PropertyInfo &p : pinfo) {
if (!(p.usage & PROPERTY_USAGE_EDITOR) || !(p.usage & PROPERTY_USAGE_STORAGE) || p.hint != PROPERTY_HINT_RESOURCE_TYPE) {
continue;
}
Vector<String> valid_types = p.hint_string.split(",");
- for (String &prop_type : valid_types) {
+ for (const String &prop_type : valid_types) {
if (res_type == prop_type || ClassDB::is_parent_class(res_type, prop_type) || EditorNode::get_editor_data().script_class_is_parent(res_type, prop_type)) {
valid_properties.push_back(p.name);
break;
@@ -2539,7 +2538,7 @@ void SceneTreeDock::_files_dropped(Vector<String> p_files, NodePath p_to, int p_
bool capitalize = bool(EDITOR_GET("interface/inspector/capitalize_properties"));
menu_properties->clear();
- for (String &p : valid_properties) {
+ for (const String &p : valid_properties) {
menu_properties->add_item(capitalize ? p.capitalize() : p);
menu_properties->set_item_metadata(menu_properties->get_item_count() - 1, p);
}
@@ -2597,7 +2596,7 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) {
List<PropertyInfo> pinfo;
p_obj->get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (!(E.usage & PROPERTY_USAGE_EDITOR)) {
continue;
}
@@ -3052,7 +3051,7 @@ void SceneTreeDock::_create_remap_for_node(Node *p_node, Map<RES, RES> &r_remap)
p_node->get_property_list(&props);
bool is_instantiated = EditorPropertyRevert::may_node_be_in_instance(p_node);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -3088,7 +3087,7 @@ void SceneTreeDock::_create_remap_for_resource(RES p_resource, Map<RES, RES> &r_
List<PropertyInfo> props;
p_resource->get_property_list(&props);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 90481b2107..9a4b38db74 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -205,7 +205,7 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must
bool found = false;
bool match = false;
int index = 0;
- for (String &E : extensions) {
+ for (const String &E : extensions) {
if (E.nocasecmp_to(extension) == 0) {
//FIXME (?) - changing language this way doesn't update controls, needs rework
//language_menu->select(index); // change Language option by extension
@@ -373,7 +373,7 @@ void ScriptCreateDialog::_lang_changed(int l) {
ScriptServer::get_language(m)->get_recognized_extensions(&extensions);
}
- for (String &E : extensions) {
+ for (const String &E : extensions) {
if (E.nocasecmp_to(extension) == 0) {
path = path.get_basename() + selected_ext;
_path_changed(path);
@@ -534,7 +534,7 @@ void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) {
int lang = language_menu->get_selected();
ScriptServer::get_language(lang)->get_recognized_extensions(&extensions);
- for (String &E : extensions) {
+ for (const String &E : extensions) {
file_browse->add_filter("*." + E);
}
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 89e102ee22..b3ec0c96c4 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -324,7 +324,7 @@ void EditorSettingsDialog::_update_shortcuts() {
List<String> slist;
EditorSettings::get_singleton()->get_shortcut_list(&slist);
- for (String &E : slist) {
+ for (const String &E : slist) {
Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(E);
if (!sc->has_meta("original")) {
continue;
@@ -403,7 +403,7 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
List<Ref<InputEvent>> defaults = InputMap::get_singleton()->get_builtins()[current_action];
// Convert the list to an array, and only keep key events as this is for the editor.
- for (Ref<InputEvent> k : defaults) {
+ for (const Ref<InputEvent> &k : defaults) {
if (k.is_valid()) {
events.append(k);
}
diff --git a/editor/translations/af.po b/editor/translations/af.po
index bb7e7ca553..6a74789da2 100644
--- a/editor/translations/af.po
+++ b/editor/translations/af.po
@@ -5251,8 +5251,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/ar.po b/editor/translations/ar.po
index 6d8db6f47b..b851db361f 100644
--- a/editor/translations/ar.po
+++ b/editor/translations/ar.po
@@ -52,12 +52,13 @@
# ILG - Game <moegypt277@gmail.com>, 2021.
# Hatim Jamal <hatimjamal8@gmail.com>, 2021.
# HASSAN GAMER - حسن جيمر <gamerhassan55@gmail.com>, 2021.
+# abubakrAlsaab <madeinsudan19@gmail.com>, 2021.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-07-09 14:32+0000\n"
-"Last-Translator: HASSAN GAMER - حسن جيمر <gamerhassan55@gmail.com>\n"
+"PO-Revision-Date: 2021-07-16 05:47+0000\n"
+"Last-Translator: abubakrAlsaab <madeinsudan19@gmail.com>\n"
"Language-Team: Arabic <https://hosted.weblate.org/projects/godot-engine/"
"godot/ar/>\n"
"Language: ar\n"
@@ -66,7 +67,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
-"X-Generator: Weblate 4.8-dev\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -3021,7 +3022,7 @@ msgstr "حول"
#: editor/editor_node.cpp
msgid "Support Godot Development"
-msgstr ""
+msgstr "إدعم تطوير محرك غو-دوت"
#: editor/editor_node.cpp
msgid "Play the project."
@@ -5215,9 +5216,10 @@ msgstr ""
"الضوء المعدة مسبقا."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"لايوجد ميش لكي يتم تجهيزة. تاكد من انه يحتوي على منفذ UV2 و ان زر الضوء "
"'المعد' مفعل."
@@ -5342,7 +5344,7 @@ msgstr "تعديل حجم العقدة \"Node2D \"%s إلى (s, %s%)"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Resize Control \"%s\" to (%d, %d)"
-msgstr ""
+msgstr "تغيير حجم عنصر التحكم \"٪ s\" إلى (٪ d،٪ d)"
#: editor/plugins/canvas_item_editor_plugin.cpp
#, fuzzy
@@ -7566,6 +7568,7 @@ msgstr "تدوير الرؤية مقفول"
msgid ""
"To zoom further, change the camera's clipping planes (View -> Settings...)"
msgstr ""
+"للتكبير بشكل أكبر ، قم بتغيير مستويات اقتصاص الكاميرا (عرض -> الإعدادات ...)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid ""
@@ -9536,7 +9539,7 @@ msgstr ""
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "A reference to an existing uniform."
-msgstr ""
+msgstr "إشارة إلى زي موحد موجود."
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "(Fragment/Light mode only) Scalar derivative function."
@@ -9903,7 +9906,7 @@ msgstr "OpenGL ES 3.0"
#: editor/project_manager.cpp
msgid "Not supported by your GPU drivers."
-msgstr ""
+msgstr "غير مدعوم من قبل برامج تشغيل GPU(اجهزة اارسوم) الخاصة بك."
#: editor/project_manager.cpp
msgid ""
@@ -10959,6 +10962,9 @@ msgid ""
"every time it updates.\n"
"Switch back to the Local scene tree dock to improve performance."
msgstr ""
+"إذا تم تحديده ، فسيؤدي شجرة المشهد إلى توقف المشروع في كل مرة يتم فيها "
+"تحديثه.\n"
+"قم بالتبديل مرة أخرى إلى رصيف شجرة المشهد المحلي لتحسين الأداء."
#: editor/scene_tree_dock.cpp
msgid "Local"
@@ -11657,11 +11663,11 @@ msgstr ""
#: modules/lightmapper_cpu/lightmapper_cpu.cpp
msgid "Begin Bake"
-msgstr ""
+msgstr "ابدأ الخبز (دمج تاثير الضوء في الصورة )"
#: modules/lightmapper_cpu/lightmapper_cpu.cpp
msgid "Preparing data structures"
-msgstr ""
+msgstr "تحضير هياكل البيانات"
#: modules/lightmapper_cpu/lightmapper_cpu.cpp
#, fuzzy
@@ -12192,7 +12198,7 @@ msgstr "اختر جهازاً من القائمة"
#: platform/android/export/export.cpp
msgid "Unable to find the 'apksigner' tool."
-msgstr ""
+msgstr "تعذر العثور على أداة توقيع تطبيق اندرويد\"apksigner\"."
#: platform/android/export/export.cpp
msgid ""
diff --git a/editor/translations/az.po b/editor/translations/az.po
index 054bc9263d..be05c12c5c 100644
--- a/editor/translations/az.po
+++ b/editor/translations/az.po
@@ -5056,8 +5056,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/bg.po b/editor/translations/bg.po
index 7bf3d40805..9759e3d1e5 100644
--- a/editor/translations/bg.po
+++ b/editor/translations/bg.po
@@ -5042,9 +5042,10 @@ msgstr ""
"Запазете сцената и опитайте отново."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Няма полигонни мрежи за изпичане. Уверете се, че те съдържат канал UV2 и че "
"флагът „Изпичане на светлината“ е включен."
diff --git a/editor/translations/bn.po b/editor/translations/bn.po
index 70a66820fb..f4a10f7dea 100644
--- a/editor/translations/bn.po
+++ b/editor/translations/bn.po
@@ -5526,8 +5526,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/br.po b/editor/translations/br.po
index 9d1e52e009..0fe39331f9 100644
--- a/editor/translations/br.po
+++ b/editor/translations/br.po
@@ -5000,8 +5000,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/ca.po b/editor/translations/ca.po
index 1032b7cdeb..40429cc0e0 100644
--- a/editor/translations/ca.po
+++ b/editor/translations/ca.po
@@ -5277,9 +5277,10 @@ msgstr ""
"camí des de les propietats de BakedLightmap."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Cap Malla per precalcular. Comproveu que disposin d'un canal d'UV2 i que "
"l'indicador 'Bake Light' és activat."
diff --git a/editor/translations/cs.po b/editor/translations/cs.po
index 3aaf91d758..281bc500f2 100644
--- a/editor/translations/cs.po
+++ b/editor/translations/cs.po
@@ -30,8 +30,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-06-25 02:57+0000\n"
-"Last-Translator: Vojtěch Šamla <auzkok@seznam.cz>\n"
+"PO-Revision-Date: 2021-07-26 14:18+0000\n"
+"Last-Translator: Zbyněk <zbynek.fiala@gmail.com>\n"
"Language-Team: Czech <https://hosted.weblate.org/projects/godot-engine/godot/"
"cs/>\n"
"Language: cs\n"
@@ -39,7 +39,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
-"X-Generator: Weblate 4.7.1-dev\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -5139,7 +5139,7 @@ msgstr "Poslední"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "All"
-msgstr "Všechny"
+msgstr "všichni"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "No results for \"%s\"."
@@ -5194,9 +5194,10 @@ msgstr ""
"Uložte scénu a zkuste to znovu."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Žádné sítě k zapečení. Ujistěte se, že obsahují kanál UV2 a že je nastaven "
"příznak \"Zapéct světlo\"."
@@ -10546,7 +10547,7 @@ msgstr "Hodnota, o kterou se počítadlo zvýší za každý uzel"
#: editor/rename_dialog.cpp
msgid "Padding"
-msgstr "Odsazení"
+msgstr "Zarovnávání"
#: editor/rename_dialog.cpp
msgid ""
diff --git a/editor/translations/da.po b/editor/translations/da.po
index 9e09250fbc..c86ec25b4b 100644
--- a/editor/translations/da.po
+++ b/editor/translations/da.po
@@ -5390,8 +5390,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/de.po b/editor/translations/de.po
index bbf72f815b..954f8426f8 100644
--- a/editor/translations/de.po
+++ b/editor/translations/de.po
@@ -5289,9 +5289,10 @@ msgstr ""
"Ein Speichern der Szene sollte dieses Problem beheben."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Keine Meshes zum vorrendern vorhanden. Meshes, die vorgerendert werden "
"sollen, müssen einen UV2-Kanal beinhalten und die ‚Bake Light‘-Option "
diff --git a/editor/translations/editor.pot b/editor/translations/editor.pot
index a0f4654639..ae7b6b37dc 100644
--- a/editor/translations/editor.pot
+++ b/editor/translations/editor.pot
@@ -4980,8 +4980,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
@@ -6979,7 +6979,7 @@ msgstr ""
#: editor/plugins/shader_editor_plugin.cpp
msgid ""
-"This shader has been modified on on disk.\n"
+"This shader has been modified on disk.\n"
"What action should be taken?"
msgstr ""
diff --git a/editor/translations/el.po b/editor/translations/el.po
index 035a82f99f..40d8ab46cc 100644
--- a/editor/translations/el.po
+++ b/editor/translations/el.po
@@ -5239,9 +5239,10 @@ msgstr ""
"Αποθηκεύστε τη σκηνή σας και δοκιμάστε ξανα."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Δεν υπάρχουν πλέγματα για προετοιμασία. Σιγουρευτείτε ότι εμπεριέχουν κανάλι "
"UV2 και πως η σημαία 'Bake Light' είναι ενεργοποιημένη."
diff --git a/editor/translations/eo.po b/editor/translations/eo.po
index 0523742303..38c72380da 100644
--- a/editor/translations/eo.po
+++ b/editor/translations/eo.po
@@ -5204,8 +5204,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/es.po b/editor/translations/es.po
index 5953536c60..e09d1df8c7 100644
--- a/editor/translations/es.po
+++ b/editor/translations/es.po
@@ -72,7 +72,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-07-05 21:41+0000\n"
+"PO-Revision-Date: 2021-07-16 05:47+0000\n"
"Last-Translator: Erick Figueroa <querecuto@hotmail.com>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/godot-engine/"
"godot/es/>\n"
@@ -81,7 +81,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.8-dev\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -1205,7 +1205,7 @@ msgstr "Desarrollador Principal"
#. you do not have to keep it in your translation.
#: editor/editor_about.cpp
msgid "Project Manager "
-msgstr "Gestor del Proyecto "
+msgstr "Administrador de Proyectos "
#: editor/editor_about.cpp
msgid "Developers"
@@ -3078,7 +3078,7 @@ msgstr "Apoyar el desarrollo de Godot"
#: editor/editor_node.cpp
msgid "Play the project."
-msgstr "Reproducir el proyecto."
+msgstr "Ejecutar el proyecto."
#: editor/editor_node.cpp
msgid "Play"
@@ -5293,9 +5293,10 @@ msgstr ""
"Guarda tu escena e inténtalo de nuevo."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"No hay mallas para hacer bake. Asegúrate que contengan un canal UV2 y que la "
"opción de 'Bake Light' está activada."
@@ -10154,8 +10155,8 @@ msgid ""
"The interface will update after restarting the editor or project manager."
msgstr ""
"Idioma cambiado.\n"
-"La interfaz se actualizará después de reiniciar el editor o el gestor de "
-"proyectos."
+"La interfaz se actualizará después de reiniciar el editor o el administrador "
+"de proyectos."
#: editor/project_manager.cpp
msgid ""
@@ -11737,7 +11738,7 @@ msgstr "Eliminar Rotación del Cursor"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Paste Selects"
-msgstr "Pegar Selecciona"
+msgstr "Pegar Seleccionados"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Clear Selection"
diff --git a/editor/translations/es_AR.po b/editor/translations/es_AR.po
index d1fe06a565..33c29d9c6e 100644
--- a/editor/translations/es_AR.po
+++ b/editor/translations/es_AR.po
@@ -5237,9 +5237,10 @@ msgstr ""
"Guardá tu escena e inténtalo de nuevo."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"No hay meshes para hacer bake. Asegúrate que contienen un canal UV2 y que el "
"flag 'Bake Light' esta activado."
diff --git a/editor/translations/et.po b/editor/translations/et.po
index 05a414f5a9..fd534943b1 100644
--- a/editor/translations/et.po
+++ b/editor/translations/et.po
@@ -10,7 +10,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2021-05-10 15:32+0000\n"
+"PO-Revision-Date: 2021-07-16 05:47+0000\n"
"Last-Translator: Kritzmensch <streef.gtx@gmail.com>\n"
"Language-Team: Estonian <https://hosted.weblate.org/projects/godot-engine/"
"godot/et/>\n"
@@ -18,7 +18,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.7-dev\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -1090,7 +1090,7 @@ msgstr "Suur tänu Godot kogukonnalt!"
#: editor/editor_about.cpp editor/editor_node.cpp editor/project_manager.cpp
msgid "Click to copy."
-msgstr ""
+msgstr "Klõpsa, et kopeerida."
#: editor/editor_about.cpp
msgid "Godot Engine contributors"
@@ -5039,8 +5039,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
@@ -7244,7 +7244,7 @@ msgstr "Kuva tavaliselt"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Display Wireframe"
-msgstr "Kuva traadiraamina"
+msgstr "Kuva traatraamina"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Display Overdraw"
diff --git a/editor/translations/eu.po b/editor/translations/eu.po
index 87c91de10e..f9f2d97348 100644
--- a/editor/translations/eu.po
+++ b/editor/translations/eu.po
@@ -5012,8 +5012,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/fa.po b/editor/translations/fa.po
index ddccfeaebe..ab4157565e 100644
--- a/editor/translations/fa.po
+++ b/editor/translations/fa.po
@@ -5191,8 +5191,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/fi.po b/editor/translations/fi.po
index 834d1894e3..1007ee660b 100644
--- a/editor/translations/fi.po
+++ b/editor/translations/fi.po
@@ -5195,9 +5195,10 @@ msgstr ""
"Tallenna skenesi ja yritä uudelleen."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Ei meshejä kehitettävänä. Varmista, että ne sisältävät UV2-kanavan, ja että "
"'Bake Light' asetus on päällä."
diff --git a/editor/translations/fil.po b/editor/translations/fil.po
index 892968821b..b23a43088c 100644
--- a/editor/translations/fil.po
+++ b/editor/translations/fil.po
@@ -4998,8 +4998,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/fr.po b/editor/translations/fr.po
index 6fad70a7c2..d4ded02294 100644
--- a/editor/translations/fr.po
+++ b/editor/translations/fr.po
@@ -85,8 +85,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-07-01 14:33+0000\n"
-"Last-Translator: Clément Topy <topy72.mine@gmail.com>\n"
+"PO-Revision-Date: 2021-07-16 05:47+0000\n"
+"Last-Translator: Pierre Caye <pierrecaye@laposte.net>\n"
"Language-Team: French <https://hosted.weblate.org/projects/godot-engine/"
"godot/fr/>\n"
"Language: fr\n"
@@ -94,7 +94,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
-"X-Generator: Weblate 4.8-dev\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -5258,7 +5258,7 @@ msgstr "Dernier"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "All"
-msgstr "Tout"
+msgstr "All"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "No results for \"%s\"."
@@ -5314,11 +5314,12 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
-"Aucun maillage à transférer. Assurez-vous qu'ils contiennent un canal UV2 et "
-"que l'indicateur « Bake Light » est activé."
+"Aucun maillage à précalculer. Assurez-vous qu'ils contiennent un canal UV2 "
+"et que les propriétés « Use In Bake Light » et « Generate Lightmap » soient "
+"activées."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Failed creating lightmap images, make sure path is writable."
diff --git a/editor/translations/ga.po b/editor/translations/ga.po
index 8168c1a440..9db93e38f8 100644
--- a/editor/translations/ga.po
+++ b/editor/translations/ga.po
@@ -4995,8 +4995,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/gl.po b/editor/translations/gl.po
index 016a3ab589..68e7b47599 100644
--- a/editor/translations/gl.po
+++ b/editor/translations/gl.po
@@ -5162,8 +5162,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/he.po b/editor/translations/he.po
index 5dc30a6cc2..a989a8aad0 100644
--- a/editor/translations/he.po
+++ b/editor/translations/he.po
@@ -5214,9 +5214,10 @@ msgstr ""
"ממאפייני BakedLightmap."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr "אין רשתות לאפייה. ודא/י שהם מכילים ערוץ UV2 והדגל 'Bake Light' מאופשר."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/hi.po b/editor/translations/hi.po
index db1dcd67e6..70187feed0 100644
--- a/editor/translations/hi.po
+++ b/editor/translations/hi.po
@@ -5137,8 +5137,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/hr.po b/editor/translations/hr.po
index d737bb04b7..c62d3f3eb5 100644
--- a/editor/translations/hr.po
+++ b/editor/translations/hr.po
@@ -9,7 +9,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2021-04-11 22:02+0000\n"
+"PO-Revision-Date: 2021-07-16 05:47+0000\n"
"Last-Translator: LeoClose <leoclose575@gmail.com>\n"
"Language-Team: Croatian <https://hosted.weblate.org/projects/godot-engine/"
"godot/hr/>\n"
@@ -18,7 +18,7 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
-"X-Generator: Weblate 4.6-dev\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -41,7 +41,7 @@ msgstr "Neispravan unos %i (nije uspio) u izrazu"
#: core/math/expression.cpp
msgid "self can't be used because instance is null (not passed)"
-msgstr "self nije moguće koristiti jer je jedinka null (nije uspio)"
+msgstr "self se ne može koristiti jer instanca je null (nije prosljeđena)"
#: core/math/expression.cpp
msgid "Invalid operands to operator %s, %s and %s."
@@ -1716,7 +1716,7 @@ msgstr "Novo"
#: editor/editor_feature_profile.cpp editor/editor_node.cpp
#: editor/project_manager.cpp
msgid "Import"
-msgstr "Uvoz"
+msgstr "Uvezi"
#: editor/editor_feature_profile.cpp editor/project_export.cpp
msgid "Export"
@@ -2861,7 +2861,7 @@ msgstr "Zajednica"
#: editor/editor_node.cpp
msgid "About"
-msgstr ""
+msgstr "U vezi s"
#: editor/editor_node.cpp
msgid "Support Godot Development"
@@ -5009,8 +5009,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/hu.po b/editor/translations/hu.po
index 85933dc05d..7a2e35e37b 100644
--- a/editor/translations/hu.po
+++ b/editor/translations/hu.po
@@ -5180,9 +5180,10 @@ msgstr ""
"tulajdonságaiból."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Nincs mesh, amibe adatokat süthetne. Bizonyosodjon meg arról, hogy "
"tartalmaznak egy UV2 csatornát, és hogy a 'Fény Besütése' opció be van "
diff --git a/editor/translations/id.po b/editor/translations/id.po
index e1029fc231..4dce64fd92 100644
--- a/editor/translations/id.po
+++ b/editor/translations/id.po
@@ -5210,9 +5210,10 @@ msgstr ""
"Simpan skena Anda dan coba lagi."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Tidak ada mesh-mesh untuk di bake. Pastikan mereka punya kanal UV2 dan 'Bake "
"Cahaya' menyala."
diff --git a/editor/translations/is.po b/editor/translations/is.po
index fc1423d841..c7d7023690 100644
--- a/editor/translations/is.po
+++ b/editor/translations/is.po
@@ -5051,8 +5051,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/it.po b/editor/translations/it.po
index 60c362c63a..f1de95dac6 100644
--- a/editor/translations/it.po
+++ b/editor/translations/it.po
@@ -59,12 +59,13 @@
# Alessandro Mandelli <mandelli.alessandro@ngi.it>, 2021.
# Jusef Azzolina <rosarioazzolina33@gmail.com>, 2021.
# Daniele Basso <tiziodcaio@gmail.com>, 2021.
+# Riteo Siuga <riteo@posteo.net>, 2021.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-06-15 19:34+0000\n"
-"Last-Translator: Riteo Siuga <lorenzocerqua@tutanota.com>\n"
+"PO-Revision-Date: 2021-07-26 14:18+0000\n"
+"Last-Translator: Riteo Siuga <riteo@posteo.net>\n"
"Language-Team: Italian <https://hosted.weblate.org/projects/godot-engine/"
"godot/it/>\n"
"Language: it\n"
@@ -72,7 +73,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.7-dev\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -876,6 +877,7 @@ msgid "Deferred"
msgstr "Differita"
#: editor/connections_dialog.cpp
+#, fuzzy
msgid ""
"Defers the signal, storing it in a queue and only firing it at idle time."
msgstr ""
@@ -1172,7 +1174,7 @@ msgstr "Grazie dalla comunità di Godot!"
#: editor/editor_about.cpp editor/editor_node.cpp editor/project_manager.cpp
msgid "Click to copy."
-msgstr ""
+msgstr "Clicca per copiare."
#: editor/editor_about.cpp
msgid "Godot Engine contributors"
@@ -2348,7 +2350,7 @@ msgid ""
msgstr ""
"Questa scena non può essere salvata perché contiene un'istanziazione "
"ciclica.\n"
-"Riprovare ad eseguire il salvataggio dopo aver risolto il problema."
+"Riprovare a eseguire il salvataggio dopo aver risolto il problema."
#: editor/editor_node.cpp
msgid ""
@@ -2962,7 +2964,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Synchronize Scene Changes"
-msgstr "Sincronizza i cambi della scena"
+msgstr "Sincronizza i cambiamenti delle scene"
#: editor/editor_node.cpp
msgid ""
@@ -2978,9 +2980,10 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Synchronize Script Changes"
-msgstr "Sincronizza Modifiche Script"
+msgstr "Sincronizza le modifiche degli script"
#: editor/editor_node.cpp
+#, fuzzy
msgid ""
"When this option is enabled, any script that is saved will be reloaded in "
"the running project.\n"
@@ -2989,7 +2992,7 @@ msgid ""
msgstr ""
"Quando questa opzione è abilitata, qualsiasi script salvato verrà ricaricato "
"nel progetto in esecuzione.\n"
-"Quando usato in remoto su un dispositivo, essa risulta più efficate "
+"Quando usato in remoto su un dispositivo, essa risulta più efficace "
"abilitando l'opzione \"network filesystem\"."
#: editor/editor_node.cpp editor/script_create_dialog.cpp
@@ -3062,6 +3065,7 @@ msgid "Report a Bug"
msgstr "Segnala un problema"
#: editor/editor_node.cpp
+#, fuzzy
msgid "Send Docs Feedback"
msgstr "Valuta la documentazione"
@@ -3078,6 +3082,7 @@ msgid "Support Godot Development"
msgstr "Supporta lo sviluppo di Godot"
#: editor/editor_node.cpp
+#, fuzzy
msgid "Play the project."
msgstr "Esegui il progetto."
@@ -3091,7 +3096,7 @@ msgstr "Metti in pausa l'esecuzione della scena per eseguire il debug."
#: editor/editor_node.cpp
msgid "Pause Scene"
-msgstr "Pausa scena"
+msgstr "Pausa la scena"
#: editor/editor_node.cpp
msgid "Stop the scene."
@@ -3115,7 +3120,7 @@ msgstr "Avvia una scena personalizzata"
#: editor/editor_node.cpp
msgid "Changing the video driver requires restarting the editor."
-msgstr "Il cambiamento dei driver video necessita il riavvio dell'editor."
+msgstr "Il cambiamento dei driver video necessita di un riavvio dell'editor."
#: editor/editor_node.cpp editor/project_settings_editor.cpp
#: editor/settings_config_dialog.cpp
@@ -3131,6 +3136,7 @@ msgid "Update Continuously"
msgstr "Aggiorna continuamente"
#: editor/editor_node.cpp
+#, fuzzy
msgid "Update When Changed"
msgstr "Aggiorna quando modificata"
@@ -3209,16 +3215,17 @@ msgid "Template Package"
msgstr "Pacchetto di modelli"
#: editor/editor_node.cpp
+#, fuzzy
msgid "Export Library"
msgstr "Esporta Libreria"
#: editor/editor_node.cpp
msgid "Merge With Existing"
-msgstr "Unisci Con Esistente"
+msgstr "Unisci con una esistente"
#: editor/editor_node.cpp
msgid "Open & Run a Script"
-msgstr "Apri ed Esegui uno Script"
+msgstr "Apri ed esegui uno script"
#: editor/editor_node.cpp
msgid ""
@@ -3244,7 +3251,7 @@ msgstr "Nuova ereditata"
#: editor/editor_node.cpp
msgid "Load Errors"
-msgstr "Carica errori"
+msgstr "Errori di caricamento"
#: editor/editor_node.cpp editor/plugins/tile_map_editor_plugin.cpp
msgid "Select"
@@ -3252,27 +3259,28 @@ msgstr "Seleziona"
#: editor/editor_node.cpp
msgid "Open 2D Editor"
-msgstr "Apri Editor 2D"
+msgstr "Apri l'editor 2D"
#: editor/editor_node.cpp
msgid "Open 3D Editor"
-msgstr "Apri Editor 3D"
+msgstr "Apri l'editor 3D"
#: editor/editor_node.cpp
msgid "Open Script Editor"
-msgstr "Apri Editor degli script"
+msgstr "Apri l'editor degli script"
#: editor/editor_node.cpp editor/project_manager.cpp
+#, fuzzy
msgid "Open Asset Library"
-msgstr "Apri Libreria degli Asset"
+msgstr "Apri la libreria degli Asset"
#: editor/editor_node.cpp
msgid "Open the next Editor"
-msgstr "Apri l'Editor successivo"
+msgstr "Apri l'editor successivo"
#: editor/editor_node.cpp
msgid "Open the previous Editor"
-msgstr "Apri l'Editor precedente"
+msgstr "Apri l'editor precedente"
#: editor/editor_node.h
msgid "Warning!"
@@ -3284,7 +3292,7 @@ msgstr "Nessuna sottorisorsa trovata."
#: editor/editor_plugin.cpp
msgid "Creating Mesh Previews"
-msgstr "Creazione Anteprime Mesh"
+msgstr "Creando le anteprime delle mesh"
#: editor/editor_plugin.cpp
msgid "Thumbnail..."
@@ -3292,11 +3300,11 @@ msgstr "Miniatura..."
#: editor/editor_plugin_settings.cpp
msgid "Main Script:"
-msgstr "Script Principale:"
+msgstr "Script principale:"
#: editor/editor_plugin_settings.cpp
msgid "Edit Plugin"
-msgstr "Modifica estensione"
+msgstr "Modifica l'estensione"
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -3328,32 +3336,37 @@ msgid "Measure:"
msgstr "Misura:"
#: editor/editor_profiler.cpp
+#, fuzzy
msgid "Frame Time (sec)"
-msgstr "Tempo Frame (sec)"
+msgstr "Tempo fotogramma (sec)"
#: editor/editor_profiler.cpp
+#, fuzzy
msgid "Average Time (sec)"
-msgstr "Tempo Medio (sec)"
+msgstr "Tempo medio (sec)"
#: editor/editor_profiler.cpp
+#, fuzzy
msgid "Frame %"
-msgstr "Frame %"
+msgstr "% fotogramma"
#: editor/editor_profiler.cpp
+#, fuzzy
msgid "Physics Frame %"
-msgstr "Fotogramma della Fisica %"
+msgstr "% fotogramma fisico"
#: editor/editor_profiler.cpp
msgid "Inclusive"
msgstr "Inclusivo"
#: editor/editor_profiler.cpp
+#, fuzzy
msgid "Self"
msgstr "Se stesso"
#: editor/editor_profiler.cpp
msgid "Frame #:"
-msgstr "Frame #:"
+msgstr "Fotogramma #:"
#: editor/editor_profiler.cpp
msgid "Time"
@@ -3365,7 +3378,7 @@ msgstr "Chiamate"
#: editor/editor_properties.cpp
msgid "Edit Text:"
-msgstr "Modifica Testo:"
+msgstr "Modifica il testo:"
#: editor/editor_properties.cpp editor/script_create_dialog.cpp
msgid "On"
@@ -3389,55 +3402,57 @@ msgstr "Assegna..."
#: editor/editor_properties.cpp
msgid "Invalid RID"
-msgstr "RID Invalido"
+msgstr "RID non valido"
#: editor/editor_properties.cpp
msgid ""
"The selected resource (%s) does not match any type expected for this "
"property (%s)."
msgstr ""
-"La risorsa selezionata (%s) non corrisponde ad alcun tipo atteso per questa "
-"proprietà (%s)."
+"La risorsa selezionata (%s) non corrisponde ad alcun tipo previsto per "
+"questa proprietà (%s)."
#: editor/editor_properties.cpp
msgid ""
"Can't create a ViewportTexture on resources saved as a file.\n"
"Resource needs to belong to a scene."
msgstr ""
-"Impossibile creare ViewportTexture da risorse salvate come file.\n"
-"La risorsa deve appartenere ad una scena."
+"Impossibile creare un ViewportTexture su delle risorse salvate come file.\n"
+"Esse devono appartenere a una scena."
#: editor/editor_properties.cpp
+#, fuzzy
msgid ""
"Can't create a ViewportTexture on this resource because it's not set as "
"local to scene.\n"
"Please switch on the 'local to scene' property on it (and all resources "
"containing it up to a node)."
msgstr ""
-"Impossibile creare ViewportTexture da questa risorsa perché non è definita "
-"localmente in una scena.\n"
-"Per favore attivare la proprietà \"local to scene\" sulla risorsa (e su "
-"tutte le risorse che la contengono, fino al nodo che le utilizza)."
+"Impossibile creare un VieportTexture su questa risorsa perché non è stata "
+"impostata come locale alla scena.\n"
+"Per favore attivare la properietà \"local to scene\" su di essa (e su tutte "
+"quelle che la contengono fino ad arrivare a un nodo)."
#: editor/editor_properties.cpp editor/property_editor.cpp
msgid "Pick a Viewport"
-msgstr "Scegli una Vista"
+msgstr "Selezionare una vista"
#: editor/editor_properties.cpp editor/property_editor.cpp
msgid "New Script"
-msgstr "Nuovo Script"
+msgstr "Nuovo script"
#: editor/editor_properties.cpp editor/scene_tree_dock.cpp
msgid "Extend Script"
-msgstr "Estendi Script"
+msgstr "Estendi script"
#: editor/editor_properties.cpp editor/property_editor.cpp
msgid "New %s"
msgstr "Nuovo %s"
#: editor/editor_properties.cpp editor/property_editor.cpp
+#, fuzzy
msgid "Make Unique"
-msgstr "Rendi Unico"
+msgstr "Rendi unico"
#: editor/editor_properties.cpp
#: editor/plugins/animation_blend_space_1d_editor.cpp
@@ -3455,11 +3470,12 @@ msgstr "Incolla"
#: editor/editor_properties.cpp editor/property_editor.cpp
msgid "Convert To %s"
-msgstr "Converti In %s"
+msgstr "Converti in %s"
#: editor/editor_properties.cpp editor/property_editor.cpp
+#, fuzzy
msgid "Selected node is not a Viewport!"
-msgstr "Il nodo selezionato non è una Viewport!"
+msgstr "Il nodo selezionato non è un Viewport!"
#: editor/editor_properties_array_dict.cpp
msgid "Size: "
@@ -3472,19 +3488,19 @@ msgstr "Pagina: "
#: editor/editor_properties_array_dict.cpp
#: editor/plugins/theme_editor_plugin.cpp
msgid "Remove Item"
-msgstr "Rimuovi Elemento"
+msgstr "Rimuovi l'elemento"
#: editor/editor_properties_array_dict.cpp
msgid "New Key:"
-msgstr "Nuova Chiave:"
+msgstr "Nuova chiave:"
#: editor/editor_properties_array_dict.cpp
msgid "New Value:"
-msgstr "Nuovo Valore:"
+msgstr "Nuovo valore:"
#: editor/editor_properties_array_dict.cpp
msgid "Add Key/Value Pair"
-msgstr "Aggiungi Coppia Chiave/Valore"
+msgstr "Aggiungi una coppia chiave/valore"
#: editor/editor_run_native.cpp
msgid ""
@@ -3492,13 +3508,15 @@ msgid ""
"Please add a runnable preset in the Export menu or define an existing preset "
"as runnable."
msgstr ""
-"Nessuna esportazione eseguibile trovata per questa piattaforma.\n"
-"Per favore, aggiungi un preset eseguibile nel menù Export oppure definisci "
-"un preset già esistente come \"eseguibile\"."
+"Nessuna preimpostazione di esportazione eseguibile trovata per questa "
+"piattaforma.\n"
+"Per favore, aggiungerne una nel menù di esportazione o impostarne una già "
+"esistente come eseguibile."
#: editor/editor_run_script.cpp
+#, fuzzy
msgid "Write your logic in the _run() method."
-msgstr "Scrivi la logica nel metodo _run()."
+msgstr "Inserire la logica dello script nel metodo _run()."
#: editor/editor_run_script.cpp
msgid "There is an edited scene already."
@@ -4499,7 +4517,7 @@ msgstr "Rimuovi Triangolo BlendSpace2D"
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "BlendSpace2D does not belong to an AnimationTree node."
-msgstr "BlendSpace2D non appartiene ad un nodo AnimationTree."
+msgstr "BlendSpace2D non appartiene a un nodo AnimationTree."
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "No triangles exist, so no blending can take place."
@@ -5292,9 +5310,10 @@ msgstr ""
"Salva la scena e riprova."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Nessuna mesh da preprocessare. Assicurarsi che contengano un canale UV2 e "
"che la spunta \"Bake Light\" sia abilitata."
@@ -6658,7 +6677,7 @@ msgstr "Spostare il giunto"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid ""
"The skeleton property of the Polygon2D does not point to a Skeleton2D node"
-msgstr "La proprietà scheletro del Polygon2D non punta ad un nodo Skeleton2D"
+msgstr "La proprietà scheletro del Polygon2D non punta a un nodo Skeleton2D"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Sync Bones"
@@ -6914,7 +6933,7 @@ msgstr "Preloader Risorsa"
#: editor/plugins/root_motion_editor_plugin.cpp
msgid "AnimationTree has no path set to an AnimationPlayer"
-msgstr "AnimationTree non ha nessun percorso impostato ad un AnimationPlayer"
+msgstr "AnimationTree non ha nessun percorso impostato a un AnimationPlayer"
#: editor/plugins/root_motion_editor_plugin.cpp
msgid "Path to AnimationPlayer is invalid"
@@ -6982,10 +7001,11 @@ msgid "Script is not in tool mode, will not be able to run."
msgstr "Lo script non è in modalità tool, non sarà possibile eseguirlo."
#: editor/plugins/script_editor_plugin.cpp
+#, fuzzy
msgid ""
"To run this script, it must inherit EditorScript and be set to tool mode."
msgstr ""
-"Per eseguire questo script, esso deve ereditare EditorScript ed essere "
+"Per eseguire questo script, esso deve ereditare da EditorScript ed essere "
"impostato in modalità tool."
#: editor/plugins/script_editor_plugin.cpp
@@ -9322,8 +9342,9 @@ msgid "Finds the nearest even integer to the parameter."
msgstr "Trova il numero intero pari più vicino al parametro."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid "Clamps the value between 0.0 and 1.0."
-msgstr "Blocca il valore tra 0.0 ed 1.0."
+msgstr "Blocca il valore tra 0.0 e 1.0."
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "Extracts the sign of the parameter."
@@ -9342,6 +9363,7 @@ msgid "Returns the square root of the parameter."
msgstr "Restituisce la radice quadrata del parametro."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid ""
"SmoothStep function( scalar(edge0), scalar(edge1), scalar(x) ).\n"
"\n"
@@ -9353,7 +9375,7 @@ msgstr ""
"\n"
"Restituisce 0.0 se \"x\" è più piccolo di \"edge0\", o 1.0 se \"x\" è più "
"grande di \"edge1\". Altrimenti, il valore di ritorno è interpolato tra 0.0 "
-"ed 1.0 usando i polinomi di Hermite."
+"e 1.0 usando i polinomi di Hermite."
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid ""
@@ -9430,6 +9452,7 @@ msgid "Transform function."
msgstr "Funzione di trasformazione."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid ""
"Calculate the outer product of a pair of vectors.\n"
"\n"
@@ -9513,6 +9536,7 @@ msgid "Calculates the dot product of two vectors."
msgstr "Calcola il prodotto scalare di due vettori."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid ""
"Returns the vector that points in the same direction as a reference vector. "
"The function has three vector parameters : N, the vector to orient, I, the "
@@ -9562,6 +9586,7 @@ msgid "Returns the vector that points in the direction of refraction."
msgstr "Restituisce un vettore che punta nella direzione della refrazione."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid ""
"SmoothStep function( vector(edge0), vector(edge1), vector(x) ).\n"
"\n"
@@ -9571,11 +9596,12 @@ msgid ""
msgstr ""
"SmoothStep function( vector(edge0), vector(edge1), vector(x) ).\n"
"\n"
-"Restituisce 0.0 se \"x\" è minore di \"edge0\", ed 1.0 se \"x\" è più grande "
-"di \"edge1\". Altrimenti, il valore di ritorno è interpolato tra 0.0 ed 1.0 "
+"Restituisce 0.0 se \"x\" è minore di \"edge0\", e 1.0 se \"x\" è più grande "
+"di \"edge1\". Altrimenti, il valore di ritorno è interpolato tra 0.0 e 1.0 "
"usando i polinomiali di Hermite."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid ""
"SmoothStep function( scalar(edge0), scalar(edge1), vector(x) ).\n"
"\n"
@@ -9585,8 +9611,8 @@ msgid ""
msgstr ""
"SmoothStep function( scalar(edge0), scalar(edge1), vector(x) ).\n"
"\n"
-"Restituisce 0.0 se \"x\" è minore di \"edge0\", ed 1.0 se \"x\" è più grande "
-"di \"edge1\". Altrimenti, il valore di ritorno è interpolato tra 0.0 ed 1.0 "
+"Restituisce 0.0 se \"x\" è minore di \"edge0\", e 1.0 se \"x\" è più grande "
+"di \"edge1\". Altrimenti, il valore di ritorno è interpolato tra 0.0 e 1.0 "
"usando i polinomiali di Hermite."
#: editor/plugins/visual_shader_editor_plugin.cpp
@@ -9638,13 +9664,14 @@ msgid "Vector uniform."
msgstr "Uniforme vettore."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid ""
"Custom Godot Shader Language expression, with custom amount of input and "
"output ports. This is a direct injection of code into the vertex/fragment/"
"light function, do not use it to write the function declarations inside."
msgstr ""
"Una espressione del Custom Godot Shader Language, con quantità "
-"personalizzabile di porte input ed output. Questa è una iniezione diretta di "
+"personalizzabile di porte input e output. Questa è una iniezione diretta di "
"codice nella funzione vertex/fragment/light. Non usarla per scrivere le "
"dichiarazione della funzione all'interno."
@@ -9654,7 +9681,7 @@ msgid ""
"direction of camera (pass associated inputs to it)."
msgstr ""
"Restituisce il decadimento in base al prodotto scalare della normale della "
-"superfice e direzione della telecamera (passa gli input associati ad essa)."
+"superfice e direzione della telecamera (passa gli input associati a essa)."
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid ""
@@ -9669,8 +9696,9 @@ msgstr ""
"dichiarare varianti, uniformi e costanti."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid "A reference to an existing uniform."
-msgstr "Un riferimento ad una uniform esistente."
+msgstr "Un riferimento a una uniform esistente."
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "(Fragment/Light mode only) Scalar derivative function."
@@ -9713,20 +9741,22 @@ msgstr ""
"differenziazione locale."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid ""
"(Fragment/Light mode only) (Vector) Sum of absolute derivative in 'x' and "
"'y'."
msgstr ""
"(Soltanto modalità Fragment/Light) (Vettore) Somma delle derivate assolute "
-"in \"x\" ed \"y\"."
+"in \"x\" e \"y\"."
#: editor/plugins/visual_shader_editor_plugin.cpp
+#, fuzzy
msgid ""
"(Fragment/Light mode only) (Scalar) Sum of absolute derivative in 'x' and "
"'y'."
msgstr ""
"(Soltanto modalità Fragment/Light) (Scalare) Somma delle derivate assolute "
-"in \"x\" ed \"y\"."
+"in \"x\" e \"y\"."
#: editor/plugins/visual_shader_editor_plugin.cpp
msgid "VisualShader"
@@ -9757,13 +9787,14 @@ msgstr ""
"I template di esportazione sembrano essere mancanti o non validi."
#: editor/project_export.cpp
+#, fuzzy
msgid ""
"Failed to export the project for platform '%s'.\n"
"This might be due to a configuration issue in the export preset or your "
"export settings."
msgstr ""
"Impossibile esportare il progetto per la piattaforma \"%s\".\n"
-"Questo potrebbe essere dovuto ad un problema di configurazione nel preset di "
+"Questo potrebbe essere dovuto a un problema di configurazione nel preset di "
"esportazione o nelle impostazioni di esportazione."
#: editor/project_export.cpp
@@ -12264,7 +12295,7 @@ msgstr "L'oggetto base non è un Nodo!"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Path does not lead Node!"
-msgstr "Il percorso non conduce ad un Nodo!"
+msgstr "Il percorso non conduce a un Nodo!"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Invalid index property name '%s' in node %s."
@@ -12676,7 +12707,7 @@ msgid ""
"CollisionObject2D derived node. Please only use it as a child of Area2D, "
"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
msgstr ""
-"CollisionPolygon2D serve a fornire una forma di collisione ad un nodo "
+"CollisionPolygon2D serve a fornire una forma di collisione a un nodo "
"derivato di CollisionObject2D. Si prega di utilizzarlo solamente come figlio "
"di Area2D, StaticBody2D, RigidBody2D, KinematicBody2D, etc. in modo da "
"dargli una forma."
@@ -12698,13 +12729,14 @@ msgstr ""
"costruzione \"Segmenti\"."
#: scene/2d/collision_shape_2d.cpp
+#, fuzzy
msgid ""
"CollisionShape2D only serves to provide a collision shape to a "
"CollisionObject2D derived node. Please only use it as a child of Area2D, "
"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
msgstr ""
-"CollisionShape2D serve a fornire una forma di collisione ad un nodo derivato "
-"di CollisionObject2D. Si prega di utilizzarlo solamente come figlio di "
+"CollisionShape2D serve a fornire una forma di collisione a un nodo derivato "
+"da CollisionObject2D. Si prega di utilizzarlo solamente come figlio di "
"Area2D, StaticBody2D, RigidBody2D, KinematicBody2D, etc. in modo da dargli "
"una forma."
@@ -12840,9 +12872,9 @@ msgstr ""
"Modifica invece la dimensione nelle forme di collisione figlie."
#: scene/2d/remote_transform_2d.cpp
+#, fuzzy
msgid "Path property must point to a valid Node2D node to work."
-msgstr ""
-"La proprietà path deve puntare ad un nodo Node2D valido per funzionare."
+msgstr "La proprietà path deve puntare a un nodo Node2D valido per funzionare."
#: scene/2d/skeleton_2d.cpp
msgid "This Bone2D chain should end at a Skeleton2D node."
@@ -12888,11 +12920,12 @@ msgid "ARVRController must have an ARVROrigin node as its parent."
msgstr "ARVRController deve avere un nodo ARVROrigin come genitore."
#: scene/3d/arvr_nodes.cpp
+#, fuzzy
msgid ""
"The controller ID must not be 0 or this controller won't be bound to an "
"actual controller."
msgstr ""
-"L'id del controller non deve essere 0 o non verrà associato ad un controller "
+"L'id del controller non deve essere 0 o non verrà associato a un controller "
"attuale."
#: scene/3d/arvr_nodes.cpp
@@ -12900,11 +12933,12 @@ msgid "ARVRAnchor must have an ARVROrigin node as its parent."
msgstr "ARVRAnchor deve avere un nodo ARVROrigin come genitore."
#: scene/3d/arvr_nodes.cpp
+#, fuzzy
msgid ""
"The anchor ID must not be 0 or this anchor won't be bound to an actual "
"anchor."
msgstr ""
-"L'ID dell'ancora non deve essere 0 oppure non verrà associato ad un'ancora "
+"L'ID dell'ancora non deve essere 0 oppure non verrà associato a un'ancora "
"attuale."
#: scene/3d/arvr_nodes.cpp
@@ -12947,28 +12981,29 @@ msgstr ""
"definire la sua forma."
#: scene/3d/collision_polygon.cpp
+#, fuzzy
msgid ""
"CollisionPolygon only serves to provide a collision shape to a "
"CollisionObject derived node. Please only use it as a child of Area, "
"StaticBody, RigidBody, KinematicBody, etc. to give them a shape."
msgstr ""
-"CollisionPolygon serve solamente a fornire una forma di collisione ad un "
-"nodo derivato di CollisionObject. Si prega di usarlo solamente come figlio "
-"di Area, StaticBody, RigidBody, KinematicBody, etc. in modo da dargli una "
-"forma."
+"CollisionPolygon serve solamente a fornire una forma di collisione a un nodo "
+"derivato da CollisionObject. Si prega di usarlo solamente come figlio di "
+"Area, StaticBody, RigidBody, KinematicBody, etc. in modo da dargli una forma."
#: scene/3d/collision_polygon.cpp
msgid "An empty CollisionPolygon has no effect on collision."
msgstr "Un CollisionPolygon vuoto non ha effetti in collisione."
#: scene/3d/collision_shape.cpp
+#, fuzzy
msgid ""
"CollisionShape only serves to provide a collision shape to a CollisionObject "
"derived node. Please only use it as a child of Area, StaticBody, RigidBody, "
"KinematicBody, etc. to give them a shape."
msgstr ""
-"CollisionShape serve a fornire una forma di collisione ad un nodo derivato "
-"di CollisionObject. Si prega di utilizzarlo solamente come figlio di Area, "
+"CollisionShape serve a fornire una forma di collisione a un nodo derivato da "
+"CollisionObject. Si prega di utilizzarlo solamente come figlio di Area, "
"StaticBody, RigidBody, KinematicBody, etc. in modo da dargli una forma."
#: scene/3d/collision_shape.cpp
@@ -13288,13 +13323,14 @@ msgid "If \"Exp Edit\" is enabled, \"Min Value\" must be greater than 0."
msgstr "Se \"Exp Edit\" è abilitato, \"Min Value\" deve essere maggiore di 0."
#: scene/gui/scroll_container.cpp
+#, fuzzy
msgid ""
"ScrollContainer is intended to work with a single child control.\n"
"Use a container as child (VBox, HBox, etc.), or a Control and set the custom "
"minimum size manually."
msgstr ""
"ScrollContainer è inteso per funzionare con un singolo figlio di controllo.\n"
-"Usa un container come figlio (VBox, HBox, ect.), oppure un nodo Control ed "
+"Usa un container come figlio (VBox, HBox, ect.), oppure un nodo Control e "
"imposta la dimensione minima personalizzata manualmente."
#: scene/gui/tree.cpp
diff --git a/editor/translations/ja.po b/editor/translations/ja.po
index 1fd770fe13..45977a890f 100644
--- a/editor/translations/ja.po
+++ b/editor/translations/ja.po
@@ -5214,9 +5214,10 @@ msgstr ""
"シーンを保存してから再度行ってください。"
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"ベイクするメッシュがありません。メッシュに UV2チャンネルが含まれてお"
"り、'Bake Light' フラグがオンになっていることを確認してください。"
diff --git a/editor/translations/ka.po b/editor/translations/ka.po
index 587624651a..7a108d6f95 100644
--- a/editor/translations/ka.po
+++ b/editor/translations/ka.po
@@ -5176,8 +5176,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/km.po b/editor/translations/km.po
index fe396cf590..33e9b00daf 100644
--- a/editor/translations/km.po
+++ b/editor/translations/km.po
@@ -4986,8 +4986,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/ko.po b/editor/translations/ko.po
index ec9fed24ca..877f572f48 100644
--- a/editor/translations/ko.po
+++ b/editor/translations/ko.po
@@ -27,7 +27,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-06-20 13:35+0000\n"
+"PO-Revision-Date: 2021-07-16 05:47+0000\n"
"Last-Translator: Myeongjin Lee <aranet100@gmail.com>\n"
"Language-Team: Korean <https://hosted.weblate.org/projects/godot-engine/"
"godot/ko/>\n"
@@ -36,7 +36,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 4.7\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -5182,9 +5182,10 @@ msgstr ""
"당신의 씬을 저장하고 다시 시도하세요."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"라이트맵을 구울 메시가 없습니다. 메시가 UV2 채널을 갖고 있고 'Bake Light' 플"
"래그가 켜져 있는지 확인해주세요."
diff --git a/editor/translations/lt.po b/editor/translations/lt.po
index 6df1f44cfb..f4043f1de2 100644
--- a/editor/translations/lt.po
+++ b/editor/translations/lt.po
@@ -5145,8 +5145,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/lv.po b/editor/translations/lv.po
index 8c8a0011c7..a4c8d10715 100644
--- a/editor/translations/lv.po
+++ b/editor/translations/lv.po
@@ -5038,8 +5038,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/mi.po b/editor/translations/mi.po
index 36a93be0ee..5a847e6594 100644
--- a/editor/translations/mi.po
+++ b/editor/translations/mi.po
@@ -4978,8 +4978,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/mk.po b/editor/translations/mk.po
index 7e5aa06f3c..001542b888 100644
--- a/editor/translations/mk.po
+++ b/editor/translations/mk.po
@@ -4985,8 +4985,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/ml.po b/editor/translations/ml.po
index 3919011ade..f7bc8349bc 100644
--- a/editor/translations/ml.po
+++ b/editor/translations/ml.po
@@ -4993,8 +4993,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/mr.po b/editor/translations/mr.po
index 4d81595cb1..66157f77d1 100644
--- a/editor/translations/mr.po
+++ b/editor/translations/mr.po
@@ -4985,8 +4985,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/ms.po b/editor/translations/ms.po
index 6226d644a3..d8714d6196 100644
--- a/editor/translations/ms.po
+++ b/editor/translations/ms.po
@@ -14,7 +14,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-05-29 13:49+0000\n"
+"PO-Revision-Date: 2021-07-23 12:59+0000\n"
"Last-Translator: Keviindran Ramachandran <keviinx@yahoo.com>\n"
"Language-Team: Malay <https://hosted.weblate.org/projects/godot-engine/godot/"
"ms/>\n"
@@ -23,7 +23,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 4.7-dev\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -459,7 +459,7 @@ msgstr "Kunci Gerak Anim"
#: editor/animation_track_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Clipboard is empty!"
-msgstr ""
+msgstr "Papan klip kosong!"
#: editor/animation_track_editor.cpp
msgid "Paste Tracks"
@@ -1122,7 +1122,7 @@ msgstr "Terima kasih dari komuniti Godot!"
#: editor/editor_about.cpp editor/editor_node.cpp editor/project_manager.cpp
msgid "Click to copy."
-msgstr ""
+msgstr "Klik untuk salin."
#: editor/editor_about.cpp
msgid "Godot Engine contributors"
@@ -1624,16 +1624,15 @@ msgstr ""
"GLES3. Aktifkan 'Import Etc 2' atau 'Import Pvrtc' dalam Tetapan Projek."
#: editor/editor_export.cpp
-#, fuzzy
msgid ""
"Target platform requires 'PVRTC' texture compression for the driver fallback "
"to GLES2.\n"
"Enable 'Import Pvrtc' in Project Settings, or disable 'Driver Fallback "
"Enabled'."
msgstr ""
-"Platform sasaran memerlukan pemampatan tekstur 'ETC' untuk sandaran pemandu "
+"Platform sasaran memerlukan pemampatan tekstur 'PVRTC' untuk sandaran driver "
"ke GLES2.\n"
-"Aktifkan 'Import Etc' dalam Tetapan Projek, atau nyahaktifkan 'Driver "
+"Aktifkan 'Import Pvrtc' dalam Tetapan Projek, atau nyahaktifkan 'Driver "
"Fallback Enabled'."
#: editor/editor_export.cpp platform/android/export/export.cpp
@@ -2335,9 +2334,8 @@ msgid "Layout name not found!"
msgstr "Nama susun atur tidak dijumpai!"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Restored the Default layout to its base settings."
-msgstr "Tata letak lalai telah dipulihkan ke tetapan asas."
+msgstr "Susun atur lalai telah dipulihkan ke tetapan asas."
#: editor/editor_node.cpp
msgid ""
@@ -4501,34 +4499,34 @@ msgstr "Tetapkan kedudukan pengadunan dalam ruang"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Select and move points, create points with RMB."
-msgstr ""
+msgstr "Pilih dan pindahkan titik-titik, cipta titik-titik dengan RMB."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp scene/gui/graph_edit.cpp
msgid "Enable snap and show grid."
-msgstr ""
+msgstr "Aktifkan snap dan tunjukkan grid."
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Point"
-msgstr ""
+msgstr "Titik"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
msgid "Open Editor"
-msgstr ""
+msgstr "Buka Editor"
#: editor/plugins/animation_blend_space_1d_editor.cpp
#: editor/plugins/animation_blend_space_2d_editor.cpp
#: editor/plugins/animation_blend_tree_editor_plugin.cpp
#: editor/plugins/animation_state_machine_editor.cpp
msgid "Open Animation Node"
-msgstr ""
+msgstr "Buka Nod Animasi"
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Triangle already exists."
-msgstr ""
+msgstr "Segi tiga sudah wujud."
#: editor/plugins/animation_blend_space_2d_editor.cpp
#, fuzzy
@@ -4537,39 +4535,40 @@ msgstr "Anim Tambah Trek"
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Change BlendSpace2D Limits"
-msgstr ""
+msgstr "Tukar Had-had BlendSpace2D"
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Change BlendSpace2D Labels"
-msgstr ""
+msgstr "Tukar Label-label BlendSpace2D"
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Remove BlendSpace2D Point"
-msgstr ""
+msgstr "Keluarkan Titik BlendSpace2D"
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Remove BlendSpace2D Triangle"
-msgstr ""
+msgstr "Keluarkan Segi tiga BlendSpace2D"
#: editor/plugins/animation_blend_space_2d_editor.cpp
+#, fuzzy
msgid "BlendSpace2D does not belong to an AnimationTree node."
-msgstr ""
+msgstr "BlendSpace2D bukan milik nod AnimationTree."
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "No triangles exist, so no blending can take place."
-msgstr ""
+msgstr "Tiada segi tiga-segi tiga wujud, jadi tiada pengadunan boleh berlaku."
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Toggle Auto Triangles"
-msgstr ""
+msgstr "Togol Segi Tiga Auto"
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Create triangles by connecting points."
-msgstr ""
+msgstr "Cipta segi tiga dengan menhubungkan titik-titik."
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Erase points and triangles."
-msgstr ""
+msgstr "Padamkan titik-titik dan segi tiga-segi tiga."
#: editor/plugins/animation_blend_space_2d_editor.cpp
msgid "Generate blend triangles automatically (instead of manually)"
@@ -5334,8 +5333,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/nb.po b/editor/translations/nb.po
index 042ee8d26f..c36274abba 100644
--- a/editor/translations/nb.po
+++ b/editor/translations/nb.po
@@ -5427,8 +5427,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/nl.po b/editor/translations/nl.po
index 2410cd5ad0..296291e435 100644
--- a/editor/translations/nl.po
+++ b/editor/translations/nl.po
@@ -46,12 +46,13 @@
# T-rex08 <ipadtriceratops@gmail.com>, 2021.
# Dwarffish <hoogvlietjohan@gmail.com>, 2021.
# Arthur de Roos <arthur.de.roos@gmail.com>, 2021.
+# Vancha March <tjipkevdh@gmail.com>, 2021.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-06-05 08:32+0000\n"
-"Last-Translator: Stijn Hinlopen <f.a.hinlopen@gmail.com>\n"
+"PO-Revision-Date: 2021-07-26 14:18+0000\n"
+"Last-Translator: Vancha March <tjipkevdh@gmail.com>\n"
"Language-Team: Dutch <https://hosted.weblate.org/projects/godot-engine/godot/"
"nl/>\n"
"Language: nl\n"
@@ -59,7 +60,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.7-dev\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -1162,7 +1163,7 @@ msgstr "Bedankt van de Godot gemeenschap!"
#: editor/editor_about.cpp editor/editor_node.cpp editor/project_manager.cpp
msgid "Click to copy."
-msgstr ""
+msgstr "Klik om te kopiëren."
#: editor/editor_about.cpp
msgid "Godot Engine contributors"
@@ -5243,9 +5244,10 @@ msgstr ""
"Sla uw scène op en probeer opnieuw."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Geen meshes om te bakken. Zorg ervoor dat ze een UV2 kanaal bevatten en dat "
"'Bake Light' vlag aan staat."
diff --git a/editor/translations/or.po b/editor/translations/or.po
index 87528cdac5..c1d191a4a5 100644
--- a/editor/translations/or.po
+++ b/editor/translations/or.po
@@ -4984,8 +4984,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/pl.po b/editor/translations/pl.po
index 3c51593e02..d933e8f92b 100644
--- a/editor/translations/pl.po
+++ b/editor/translations/pl.po
@@ -52,8 +52,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-07-05 14:32+0000\n"
-"Last-Translator: Rafal Brozio <rafal.brozio@gmail.com>\n"
+"PO-Revision-Date: 2021-07-16 05:47+0000\n"
+"Last-Translator: Tomek <kobewi4e@gmail.com>\n"
"Language-Team: Polish <https://hosted.weblate.org/projects/godot-engine/"
"godot/pl/>\n"
"Language: pl\n"
@@ -62,7 +62,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2;\n"
-"X-Generator: Weblate 4.8-dev\n"
+"X-Generator: Weblate 4.7.2-dev\n"
#: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -5229,9 +5229,10 @@ msgstr ""
"Zapisz scenę i spróbuj ponownie."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Brak siatek do cieniowania. Upewnij się, że zawierają kanał UV2 i że flaga "
"\"Bake Light\" jest ustawiona."
@@ -5760,7 +5761,7 @@ msgstr "Powiększ do zaznaczenia"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Preview Canvas Scale"
-msgstr "Skala płótna podglądu"
+msgstr "Podejrzyj skalę płótna"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Translation mask for inserting keys."
diff --git a/editor/translations/pr.po b/editor/translations/pr.po
index 675c9cf506..9b586ad756 100644
--- a/editor/translations/pr.po
+++ b/editor/translations/pr.po
@@ -5153,8 +5153,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/pt.po b/editor/translations/pt.po
index 17b1861821..6eb24001a5 100644
--- a/editor/translations/pt.po
+++ b/editor/translations/pt.po
@@ -5209,9 +5209,10 @@ msgstr ""
"Guarde a sua cena e tente novamente."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Não há malhas para consolidar. Assegure-se que contêm um canal UV2 e que a "
"referência 'Bake Light' flag está on."
diff --git a/editor/translations/pt_BR.po b/editor/translations/pt_BR.po
index e79dd0fa19..01f6220bbd 100644
--- a/editor/translations/pt_BR.po
+++ b/editor/translations/pt_BR.po
@@ -5320,9 +5320,10 @@ msgstr ""
"Salve sua cena e tente novamente."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Não há malhas para preparar. Certifique-se de que elas possuem um canal UV2 "
"e que a propriedade \"Preparar Luz\" está habilitada."
diff --git a/editor/translations/ro.po b/editor/translations/ro.po
index 7ac06fc1b1..3b5af5fe1a 100644
--- a/editor/translations/ro.po
+++ b/editor/translations/ro.po
@@ -5218,9 +5218,10 @@ msgstr ""
"cale de salvare din proprietățile BakedLightmap."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Nicio structură pentru procesare. Asigură-te că acestea conțin un canal UV2 "
"și că opțiunea 'Procesează Lumina' este pornită."
diff --git a/editor/translations/ru.po b/editor/translations/ru.po
index 4b56d21383..e02b70b16d 100644
--- a/editor/translations/ru.po
+++ b/editor/translations/ru.po
@@ -97,12 +97,13 @@
# Bualma Show <appleaidar6@gmail.com>, 2021.
# enderlorde <madel.laboratories@gmail.com>, 2021.
# Олег Довгер <oleg.a.dovger@gmail.com>, 2021.
+# Anna Malinovskaia <tacitcoast@gmail.com>, 2021.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-07-13 06:13+0000\n"
-"Last-Translator: Danil Alexeev <danil@alexeev.xyz>\n"
+"PO-Revision-Date: 2021-07-19 09:34+0000\n"
+"Last-Translator: Anna Malinovskaia <tacitcoast@gmail.com>\n"
"Language-Team: Russian <https://hosted.weblate.org/projects/godot-engine/"
"godot/ru/>\n"
"Language: ru\n"
@@ -5286,9 +5287,10 @@ msgstr ""
"Сохраните сцену и попробуйте ещё раз."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Нет полисеток для запекания. Убедитесь, что они содержат канал UV2 и что "
"флаг «Запекание света» включён."
diff --git a/editor/translations/si.po b/editor/translations/si.po
index a5586af274..36abdd4774 100644
--- a/editor/translations/si.po
+++ b/editor/translations/si.po
@@ -5024,8 +5024,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/sk.po b/editor/translations/sk.po
index d97e1321ef..cb56bb037e 100644
--- a/editor/translations/sk.po
+++ b/editor/translations/sk.po
@@ -5183,9 +5183,10 @@ msgstr ""
"na uloženie so BakedLightmap vlastností."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Žiadne mesh-e na bake. Uistite sa že obsahujú UV2 channel a je na ňom 'Bake "
"Light' vlajka."
diff --git a/editor/translations/sl.po b/editor/translations/sl.po
index 07bd33c389..42f0bfc2cb 100644
--- a/editor/translations/sl.po
+++ b/editor/translations/sl.po
@@ -5419,9 +5419,10 @@ msgstr ""
"shranitev iz lastnosti Zapečene Svetlobne karte."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Brez modelov za peko. Poskrbi, da vsebujejo kanal UV2 in da je vključena "
"oznaka 'Zapeči Svetlobo'."
diff --git a/editor/translations/sq.po b/editor/translations/sq.po
index 49a42b5553..f054de99bd 100644
--- a/editor/translations/sq.po
+++ b/editor/translations/sq.po
@@ -5273,8 +5273,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/sr_Cyrl.po b/editor/translations/sr_Cyrl.po
index 53fb04b3e4..5d4f6cab1b 100644
--- a/editor/translations/sr_Cyrl.po
+++ b/editor/translations/sr_Cyrl.po
@@ -5682,8 +5682,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Нема мрежа за печење. Провери да ли садрже UV2 канал и да је опција 'Изпеци "
"Светла' укључена."
diff --git a/editor/translations/sr_Latn.po b/editor/translations/sr_Latn.po
index 0a90379b41..49f7cd7f3e 100644
--- a/editor/translations/sr_Latn.po
+++ b/editor/translations/sr_Latn.po
@@ -5048,8 +5048,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/sv.po b/editor/translations/sv.po
index 0c5db25a9a..79c1c4a1b9 100644
--- a/editor/translations/sv.po
+++ b/editor/translations/sv.po
@@ -5277,8 +5277,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/ta.po b/editor/translations/ta.po
index 0c9022b097..45eef9a8f6 100644
--- a/editor/translations/ta.po
+++ b/editor/translations/ta.po
@@ -5033,8 +5033,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/te.po b/editor/translations/te.po
index 8274d5520f..47338f3f28 100644
--- a/editor/translations/te.po
+++ b/editor/translations/te.po
@@ -4987,8 +4987,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/th.po b/editor/translations/th.po
index e9c2a80a49..fc38c35df9 100644
--- a/editor/translations/th.po
+++ b/editor/translations/th.po
@@ -5125,9 +5125,10 @@ msgstr ""
"ลองบันทึกฉากของคุณแล้วลองอีกครั้ง"
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"ไม่มีพื้นผิวให้สร้าง lightmap กรุณาตรวจสอบว่าพื้นผิวมี UV2 และได้เปิดใช้งาน 'Bake Light'"
diff --git a/editor/translations/tr.po b/editor/translations/tr.po
index 578d7b48d0..4f3eb3ff60 100644
--- a/editor/translations/tr.po
+++ b/editor/translations/tr.po
@@ -5250,9 +5250,10 @@ msgstr ""
"Sahneyi kaydedip tekrar deneyin."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Pişirilecek örüntüler yok. Örüntülerin UV2 kanalı içerdiğinden ve 'Bake "
"Light' bayrağınının açık olduğundan emin olun."
diff --git a/editor/translations/tt.po b/editor/translations/tt.po
index 3e63f2369d..d5d41b7879 100644
--- a/editor/translations/tt.po
+++ b/editor/translations/tt.po
@@ -4987,8 +4987,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/tzm.po b/editor/translations/tzm.po
index 0b0ce7d01e..fdb092c6a4 100644
--- a/editor/translations/tzm.po
+++ b/editor/translations/tzm.po
@@ -4985,8 +4985,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/uk.po b/editor/translations/uk.po
index 50508c5df3..66c69938f6 100644
--- a/editor/translations/uk.po
+++ b/editor/translations/uk.po
@@ -5222,9 +5222,10 @@ msgstr ""
"Збережіть вашу сцену і повторіть спробу."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"Немає полісеток для запікання. Переконайтеся, що вони містять канал UV2 і що "
"прапор 'Запікання світла' включений."
diff --git a/editor/translations/ur_PK.po b/editor/translations/ur_PK.po
index 0a213a2bdf..5476915ea5 100644
--- a/editor/translations/ur_PK.po
+++ b/editor/translations/ur_PK.po
@@ -5091,8 +5091,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/vi.po b/editor/translations/vi.po
index 0104d05502..4267f19def 100644
--- a/editor/translations/vi.po
+++ b/editor/translations/vi.po
@@ -5156,8 +5156,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/zh_CN.po b/editor/translations/zh_CN.po
index 4393cb4e08..c5b0c34c74 100644
--- a/editor/translations/zh_CN.po
+++ b/editor/translations/zh_CN.po
@@ -83,7 +83,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Chinese (Simplified) (Godot Engine)\n"
"POT-Creation-Date: 2018-01-20 12:15+0200\n"
-"PO-Revision-Date: 2021-07-13 06:13+0000\n"
+"PO-Revision-Date: 2021-07-23 12:59+0000\n"
"Last-Translator: Haoyu Qiu <timothyqiu32@gmail.com>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
"godot-engine/godot/zh_Hans/>\n"
@@ -1172,7 +1172,7 @@ msgstr "改变字典值"
#: editor/editor_about.cpp
msgid "Thanks from the Godot community!"
-msgstr "Godot 社区感谢你!"
+msgstr "Godot 社区感谢大家!"
#: editor/editor_about.cpp editor/editor_node.cpp editor/project_manager.cpp
msgid "Click to copy."
@@ -5171,9 +5171,10 @@ msgstr ""
"BakedLightmap 属性。"
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr "没有可烘焙的网格。请确保网格包含 UV2 通道并且勾选 “Bake Light” 选项。"
#: editor/plugins/baked_lightmap_editor_plugin.cpp
@@ -7338,7 +7339,7 @@ msgstr "顶视图。"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom View."
-msgstr "仰视图。"
+msgstr "底视图。"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom"
@@ -7547,11 +7548,11 @@ msgstr "使用吸附"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom View"
-msgstr "仰视图"
+msgstr "底视图"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Top View"
-msgstr "俯视图"
+msgstr "顶视图"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rear View"
@@ -7559,7 +7560,7 @@ msgstr "后视图"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Front View"
-msgstr "正视图"
+msgstr "前视图"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Left View"
@@ -8240,7 +8241,7 @@ msgstr "新建自动图块"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "New Atlas"
-msgstr "新建合集"
+msgstr "新建图集"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Next Coordinate"
diff --git a/editor/translations/zh_HK.po b/editor/translations/zh_HK.po
index 28a69ee289..69a8998437 100644
--- a/editor/translations/zh_HK.po
+++ b/editor/translations/zh_HK.po
@@ -5380,8 +5380,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
diff --git a/editor/translations/zh_TW.po b/editor/translations/zh_TW.po
index f65d628d63..2d04a07157 100644
--- a/editor/translations/zh_TW.po
+++ b/editor/translations/zh_TW.po
@@ -5118,9 +5118,10 @@ msgstr ""
"請保存場景並重試。"
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
-"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
-"Light' flag is on."
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Use "
+"In Baked Light' and 'Generate Lightmap' flags are on."
msgstr ""
"無可烘焙之網格。請確保這些網格包含 UV2 通道並已開啟「Bake Light」旗標。"
diff --git a/main/main_timer_sync.cpp b/main/main_timer_sync.cpp
index 93448d0904..94e62bea97 100644
--- a/main/main_timer_sync.cpp
+++ b/main/main_timer_sync.cpp
@@ -30,7 +30,7 @@
#include "main_timer_sync.h"
-void MainFrameTime::clamp_process_step(float min_process_step, float max_process_step) {
+void MainFrameTime::clamp_process_step(double min_process_step, double max_process_step) {
if (process_step < min_process_step) {
process_step = min_process_step;
} else if (process_step > max_process_step) {
@@ -43,25 +43,25 @@ void MainFrameTime::clamp_process_step(float min_process_step, float max_process
// returns the fraction of p_physics_step required for the timer to overshoot
// before advance_core considers changing the physics_steps return from
// the typical values as defined by typical_physics_steps
-float MainTimerSync::get_physics_jitter_fix() {
+double MainTimerSync::get_physics_jitter_fix() {
return Engine::get_singleton()->get_physics_jitter_fix();
}
// gets our best bet for the average number of physics steps per render frame
// return value: number of frames back this data is consistent
-int MainTimerSync::get_average_physics_steps(float &p_min, float &p_max) {
+int MainTimerSync::get_average_physics_steps(double &p_min, double &p_max) {
p_min = typical_physics_steps[0];
p_max = p_min + 1;
for (int i = 1; i < CONTROL_STEPS; ++i) {
- const float typical_lower = typical_physics_steps[i];
- const float current_min = typical_lower / (i + 1);
+ const double typical_lower = typical_physics_steps[i];
+ const double current_min = typical_lower / (i + 1);
if (current_min > p_max) {
return i; // bail out of further restrictions would void the interval
} else if (current_min > p_min) {
p_min = current_min;
}
- const float current_max = (typical_lower + 1) / (i + 1);
+ const double current_max = (typical_lower + 1) / (i + 1);
if (current_max < p_min) {
return i;
} else if (current_max < p_max) {
@@ -73,7 +73,7 @@ int MainTimerSync::get_average_physics_steps(float &p_min, float &p_max) {
}
// advance physics clock by p_process_step, return appropriate number of steps to simulate
-MainFrameTime MainTimerSync::advance_core(float p_physics_step, int p_physics_fps, float p_process_step) {
+MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_fps, double p_process_step) {
MainFrameTime ret;
ret.process_step = p_process_step;
@@ -146,7 +146,7 @@ MainFrameTime MainTimerSync::advance_core(float p_physics_step, int p_physics_fp
}
// calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero
-MainFrameTime MainTimerSync::advance_checked(float p_physics_step, int p_physics_fps, float p_process_step) {
+MainFrameTime MainTimerSync::advance_checked(double p_physics_step, int p_physics_fps, double p_process_step) {
if (fixed_fps != -1) {
p_process_step = 1.0 / fixed_fps;
}
@@ -163,7 +163,7 @@ MainFrameTime MainTimerSync::advance_checked(float p_physics_step, int p_physics
// first, least important clamping: keep ret.process_step consistent with typical_physics_steps.
// this smoothes out the process steps and culls small but quick variations.
{
- float min_average_physics_steps, max_average_physics_steps;
+ double min_average_physics_steps, max_average_physics_steps;
int consistent_steps = get_average_physics_steps(min_average_physics_steps, max_average_physics_steps);
if (consistent_steps > 3) {
ret.clamp_process_step(min_average_physics_steps * p_physics_step, max_average_physics_steps * p_physics_step);
@@ -171,7 +171,7 @@ MainFrameTime MainTimerSync::advance_checked(float p_physics_step, int p_physics
}
// second clamping: keep abs(time_deficit) < jitter_fix * frame_slise
- float max_clock_deviation = get_physics_jitter_fix() * p_physics_step;
+ double max_clock_deviation = get_physics_jitter_fix() * p_physics_step;
ret.clamp_process_step(p_process_step - max_clock_deviation, p_process_step + max_clock_deviation);
// last clamping: make sure time_accum is between 0 and p_physics_step for consistency between physics and process
@@ -191,7 +191,7 @@ MainFrameTime MainTimerSync::advance_checked(float p_physics_step, int p_physics
}
// determine wall clock step since last iteration
-float MainTimerSync::get_cpu_process_step() {
+double MainTimerSync::get_cpu_process_step() {
uint64_t cpu_ticks_elapsed = current_cpu_ticks_usec - last_cpu_ticks_usec;
last_cpu_ticks_usec = current_cpu_ticks_usec;
@@ -220,8 +220,8 @@ void MainTimerSync::set_fixed_fps(int p_fixed_fps) {
}
// advance one physics frame, return timesteps to take
-MainFrameTime MainTimerSync::advance(float p_physics_step, int p_physics_fps) {
- float cpu_process_step = get_cpu_process_step();
+MainFrameTime MainTimerSync::advance(double p_physics_step, int p_physics_fps) {
+ double cpu_process_step = get_cpu_process_step();
return advance_checked(p_physics_step, p_physics_fps, cpu_process_step);
}
diff --git a/main/main_timer_sync.h b/main/main_timer_sync.h
index 884978bf96..abdec18f6d 100644
--- a/main/main_timer_sync.h
+++ b/main/main_timer_sync.h
@@ -34,11 +34,11 @@
#include "core/config/engine.h"
struct MainFrameTime {
- float process_step; // delta time to advance during process()
+ double process_step; // delta time to advance during process()
int physics_steps; // number of times to iterate the physics engine
- float interpolation_fraction; // fraction through the current physics tick
+ double interpolation_fraction; // fraction through the current physics tick
- void clamp_process_step(float min_process_step, float max_process_step);
+ void clamp_process_step(double min_process_step, double max_process_step);
};
class MainTimerSync {
@@ -47,10 +47,10 @@ class MainTimerSync {
uint64_t current_cpu_ticks_usec = 0;
// logical game time since last physics timestep
- float time_accum = 0;
+ double time_accum = 0;
// current difference between wall clock time and reported sum of process_steps
- float time_deficit = 0;
+ double time_deficit = 0;
// number of frames back for keeping accumulated physics steps roughly constant.
// value of 12 chosen because that is what is required to make 144 Hz monitors
@@ -70,20 +70,20 @@ protected:
// returns the fraction of p_physics_step required for the timer to overshoot
// before advance_core considers changing the physics_steps return from
// the typical values as defined by typical_physics_steps
- float get_physics_jitter_fix();
+ double get_physics_jitter_fix();
// gets our best bet for the average number of physics steps per render frame
// return value: number of frames back this data is consistent
- int get_average_physics_steps(float &p_min, float &p_max);
+ int get_average_physics_steps(double &p_min, double &p_max);
// advance physics clock by p_process_step, return appropriate number of steps to simulate
- MainFrameTime advance_core(float p_physics_step, int p_physics_fps, float p_process_step);
+ MainFrameTime advance_core(double p_physics_step, int p_physics_fps, double p_process_step);
// calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero
- MainFrameTime advance_checked(float p_physics_step, int p_physics_fps, float p_process_step);
+ MainFrameTime advance_checked(double p_physics_step, int p_physics_fps, double p_process_step);
// determine wall clock step since last iteration
- float get_cpu_process_step();
+ double get_cpu_process_step();
public:
MainTimerSync();
@@ -96,7 +96,7 @@ public:
void set_fixed_fps(int p_fixed_fps);
// advance one frame, return timesteps to take
- MainFrameTime advance(float p_physics_step, int p_physics_fps);
+ MainFrameTime advance(double p_physics_step, int p_physics_fps);
};
#endif // MAIN_TIMER_SYNC_H
diff --git a/main/performance.cpp b/main/performance.cpp
index 9f5be7b8c4..f9ff34c05d 100644
--- a/main/performance.cpp
+++ b/main/performance.cpp
@@ -77,7 +77,7 @@ void Performance::_bind_methods() {
BIND_ENUM_CONSTANT(MONITOR_MAX);
}
-float Performance::_get_node_count() const {
+int Performance::_get_node_count() const {
MainLoop *ml = OS::get_singleton()->get_main_loop();
SceneTree *sml = Object::cast_to<SceneTree>(ml);
if (!sml) {
@@ -118,7 +118,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
return names[p_monitor];
}
-float Performance::get_monitor(Monitor p_monitor) const {
+double Performance::get_monitor(Monitor p_monitor) const {
switch (p_monitor) {
case TIME_FPS:
return Engine::get_singleton()->get_frames_per_second();
@@ -207,11 +207,11 @@ Performance::MonitorType Performance::get_monitor_type(Monitor p_monitor) const
return types[p_monitor];
}
-void Performance::set_process_time(float p_pt) {
+void Performance::set_process_time(double p_pt) {
_process_time = p_pt;
}
-void Performance::set_physics_process_time(float p_pt) {
+void Performance::set_physics_process_time(double p_pt) {
_physics_process_time = p_pt;
}
diff --git a/main/performance.h b/main/performance.h
index 174b3500d1..4653051ebb 100644
--- a/main/performance.h
+++ b/main/performance.h
@@ -43,10 +43,10 @@ class Performance : public Object {
static Performance *singleton;
static void _bind_methods();
- float _get_node_count() const;
+ int _get_node_count() const;
- float _process_time;
- float _physics_process_time;
+ double _process_time;
+ double _physics_process_time;
class MonitorCall {
Callable _callable;
@@ -96,13 +96,13 @@ public:
MONITOR_TYPE_TIME
};
- float get_monitor(Monitor p_monitor) const;
+ double get_monitor(Monitor p_monitor) const;
String get_monitor_name(Monitor p_monitor) const;
MonitorType get_monitor_type(Monitor p_monitor) const;
- void set_process_time(float p_pt);
- void set_physics_process_time(float p_pt);
+ void set_process_time(double p_pt);
+ void set_physics_process_time(double p_pt);
void add_custom_monitor(const StringName &p_id, const Callable &p_callable, const Vector<Variant> &p_args);
void remove_custom_monitor(const StringName &p_id);
diff --git a/misc/dist/windows/modpath.pas b/misc/dist/windows/modpath.pas
index c55ec60163..ab09f18254 100644
--- a/misc/dist/windows/modpath.pas
+++ b/misc/dist/windows/modpath.pas
@@ -144,7 +144,7 @@ begin
end;
end;
-// Split a string into an array using passed delimeter
+// Split a string into an array using passed delimiter.
procedure MPExplode(var Dest: TArrayOfString; Text: String; Separator: String);
var
i: Integer;
diff --git a/modules/camera/camera_osx.h b/modules/camera/camera_osx.h
index 964b7c1edc..84274f0bf6 100644
--- a/modules/camera/camera_osx.h
+++ b/modules/camera/camera_osx.h
@@ -32,7 +32,7 @@
#define CAMERAOSX_H
///@TODO this is a near duplicate of CameraIOS, we should find a way to combine those to minimize code duplication!!!!
-// If you fix something here, make sure you fix it there as wel!
+// If you fix something here, make sure you fix it there as well!
#include "servers/camera_server.h"
diff --git a/modules/camera/camera_osx.mm b/modules/camera/camera_osx.mm
index 6bc56add20..4875eb578a 100644
--- a/modules/camera/camera_osx.mm
+++ b/modules/camera/camera_osx.mm
@@ -29,7 +29,7 @@
/*************************************************************************/
///@TODO this is a near duplicate of CameraIOS, we should find a way to combine those to minimize code duplication!!!!
-// If you fix something here, make sure you fix it there as wel!
+// If you fix something here, make sure you fix it there as well!
#include "camera_osx.h"
#include "servers/camera/camera_feed.h"
diff --git a/modules/fbx/fbx_parser/ByteSwapper.h b/modules/fbx/fbx_parser/ByteSwapper.h
index 5c16383974..08d38147d5 100644
--- a/modules/fbx/fbx_parser/ByteSwapper.h
+++ b/modules/fbx/fbx_parser/ByteSwapper.h
@@ -70,7 +70,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
-/** @file Helper class tp perform various byte oder swappings
+/** @file Helper class tp perform various byte order swappings
(e.g. little to big endian) */
#ifndef BYTE_SWAPPER_H
#define BYTE_SWAPPER_H
diff --git a/modules/fbx/fbx_parser/FBXDocument.cpp b/modules/fbx/fbx_parser/FBXDocument.cpp
index 89c69d2ee8..92c62e68b5 100644
--- a/modules/fbx/fbx_parser/FBXDocument.cpp
+++ b/modules/fbx/fbx_parser/FBXDocument.cpp
@@ -198,7 +198,7 @@ ObjectPtr LazyObject::LoadObject() {
object.reset(new ModelLimbNode(id, element, doc, name));
} else if (strcmp(classtag.c_str(), "IKEffector") && strcmp(classtag.c_str(), "FKEffector")) {
- // FK and IK effectors are not supporte
+ // FK and IK effectors are not supported.
object.reset(new Model(id, element, doc, name));
}
} else if (!strncmp(obtype, "Material", length)) {
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index b585ad15bf..9445fac1c6 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -129,7 +129,7 @@ void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
config_file->get_section_keys("entry", &entry_key_list);
}
- for (String &key : entry_key_list) {
+ for (const String &key : entry_key_list) {
PropertyInfo prop;
prop.type = Variant::STRING;
@@ -145,7 +145,7 @@ void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
config_file->get_section_keys("dependencies", &dependency_key_list);
}
- for (String &key : dependency_key_list) {
+ for (const String &key : dependency_key_list) {
PropertyInfo prop;
prop.type = Variant::STRING;
@@ -171,7 +171,7 @@ void GDNativeLibrary::set_config_file(Ref<ConfigFile> p_config_file) {
p_config_file->get_section_keys("entry", &entry_keys);
}
- for (String &key : entry_keys) {
+ for (const String &key : entry_keys) {
Vector<String> tags = key.split(".");
bool skip = false;
@@ -201,7 +201,7 @@ void GDNativeLibrary::set_config_file(Ref<ConfigFile> p_config_file) {
p_config_file->get_section_keys("dependencies", &dependency_keys);
}
- for (String &key : dependency_keys) {
+ for (const String &key : dependency_keys) {
Vector<String> tags = key.split(".");
bool skip = false;
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index 0a3225fcc5..df0f29277e 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -425,7 +425,7 @@ List<ClassAPI> generate_c_api_classes() {
List<EnumAPI> enums;
List<StringName> enum_names;
ClassDB::get_enum_list(class_name, &enum_names, true);
- for (StringName &E : enum_names) {
+ for (const StringName &E : enum_names) {
List<StringName> value_names;
EnumAPI enum_api;
enum_api.name = E;
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index dba348c20d..f3a0e9603f 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -98,7 +98,7 @@ void NativeScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder)
List<PropertyInfo> info;
get_script_property_list(&info);
Map<StringName, Variant> values;
- for (PropertyInfo &E : info) {
+ for (const PropertyInfo &E : info) {
Variant value;
get_property_default_value(E.name, value);
values[E.name] = value;
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index c3a6a3267f..a41c4f7b19 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -79,7 +79,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
List<String> entry_keys;
config->get_section_keys("entry", &entry_keys);
- for (String &key : entry_keys) {
+ for (const String &key : entry_keys) {
Vector<String> tags = key.split(".");
bool skip = false;
@@ -110,7 +110,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
List<String> dependency_keys;
config->get_section_keys("dependencies", &dependency_keys);
- for (String &key : dependency_keys) {
+ for (const String &key : dependency_keys) {
Vector<String> tags = key.split(".");
bool skip = false;
@@ -145,7 +145,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
List<String> entry_keys;
config->get_section_keys("entry", &entry_keys);
- for (String &key : entry_keys) {
+ for (const String &key : entry_keys) {
Vector<String> tags = key.split(".");
bool skip = false;
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index b19a57d56a..ed8b0a4690 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -458,7 +458,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color types_color = EDITOR_GET("text_editor/highlighting/engine_type_color");
List<StringName> types;
ClassDB::get_class_list(&types);
- for (StringName &E : types) {
+ for (const StringName &E : types) {
String n = E;
if (n.begins_with("_")) {
n = n.substr(1, n.length());
@@ -470,7 +470,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color usertype_color = EDITOR_GET("text_editor/highlighting/user_type_color");
List<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes);
- for (StringName &E : global_classes) {
+ for (const StringName &E : global_classes) {
keywords[String(E)] = usertype_color;
}
@@ -489,7 +489,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color basetype_color = EDITOR_GET("text_editor/highlighting/base_type_color");
List<String> core_types;
gdscript->get_core_type_words(&core_types);
- for (String &E : core_types) {
+ for (const String &E : core_types) {
keywords[E] = basetype_color;
}
@@ -498,7 +498,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color");
List<String> keyword_list;
gdscript->get_reserved_words(&keyword_list);
- for (String &E : keyword_list) {
+ for (const String &E : keyword_list) {
if (gdscript->is_control_flow_keyword(E)) {
keywords[E] = control_flow_keyword_color;
} else {
@@ -510,7 +510,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
List<String> comments;
gdscript->get_comment_delimiters(&comments);
- for (String &comment : comments) {
+ for (const String &comment : comments) {
String beg = comment.get_slice(" ", 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
add_color_region(beg, end, comment_color, end == "");
@@ -520,7 +520,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color string_color = EDITOR_GET("text_editor/highlighting/string_color");
List<String> strings;
gdscript->get_string_delimiters(&strings);
- for (String &string : strings) {
+ for (const String &string : strings) {
String beg = string.get_slice(" ", 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
add_color_region(beg, end, string_color, end == "");
@@ -534,7 +534,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
if (instance_base != StringName()) {
List<PropertyInfo> plist;
ClassDB::get_property_list(instance_base, &plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
String name = E.name;
if (E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP) {
continue;
@@ -547,7 +547,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
List<String> clist;
ClassDB::get_integer_constant_list(instance_base, &clist);
- for (String &E : clist) {
+ for (const String &E : clist) {
member_keywords[E] = member_variable_color;
}
}
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 79cc90b92f..8957b00a1b 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -291,7 +291,7 @@ void GDScript::_get_script_property_list(List<PropertyInfo> *r_list, bool p_incl
sptr = sptr->_base;
}
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
r_list->push_back(E);
}
}
@@ -401,7 +401,7 @@ void GDScript::_update_exports_values(Map<StringName, Variant> &values, List<Pro
values[E->key()] = E->get();
}
- for (PropertyInfo &E : members_cache) {
+ for (const PropertyInfo &E : members_cache) {
propnames.push_back(E);
}
}
@@ -861,8 +861,7 @@ Error GDScript::reload(bool p_keep_state) {
}
}
#ifdef DEBUG_ENABLED
- for (const GDScriptWarning &E : parser.get_warnings()) {
- const GDScriptWarning &warning = E;
+ for (const GDScriptWarning &warning : parser.get_warnings()) {
if (EngineDebugger::is_active()) {
Vector<ScriptLanguage::StackInfo> si;
EngineDebugger::get_script_debugger()->send_error("", get_path(), warning.start_line, warning.get_name(), warning.get_message(), ERR_HANDLER_WARNING, si);
@@ -1445,7 +1444,7 @@ void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const
sptr = sptr->_base;
}
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
p_properties->push_back(E);
}
}
@@ -1644,24 +1643,24 @@ void GDScriptLanguage::init() {
List<StringName> class_list;
ClassDB::get_class_list(&class_list);
- for (StringName &n : class_list) {
+ for (const StringName &n : class_list) {
String s = String(n);
if (s.begins_with("_")) {
- n = s.substr(1, s.length());
+ s = s.substr(1, s.length());
}
- if (globals.has(n)) {
+ if (globals.has(s)) {
continue;
}
Ref<GDScriptNativeClass> nc = memnew(GDScriptNativeClass(n));
- _add_global(n, nc);
+ _add_global(s, nc);
}
//populate singletons
List<Engine::Singleton> singletons;
Engine::get_singleton()->get_singletons(&singletons);
- for (Engine::Singleton &E : singletons) {
+ for (const Engine::Singleton &E : singletons) {
_add_global(E.name, E.ptr);
}
@@ -1805,10 +1804,10 @@ void GDScriptLanguage::reload_all_scripts() {
scripts.sort_custom<GDScriptDepSort>(); //update in inheritance dependency order
- for (Ref<GDScript> E : scripts) {
- print_verbose("GDScript: Reloading: " + E->get_path());
- E->load_source_code(E->get_path());
- E->reload(true);
+ for (Ref<GDScript> &script : scripts) {
+ print_verbose("GDScript: Reloading: " + script->get_path());
+ script->load_source_code(script->get_path());
+ script->reload(true);
}
#endif
}
@@ -1837,21 +1836,21 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so
scripts.sort_custom<GDScriptDepSort>(); //update in inheritance dependency order
- for (Ref<GDScript> E : scripts) {
- bool reload = E == p_script || to_reload.has(E->get_base());
+ for (Ref<GDScript> &script : scripts) {
+ bool reload = script == p_script || to_reload.has(script->get_base());
if (!reload) {
continue;
}
- to_reload.insert(E, Map<ObjectID, List<Pair<StringName, Variant>>>());
+ to_reload.insert(script, Map<ObjectID, List<Pair<StringName, Variant>>>());
if (!p_soft_reload) {
//save state and remove script from instances
- Map<ObjectID, List<Pair<StringName, Variant>>> &map = to_reload[E];
+ Map<ObjectID, List<Pair<StringName, Variant>>> &map = to_reload[script];
- while (E->instances.front()) {
- Object *obj = E->instances.front()->get();
+ while (script->instances.front()) {
+ Object *obj = script->instances.front()->get();
//save instance info
List<Pair<StringName, Variant>> state;
if (obj->get_script_instance()) {
@@ -1864,8 +1863,8 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so
//same thing for placeholders
#ifdef TOOLS_ENABLED
- while (E->placeholders.size()) {
- Object *obj = E->placeholders.front()->get()->get_owner();
+ while (script->placeholders.size()) {
+ Object *obj = script->placeholders.front()->get()->get_owner();
//save instance info
if (obj->get_script_instance()) {
@@ -1875,13 +1874,13 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so
obj->set_script(Variant());
} else {
// no instance found. Let's remove it so we don't loop forever
- E->placeholders.erase(E->placeholders.front()->get());
+ script->placeholders.erase(script->placeholders.front()->get());
}
}
#endif
- for (Map<ObjectID, List<Pair<StringName, Variant>>>::Element *F = E->pending_reload_state.front(); F; F = F->next()) {
+ for (Map<ObjectID, List<Pair<StringName, Variant>>>::Element *F = script->pending_reload_state.front(); F; F = F->next()) {
map[F->key()] = F->get(); //pending to reload, use this one instead
}
}
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 3289f8978b..7c9d08b782 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -981,7 +981,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
assigned = prev_base;
// Set back the values into their bases.
- for (ChainInfo &info : set_chain) {
+ for (const ChainInfo &info : set_chain) {
if (!info.is_named) {
gen->write_set(info.base, info.key, assigned);
if (info.key.mode == GDScriptCodeGenerator::Address::TEMPORARY) {
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 3ac9db3645..2a93bb620b 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -319,7 +319,7 @@ void GDScriptLanguage::debug_get_stack_level_locals(int p_level, List<String> *p
List<Pair<StringName, int>> locals;
f->debug_get_stack_member_state(*_call_stack[l].line, &locals);
- for (Pair<StringName, int> &E : locals) {
+ for (const Pair<StringName, int> &E : locals) {
p_locals->push_back(E.first);
p_values->push_back(_call_stack[l].stack[E.second]);
}
@@ -865,7 +865,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
if (!_static) {
List<PropertyInfo> members;
scr->get_script_property_list(&members);
- for (PropertyInfo &E : members) {
+ for (const PropertyInfo &E : members) {
ScriptCodeCompletionOption option(E.name, ScriptCodeCompletionOption::KIND_MEMBER);
r_result.insert(option.display, option);
}
@@ -879,7 +879,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
List<MethodInfo> signals;
scr->get_script_signal_list(&signals);
- for (MethodInfo &E : signals) {
+ for (const MethodInfo &E : signals) {
ScriptCodeCompletionOption option(E.name, ScriptCodeCompletionOption::KIND_SIGNAL);
r_result.insert(option.display, option);
}
@@ -887,7 +887,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
List<MethodInfo> methods;
scr->get_script_method_list(&methods);
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
if (E.name.begins_with("@")) {
continue;
}
@@ -920,7 +920,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
if (!p_only_functions) {
List<String> constants;
ClassDB::get_integer_constant_list(type, &constants);
- for (String &E : constants) {
+ for (const String &E : constants) {
ScriptCodeCompletionOption option(E, ScriptCodeCompletionOption::KIND_CONSTANT);
r_result.insert(option.display, option);
}
@@ -928,7 +928,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
if (!_static || Engine::get_singleton()->has_singleton(type)) {
List<PropertyInfo> pinfo;
ClassDB::get_property_list(type, &pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.usage & (PROPERTY_USAGE_GROUP | PROPERTY_USAGE_CATEGORY)) {
continue;
}
@@ -945,7 +945,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
List<MethodInfo> methods;
bool is_autocompleting_getters = GLOBAL_GET("debug/gdscript/completion/autocomplete_setters_and_getters").booleanize();
ClassDB::get_method_list(type, &methods, false, !is_autocompleting_getters);
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
if (E.name.begins_with("_")) {
continue;
}
@@ -977,7 +977,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
tmp.get_property_list(&members);
}
- for (PropertyInfo &E : members) {
+ for (const PropertyInfo &E : members) {
if (String(E.name).find("/") == -1) {
ScriptCodeCompletionOption option(E.name, ScriptCodeCompletionOption::KIND_MEMBER);
r_result.insert(option.display, option);
@@ -2095,7 +2095,7 @@ static bool _guess_method_return_type_from_base(GDScriptParser::CompletionContex
if (scr.is_valid()) {
List<MethodInfo> methods;
scr->get_script_method_list(&methods);
- for (MethodInfo &mi : methods) {
+ for (const MethodInfo &mi : methods) {
if (mi.name == p_method) {
r_type = _type_from_property(mi.return_val);
return true;
@@ -2135,7 +2135,7 @@ static bool _guess_method_return_type_from_base(GDScriptParser::CompletionContex
List<MethodInfo> methods;
tmp.get_method_list(&methods);
- for (MethodInfo &mi : methods) {
+ for (const MethodInfo &mi : methods) {
if (mi.name == p_method) {
r_type = _type_from_property(mi.return_val);
return true;
@@ -2180,7 +2180,7 @@ static void _find_enumeration_candidates(GDScriptParser::CompletionContext &p_co
List<StringName> enum_constants;
ClassDB::get_enum_constants(class_name, enum_name, &enum_constants);
- for (StringName &E : enum_constants) {
+ for (const StringName &E : enum_constants) {
String candidate = class_name + "." + E;
ScriptCodeCompletionOption option(candidate, ScriptCodeCompletionOption::KIND_ENUM);
r_result.insert(option.display, option);
@@ -2225,7 +2225,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
if (obj) {
List<String> options;
obj->get_argument_options(p_method, p_argidx, &options);
- for (String &F : options) {
+ for (const String &F : options) {
ScriptCodeCompletionOption option(F, ScriptCodeCompletionOption::KIND_FUNCTION);
r_result.insert(option.display, option);
}
@@ -2247,7 +2247,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
String s = E.name;
if (!s.begins_with("autoload/")) {
continue;
@@ -2263,7 +2263,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
// Get input actions
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
String s = E.name;
if (!s.begins_with("input/")) {
continue;
@@ -2288,7 +2288,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
List<MethodInfo> methods;
base.get_method_list(&methods);
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
if (E.name == p_method) {
r_arghint = _make_arguments_hint(E, p_argidx);
return;
@@ -2337,7 +2337,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
Variant::get_constructor_list(GDScriptParser::get_builtin_type(call->function_name), &constructors);
int i = 0;
- for (MethodInfo &E : constructors) {
+ for (const MethodInfo &E : constructors) {
if (p_argidx >= E.arguments.size()) {
continue;
}
@@ -2603,7 +2603,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
List<MethodInfo> virtual_methods;
ClassDB::get_virtual_methods(class_name, &virtual_methods);
- for (MethodInfo &mi : virtual_methods) {
+ for (const MethodInfo &mi : virtual_methods) {
String method_hint = mi.name;
if (method_hint.find(":") != -1) {
method_hint = method_hint.get_slice(":", 0);
@@ -2652,7 +2652,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
List<String> opts;
p_owner->get_argument_options("get_node", 0, &opts);
- for (String &E : opts) {
+ for (const String &E : opts) {
String opt = E.strip_edges();
if (opt.is_quoted()) {
r_forced = true;
@@ -2837,7 +2837,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
List<MethodInfo> virtual_methods;
ClassDB::get_virtual_methods(class_name, &virtual_methods, true);
- for (MethodInfo &E : virtual_methods) {
+ for (const MethodInfo &E : virtual_methods) {
if (E.name == p_symbol) {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_METHOD;
r_result.class_name = base_type.native_type;
@@ -2856,7 +2856,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
List<String> constants;
ClassDB::get_integer_constant_list(class_name, &constants, true);
- for (String &E : constants) {
+ for (const String &E : constants) {
if (E == p_symbol) {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
r_result.class_name = base_type.native_type;
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 9949d0db56..466ddb4b10 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -1332,7 +1332,7 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali
}
void GDScriptParser::clear_unused_annotations() {
- for (AnnotationNode *annotation : annotation_stack) {
+ for (const AnnotationNode *annotation : annotation_stack) {
push_error(vformat(R"(Annotation "%s" does not precedes a valid target, so it will have no effect.)", annotation->name), annotation);
}
@@ -1795,7 +1795,7 @@ GDScriptParser::MatchBranchNode *GDScriptParser::parse_match_branch() {
List<StringName> binds;
branch->patterns[0]->binds.get_key_list(&binds);
- for (StringName &E : binds) {
+ for (const StringName &E : binds) {
SuiteNode::Local local(branch->patterns[0]->binds[E], current_function);
suite->add_local(local);
}
@@ -3617,7 +3617,7 @@ void GDScriptParser::TreePrinter::push_text(const String &p_text) {
printed += p_text;
}
-void GDScriptParser::TreePrinter::print_annotation(AnnotationNode *p_annotation) {
+void GDScriptParser::TreePrinter::print_annotation(const AnnotationNode *p_annotation) {
push_text(p_annotation->name);
push_text(" (");
for (int i = 0; i < p_annotation->arguments.size(); i++) {
@@ -3992,7 +3992,7 @@ void GDScriptParser::TreePrinter::print_for(ForNode *p_for) {
}
void GDScriptParser::TreePrinter::print_function(FunctionNode *p_function, const String &p_context) {
- for (AnnotationNode *E : p_function->annotations) {
+ for (const AnnotationNode *E : p_function->annotations) {
print_annotation(E);
}
push_text(p_context);
@@ -4332,7 +4332,7 @@ void GDScriptParser::TreePrinter::print_unary_op(UnaryOpNode *p_unary_op) {
}
void GDScriptParser::TreePrinter::print_variable(VariableNode *p_variable) {
- for (AnnotationNode *E : p_variable->annotations) {
+ for (const AnnotationNode *E : p_variable->annotations) {
print_annotation(E);
}
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index 043d87c705..6a227a55e5 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -1431,7 +1431,7 @@ public:
void push_line(const String &p_line = String());
void push_text(const String &p_text);
- void print_annotation(AnnotationNode *p_annotation);
+ void print_annotation(const AnnotationNode *p_annotation);
void print_array(ArrayNode *p_array);
void print_assert(AssertNode *p_assert);
void print_assignment(AssignmentNode *p_assignment);
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp
index eb68e38840..d106b3b541 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.cpp
+++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp
@@ -150,9 +150,9 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
}
r_symbol.kind = lsp::SymbolKind::Class;
r_symbol.deprecated = false;
- r_symbol.range.start.line = LINE_NUMBER_TO_INDEX(p_class->start_line);
- r_symbol.range.start.character = LINE_NUMBER_TO_INDEX(p_class->start_column);
- r_symbol.range.end.line = LINE_NUMBER_TO_INDEX(p_class->end_line);
+ r_symbol.range.start.line = p_class->start_line;
+ r_symbol.range.start.character = p_class->start_column;
+ r_symbol.range.end.line = lines.size();
r_symbol.selectionRange.start.line = r_symbol.range.start.line;
r_symbol.detail = "class " + r_symbol.name;
bool is_root_class = &r_symbol == &class_symbol;
@@ -165,7 +165,7 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
case ClassNode::Member::VARIABLE: {
lsp::DocumentSymbol symbol;
symbol.name = m.variable->identifier->name;
- symbol.kind = lsp::SymbolKind::Variable;
+ symbol.kind = m.variable->property == VariableNode::PropertyStyle::PROP_NONE ? lsp::SymbolKind::Variable : lsp::SymbolKind::Property;
symbol.deprecated = false;
symbol.range.start.line = LINE_NUMBER_TO_INDEX(m.variable->start_line);
symbol.range.start.character = LINE_NUMBER_TO_INDEX(m.variable->start_column);
@@ -317,7 +317,7 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN
const String uri = get_uri();
r_symbol.name = p_func->identifier->name;
- r_symbol.kind = lsp::SymbolKind::Function;
+ r_symbol.kind = p_func->is_static ? lsp::SymbolKind::Function : lsp::SymbolKind::Method;
r_symbol.detail = "func " + String(p_func->identifier->name) + "(";
r_symbol.deprecated = false;
r_symbol.range.start.line = LINE_NUMBER_TO_INDEX(p_func->start_line);
@@ -465,7 +465,7 @@ String ExtendGDScriptParser::parse_documentation(int p_line, bool p_docs_down) {
}
String doc;
- for (String &E : doc_lines) {
+ for (const String &E : doc_lines) {
doc += E + "\n";
}
return doc;
diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp
index eb60433859..e6c819b22f 100644
--- a/modules/gdscript/language_server/gdscript_workspace.cpp
+++ b/modules/gdscript/language_server/gdscript_workspace.cpp
@@ -119,7 +119,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::get_script_symbol(const String &p_
void GDScriptWorkspace::reload_all_workspace_scripts() {
List<String> paths;
list_script_files("res://", paths);
- for (String &path : paths) {
+ for (const String &path : paths) {
Error err;
String content = FileAccess::get_file_as_string(path, &err);
ERR_CONTINUE(err != OK);
@@ -586,7 +586,7 @@ Error GDScriptWorkspace::resolve_signature(const lsp::TextDocumentPositionParams
GDScriptLanguageProtocol::get_singleton()->get_workspace()->resolve_related_symbols(text_pos, symbols);
}
- for (const lsp::DocumentSymbol *symbol : symbols) {
+ for (const lsp::DocumentSymbol *const &symbol : symbols) {
if (symbol->kind == lsp::SymbolKind::Method || symbol->kind == lsp::SymbolKind::Function) {
lsp::SignatureInformation signature_info;
signature_info.label = symbol->detail;
diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp
index a7dcfdb22d..0138f132ad 100644
--- a/modules/gdscript/language_server/lsp.hpp
+++ b/modules/gdscript/language_server/lsp.hpp
@@ -1018,32 +1018,32 @@ struct CompletionList {
* A symbol kind.
*/
namespace SymbolKind {
-static const int File = 0;
-static const int Module = 1;
-static const int Namespace = 2;
-static const int Package = 3;
-static const int Class = 4;
-static const int Method = 5;
-static const int Property = 6;
-static const int Field = 7;
-static const int Constructor = 8;
-static const int Enum = 9;
-static const int Interface = 10;
-static const int Function = 11;
-static const int Variable = 12;
-static const int Constant = 13;
-static const int String = 14;
-static const int Number = 15;
-static const int Boolean = 16;
-static const int Array = 17;
-static const int Object = 18;
-static const int Key = 19;
-static const int Null = 20;
-static const int EnumMember = 21;
-static const int Struct = 22;
-static const int Event = 23;
-static const int Operator = 24;
-static const int TypeParameter = 25;
+static const int File = 1;
+static const int Module = 2;
+static const int Namespace = 3;
+static const int Package = 4;
+static const int Class = 5;
+static const int Method = 6;
+static const int Property = 7;
+static const int Field = 8;
+static const int Constructor = 9;
+static const int Enum = 10;
+static const int Interface = 11;
+static const int Function = 12;
+static const int Variable = 13;
+static const int Constant = 14;
+static const int String = 15;
+static const int Number = 16;
+static const int Boolean = 17;
+static const int Array = 18;
+static const int Object = 19;
+static const int Key = 20;
+static const int Null = 21;
+static const int EnumMember = 22;
+static const int Struct = 23;
+static const int Event = 24;
+static const int Operator = 25;
+static const int TypeParameter = 26;
}; // namespace SymbolKind
/**
diff --git a/modules/glslang/register_types.cpp b/modules/glslang/register_types.cpp
index 730c6b89f7..dd545ff431 100644
--- a/modules/glslang/register_types.cpp
+++ b/modules/glslang/register_types.cpp
@@ -193,7 +193,7 @@ void preregister_glslang_types() {
// initialize in case it's not initialized. This is done once per thread
// and it's safe to call multiple times
glslang::InitializeProcess();
- RenderingDevice::shader_set_compile_function(_compile_shader_glsl);
+ RenderingDevice::shader_set_compile_to_spirv_function(_compile_shader_glsl);
RenderingDevice::shader_set_get_cache_key_function(_get_cache_key_function_glsl);
}
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index ca461566d3..fea513c820 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -519,7 +519,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
RS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid());
int idx = 0;
- for (Pair<Transform3D, IndexKey> &F : E->get()) {
+ for (const Pair<Transform3D, IndexKey> &F : E->get()) {
RS::get_singleton()->multimesh_instance_set_transform(mm, idx, F.first);
#ifdef TOOLS_ENABLED
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 9530122e04..989c2d295c 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -497,7 +497,7 @@ void GridMapEditor::_fill_selection() {
}
void GridMapEditor::_clear_clipboard_data() {
- for (ClipboardItem &E : clipboard_items) {
+ for (const ClipboardItem &E : clipboard_items) {
RenderingServer::get_singleton()->free(E.instance);
}
@@ -552,7 +552,7 @@ void GridMapEditor::_update_paste_indicator() {
RenderingServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf);
- for (ClipboardItem &item : clipboard_items) {
+ for (const ClipboardItem &item : clipboard_items) {
xf = Transform3D();
xf.origin = (paste_indicator.begin + (paste_indicator.current - paste_indicator.click) + center) * node->get_cell_size();
xf.basis = rot * xf.basis;
@@ -576,7 +576,7 @@ void GridMapEditor::_do_paste() {
Vector3 ofs = paste_indicator.current - paste_indicator.click;
undo_redo->create_action(TTR("GridMap Paste Selection"));
- for (ClipboardItem &item : clipboard_items) {
+ for (const ClipboardItem &item : clipboard_items) {
Vector3 position = rot.xform(item.grid_offset) + paste_indicator.begin + ofs;
Basis orm;
@@ -659,7 +659,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action == INPUT_PAINT)) {
if (set_items.size()) {
undo_redo->create_action(TTR("GridMap Paint"));
- for (SetItem &si : set_items) {
+ for (const SetItem &si : set_items) {
undo_redo->add_do_method(node, "set_cell_item", si.position, si.new_value, si.new_orientation);
}
for (List<SetItem>::Element *E = set_items.back(); E; E = E->prev()) {
diff --git a/modules/lightmapper_rd/lightmapper_rd.cpp b/modules/lightmapper_rd/lightmapper_rd.cpp
index b75cf6502e..fe941e25e7 100644
--- a/modules/lightmapper_rd/lightmapper_rd.cpp
+++ b/modules/lightmapper_rd/lightmapper_rd.cpp
@@ -794,7 +794,7 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
}
ERR_FAIL_COND_V(err != OK, BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES);
- RID rasterize_shader = rd->shader_create_from_bytecode(raster_shader->get_bytecode());
+ RID rasterize_shader = rd->shader_create_from_spirv(raster_shader->get_spirv_stages());
ERR_FAIL_COND_V(rasterize_shader.is_null(), BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES); //this is a bug check, though, should not happen
@@ -945,27 +945,27 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
ERR_FAIL_COND_V(err != OK, BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES);
// Unoccluder
- RID compute_shader_unocclude = rd->shader_create_from_bytecode(compute_shader->get_bytecode("unocclude"));
+ RID compute_shader_unocclude = rd->shader_create_from_spirv(compute_shader->get_spirv_stages("unocclude"));
ERR_FAIL_COND_V(compute_shader_unocclude.is_null(), BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES); // internal check, should not happen
RID compute_shader_unocclude_pipeline = rd->compute_pipeline_create(compute_shader_unocclude);
// Direct light
- RID compute_shader_primary = rd->shader_create_from_bytecode(compute_shader->get_bytecode("primary"));
+ RID compute_shader_primary = rd->shader_create_from_spirv(compute_shader->get_spirv_stages("primary"));
ERR_FAIL_COND_V(compute_shader_primary.is_null(), BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES); // internal check, should not happen
RID compute_shader_primary_pipeline = rd->compute_pipeline_create(compute_shader_primary);
// Indirect light
- RID compute_shader_secondary = rd->shader_create_from_bytecode(compute_shader->get_bytecode("secondary"));
+ RID compute_shader_secondary = rd->shader_create_from_spirv(compute_shader->get_spirv_stages("secondary"));
ERR_FAIL_COND_V(compute_shader_secondary.is_null(), BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES); //internal check, should not happen
RID compute_shader_secondary_pipeline = rd->compute_pipeline_create(compute_shader_secondary);
// Dilate
- RID compute_shader_dilate = rd->shader_create_from_bytecode(compute_shader->get_bytecode("dilate"));
+ RID compute_shader_dilate = rd->shader_create_from_spirv(compute_shader->get_spirv_stages("dilate"));
ERR_FAIL_COND_V(compute_shader_dilate.is_null(), BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES); //internal check, should not happen
RID compute_shader_dilate_pipeline = rd->compute_pipeline_create(compute_shader_dilate);
// Light probes
- RID compute_shader_light_probes = rd->shader_create_from_bytecode(compute_shader->get_bytecode("light_probes"));
+ RID compute_shader_light_probes = rd->shader_create_from_spirv(compute_shader->get_spirv_stages("light_probes"));
ERR_FAIL_COND_V(compute_shader_light_probes.is_null(), BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES); //internal check, should not happen
RID compute_shader_light_probes_pipeline = rd->compute_pipeline_create(compute_shader_light_probes);
@@ -1506,11 +1506,11 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
}
ERR_FAIL_COND_V(err != OK, BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES);
- RID blendseams_line_raster_shader = rd->shader_create_from_bytecode(blendseams_shader->get_bytecode("lines"));
+ RID blendseams_line_raster_shader = rd->shader_create_from_spirv(blendseams_shader->get_spirv_stages("lines"));
ERR_FAIL_COND_V(blendseams_line_raster_shader.is_null(), BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES);
- RID blendseams_triangle_raster_shader = rd->shader_create_from_bytecode(blendseams_shader->get_bytecode("triangles"));
+ RID blendseams_triangle_raster_shader = rd->shader_create_from_spirv(blendseams_shader->get_spirv_stages("triangles"));
ERR_FAIL_COND_V(blendseams_triangle_raster_shader.is_null(), BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES);
diff --git a/modules/mono/class_db_api_json.cpp b/modules/mono/class_db_api_json.cpp
index 01d0e13515..0da06131af 100644
--- a/modules/mono/class_db_api_json.cpp
+++ b/modules/mono/class_db_api_json.cpp
@@ -50,7 +50,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
//must be alphabetically sorted for hash to compute
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
ClassDB::ClassInfo *t = ClassDB::classes.getptr(E);
ERR_FAIL_COND(!t);
if (t->api != p_api || !t->exposed) {
@@ -84,7 +84,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
Array methods;
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
Dictionary method_dict;
methods.push_back(method_dict);
@@ -141,7 +141,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
Array constants;
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
Dictionary constant_dict;
constants.push_back(constant_dict);
@@ -168,7 +168,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
Array signals;
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
Dictionary signal_dict;
signals.push_back(signal_dict);
@@ -203,7 +203,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
Array properties;
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
Dictionary property_dict;
properties.push_back(property_dict);
@@ -222,7 +222,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
Array property_list;
//property list
- for (PropertyInfo &F : t->property_list) {
+ for (const PropertyInfo &F : t->property_list) {
Dictionary property_dict;
property_list.push_back(property_dict);
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 0eea0f543b..15a5807370 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -145,8 +145,8 @@ void CSharpLanguage::finalize() {
finalizing = true;
// Make sure all script binding gchandles are released before finalizing GDMono
- for (Map<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) {
- CSharpScriptBinding &script_binding = E->value();
+ for (KeyValue<Object *, CSharpScriptBinding> &E : script_bindings) {
+ CSharpScriptBinding &script_binding = E.value;
if (!script_binding.gchandle.is_released()) {
script_binding.gchandle.release();
@@ -163,8 +163,8 @@ void CSharpLanguage::finalize() {
script_bindings.clear();
#ifdef DEBUG_ENABLED
- for (Map<ObjectID, int>::Element *E = unsafe_object_references.front(); E; E = E->next()) {
- const ObjectID &id = E->key();
+ for (const KeyValue<ObjectID, int> &E : unsafe_object_references) {
+ const ObjectID &id = E.key;
Object *obj = ObjectDB::get_instance(id);
if (obj) {
@@ -864,8 +864,8 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
// We need to keep reference instances alive during reloading
List<Ref<RefCounted>> rc_instances;
- for (Map<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) {
- CSharpScriptBinding &script_binding = E->value();
+ for (const KeyValue<Object *, CSharpScriptBinding> &E : script_bindings) {
+ const CSharpScriptBinding &script_binding = E.value;
RefCounted *rc = Object::cast_to<RefCounted>(script_binding.owner);
if (rc) {
rc_instances.push_back(Ref<RefCounted>(rc));
@@ -874,7 +874,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
// As scripts are going to be reloaded, must proceed without locking here
- for (Ref<CSharpScript> script : scripts) {
+ for (Ref<CSharpScript> &script : scripts) {
to_reload.push_back(script);
if (script->get_path().is_empty()) {
@@ -885,8 +885,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
// Script::instances are deleted during managed object disposal, which happens on domain finalize.
// Only placeholders are kept. Therefore we need to keep a copy before that happens.
- for (Set<Object *>::Element *F = script->instances.front(); F; F = F->next()) {
- Object *obj = F->get();
+ for (Object *&obj : script->instances) {
script->pending_reload_instances.insert(obj->get_instance_id());
RefCounted *rc = Object::cast_to<RefCounted>(obj);
@@ -896,8 +895,8 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
}
#ifdef TOOLS_ENABLED
- for (Set<PlaceHolderScriptInstance *>::Element *F = script->placeholders.front(); F; F = F->next()) {
- Object *obj = F->get()->get_owner();
+ for (PlaceHolderScriptInstance *&script_instance : script->placeholders) {
+ Object *obj = script_instance->get_owner();
script->pending_reload_instances.insert(obj->get_instance_id());
RefCounted *rc = Object::cast_to<RefCounted>(obj);
@@ -910,9 +909,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
// Save state and remove script from instances
Map<ObjectID, CSharpScript::StateBackup> &owners_map = script->pending_reload_state;
- for (Set<Object *>::Element *F = script->instances.front(); F; F = F->next()) {
- Object *obj = F->get();
-
+ for (Object *&obj : script->instances) {
ERR_CONTINUE(!obj->get_script_instance());
CSharpInstance *csi = static_cast<CSharpInstance *>(obj->get_script_instance());
@@ -934,7 +931,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
}
// After the state of all instances is saved, clear scripts and script instances
- for (Ref<CSharpScript> script : scripts) {
+ for (Ref<CSharpScript> &script : scripts) {
while (script->instances.front()) {
Object *obj = script->instances.front()->get();
obj->set_script(REF()); // Remove script and existing script instances (placeholder are not removed before domain reload)
@@ -947,9 +944,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
if (gdmono->reload_scripts_domain() != OK) {
// Failed to reload the scripts domain
// Make sure to add the scripts back to their owners before returning
- for (Ref<CSharpScript> scr : to_reload) {
- for (const Map<ObjectID, CSharpScript::StateBackup>::Element *F = scr->pending_reload_state.front(); F; F = F->next()) {
- Object *obj = ObjectDB::get_instance(F->key());
+ for (Ref<CSharpScript> &scr : to_reload) {
+ for (const KeyValue<ObjectID, CSharpScript::StateBackup> &F : scr->pending_reload_state) {
+ Object *obj = ObjectDB::get_instance(F.key);
if (!obj) {
continue;
@@ -969,8 +966,8 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
#endif
// Restore Variant properties state, it will be kept by the placeholder until the next script reloading
- for (List<Pair<StringName, Variant>>::Element *G = scr->pending_reload_state[obj_id].properties.front(); G; G = G->next()) {
- placeholder->property_set_fallback(G->get().first, G->get().second, nullptr);
+ for (const Pair<StringName, Variant> &G : scr->pending_reload_state[obj_id].properties) {
+ placeholder->property_set_fallback(G.first, G.second, nullptr);
}
scr->pending_reload_state.erase(obj_id);
@@ -982,7 +979,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
List<Ref<CSharpScript>> to_reload_state;
- for (Ref<CSharpScript> script : to_reload) {
+ for (Ref<CSharpScript> &script : to_reload) {
#ifdef TOOLS_ENABLED
script->exports_invalidated = true;
#endif
@@ -1035,8 +1032,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
StringName native_name = NATIVE_GDMONOCLASS_NAME(script->native);
{
- for (Set<ObjectID>::Element *F = script->pending_reload_instances.front(); F; F = F->next()) {
- ObjectID obj_id = F->get();
+ for (const ObjectID &obj_id : script->pending_reload_instances) {
Object *obj = ObjectDB::get_instance(obj_id);
if (!obj) {
@@ -1087,9 +1083,8 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
to_reload_state.push_back(script);
}
- for (Ref<CSharpScript> script : to_reload_state) {
- for (Set<ObjectID>::Element *F = script->pending_reload_instances.front(); F; F = F->next()) {
- ObjectID obj_id = F->get();
+ for (Ref<CSharpScript> &script : to_reload_state) {
+ for (const ObjectID &obj_id : script->pending_reload_instances) {
Object *obj = ObjectDB::get_instance(obj_id);
if (!obj) {
@@ -1103,16 +1098,16 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
CSharpScript::StateBackup &state_backup = script->pending_reload_state[obj_id];
- for (List<Pair<StringName, Variant>>::Element *G = state_backup.properties.front(); G; G = G->next()) {
- obj->get_script_instance()->set(G->get().first, G->get().second);
+ for (const Pair<StringName, Variant> &G : state_backup.properties) {
+ obj->get_script_instance()->set(G.first, G.second);
}
CSharpInstance *csi = CAST_CSHARP_INSTANCE(obj->get_script_instance());
if (csi) {
- for (List<Pair<StringName, Array>>::Element *G = state_backup.event_signals.front(); G; G = G->next()) {
- const StringName &name = G->get().first;
- const Array &serialized_data = G->get().second;
+ for (const Pair<StringName, Array> &G : state_backup.event_signals) {
+ const StringName &name = G.first;
+ const Array &serialized_data = G.second;
Map<StringName, CSharpScript::EventSignal>::Element *match = script->event_signals.find(name);
@@ -1156,9 +1151,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
{
MutexLock lock(ManagedCallable::instances_mutex);
- for (Map<ManagedCallable *, Array>::Element *elem = ManagedCallable::instances_pending_reload.front(); elem; elem = elem->next()) {
- ManagedCallable *managed_callable = elem->key();
- const Array &serialized_data = elem->value();
+ for (const KeyValue<ManagedCallable *, Array> &elem : ManagedCallable::instances_pending_reload) {
+ ManagedCallable *managed_callable = elem.key;
+ const Array &serialized_data = elem.value;
MonoObject *managed_serialized_data = GDMonoMarshal::variant_to_mono_object(serialized_data);
MonoDelegate *delegate = nullptr;
@@ -1302,8 +1297,8 @@ bool CSharpLanguage::debug_break(const String &p_error, bool p_allow_continue) {
}
void CSharpLanguage::_on_scripts_domain_unloaded() {
- for (Map<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) {
- CSharpScriptBinding &script_binding = E->value();
+ for (KeyValue<Object *, CSharpScriptBinding> &E : script_bindings) {
+ CSharpScriptBinding &script_binding = E.value;
script_binding.gchandle.release();
script_binding.inited = false;
}
@@ -1728,12 +1723,12 @@ bool CSharpInstance::get(const StringName &p_name, Variant &r_ret) const {
}
void CSharpInstance::get_properties_state_for_reloading(List<Pair<StringName, Variant>> &r_state) {
- List<PropertyInfo> pinfo;
- get_property_list(&pinfo);
+ List<PropertyInfo> property_list;
+ get_property_list(&property_list);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &prop_info : property_list) {
Pair<StringName, Variant> state_pair;
- state_pair.first = E.name;
+ state_pair.first = prop_info.name;
ManagedType managedType;
@@ -1756,8 +1751,8 @@ void CSharpInstance::get_event_signals_state_for_reloading(List<Pair<StringName,
MonoObject *owner_managed = get_mono_object();
ERR_FAIL_NULL(owner_managed);
- for (const Map<StringName, CSharpScript::EventSignal>::Element *E = script->event_signals.front(); E; E = E->next()) {
- const CSharpScript::EventSignal &event_signal = E->value();
+ for (const KeyValue<StringName, CSharpScript::EventSignal> &E : script->event_signals) {
+ const CSharpScript::EventSignal &event_signal = E.value;
MonoDelegate *delegate_field_value = (MonoDelegate *)event_signal.field->get_value(owner_managed);
if (!delegate_field_value) {
@@ -1784,8 +1779,8 @@ void CSharpInstance::get_event_signals_state_for_reloading(List<Pair<StringName,
}
void CSharpInstance::get_property_list(List<PropertyInfo> *p_properties) const {
- for (Map<StringName, PropertyInfo>::Element *E = script->member_info.front(); E; E = E->next()) {
- p_properties->push_back(E->value());
+ for (const KeyValue<StringName, PropertyInfo> &E : script->member_info) {
+ p_properties->push_back(E.value);
}
// Call _get_property_list
@@ -2024,8 +2019,8 @@ void CSharpInstance::mono_object_disposed_baseref(MonoObject *p_obj, bool p_is_f
}
void CSharpInstance::connect_event_signals() {
- for (const Map<StringName, CSharpScript::EventSignal>::Element *E = script->event_signals.front(); E; E = E->next()) {
- const CSharpScript::EventSignal &event_signal = E->value();
+ for (const KeyValue<StringName, CSharpScript::EventSignal> &E : script->event_signals) {
+ const CSharpScript::EventSignal &event_signal = E.value;
StringName signal_name = event_signal.field->get_name();
@@ -2309,12 +2304,12 @@ void CSharpScript::_update_exports_values(Map<StringName, Variant> &values, List
base_cache->_update_exports_values(values, propnames);
}
- for (Map<StringName, Variant>::Element *E = exported_members_defval_cache.front(); E; E = E->next()) {
- values[E->key()] = E->get();
+ for (const KeyValue<StringName, Variant> &E : exported_members_defval_cache) {
+ values[E.key] = E.value;
}
- for (PropertyInfo &E : exported_members_cache) {
- propnames.push_back(E);
+ for (const PropertyInfo &prop_info : exported_members_cache) {
+ propnames.push_back(prop_info);
}
}
@@ -2545,8 +2540,8 @@ bool CSharpScript::_update_exports(PlaceHolderScriptInstance *p_instance_to_upda
_update_exports_values(values, propnames);
if (changed) {
- for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
- E->get()->update(propnames, values);
+ for (PlaceHolderScriptInstance *&script_instance : placeholders) {
+ script_instance->update(propnames, values);
}
} else {
p_instance_to_update->update(propnames, values);
@@ -3378,11 +3373,11 @@ bool CSharpScript::has_script_signal(const StringName &p_signal) const {
}
void CSharpScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
- for (const Map<StringName, Vector<SignalParameter>>::Element *E = _signals.front(); E; E = E->next()) {
+ for (const KeyValue<StringName, Vector<SignalParameter>> &E : _signals) {
MethodInfo mi;
- mi.name = E->key();
+ mi.name = E.key;
- const Vector<SignalParameter> &params = E->value();
+ const Vector<SignalParameter> &params = E.value;
for (int i = 0; i < params.size(); i++) {
const SignalParameter &param = params[i];
@@ -3397,11 +3392,11 @@ void CSharpScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
r_signals->push_back(mi);
}
- for (const Map<StringName, EventSignal>::Element *E = event_signals.front(); E; E = E->next()) {
+ for (const KeyValue<StringName, EventSignal> &E : event_signals) {
MethodInfo mi;
- mi.name = E->key();
+ mi.name = E.key;
- const EventSignal &event_signal = E->value();
+ const EventSignal &event_signal = E.value;
const Vector<SignalParameter> &params = event_signal.parameters;
for (int i = 0; i < params.size(); i++) {
const SignalParameter &param = params[i];
@@ -3441,8 +3436,8 @@ Ref<Script> CSharpScript::get_base_script() const {
}
void CSharpScript::get_script_property_list(List<PropertyInfo> *p_list) const {
- for (Map<StringName, PropertyInfo>::Element *E = member_info.front(); E; E = E->next()) {
- p_list->push_back(E->value());
+ for (const KeyValue<StringName, PropertyInfo> &E : member_info) {
+ p_list->push_back(E.value);
}
}
@@ -3525,8 +3520,8 @@ CSharpScript::~CSharpScript() {
void CSharpScript::get_members(Set<StringName> *p_members) {
#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
if (p_members) {
- for (Set<StringName>::Element *E = exported_members_names.front(); E; E = E->next()) {
- p_members->insert(E->get());
+ for (const StringName &member_name : exported_members_names) {
+ p_members->insert(member_name);
}
}
#endif
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
index 270be8b6bf..0b5aa72a81 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
@@ -76,9 +76,9 @@ namespace GodotTools.Export
GlobalDef("mono/export/aot/use_interpreter", true);
// --aot or --aot=opt1,opt2 (use 'mono --aot=help AuxAssembly.dll' to list AOT options)
- GlobalDef("mono/export/aot/extra_aot_options", new string[] { });
+ GlobalDef("mono/export/aot/extra_aot_options", Array.Empty<string>());
// --optimize/-O=opt1,opt2 (use 'mono --list-opt'' to list optimize options)
- GlobalDef("mono/export/aot/extra_optimizer_options", new string[] { });
+ GlobalDef("mono/export/aot/extra_optimizer_options", Array.Empty<string>());
GlobalDef("mono/export/aot/android_toolchain_path", "");
}
@@ -188,7 +188,7 @@ namespace GodotTools.Export
// However, at least in the case of 'WebAssembly.Net.Http' for some reason the BCL assemblies
// reference a different version even though the assembly is the same, for some weird reason.
- var wasmFrameworkAssemblies = new[] {"WebAssembly.Bindings", "WebAssembly.Net.WebSockets"};
+ var wasmFrameworkAssemblies = new[] { "WebAssembly.Bindings", "WebAssembly.Net.WebSockets" };
foreach (string thisWasmFrameworkAssemblyName in wasmFrameworkAssemblies)
{
@@ -298,8 +298,8 @@ namespace GodotTools.Export
LLVMOutputPath = "",
FullAot = platform == OS.Platforms.iOS || (bool)(ProjectSettings.GetSetting("mono/export/aot/full_aot") ?? false),
UseInterpreter = (bool)ProjectSettings.GetSetting("mono/export/aot/use_interpreter"),
- ExtraAotOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_aot_options") ?? new string[] { },
- ExtraOptimizerOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options") ?? new string[] { },
+ ExtraAotOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_aot_options") ?? Array.Empty<string>(),
+ ExtraOptimizerOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options") ?? Array.Empty<string>(),
ToolchainPath = aotToolchainPath
};
@@ -381,7 +381,7 @@ namespace GodotTools.Export
private static bool PlatformHasTemplateDir(string platform)
{
// OSX export templates are contained in a zip, so we place our custom template inside it and let Godot do the rest.
- return !new[] {OS.Platforms.MacOS, OS.Platforms.Android, OS.Platforms.iOS, OS.Platforms.HTML5}.Contains(platform);
+ return !new[] { OS.Platforms.MacOS, OS.Platforms.Android, OS.Platforms.iOS, OS.Platforms.HTML5 }.Contains(platform);
}
private static bool DeterminePlatformFromFeatures(IEnumerable<string> features, out string platform)
@@ -430,7 +430,7 @@ namespace GodotTools.Export
/// </summary>
private static bool PlatformRequiresCustomBcl(string platform)
{
- if (new[] {OS.Platforms.Android, OS.Platforms.iOS, OS.Platforms.HTML5}.Contains(platform))
+ if (new[] { OS.Platforms.Android, OS.Platforms.iOS, OS.Platforms.HTML5 }.Contains(platform))
return true;
// The 'net_4_x' BCL is not compatible between Windows and the other platforms.
diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs
index 94fc5da425..821532f759 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs
@@ -47,7 +47,7 @@ namespace GodotTools.Ides.Rider
GD.PushWarning(e.Message);
}
- return new RiderInfo[0];
+ return Array.Empty<RiderInfo>();
}
private static RiderInfo[] CollectAllRiderPathsLinux()
@@ -249,7 +249,7 @@ namespace GodotTools.Ides.Rider
bool isMac)
{
if (!Directory.Exists(toolboxRiderRootPath))
- return new string[0];
+ return Array.Empty<string>();
var channelDirs = Directory.GetDirectories(toolboxRiderRootPath);
var paths = channelDirs.SelectMany(channelDir =>
@@ -295,7 +295,7 @@ namespace GodotTools.Ides.Rider
Logger.Warn($"Failed to get RiderPath from {channelDir}", e);
}
- return new string[0];
+ return Array.Empty<string>();
})
.Where(c => !string.IsNullOrEmpty(c))
.ToArray();
@@ -306,7 +306,7 @@ namespace GodotTools.Ides.Rider
{
var folder = new DirectoryInfo(Path.Combine(buildDir, dirName));
if (!folder.Exists)
- return new string[0];
+ return Array.Empty<string>();
if (!isMac)
return new[] { Path.Combine(folder.FullName, searchPattern) }.Where(File.Exists).ToArray();
diff --git a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs
index e745966435..4624439665 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs
@@ -74,10 +74,10 @@ namespace GodotTools.Utils
}
private static readonly IEnumerable<string> LinuxBSDPlatforms =
- new[] {Names.Linux, Names.FreeBSD, Names.NetBSD, Names.BSD};
+ new[] { Names.Linux, Names.FreeBSD, Names.NetBSD, Names.BSD };
private static readonly IEnumerable<string> UnixLikePlatforms =
- new[] {Names.MacOS, Names.Server, Names.Haiku, Names.Android, Names.iOS}
+ new[] { Names.MacOS, Names.Server, Names.Haiku, Names.Android, Names.iOS }
.Concat(LinuxBSDPlatforms).ToArray();
private static readonly Lazy<bool> _isWindows = new Lazy<bool>(() => IsOS(Names.Windows));
@@ -111,13 +111,22 @@ namespace GodotTools.Utils
private static string PathWhichWindows([NotNull] string name)
{
- string[] windowsExts = Environment.GetEnvironmentVariable("PATHEXT")?.Split(PathSep) ?? new string[] { };
+ string[] windowsExts = Environment.GetEnvironmentVariable("PATHEXT")?.Split(PathSep) ?? Array.Empty<string>();
string[] pathDirs = Environment.GetEnvironmentVariable("PATH")?.Split(PathSep);
+ char[] invalidPathChars = Path.GetInvalidPathChars();
var searchDirs = new List<string>();
if (pathDirs != null)
- searchDirs.AddRange(pathDirs);
+ {
+ foreach (var pathDir in pathDirs)
+ {
+ if (pathDir.IndexOfAny(invalidPathChars) != -1)
+ continue;
+
+ searchDirs.Add(pathDir);
+ }
+ }
string nameExt = Path.GetExtension(name);
bool hasPathExt = !string.IsNullOrEmpty(nameExt) && windowsExts.Contains(nameExt, StringComparer.OrdinalIgnoreCase);
@@ -128,20 +137,29 @@ namespace GodotTools.Utils
return searchDirs.Select(dir => Path.Combine(dir, name)).FirstOrDefault(File.Exists);
return (from dir in searchDirs
- select Path.Combine(dir, name)
+ select Path.Combine(dir, name)
into path
- from ext in windowsExts
- select path + ext).FirstOrDefault(File.Exists);
+ from ext in windowsExts
+ select path + ext).FirstOrDefault(File.Exists);
}
private static string PathWhichUnix([NotNull] string name)
{
string[] pathDirs = Environment.GetEnvironmentVariable("PATH")?.Split(PathSep);
+ char[] invalidPathChars = Path.GetInvalidPathChars();
var searchDirs = new List<string>();
if (pathDirs != null)
- searchDirs.AddRange(pathDirs);
+ {
+ foreach (var pathDir in pathDirs)
+ {
+ if (pathDir.IndexOfAny(invalidPathChars) != -1)
+ continue;
+
+ searchDirs.Add(pathDir);
+ }
+ }
searchDirs.Add(System.IO.Directory.GetCurrentDirectory()); // last in the list
@@ -196,7 +214,7 @@ namespace GodotTools.Utils
startInfo.UseShellExecute = false;
- using (var process = new Process {StartInfo = startInfo})
+ using (var process = new Process { StartInfo = startInfo })
{
process.Start();
process.WaitForExit();
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 6ae7c88213..632f7d61cc 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -416,8 +416,8 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
// Try to find as global enum constant
const EnumInterface *target_ienum = nullptr;
- for (const EnumInterface &E : global_enums) {
- target_ienum = &E;
+ for (const EnumInterface &ienum : global_enums) {
+ target_ienum = &ienum;
target_iconst = find_constant_by_name(target_name, target_ienum->constants);
if (target_iconst) {
break;
@@ -455,8 +455,8 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
// Try to find as enum constant in the current class
const EnumInterface *target_ienum = nullptr;
- for (const EnumInterface &E : target_itype->enums) {
- target_ienum = &E;
+ for (const EnumInterface &ienum : target_itype->enums) {
+ target_ienum = &ienum;
target_iconst = find_constant_by_name(target_name, target_ienum->constants);
if (target_iconst) {
break;
@@ -655,9 +655,7 @@ int BindingsGenerator::_determine_enum_prefix(const EnumInterface &p_ienum) {
return 0;
}
- for (const List<ConstantInterface>::Element *E = p_ienum.constants.front()->next(); E; E = E->next()) {
- const ConstantInterface &iconstant = E->get();
-
+ for (const ConstantInterface &iconstant : p_ienum.constants) {
Vector<String> parts = iconstant.name.split("_", /* p_allow_empty: */ true);
int i;
@@ -682,12 +680,10 @@ int BindingsGenerator::_determine_enum_prefix(const EnumInterface &p_ienum) {
void BindingsGenerator::_apply_prefix_to_enum_constants(BindingsGenerator::EnumInterface &p_ienum, int p_prefix_length) {
if (p_prefix_length > 0) {
- for (ConstantInterface &E : p_ienum.constants) {
+ for (ConstantInterface &iconstant : p_ienum.constants) {
int curr_prefix_length = p_prefix_length;
- ConstantInterface &curr_const = E;
-
- String constant_name = curr_const.name;
+ String constant_name = iconstant.name;
Vector<String> parts = constant_name.split("_", /* p_allow_empty: */ true);
@@ -713,7 +709,7 @@ void BindingsGenerator::_apply_prefix_to_enum_constants(BindingsGenerator::EnumI
constant_name += parts[i];
}
- curr_const.proxy_name = snake_to_pascal_case(constant_name, true);
+ iconstant.proxy_name = snake_to_pascal_case(constant_name, true);
}
}
}
@@ -733,8 +729,8 @@ void BindingsGenerator::_generate_method_icalls(const TypeInterface &p_itype) {
// Get arguments information
int i = 0;
- for (const ArgumentInterface &F : imethod.arguments) {
- const TypeInterface *arg_type = _get_type_or_placeholder(F.type);
+ for (const ArgumentInterface &iarg : imethod.arguments) {
+ const TypeInterface *arg_type = _get_type_or_placeholder(iarg.type);
im_sig += ", ";
im_sig += arg_type->im_type_in;
@@ -774,10 +770,10 @@ void BindingsGenerator::_generate_method_icalls(const TypeInterface &p_itype) {
if (p_itype.api_type != ClassDB::API_EDITOR) {
match->get().editor_only = false;
}
- method_icalls_map.insert(&E, &match->get());
+ method_icalls_map.insert(&imethod, &match->get());
} else {
List<InternalCall>::Element *added = method_icalls.push_back(im_icall);
- method_icalls_map.insert(&E, &added->get());
+ method_icalls_map.insert(&imethod, &added->get());
}
}
}
@@ -890,7 +886,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
// Enums
- for (EnumInterface &ienum : global_enums) {
+ for (const EnumInterface &ienum : global_enums) {
CRASH_COND(ienum.constants.is_empty());
String enum_proxy_name = ienum.cname.operator String();
@@ -915,9 +911,8 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
p_output.append(enum_proxy_name);
p_output.append("\n" INDENT1 OPEN_BLOCK);
- for (const ConstantInterface &F : ienum.constants) {
- const ConstantInterface &iconstant = F;
-
+ const ConstantInterface &last = ienum.constants.back()->get();
+ for (const ConstantInterface &iconstant : ienum.constants) {
if (iconstant.const_doc && iconstant.const_doc->description.size()) {
String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), nullptr);
Vector<String> summary_lines = xml_summary.length() ? xml_summary.split("\n") : Vector<String>();
@@ -939,7 +934,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
p_output.append(iconstant.proxy_name);
p_output.append(" = ");
p_output.append(itos(iconstant.value));
- p_output.append(F != ienum.constants.back() ? ",\n" : "\n");
+ p_output.append(&iconstant != &last ? ",\n" : "\n");
}
p_output.append(INDENT1 CLOSE_BLOCK);
@@ -1047,11 +1042,11 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
cs_icalls_content.append(m_icall.im_sig + ");\n"); \
}
- for (const InternalCall &E : core_custom_icalls) {
- ADD_INTERNAL_CALL(E);
+ for (const InternalCall &internal_call : core_custom_icalls) {
+ ADD_INTERNAL_CALL(internal_call);
}
- for (const InternalCall &E : method_icalls) {
- ADD_INTERNAL_CALL(E);
+ for (const InternalCall &internal_call : method_icalls) {
+ ADD_INTERNAL_CALL(internal_call);
}
#undef ADD_INTERNAL_CALL
@@ -1155,11 +1150,11 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
cs_icalls_content.append(m_icall.im_sig + ");\n"); \
}
- for (const InternalCall &E : editor_custom_icalls) {
- ADD_INTERNAL_CALL(E);
+ for (const InternalCall &internal_call : editor_custom_icalls) {
+ ADD_INTERNAL_CALL(internal_call);
}
- for (const InternalCall &E : method_icalls) {
- ADD_INTERNAL_CALL(E);
+ for (const InternalCall &internal_call : method_icalls) {
+ ADD_INTERNAL_CALL(internal_call);
}
#undef ADD_INTERNAL_CALL
@@ -1359,9 +1354,8 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.append(ienum.cname.operator String());
output.append(MEMBER_BEGIN OPEN_BLOCK);
- for (const ConstantInterface &F : ienum.constants) {
- const ConstantInterface &iconstant = F;
-
+ const ConstantInterface &last = ienum.constants.back()->get();
+ for (const ConstantInterface &iconstant : ienum.constants) {
if (iconstant.const_doc && iconstant.const_doc->description.size()) {
String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), &itype);
Vector<String> summary_lines = xml_summary.length() ? xml_summary.split("\n") : Vector<String>();
@@ -1383,7 +1377,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.append(iconstant.proxy_name);
output.append(" = ");
output.append(itos(iconstant.value));
- output.append(F != ienum.constants.back() ? ",\n" : "\n");
+ output.append(&iconstant != &last ? ",\n" : "\n");
}
output.append(INDENT2 CLOSE_BLOCK);
@@ -1665,8 +1659,8 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
StringBuilder default_args_doc;
// Retrieve information from the arguments
- for (const ArgumentInterface &F : p_imethod.arguments) {
- const ArgumentInterface &iarg = F;
+ const ArgumentInterface &first = p_imethod.arguments.front()->get();
+ for (const ArgumentInterface &iarg : p_imethod.arguments) {
const TypeInterface *arg_type = _get_type_or_placeholder(iarg.type);
ERR_FAIL_COND_V_MSG(arg_type->is_singleton, ERR_BUG,
@@ -1686,7 +1680,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
// Add the current arguments to the signature
// If the argument has a default value which is not a constant, we will make it Nullable
{
- if (F != p_imethod.arguments.front()) {
+ if (&iarg != &first) {
arguments_sig += ", ";
}
@@ -1741,7 +1735,12 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
cs_in_statements += " : ";
}
- String def_arg = sformat(iarg.default_argument, arg_type->cs_type);
+ String cs_type = arg_type->cs_type;
+ if (cs_type.ends_with("[]")) {
+ cs_type = cs_type.substr(0, cs_type.length() - 2);
+ }
+
+ String def_arg = sformat(iarg.default_argument, cs_type);
cs_in_statements += def_arg;
cs_in_statements += ";\n" INDENT3;
@@ -1750,8 +1749,10 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
// Apparently the name attribute must not include the @
String param_tag_name = iarg.name.begins_with("@") ? iarg.name.substr(1, iarg.name.length()) : iarg.name;
+ // Escape < and > in the attribute default value
+ String param_def_arg = def_arg.replacen("<", "&lt;").replacen(">", "&gt;");
- default_args_doc.append(MEMBER_BEGIN "/// <param name=\"" + param_tag_name + "\">If the parameter is null, then the default value is " + def_arg + "</param>");
+ default_args_doc.append(MEMBER_BEGIN "/// <param name=\"" + param_tag_name + "\">If the parameter is null, then the default value is " + param_def_arg + "</param>");
} else {
icall_params += arg_type->cs_in.is_empty() ? iarg.name : sformat(arg_type->cs_in, iarg.name);
}
@@ -1842,9 +1843,9 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
p_output.append(p_imethod.name);
p_output.append("\"");
- for (const ArgumentInterface &F : p_imethod.arguments) {
+ for (const ArgumentInterface &iarg : p_imethod.arguments) {
p_output.append(", ");
- p_output.append(F.name);
+ p_output.append(iarg.name);
}
p_output.append(");\n" CLOSE_BLOCK_L2);
@@ -1886,8 +1887,8 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
String arguments_sig;
// Retrieve information from the arguments
- for (const ArgumentInterface &F : p_isignal.arguments) {
- const ArgumentInterface &iarg = F;
+ const ArgumentInterface &first = p_isignal.arguments.front()->get();
+ for (const ArgumentInterface &iarg : p_isignal.arguments) {
const TypeInterface *arg_type = _get_type_or_placeholder(iarg.type);
ERR_FAIL_COND_V_MSG(arg_type->is_singleton, ERR_BUG,
@@ -1901,7 +1902,7 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
// Add the current arguments to the signature
- if (F != p_isignal.arguments.front()) {
+ if (&iarg != &first) {
arguments_sig += ", ";
}
@@ -2100,20 +2101,20 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
}
bool tools_sequence = false;
- for (const InternalCall &E : core_custom_icalls) {
+ for (const InternalCall &internal_call : core_custom_icalls) {
if (tools_sequence) {
- if (!E.editor_only) {
+ if (!internal_call.editor_only) {
tools_sequence = false;
output.append("#endif\n");
}
} else {
- if (E.editor_only) {
+ if (internal_call.editor_only) {
output.append("#ifdef TOOLS_ENABLED\n");
tools_sequence = true;
}
}
- ADD_INTERNAL_CALL_REGISTRATION(E);
+ ADD_INTERNAL_CALL_REGISTRATION(internal_call);
}
if (tools_sequence) {
@@ -2122,24 +2123,24 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
}
output.append("#ifdef TOOLS_ENABLED\n");
- for (const InternalCall &E : editor_custom_icalls)
- ADD_INTERNAL_CALL_REGISTRATION(E);
+ for (const InternalCall &internal_call : editor_custom_icalls)
+ ADD_INTERNAL_CALL_REGISTRATION(internal_call);
output.append("#endif // TOOLS_ENABLED\n");
- for (const InternalCall &E : method_icalls) {
+ for (const InternalCall &internal_call : method_icalls) {
if (tools_sequence) {
- if (!E.editor_only) {
+ if (!internal_call.editor_only) {
tools_sequence = false;
output.append("#endif\n");
}
} else {
- if (E.editor_only) {
+ if (internal_call.editor_only) {
output.append("#ifdef TOOLS_ENABLED\n");
tools_sequence = true;
}
}
- ADD_INTERNAL_CALL_REGISTRATION(E);
+ ADD_INTERNAL_CALL_REGISTRATION(internal_call);
}
if (tools_sequence) {
@@ -2195,8 +2196,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
// Get arguments information
int i = 0;
- for (const ArgumentInterface &F : p_imethod.arguments) {
- const ArgumentInterface &iarg = F;
+ for (const ArgumentInterface &iarg : p_imethod.arguments) {
const TypeInterface *arg_type = _get_type_or_placeholder(iarg.type);
String c_param_name = "arg" + itos(i + 1);
@@ -2668,9 +2668,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
ClassDB::get_method_list(type_cname, &method_list, true);
method_list.sort();
- for (MethodInfo &E : method_list) {
- const MethodInfo &method_info = E;
-
+ for (const MethodInfo &method_info : method_list) {
int argc = method_info.arguments.size();
if (method_info.name.is_empty()) {
@@ -2824,9 +2822,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
// Classes starting with an underscore are ignored unless they're used as a property setter or getter
if (!imethod.is_virtual && imethod.name[0] == '_') {
- for (const PropertyInterface &F : itype.properties) {
- const PropertyInterface &iprop = F;
-
+ for (const PropertyInterface &iprop : itype.properties) {
if (iprop.setter == imethod.name || iprop.getter == imethod.name) {
imethod.is_internal = true;
itype.methods.push_back(imethod);
@@ -2936,8 +2932,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
}
EnumInterface ienum(enum_proxy_cname);
const List<StringName> &enum_constants = enum_map.get(*k);
- for (const StringName &E : enum_constants) {
- const StringName &constant_cname = E;
+ for (const StringName &constant_cname : enum_constants) {
String constant_name = constant_cname.operator String();
int *value = class_info->constant_map.getptr(constant_cname);
ERR_FAIL_NULL_V(value, false);
@@ -2973,9 +2968,8 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
enum_types.insert(enum_itype.cname, enum_itype);
}
- for (const String &E : constants) {
- const String &constant_name = E;
- int *value = class_info->constant_map.getptr(StringName(E));
+ for (const String &constant_name : constants) {
+ int *value = class_info->constant_map.getptr(StringName(constant_name));
ERR_FAIL_NULL_V(value, false);
ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), *value);
@@ -3083,6 +3077,9 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
r_iarg.default_argument = "null";
break;
case Variant::ARRAY:
+ r_iarg.default_argument = "new %s { }";
+ r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF;
+ break;
case Variant::PACKED_BYTE_ARRAY:
case Variant::PACKED_INT32_ARRAY:
case Variant::PACKED_INT64_ARRAY:
@@ -3092,7 +3089,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
case Variant::PACKED_VECTOR2_ARRAY:
case Variant::PACKED_VECTOR3_ARRAY:
case Variant::PACKED_COLOR_ARRAY:
- r_iarg.default_argument = "new %s {}";
+ r_iarg.default_argument = "Array.Empty<%s>()";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF;
break;
case Variant::TRANSFORM2D: {
@@ -3553,13 +3550,13 @@ void BindingsGenerator::_populate_global_constants() {
hardcoded_enums.push_back("Vector2i.Axis");
hardcoded_enums.push_back("Vector3.Axis");
hardcoded_enums.push_back("Vector3i.Axis");
- for (StringName &E : hardcoded_enums) {
+ for (const StringName &enum_cname : hardcoded_enums) {
// These enums are not generated and must be written manually (e.g.: Vector3.Axis)
// Here, we assume core types do not begin with underscore
TypeInterface enum_itype;
enum_itype.is_enum = true;
- enum_itype.name = E.operator String();
- enum_itype.cname = E;
+ enum_itype.name = enum_cname.operator String();
+ enum_itype.cname = enum_cname;
enum_itype.proxy_name = enum_itype.name;
TypeInterface::postsetup_enum_type(enum_itype);
enum_types.insert(enum_itype.cname, enum_itype);
diff --git a/modules/mono/editor/code_completion.cpp b/modules/mono/editor/code_completion.cpp
index 308c15e7c9..b7b36a92d8 100644
--- a/modules/mono/editor/code_completion.cpp
+++ b/modules/mono/editor/code_completion.cpp
@@ -109,7 +109,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<PropertyInfo> project_props;
ProjectSettings::get_singleton()->get_property_list(&project_props);
- for (PropertyInfo &prop : project_props) {
+ for (const PropertyInfo &prop : project_props) {
if (!prop.name.begins_with("input/")) {
continue;
}
@@ -123,8 +123,8 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
// AutoLoads
Map<StringName, ProjectSettings::AutoloadInfo> autoloads = ProjectSettings::get_singleton()->get_autoload_list();
- for (Map<StringName, ProjectSettings::AutoloadInfo>::Element *E = autoloads.front(); E; E = E->next()) {
- const ProjectSettings::AutoloadInfo &info = E->value();
+ for (const KeyValue<StringName, ProjectSettings::AutoloadInfo> &E : autoloads) {
+ const ProjectSettings::AutoloadInfo &info = E.value;
suggestions.push_back(quoted("/root/" + String(info.name)));
}
}
@@ -185,7 +185,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
ClassDB::get_signal_list(native, &signals, /* p_no_inheritance: */ false);
}
- for (MethodInfo &E : signals) {
+ for (const MethodInfo &E : signals) {
const String &signal = E.name;
suggestions.push_back(quoted(signal));
}
@@ -197,7 +197,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<StringName> sn;
Theme::get_default()->get_color_list(base->get_class(), &sn);
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
suggestions.push_back(quoted(E));
}
}
@@ -209,7 +209,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<StringName> sn;
Theme::get_default()->get_constant_list(base->get_class(), &sn);
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
suggestions.push_back(quoted(E));
}
}
@@ -221,7 +221,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<StringName> sn;
Theme::get_default()->get_font_list(base->get_class(), &sn);
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
suggestions.push_back(quoted(E));
}
}
@@ -233,7 +233,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<StringName> sn;
Theme::get_default()->get_font_size_list(base->get_class(), &sn);
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
suggestions.push_back(quoted(E));
}
}
@@ -245,7 +245,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<StringName> sn;
Theme::get_default()->get_stylebox_list(base->get_class(), &sn);
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
suggestions.push_back(quoted(E));
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
index ce613f7ef9..f52a767018 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
@@ -25,16 +25,30 @@ namespace Godot.Collections
}
}
+ /// <summary>
+ /// Wrapper around Godot's Array class, an array of Variant
+ /// typed elements allocated in the engine in C++. Useful when
+ /// interfacing with the engine. Otherwise prefer .NET collections
+ /// such as <see cref="System.Array"/> or <see cref="List{T}"/>.
+ /// </summary>
public class Array : IList, IDisposable
{
ArraySafeHandle safeHandle;
bool disposed = false;
+ /// <summary>
+ /// Constructs a new empty <see cref="Array"/>.
+ /// </summary>
public Array()
{
safeHandle = new ArraySafeHandle(godot_icall_Array_Ctor());
}
+ /// <summary>
+ /// Constructs a new <see cref="Array"/> from the given collection's elements.
+ /// </summary>
+ /// <param name="collection">The collection of elements to construct from.</param>
+ /// <returns>A new Godot Array.</returns>
public Array(IEnumerable collection) : this()
{
if (collection == null)
@@ -44,6 +58,11 @@ namespace Godot.Collections
Add(element);
}
+ /// <summary>
+ /// Constructs a new <see cref="Array"/> from the given objects.
+ /// </summary>
+ /// <param name="array">The objects to put in the new array.</param>
+ /// <returns>A new Godot Array.</returns>
public Array(params object[] array) : this()
{
if (array == null)
@@ -71,21 +90,40 @@ namespace Godot.Collections
return safeHandle.DangerousGetHandle();
}
+ /// <summary>
+ /// Duplicates this <see cref="Array"/>.
+ /// </summary>
+ /// <param name="deep">If true, performs a deep copy.</param>
+ /// <returns>A new Godot Array.</returns>
public Array Duplicate(bool deep = false)
{
return new Array(godot_icall_Array_Duplicate(GetPtr(), deep));
}
+ /// <summary>
+ /// Resizes this <see cref="Array"/> to the given size.
+ /// </summary>
+ /// <param name="newSize">The new size of the array.</param>
+ /// <returns><see cref="Error.Ok"/> if successful, or an error code.</returns>
public Error Resize(int newSize)
{
return godot_icall_Array_Resize(GetPtr(), newSize);
}
+ /// <summary>
+ /// Shuffles the contents of this <see cref="Array"/> into a random order.
+ /// </summary>
public void Shuffle()
{
godot_icall_Array_Shuffle(GetPtr());
}
+ /// <summary>
+ /// Concatenates these two <see cref="Array"/>s.
+ /// </summary>
+ /// <param name="left">The first array.</param>
+ /// <param name="right">The second array.</param>
+ /// <returns>A new Godot Array with the contents of both arrays.</returns>
public static Array operator +(Array left, Array right)
{
return new Array(godot_icall_Array_Concatenate(left.GetPtr(), right.GetPtr()));
@@ -93,6 +131,9 @@ namespace Godot.Collections
// IDisposable
+ /// <summary>
+ /// Disposes of this <see cref="Array"/>.
+ /// </summary>
public void Dispose()
{
if (disposed)
@@ -109,38 +150,90 @@ namespace Godot.Collections
// IList
- public bool IsReadOnly => false;
+ bool IList.IsReadOnly => false;
- public bool IsFixedSize => false;
+ bool IList.IsFixedSize => false;
+ /// <summary>
+ /// Returns the object at the given index.
+ /// </summary>
+ /// <value>The object at the given index.</value>
public object this[int index]
{
get => godot_icall_Array_At(GetPtr(), index);
set => godot_icall_Array_SetAt(GetPtr(), index, value);
}
+ /// <summary>
+ /// Adds an object to the end of this <see cref="Array"/>.
+ /// This is the same as `append` or `push_back` in GDScript.
+ /// </summary>
+ /// <param name="value">The object to add.</param>
+ /// <returns>The new size after adding the object.</returns>
public int Add(object value) => godot_icall_Array_Add(GetPtr(), value);
+ /// <summary>
+ /// Checks if this <see cref="Array"/> contains the given object.
+ /// </summary>
+ /// <param name="value">The item to look for.</param>
+ /// <returns>Whether or not this array contains the given object.</returns>
public bool Contains(object value) => godot_icall_Array_Contains(GetPtr(), value);
+ /// <summary>
+ /// Erases all items from this <see cref="Array"/>.
+ /// </summary>
public void Clear() => godot_icall_Array_Clear(GetPtr());
+ /// <summary>
+ /// Searches this <see cref="Array"/> for an object
+ /// and returns its index or -1 if not found.
+ /// </summary>
+ /// <param name="value">The object to search for.</param>
+ /// <returns>The index of the object, or -1 if not found.</returns>
public int IndexOf(object value) => godot_icall_Array_IndexOf(GetPtr(), value);
+ /// <summary>
+ /// Inserts a new object at a given position in the array.
+ /// The position must be a valid position of an existing item,
+ /// or the position at the end of the array.
+ /// Existing items will be moved to the right.
+ /// </summary>
+ /// <param name="index">The index to insert at.</param>
+ /// <param name="value">The object to insert.</param>
public void Insert(int index, object value) => godot_icall_Array_Insert(GetPtr(), index, value);
+ /// <summary>
+ /// Removes the first occurrence of the specified value
+ /// from this <see cref="Array"/>.
+ /// </summary>
+ /// <param name="value">The value to remove.</param>
public void Remove(object value) => godot_icall_Array_Remove(GetPtr(), value);
+ /// <summary>
+ /// Removes an element from this <see cref="Array"/> by index.
+ /// </summary>
+ /// <param name="index">The index of the element to remove.</param>
public void RemoveAt(int index) => godot_icall_Array_RemoveAt(GetPtr(), index);
// ICollection
+ /// <summary>
+ /// Returns the number of elements in this <see cref="Array"/>.
+ /// This is also known as the size or length of the array.
+ /// </summary>
+ /// <returns>The number of elements.</returns>
public int Count => godot_icall_Array_Count(GetPtr());
- public object SyncRoot => this;
+ object ICollection.SyncRoot => this;
- public bool IsSynchronized => false;
+ bool ICollection.IsSynchronized => false;
+ /// <summary>
+ /// Copies the elements of this <see cref="Array"/> to the given
+ /// untyped C# array, starting at the given index.
+ /// </summary>
+ /// <param name="array">The array to copy to.</param>
+ /// <param name="index">The index to start at.</param>
public void CopyTo(System.Array array, int index)
{
if (array == null)
@@ -155,6 +248,10 @@ namespace Godot.Collections
// IEnumerable
+ /// <summary>
+ /// Gets an enumerator for this <see cref="Array"/>.
+ /// </summary>
+ /// <returns>An enumerator.</returns>
public IEnumerator GetEnumerator()
{
int count = Count;
@@ -165,6 +262,10 @@ namespace Godot.Collections
}
}
+ /// <summary>
+ /// Converts this <see cref="Array"/> to a string.
+ /// </summary>
+ /// <returns>A string representation of this array.</returns>
public override string ToString()
{
return godot_icall_Array_ToString(GetPtr());
@@ -234,6 +335,13 @@ namespace Godot.Collections
internal extern static string godot_icall_Array_ToString(IntPtr ptr);
}
+ /// <summary>
+ /// Typed wrapper around Godot's Array class, an array of Variant
+ /// typed elements allocated in the engine in C++. Useful when
+ /// interfacing with the engine. Otherwise prefer .NET collections
+ /// such as arrays or <see cref="List{T}"/>.
+ /// </summary>
+ /// <typeparam name="T">The type of the array.</typeparam>
public class Array<T> : IList<T>, ICollection<T>, IEnumerable<T>
{
Array objectArray;
@@ -246,11 +354,19 @@ namespace Godot.Collections
Array.godot_icall_Array_Generic_GetElementTypeInfo(typeof(T), out elemTypeEncoding, out elemTypeClass);
}
+ /// <summary>
+ /// Constructs a new empty <see cref="Array{T}"/>.
+ /// </summary>
public Array()
{
objectArray = new Array();
}
+ /// <summary>
+ /// Constructs a new <see cref="Array{T}"/> from the given collection's elements.
+ /// </summary>
+ /// <param name="collection">The collection of elements to construct from.</param>
+ /// <returns>A new Godot Array.</returns>
public Array(IEnumerable<T> collection)
{
if (collection == null)
@@ -259,6 +375,11 @@ namespace Godot.Collections
objectArray = new Array(collection);
}
+ /// <summary>
+ /// Constructs a new <see cref="Array{T}"/> from the given items.
+ /// </summary>
+ /// <param name="array">The items to put in the new array.</param>
+ /// <returns>A new Godot Array.</returns>
public Array(params T[] array) : this()
{
if (array == null)
@@ -268,6 +389,10 @@ namespace Godot.Collections
objectArray = new Array(array);
}
+ /// <summary>
+ /// Constructs a typed <see cref="Array{T}"/> from an untyped <see cref="Array"/>.
+ /// </summary>
+ /// <param name="array">The untyped array to construct from.</param>
public Array(Array array)
{
objectArray = array;
@@ -288,26 +413,49 @@ namespace Godot.Collections
return objectArray.GetPtr();
}
+ /// <summary>
+ /// Converts this typed <see cref="Array{T}"/> to an untyped <see cref="Array"/>.
+ /// </summary>
+ /// <param name="from">The typed array to convert.</param>
public static explicit operator Array(Array<T> from)
{
return from.objectArray;
}
+ /// <summary>
+ /// Duplicates this <see cref="Array{T}"/>.
+ /// </summary>
+ /// <param name="deep">If true, performs a deep copy.</param>
+ /// <returns>A new Godot Array.</returns>
public Array<T> Duplicate(bool deep = false)
{
return new Array<T>(objectArray.Duplicate(deep));
}
+ /// <summary>
+ /// Resizes this <see cref="Array{T}"/> to the given size.
+ /// </summary>
+ /// <param name="newSize">The new size of the array.</param>
+ /// <returns><see cref="Error.Ok"/> if successful, or an error code.</returns>
public Error Resize(int newSize)
{
return objectArray.Resize(newSize);
}
+ /// <summary>
+ /// Shuffles the contents of this <see cref="Array{T}"/> into a random order.
+ /// </summary>
public void Shuffle()
{
objectArray.Shuffle();
}
+ /// <summary>
+ /// Concatenates these two <see cref="Array{T}"/>s.
+ /// </summary>
+ /// <param name="left">The first array.</param>
+ /// <param name="right">The second array.</param>
+ /// <returns>A new Godot Array with the contents of both arrays.</returns>
public static Array<T> operator +(Array<T> left, Array<T> right)
{
return new Array<T>(left.objectArray + right.objectArray);
@@ -315,22 +463,44 @@ namespace Godot.Collections
// IList<T>
+ /// <summary>
+ /// Returns the value at the given index.
+ /// </summary>
+ /// <value>The value at the given index.</value>
public T this[int index]
{
get { return (T)Array.godot_icall_Array_At_Generic(GetPtr(), index, elemTypeEncoding, elemTypeClass); }
set { objectArray[index] = value; }
}
+ /// <summary>
+ /// Searches this <see cref="Array{T}"/> for an item
+ /// and returns its index or -1 if not found.
+ /// </summary>
+ /// <param name="item">The item to search for.</param>
+ /// <returns>The index of the item, or -1 if not found.</returns>
public int IndexOf(T item)
{
return objectArray.IndexOf(item);
}
+ /// <summary>
+ /// Inserts a new item at a given position in the <see cref="Array{T}"/>.
+ /// The position must be a valid position of an existing item,
+ /// or the position at the end of the array.
+ /// Existing items will be moved to the right.
+ /// </summary>
+ /// <param name="index">The index to insert at.</param>
+ /// <param name="item">The item to insert.</param>
public void Insert(int index, T item)
{
objectArray.Insert(index, item);
}
+ /// <summary>
+ /// Removes an element from this <see cref="Array{T}"/> by index.
+ /// </summary>
+ /// <param name="index">The index of the element to remove.</param>
public void RemoveAt(int index)
{
objectArray.RemoveAt(index);
@@ -338,31 +508,53 @@ namespace Godot.Collections
// ICollection<T>
+ /// <summary>
+ /// Returns the number of elements in this <see cref="Array{T}"/>.
+ /// This is also known as the size or length of the array.
+ /// </summary>
+ /// <returns>The number of elements.</returns>
public int Count
{
get { return objectArray.Count; }
}
- public bool IsReadOnly
- {
- get { return objectArray.IsReadOnly; }
- }
+ bool ICollection<T>.IsReadOnly => false;
+ /// <summary>
+ /// Adds an item to the end of this <see cref="Array{T}"/>.
+ /// This is the same as `append` or `push_back` in GDScript.
+ /// </summary>
+ /// <param name="item">The item to add.</param>
+ /// <returns>The new size after adding the item.</returns>
public void Add(T item)
{
objectArray.Add(item);
}
+ /// <summary>
+ /// Erases all items from this <see cref="Array{T}"/>.
+ /// </summary>
public void Clear()
{
objectArray.Clear();
}
+ /// <summary>
+ /// Checks if this <see cref="Array{T}"/> contains the given item.
+ /// </summary>
+ /// <param name="item">The item to look for.</param>
+ /// <returns>Whether or not this array contains the given item.</returns>
public bool Contains(T item)
{
return objectArray.Contains(item);
}
+ /// <summary>
+ /// Copies the elements of this <see cref="Array{T}"/> to the given
+ /// C# array, starting at the given index.
+ /// </summary>
+ /// <param name="array">The C# array to copy to.</param>
+ /// <param name="arrayIndex">The index to start at.</param>
public void CopyTo(T[] array, int arrayIndex)
{
if (array == null)
@@ -386,6 +578,12 @@ namespace Godot.Collections
}
}
+ /// <summary>
+ /// Removes the first occurrence of the specified value
+ /// from this <see cref="Array{T}"/>.
+ /// </summary>
+ /// <param name="item">The value to remove.</param>
+ /// <returns>A bool indicating success or failure.</returns>
public bool Remove(T item)
{
return Array.godot_icall_Array_Remove(GetPtr(), item);
@@ -393,6 +591,10 @@ namespace Godot.Collections
// IEnumerable<T>
+ /// <summary>
+ /// Gets an enumerator for this <see cref="Array{T}"/>.
+ /// </summary>
+ /// <returns>An enumerator.</returns>
public IEnumerator<T> GetEnumerator()
{
int count = objectArray.Count;
@@ -408,6 +610,10 @@ namespace Godot.Collections
return GetEnumerator();
}
+ /// <summary>
+ /// Converts this <see cref="Array{T}"/> to a string.
+ /// </summary>
+ /// <returns>A string representation of this array.</returns>
public override string ToString() => objectArray.ToString();
}
}
diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp
index 358e390784..a99dff8432 100644
--- a/modules/mono/glue/base_object_glue.cpp
+++ b/modules/mono/glue/base_object_glue.cpp
@@ -177,7 +177,7 @@ MonoArray *godot_icall_DynamicGodotObject_SetMemberList(Object *p_ptr) {
MonoArray *result = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(String), property_list.size());
int i = 0;
- for (PropertyInfo &E : property_list) {
+ for (const PropertyInfo &E : property_list) {
MonoString *boxed = GDMonoMarshal::mono_string_from_godot(E.name);
mono_array_setref(result, i, boxed);
i++;
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index d7c5850005..299344bb93 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -100,7 +100,7 @@ void gd_mono_setup_runtime_main_args() {
main_args.write[0] = execpath.ptrw();
int i = 1;
- for (String &E : cmdline_args) {
+ for (const String &E : cmdline_args) {
CharString &stored = cmdline_args_utf8.push_back(E.utf8())->get();
main_args.write[i] = stored.ptrw();
i++;
diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp
index 67d6f3ef29..67f38bf127 100644
--- a/modules/mono/mono_gd/gd_mono_assembly.cpp
+++ b/modules/mono/mono_gd/gd_mono_assembly.cpp
@@ -330,8 +330,8 @@ no_pdb:
void GDMonoAssembly::unload() {
ERR_FAIL_NULL(image); // Should not be called if already unloaded
- for (Map<MonoClass *, GDMonoClass *>::Element *E = cached_raw.front(); E; E = E->next()) {
- memdelete(E->value());
+ for (const KeyValue<MonoClass *, GDMonoClass *> &E : cached_raw) {
+ memdelete(E.value);
}
cached_classes.clear();
diff --git a/modules/mono/mono_gd/gd_mono_class.cpp b/modules/mono/mono_gd/gd_mono_class.cpp
index f9fddd931b..27b4ac7fa7 100644
--- a/modules/mono/mono_gd/gd_mono_class.cpp
+++ b/modules/mono/mono_gd/gd_mono_class.cpp
@@ -522,12 +522,12 @@ GDMonoClass::~GDMonoClass() {
mono_custom_attrs_free(attributes);
}
- for (Map<StringName, GDMonoField *>::Element *E = fields.front(); E; E = E->next()) {
- memdelete(E->value());
+ for (const KeyValue<StringName, GDMonoField *> &E : fields) {
+ memdelete(E.value);
}
- for (Map<StringName, GDMonoProperty *>::Element *E = properties.front(); E; E = E->next()) {
- memdelete(E->value());
+ for (const KeyValue<StringName, GDMonoProperty *> &E : properties) {
+ memdelete(E.value);
}
{
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 6493464759..fa4888f843 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -927,13 +927,13 @@ void TextServerAdvanced::font_set_oversampling(float p_oversampling) {
oversampling = p_oversampling;
List<RID> fonts;
font_owner.get_owned_list(&fonts);
- for (RID E : fonts) {
+ for (const RID &E : fonts) {
font_owner.getornull(E)->clear_cache();
}
List<RID> text_bufs;
shaped_owner.get_owned_list(&text_bufs);
- for (RID E : text_bufs) {
+ for (const RID &E : text_bufs) {
invalidate(shaped_owner.getornull(E));
}
}
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index cc90dfb4b8..004cbc2bb3 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -473,7 +473,7 @@ void TextServerFallback::font_set_oversampling(float p_oversampling) {
oversampling = p_oversampling;
List<RID> fonts;
font_owner.get_owned_list(&fonts);
- for (RID E : fonts) {
+ for (const RID &E : fonts) {
font_owner.getornull(E)->clear_cache();
}
}
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 5828529103..7a2404fd80 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -752,7 +752,7 @@ void VisualScript::_update_placeholders() {
List<StringName> keys;
variables.get_key_list(&keys);
- for (StringName &E : keys) {
+ for (const StringName &E : keys) {
if (!variables[E]._export) {
continue;
}
@@ -874,7 +874,7 @@ void VisualScript::get_script_method_list(List<MethodInfo> *p_list) const {
List<StringName> funcs;
functions.get_key_list(&funcs);
- for (StringName &E : funcs) {
+ for (const StringName &E : funcs) {
MethodInfo mi;
mi.name = E;
if (functions[E].func_id >= 0) {
@@ -928,7 +928,7 @@ void VisualScript::get_script_property_list(List<PropertyInfo> *p_list) const {
List<StringName> vars;
get_variable_list(&vars);
- for (StringName &E : vars) {
+ for (const StringName &E : vars) {
//if (!variables[E]._export)
// continue;
PropertyInfo pi = variables[E].info;
@@ -2467,7 +2467,7 @@ void VisualScriptLanguage::debug_get_stack_level_members(int p_level, List<Strin
List<StringName> vars;
vs->get_variable_list(&vars);
- for (StringName &E : vars) {
+ for (const StringName &E : vars) {
Variant v;
if (_call_stack[l].instance->get_variable(E, &v)) {
p_members->push_back("variables/" + E);
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 16313d58d0..fca7985b74 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -561,7 +561,7 @@ void VisualScriptEditor::_update_graph_connections() {
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(&sequence_conns);
- for (VisualScript::SequenceConnection &E : sequence_conns) {
+ for (const VisualScript::SequenceConnection &E : sequence_conns) {
graph->connect_node(itos(E.from_node), E.from_output, itos(E.to_node), 0);
}
@@ -1045,7 +1045,7 @@ void VisualScriptEditor::_update_members() {
List<StringName> func_names;
script->get_function_list(&func_names);
func_names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : func_names) {
+ for (const StringName &E : func_names) {
TreeItem *ti = members->create_item(functions);
ti->set_text(0, E);
ti->set_selectable(0, true);
@@ -1099,7 +1099,7 @@ void VisualScriptEditor::_update_members() {
List<StringName> var_names;
script->get_variable_list(&var_names);
- for (StringName &E : var_names) {
+ for (const StringName &E : var_names) {
TreeItem *ti = members->create_item(variables);
ti->set_text(0, E);
@@ -1123,7 +1123,7 @@ void VisualScriptEditor::_update_members() {
List<StringName> signal_names;
script->get_custom_signal_list(&signal_names);
- for (StringName &E : signal_names) {
+ for (const StringName &E : signal_names) {
TreeItem *ti = members->create_item(_signals);
ti->set_text(0, E);
ti->set_selectable(0, true);
@@ -1705,7 +1705,7 @@ void VisualScriptEditor::_on_nodes_delete() {
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(&sequence_conns);
- for (VisualScript::SequenceConnection &E : sequence_conns) {
+ for (const VisualScript::SequenceConnection &E : sequence_conns) {
if (E.from_node == cr_node || E.to_node == cr_node) {
undo_redo->add_undo_method(script.ptr(), "sequence_connect", E.from_node, E.from_output, E.to_node);
}
@@ -1714,7 +1714,7 @@ void VisualScriptEditor::_on_nodes_delete() {
List<VisualScript::DataConnection> data_conns;
script->get_data_connection_list(&data_conns);
- for (VisualScript::DataConnection &E : data_conns) {
+ for (const VisualScript::DataConnection &E : data_conns) {
if (E.from_node == F || E.to_node == F) {
undo_redo->add_undo_method(script.ptr(), "data_connect", E.from_node, E.from_port, E.to_node, E.to_port);
}
@@ -1765,7 +1765,7 @@ void VisualScriptEditor::_on_nodes_duplicate() {
List<VisualScript::SequenceConnection> seqs;
script->get_sequence_connection_list(&seqs);
- for (VisualScript::SequenceConnection &E : seqs) {
+ for (const VisualScript::SequenceConnection &E : seqs) {
if (to_duplicate.has(E.from_node) && to_duplicate.has(E.to_node)) {
undo_redo->add_do_method(script.ptr(), "sequence_connect", remap[E.from_node], E.from_output, remap[E.to_node]);
}
@@ -1773,7 +1773,7 @@ void VisualScriptEditor::_on_nodes_duplicate() {
List<VisualScript::DataConnection> data;
script->get_data_connection_list(&data);
- for (VisualScript::DataConnection &E : data) {
+ for (const VisualScript::DataConnection &E : data) {
if (to_duplicate.has(E.from_node) && to_duplicate.has(E.to_node)) {
undo_redo->add_do_method(script.ptr(), "data_connect", remap[E.from_node], E.from_port, remap[E.to_node], E.to_port);
}
@@ -2186,7 +2186,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
int new_id = script->get_available_id();
if (files.size()) {
- undo_redo->create_action(TTR("Add Preload Node"));
+ undo_redo->create_action(TTR("Add Node(s)"));
for (int i = 0; i < files.size(); i++) {
Ref<Resource> res = ResourceLoader::load(files[i]);
@@ -2552,7 +2552,7 @@ void VisualScriptEditor::goto_line(int p_line, bool p_with_error) {
List<StringName> functions;
script->get_function_list(&functions);
- for (StringName &E : functions) {
+ for (const StringName &E : functions) {
if (script->has_node(p_line)) {
_update_graph();
_update_members();
@@ -2773,7 +2773,7 @@ void VisualScriptEditor::_remove_node(int p_id) {
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(&sequence_conns);
- for (VisualScript::SequenceConnection &E : sequence_conns) {
+ for (const VisualScript::SequenceConnection &E : sequence_conns) {
if (E.from_node == p_id || E.to_node == p_id) {
undo_redo->add_undo_method(script.ptr(), "sequence_connect", E.from_node, E.from_output, E.to_node);
}
@@ -2782,7 +2782,7 @@ void VisualScriptEditor::_remove_node(int p_id) {
List<VisualScript::DataConnection> data_conns;
script->get_data_connection_list(&data_conns);
- for (VisualScript::DataConnection &E : data_conns) {
+ for (const VisualScript::DataConnection &E : data_conns) {
if (E.from_node == p_id || E.to_node == p_id) {
undo_redo->add_undo_method(script.ptr(), "data_connect", E.from_node, E.from_port, E.to_node, E.to_port);
}
@@ -2802,7 +2802,7 @@ bool VisualScriptEditor::node_has_sequence_connections(int p_id) {
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(&sequence_conns);
- for (VisualScript::SequenceConnection &E : sequence_conns) {
+ for (const VisualScript::SequenceConnection &E : sequence_conns) {
int from = E.from_node;
int to = E.to_node;
@@ -3460,7 +3460,7 @@ void VisualScriptEditor::_selected_new_virtual_method(const String &p_text, cons
List<MethodInfo> methods;
bool found = false;
ClassDB::get_virtual_methods(script->get_instance_base_type(), &methods);
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
if (E.name == name) {
minfo = E;
found = true;
@@ -3732,7 +3732,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
_update_graph();
- for (String &E : reselect) {
+ for (const String &E : reselect) {
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(E));
gn->set_selected(true);
}
@@ -3772,7 +3772,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
List<VisualScript::SequenceConnection> sequence_connections;
script->get_sequence_connection_list(&sequence_connections);
- for (VisualScript::SequenceConnection &E : sequence_connections) {
+ for (const VisualScript::SequenceConnection &E : sequence_connections) {
if (clipboard->nodes.has(E.from_node) && clipboard->nodes.has(E.to_node)) {
clipboard->sequence_connections.insert(E);
}
@@ -3781,7 +3781,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
List<VisualScript::DataConnection> data_connections;
script->get_data_connection_list(&data_connections);
- for (VisualScript::DataConnection &E : data_connections) {
+ for (const VisualScript::DataConnection &E : data_connections) {
if (clipboard->nodes.has(E.from_node) && clipboard->nodes.has(E.to_node)) {
clipboard->data_connections.insert(E);
}
@@ -3933,7 +3933,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
// Pick the node with input sequence.
Set<int> nodes_from;
Set<int> nodes_to;
- for (VisualScript::SequenceConnection &E : seqs) {
+ for (const VisualScript::SequenceConnection &E : seqs) {
if (nodes.has(E.from_node) && nodes.has(E.to_node)) {
seqmove.insert(E);
nodes_from.insert(E.from_node);
@@ -3976,7 +3976,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
{
List<VisualScript::DataConnection> dats;
script->get_data_connection_list(&dats);
- for (VisualScript::DataConnection &E : dats) {
+ for (const VisualScript::DataConnection &E : dats) {
if (nodes.has(E.from_node) && nodes.has(E.to_node)) {
datamove.insert(E);
} else if (!nodes.has(E.from_node) && nodes.has(E.to_node)) {
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index ddf6169015..62a4f465cb 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -852,7 +852,7 @@ void VisualScriptTypeCast::_bind_methods() {
}
String script_ext_hint;
- for (String &E : script_extensions) {
+ for (const String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index c694d6b8e0..6ba5ad4fd6 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -538,7 +538,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
Engine::get_singleton()->get_singletons(&names);
property.hint = PROPERTY_HINT_ENUM;
String sl;
- for (Engine::Singleton &E : names) {
+ for (const Engine::Singleton &E : names) {
if (sl != String()) {
sl += ",";
}
@@ -683,7 +683,7 @@ void VisualScriptFunctionCall::_bind_methods() {
}
String script_ext_hint;
- for (String &E : script_extensions) {
+ for (const String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
@@ -1004,7 +1004,7 @@ PropertyInfo VisualScriptPropertySet::get_input_value_port_info(int p_idx) const
List<PropertyInfo> props;
ClassDB::get_property_list(_get_base_type(), &props, false);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (E.name == property) {
String detail_prop_name = property;
if (index != StringName()) {
@@ -1135,7 +1135,7 @@ void VisualScriptPropertySet::_update_cache() {
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.name == property) {
type_cache = E;
}
@@ -1186,7 +1186,7 @@ void VisualScriptPropertySet::_update_cache() {
script->get_script_property_list(&pinfo);
}
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.name == property) {
type_cache = E;
return;
@@ -1354,7 +1354,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
options += "," + E.name;
}
@@ -1410,7 +1410,7 @@ void VisualScriptPropertySet::_bind_methods() {
}
String script_ext_hint;
- for (String &E : script_extensions) {
+ for (const String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
@@ -1820,7 +1820,7 @@ void VisualScriptPropertyGet::_update_cache() {
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.name == property) {
type_cache = E.type;
return;
@@ -2059,7 +2059,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
options += "," + E.name;
}
@@ -2112,7 +2112,7 @@ void VisualScriptPropertyGet::_bind_methods() {
}
String script_ext_hint;
- for (String &E : script_extensions) {
+ for (const String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
@@ -2323,7 +2323,7 @@ void VisualScriptEmitSignal::_validate_property(PropertyInfo &property) const {
}
String ml;
- for (StringName &E : sigs) {
+ for (const StringName &E : sigs) {
if (ml != String()) {
ml += ",";
}
@@ -2418,7 +2418,7 @@ void register_visual_script_func_nodes() {
List<MethodInfo> ml;
vt.get_method_list(&ml);
- for (MethodInfo &E : ml) {
+ for (const MethodInfo &E : ml) {
VisualScriptLanguage::singleton->add_register_func("functions/by_type/" + type_name + "/" + E.name, create_basic_type_call_node);
}
}
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index e6511792aa..c517d89aa5 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1306,7 +1306,7 @@ void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const {
vs->get_variable_list(&vars);
String vhint;
- for (StringName &E : vars) {
+ for (const StringName &E : vars) {
if (vhint != String()) {
vhint += ",";
}
@@ -1416,7 +1416,7 @@ void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const {
vs->get_variable_list(&vars);
String vhint;
- for (StringName &E : vars) {
+ for (const StringName &E : vars) {
if (vhint != String()) {
vhint += ",";
}
@@ -1944,7 +1944,7 @@ void VisualScriptClassConstant::set_base_type(const StringName &p_which) {
ClassDB::get_integer_constant_list(base_type, &constants, true);
if (constants.size() > 0) {
bool found_name = false;
- for (String &E : constants) {
+ for (const String &E : constants) {
if (E == name) {
found_name = true;
break;
@@ -1993,7 +1993,7 @@ void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const
ClassDB::get_integer_constant_list(base_type, &constants, true);
property.hint_string = "";
- for (String &E : constants) {
+ for (const String &E : constants) {
if (property.hint_string != String()) {
property.hint_string += ",";
}
@@ -2078,7 +2078,7 @@ void VisualScriptBasicTypeConstant::set_basic_type(Variant::Type p_which) {
Variant::get_constants_for_type(type, &constants);
if (constants.size() > 0) {
bool found_name = false;
- for (StringName &E : constants) {
+ for (const StringName &E : constants) {
if (E == name) {
found_name = true;
break;
@@ -2131,7 +2131,7 @@ void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) c
return;
}
property.hint_string = "";
- for (StringName &E : constants) {
+ for (const StringName &E : constants) {
if (property.hint_string != String()) {
property.hint_string += ",";
}
@@ -2358,7 +2358,7 @@ void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) con
Engine::get_singleton()->get_singletons(&singletons);
- for (Engine::Singleton &E : singletons) {
+ for (const Engine::Singleton &E : singletons) {
if (E.name == "VS" || E.name == "PS" || E.name == "PS2D" || E.name == "AS" || E.name == "TS" || E.name == "SS" || E.name == "SS2D") {
continue; //skip these, too simple named
}
@@ -3749,7 +3749,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo &property) const {
ProjectSettings::get_singleton()->get_property_list(&pinfo);
Vector<String> al;
- for (PropertyInfo &pi : pinfo) {
+ for (const PropertyInfo &pi : pinfo) {
if (!pi.name.begins_with("input/")) {
continue;
}
@@ -3842,7 +3842,7 @@ void VisualScriptDeconstruct::_update_elements() {
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
Element e;
e.name = E.name;
e.type = E.type;
@@ -4023,7 +4023,7 @@ void register_visual_script_nodes() {
List<MethodInfo> constructors;
Variant::get_constructor_list(Variant::Type(i), &constructors);
- for (MethodInfo &E : constructors) {
+ for (const MethodInfo &E : constructors) {
if (E.arguments.size() > 0) {
String name = "functions/constructors/" + Variant::get_type_name(Variant::Type(i)) + "(";
for (int j = 0; j < E.arguments.size(); j++) {
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index 5e9ecbe615..8bf1c6cbfa 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -93,7 +93,7 @@ void VisualScriptPropertySelector::_update_search() {
base = ClassDB::get_parent_class_nocheck(base);
}
- for (StringName &E : base_list) {
+ for (const StringName &E : base_list) {
List<MethodInfo> methods;
List<PropertyInfo> props;
TreeItem *category = nullptr;
@@ -157,7 +157,7 @@ void VisualScriptPropertySelector::_update_search() {
ClassDB::get_property_list(E, &props, true);
}
}
- for (PropertyInfo &F : props) {
+ for (const PropertyInfo &F : props) {
if (!(F.usage & PROPERTY_USAGE_EDITOR) && !(F.usage & PROPERTY_USAGE_SCRIPT_VARIABLE)) {
continue;
}
@@ -340,7 +340,7 @@ void VisualScriptPropertySelector::get_visual_node_names(const String &root_filt
List<String> fnodes;
VisualScriptLanguage::singleton->get_registered_node_names(&fnodes);
- for (String &E : fnodes) {
+ for (const String &E : fnodes) {
if (!E.begins_with(root_filter)) {
continue;
}
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index bf269b1d7a..9fa49b8a1d 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -438,7 +438,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const {
ClassDB::get_signal_list(_get_base_type(), &methods);
List<String> mstring;
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
if (E.name.begins_with("_")) {
continue;
}
@@ -448,7 +448,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const {
mstring.sort();
String ml;
- for (String &E : mstring) {
+ for (const String &E : mstring) {
if (ml != String()) {
ml += ",";
}
diff --git a/modules/webrtc/webrtc_multiplayer_peer.cpp b/modules/webrtc/webrtc_multiplayer_peer.cpp
index 77857255c1..9b08a26aed 100644
--- a/modules/webrtc/webrtc_multiplayer_peer.cpp
+++ b/modules/webrtc/webrtc_multiplayer_peer.cpp
@@ -154,7 +154,7 @@ void WebRTCMultiplayerPeer::_find_next_peer() {
}
// After last.
while (E) {
- for (Ref<WebRTCDataChannel> F : E->get()->channels) {
+ for (const Ref<WebRTCDataChannel> &F : E->get()->channels) {
if (F->get_available_packet_count()) {
next_packet_peer = E->key();
return;
@@ -165,7 +165,7 @@ void WebRTCMultiplayerPeer::_find_next_peer() {
E = peer_map.front();
// Before last
while (E) {
- for (Ref<WebRTCDataChannel> F : E->get()->channels) {
+ for (const Ref<WebRTCDataChannel> &F : E->get()->channels) {
if (F->get_available_packet_count()) {
next_packet_peer = E->key();
return;
@@ -213,7 +213,7 @@ int WebRTCMultiplayerPeer::get_unique_id() const {
void WebRTCMultiplayerPeer::_peer_to_dict(Ref<ConnectedPeer> p_connected_peer, Dictionary &r_dict) {
Array channels;
- for (Ref<WebRTCDataChannel> F : p_connected_peer->channels) {
+ for (Ref<WebRTCDataChannel> &F : p_connected_peer->channels) {
channels.push_back(F);
}
r_dict["connection"] = p_connected_peer->connection;
@@ -297,7 +297,7 @@ Error WebRTCMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_
_find_next_peer();
ERR_FAIL_V(ERR_UNAVAILABLE);
}
- for (Ref<WebRTCDataChannel> E : peer_map[next_packet_peer]->channels) {
+ for (Ref<WebRTCDataChannel> &E : peer_map[next_packet_peer]->channels) {
if (E->get_available_packet_count()) {
Error err = E->get_packet(r_buffer, r_buffer_size);
_find_next_peer();
@@ -357,7 +357,7 @@ int WebRTCMultiplayerPeer::get_available_packet_count() const {
}
int size = 0;
for (Map<int, Ref<ConnectedPeer>>::Element *E = peer_map.front(); E; E = E->next()) {
- for (Ref<WebRTCDataChannel> F : E->get()->channels) {
+ for (const Ref<WebRTCDataChannel> &F : E->get()->channels) {
size += F->get_available_packet_count();
}
}
diff --git a/modules/websocket/emws_client.cpp b/modules/websocket/emws_client.cpp
index 744053b6e2..d3d0066c12 100644
--- a/modules/websocket/emws_client.cpp
+++ b/modules/websocket/emws_client.cpp
@@ -79,7 +79,7 @@ Error EMWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
String str = "ws://";
if (p_custom_headers.size()) {
- WARN_PRINT_ONCE("Custom headers are not supported in in HTML5 platform.");
+ WARN_PRINT_ONCE("Custom headers are not supported in HTML5 platform.");
}
if (p_ssl) {
str = "wss://";
diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp
index 1df001f86e..c6eb3d44b4 100644
--- a/modules/websocket/wsl_server.cpp
+++ b/modules/websocket/wsl_server.cpp
@@ -196,7 +196,7 @@ void WSLServer::poll() {
remove_ids.clear();
List<Ref<PendingPeer>> remove_peers;
- for (Ref<PendingPeer> E : _pending) {
+ for (const Ref<PendingPeer> &E : _pending) {
String resource_name;
Ref<PendingPeer> ppeer = E;
Error err = ppeer->do_handshake(_protocols, handshake_timeout, resource_name);
@@ -224,7 +224,7 @@ void WSLServer::poll() {
remove_peers.push_back(ppeer);
_on_connect(id, ppeer->protocol, resource_name);
}
- for (Ref<PendingPeer> E : remove_peers) {
+ for (const Ref<PendingPeer> &E : remove_peers) {
_pending.erase(E);
}
remove_peers.clear();
diff --git a/modules/webxr/doc_classes/WebXRInterface.xml b/modules/webxr/doc_classes/WebXRInterface.xml
index 9b3a063ef5..67b2b866f3 100644
--- a/modules/webxr/doc_classes/WebXRInterface.xml
+++ b/modules/webxr/doc_classes/WebXRInterface.xml
@@ -88,7 +88,7 @@
- Using [XRController3D] nodes and their [signal XRController3D.button_pressed] and [signal XRController3D.button_released] signals. This is how controllers are typically handled in AR/VR apps in Godot, however, this will only work with advanced VR controllers like the Oculus Touch or Index controllers, for example. The buttons codes are defined by [url=https://immersive-web.github.io/webxr-gamepads-module/#xr-standard-gamepad-mapping]Section 3.3 of the WebXR Gamepads Module[/url].
- Using [method Node._unhandled_input] and [InputEventJoypadButton] or [InputEventJoypadMotion]. This works the same as normal joypads, except the [member InputEvent.device] starts at 100, so the left controller is 100 and the right controller is 101, and the button codes are also defined by [url=https://immersive-web.github.io/webxr-gamepads-module/#xr-standard-gamepad-mapping]Section 3.3 of the WebXR Gamepads Module[/url].
- Using the [signal select], [signal squeeze] and related signals. This method will work for both advanced VR controllers, and non-traditional "controllers" like a tap on the screen, a spoken voice command or a button press on the device itself. The [code]controller_id[/code] passed to these signals is the same id as used in [member XRController3D.controller_id].
- You can use one or all of these methods to allow your game or app to support a wider or narrower set of devices and input methods, or to allow more advanced interations with more advanced devices.
+ You can use one or all of these methods to allow your game or app to support a wider or narrower set of devices and input methods, or to allow more advanced interactions with more advanced devices.
</description>
<tutorials>
<link title="How to make a VR game for WebXR with Godot">https://www.snopekgames.com/blog/2020/how-make-vr-game-webxr-godot</link>
diff --git a/platform/android/java/lib/src/com/google/android/vending/licensing/Obfuscator.java b/platform/android/java/lib/src/com/google/android/vending/licensing/Obfuscator.java
index 008c150a8e..05b452d0c1 100644
--- a/platform/android/java/lib/src/com/google/android/vending/licensing/Obfuscator.java
+++ b/platform/android/java/lib/src/com/google/android/vending/licensing/Obfuscator.java
@@ -20,7 +20,7 @@ package com.google.android.vending.licensing;
* Interface used as part of a {@link Policy} to allow application authors to obfuscate
* licensing data that will be stored into a SharedPreferences file.
* <p>
- * Any transformation scheme must be reversable. Implementing classes may optionally implement an
+ * Any transformation scheme must be reversible. Implementing classes may optionally implement an
* integrity check to further prevent modification to preference data. Implementing classes
* should use device-specific information as a key in the obfuscation algorithm to prevent
* obfuscated preferences from being shared among devices.
diff --git a/platform/iphone/godot_view_gesture_recognizer.h b/platform/iphone/godot_view_gesture_recognizer.h
index 48b2d5ffad..61438ef22f 100644
--- a/platform/iphone/godot_view_gesture_recognizer.h
+++ b/platform/iphone/godot_view_gesture_recognizer.h
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-// GLViewGestureRecognizer allows iOS gestures to work currectly by
+// GLViewGestureRecognizer allows iOS gestures to work correctly by
// emulating UIScrollView's UIScrollViewDelayedTouchesBeganGestureRecognizer.
// It catches all gestures incoming to UIView and delays them for 150ms
// (the same value used by UIScrollViewDelayedTouchesBeganGestureRecognizer)
diff --git a/platform/javascript/js/libs/audio.worklet.js b/platform/javascript/js/libs/audio.worklet.js
index 6b3f80c6a9..866f845139 100644
--- a/platform/javascript/js/libs/audio.worklet.js
+++ b/platform/javascript/js/libs/audio.worklet.js
@@ -115,7 +115,7 @@ class GodotProcessor extends AudioWorkletProcessor {
this.input = new RingBuffer(p_data[1], avail_in);
this.output = new RingBuffer(p_data[2], avail_out);
} else if (p_cmd === 'stop') {
- this.runing = false;
+ this.running = false;
this.output = null;
this.input = null;
}
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 430f8cc4c4..4a32dd9646 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -2167,7 +2167,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
// still works in half the cases. (won't handle deadkeys)
// For more complex input methods (deadkeys and more advanced)
// you have to use XmbLookupString (??).
- // So.. then you have to chosse which of both results
+ // So then you have to choose which of both results
// you want to keep.
// This is a real bizarreness and cpu waster.
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp
index ba63a009fe..08630be8b0 100644
--- a/platform/linuxbsd/os_linuxbsd.cpp
+++ b/platform/linuxbsd/os_linuxbsd.cpp
@@ -451,7 +451,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) {
DirAccess *dir_access = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
Error err = dir_access->make_dir_recursive(trash_path);
- // Issue an error if trash can is not created proprely.
+ // Issue an error if trash can is not created properly.
ERR_FAIL_COND_V_MSG(err != OK, err, "Could not create the trash path \"" + trash_path + "\"");
err = dir_access->make_dir_recursive(trash_path + "/files");
ERR_FAIL_COND_V_MSG(err != OK, err, "Could not create the trash path \"" + trash_path + "\"/files");
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index ea34b8a24e..131c4b821e 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -178,6 +178,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/entitlements/calendars"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/entitlements/photos_library"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/entitlements/apple_events"), false));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/entitlements/debugging"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/entitlements/app_sandbox/enabled"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/entitlements/app_sandbox/network_server"), false));
@@ -845,6 +846,10 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
ent_f->store_line("<key>com.apple.security.automation.apple-events</key>");
ent_f->store_line("<true/>");
}
+ if ((bool)p_preset->get("codesign/entitlements/debugging")) {
+ ent_f->store_line("<key>com.apple.security.get-task-allow</key>");
+ ent_f->store_line("<true/>");
+ }
if ((bool)p_preset->get("codesign/entitlements/app_sandbox/enabled")) {
ent_f->store_line("<key>com.apple.security.app-sandbox</key>");
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp
index 126ebc1908..d778271350 100644
--- a/platform/osx/joypad_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -286,8 +286,9 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) {
}
if ((!refCF) || (!CFStringGetCString((CFStringRef)refCF, c_name, sizeof(c_name), kCFStringEncodingUTF8))) {
name = "Unidentified Joypad";
+ } else {
+ name = c_name;
}
- name = c_name;
int id = input->get_unused_joy_id();
ERR_FAIL_COND_V(id == -1, false);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index b8361c0b3e..c458a0264a 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -369,7 +369,7 @@ String OS_OSX::get_cache_path() const {
if (get_environment("XDG_CACHE_HOME").is_absolute_path()) {
return get_environment("XDG_CACHE_HOME");
} else {
- WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `$HOME/Libary/Caches` or `get_config_path()` per the XDG Base Directory specification.");
+ WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `$HOME/Library/Caches` or `get_config_path()` per the XDG Base Directory specification.");
}
}
if (has_environment("HOME")) {
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 7772ba2dbe..a94f38583c 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -171,7 +171,6 @@ def setup_mingw(env):
"""Set up env for use with mingw"""
# Nothing to do here
print("Using MinGW")
- pass
def configure_msvc(env, manual_msvc_config):
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 8709acf7f1..561207c24c 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -145,7 +145,7 @@ TypedArray<PhysicsBody2D> PhysicsBody2D::get_collision_exceptions() {
List<RID> exceptions;
PhysicsServer2D::get_singleton()->body_get_collision_exceptions(get_rid(), &exceptions);
Array ret;
- for (RID body : exceptions) {
+ for (const RID &body : exceptions) {
ObjectID instance_id = PhysicsServer2D::get_singleton()->body_get_object_instance_id(body);
Object *obj = ObjectDB::get_instance(instance_id);
PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(obj);
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 4a15a1dc46..e9efa1cf84 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -795,6 +795,7 @@ void TileMap::_set_tile_data(const Vector<int> &p_data) {
const int *r = p_data.ptr();
int offset = (format >= FORMAT_2) ? 3 : 2;
+ ERR_FAIL_COND_MSG(c % offset != 0, "Corrupted tile data.");
clear();
@@ -1596,7 +1597,7 @@ void TileMap::set_light_mask(int p_light_mask) {
// Occlusion: set light mask.
CanvasItem::set_light_mask(p_light_mask);
for (Map<Vector2i, TileMapQuadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
- for (RID F : E->get().canvas_items) {
+ for (const RID &F : E->get().canvas_items) {
RenderingServer::get_singleton()->canvas_item_set_light_mask(F, get_light_mask());
}
}
@@ -1609,7 +1610,7 @@ void TileMap::set_material(const Ref<Material> &p_material) {
// Update material for the whole tilemap.
for (Map<Vector2i, TileMapQuadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
TileMapQuadrant &q = E->get();
- for (RID F : q.canvas_items) {
+ for (const RID &F : q.canvas_items) {
RS::get_singleton()->canvas_item_set_use_parent_material(F, get_use_parent_material() || get_material().is_valid());
}
}
@@ -1622,7 +1623,7 @@ void TileMap::set_use_parent_material(bool p_use_parent_material) {
// Update use_parent_material for the whole tilemap.
for (Map<Vector2i, TileMapQuadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
TileMapQuadrant &q = E->get();
- for (RID F : q.canvas_items) {
+ for (const RID &F : q.canvas_items) {
RS::get_singleton()->canvas_item_set_use_parent_material(F, get_use_parent_material() || get_material().is_valid());
}
}
@@ -1633,7 +1634,7 @@ void TileMap::set_texture_filter(TextureFilter p_texture_filter) {
CanvasItem::set_texture_filter(p_texture_filter);
for (Map<Vector2i, TileMapQuadrant>::Element *F = quadrant_map.front(); F; F = F->next()) {
TileMapQuadrant &q = F->get();
- for (RID E : q.canvas_items) {
+ for (const RID &E : q.canvas_items) {
RenderingServer::get_singleton()->canvas_item_set_default_texture_filter(E, RS::CanvasItemTextureFilter(p_texture_filter));
_make_quadrant_dirty(F);
}
@@ -1645,7 +1646,7 @@ void TileMap::set_texture_repeat(CanvasItem::TextureRepeat p_texture_repeat) {
CanvasItem::set_texture_repeat(p_texture_repeat);
for (Map<Vector2i, TileMapQuadrant>::Element *F = quadrant_map.front(); F; F = F->next()) {
TileMapQuadrant &q = F->get();
- for (RID E : q.canvas_items) {
+ for (const RID &E : q.canvas_items) {
RenderingServer::get_singleton()->canvas_item_set_default_texture_repeat(E, RS::CanvasItemTextureRepeat(p_texture_repeat));
_make_quadrant_dirty(F);
}
diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp
index 97b562837a..cc1b620025 100644
--- a/scene/3d/gpu_particles_collision_3d.cpp
+++ b/scene/3d/gpu_particles_collision_3d.cpp
@@ -397,7 +397,7 @@ Ref<Image> GPUParticlesCollisionSDF::bake() {
bake_step_function(0, "Finding Meshes");
}
- for (PlotMesh &pm : plot_meshes) {
+ for (const PlotMesh &pm : plot_meshes) {
for (int i = 0; i < pm.mesh->get_surface_count(); i++) {
if (pm.mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) {
continue; //only triangles
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp
index 93cd088418..9ca1d55d0b 100644
--- a/scene/3d/mesh_instance_3d.cpp
+++ b/scene/3d/mesh_instance_3d.cpp
@@ -94,7 +94,7 @@ void MeshInstance3D::_get_property_list(List<PropertyInfo> *p_list) const {
ls.sort();
- for (String &E : ls) {
+ for (const String &E : ls) {
p_list->push_back(PropertyInfo(Variant::FLOAT, E, PROPERTY_HINT_RANGE, "-1,1,0.00001"));
}
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 6736a4ec40..93ecb2cd3a 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -78,7 +78,7 @@ TypedArray<PhysicsBody3D> PhysicsBody3D::get_collision_exceptions() {
List<RID> exceptions;
PhysicsServer3D::get_singleton()->body_get_collision_exceptions(get_rid(), &exceptions);
Array ret;
- for (RID body : exceptions) {
+ for (const RID &body : exceptions) {
ObjectID instance_id = PhysicsServer3D::get_singleton()->body_get_object_instance_id(body);
Object *obj = ObjectDB::get_instance(instance_id);
PhysicsBody3D *physics_body = Object::cast_to<PhysicsBody3D>(obj);
diff --git a/scene/3d/proximity_group_3d.cpp b/scene/3d/proximity_group_3d.cpp
index 037110eaa1..c8c61a9f00 100644
--- a/scene/3d/proximity_group_3d.cpp
+++ b/scene/3d/proximity_group_3d.cpp
@@ -128,6 +128,7 @@ void ProximityGroup3D::broadcast(String p_method, Variant p_parameters) {
void ProximityGroup3D::_proximity_group_broadcast(String p_method, Variant p_parameters) {
if (dispatch_mode == MODE_PROXY) {
+ ERR_FAIL_COND(!is_inside_tree());
get_parent()->call(p_method, p_parameters);
} else {
emit_signal(SNAME("broadcast"), p_method, p_parameters);
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index fb5e9639c7..9ce4c37457 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -264,7 +264,7 @@ void Skeleton3D::_notification(int p_what) {
b.global_pose_override_amount = 0.0;
}
- for (ObjectID &E : b.nodes_bound) {
+ for (const ObjectID &E : b.nodes_bound) {
Object *obj = ObjectDB::get_instance(E);
ERR_CONTINUE(!obj);
Node3D *node_3d = Object::cast_to<Node3D>(obj);
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp
index 0d00d10d32..a7ff0842d2 100644
--- a/scene/3d/soft_body_3d.cpp
+++ b/scene/3d/soft_body_3d.cpp
@@ -592,7 +592,7 @@ Array SoftBody3D::get_collision_exceptions() {
List<RID> exceptions;
PhysicsServer3D::get_singleton()->soft_body_get_collision_exceptions(physics_rid, &exceptions);
Array ret;
- for (RID body : exceptions) {
+ for (const RID &body : exceptions) {
ObjectID instance_id = PhysicsServer3D::get_singleton()->body_get_object_instance_id(body);
Object *obj = ObjectDB::get_instance(instance_id);
PhysicsBody3D *physics_body = Object::cast_to<PhysicsBody3D>(obj);
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 495f60d4c9..4bddae3b14 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -1089,7 +1089,7 @@ bool AnimationNodeBlendTree::_get(const StringName &p_name, Variant &r_ret) cons
conns.resize(nc.size() * 3);
int idx = 0;
- for (NodeConnection &E : nc) {
+ for (const NodeConnection &E : nc) {
conns[idx * 3 + 0] = E.input_node;
conns[idx * 3 + 1] = E.input_index;
conns[idx * 3 + 2] = E.output_node;
@@ -1110,7 +1110,7 @@ void AnimationNodeBlendTree::_get_property_list(List<PropertyInfo> *p_list) cons
}
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
String name = E;
if (name != "output") {
p_list->push_back(PropertyInfo(Variant::OBJECT, "nodes/" + name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationNode", PROPERTY_USAGE_NOEDITOR));
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 383d92d37f..bf53b554bf 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -512,7 +512,7 @@ void AnimationNodeStateMachine::get_parameter_list(List<PropertyInfo> *r_list) c
}
advance_conditions.sort_custom<StringName::AlphCompare>();
- for (StringName &E : advance_conditions) {
+ for (const StringName &E : advance_conditions) {
r_list->push_back(PropertyInfo(Variant::BOOL, E));
}
}
@@ -679,7 +679,7 @@ void AnimationNodeStateMachine::get_node_list(List<StringName> *r_nodes) const {
}
nodes.sort_custom<StringName::AlphCompare>();
- for (StringName &E : nodes) {
+ for (const StringName &E : nodes) {
r_nodes->push_back(E);
}
}
@@ -902,7 +902,7 @@ void AnimationNodeStateMachine::_get_property_list(List<PropertyInfo> *p_list) c
}
names.sort_custom<StringName::AlphCompare>();
- for (StringName &name : names) {
+ for (const StringName &name : names) {
p_list->push_back(PropertyInfo(Variant::OBJECT, "states/" + name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationNode", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::VECTOR2, "states/" + name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 0f557519b2..67b6205a65 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -176,7 +176,7 @@ void AnimationPlayer::_get_property_list(List<PropertyInfo> *p_list) const {
anim_names.sort();
- for (PropertyInfo &E : anim_names) {
+ for (const PropertyInfo &E : anim_names) {
p_list->push_back(E);
}
@@ -1076,7 +1076,7 @@ void AnimationPlayer::get_animation_list(List<StringName> *p_animations) const {
anims.sort();
- for (String &E : anims) {
+ for (const String &E : anims) {
p_animations->push_back(E);
}
}
@@ -1118,7 +1118,7 @@ void AnimationPlayer::queue(const StringName &p_name) {
Vector<String> AnimationPlayer::get_queue() {
Vector<String> ret;
- for (StringName &E : queued) {
+ for (const StringName &E : queued) {
ret.push_back(E);
}
@@ -1502,7 +1502,7 @@ void AnimationPlayer::get_argument_options(const StringName &p_function, int p_i
if (p_idx == 0 && (p_function == "play" || p_function == "play_backwards" || p_function == "remove_animation" || p_function == "has_animation" || p_function == "queue")) {
List<StringName> al;
get_animation_list(&al);
- for (StringName &E : al) {
+ for (const StringName &E : al) {
r_options->push_back(quote_style + String(E) + quote_style);
}
}
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index d277808e1f..00b847168d 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -76,7 +76,7 @@ void AnimationNode::get_child_nodes(List<ChildNode> *r_child_nodes) {
Dictionary cn = get_script_instance()->call("_get_child_nodes");
List<Variant> keys;
cn.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
ChildNode child;
child.name = E;
child.node = cn[E];
@@ -536,7 +536,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
List<StringName> sname;
player->get_animation_list(&sname);
- for (StringName &E : sname) {
+ for (const StringName &E : sname) {
Ref<Animation> anim = player->get_animation(E);
for (int i = 0; i < anim->get_track_count(); i++) {
NodePath path = anim->track_get_path(i);
@@ -816,7 +816,7 @@ void AnimationTree::_process_graph(float p_delta) {
{
bool can_call = is_inside_tree() && !Engine::get_singleton()->is_editor_hint();
- for (AnimationNode::AnimationState &as : state.animation_states) {
+ for (const AnimationNode::AnimationState &as : state.animation_states) {
Ref<Animation> a = as.animation;
float time = as.time;
float delta = as.delta;
@@ -1369,7 +1369,7 @@ void AnimationTree::_update_properties_for_node(const String &p_base_path, Ref<A
List<AnimationNode::ChildNode> children;
node->get_child_nodes(&children);
- for (AnimationNode::ChildNode &E : children) {
+ for (const AnimationNode::ChildNode &E : children) {
_update_properties_for_node(p_base_path + E.name + "/", E.node);
}
}
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index b31c3d57f9..a57e986877 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -46,8 +46,8 @@ void Tween::start_tweeners() {
ERR_FAIL_MSG("Tween without commands, aborting.");
}
- for (Ref<Tweener> E : tweeners.write[current_step]) {
- E->start();
+ for (Ref<Tweener> &tweener : tweeners.write[current_step]) {
+ tweener->start();
}
}
@@ -253,11 +253,11 @@ bool Tween::step(float p_delta) {
float step_delta = rem_delta;
step_active = false;
- for (Ref<Tweener> E : tweeners.write[current_step]) {
+ for (Ref<Tweener> &tweener : tweeners.write[current_step]) {
// Modified inside Tweener.step().
float temp_delta = rem_delta;
// Turns to true if any Tweener returns true (i.e. is still not finished).
- step_active = E->step(temp_delta) || step_active;
+ step_active = tweener->step(temp_delta) || step_active;
step_delta = MIN(temp_delta, rem_delta);
}
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp
index 5012aed99a..ce2b320c96 100644
--- a/scene/debugger/scene_debugger.cpp
+++ b/scene/debugger/scene_debugger.cpp
@@ -292,7 +292,7 @@ SceneDebuggerObject::SceneDebuggerObject(ObjectID p_id) {
// Add base object properties.
List<PropertyInfo> pinfo;
obj->get_property_list(&pinfo, true);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.usage & (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CATEGORY)) {
properties.push_back(SceneDebuggerProperty(E, obj->get(E.name)));
}
@@ -452,7 +452,7 @@ SceneDebuggerTree::SceneDebuggerTree(Node *p_root) {
}
void SceneDebuggerTree::serialize(Array &p_arr) {
- for (RemoteNode &n : nodes) {
+ for (const RemoteNode &n : nodes) {
p_arr.push_back(n.child_count);
p_arr.push_back(n.name);
p_arr.push_back(n.type_name);
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 6e3d0e2767..be5e0bf4e5 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -2128,7 +2128,7 @@ int CodeEdit::_is_in_delimiter(int p_line, int p_column, DelimiterType p_type) c
int region = (p_line <= 0 || delimiter_cache[p_line - 1].size() < 1) ? -1 : delimiter_cache[p_line - 1].back()->value();
bool in_region = region != -1 && delimiters[region].type == p_type;
for (Map<int, int>::Element *E = delimiter_cache[p_line].front(); E; E = E->next()) {
- /* If column is specified, loop untill the key is larger then the column. */
+ /* If column is specified, loop until the key is larger then the column. */
if (p_column != -1) {
if (E->key() > p_column) {
break;
@@ -2138,7 +2138,7 @@ int CodeEdit::_is_in_delimiter(int p_line, int p_column, DelimiterType p_type) c
continue;
}
- /* If no column, calulate if the entire line is a region */
+ /* If no column, calculate if the entire line is a region */
/* excluding whitespace. */
const String line = get_line(p_line);
if (!in_region) {
@@ -2288,7 +2288,7 @@ void CodeEdit::_filter_code_completion_candidates() {
TypedArray<Dictionary> completion_options_sources;
completion_options_sources.resize(code_completion_option_sources.size());
int i = 0;
- for (ScriptCodeCompletionOption &E : code_completion_option_sources) {
+ for (const ScriptCodeCompletionOption &E : code_completion_option_sources) {
Dictionary option;
option["kind"] = E.kind;
option["display_text"] = E.display;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index ae1f4b2f65..c19ee849d3 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -343,7 +343,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_icon_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.icon_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -355,7 +355,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_stylebox_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.style_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -367,7 +367,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_font_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.font_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -379,7 +379,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_font_size_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.font_size_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -391,7 +391,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_color_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.color_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -403,7 +403,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_constant_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.constant_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -428,7 +428,7 @@ void Control::_validate_property(PropertyInfo &property) const {
Vector<StringName> unique_names;
String hint_string;
- for (StringName &E : names) {
+ for (const StringName &E : names) {
// Skip duplicate values.
if (unique_names.has(E)) {
continue;
@@ -454,6 +454,8 @@ void Control::set_layout_direction(Control::LayoutDirection p_direction) {
ERR_FAIL_INDEX((int)p_direction, 4);
data.layout_dir = p_direction;
+ data.is_rtl_dirty = true;
+
propagate_notification(NOTIFICATION_LAYOUT_DIRECTION_CHANGED);
}
@@ -462,29 +464,35 @@ Control::LayoutDirection Control::get_layout_direction() const {
}
bool Control::is_layout_rtl() const {
- if (data.layout_dir == LAYOUT_DIRECTION_INHERITED) {
- Window *parent_window = get_parent_window();
- Control *parent_control = get_parent_control();
- if (parent_control) {
- return parent_control->is_layout_rtl();
- } else if (parent_window) {
- return parent_window->is_layout_rtl();
- } else {
+ if (data.is_rtl_dirty) {
+ const_cast<Control *>(this)->data.is_rtl_dirty = false;
+ if (data.layout_dir == LAYOUT_DIRECTION_INHERITED) {
+ Window *parent_window = get_parent_window();
+ Control *parent_control = get_parent_control();
+ if (parent_control) {
+ const_cast<Control *>(this)->data.is_rtl = parent_control->is_layout_rtl();
+ } else if (parent_window) {
+ const_cast<Control *>(this)->data.is_rtl = parent_window->is_layout_rtl();
+ } else {
+ if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
+ const_cast<Control *>(this)->data.is_rtl = true;
+ } else {
+ String locale = TranslationServer::get_singleton()->get_tool_locale();
+ const_cast<Control *>(this)->data.is_rtl = TS->is_locale_right_to_left(locale);
+ }
+ }
+ } else if (data.layout_dir == LAYOUT_DIRECTION_LOCALE) {
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
- return true;
+ const_cast<Control *>(this)->data.is_rtl = true;
+ } else {
+ String locale = TranslationServer::get_singleton()->get_tool_locale();
+ const_cast<Control *>(this)->data.is_rtl = TS->is_locale_right_to_left(locale);
}
- String locale = TranslationServer::get_singleton()->get_tool_locale();
- return TS->is_locale_right_to_left(locale);
- }
- } else if (data.layout_dir == LAYOUT_DIRECTION_LOCALE) {
- if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
- return true;
+ } else {
+ const_cast<Control *>(this)->data.is_rtl = (data.layout_dir == LAYOUT_DIRECTION_RTL);
}
- String locale = TranslationServer::get_singleton()->get_tool_locale();
- return TS->is_locale_right_to_left(locale);
- } else {
- return (data.layout_dir == LAYOUT_DIRECTION_RTL);
}
+ return data.is_rtl;
}
void Control::_clear_size_warning() {
@@ -534,6 +542,7 @@ void Control::_notification(int p_notification) {
} break;
case NOTIFICATION_POST_ENTER_TREE: {
data.minimum_size_valid = false;
+ data.is_rtl_dirty = true;
_size_changed();
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -548,6 +557,7 @@ void Control::_notification(int p_notification) {
case NOTIFICATION_ENTER_CANVAS: {
data.parent = Object::cast_to<Control>(get_parent());
data.parent_window = Object::cast_to<Window>(get_parent());
+ data.is_rtl_dirty = true;
Node *parent = this; //meh
Control *parent_control = nullptr;
@@ -613,6 +623,7 @@ void Control::_notification(int p_notification) {
data.parent = nullptr;
data.parent_canvas_item = nullptr;
data.parent_window = nullptr;
+ data.is_rtl_dirty = true;
} break;
case NOTIFICATION_MOVED_IN_PARENT: {
@@ -672,6 +683,7 @@ void Control::_notification(int p_notification) {
} break;
case NOTIFICATION_TRANSLATION_CHANGED:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
+ data.is_rtl_dirty = true;
_size_changed();
} break;
}
@@ -793,7 +805,7 @@ T Control::get_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner
Window *theme_owner_window = p_theme_owner_window;
while (theme_owner || theme_owner_window) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (theme_owner && theme_owner->data.theme->has_theme_item(p_data_type, p_name, E)) {
return theme_owner->data.theme->get_theme_item(p_data_type, p_name, E);
}
@@ -822,7 +834,7 @@ T Control::get_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner
// Secondly, check the project-defined Theme resource.
if (Theme::get_project_default().is_valid()) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_project_default()->has_theme_item(p_data_type, p_name, E)) {
return Theme::get_project_default()->get_theme_item(p_data_type, p_name, E);
}
@@ -830,7 +842,7 @@ T Control::get_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner
}
// Lastly, fall back on the items defined in the default Theme, if they exist.
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_default()->has_theme_item(p_data_type, p_name, E)) {
return Theme::get_default()->get_theme_item(p_data_type, p_name, E);
}
@@ -848,7 +860,7 @@ bool Control::has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_ow
Window *theme_owner_window = p_theme_owner_window;
while (theme_owner || theme_owner_window) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (theme_owner && theme_owner->data.theme->has_theme_item(p_data_type, p_name, E)) {
return true;
}
@@ -877,7 +889,7 @@ bool Control::has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_ow
// Secondly, check the project-defined Theme resource.
if (Theme::get_project_default().is_valid()) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_project_default()->has_theme_item(p_data_type, p_name, E)) {
return true;
}
@@ -885,7 +897,7 @@ bool Control::has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_ow
}
// Lastly, fall back on the items defined in the default Theme, if they exist.
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_default()->has_theme_item(p_data_type, p_name, E)) {
return true;
}
@@ -1594,7 +1606,7 @@ void Control::set_rect(const Rect2 &p_rect) {
void Control::_set_size(const Size2 &p_size) {
#ifdef DEBUG_ENABLED
if (data.size_warning && (data.anchor[SIDE_LEFT] != data.anchor[SIDE_RIGHT] || data.anchor[SIDE_TOP] != data.anchor[SIDE_BOTTOM])) {
- WARN_PRINT("Nodes with non-equal opposite anchors will have their size overriden after _ready(). \nIf you want to set size, change the anchors or consider using set_deferred().");
+ WARN_PRINT("Nodes with non-equal opposite anchors will have their size overridden after _ready(). \nIf you want to set size, change the anchors or consider using set_deferred().");
}
#endif
set_size(p_size);
@@ -2580,7 +2592,7 @@ void Control::get_argument_options(const StringName &p_function, int p_idx, List
}
sn.sort_custom<StringName::AlphCompare>();
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
r_options->push_back(quote_style + E + quote_style);
}
}
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 51b454b334..3779f9b308 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -179,6 +179,8 @@ private:
GrowDirection v_grow = GROW_DIRECTION_END;
LayoutDirection layout_dir = LAYOUT_DIRECTION_INHERITED;
+ bool is_rtl_dirty = true;
+ bool is_rtl = false;
real_t rotation = 0.0;
Vector2 scale = Vector2(1, 1);
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 67cb6f04a7..2e4204e171 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -552,7 +552,7 @@ void FileDialog::update_file_list() {
bool match = patterns.is_empty();
String match_str;
- for (String &E : patterns) {
+ for (const String &E : patterns) {
if (files.front()->get().matchn(E)) {
match_str = E;
match = true;
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 8ad4d04b7f..1fac2b9129 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -217,7 +217,7 @@ Error GraphEdit::connect_node(const StringName &p_from, int p_from_port, const S
}
bool GraphEdit::is_node_connected(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port) {
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
if (E.from == p_from && E.from_port == p_from_port && E.to == p_to && E.to_port == p_to_port) {
return true;
}
@@ -561,7 +561,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
if (is_in_hot_zone(pos / zoom, click_pos)) {
if (valid_left_disconnect_types.has(gn->get_connection_output_type(j))) {
//check disconnect
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
if (E.from == gn->get_name() && E.from_port == j) {
Node *to = get_node(String(E.to));
if (Object::cast_to<GraphNode>(to)) {
@@ -603,7 +603,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
if (is_in_hot_zone(pos / zoom, click_pos)) {
if (right_disconnects || valid_right_disconnect_types.has(gn->get_connection_input_type(j))) {
//check disconnect
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
if (E.to == gn->get_name() && E.to_port == j) {
Node *fr = get_node(String(E.from));
if (Object::cast_to<GraphNode>(fr)) {
@@ -1001,7 +1001,7 @@ void GraphEdit::_minimap_draw() {
// Draw node connections.
Color activity_color = get_theme_color(SNAME("activity"));
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
NodePath fromnp(E.from);
Node *from = get_node(fromnp);
@@ -1500,7 +1500,7 @@ Array GraphEdit::_get_connection_list() const {
List<Connection> conns;
get_connection_list(&conns);
Array arr;
- for (Connection &E : conns) {
+ for (const Connection &E : conns) {
Dictionary d;
d["from"] = E.from;
d["from_port"] = E.from_port;
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index 73034dee5a..cf1f41d0fc 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -57,7 +57,32 @@ void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) {
void MenuButton::_popup_visibility_changed(bool p_visible) {
set_pressed(p_visible);
- set_process_internal(p_visible);
+
+ if (!p_visible) {
+ set_process_internal(false);
+ return;
+ }
+
+ if (switch_on_hover) {
+ Window *window = Object::cast_to<Window>(get_viewport());
+ if (window) {
+ mouse_pos_adjusted = window->get_position();
+
+ if (window->is_embedded()) {
+ Window *window_parent = Object::cast_to<Window>(window->get_parent()->get_viewport());
+ while (window_parent) {
+ if (!window_parent->is_embedded()) {
+ mouse_pos_adjusted += window_parent->get_position();
+ break;
+ }
+
+ window_parent = Object::cast_to<Window>(window_parent->get_parent()->get_viewport());
+ }
+ }
+
+ set_process_internal(true);
+ }
+ }
}
void MenuButton::pressed() {
@@ -106,17 +131,13 @@ void MenuButton::_notification(int p_what) {
}
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
- if (switch_on_hover) {
- Window *window = Object::cast_to<Window>(get_viewport());
- if (window) {
- Vector2i mouse_pos = DisplayServer::get_singleton()->mouse_get_position() - window->get_position();
- MenuButton *menu_btn_other = Object::cast_to<MenuButton>(window->gui_find_control(mouse_pos));
- if (menu_btn_other && menu_btn_other != this && menu_btn_other->is_switch_on_hover() && !menu_btn_other->is_disabled() &&
- (get_parent()->is_ancestor_of(menu_btn_other) || menu_btn_other->get_parent()->is_ancestor_of(popup))) {
- popup->hide();
- menu_btn_other->pressed();
- }
- }
+ Vector2i mouse_pos = DisplayServer::get_singleton()->mouse_get_position() - mouse_pos_adjusted;
+ MenuButton *menu_btn_other = Object::cast_to<MenuButton>(get_viewport()->gui_find_control(mouse_pos));
+
+ if (menu_btn_other && menu_btn_other != this && menu_btn_other->is_switch_on_hover() && !menu_btn_other->is_disabled() &&
+ (get_parent()->is_ancestor_of(menu_btn_other) || menu_btn_other->get_parent()->is_ancestor_of(popup))) {
+ popup->hide();
+ menu_btn_other->pressed();
}
} break;
}
diff --git a/scene/gui/menu_button.h b/scene/gui/menu_button.h
index 301769b008..cc2ca117c4 100644
--- a/scene/gui/menu_button.h
+++ b/scene/gui/menu_button.h
@@ -42,6 +42,8 @@ class MenuButton : public Button {
bool disable_shortcuts = false;
PopupMenu *popup;
+ Vector2i mouse_pos_adjusted;
+
Array _get_items() const;
void _set_items(const Array &p_items);
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index ae3db4a983..7790a0970c 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -397,7 +397,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseMotion> m = p_event;
if (m.is_valid()) {
- for (Rect2 &E : autohide_areas) {
+ for (const Rect2 &E : autohide_areas) {
if (!Rect2(Point2(), get_size()).has_point(m->get_position()) && E.has_point(m->get_position())) {
_close_pressed();
return;
@@ -751,7 +751,7 @@ void PopupMenu::_notification(int p_what) {
Point2 mouse_pos = DisplayServer::get_singleton()->mouse_get_position();
mouse_pos -= get_position();
- for (Rect2 &E : autohide_areas) {
+ for (const Rect2 &E : autohide_areas) {
if (!Rect2(Point2(), get_size()).has_point(mouse_pos) && E.has_point(mouse_pos)) {
_close_pressed();
return;
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 588d4b67d5..2c6cefa771 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -220,7 +220,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) {
client->get_response_headers(&rheaders);
response_headers.resize(0);
downloaded.set(0);
- for (String &E : rheaders) {
+ for (const String &E : rheaders) {
response_headers.push_back(E);
}
@@ -235,7 +235,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) {
String new_request;
- for (String &E : rheaders) {
+ for (const String &E : rheaders) {
if (E.findn("Location: ") != -1) {
new_request = E.substr(9, E.length()).strip_edges();
}
diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp
index b7c6723cfc..b5ba1899ec 100644
--- a/scene/main/instance_placeholder.cpp
+++ b/scene/main/instance_placeholder.cpp
@@ -95,7 +95,7 @@ Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene
scene->set_name(get_name());
int pos = get_index();
- for (PropSet &E : stored_values) {
+ for (const PropSet &E : stored_values) {
scene->set(E.name, E.value);
}
@@ -114,7 +114,7 @@ Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) {
Dictionary ret;
PackedStringArray order;
- for (PropSet &E : stored_values) {
+ for (const PropSet &E : stored_values) {
ret[E.name] = E.value;
if (p_with_order) {
order.push_back(E.name);
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 4b496d4761..f1e5574351 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1597,7 +1597,7 @@ Array Node::_get_groups() const {
Array groups;
List<GroupInfo> gi;
get_groups(&gi);
- for (GroupInfo &E : gi) {
+ for (const GroupInfo &E : gi) {
groups.push_back(E.name);
}
@@ -1947,7 +1947,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
List<PropertyInfo> plist;
N->get()->get_property_list(&plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -1983,7 +1983,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
if (p_flags & DUPLICATE_GROUPS) {
List<GroupInfo> gi;
get_groups(&gi);
- for (GroupInfo &E : gi) {
+ for (const GroupInfo &E : gi) {
#ifdef TOOLS_ENABLED
if ((p_flags & DUPLICATE_FROM_EDITOR) && !E.persistent) {
continue;
@@ -2073,7 +2073,7 @@ void Node::remap_node_resources(Node *p_node, const Map<RES, RES> &p_resource_re
List<PropertyInfo> props;
p_node->get_property_list(&props);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -2099,7 +2099,7 @@ void Node::remap_nested_resources(RES p_resource, const Map<RES, RES> &p_resourc
List<PropertyInfo> props;
p_resource->get_property_list(&props);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -2135,7 +2135,7 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const {
List<Connection> conns;
n->get_all_signal_connections(&conns);
- for (Connection &E : conns) {
+ for (const Connection &E : conns) {
if (E.flags & CONNECT_PERSIST) {
//user connected
NodePath p = p_original->get_path_to(n);
@@ -2194,7 +2194,7 @@ void Node::replace_by(Node *p_node, bool p_keep_groups) {
List<GroupInfo> groups;
get_groups(&groups);
- for (GroupInfo &E : groups) {
+ for (const GroupInfo &E : groups) {
p_node->add_to_group(E.name, E.persistent);
}
}
@@ -2241,7 +2241,7 @@ void Node::_replace_connections_target(Node *p_new_target) {
List<Connection> cl;
get_signals_connected_to_this(&cl);
- for (Connection &c : cl) {
+ for (const Connection &c : cl) {
if (c.flags & CONNECT_PERSIST) {
c.signal.get_object()->disconnect(c.signal.get_name(), Callable(this, c.callable.get_method()));
bool valid = p_new_target->has_method(c.callable.get_method()) || Ref<Script>(p_new_target->get_script()).is_null() || Ref<Script>(p_new_target->get_script())->has_method(c.callable.get_method());
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 8bca76a794..dcbbebbc55 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -66,11 +66,11 @@ void SceneTreeTimer::_bind_methods() {
ADD_SIGNAL(MethodInfo("timeout"));
}
-void SceneTreeTimer::set_time_left(float p_time) {
+void SceneTreeTimer::set_time_left(double p_time) {
time_left = p_time;
}
-float SceneTreeTimer::get_time_left() const {
+double SceneTreeTimer::get_time_left() const {
return time_left;
}
@@ -94,7 +94,7 @@ void SceneTreeTimer::release_connections() {
List<Connection> connections;
get_all_signal_connections(&connections);
- for (Connection &connection : connections) {
+ for (const Connection &connection : connections) {
disconnect(connection.signal.get_name(), connection.callable);
}
}
@@ -403,7 +403,7 @@ void SceneTree::initialize() {
MainLoop::initialize();
}
-bool SceneTree::physics_process(float p_time) {
+bool SceneTree::physics_process(double p_time) {
root_lock++;
current_frame++;
@@ -432,7 +432,7 @@ bool SceneTree::physics_process(float p_time) {
return _quit;
}
-bool SceneTree::process(float p_time) {
+bool SceneTree::process(double p_time) {
root_lock++;
MainLoop::process(p_time);
@@ -474,7 +474,7 @@ bool SceneTree::process(float p_time) {
continue;
}
- float time_left = E->get()->get_time_left();
+ double time_left = E->get()->get_time_left();
if (E->get()->is_ignore_time_scale()) {
time_left -= Engine::get_singleton()->get_process_step();
} else {
@@ -571,8 +571,8 @@ void SceneTree::finalize() {
}
// cleanup timers
- for (Ref<SceneTreeTimer> E : timers) {
- E->release_connections();
+ for (Ref<SceneTreeTimer> &timer : timers) {
+ timer->release_connections();
}
timers.clear();
}
@@ -1124,7 +1124,7 @@ void SceneTree::add_current_scene(Node *p_current) {
root->add_child(p_current);
}
-Ref<SceneTreeTimer> SceneTree::create_timer(float p_delay_sec, bool p_process_always) {
+Ref<SceneTreeTimer> SceneTree::create_timer(double p_delay_sec, bool p_process_always) {
Ref<SceneTreeTimer> stt;
stt.instantiate();
stt->set_process_always(p_process_always);
@@ -1146,8 +1146,8 @@ Array SceneTree::get_processed_tweens() {
ret.resize(tweens.size());
int i = 0;
- for (Ref<Tween> E : tweens) {
- ret[i] = E;
+ for (const Ref<Tween> &tween : tweens) {
+ ret[i] = tween;
i++;
}
@@ -1402,7 +1402,7 @@ SceneTree::SceneTree() {
List<String> exts;
ResourceLoader::get_recognized_extensions_for_type("Environment", &exts);
String ext_hint;
- for (String &E : exts) {
+ for (const String &E : exts) {
if (ext_hint != String()) {
ext_hint += ",";
}
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index c3d59663d6..cfb95bd6b5 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -52,7 +52,7 @@ class Tween;
class SceneTreeTimer : public RefCounted {
GDCLASS(SceneTreeTimer, RefCounted);
- float time_left = 0.0;
+ double time_left = 0.0;
bool process_always = true;
bool ignore_time_scale = false;
@@ -60,8 +60,8 @@ protected:
static void _bind_methods();
public:
- void set_time_left(float p_time);
- float get_time_left() const;
+ void set_time_left(double p_time);
+ double get_time_left() const;
void set_process_always(bool p_process_always);
bool is_process_always();
@@ -91,8 +91,8 @@ private:
Window *root = nullptr;
uint64_t tree_version = 1;
- float physics_process_time = 1.0;
- float process_time = 1.0;
+ double physics_process_time = 1.0;
+ double process_time = 1.0;
bool accept_quit = true;
bool quit_on_go_back = true;
@@ -237,8 +237,8 @@ public:
virtual void initialize() override;
- virtual bool physics_process(float p_time) override;
- virtual bool process(float p_time) override;
+ virtual bool physics_process(double p_time) override;
+ virtual bool process(double p_time) override;
virtual void finalize() override;
@@ -247,8 +247,8 @@ public:
void quit(int p_exit_code = EXIT_SUCCESS);
- _FORCE_INLINE_ float get_physics_process_time() const { return physics_process_time; }
- _FORCE_INLINE_ float get_process_time() const { return process_time; }
+ _FORCE_INLINE_ double get_physics_process_time() const { return physics_process_time; }
+ _FORCE_INLINE_ double get_process_time() const { return process_time; }
#ifdef TOOLS_ENABLED
bool is_node_being_edited(const Node *p_node) const;
@@ -317,7 +317,7 @@ public:
Error change_scene_to(const Ref<PackedScene> &p_scene);
Error reload_current_scene();
- Ref<SceneTreeTimer> create_timer(float p_delay_sec, bool p_process_always = true);
+ Ref<SceneTreeTimer> create_timer(double p_delay_sec, bool p_process_always = true);
Ref<Tween> create_tween();
Array get_processed_tweens();
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index ef8245076f..b5a2a30b3b 100644
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -81,12 +81,12 @@ void Timer::_notification(int p_what) {
}
}
-void Timer::set_wait_time(float p_time) {
+void Timer::set_wait_time(double p_time) {
ERR_FAIL_COND_MSG(p_time <= 0, "Time should be greater than zero.");
wait_time = p_time;
}
-float Timer::get_wait_time() const {
+double Timer::get_wait_time() const {
return wait_time;
}
@@ -106,7 +106,7 @@ bool Timer::has_autostart() const {
return autostart;
}
-void Timer::start(float p_time) {
+void Timer::start(double p_time) {
ERR_FAIL_COND_MSG(!is_inside_tree(), "Timer was not added to the SceneTree. Either add it or set autostart to true.");
if (p_time > 0) {
@@ -139,7 +139,7 @@ bool Timer::is_stopped() const {
return get_time_left() <= 0;
}
-float Timer::get_time_left() const {
+double Timer::get_time_left() const {
return time_left > 0 ? time_left : 0;
}
diff --git a/scene/main/timer.h b/scene/main/timer.h
index 3d9e21d7fc..2b9faddcb9 100644
--- a/scene/main/timer.h
+++ b/scene/main/timer.h
@@ -36,7 +36,7 @@
class Timer : public Node {
GDCLASS(Timer, Node);
- float wait_time = 1.0;
+ double wait_time = 1.0;
bool one_shot = false;
bool autostart = false;
bool processing = false;
@@ -54,8 +54,8 @@ public:
TIMER_PROCESS_IDLE,
};
- void set_wait_time(float p_time);
- float get_wait_time() const;
+ void set_wait_time(double p_time);
+ double get_wait_time() const;
void set_one_shot(bool p_one_shot);
bool is_one_shot() const;
@@ -63,7 +63,7 @@ public:
void set_autostart(bool p_start);
bool has_autostart() const;
- void start(float p_time = -1);
+ void start(double p_time = -1);
void stop();
void set_paused(bool p_paused);
@@ -71,7 +71,7 @@ public:
bool is_stopped() const;
- float get_time_left() const;
+ double get_time_left() const;
void set_timer_process_callback(TimerProcessCallback p_callback);
TimerProcessCallback get_timer_process_callback() const;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 4231072ed9..27e42db1bd 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -573,7 +573,7 @@ void Viewport::_process_picking() {
// if no mouse event exists, create a motion one. This is necessary because objects or camera may have moved.
// while this extra event is sent, it is checked if both camera and last object and last ID did not move. If nothing changed, the event is discarded to avoid flooding with unnecessary motion events every frame
bool has_mouse_event = false;
- for (Ref<InputEvent> m : physics_picking_events) {
+ for (const Ref<InputEvent> &m : physics_picking_events) {
if (m.is_valid()) {
has_mouse_event = true;
break;
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 4ebfe301ab..ab1846660b 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -1356,7 +1356,7 @@ void Window::_validate_property(PropertyInfo &property) const {
Vector<StringName> unique_names;
String hint_string;
- for (StringName &E : names) {
+ for (const StringName &E : names) {
// Skip duplicate values.
if (unique_names.has(E)) {
continue;
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 439fe649a1..8ede8e9a0b 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -909,7 +909,6 @@ void register_scene_types() {
ClassDB::add_compatibility_class("Generic6DOFJoint", "Generic6DOFJoint3D");
ClassDB::add_compatibility_class("HeightMapShape", "HeightMapShape3D");
ClassDB::add_compatibility_class("HingeJoint", "HingeJoint3D");
- ClassDB::add_compatibility_class("ImmediateGeometry", "ImmediateGeometry3D");
ClassDB::add_compatibility_class("Joint", "Joint3D");
ClassDB::add_compatibility_class("KinematicBody", "CharacterBody3D");
ClassDB::add_compatibility_class("KinematicBody2D", "CharacterBody2D");
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index 71b4542970..c13db83d6d 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -729,7 +729,7 @@ void Curve2D::_bake() const {
Vector2 *w = baked_point_cache.ptrw();
int idx = 0;
- for (Vector2 &E : pointlist) {
+ for (const Vector2 &E : pointlist) {
w[idx] = E;
idx++;
}
@@ -1239,7 +1239,7 @@ void Curve3D::_bake() const {
Vector3 prev_up = Vector3(0, 1, 0);
Vector3 prev_forward = Vector3(0, 0, 1);
- for (Plane &E : pointlist) {
+ for (const Plane &E : pointlist) {
w[idx] = E.normal;
wt[idx] = E.d;
diff --git a/scene/resources/immediate_mesh.cpp b/scene/resources/immediate_mesh.cpp
index ebe65605f8..05d1a7bf94 100644
--- a/scene/resources/immediate_mesh.cpp
+++ b/scene/resources/immediate_mesh.cpp
@@ -146,7 +146,7 @@ void ImmediateMesh::surface_add_vertex_2d(const Vector2 &p_vertex) {
}
void ImmediateMesh::surface_end() {
ERR_FAIL_COND_MSG(!surface_active, "Not creating any surface. Use surface_begin() to do it.");
- ERR_FAIL_COND_MSG(!vertices.size(), "No vertices were added, surface cant be created.");
+ ERR_FAIL_COND_MSG(!vertices.size(), "No vertices were added, surface can't be created.");
uint32_t format = ARRAY_FORMAT_VERTEX;
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index fbeb331f13..08f7274ff6 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -278,7 +278,7 @@ void ShaderMaterial::get_argument_options(const StringName &p_function, int p_id
if (shader.is_valid()) {
List<PropertyInfo> pl;
shader->get_param_list(&pl);
- for (PropertyInfo &E : pl) {
+ for (const PropertyInfo &E : pl) {
r_options->push_back(quote_style + E.name.replace_first("shader_param/", "") + quote_style);
}
}
diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp
index d679a17c15..ddc50c0490 100644
--- a/scene/resources/navigation_mesh.cpp
+++ b/scene/resources/navigation_mesh.cpp
@@ -329,7 +329,7 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
Vector3 *tw = tmeshfaces.ptrw();
int tidx = 0;
- for (Face3 &f : faces) {
+ for (const Face3 &f : faces) {
for (int j = 0; j < 3; j++) {
tw[tidx++] = f.vertex[j];
_EdgeKey ek;
@@ -364,7 +364,7 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
{
Vector3 *w = varr.ptrw();
int idx = 0;
- for (Vector3 &E : lines) {
+ for (const Vector3 &E : lines) {
w[idx++] = E;
}
}
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 8018ce3a9b..eddbb9a842 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -206,7 +206,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
node->set(snames[nprops[j].name], props[nprops[j].value], &valid);
//restore old state for new script, if exists
- for (Pair<StringName, Variant> &E : old_state) {
+ for (const Pair<StringName, Variant> &E : old_state) {
node->set(E.first, E.second);
}
} else {
@@ -477,7 +477,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
script->update_exports();
}
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -565,7 +565,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
List<Node::GroupInfo> groups;
p_node->get_groups(&groups);
- for (Node::GroupInfo &gi : groups) {
+ for (const Node::GroupInfo &gi : groups) {
if (!gi.persistent) {
continue;
}
@@ -575,7 +575,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
*/
bool skip = false;
- for (PackState &F : pack_state_stack) {
+ for (const PackState &F : pack_state_stack) {
//check all levels of pack to see if the group was added somewhere
const PackState &ps = F;
if (ps.state->is_node_in_group(ps.node, gi.name)) {
@@ -677,13 +677,13 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName
//ERR_FAIL_COND_V( !node_map.has(p_node), ERR_BUG);
//NodeData &nd = nodes[node_map[p_node]];
- for (MethodInfo &E : _signals) {
+ for (const MethodInfo &E : _signals) {
List<Node::Connection> conns;
p_node->get_signal_connection_list(E.name, &conns);
conns.sort();
- for (Node::Connection &F : conns) {
+ for (const Node::Connection &F : conns) {
const Node::Connection &c = F;
if (!(c.flags & CONNECT_PERSIST)) { //only persistent connections get saved
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 615187ab7f..3f6e926aa7 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -1221,7 +1221,7 @@ Error ResourceLoaderText::save_as_binary(FileAccess *p_f, const String &p_path)
int prop_count = 0;
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -1399,7 +1399,7 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const {
return String();
}
- //for anyhting else must test..
+ // ...for anything else must test...
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
if (!f) {
@@ -1581,7 +1581,7 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant,
Dictionary d = p_variant;
List<Variant> keys;
d.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
Variant v = d[E];
_find_resources(v);
}
diff --git a/scene/resources/sprite_frames.cpp b/scene/resources/sprite_frames.cpp
index 5fdabb6f0f..e9adf67559 100644
--- a/scene/resources/sprite_frames.cpp
+++ b/scene/resources/sprite_frames.cpp
@@ -100,7 +100,7 @@ Vector<String> SpriteFrames::_get_animation_list() const {
Vector<String> ret;
List<StringName> al;
get_animation_list(&al);
- for (StringName &E : al) {
+ for (const StringName &E : al) {
ret.push_back(E);
}
diff --git a/scene/resources/syntax_highlighter.cpp b/scene/resources/syntax_highlighter.cpp
index ac6bffb20b..173ce2adce 100644
--- a/scene/resources/syntax_highlighter.cpp
+++ b/scene/resources/syntax_highlighter.cpp
@@ -529,7 +529,7 @@ void CodeHighlighter::set_color_regions(const Dictionary &p_color_regions) {
List<Variant> keys;
p_color_regions.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
String key = E;
String start_key = key.get_slice(" ", 0);
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 5eb35ce3ff..e4a731c7f7 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -447,7 +447,7 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const {
// Sort and store properties.
list.sort();
- for (PropertyInfo &E : list) {
+ for (const PropertyInfo &E : list) {
p_list->push_back(E);
}
}
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 2ab9d4b5a3..737b47ed95 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -2728,7 +2728,7 @@ TileSet::TileSet() {
tile_lines_mesh.instantiate();
tile_filled_mesh.instantiate();
- // Instanciate and list all plugins.
+ // Instantiate and list all plugins.
tile_set_plugins_vector.append(memnew(TileSetPluginAtlasRendering));
tile_set_plugins_vector.append(memnew(TileSetPluginAtlasPhysics));
tile_set_plugins_vector.append(memnew(TileSetPluginAtlasNavigation));
@@ -4357,13 +4357,13 @@ void TileSetPluginAtlasRendering::update_dirty_quadrants(TileMap *p_tile_map, Se
RenderingServer *rs = RenderingServer::get_singleton();
// Free the canvas items.
- for (RID E : q.canvas_items) {
+ for (const RID &E : q.canvas_items) {
rs->free(E);
}
q.canvas_items.clear();
// Free the occluders.
- for (RID E : q.occluders) {
+ for (const RID &E : q.occluders) {
rs->free(E);
}
q.occluders.clear();
@@ -4473,7 +4473,7 @@ void TileSetPluginAtlasRendering::update_dirty_quadrants(TileMap *p_tile_map, Se
// Sort the quadrants
for (Map<Vector2i, Vector2i, TileMapQuadrant::CoordsWorldComparator>::Element *E = world_to_map.front(); E; E = E->next()) {
TileMapQuadrant &q = quadrant_map[E->value()];
- for (RID F : q.canvas_items) {
+ for (const RID &F : q.canvas_items) {
RS::get_singleton()->canvas_item_set_draw_index(F, index++);
}
}
@@ -4491,13 +4491,13 @@ void TileSetPluginAtlasRendering::create_quadrant(TileMap *p_tile_map, TileMapQu
void TileSetPluginAtlasRendering::cleanup_quadrant(TileMap *p_tile_map, TileMapQuadrant *p_quadrant) {
// Free the canvas items.
- for (RID E : p_quadrant->canvas_items) {
+ for (const RID &E : p_quadrant->canvas_items) {
RenderingServer::get_singleton()->free(E);
}
p_quadrant->canvas_items.clear();
// Free the occluders.
- for (RID E : p_quadrant->occluders) {
+ for (const RID &E : p_quadrant->occluders) {
RenderingServer::get_singleton()->free(E);
}
p_quadrant->occluders.clear();
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 752c026aa6..7292728251 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -739,7 +739,7 @@ Error VisualShader::connect_nodes(Type p_type, int p_from_node, int p_from_port,
ERR_FAIL_COND_V_MSG(!is_port_types_compatible(from_port_type, to_port_type), ERR_INVALID_PARAMETER, "Incompatible port types (scalar/vec/bool) with transform.");
- for (Connection &E : g->connections) {
+ for (const Connection &E : g->connections) {
if (E.from_node == p_from_node && E.from_port == p_from_port && E.to_node == p_to_node && E.to_port == p_to_port) {
ERR_FAIL_V(ERR_ALREADY_EXISTS);
}
@@ -2586,7 +2586,7 @@ void VisualShaderNodeUniformRef::clear_uniforms() {
}
bool VisualShaderNodeUniformRef::has_uniform(const String &p_name) {
- for (VisualShaderNodeUniformRef::Uniform &E : uniforms) {
+ for (const VisualShaderNodeUniformRef::Uniform &E : uniforms) {
if (E.name == p_name) {
return true;
}
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp
index 0a01d0c0b0..7aa2f9b7de 100644
--- a/servers/physics_2d/body_2d_sw.cpp
+++ b/servers/physics_2d/body_2d_sw.cpp
@@ -532,7 +532,7 @@ void Body2DSW::integrate_velocities(real_t p_step) {
}
void Body2DSW::wakeup_neighbours() {
- for (Pair<Constraint2DSW *, int> &E : constraint_list) {
+ for (const Pair<Constraint2DSW *, int> &E : constraint_list) {
const Constraint2DSW *c = E.first;
Body2DSW **n = c->get_body_ptr();
int bc = c->get_body_count();
diff --git a/servers/physics_3d/joints/generic_6dof_joint_3d_sw.h b/servers/physics_3d/joints/generic_6dof_joint_3d_sw.h
index d46437e782..d0f3dbbd35 100644
--- a/servers/physics_3d/joints/generic_6dof_joint_3d_sw.h
+++ b/servers/physics_3d/joints/generic_6dof_joint_3d_sw.h
@@ -322,12 +322,12 @@ public:
m_angularLimits[2].m_hiLimit = angularUpper.z;
}
- //! Retrieves the angular limit informacion
+ //! Retrieves the angular limit information.
G6DOFRotationalLimitMotor3DSW *getRotationalLimitMotor(int index) {
return &m_angularLimits[index];
}
- //! Retrieves the limit informacion
+ //! Retrieves the limit information.
G6DOFTranslationalLimitMotor3DSW *getTranslationalLimitMotor() {
return &m_linearLimits;
}
diff --git a/servers/physics_3d/joints/slider_joint_3d_sw.cpp b/servers/physics_3d/joints/slider_joint_3d_sw.cpp
index db9bdb2986..1895fe1e2e 100644
--- a/servers/physics_3d/joints/slider_joint_3d_sw.cpp
+++ b/servers/physics_3d/joints/slider_joint_3d_sw.cpp
@@ -200,7 +200,7 @@ void SliderJoint3DSW::solve(real_t p_step) {
real_t softness = (i) ? m_softnessOrthoLin : (m_solveLinLim ? m_softnessLimLin : m_softnessDirLin);
real_t restitution = (i) ? m_restitutionOrthoLin : (m_solveLinLim ? m_restitutionLimLin : m_restitutionDirLin);
real_t damping = (i) ? m_dampingOrthoLin : (m_solveLinLim ? m_dampingLimLin : m_dampingDirLin);
- // calcutate and apply impulse
+ // Calculate and apply impulse.
real_t normalImpulse = softness * (restitution * depth / p_step - damping * rel_vel) * m_jacLinDiagABInv[i];
Vector3 impulse_vector = normal * normalImpulse;
if (dynamic_A) {
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index 717b4e8d14..857f112102 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -205,7 +205,7 @@ void register_server_types() {
GDREGISTER_CLASS(RDPipelineColorBlendStateAttachment);
GDREGISTER_CLASS(RDPipelineColorBlendState);
GDREGISTER_CLASS(RDShaderSource);
- GDREGISTER_CLASS(RDShaderBytecode);
+ GDREGISTER_CLASS(RDShaderSPIRV);
GDREGISTER_CLASS(RDShaderFile);
GDREGISTER_CLASS(RDPipelineSpecializationConstant);
diff --git a/servers/rendering/renderer_rd/cluster_builder_rd.h b/servers/rendering/renderer_rd/cluster_builder_rd.h
index ebb81abdad..c0c03eb26a 100644
--- a/servers/rendering/renderer_rd/cluster_builder_rd.h
+++ b/servers/rendering/renderer_rd/cluster_builder_rd.h
@@ -235,7 +235,7 @@ public:
Transform3D xform = view_xform * p_transform;
float radius = xform.basis.get_uniform_scale();
- if (radius > 0.98 || radius < 1.02) {
+ if (radius < 0.98 || radius > 1.02) {
xform.basis.orthonormalize();
}
diff --git a/servers/rendering/renderer_rd/effects_rd.cpp b/servers/rendering/renderer_rd/effects_rd.cpp
index 5dab066262..47bb756d55 100644
--- a/servers/rendering/renderer_rd/effects_rd.cpp
+++ b/servers/rendering/renderer_rd/effects_rd.cpp
@@ -1351,8 +1351,9 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
if (p_settings.quality > RS::ENV_SSAO_QUALITY_VERY_LOW) {
if (pass < blur_passes - 2) {
blur_pipeline = SSAO_BLUR_PASS_WIDE;
+ } else {
+ blur_pipeline = SSAO_BLUR_PASS_SMART;
}
- blur_pipeline = SSAO_BLUR_PASS_SMART;
}
for (int i = 0; i < 4; i++) {
diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
index 6d1c408a32..5f6d9465c7 100644
--- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
+++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
@@ -160,12 +160,12 @@ bool RenderForwardMobile::free(RID p_rid) {
/* Render functions */
RD::DataFormat RenderForwardMobile::_render_buffers_get_color_format() {
- // Using 32bit buffers enables AFBC on mobile devices which should have a definate performance improvement (MALI G710 and newer support this on 64bit RTs)
+ // Using 32bit buffers enables AFBC on mobile devices which should have a definite performance improvement (MALI G710 and newer support this on 64bit RTs)
return RD::DATA_FORMAT_A2B10G10R10_UNORM_PACK32;
}
bool RenderForwardMobile::_render_buffers_can_be_storage() {
- // Using 32bit buffers enables AFBC on mobile devices which should have a definate performance improvement (MALI G710 and newer support this on 64bit RTs)
+ // Using 32bit buffers enables AFBC on mobile devices which should have a definite performance improvement (MALI G710 and newer support this on 64bit RTs)
// Doesn't support storage
return false;
}
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
index 6a66e9fa01..18c1fe02a0 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
@@ -620,7 +620,7 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend
RD::get_singleton()->draw_list_bind_index_array(p_draw_list, shader.quad_index_array);
RD::get_singleton()->draw_list_draw(p_draw_list, true);
- //restore if overrided
+ // Restore if overridden.
push_constant.color_texture_pixel_size[0] = texpixel_size.x;
push_constant.color_texture_pixel_size[1] = texpixel_size.y;
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
index 02f3a01ec3..2e0e7c3c43 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
@@ -2250,7 +2250,7 @@ bool RendererSceneRenderRD::_render_buffers_can_be_storage() {
}
void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) {
- ERR_FAIL_COND_MSG(p_view_count == 0, "Must have atleast 1 view");
+ ERR_FAIL_COND_MSG(p_view_count == 0, "Must have at least 1 view");
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
rb->width = p_width;
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
index 178fb60885..d5c7db6fd2 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
@@ -8410,7 +8410,7 @@ void RendererStorageRD::global_variables_load_settings(bool p_load_textures) {
List<PropertyInfo> settings;
ProjectSettings::get_singleton()->get_property_list(&settings);
- for (PropertyInfo &E : settings) {
+ for (const PropertyInfo &E : settings) {
if (E.name.begins_with("shader_globals/")) {
StringName name = E.name.get_slice("/", 1);
Dictionary d = ProjectSettings::get_singleton()->get(E.name);
@@ -8581,7 +8581,7 @@ void RendererStorageRD::_update_global_variables() {
if (global_variables.must_update_buffer_materials) {
// only happens in the case of a buffer variable added or removed,
// so not often.
- for (RID E : global_variables.materials_using_buffer) {
+ for (const RID &E : global_variables.materials_using_buffer) {
Material *material = material_owner.getornull(E);
ERR_CONTINUE(!material); //wtf
@@ -8594,7 +8594,7 @@ void RendererStorageRD::_update_global_variables() {
if (global_variables.must_update_texture_materials) {
// only happens in the case of a buffer variable added or removed,
// so not often.
- for (RID E : global_variables.materials_using_texture) {
+ for (const RID &E : global_variables.materials_using_texture) {
Material *material = material_owner.getornull(E);
ERR_CONTINUE(!material); //wtf
diff --git a/servers/rendering/renderer_rd/shader_compiler_rd.cpp b/servers/rendering/renderer_rd/shader_compiler_rd.cpp
index 8c4070562e..9c1068ea2e 100644
--- a/servers/rendering/renderer_rd/shader_compiler_rd.cpp
+++ b/servers/rendering/renderer_rd/shader_compiler_rd.cpp
@@ -571,7 +571,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
max_texture_uniforms++;
} else {
if (E->get().scope == SL::ShaderNode::Uniform::SCOPE_INSTANCE) {
- continue; //instances are indexed directly, dont need index uniforms
+ continue; // Instances are indexed directly, don't need index uniforms.
}
max_uniforms++;
@@ -605,7 +605,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
if (uniform.scope == SL::ShaderNode::Uniform::SCOPE_INSTANCE) {
//insert, but don't generate any code.
p_actions.uniforms->insert(uniform_name, uniform);
- continue; //instances are indexed directly, dont need index uniforms
+ continue; // Instances are indexed directly, don't need index uniforms.
}
if (SL::is_sampler_type(uniform.type)) {
ucode = "layout(set = " + itos(actions.texture_layout_set) + ", binding = " + itos(actions.base_texture_binding_index + uniform.texture_order) + ") uniform ";
@@ -760,7 +760,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
if (var_frag_to_light.size() > 0) {
String gcode = "\n\nstruct {\n";
- for (Pair<StringName, SL::ShaderNode::Varying> &E : var_frag_to_light) {
+ for (const Pair<StringName, SL::ShaderNode::Varying> &E : var_frag_to_light) {
gcode += "\t" + _prestr(E.second.precision) + _typestr(E.second.type) + " " + _mkid(E.first);
if (E.second.array_size > 0) {
gcode += "[";
@@ -1394,7 +1394,7 @@ void ShaderCompilerRD::initialize(DefaultIdentifierActions p_actions) {
ShaderLanguage::get_builtin_funcs(&func_list);
- for (String &E : func_list) {
+ for (const String &E : func_list) {
internal_functions.insert(E);
}
texture_functions.insert("texture");
diff --git a/servers/rendering/renderer_rd/shader_rd.cpp b/servers/rendering/renderer_rd/shader_rd.cpp
index 27305cc938..1b9f54d1c8 100644
--- a/servers/rendering/renderer_rd/shader_rd.cpp
+++ b/servers/rendering/renderer_rd/shader_rd.cpp
@@ -116,8 +116,10 @@ void ShaderRD::setup(const char *p_vertex_code, const char *p_fragment_code, con
}
StringBuilder tohash;
- tohash.append("[VersionKey]");
- tohash.append(RenderingDevice::get_singleton()->shader_get_cache_key());
+ tohash.append("[SpirvCacheKey]");
+ tohash.append(RenderingDevice::get_singleton()->shader_get_spirv_cache_key());
+ tohash.append("[BinaryCacheKey]");
+ tohash.append(RenderingDevice::get_singleton()->shader_get_binary_cache_key());
tohash.append("[Vertex]");
tohash.append(p_vertex_code ? p_vertex_code : "");
tohash.append("[Fragment]");
@@ -148,8 +150,8 @@ void ShaderRD::_clear_version(Version *p_version) {
}
memdelete_arr(p_version->variants);
- if (p_version->variant_stages) {
- memdelete_arr(p_version->variant_stages);
+ if (p_version->variant_data) {
+ memdelete_arr(p_version->variant_data);
}
p_version->variants = nullptr;
}
@@ -203,7 +205,7 @@ void ShaderRD::_compile_variant(uint32_t p_variant, Version *p_version) {
return; //variant is disabled, return
}
- Vector<RD::ShaderStageData> &stages = p_version->variant_stages[p_variant];
+ Vector<RD::ShaderStageSPIRVData> stages;
String error;
String current_source;
@@ -217,8 +219,8 @@ void ShaderRD::_compile_variant(uint32_t p_variant, Version *p_version) {
_build_variant_code(builder, p_variant, p_version, stage_templates[STAGE_TYPE_VERTEX]);
current_source = builder.as_string();
- RD::ShaderStageData stage;
- stage.spir_v = RD::get_singleton()->shader_compile_from_source(RD::SHADER_STAGE_VERTEX, current_source, RD::SHADER_LANGUAGE_GLSL, &error);
+ RD::ShaderStageSPIRVData stage;
+ stage.spir_v = RD::get_singleton()->shader_compile_spirv_from_source(RD::SHADER_STAGE_VERTEX, current_source, RD::SHADER_LANGUAGE_GLSL, &error);
if (stage.spir_v.size() == 0) {
build_ok = false;
} else {
@@ -235,8 +237,8 @@ void ShaderRD::_compile_variant(uint32_t p_variant, Version *p_version) {
_build_variant_code(builder, p_variant, p_version, stage_templates[STAGE_TYPE_FRAGMENT]);
current_source = builder.as_string();
- RD::ShaderStageData stage;
- stage.spir_v = RD::get_singleton()->shader_compile_from_source(RD::SHADER_STAGE_FRAGMENT, current_source, RD::SHADER_LANGUAGE_GLSL, &error);
+ RD::ShaderStageSPIRVData stage;
+ stage.spir_v = RD::get_singleton()->shader_compile_spirv_from_source(RD::SHADER_STAGE_FRAGMENT, current_source, RD::SHADER_LANGUAGE_GLSL, &error);
if (stage.spir_v.size() == 0) {
build_ok = false;
} else {
@@ -254,8 +256,8 @@ void ShaderRD::_compile_variant(uint32_t p_variant, Version *p_version) {
current_source = builder.as_string();
- RD::ShaderStageData stage;
- stage.spir_v = RD::get_singleton()->shader_compile_from_source(RD::SHADER_STAGE_COMPUTE, current_source, RD::SHADER_LANGUAGE_GLSL, &error);
+ RD::ShaderStageSPIRVData stage;
+ stage.spir_v = RD::get_singleton()->shader_compile_spirv_from_source(RD::SHADER_STAGE_COMPUTE, current_source, RD::SHADER_LANGUAGE_GLSL, &error);
if (stage.spir_v.size() == 0) {
build_ok = false;
} else {
@@ -275,10 +277,15 @@ void ShaderRD::_compile_variant(uint32_t p_variant, Version *p_version) {
return;
}
- RID shader = RD::get_singleton()->shader_create(stages);
+ Vector<uint8_t> shader_data = RD::get_singleton()->shader_compile_binary_from_spirv(stages);
+
+ ERR_FAIL_COND(shader_data.size() == 0);
+
+ RID shader = RD::get_singleton()->shader_create_from_bytecode(shader_data);
{
MutexLock lock(variant_set_mutex);
p_version->variants[p_variant] = shader;
+ p_version->variant_data[p_variant] = shader_data;
}
}
@@ -364,14 +371,12 @@ String ShaderRD::_version_get_sha1(Version *p_version) const {
}
static const char *shader_file_header = "GDSC";
-static const uint32_t cache_file_version = 1;
+static const uint32_t cache_file_version = 2;
bool ShaderRD::_load_from_cache(Version *p_version) {
String sha1 = _version_get_sha1(p_version);
String path = shader_cache_dir.plus_file(name).plus_file(base_sha256).plus_file(sha1) + ".cache";
- uint64_t time_from = OS::get_singleton()->get_ticks_usec();
-
FileAccessRef f = FileAccess::open(path, FileAccess::READ);
if (!f) {
return false;
@@ -390,76 +395,43 @@ bool ShaderRD::_load_from_cache(Version *p_version) {
ERR_FAIL_COND_V(variant_count != (uint32_t)variant_defines.size(), false); //should not happen but check
- bool success = true;
for (uint32_t i = 0; i < variant_count; i++) {
- uint32_t stage_count = f->get_32();
- p_version->variant_stages[i].resize(stage_count);
- for (uint32_t j = 0; j < stage_count; j++) {
- p_version->variant_stages[i].write[j].shader_stage = RD::ShaderStage(f->get_32());
-
- int compression = f->get_32();
- uint32_t length = f->get_32();
-
- if (compression == 0) {
- Vector<uint8_t> data;
- data.resize(length);
-
- f->get_buffer(data.ptrw(), length);
-
- p_version->variant_stages[i].write[j].spir_v = data;
- } else {
- Vector<uint8_t> data;
-
- if (compression == 2) {
- //zstd
- int smol_length = f->get_32();
- Vector<uint8_t> zstd_data;
-
- zstd_data.resize(smol_length);
- f->get_buffer(zstd_data.ptrw(), smol_length);
-
- data.resize(length);
- Compression::decompress(data.ptrw(), data.size(), zstd_data.ptr(), zstd_data.size(), Compression::MODE_ZSTD);
-
- } else {
- data.resize(length);
- f->get_buffer(data.ptrw(), length);
- }
-
- Vector<uint8_t> spirv;
- uint32_t spirv_size = smolv::GetDecodedBufferSize(data.ptr(), data.size());
- spirv.resize(spirv_size);
- if (!smolv::Decode(data.ptr(), data.size(), spirv.ptrw(), spirv_size)) {
- ERR_PRINT("Malformed smolv input uncompressing shader " + name + ", variant #" + itos(i) + " stage :" + itos(j));
- success = false;
- break;
- }
- p_version->variant_stages[i].write[j].spir_v = spirv;
- }
+ uint32_t variant_size = f->get_32();
+ ERR_FAIL_COND_V(variant_size == 0 && variants_enabled[i], false);
+ if (!variants_enabled[i]) {
+ continue;
}
- }
+ Vector<uint8_t> variant_bytes;
+ variant_bytes.resize(variant_size);
- if (!success) {
- for (uint32_t i = 0; i < variant_count; i++) {
- p_version->variant_stages[i].resize(0);
- }
- return false;
- }
+ uint32_t br = f->get_buffer(variant_bytes.ptrw(), variant_size);
- float time_ms = double(OS::get_singleton()->get_ticks_usec() - time_from) / 1000.0;
+ ERR_FAIL_COND_V(br != variant_size, false);
- print_verbose("Shader cache load success '" + path + "' " + rtos(time_ms) + "ms.");
+ p_version->variant_data[i] = variant_bytes;
+ }
for (uint32_t i = 0; i < variant_count; i++) {
- RID shader = RD::get_singleton()->shader_create(p_version->variant_stages[i]);
+ if (!variants_enabled[i]) {
+ MutexLock lock(variant_set_mutex);
+ p_version->variants[i] = RID();
+ continue;
+ }
+ RID shader = RD::get_singleton()->shader_create_from_bytecode(p_version->variant_data[i]);
+ if (shader.is_null()) {
+ for (uint32_t j = 0; j < i; j++) {
+ RD::get_singleton()->free(p_version->variants[i]);
+ }
+ ERR_FAIL_COND_V(shader.is_null(), false);
+ }
{
MutexLock lock(variant_set_mutex);
p_version->variants[i] = shader;
}
}
- memdelete_arr(p_version->variant_stages); //clear stages
- p_version->variant_stages = nullptr;
+ memdelete_arr(p_version->variant_data); //clear stages
+ p_version->variant_data = nullptr;
p_version->valid = true;
return true;
}
@@ -476,49 +448,8 @@ void ShaderRD::_save_to_cache(Version *p_version) {
f->store_32(variant_count); //variant count
for (uint32_t i = 0; i < variant_count; i++) {
- f->store_32(p_version->variant_stages[i].size()); //stage count
- for (int j = 0; j < p_version->variant_stages[i].size(); j++) {
- f->store_32(p_version->variant_stages[i][j].shader_stage); //stage count
- Vector<uint8_t> spirv = p_version->variant_stages[i][j].spir_v;
-
- bool save_uncompressed = true;
- if (shader_cache_save_compressed) {
- smolv::ByteArray smolv;
- bool strip_debug = !shader_cache_save_debug;
- if (!smolv::Encode(spirv.ptr(), spirv.size(), smolv, strip_debug ? smolv::kEncodeFlagStripDebugInfo : 0)) {
- ERR_PRINT("Error compressing shader " + name + ", variant #" + itos(i) + " stage :" + itos(i));
- } else {
- bool compress_zstd = shader_cache_save_compressed_zstd;
-
- if (compress_zstd) {
- Vector<uint8_t> zstd;
- zstd.resize(Compression::get_max_compressed_buffer_size(smolv.size(), Compression::MODE_ZSTD));
- int dst_size = Compression::compress(zstd.ptrw(), &smolv[0], smolv.size(), Compression::MODE_ZSTD);
- if (dst_size >= 0 && (uint32_t)dst_size < smolv.size()) {
- f->store_32(2); //compressed zstd
- f->store_32(smolv.size()); //size of smolv buffer
- f->store_32(dst_size); //size of smolv buffer
- f->store_buffer(zstd.ptr(), dst_size); //smolv buffer
- } else {
- compress_zstd = false;
- }
- }
-
- if (!compress_zstd) {
- f->store_32(1); //compressed
- f->store_32(smolv.size()); //size of smolv buffer
- f->store_buffer(&smolv[0], smolv.size()); //smolv buffer
- }
- save_uncompressed = false;
- }
- }
-
- if (save_uncompressed) {
- f->store_32(0); //uncompressed
- f->store_32(spirv.size()); //stage count
- f->store_buffer(spirv.ptr(), spirv.size()); //stage count
- }
- }
+ f->store_32(p_version->variant_data[i].size()); //stage count
+ f->store_buffer(p_version->variant_data[i].ptr(), p_version->variant_data[i].size());
}
f->close();
@@ -531,8 +462,8 @@ void ShaderRD::_compile_version(Version *p_version) {
p_version->dirty = false;
p_version->variants = memnew_arr(RID, variant_defines.size());
- typedef Vector<RD::ShaderStageData> ShaderStageArray;
- p_version->variant_stages = memnew_arr(ShaderStageArray, variant_defines.size());
+ typedef Vector<uint8_t> ShaderStageData;
+ p_version->variant_data = memnew_arr(ShaderStageData, variant_defines.size());
if (shader_cache_dir_valid) {
if (_load_from_cache(p_version)) {
@@ -571,19 +502,19 @@ void ShaderRD::_compile_version(Version *p_version) {
}
}
memdelete_arr(p_version->variants);
- if (p_version->variant_stages) {
- memdelete_arr(p_version->variant_stages);
+ if (p_version->variant_data) {
+ memdelete_arr(p_version->variant_data);
}
p_version->variants = nullptr;
- p_version->variant_stages = nullptr;
+ p_version->variant_data = nullptr;
return;
} else if (shader_cache_dir_valid) {
//save shader cache
_save_to_cache(p_version);
}
- memdelete_arr(p_version->variant_stages); //clear stages
- p_version->variant_stages = nullptr;
+ memdelete_arr(p_version->variant_data); //clear stages
+ p_version->variant_data = nullptr;
p_version->valid = true;
}
diff --git a/servers/rendering/renderer_rd/shader_rd.h b/servers/rendering/renderer_rd/shader_rd.h
index 9a68e02007..529328f0ed 100644
--- a/servers/rendering/renderer_rd/shader_rd.h
+++ b/servers/rendering/renderer_rd/shader_rd.h
@@ -59,7 +59,7 @@ class ShaderRD {
Map<StringName, CharString> code_sections;
Vector<CharString> custom_defines;
- Vector<RD::ShaderStageData> *variant_stages = nullptr;
+ Vector<uint8_t> *variant_data = nullptr;
RID *variants = nullptr; //same size as version defines
bool valid;
diff --git a/servers/rendering/renderer_rd/shaders/particles_copy.glsl b/servers/rendering/renderer_rd/shaders/particles_copy.glsl
index 4dceeea995..e88e68b511 100644
--- a/servers/rendering/renderer_rd/shaders/particles_copy.glsl
+++ b/servers/rendering/renderer_rd/shaders/particles_copy.glsl
@@ -138,7 +138,7 @@ void main() {
if (bool(particles.data[particle].flags & PARTICLE_FLAG_ACTIVE) || bool(particles.data[particle].flags & PARTICLE_FLAG_TRAILED)) {
txform = particles.data[particle].xform;
if (params.trail_size > 1) {
- // since the steps dont fit precisely in the history frames, must do a tiny bit of
+ // Since the steps don't fit precisely in the history frames, must do a tiny bit of
// interpolation to get them close to their intended location.
uint part_ofs = particle % params.trail_size;
float natural_ofs = fract((float(part_ofs) / float(params.trail_size)) * float(params.trail_total)) * params.frame_delta;
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
index ef1c9bacfb..b3a349c948 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
@@ -1214,7 +1214,7 @@ void main() {
specular_light *= specular * metallic * albedo * 2.0;
#else
- // scales the specular reflections, needs to be be computed before lighting happens,
+ // scales the specular reflections, needs to be computed before lighting happens,
// but after environment, GI, and reflection probes are added
// Environment brdf approximation (Lazarov 2013)
// see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl
index 3a05275652..b53bf6a6d4 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl
@@ -177,7 +177,7 @@ layout(set = 1, binding = 0, std140) uniform SceneData {
uint cluster_type_size;
uint max_cluster_element_count_div_32;
- //use vec4s because std140 doesnt play nice with vec2s, z and w are wasted
+ // Use vec4s because std140 doesn't play nice with vec2s, z and w are wasted.
vec4 directional_penumbra_shadow_kernel[32];
vec4 directional_soft_shadow_kernel[32];
vec4 penumbra_shadow_kernel[32];
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
index 7e72ece5dc..70900a847c 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
@@ -981,7 +981,7 @@ void main() {
specular_light *= specular * metallic * albedo * 2.0;
#else
- // scales the specular reflections, needs to be be computed before lighting happens,
+ // scales the specular reflections, needs to be computed before lighting happens,
// but after environment, GI, and reflection probes are added
// Environment brdf approximation (Lazarov 2013)
// see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl
index 1b8e21551c..d9682d7b23 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl
@@ -138,7 +138,7 @@ layout(set = 1, binding = 0, std140) uniform SceneData {
vec2 viewport_size;
vec2 screen_pixel_size;
- //use vec4s because std140 doesnt play nice with vec2s, z and w are wasted
+ // Use vec4s because std140 doesn't play nice with vec2s, z and w are wasted.
vec4 directional_penumbra_shadow_kernel[32];
vec4 directional_soft_shadow_kernel[32];
vec4 penumbra_shadow_kernel[32];
diff --git a/servers/rendering/renderer_rd/shaders/sdfgi_direct_light.glsl b/servers/rendering/renderer_rd/shaders/sdfgi_direct_light.glsl
index 99db35bb34..d6e5c6a92e 100644
--- a/servers/rendering/renderer_rd/shaders/sdfgi_direct_light.glsl
+++ b/servers/rendering/renderer_rd/shaders/sdfgi_direct_light.glsl
@@ -20,10 +20,10 @@ layout(set = 0, binding = 3, std430) restrict readonly buffer DispatchData {
dispatch_data;
struct ProcessVoxel {
- uint position; //xyz 7 bit packed, extra 11 bits for neigbours
- uint albedo; //rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neibhbours
- uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbours
- uint light_aniso; //55555 light anisotropy, extra 2 bits for neighbours
+ uint position; // xyz 7 bit packed, extra 11 bits for neighbors.
+ uint albedo; // rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neighbors.
+ uint light; // rgbe8985 encoded total saved light, extra 2 bits for neighbors.
+ uint light_aniso; // 55555 light anisotropy, extra 2 bits for neighbors.
//total neighbours: 26
};
diff --git a/servers/rendering/renderer_rd/shaders/sdfgi_integrate.glsl b/servers/rendering/renderer_rd/shaders/sdfgi_integrate.glsl
index bc376e9522..eedd28959c 100644
--- a/servers/rendering/renderer_rd/shaders/sdfgi_integrate.glsl
+++ b/servers/rendering/renderer_rd/shaders/sdfgi_integrate.glsl
@@ -266,9 +266,9 @@ void main() {
} else if (params.sky_mode == SKY_MODE_SKY) {
#ifdef USE_CUBEMAP_ARRAY
- light.rgb = textureLod(samplerCubeArray(sky_irradiance, linear_sampler_mipmaps), vec4(ray_dir, 0.0), 2.0).rgb; //use second mipmap because we dont usually throw a lot of rays, so this compensates
+ light.rgb = textureLod(samplerCubeArray(sky_irradiance, linear_sampler_mipmaps), vec4(ray_dir, 0.0), 2.0).rgb; // Use second mipmap because we don't usually throw a lot of rays, so this compensates.
#else
- light.rgb = textureLod(samplerCube(sky_irradiance, linear_sampler_mipmaps), ray_dir, 2.0).rgb; //use second mipmap because we dont usually throw a lot of rays, so this compensates
+ light.rgb = textureLod(samplerCube(sky_irradiance, linear_sampler_mipmaps), ray_dir, 2.0).rgb; // Use second mipmap because we don't usually throw a lot of rays, so this compensates.
#endif
light.rgb *= params.sky_energy;
light.a = 0.0;
diff --git a/servers/rendering/renderer_rd/shaders/sdfgi_preprocess.glsl b/servers/rendering/renderer_rd/shaders/sdfgi_preprocess.glsl
index aa4ded146f..4d9fa85a74 100644
--- a/servers/rendering/renderer_rd/shaders/sdfgi_preprocess.glsl
+++ b/servers/rendering/renderer_rd/shaders/sdfgi_preprocess.glsl
@@ -101,7 +101,7 @@ layout(set = 0, binding = 10, std430) restrict buffer DispatchData {
dispatch_data;
struct ProcessVoxel {
- uint position; //xyz 7 bit packed, extra 11 bits for neigbours
+ uint position; // xyz 7 bit packed, extra 11 bits for neighbors.
uint albedo; //rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neibhbours
uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbours
uint light_aniso; //55555 light anisotropy, extra 2 bits for neighbours
@@ -134,7 +134,7 @@ layout(set = 0, binding = 5, std430) restrict buffer readonly DispatchData {
dispatch_data;
struct ProcessVoxel {
- uint position; //xyz 7 bit packed, extra 11 bits for neigbours
+ uint position; // xyz 7 bit packed, extra 11 bits for neighbors.
uint albedo; //rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neibhbours
uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbours
uint light_aniso; //55555 light anisotropy, extra 2 bits for neighbours
@@ -183,7 +183,7 @@ void main() {
ivec3 write_pos = read_pos + params.scroll;
if (any(lessThan(write_pos, ivec3(0))) || any(greaterThanEqual(write_pos, ivec3(params.grid_size)))) {
- return; //fits outside the 3D texture, dont do anything
+ return; // Fits outside the 3D texture, don't do anything.
}
uint albedo = ((src_process_voxels.data[index].albedo & 0x7FFF) << 1) | 1; //add solid bit
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp
index 2ade8454bb..83d1b33bf2 100644
--- a/servers/rendering/renderer_scene_cull.cpp
+++ b/servers/rendering/renderer_scene_cull.cpp
@@ -1259,7 +1259,7 @@ void RendererSceneCull::_update_instance_visibility_depth(Instance *p_instance)
}
if (cycle_detected) {
- ERR_PRINT("Cycle detected in the visibility dependecies tree.");
+ ERR_PRINT("Cycle detected in the visibility dependencies tree.");
for (Set<Instance *>::Element *E = traversed_nodes.front(); E; E = E->next()) {
Instance *instance = E->get();
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(instance->base_data);
@@ -3391,7 +3391,7 @@ void RendererSceneCull::render_probes() {
idx++;
}
- for (Instance *instance : probe->owner->scenario->directional_lights) {
+ for (const Instance *instance : probe->owner->scenario->directional_lights) {
InstanceLightData *instance_light = (InstanceLightData *)instance->base_data;
if (!instance->visible) {
continue;
@@ -3464,7 +3464,7 @@ void RendererSceneCull::render_probes() {
idx++;
}
- for (Instance *instance : probe->owner->scenario->directional_lights) {
+ for (const Instance *instance : probe->owner->scenario->directional_lights) {
InstanceLightData *instance_light = (InstanceLightData *)instance->base_data;
if (!instance->visible) {
continue;
@@ -3571,7 +3571,7 @@ void RendererSceneCull::render_particle_colliders() {
void RendererSceneCull::_update_instance_shader_parameters_from_material(Map<StringName, Instance::InstanceShaderParameter> &isparams, const Map<StringName, Instance::InstanceShaderParameter> &existing_isparams, RID p_material) {
List<RendererStorage::InstanceShaderParam> plist;
RSG::storage->material_get_instance_shader_parameters(p_material, &plist);
- for (RendererStorage::InstanceShaderParam &E : plist) {
+ for (const RendererStorage::InstanceShaderParam &E : plist) {
StringName name = E.info.name;
if (isparams.has(name)) {
if (isparams[name].info.type != E.info.type) {
diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp
index 3594939362..b298ad193b 100644
--- a/servers/rendering/rendering_device.cpp
+++ b/servers/rendering/rendering_device.cpp
@@ -38,23 +38,23 @@ RenderingDevice *RenderingDevice::get_singleton() {
return singleton;
}
-RenderingDevice::ShaderCompileFunction RenderingDevice::compile_function = nullptr;
+RenderingDevice::ShaderCompileToSPIRVFunction RenderingDevice::compile_to_spirv_function = nullptr;
RenderingDevice::ShaderCacheFunction RenderingDevice::cache_function = nullptr;
-RenderingDevice::ShaderGetCacheKeyFunction RenderingDevice::get_cache_key_function = nullptr;
+RenderingDevice::ShaderSPIRVGetCacheKeyFunction RenderingDevice::get_spirv_cache_key_function = nullptr;
-void RenderingDevice::shader_set_compile_function(ShaderCompileFunction p_function) {
- compile_function = p_function;
+void RenderingDevice::shader_set_compile_to_spirv_function(ShaderCompileToSPIRVFunction p_function) {
+ compile_to_spirv_function = p_function;
}
-void RenderingDevice::shader_set_cache_function(ShaderCacheFunction p_function) {
+void RenderingDevice::shader_set_spirv_cache_function(ShaderCacheFunction p_function) {
cache_function = p_function;
}
-void RenderingDevice::shader_set_get_cache_key_function(ShaderGetCacheKeyFunction p_function) {
- get_cache_key_function = p_function;
+void RenderingDevice::shader_set_get_cache_key_function(ShaderSPIRVGetCacheKeyFunction p_function) {
+ get_spirv_cache_key_function = p_function;
}
-Vector<uint8_t> RenderingDevice::shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error, bool p_allow_cache) {
+Vector<uint8_t> RenderingDevice::shader_compile_spirv_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error, bool p_allow_cache) {
if (p_allow_cache && cache_function) {
Vector<uint8_t> cache = cache_function(p_stage, p_source_code, p_language);
if (cache.size()) {
@@ -62,18 +62,24 @@ Vector<uint8_t> RenderingDevice::shader_compile_from_source(ShaderStage p_stage,
}
}
- ERR_FAIL_COND_V(!compile_function, Vector<uint8_t>());
+ ERR_FAIL_COND_V(!compile_to_spirv_function, Vector<uint8_t>());
- return compile_function(p_stage, p_source_code, p_language, r_error, &device_capabilities);
+ return compile_to_spirv_function(p_stage, p_source_code, p_language, r_error, &device_capabilities);
}
-String RenderingDevice::shader_get_cache_key() const {
- if (get_cache_key_function) {
- return get_cache_key_function(&device_capabilities);
+String RenderingDevice::shader_get_spirv_cache_key() const {
+ if (get_spirv_cache_key_function) {
+ return get_spirv_cache_key_function(&device_capabilities);
}
return String();
}
+RID RenderingDevice::shader_create_from_spirv(const Vector<ShaderStageSPIRVData> &p_spirv) {
+ Vector<uint8_t> bytecode = shader_compile_binary_from_spirv(p_spirv);
+ ERR_FAIL_COND_V(bytecode.size() == 0, RID());
+ return shader_create_from_bytecode(bytecode);
+}
+
RID RenderingDevice::_texture_create(const Ref<RDTextureFormat> &p_format, const Ref<RDTextureView> &p_view, const TypedArray<PackedByteArray> &p_data) {
ERR_FAIL_COND_V(p_format.is_null(), RID());
ERR_FAIL_COND_V(p_view.is_null(), RID());
@@ -170,40 +176,59 @@ RID RenderingDevice::_vertex_array_create(uint32_t p_vertex_count, VertexFormatI
return vertex_array_create(p_vertex_count, p_vertex_format, buffers);
}
-Ref<RDShaderBytecode> RenderingDevice::_shader_compile_from_source(const Ref<RDShaderSource> &p_source, bool p_allow_cache) {
- ERR_FAIL_COND_V(p_source.is_null(), Ref<RDShaderBytecode>());
+Ref<RDShaderSPIRV> RenderingDevice::_shader_compile_spirv_from_source(const Ref<RDShaderSource> &p_source, bool p_allow_cache) {
+ ERR_FAIL_COND_V(p_source.is_null(), Ref<RDShaderSPIRV>());
- Ref<RDShaderBytecode> bytecode;
+ Ref<RDShaderSPIRV> bytecode;
bytecode.instantiate();
for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) {
String error;
ShaderStage stage = ShaderStage(i);
- Vector<uint8_t> spirv = shader_compile_from_source(stage, p_source->get_stage_source(stage), p_source->get_language(), &error, p_allow_cache);
+ Vector<uint8_t> spirv = shader_compile_spirv_from_source(stage, p_source->get_stage_source(stage), p_source->get_language(), &error, p_allow_cache);
bytecode->set_stage_bytecode(stage, spirv);
bytecode->set_stage_compile_error(stage, error);
}
return bytecode;
}
-RID RenderingDevice::shader_create_from_bytecode(const Ref<RDShaderBytecode> &p_bytecode) {
- ERR_FAIL_COND_V(p_bytecode.is_null(), RID());
+Vector<uint8_t> RenderingDevice::_shader_compile_binary_from_spirv(const Ref<RDShaderSPIRV> &p_spirv) {
+ ERR_FAIL_COND_V(p_spirv.is_null(), Vector<uint8_t>());
- Vector<ShaderStageData> stage_data;
+ Vector<ShaderStageSPIRVData> stage_data;
for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) {
ShaderStage stage = ShaderStage(i);
- ShaderStageData sd;
+ ShaderStageSPIRVData sd;
sd.shader_stage = stage;
- String error = p_bytecode->get_stage_compile_error(stage);
- ERR_FAIL_COND_V_MSG(error != String(), RID(), "Can't create a shader from an errored bytecode. Check errors in source bytecode.");
- sd.spir_v = p_bytecode->get_stage_bytecode(stage);
+ String error = p_spirv->get_stage_compile_error(stage);
+ ERR_FAIL_COND_V_MSG(error != String(), Vector<uint8_t>(), "Can't create a shader from an errored bytecode. Check errors in source bytecode.");
+ sd.spir_v = p_spirv->get_stage_bytecode(stage);
if (sd.spir_v.is_empty()) {
continue;
}
stage_data.push_back(sd);
}
- return shader_create(stage_data);
+ return shader_compile_binary_from_spirv(stage_data);
+}
+
+RID RenderingDevice::_shader_create_from_spirv(const Ref<RDShaderSPIRV> &p_spirv) {
+ ERR_FAIL_COND_V(p_spirv.is_null(), RID());
+
+ Vector<ShaderStageSPIRVData> stage_data;
+ for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) {
+ ShaderStage stage = ShaderStage(i);
+ ShaderStageSPIRVData sd;
+ sd.shader_stage = stage;
+ String error = p_spirv->get_stage_compile_error(stage);
+ ERR_FAIL_COND_V_MSG(error != String(), RID(), "Can't create a shader from an errored bytecode. Check errors in source bytecode.");
+ sd.spir_v = p_spirv->get_stage_bytecode(stage);
+ if (sd.spir_v.is_empty()) {
+ continue;
+ }
+ stage_data.push_back(sd);
+ }
+ return shader_create_from_spirv(stage_data);
}
RID RenderingDevice::_uniform_set_create(const Array &p_uniforms, RID p_shader, uint32_t p_shader_set) {
@@ -366,8 +391,10 @@ void RenderingDevice::_bind_methods() {
ClassDB::bind_method(D_METHOD("index_buffer_create", "size_indices", "format", "data", "use_restart_indices"), &RenderingDevice::index_buffer_create, DEFVAL(Vector<uint8_t>()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("index_array_create", "index_buffer", "index_offset", "index_count"), &RenderingDevice::index_array_create);
- ClassDB::bind_method(D_METHOD("shader_compile_from_source", "shader_source", "allow_cache"), &RenderingDevice::_shader_compile_from_source, DEFVAL(true));
- ClassDB::bind_method(D_METHOD("shader_create", "shader_data"), &RenderingDevice::shader_create_from_bytecode);
+ ClassDB::bind_method(D_METHOD("shader_compile_spirv_from_source", "shader_source", "allow_cache"), &RenderingDevice::_shader_compile_spirv_from_source, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("shader_compile_binary_from_spirv", "spirv_data"), &RenderingDevice::_shader_compile_binary_from_spirv);
+ ClassDB::bind_method(D_METHOD("shader_create_from_spirv", "spirv_data"), &RenderingDevice::_shader_compile_binary_from_spirv);
+ ClassDB::bind_method(D_METHOD("shader_create_from_bytecode", "binary_data"), &RenderingDevice::shader_create_from_bytecode);
ClassDB::bind_method(D_METHOD("shader_get_vertex_input_attribute_mask", "shader"), &RenderingDevice::shader_get_vertex_input_attribute_mask);
ClassDB::bind_method(D_METHOD("uniform_buffer_create", "size_bytes", "data"), &RenderingDevice::uniform_buffer_create, DEFVAL(Vector<uint8_t>()));
diff --git a/servers/rendering/rendering_device.h b/servers/rendering/rendering_device.h
index 9a154ef7e9..eaf1ace798 100644
--- a/servers/rendering/rendering_device.h
+++ b/servers/rendering/rendering_device.h
@@ -41,7 +41,7 @@ class RDAttachmentFormat;
class RDSamplerState;
class RDVertexAttribute;
class RDShaderSource;
-class RDShaderBytecode;
+class RDShaderSPIRV;
class RDUniforms;
class RDPipelineRasterizationState;
class RDPipelineMultisampleState;
@@ -105,14 +105,14 @@ public:
bool supports_multiview = false; // If true this device supports multiview options
};
- typedef String (*ShaderGetCacheKeyFunction)(const Capabilities *p_capabilities);
- typedef Vector<uint8_t> (*ShaderCompileFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error, const Capabilities *p_capabilities);
+ typedef String (*ShaderSPIRVGetCacheKeyFunction)(const Capabilities *p_capabilities);
+ typedef Vector<uint8_t> (*ShaderCompileToSPIRVFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error, const Capabilities *p_capabilities);
typedef Vector<uint8_t> (*ShaderCacheFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language);
private:
- static ShaderCompileFunction compile_function;
+ static ShaderCompileToSPIRVFunction compile_to_spirv_function;
static ShaderCacheFunction cache_function;
- static ShaderGetCacheKeyFunction get_cache_key_function;
+ static ShaderSPIRVGetCacheKeyFunction get_spirv_cache_key_function;
static RenderingDevice *singleton;
@@ -651,24 +651,28 @@ public:
const Capabilities *get_device_capabilities() const { return &device_capabilities; };
- virtual Vector<uint8_t> shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language = SHADER_LANGUAGE_GLSL, String *r_error = nullptr, bool p_allow_cache = true);
- virtual String shader_get_cache_key() const;
+ virtual Vector<uint8_t> shader_compile_spirv_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language = SHADER_LANGUAGE_GLSL, String *r_error = nullptr, bool p_allow_cache = true);
+ virtual String shader_get_spirv_cache_key() const;
- static void shader_set_compile_function(ShaderCompileFunction p_function);
- static void shader_set_cache_function(ShaderCacheFunction p_function);
- static void shader_set_get_cache_key_function(ShaderGetCacheKeyFunction p_function);
+ static void shader_set_compile_to_spirv_function(ShaderCompileToSPIRVFunction p_function);
+ static void shader_set_spirv_cache_function(ShaderCacheFunction p_function);
+ static void shader_set_get_cache_key_function(ShaderSPIRVGetCacheKeyFunction p_function);
- struct ShaderStageData {
+ struct ShaderStageSPIRVData {
ShaderStage shader_stage;
Vector<uint8_t> spir_v;
- ShaderStageData() {
+ ShaderStageSPIRVData() {
shader_stage = SHADER_STAGE_VERTEX;
}
};
- RID shader_create_from_bytecode(const Ref<RDShaderBytecode> &p_bytecode);
- virtual RID shader_create(const Vector<ShaderStageData> &p_stages) = 0;
+ virtual String shader_get_binary_cache_key() const = 0;
+ virtual Vector<uint8_t> shader_compile_binary_from_spirv(const Vector<ShaderStageSPIRVData> &p_spirv) = 0;
+
+ virtual RID shader_create_from_spirv(const Vector<ShaderStageSPIRVData> &p_spirv);
+ virtual RID shader_create_from_bytecode(const Vector<uint8_t> &p_shader_binary) = 0;
+
virtual uint32_t shader_get_vertex_input_attribute_mask(RID p_shader) = 0;
/******************/
@@ -1194,7 +1198,9 @@ protected:
VertexFormatID _vertex_format_create(const TypedArray<RDVertexAttribute> &p_vertex_formats);
RID _vertex_array_create(uint32_t p_vertex_count, VertexFormatID p_vertex_format, const TypedArray<RID> &p_src_buffers);
- Ref<RDShaderBytecode> _shader_compile_from_source(const Ref<RDShaderSource> &p_source, bool p_allow_cache = true);
+ Ref<RDShaderSPIRV> _shader_compile_spirv_from_source(const Ref<RDShaderSource> &p_source, bool p_allow_cache = true);
+ Vector<uint8_t> _shader_compile_binary_from_spirv(const Ref<RDShaderSPIRV> &p_bytecode);
+ RID _shader_create_from_spirv(const Ref<RDShaderSPIRV> &p_spirv);
RID _uniform_set_create(const Array &p_uniforms, RID p_shader, uint32_t p_shader_set);
diff --git a/servers/rendering/rendering_device_binds.cpp b/servers/rendering/rendering_device_binds.cpp
index 2652edb1bc..fa3f2f3895 100644
--- a/servers/rendering/rendering_device_binds.cpp
+++ b/servers/rendering/rendering_device_binds.cpp
@@ -172,7 +172,7 @@ Error RDShaderFile::parse_versions_from_text(const String &p_text, const String
/* STEP 2, Compile the versions, add to shader file */
for (Map<StringName, String>::Element *E = version_texts.front(); E; E = E->next()) {
- Ref<RDShaderBytecode> bytecode;
+ Ref<RDShaderSPIRV> bytecode;
bytecode.instantiate();
for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) {
@@ -182,7 +182,7 @@ Error RDShaderFile::parse_versions_from_text(const String &p_text, const String
}
code = code.replace("VERSION_DEFINES", E->get());
String error;
- Vector<uint8_t> spirv = RenderingDevice::get_singleton()->shader_compile_from_source(RD::ShaderStage(i), code, RD::SHADER_LANGUAGE_GLSL, &error, false);
+ Vector<uint8_t> spirv = RenderingDevice::get_singleton()->shader_compile_spirv_from_source(RD::ShaderStage(i), code, RD::SHADER_LANGUAGE_GLSL, &error, false);
bytecode->set_stage_bytecode(RD::ShaderStage(i), spirv);
if (error != "") {
error += String() + "\n\nStage '" + stage_str[i] + "' source code: \n\n";
diff --git a/servers/rendering/rendering_device_binds.h b/servers/rendering/rendering_device_binds.h
index df1b40974f..ccc3e2fb39 100644
--- a/servers/rendering/rendering_device_binds.h
+++ b/servers/rendering/rendering_device_binds.h
@@ -263,8 +263,8 @@ protected:
}
};
-class RDShaderBytecode : public Resource {
- GDCLASS(RDShaderBytecode, Resource)
+class RDShaderSPIRV : public Resource {
+ GDCLASS(RDShaderSPIRV, Resource)
Vector<uint8_t> bytecode[RD::SHADER_STAGE_MAX];
String compile_error[RD::SHADER_STAGE_MAX];
@@ -280,6 +280,19 @@ public:
return bytecode[p_stage];
}
+ Vector<RD::ShaderStageSPIRVData> get_stages() const {
+ Vector<RD::ShaderStageSPIRVData> stages;
+ for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) {
+ if (bytecode[i].size()) {
+ RD::ShaderStageSPIRVData stage;
+ stage.shader_stage = RD::ShaderStage(i);
+ stage.spir_v = bytecode[i];
+ stages.push_back(stage);
+ }
+ }
+ return stages;
+ }
+
void set_stage_compile_error(RD::ShaderStage p_stage, const String &p_compile_error) {
ERR_FAIL_INDEX(p_stage, RD::SHADER_STAGE_MAX);
compile_error[p_stage] = p_compile_error;
@@ -292,11 +305,11 @@ public:
protected:
static void _bind_methods() {
- ClassDB::bind_method(D_METHOD("set_stage_bytecode", "stage", "bytecode"), &RDShaderBytecode::set_stage_bytecode);
- ClassDB::bind_method(D_METHOD("get_stage_bytecode", "stage"), &RDShaderBytecode::get_stage_bytecode);
+ ClassDB::bind_method(D_METHOD("set_stage_bytecode", "stage", "bytecode"), &RDShaderSPIRV::set_stage_bytecode);
+ ClassDB::bind_method(D_METHOD("get_stage_bytecode", "stage"), &RDShaderSPIRV::get_stage_bytecode);
- ClassDB::bind_method(D_METHOD("set_stage_compile_error", "stage", "compile_error"), &RDShaderBytecode::set_stage_compile_error);
- ClassDB::bind_method(D_METHOD("get_stage_compile_error", "stage"), &RDShaderBytecode::get_stage_compile_error);
+ ClassDB::bind_method(D_METHOD("set_stage_compile_error", "stage", "compile_error"), &RDShaderSPIRV::set_stage_compile_error);
+ ClassDB::bind_method(D_METHOD("get_stage_compile_error", "stage"), &RDShaderSPIRV::get_stage_compile_error);
ADD_GROUP("Bytecode", "bytecode_");
ADD_PROPERTYI(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "bytecode_vertex"), "set_stage_bytecode", "get_stage_bytecode", RD::SHADER_STAGE_VERTEX);
@@ -316,24 +329,29 @@ protected:
class RDShaderFile : public Resource {
GDCLASS(RDShaderFile, Resource)
- Map<StringName, Ref<RDShaderBytecode>> versions;
+ Map<StringName, Ref<RDShaderSPIRV>> versions;
String base_error;
public:
- void set_bytecode(const Ref<RDShaderBytecode> &p_bytecode, const StringName &p_version = StringName()) {
+ void set_bytecode(const Ref<RDShaderSPIRV> &p_bytecode, const StringName &p_version = StringName()) {
ERR_FAIL_COND(p_bytecode.is_null());
versions[p_version] = p_bytecode;
emit_changed();
}
- Ref<RDShaderBytecode> get_bytecode(const StringName &p_version = StringName()) const {
- ERR_FAIL_COND_V(!versions.has(p_version), Ref<RDShaderBytecode>());
+ Ref<RDShaderSPIRV> get_spirv(const StringName &p_version = StringName()) const {
+ ERR_FAIL_COND_V(!versions.has(p_version), Ref<RDShaderSPIRV>());
return versions[p_version];
}
+ Vector<RD::ShaderStageSPIRVData> get_spirv_stages(const StringName &p_version = StringName()) const {
+ ERR_FAIL_COND_V(!versions.has(p_version), Vector<RD::ShaderStageSPIRVData>());
+ return versions[p_version]->get_stages();
+ }
+
Vector<StringName> get_version_list() const {
Vector<StringName> vnames;
- for (Map<StringName, Ref<RDShaderBytecode>>::Element *E = versions.front(); E; E = E->next()) {
+ for (Map<StringName, Ref<RDShaderSPIRV>>::Element *E = versions.front(); E; E = E->next()) {
vnames.push_back(E->key());
}
vnames.sort_custom<StringName::AlphCompare>();
@@ -353,7 +371,7 @@ public:
if (base_error != "") {
ERR_PRINT("Error parsing shader '" + p_file + "':\n\n" + base_error);
} else {
- for (Map<StringName, Ref<RDShaderBytecode>>::Element *E = versions.front(); E; E = E->next()) {
+ for (Map<StringName, Ref<RDShaderSPIRV>>::Element *E = versions.front(); E; E = E->next()) {
for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) {
String error = E->get()->get_stage_compile_error(RD::ShaderStage(i));
if (error != String()) {
@@ -388,9 +406,9 @@ protected:
versions.clear();
List<Variant> keys;
p_versions.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
StringName name = E;
- Ref<RDShaderBytecode> bc = p_versions[E];
+ Ref<RDShaderSPIRV> bc = p_versions[E];
ERR_CONTINUE(bc.is_null());
versions[name] = bc;
}
@@ -400,7 +418,7 @@ protected:
static void _bind_methods() {
ClassDB::bind_method(D_METHOD("set_bytecode", "bytecode", "version"), &RDShaderFile::set_bytecode, DEFVAL(StringName()));
- ClassDB::bind_method(D_METHOD("get_bytecode", "version"), &RDShaderFile::get_bytecode, DEFVAL(StringName()));
+ ClassDB::bind_method(D_METHOD("get_spirv", "version"), &RDShaderFile::get_spirv, DEFVAL(StringName()));
ClassDB::bind_method(D_METHOD("get_version_list"), &RDShaderFile::get_version_list);
ClassDB::bind_method(D_METHOD("set_base_error", "error"), &RDShaderFile::set_base_error);
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 2db246c31f..baa5381554 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -912,6 +912,8 @@ void ShaderLanguage::clear() {
completion_class = SubClassTag::TAG_GLOBAL;
completion_struct = StringName();
+ unknown_varying_usages.clear();
+
#ifdef DEBUG_ENABLED
used_constants.clear();
used_varyings.clear();
@@ -2818,6 +2820,20 @@ bool ShaderLanguage::is_token_operator(TokenType p_type) {
p_type == TK_COLON);
}
+bool ShaderLanguage::is_token_operator_assign(TokenType p_type) {
+ return (p_type == TK_OP_ASSIGN ||
+ p_type == TK_OP_ASSIGN_ADD ||
+ p_type == TK_OP_ASSIGN_SUB ||
+ p_type == TK_OP_ASSIGN_MUL ||
+ p_type == TK_OP_ASSIGN_DIV ||
+ p_type == TK_OP_ASSIGN_MOD ||
+ p_type == TK_OP_ASSIGN_SHIFT_LEFT ||
+ p_type == TK_OP_ASSIGN_SHIFT_RIGHT ||
+ p_type == TK_OP_ASSIGN_BIT_AND ||
+ p_type == TK_OP_ASSIGN_BIT_OR ||
+ p_type == TK_OP_ASSIGN_BIT_XOR);
+}
+
bool ShaderLanguage::convert_constant(ConstantNode *p_constant, DataType p_to_type, ConstantNode::Value *p_value) {
if (p_constant->datatype == p_to_type) {
if (p_value) {
@@ -3324,8 +3340,7 @@ bool ShaderLanguage::_validate_varying_assign(ShaderNode::Varying &p_varying, St
p_varying.stage = ShaderNode::Varying::STAGE_FRAGMENT;
}
break;
- case ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT:
- case ShaderNode::Varying::STAGE_VERTEX_TO_LIGHT:
+ case ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT_LIGHT:
case ShaderNode::Varying::STAGE_VERTEX:
if (current_function == varying_function_names.fragment) {
*r_message = RTR("Varyings which assigned in 'vertex' function may not be reassigned in 'fragment' or 'light'.");
@@ -3348,13 +3363,14 @@ bool ShaderLanguage::_validate_varying_assign(ShaderNode::Varying &p_varying, St
bool ShaderLanguage::_validate_varying_using(ShaderNode::Varying &p_varying, String *r_message) {
switch (p_varying.stage) {
case ShaderNode::Varying::STAGE_UNKNOWN:
- *r_message = RTR("Varying must be assigned before using!");
- return false;
+ VaryingUsage usage;
+ usage.var = &p_varying;
+ usage.line = tk_line;
+ unknown_varying_usages.push_back(usage);
+ break;
case ShaderNode::Varying::STAGE_VERTEX:
- if (current_function == varying_function_names.fragment) {
- p_varying.stage = ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT;
- } else if (current_function == varying_function_names.light) {
- p_varying.stage = ShaderNode::Varying::STAGE_VERTEX_TO_LIGHT;
+ if (current_function == varying_function_names.fragment || current_function == varying_function_names.light) {
+ p_varying.stage = ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT_LIGHT;
}
break;
case ShaderNode::Varying::STAGE_FRAGMENT:
@@ -3362,24 +3378,25 @@ bool ShaderLanguage::_validate_varying_using(ShaderNode::Varying &p_varying, Str
p_varying.stage = ShaderNode::Varying::STAGE_FRAGMENT_TO_LIGHT;
}
break;
- case ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT:
- if (current_function == varying_function_names.light) {
- *r_message = RTR("Varying must only be used in two different stages, which can be 'vertex' 'fragment' and 'light'");
- return false;
- }
- break;
- case ShaderNode::Varying::STAGE_VERTEX_TO_LIGHT:
- if (current_function == varying_function_names.fragment) {
- *r_message = RTR("Varying must only be used in two different stages, which can be 'vertex' 'fragment' and 'light'");
- return false;
- }
- break;
default:
break;
}
return true;
}
+bool ShaderLanguage::_check_varying_usages(int *r_error_line, String *r_error_message) const {
+ for (const List<ShaderLanguage::VaryingUsage>::Element *E = unknown_varying_usages.front(); E; E = E->next()) {
+ ShaderNode::Varying::Stage stage = E->get().var->stage;
+ if (stage != ShaderNode::Varying::STAGE_UNKNOWN && stage != ShaderNode::Varying::STAGE_VERTEX && stage != ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT_LIGHT) {
+ *r_error_line = E->get().line;
+ *r_error_message = RTR("Fragment-stage varying could not been accessed in custom function!");
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool ShaderLanguage::_check_node_constness(const Node *p_node) const {
switch (p_node->type) {
case Node::TYPE_OPERATOR: {
@@ -4237,7 +4254,8 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
Token next_token = _get_token();
_set_tkpos(prev_pos);
String error;
- if (next_token.type == TK_OP_ASSIGN) {
+
+ if (is_token_operator_assign(next_token.type)) {
if (!_validate_varying_assign(shader->varyings[identifier], &error)) {
_set_error(error);
return nullptr;
@@ -4448,7 +4466,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
String member_name = String(ident.ptr());
if (shader->structs.has(st)) {
StructNode *n = shader->structs[st].shader_struct;
- for (MemberNode *E : n->members) {
+ for (const MemberNode *E : n->members) {
if (String(E->name) == member_name) {
member_type = E->datatype;
array_size = E->array_size;
@@ -4778,10 +4796,12 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
String member_struct_name;
if (expr->get_array_size() > 0) {
- uint32_t index_constant = static_cast<ConstantNode *>(index)->values[0].uint;
- if (index_constant >= (uint32_t)expr->get_array_size()) {
- _set_error(vformat("Index [%s] out of range [%s..%s]", index_constant, 0, expr->get_array_size() - 1));
- return nullptr;
+ if (index->type == Node::TYPE_CONSTANT) {
+ uint32_t index_constant = static_cast<ConstantNode *>(index)->values[0].uint;
+ if (index_constant >= (uint32_t)expr->get_array_size()) {
+ _set_error(vformat("Index [%s] out of range [%s..%s]", index_constant, 0, expr->get_array_size() - 1));
+ return nullptr;
+ }
}
member_type = expr->get_datatype();
if (member_type == TYPE_STRUCT) {
@@ -7875,6 +7895,15 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
tk = _get_token();
}
+
+ int error_line;
+ String error_message;
+ if (!_check_varying_usages(&error_line, &error_message)) {
+ _set_tkpos({ 0, error_line });
+ _set_error(error_message);
+ return ERR_PARSE_ERROR;
+ }
+
return OK;
}
diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h
index a91fa57a8e..c02d6c47ec 100644
--- a/servers/rendering/shader_language.h
+++ b/servers/rendering/shader_language.h
@@ -646,10 +646,9 @@ public:
struct Varying {
enum Stage {
STAGE_UNKNOWN,
- STAGE_VERTEX, // transition stage to STAGE_VERTEX_TO_FRAGMENT or STAGE_VERTEX_TO_LIGHT, emits error if they are not used
- STAGE_FRAGMENT, // transition stage to STAGE_FRAGMENT_TO_LIGHT, emits error if it's not used
- STAGE_VERTEX_TO_FRAGMENT,
- STAGE_VERTEX_TO_LIGHT,
+ STAGE_VERTEX, // transition stage to STAGE_VERTEX_TO_FRAGMENT_LIGHT, emits warning if it's not used
+ STAGE_FRAGMENT, // transition stage to STAGE_FRAGMENT_TO_LIGHT, emits warning if it's not used
+ STAGE_VERTEX_TO_FRAGMENT_LIGHT,
STAGE_FRAGMENT_TO_LIGHT,
};
@@ -767,6 +766,7 @@ public:
static String get_datatype_name(DataType p_type);
static bool is_token_nonvoid_datatype(TokenType p_type);
static bool is_token_operator(TokenType p_type);
+ static bool is_token_operator_assign(TokenType p_type);
static bool convert_constant(ConstantNode *p_constant, DataType p_to_type, ConstantNode::Value *p_value = nullptr);
static DataType get_scalar_type(DataType p_type);
@@ -876,6 +876,14 @@ private:
VaryingFunctionNames varying_function_names;
+ struct VaryingUsage {
+ ShaderNode::Varying *var;
+ int line;
+ };
+ List<VaryingUsage> unknown_varying_usages;
+
+ bool _check_varying_usages(int *r_error_line, String *r_error_message) const;
+
TkPos _get_tkpos() {
TkPos tkp;
tkp.char_idx = char_idx;
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index 9377075e76..1f01f47fff 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -972,7 +972,7 @@ Error RenderingServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surfa
if (index_array_len) {
List<Variant> keys;
p_lods.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
float distance = E;
ERR_CONTINUE(distance <= 0.0);
Vector<int> indices = p_lods[E];
diff --git a/servers/xr/xr_interface.h b/servers/xr/xr_interface.h
index 6031bd7003..6b248c9554 100644
--- a/servers/xr/xr_interface.h
+++ b/servers/xr/xr_interface.h
@@ -41,7 +41,7 @@ struct BlitToScreen;
/**
@author Bastiaan Olij <mux213@gmail.com>
- The XR interface is a template class ontop of which we build interface to different AR, VR and tracking SDKs.
+ The XR interface is a template class on top of which we build interface to different AR, VR and tracking SDKs.
The idea is that we subclass this class, implement the logic, and then instantiate a singleton of each interface
when Godot starts. These instances do not initialize themselves but register themselves with the AR/VR server.
diff --git a/tests/test_class_db.h b/tests/test_class_db.h
index e67b2de66a..ea680da5d6 100644
--- a/tests/test_class_db.h
+++ b/tests/test_class_db.h
@@ -559,7 +559,7 @@ void add_exposed_classes(Context &r_context) {
ClassDB::get_method_list(class_name, &method_list, true);
method_list.sort();
- for (MethodInfo &E : method_list) {
+ for (const MethodInfo &E : method_list) {
const MethodInfo &method_info = E;
int argc = method_info.arguments.size();
@@ -827,7 +827,7 @@ void add_global_enums(Context &r_context) {
}
}
- for (EnumData &E : r_context.global_enums) {
+ for (const EnumData &E : r_context.global_enums) {
r_context.enum_types.push_back(E.name);
}
}
@@ -838,7 +838,7 @@ void add_global_enums(Context &r_context) {
hardcoded_enums.push_back("Vector2i.Axis");
hardcoded_enums.push_back("Vector3.Axis");
hardcoded_enums.push_back("Vector3i.Axis");
- for (StringName &E : hardcoded_enums) {
+ for (const StringName &E : hardcoded_enums) {
// These enums are not generated and must be written manually (e.g.: Vector3.Axis)
// Here, we assume core types do not begin with underscore
r_context.enum_types.push_back(E);
diff --git a/tests/test_math.cpp b/tests/test_math.cpp
index d2960333cc..d0b9fdef4b 100644
--- a/tests/test_math.cpp
+++ b/tests/test_math.cpp
@@ -549,7 +549,7 @@ MainLoop *test() {
List<StringName> tl;
ClassDB::get_class_list(&tl);
- for (StringName &E : tl) {
+ for (const StringName &E : tl) {
Vector<uint8_t> m5b = E.operator String().md5_buffer();
hashes.push_back(hashes.size());
}
diff --git a/tests/test_physics_2d.cpp b/tests/test_physics_2d.cpp
index a9e2e92b34..40dc74e89c 100644
--- a/tests/test_physics_2d.cpp
+++ b/tests/test_physics_2d.cpp
@@ -386,7 +386,7 @@ public:
//_add_plane(Vector2(-1,0).normalized(),-600);
}
- virtual bool process(float p_time) override {
+ virtual bool process(double p_time) override {
return false;
}
virtual void finalize() override {
diff --git a/tests/test_physics_3d.cpp b/tests/test_physics_3d.cpp
index 4488e4bf64..ed49b60c71 100644
--- a/tests/test_physics_3d.cpp
+++ b/tests/test_physics_3d.cpp
@@ -313,7 +313,7 @@ public:
test_fall();
quit = false;
}
- virtual bool physics_process(float p_time) override {
+ virtual bool physics_process(double p_time) override {
if (mover.is_valid()) {
static real_t joy_speed = 10;
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
@@ -399,7 +399,7 @@ public:
create_static_plane(Plane(Vector3(0, 1, 0), -1));
}
- virtual bool process(float p_time) override {
+ virtual bool process(double p_time) override {
return false;
}
diff --git a/tests/test_render.cpp b/tests/test_render.cpp
index 66fd04dbdd..beff86dd83 100644
--- a/tests/test_render.cpp
+++ b/tests/test_render.cpp
@@ -199,7 +199,7 @@ public:
ofs = 0;
quit = false;
}
- virtual bool iteration(float p_time) {
+ virtual bool iteration(double p_time) {
RenderingServer *vs = RenderingServer::get_singleton();
//Transform3D t;
//t.rotate(Vector3(0, 1, 0), ofs);
@@ -210,7 +210,7 @@ public:
//return quit;
- for (InstanceInfo &E : instances) {
+ for (const InstanceInfo &E : instances) {
Transform3D pre(Basis(E.rot_axis, ofs), Vector3());
vs->instance_set_transform(E.instance, pre * E.base);
/*
@@ -223,7 +223,7 @@ public:
return quit;
}
- virtual bool idle(float p_time) {
+ virtual bool idle(double p_time) {
return quit;
}