From 182541b7bcce92426cff5b80624ea1104252ead0 Mon Sep 17 00:00:00 2001 From: GeneralProtectionFault Date: Thu, 12 Mar 2026 03:07:36 -0400 Subject: [PATCH 1/3] Make existing function comments doxygen & format all TODOs to @todo, etc... update doxygen files & .gitignore. --- .gitignore | 3 +- core/config/engine.cpp | 6 + core/config/engine.h | 8 +- core/config/project_settings.cpp | 47 +- core/config/project_settings.h | 58 +- core/core_bind.cpp | 12 +- core/core_bind.h | 32 +- core/core_constants.cpp | 10 +- core/core_constants.h | 6 + core/core_globals.h | 11 +- core/core_string_names.h | 8 +- core/crypto/aes_context.cpp | 6 + core/crypto/aes_context.h | 6 + core/crypto/crypto.cpp | 8 +- core/crypto/crypto.h | 12 +- core/crypto/crypto_core.cpp | 6 + core/crypto/crypto_core.h | 6 + core/crypto/hashing_context.cpp | 6 + core/crypto/hashing_context.h | 6 + core/debugger/debugger_marshalls.cpp | 6 + core/debugger/debugger_marshalls.h | 6 + core/debugger/engine_debugger.cpp | 6 + core/debugger/engine_debugger.h | 9 +- core/debugger/engine_profiler.cpp | 6 + core/debugger/engine_profiler.h | 6 + core/debugger/local_debugger.cpp | 10 +- core/debugger/local_debugger.h | 6 + core/debugger/remote_debugger.cpp | 9 +- core/debugger/remote_debugger.h | 8 + core/debugger/remote_debugger_peer.cpp | 6 + core/debugger/remote_debugger_peer.h | 8 +- core/debugger/script_debugger.cpp | 8 +- core/debugger/script_debugger.h | 6 + core/doc_data.cpp | 6 + core/doc_data.h | 8 +- core/error/error_list.cpp | 6 + core/error/error_list.h | 10 +- core/error/error_macros.cpp | 9 +- core/error/error_macros.h | 88 +- core/extension/extension_api_dump.cpp | 9 +- core/extension/extension_api_dump.h | 6 + core/extension/gdextension.cpp | 8 +- core/extension/gdextension.h | 10 +- core/extension/gdextension_interface.cpp | 8 +- core/extension/gdextension_interface.h | 301 ++-- core/extension/gdextension_library_loader.cpp | 6 + core/extension/gdextension_library_loader.h | 8 +- core/extension/gdextension_loader.h | 6 + core/extension/gdextension_manager.cpp | 10 +- core/extension/gdextension_manager.h | 6 + .../gdextension_special_compat_hashes.cpp | 6 + .../gdextension_special_compat_hashes.h | 13 +- core/input/default_controller_mappings.h | 6 + core/input/input.cpp | 23 +- core/input/input.h | 37 +- core/input/input_enums.h | 14 +- core/input/input_event.cpp | 6 + core/input/input_event.h | 18 +- core/input/input_event_codec.cpp | 8 +- core/input/input_event_codec.h | 8 +- core/input/input_map.cpp | 6 + core/input/input_map.h | 10 +- core/input/shortcut.cpp | 6 + core/input/shortcut.h | 6 + core/io/compression.cpp | 11 +- core/io/compression.h | 13 +- core/io/config_file.cpp | 6 + core/io/config_file.h | 6 + core/io/dir_access.cpp | 10 +- core/io/dir_access.h | 14 +- core/io/dtls_server.cpp | 6 + core/io/dtls_server.h | 6 + core/io/file_access.cpp | 9 +- core/io/file_access.h | 22 +- core/io/file_access_compressed.cpp | 6 + core/io/file_access_compressed.h | 14 +- core/io/file_access_encrypted.cpp | 6 + core/io/file_access_encrypted.h | 14 +- core/io/file_access_memory.cpp | 6 + core/io/file_access_memory.h | 10 +- core/io/file_access_pack.cpp | 6 + core/io/file_access_pack.h | 15 +- core/io/file_access_zip.cpp | 7 +- core/io/file_access_zip.h | 12 +- core/io/http_client.cpp | 6 + core/io/http_client.h | 24 +- core/io/http_client_tcp.cpp | 6 + core/io/http_client_tcp.h | 18 +- core/io/image.cpp | 37 +- core/io/image.h | 129 +- core/io/image_frames.cpp | 6 + core/io/image_frames.h | 12 +- core/io/image_frames_loader.cpp | 6 + core/io/image_frames_loader.h | 6 + core/io/image_loader.cpp | 6 + core/io/image_loader.h | 6 + core/io/ip.cpp | 6 + core/io/ip.h | 8 +- core/io/ip_address.cpp | 6 + core/io/ip_address.h | 8 +- core/io/json.cpp | 6 + core/io/json.h | 8 +- core/io/logger.cpp | 8 +- core/io/logger.h | 6 + core/io/marshalls.cpp | 32 +- core/io/marshalls.h | 10 + core/io/missing_resource.cpp | 6 + core/io/missing_resource.h | 6 + core/io/net_socket.cpp | 6 + core/io/net_socket.h | 8 +- core/io/packed_data_container.cpp | 6 + core/io/packed_data_container.h | 6 + core/io/packet_peer.cpp | 6 + core/io/packet_peer.h | 12 +- core/io/packet_peer_dtls.cpp | 6 + core/io/packet_peer_dtls.h | 6 + core/io/packet_peer_udp.cpp | 11 +- core/io/packet_peer_udp.h | 12 +- core/io/pck_packer.cpp | 6 + core/io/pck_packer.h | 6 + core/io/plist.cpp | 9 +- core/io/plist.h | 14 +- core/io/remote_filesystem_client.cpp | 10 +- core/io/remote_filesystem_client.h | 12 +- core/io/resource.cpp | 26 +- core/io/resource.h | 28 +- core/io/resource_format_binary.cpp | 8 +- core/io/resource_format_binary.h | 12 +- core/io/resource_importer.cpp | 8 +- core/io/resource_importer.h | 8 +- core/io/resource_loader.cpp | 31 +- core/io/resource_loader.h | 28 +- core/io/resource_saver.cpp | 8 +- core/io/resource_saver.h | 8 +- core/io/resource_uid.cpp | 13 +- core/io/resource_uid.h | 10 +- core/io/stream_peer.cpp | 10 +- core/io/stream_peer.h | 10 +- core/io/stream_peer_gzip.cpp | 6 + core/io/stream_peer_gzip.h | 8 +- core/io/stream_peer_tcp.cpp | 6 + core/io/stream_peer_tcp.h | 14 +- core/io/stream_peer_tls.cpp | 6 + core/io/stream_peer_tls.h | 6 + core/io/tcp_server.cpp | 6 + core/io/tcp_server.h | 8 +- core/io/translation_loader_po.cpp | 6 + core/io/translation_loader_po.h | 6 + core/io/udp_server.cpp | 6 + core/io/udp_server.h | 6 + core/io/xml_parser.cpp | 7 +- core/io/xml_parser.h | 14 +- core/io/zip_io.cpp | 6 + core/io/zip_io.h | 8 +- core/math/a_star.cpp | 6 + core/math/a_star.h | 16 +- core/math/a_star_grid_2d.cpp | 8 +- core/math/a_star_grid_2d.h | 12 +- core/math/aabb.cpp | 6 + core/math/aabb.h | 25 +- core/math/audio_frame.h | 8 +- core/math/basis.cpp | 101 +- core/math/basis.h | 68 +- core/math/bvh.h | 116 +- core/math/bvh_abb.h | 20 +- core/math/bvh_tree.h | 50 +- core/math/color.cpp | 6 + core/math/color.h | 6 + core/math/convex_hull.cpp | 32 +- core/math/convex_hull.h | 66 +- core/math/delaunay_2d.h | 6 + core/math/delaunay_3d.h | 13 +- core/math/disjoint_set.h | 8 +- core/math/dynamic_bvh.cpp | 9 +- core/math/dynamic_bvh.h | 9 + core/math/expression.cpp | 6 + core/math/expression.h | 6 + core/math/face3.cpp | 6 + core/math/face3.h | 6 + core/math/geometry_2d.cpp | 16 +- core/math/geometry_2d.h | 23 +- core/math/geometry_3d.cpp | 10 +- core/math/geometry_3d.h | 29 +- core/math/math_defs.h | 8 +- core/math/math_fieldwise.cpp | 6 + core/math/math_fieldwise.h | 6 + core/math/math_funcs.cpp | 8 +- core/math/math_funcs.h | 34 +- core/math/plane.cpp | 6 + core/math/plane.h | 22 +- core/math/projection.cpp | 44 +- core/math/projection.h | 42 + core/math/quaternion.cpp | 10 +- core/math/quaternion.h | 11 + core/math/quick_hull.cpp | 6 + core/math/quick_hull.h | 6 + core/math/random_number_generator.cpp | 10 +- core/math/random_number_generator.h | 6 + core/math/random_pcg.cpp | 6 + core/math/random_pcg.h | 38 +- core/math/rect2.cpp | 6 + core/math/rect2.h | 12 +- core/math/rect2i.cpp | 6 + core/math/rect2i.h | 8 +- core/math/static_raycaster.cpp | 6 + core/math/static_raycaster.h | 10 +- core/math/transform_2d.cpp | 16 +- core/math/transform_2d.h | 45 +- core/math/transform_3d.cpp | 14 +- core/math/transform_3d.h | 43 +- core/math/transform_interpolator.cpp | 24 +- core/math/transform_interpolator.h | 21 +- core/math/triangle_mesh.cpp | 8 +- core/math/triangle_mesh.h | 13 +- core/math/triangulate.cpp | 8 +- core/math/triangulate.h | 20 +- core/math/vector2.cpp | 7 +- core/math/vector2.h | 15 +- core/math/vector2i.cpp | 6 + core/math/vector2i.h | 11 +- core/math/vector3.cpp | 6 + core/math/vector3.h | 43 +- core/math/vector3i.cpp | 6 + core/math/vector3i.h | 20 +- core/math/vector4.cpp | 6 + core/math/vector4.h | 6 + core/math/vector4i.cpp | 6 + core/math/vector4i.h | 15 +- core/object/callable_method_pointer.cpp | 6 + core/object/callable_method_pointer.h | 14 +- core/object/class_db.cpp | 12 +- core/object/class_db.h | 25 +- core/object/message_queue.cpp | 10 +- core/object/message_queue.h | 12 +- core/object/method_bind.cpp | 10 +- core/object/method_bind.h | 16 +- core/object/object.cpp | 24 +- core/object/object.h | 110 +- core/object/object_id.h | 14 +- core/object/ref_counted.cpp | 6 + core/object/ref_counted.h | 22 +- core/object/script_backtrace.cpp | 6 + core/object/script_backtrace.h | 6 + core/object/script_instance.cpp | 7 +- core/object/script_instance.h | 15 +- core/object/script_language.cpp | 12 +- core/object/script_language.h | 80 +- core/object/script_language_extension.cpp | 6 + core/object/script_language_extension.h | 14 +- core/object/undo_redo.cpp | 6 + core/object/undo_redo.h | 6 + core/object/worker_thread_pool.cpp | 20 +- core/object/worker_thread_pool.h | 33 +- core/os/condition_variable.h | 17 +- core/os/keyboard.cpp | 6 + core/os/keyboard.h | 26 +- core/os/main_loop.cpp | 6 + core/os/main_loop.h | 8 +- core/os/memory.cpp | 6 + core/os/memory.h | 57 +- core/os/midi_driver.cpp | 6 + core/os/midi_driver.h | 33 +- core/os/mutex.cpp | 6 + core/os/mutex.h | 14 +- core/os/os.cpp | 23 +- core/os/os.h | 43 +- core/os/rw_lock.h | 18 +- core/os/safe_binary_mutex.h | 26 +- core/os/semaphore.h | 8 +- core/os/shared_object.h | 6 + core/os/spin_lock.h | 12 +- core/os/thread.cpp | 6 + core/os/thread.h | 22 +- core/os/thread_safe.cpp | 6 + core/os/thread_safe.h | 6 + core/os/time.cpp | 12 +- core/os/time.h | 36 +- core/os/time_enums.h | 10 +- core/register_core_types.cpp | 8 +- core/register_core_types.h | 6 + core/string/alt_codes.h | 9 +- core/string/char_utils.h | 6 + core/string/fuzzy_search.cpp | 18 +- core/string/fuzzy_search.h | 13 +- core/string/locales.h | 83 +- core/string/node_path.cpp | 6 + core/string/node_path.h | 8 +- core/string/optimized_translation.cpp | 11 +- core/string/optimized_translation.h | 22 +- core/string/print_string.cpp | 6 + core/string/print_string.h | 8 +- core/string/string_buffer.h | 6 + core/string/string_builder.cpp | 6 + core/string/string_builder.h | 10 +- core/string/string_name.cpp | 6 + core/string/string_name.h | 15 +- core/string/translation.cpp | 6 + core/string/translation.h | 6 + core/string/translation_domain.cpp | 7 +- core/string/translation_domain.h | 11 +- core/string/translation_po.cpp | 25 +- core/string/translation_po.h | 38 +- core/string/translation_server.cpp | 7 +- core/string/translation_server.h | 7 + core/string/ucaps.h | 8 +- core/string/ustring.cpp | 125 +- core/string/ustring.h | 206 ++- core/templates/a_hash_map.cpp | 6 + core/templates/a_hash_map.h | 26 +- core/templates/bin_sorted_array.h | 8 +- core/templates/bit_field.h | 12 +- core/templates/command_queue_mt.cpp | 6 + core/templates/command_queue_mt.h | 10 +- core/templates/cowdata.h | 28 +- core/templates/fixed_vector.h | 15 +- core/templates/hash_map.h | 19 +- core/templates/hash_set.h | 11 +- core/templates/hashfuncs.h | 21 +- core/templates/interpolated_property.cpp | 6 + core/templates/interpolated_property.h | 25 +- core/templates/list.h | 19 +- core/templates/local_vector.h | 14 +- core/templates/lru.h | 6 + core/templates/paged_allocator.h | 10 +- core/templates/paged_array.h | 27 +- core/templates/pair.h | 10 +- core/templates/pass_func.h | 6 + core/templates/pooled_list.h | 69 +- core/templates/rb_map.h | 17 +- core/templates/rb_set.h | 17 +- core/templates/rid.h | 6 + core/templates/rid_owner.cpp | 6 + core/templates/rid_owner.h | 28 +- core/templates/ring_buffer.h | 6 + core/templates/safe_list.h | 27 +- core/templates/safe_refcount.h | 40 +- core/templates/self_list.h | 10 +- core/templates/simple_type.h | 6 + core/templates/sort_array.h | 10 +- core/templates/sort_list.h | 6 + core/templates/span.h | 34 +- core/templates/tuple.h | 85 +- core/templates/vector.h | 23 +- core/templates/vset.h | 6 + core/typedefs.h | 52 +- core/variant/array.cpp | 8 +- core/variant/array.h | 8 +- core/variant/binder_common.h | 19 +- core/variant/callable.cpp | 8 +- core/variant/callable.h | 43 +- core/variant/callable_bind.cpp | 6 + core/variant/callable_bind.h | 6 + core/variant/container_type_validate.h | 8 +- core/variant/dictionary.cpp | 16 +- core/variant/dictionary.h | 6 + core/variant/method_ptrcall.h | 41 +- core/variant/native_ptr.h | 6 + core/variant/type_info.h | 18 +- core/variant/typed_array.h | 9 +- core/variant/typed_dictionary.h | 9 +- core/variant/variant.cpp | 13 +- core/variant/variant.h | 55 +- core/variant/variant_call.cpp | 6 + core/variant/variant_callable.cpp | 6 + core/variant/variant_callable.h | 6 + core/variant/variant_construct.cpp | 6 + core/variant/variant_construct.h | 6 + core/variant/variant_deep_duplicate.h | 12 +- core/variant/variant_destruct.cpp | 6 + core/variant/variant_destruct.h | 6 + core/variant/variant_internal.h | 35 +- core/variant/variant_op.cpp | 6 + core/variant/variant_op.h | 6 + core/variant/variant_parser.cpp | 13 +- core/variant/variant_parser.h | 6 + core/variant/variant_setget.cpp | 6 + core/variant/variant_setget.h | 6 + core/variant/variant_utility.cpp | 6 + core/variant/variant_utility.h | 6 + core/version.h | 70 +- doc/Doxyfile | 1549 ++++++++++++----- .../accessibility_driver_accesskit.cpp | 10 +- .../accessibility_driver_accesskit.h | 6 + .../dynwrappers/accesskit-dll_wrap.h | 6 + .../dynwrappers/accesskit-dylib_wrap.h | 6 + .../accesskit/dynwrappers/accesskit-so_wrap.h | 6 + drivers/alsa/asound-so_wrap.h | 6 + drivers/alsa/audio_driver_alsa.cpp | 14 +- drivers/alsa/audio_driver_alsa.h | 6 + drivers/alsamidi/midi_driver_alsamidi.cpp | 6 + drivers/alsamidi/midi_driver_alsamidi.h | 8 +- drivers/apple/foundation_helpers.h | 12 +- drivers/apple/joypad_apple.h | 6 + drivers/apple/os_log_logger.cpp | 6 + drivers/apple/os_log_logger.h | 6 + drivers/apple/thread_apple.cpp | 8 +- drivers/apple/thread_apple.h | 12 +- drivers/apple_embedded/app_delegate_service.h | 6 + drivers/apple_embedded/apple_embedded.h | 6 + .../display_layer_apple_embedded.h | 6 + .../display_server_apple_embedded.h | 23 +- drivers/apple_embedded/godot_app_delegate.h | 6 + .../godot_view_apple_embedded.h | 6 + drivers/apple_embedded/godot_view_renderer.h | 6 + .../key_mapping_apple_embedded.h | 6 + drivers/apple_embedded/keyboard_input_view.h | 6 + drivers/apple_embedded/main_utilities.h | 6 + drivers/apple_embedded/os_apple_embedded.h | 6 + drivers/apple_embedded/platform_config.h | 6 + ...ing_context_driver_vulkan_apple_embedded.h | 6 + drivers/apple_embedded/tts_apple_embedded.h | 6 + drivers/apple_embedded/view_controller.h | 6 + drivers/coreaudio/audio_driver_coreaudio.h | 6 + drivers/coremidi/midi_driver_coremidi.h | 6 + drivers/d3d12/d3d12_godot_nir_bridge.h | 12 +- drivers/d3d12/d3d12_hooks.cpp | 6 + drivers/d3d12/d3d12_hooks.h | 6 + drivers/d3d12/d3d12ma.cpp | 10 +- drivers/d3d12/dxil_hash.cpp | 7 +- drivers/d3d12/dxil_hash.h | 6 + .../d3d12/rendering_context_driver_d3d12.cpp | 16 +- .../d3d12/rendering_context_driver_d3d12.h | 8 + .../d3d12/rendering_device_driver_d3d12.cpp | 44 +- drivers/d3d12/rendering_device_driver_d3d12.h | 98 +- .../rendering_shader_container_d3d12.cpp | 13 +- .../d3d12/rendering_shader_container_d3d12.h | 11 +- drivers/egl/egl_manager.cpp | 7 +- drivers/egl/egl_manager.h | 17 +- drivers/gles3/effects/copy_effects.cpp | 8 +- drivers/gles3/effects/copy_effects.h | 17 +- drivers/gles3/effects/cubemap_filter.cpp | 6 + drivers/gles3/effects/cubemap_filter.h | 8 +- drivers/gles3/effects/feed_effects.cpp | 6 + drivers/gles3/effects/feed_effects.h | 6 + drivers/gles3/effects/glow.cpp | 6 + drivers/gles3/effects/glow.h | 8 +- drivers/gles3/effects/post_effects.cpp | 6 + drivers/gles3/effects/post_effects.h | 8 +- drivers/gles3/environment/fog.cpp | 6 + drivers/gles3/environment/fog.h | 6 + drivers/gles3/environment/gi.cpp | 6 + drivers/gles3/environment/gi.h | 6 + drivers/gles3/rasterizer_canvas_gles3.cpp | 14 +- drivers/gles3/rasterizer_canvas_gles3.h | 40 +- drivers/gles3/rasterizer_gles3.cpp | 25 +- drivers/gles3/rasterizer_gles3.h | 7 + drivers/gles3/rasterizer_scene_gles3.cpp | 33 +- drivers/gles3/rasterizer_scene_gles3.h | 99 +- drivers/gles3/shader_gles3.cpp | 6 + drivers/gles3/shader_gles3.h | 20 +- drivers/gles3/storage/config.cpp | 12 +- drivers/gles3/storage/config.h | 14 +- drivers/gles3/storage/light_storage.cpp | 7 +- drivers/gles3/storage/light_storage.h | 8 +- drivers/gles3/storage/material_storage.cpp | 6 + drivers/gles3/storage/material_storage.h | 39 +- drivers/gles3/storage/mesh_storage.cpp | 10 +- drivers/gles3/storage/mesh_storage.h | 28 +- drivers/gles3/storage/particles_storage.cpp | 9 +- drivers/gles3/storage/particles_storage.h | 33 +- .../storage/render_scene_buffers_gles3.cpp | 6 + .../storage/render_scene_buffers_gles3.h | 26 +- drivers/gles3/storage/texture_storage.cpp | 12 +- drivers/gles3/storage/texture_storage.h | 31 +- drivers/gles3/storage/utilities.cpp | 6 + drivers/gles3/storage/utilities.h | 36 +- drivers/metal/inflection_map.h | 12 +- drivers/metal/metal_device_properties.h | 43 +- drivers/metal/metal_objects.h | 56 +- drivers/metal/metal_utils.h | 6 + drivers/metal/pixel_formats.h | 79 +- .../metal/rendering_context_driver_metal.h | 10 +- drivers/metal/rendering_device_driver_metal.h | 51 +- .../metal/rendering_shader_container_metal.h | 28 +- drivers/metal/sha256_digest.h | 6 + drivers/png/image_frames_loader_png.cpp | 6 + drivers/png/image_frames_loader_png.h | 6 + drivers/png/image_loader_png.cpp | 6 + drivers/png/image_loader_png.h | 6 + drivers/png/png_driver_common.cpp | 16 +- drivers/png/png_driver_common.h | 14 +- drivers/png/resource_saver_png.cpp | 6 + drivers/png/resource_saver_png.h | 6 + .../pulseaudio/audio_driver_pulseaudio.cpp | 26 +- drivers/pulseaudio/audio_driver_pulseaudio.h | 6 + drivers/register_driver_types.cpp | 6 + drivers/register_driver_types.h | 6 + drivers/sdl/SDL_build_config_private.h | 6 + drivers/sdl/joypad_sdl.cpp | 14 +- drivers/sdl/joypad_sdl.h | 6 + drivers/unix/dir_access_unix.cpp | 8 +- drivers/unix/dir_access_unix.h | 8 +- drivers/unix/file_access_unix.cpp | 12 +- drivers/unix/file_access_unix.h | 16 +- drivers/unix/file_access_unix_pipe.cpp | 6 + drivers/unix/file_access_unix_pipe.h | 12 +- drivers/unix/ip_unix.cpp | 6 + drivers/unix/ip_unix.h | 6 + drivers/unix/net_socket_unix.cpp | 6 + drivers/unix/net_socket_unix.h | 6 + drivers/unix/os_unix.cpp | 6 + drivers/unix/os_unix.h | 9 +- drivers/unix/syslog_logger.cpp | 6 + drivers/unix/syslog_logger.h | 6 + drivers/unix/thread_posix.cpp | 6 + drivers/unix/thread_posix.h | 6 + drivers/vulkan/godot_vulkan.h | 6 + .../rendering_context_driver_vulkan.cpp | 23 +- .../vulkan/rendering_context_driver_vulkan.h | 71 +- .../vulkan/rendering_device_driver_vulkan.cpp | 88 +- .../vulkan/rendering_device_driver_vulkan.h | 96 +- .../rendering_shader_container_vulkan.cpp | 6 + .../rendering_shader_container_vulkan.h | 6 + drivers/vulkan/vulkan_hooks.cpp | 6 + drivers/vulkan/vulkan_hooks.h | 6 + drivers/wasapi/audio_driver_wasapi.cpp | 8 +- drivers/wasapi/audio_driver_wasapi.h | 14 +- drivers/windows/dir_access_windows.cpp | 10 +- drivers/windows/dir_access_windows.h | 12 +- drivers/windows/file_access_windows.cpp | 6 + drivers/windows/file_access_windows.h | 12 +- drivers/windows/file_access_windows_pipe.cpp | 7 +- drivers/windows/file_access_windows_pipe.h | 13 +- drivers/windows/ip_windows.cpp | 6 + drivers/windows/ip_windows.h | 6 + drivers/windows/net_socket_winsock.cpp | 6 + drivers/windows/net_socket_winsock.h | 6 + drivers/windows/thread_windows.cpp | 6 + drivers/windows/thread_windows.h | 6 + drivers/winmidi/midi_driver_winmidi.cpp | 6 + drivers/winmidi/midi_driver_winmidi.h | 6 + drivers/xaudio2/audio_driver_xaudio2.cpp | 8 +- drivers/xaudio2/audio_driver_xaudio2.h | 6 + editor/animation/animation_bezier_editor.cpp | 10 +- editor/animation/animation_bezier_editor.h | 14 +- .../animation_blend_space_1d_editor.cpp | 6 + .../animation_blend_space_1d_editor.h | 6 + .../animation_blend_space_2d_editor.cpp | 6 + .../animation_blend_space_2d_editor.h | 6 + .../animation_blend_tree_editor_plugin.cpp | 20 +- .../animation_blend_tree_editor_plugin.h | 8 + editor/animation/animation_library_editor.cpp | 6 + editor/animation/animation_library_editor.h | 6 + .../animation_player_editor_plugin.cpp | 44 +- .../animation_player_editor_plugin.h | 18 +- .../animation_state_machine_editor.cpp | 8 +- .../animation_state_machine_editor.h | 6 + editor/animation/animation_track_editor.cpp | 24 +- editor/animation/animation_track_editor.h | 22 +- .../animation_track_editor_plugins.cpp | 6 + .../animation_track_editor_plugins.h | 6 + .../animation_tree_editor_plugin.cpp | 6 + .../animation/animation_tree_editor_plugin.h | 6 + .../asset_library_editor_plugin.cpp | 10 +- .../asset_library_editor_plugin.h | 6 + .../asset_library/editor_asset_installer.cpp | 10 +- editor/asset_library/editor_asset_installer.h | 9 + editor/audio/audio_stream_editor_plugin.cpp | 6 + editor/audio/audio_stream_editor_plugin.h | 6 + editor/audio/audio_stream_preview.cpp | 6 + editor/audio/audio_stream_preview.h | 6 + .../audio_stream_randomizer_editor_plugin.cpp | 6 + .../audio_stream_randomizer_editor_plugin.h | 6 + editor/audio/editor_audio_buses.cpp | 8 +- editor/audio/editor_audio_buses.h | 8 + .../debug_adapter/debug_adapter_parser.cpp | 6 + .../debug_adapter/debug_adapter_parser.h | 14 +- .../debug_adapter/debug_adapter_protocol.cpp | 6 + .../debug_adapter/debug_adapter_protocol.h | 15 +- .../debug_adapter/debug_adapter_server.cpp | 8 +- .../debug_adapter/debug_adapter_server.h | 6 + .../debug_adapter/debug_adapter_types.h | 12 +- editor/debugger/debugger_editor_plugin.cpp | 6 + editor/debugger/debugger_editor_plugin.h | 6 + editor/debugger/editor_debugger_inspector.cpp | 6 + editor/debugger/editor_debugger_inspector.h | 6 + editor/debugger/editor_debugger_node.cpp | 6 + editor/debugger/editor_debugger_node.h | 17 +- editor/debugger/editor_debugger_plugin.cpp | 6 + editor/debugger/editor_debugger_plugin.h | 6 + editor/debugger/editor_debugger_server.cpp | 6 + editor/debugger/editor_debugger_server.h | 6 + editor/debugger/editor_debugger_tree.cpp | 20 +- editor/debugger/editor_debugger_tree.h | 21 + .../debugger/editor_expression_evaluator.cpp | 6 + editor/debugger/editor_expression_evaluator.h | 6 + editor/debugger/editor_file_server.cpp | 12 +- editor/debugger/editor_file_server.h | 6 + .../debugger/editor_performance_profiler.cpp | 6 + editor/debugger/editor_performance_profiler.h | 6 + editor/debugger/editor_profiler.cpp | 6 + editor/debugger/editor_profiler.h | 8 +- editor/debugger/editor_visual_profiler.cpp | 6 + editor/debugger/editor_visual_profiler.h | 6 + editor/debugger/script_editor_debugger.cpp | 6 + editor/debugger/script_editor_debugger.h | 14 +- editor/doc/doc_tools.cpp | 18 +- editor/doc/doc_tools.h | 6 + editor/doc/editor_help.cpp | 20 +- editor/doc/editor_help.h | 30 +- editor/doc/editor_help_search.cpp | 7 +- editor/doc/editor_help_search.h | 7 + editor/docks/editor_dock_manager.cpp | 8 +- editor/docks/editor_dock_manager.h | 12 +- editor/docks/filesystem_dock.cpp | 12 +- editor/docks/filesystem_dock.h | 8 + editor/docks/groups_editor.cpp | 6 + editor/docks/groups_editor.h | 6 + editor/docks/history_dock.cpp | 6 + editor/docks/history_dock.h | 6 + editor/docks/import_dock.cpp | 6 + editor/docks/import_dock.h | 6 + editor/docks/inspector_dock.cpp | 6 + editor/docks/inspector_dock.h | 17 +- editor/docks/node_dock.cpp | 6 + editor/docks/node_dock.h | 6 + editor/docks/scene_tree_dock.cpp | 24 +- editor/docks/scene_tree_dock.h | 8 +- editor/docks/uid_viewer_dock.cpp | 6 + editor/docks/uid_viewer_dock.h | 6 + editor/editor_data.cpp | 10 +- editor/editor_data.h | 58 +- editor/editor_interface.cpp | 6 + editor/editor_interface.h | 52 +- editor/editor_log.cpp | 6 + editor/editor_log.h | 18 +- editor/editor_main_screen.cpp | 6 + editor/editor_main_screen.h | 6 + editor/editor_node.cpp | 53 +- editor/editor_node.h | 45 +- editor/editor_string_names.h | 6 + editor/editor_undo_redo_manager.cpp | 6 + editor/editor_undo_redo_manager.h | 6 + editor/export/codesign.cpp | 6 + editor/export/codesign.h | 82 +- .../export/dedicated_server_export_plugin.cpp | 6 + .../export/dedicated_server_export_plugin.h | 6 + editor/export/editor_export.cpp | 6 + editor/export/editor_export.h | 6 + editor/export/editor_export_platform.cpp | 6 + editor/export/editor_export_platform.h | 6 + .../editor_export_platform_apple_embedded.cpp | 20 +- .../editor_export_platform_apple_embedded.h | 14 +- .../editor_export_platform_extension.cpp | 6 + .../export/editor_export_platform_extension.h | 6 + editor/export/editor_export_platform_pc.cpp | 6 + editor/export/editor_export_platform_pc.h | 6 + editor/export/editor_export_plugin.cpp | 6 + editor/export/editor_export_plugin.h | 16 +- editor/export/editor_export_preset.cpp | 11 +- editor/export/editor_export_preset.h | 16 +- editor/export/export_template_manager.cpp | 10 +- editor/export/export_template_manager.h | 9 + editor/export/gdextension_export_plugin.h | 6 + editor/export/lipo.cpp | 6 + editor/export/lipo.h | 8 +- editor/export/macho.cpp | 6 + editor/export/macho.h | 12 +- .../export/plugin_config_apple_embedded.cpp | 6 + editor/export/plugin_config_apple_embedded.h | 52 +- editor/export/project_export.cpp | 14 +- editor/export/project_export.h | 6 + editor/export/project_zip_packer.cpp | 10 +- editor/export/project_zip_packer.h | 10 + editor/export/register_exporters.h | 6 + editor/export/shader_baker_export_plugin.cpp | 6 + editor/export/shader_baker_export_plugin.h | 8 +- editor/file_system/dependency_editor.cpp | 6 + editor/file_system/dependency_editor.h | 6 + editor/file_system/editor_file_system.cpp | 22 +- editor/file_system/editor_file_system.h | 28 +- editor/file_system/editor_paths.cpp | 6 + editor/file_system/editor_paths.h | 22 +- editor/file_system/file_info.cpp | 6 + editor/file_system/file_info.h | 6 + editor/gui/code_editor.cpp | 9 +- editor/gui/code_editor.h | 9 + editor/gui/create_dialog.cpp | 6 + editor/gui/create_dialog.h | 6 + editor/gui/credits_roll.cpp | 6 + editor/gui/credits_roll.h | 6 + editor/gui/directory_create_dialog.cpp | 6 + editor/gui/directory_create_dialog.h | 6 + editor/gui/editor_about.cpp | 6 + editor/gui/editor_about.h | 8 +- editor/gui/editor_bottom_panel.cpp | 6 + editor/gui/editor_bottom_panel.h | 6 + editor/gui/editor_dir_dialog.cpp | 6 + editor/gui/editor_dir_dialog.h | 6 + editor/gui/editor_file_dialog.cpp | 11 +- editor/gui/editor_file_dialog.h | 7 + editor/gui/editor_object_selector.cpp | 6 + editor/gui/editor_object_selector.h | 6 + editor/gui/editor_quick_open_dialog.cpp | 6 + editor/gui/editor_quick_open_dialog.h | 6 + editor/gui/editor_spin_slider.cpp | 9 +- editor/gui/editor_spin_slider.h | 12 +- editor/gui/editor_title_bar.cpp | 6 + editor/gui/editor_title_bar.h | 6 + editor/gui/editor_toaster.cpp | 8 +- editor/gui/editor_toaster.h | 22 +- editor/gui/editor_validation_panel.cpp | 6 + editor/gui/editor_validation_panel.h | 8 +- editor/gui/editor_variant_type_selectors.cpp | 6 + editor/gui/editor_variant_type_selectors.h | 6 + editor/gui/editor_version_button.cpp | 6 + editor/gui/editor_version_button.h | 15 +- editor/gui/editor_zoom_widget.cpp | 6 + editor/gui/editor_zoom_widget.h | 10 +- editor/gui/progress_dialog.cpp | 6 + editor/gui/progress_dialog.h | 6 + editor/gui/touch_actions_panel.cpp | 6 + editor/gui/touch_actions_panel.h | 8 +- editor/gui/window_wrapper.cpp | 12 +- editor/gui/window_wrapper.h | 6 + editor/import/3d/collada.cpp | 21 +- editor/import/3d/collada.h | 9 + editor/import/3d/editor_import_collada.cpp | 13 +- editor/import/3d/editor_import_collada.h | 6 + .../post_import_plugin_skeleton_renamer.cpp | 6 + .../3d/post_import_plugin_skeleton_renamer.h | 6 + ...post_import_plugin_skeleton_rest_fixer.cpp | 20 +- .../post_import_plugin_skeleton_rest_fixer.h | 6 + ...import_plugin_skeleton_track_organizer.cpp | 6 + ...t_import_plugin_skeleton_track_organizer.h | 6 + editor/import/3d/resource_importer_obj.cpp | 6 + editor/import/3d/resource_importer_obj.h | 6 + editor/import/3d/resource_importer_scene.cpp | 20 +- editor/import/3d/resource_importer_scene.h | 10 +- editor/import/3d/scene_import_settings.cpp | 12 +- editor/import/3d/scene_import_settings.h | 6 + .../import/audio_stream_import_settings.cpp | 6 + editor/import/audio_stream_import_settings.h | 6 + .../import/dynamic_font_import_settings.cpp | 6 + editor/import/dynamic_font_import_settings.h | 32 +- editor/import/editor_atlas_packer.cpp | 6 + editor/import/editor_atlas_packer.h | 6 + editor/import/editor_import_plugin.cpp | 6 + editor/import/editor_import_plugin.h | 6 + editor/import/fbx_importer_manager.cpp | 8 +- editor/import/fbx_importer_manager.h | 6 + editor/import/import_defaults_editor.cpp | 6 + editor/import/import_defaults_editor.h | 6 + .../resource_importer_animated_texture.cpp | 6 + .../resource_importer_animated_texture.h | 6 + editor/import/resource_importer_bitmask.cpp | 6 + editor/import/resource_importer_bitmask.h | 6 + editor/import/resource_importer_bmfont.cpp | 6 + editor/import/resource_importer_bmfont.h | 6 + .../resource_importer_csv_translation.cpp | 6 + .../resource_importer_csv_translation.h | 6 + .../import/resource_importer_dynamic_font.cpp | 6 + .../import/resource_importer_dynamic_font.h | 6 + editor/import/resource_importer_image.cpp | 6 + editor/import/resource_importer_image.h | 6 + .../import/resource_importer_image_frames.cpp | 6 + .../import/resource_importer_image_frames.h | 6 + editor/import/resource_importer_imagefont.cpp | 6 + editor/import/resource_importer_imagefont.h | 6 + .../resource_importer_layered_texture.cpp | 6 + .../resource_importer_layered_texture.h | 6 + .../import/resource_importer_shader_file.cpp | 6 + editor/import/resource_importer_shader_file.h | 6 + .../resource_importer_sprite_frames.cpp | 12 +- .../import/resource_importer_sprite_frames.h | 6 + editor/import/resource_importer_svg.cpp | 6 + editor/import/resource_importer_svg.h | 6 + editor/import/resource_importer_texture.cpp | 13 +- editor/import/resource_importer_texture.h | 13 + .../resource_importer_texture_atlas.cpp | 14 +- .../import/resource_importer_texture_atlas.h | 11 +- .../resource_importer_texture_settings.cpp | 8 +- .../resource_importer_texture_settings.h | 12 +- editor/import/resource_importer_wav.cpp | 6 + editor/import/resource_importer_wav.h | 6 + editor/inspector/add_metadata_dialog.cpp | 6 + editor/inspector/add_metadata_dialog.h | 6 + .../inspector/editor_context_menu_plugin.cpp | 6 + editor/inspector/editor_context_menu_plugin.h | 6 + editor/inspector/editor_inspector.cpp | 39 +- editor/inspector/editor_inspector.h | 23 +- editor/inspector/editor_preview_plugins.cpp | 6 + editor/inspector/editor_preview_plugins.h | 6 + editor/inspector/editor_properties.cpp | 12 +- editor/inspector/editor_properties.h | 8 +- .../editor_properties_array_dict.cpp | 6 + .../inspector/editor_properties_array_dict.h | 6 + editor/inspector/editor_properties_vector.cpp | 6 + editor/inspector/editor_properties_vector.h | 6 + .../editor_property_name_processor.cpp | 6 + .../editor_property_name_processor.h | 20 +- editor/inspector/editor_resource_picker.cpp | 12 +- editor/inspector/editor_resource_picker.h | 6 + editor/inspector/editor_resource_preview.cpp | 6 + editor/inspector/editor_resource_preview.h | 16 +- .../editor_resource_tooltip_plugins.cpp | 6 + .../editor_resource_tooltip_plugins.h | 6 + .../inspector/editor_sectioned_inspector.cpp | 6 + editor/inspector/editor_sectioned_inspector.h | 6 + .../inspector/input_event_editor_plugin.cpp | 6 + editor/inspector/input_event_editor_plugin.h | 6 + editor/inspector/multi_node_edit.cpp | 6 + editor/inspector/multi_node_edit.h | 6 + editor/inspector/property_selector.cpp | 8 +- editor/inspector/property_selector.h | 6 + .../sub_viewport_preview_editor_plugin.cpp | 6 + .../sub_viewport_preview_editor_plugin.h | 6 + .../inspector/tool_button_editor_plugin.cpp | 6 + editor/inspector/tool_button_editor_plugin.h | 6 + editor/plugins/editor_plugin.cpp | 11 +- editor/plugins/editor_plugin.h | 29 +- editor/plugins/editor_plugin_settings.cpp | 6 + editor/plugins/editor_plugin_settings.h | 6 + .../editor_resource_conversion_plugin.cpp | 6 + .../editor_resource_conversion_plugin.h | 6 + editor/plugins/plugin_config_dialog.cpp | 6 + editor/plugins/plugin_config_dialog.h | 6 + .../project_manager/engine_update_label.cpp | 6 + editor/project_manager/engine_update_label.h | 8 +- editor/project_manager/project_dialog.cpp | 14 +- editor/project_manager/project_dialog.h | 16 +- editor/project_manager/project_list.cpp | 22 +- editor/project_manager/project_list.h | 92 +- editor/project_manager/project_manager.cpp | 11 +- editor/project_manager/project_manager.h | 12 +- editor/project_manager/project_tag.cpp | 6 + editor/project_manager/project_tag.h | 6 + .../project_manager/quick_settings_dialog.cpp | 6 + .../project_manager/quick_settings_dialog.h | 10 +- .../project_converter_3_to_4.cpp | 51 +- .../project_converter_3_to_4.h | 33 + .../project_upgrade/project_upgrade_tool.cpp | 6 + editor/project_upgrade/project_upgrade_tool.h | 6 + editor/project_upgrade/renames_map_3_to_4.cpp | 35 +- editor/project_upgrade/renames_map_3_to_4.h | 12 +- editor/register_editor_types.cpp | 6 + editor/register_editor_types.h | 6 + editor/run/editor_run.cpp | 6 + editor/run/editor_run.h | 6 + editor/run/editor_run_bar.cpp | 8 +- editor/run/editor_run_bar.h | 6 + editor/run/editor_run_native.cpp | 6 + editor/run/editor_run_native.h | 6 + editor/run/embedded_process.cpp | 9 +- editor/run/embedded_process.h | 9 + editor/run/game_view_plugin.cpp | 6 + editor/run/game_view_plugin.h | 6 + editor/run/run_instances_dialog.cpp | 6 + editor/run/run_instances_dialog.h | 14 +- .../scene/2d/abstract_polygon_2d_editor.cpp | 8 +- editor/scene/2d/abstract_polygon_2d_editor.h | 12 +- editor/scene/2d/camera_2d_editor_plugin.cpp | 6 + editor/scene/2d/camera_2d_editor_plugin.h | 6 + .../2d/light_occluder_2d_editor_plugin.cpp | 6 + .../2d/light_occluder_2d_editor_plugin.h | 6 + editor/scene/2d/line_2d_editor_plugin.cpp | 6 + editor/scene/2d/line_2d_editor_plugin.h | 6 + .../2d/parallax_background_editor_plugin.cpp | 6 + .../2d/parallax_background_editor_plugin.h | 6 + .../scene/2d/particles_2d_editor_plugin.cpp | 6 + editor/scene/2d/particles_2d_editor_plugin.h | 6 + editor/scene/2d/path_2d_editor_plugin.cpp | 6 + editor/scene/2d/path_2d_editor_plugin.h | 10 +- .../2d/physics/cast_2d_editor_plugin.cpp | 6 + .../scene/2d/physics/cast_2d_editor_plugin.h | 6 + .../collision_polygon_2d_editor_plugin.cpp | 6 + .../collision_polygon_2d_editor_plugin.h | 6 + .../collision_shape_2d_editor_plugin.cpp | 6 + .../collision_shape_2d_editor_plugin.h | 6 + editor/scene/2d/polygon_2d_editor_plugin.cpp | 8 +- editor/scene/2d/polygon_2d_editor_plugin.h | 8 +- editor/scene/2d/skeleton_2d_editor_plugin.cpp | 6 + editor/scene/2d/skeleton_2d_editor_plugin.h | 6 + editor/scene/2d/sprite_2d_editor_plugin.cpp | 6 + editor/scene/2d/sprite_2d_editor_plugin.h | 6 + .../scene/2d/tiles/atlas_merging_dialog.cpp | 6 + editor/scene/2d/tiles/atlas_merging_dialog.h | 6 + editor/scene/2d/tiles/tile_atlas_view.cpp | 6 + editor/scene/2d/tiles/tile_atlas_view.h | 34 +- editor/scene/2d/tiles/tile_data_editors.cpp | 10 +- editor/scene/2d/tiles/tile_data_editors.h | 25 +- .../scene/2d/tiles/tile_map_layer_editor.cpp | 24 +- editor/scene/2d/tiles/tile_map_layer_editor.h | 121 +- .../2d/tiles/tile_proxies_manager_dialog.cpp | 6 + .../2d/tiles/tile_proxies_manager_dialog.h | 6 + .../2d/tiles/tile_set_atlas_source_editor.cpp | 8 +- .../2d/tiles/tile_set_atlas_source_editor.h | 67 +- editor/scene/2d/tiles/tile_set_editor.cpp | 8 +- editor/scene/2d/tiles/tile_set_editor.h | 30 +- ...le_set_scenes_collection_source_editor.cpp | 6 + ...tile_set_scenes_collection_source_editor.h | 26 +- editor/scene/2d/tiles/tiles_editor_plugin.cpp | 8 +- editor/scene/2d/tiles/tiles_editor_plugin.h | 33 +- editor/scene/3d/bone_map_editor_plugin.cpp | 10 +- editor/scene/3d/bone_map_editor_plugin.h | 8 +- editor/scene/3d/camera_3d_editor_plugin.cpp | 6 + editor/scene/3d/camera_3d_editor_plugin.h | 6 + .../gizmos/audio_listener_3d_gizmo_plugin.cpp | 6 + .../gizmos/audio_listener_3d_gizmo_plugin.h | 6 + .../audio_stream_player_3d_gizmo_plugin.cpp | 6 + .../audio_stream_player_3d_gizmo_plugin.h | 6 + .../3d/gizmos/camera_3d_gizmo_plugin.cpp | 6 + .../scene/3d/gizmos/camera_3d_gizmo_plugin.h | 6 + .../gizmos/cpu_particles_3d_gizmo_plugin.cpp | 6 + .../3d/gizmos/cpu_particles_3d_gizmo_plugin.h | 6 + editor/scene/3d/gizmos/decal_gizmo_plugin.cpp | 6 + editor/scene/3d/gizmos/decal_gizmo_plugin.h | 6 + .../3d/gizmos/fog_volume_gizmo_plugin.cpp | 6 + .../scene/3d/gizmos/fog_volume_gizmo_plugin.h | 6 + .../geometry_instance_3d_gizmo_plugin.cpp | 6 + .../geometry_instance_3d_gizmo_plugin.h | 6 + editor/scene/3d/gizmos/gizmo_3d_helper.cpp | 6 + editor/scene/3d/gizmos/gizmo_3d_helper.h | 23 +- .../gizmos/gpu_particles_3d_gizmo_plugin.cpp | 6 + .../3d/gizmos/gpu_particles_3d_gizmo_plugin.h | 6 + ...pu_particles_collision_3d_gizmo_plugin.cpp | 6 + .../gpu_particles_collision_3d_gizmo_plugin.h | 6 + .../scene/3d/gizmos/label_3d_gizmo_plugin.cpp | 6 + .../scene/3d/gizmos/label_3d_gizmo_plugin.h | 6 + .../scene/3d/gizmos/light_3d_gizmo_plugin.cpp | 6 + .../scene/3d/gizmos/light_3d_gizmo_plugin.h | 6 + .../3d/gizmos/lightmap_gi_gizmo_plugin.cpp | 10 +- .../3d/gizmos/lightmap_gi_gizmo_plugin.h | 6 + .../3d/gizmos/lightmap_probe_gizmo_plugin.cpp | 10 +- .../3d/gizmos/lightmap_probe_gizmo_plugin.h | 6 + .../3d/gizmos/marker_3d_gizmo_plugin.cpp | 10 +- .../scene/3d/gizmos/marker_3d_gizmo_plugin.h | 6 + .../gizmos/mesh_instance_3d_gizmo_plugin.cpp | 6 + .../3d/gizmos/mesh_instance_3d_gizmo_plugin.h | 6 + .../occluder_instance_3d_gizmo_plugin.cpp | 6 + .../occluder_instance_3d_gizmo_plugin.h | 6 + ...rticles_3d_emission_shape_gizmo_plugin.cpp | 6 + ...particles_3d_emission_shape_gizmo_plugin.h | 6 + .../collision_object_3d_gizmo_plugin.cpp | 6 + .../collision_object_3d_gizmo_plugin.h | 6 + .../collision_polygon_3d_gizmo_plugin.cpp | 6 + .../collision_polygon_3d_gizmo_plugin.h | 6 + .../collision_shape_3d_gizmo_plugin.cpp | 6 + .../physics/collision_shape_3d_gizmo_plugin.h | 6 + .../gizmos/physics/joint_3d_gizmo_plugin.cpp | 6 + .../3d/gizmos/physics/joint_3d_gizmo_plugin.h | 8 +- .../physics/physics_bone_3d_gizmo_plugin.cpp | 6 + .../physics/physics_bone_3d_gizmo_plugin.h | 6 + .../physics/ray_cast_3d_gizmo_plugin.cpp | 6 + .../gizmos/physics/ray_cast_3d_gizmo_plugin.h | 6 + .../physics/shape_cast_3d_gizmo_plugin.cpp | 6 + .../physics/shape_cast_3d_gizmo_plugin.h | 6 + .../physics/soft_body_3d_gizmo_plugin.cpp | 6 + .../physics/soft_body_3d_gizmo_plugin.h | 6 + .../physics/spring_arm_3d_gizmo_plugin.cpp | 6 + .../physics/spring_arm_3d_gizmo_plugin.h | 6 + .../physics/vehicle_body_3d_gizmo_plugin.cpp | 6 + .../physics/vehicle_body_3d_gizmo_plugin.h | 6 + .../gizmos/reflection_probe_gizmo_plugin.cpp | 6 + .../3d/gizmos/reflection_probe_gizmo_plugin.h | 6 + .../3d/gizmos/spring_bone_3d_gizmo_plugin.cpp | 6 + .../3d/gizmos/spring_bone_3d_gizmo_plugin.h | 6 + .../3d/gizmos/sprite_base_3d_gizmo_plugin.cpp | 6 + .../3d/gizmos/sprite_base_3d_gizmo_plugin.h | 6 + ...ble_on_screen_notifier_3d_gizmo_plugin.cpp | 6 + ...sible_on_screen_notifier_3d_gizmo_plugin.h | 6 + .../scene/3d/gizmos/voxel_gi_gizmo_plugin.cpp | 6 + .../scene/3d/gizmos/voxel_gi_gizmo_plugin.h | 6 + ..._particles_collision_sdf_editor_plugin.cpp | 6 + ...pu_particles_collision_sdf_editor_plugin.h | 6 + editor/scene/3d/lightmap_gi_editor_plugin.cpp | 10 +- editor/scene/3d/lightmap_gi_editor_plugin.h | 6 + editor/scene/3d/mesh_editor_plugin.cpp | 6 + editor/scene/3d/mesh_editor_plugin.h | 6 + .../3d/mesh_instance_3d_editor_plugin.cpp | 6 + .../scene/3d/mesh_instance_3d_editor_plugin.h | 6 + .../scene/3d/mesh_library_editor_plugin.cpp | 6 + editor/scene/3d/mesh_library_editor_plugin.h | 6 + editor/scene/3d/multimesh_editor_plugin.cpp | 6 + editor/scene/3d/multimesh_editor_plugin.h | 6 + editor/scene/3d/node_3d_editor_gizmos.cpp | 6 + editor/scene/3d/node_3d_editor_gizmos.h | 6 + editor/scene/3d/node_3d_editor_plugin.cpp | 19 +- editor/scene/3d/node_3d_editor_plugin.h | 46 +- .../3d/occluder_instance_3d_editor_plugin.cpp | 6 + .../3d/occluder_instance_3d_editor_plugin.h | 6 + .../scene/3d/particles_3d_editor_plugin.cpp | 6 + editor/scene/3d/particles_3d_editor_plugin.h | 6 + editor/scene/3d/path_3d_editor_plugin.cpp | 6 + editor/scene/3d/path_3d_editor_plugin.h | 20 +- .../physical_bone_3d_editor_plugin.cpp | 10 +- .../physics/physical_bone_3d_editor_plugin.h | 6 + editor/scene/3d/polygon_3d_editor_plugin.cpp | 6 + editor/scene/3d/polygon_3d_editor_plugin.h | 6 + editor/scene/3d/root_motion_editor_plugin.cpp | 6 + editor/scene/3d/root_motion_editor_plugin.h | 6 + editor/scene/3d/skeleton_3d_editor_plugin.cpp | 11 +- editor/scene/3d/skeleton_3d_editor_plugin.h | 11 +- .../scene/3d/skeleton_ik_3d_editor_plugin.cpp | 6 + .../scene/3d/skeleton_ik_3d_editor_plugin.h | 6 + editor/scene/3d/voxel_gi_editor_plugin.cpp | 10 +- editor/scene/3d/voxel_gi_editor_plugin.h | 6 + editor/scene/canvas_item_editor_plugin.cpp | 10 +- editor/scene/canvas_item_editor_plugin.h | 20 +- editor/scene/connections_dialog.cpp | 61 +- editor/scene/connections_dialog.h | 60 +- editor/scene/curve_editor_plugin.cpp | 15 +- editor/scene/curve_editor_plugin.h | 15 +- editor/scene/editor_scene_tabs.cpp | 6 + editor/scene/editor_scene_tabs.h | 8 +- editor/scene/gradient_editor_plugin.cpp | 8 +- editor/scene/gradient_editor_plugin.h | 10 +- editor/scene/group_settings_editor.cpp | 6 + editor/scene/group_settings_editor.h | 6 + editor/scene/gui/control_editor_plugin.cpp | 6 + editor/scene/gui/control_editor_plugin.h | 12 +- editor/scene/gui/font_config_plugin.cpp | 6 + editor/scene/gui/font_config_plugin.h | 6 + editor/scene/gui/style_box_editor_plugin.cpp | 6 + editor/scene/gui/style_box_editor_plugin.h | 6 + editor/scene/gui/theme_editor_plugin.cpp | 6 + editor/scene/gui/theme_editor_plugin.h | 8 +- editor/scene/gui/theme_editor_preview.cpp | 6 + editor/scene/gui/theme_editor_preview.h | 6 + editor/scene/material_editor_plugin.cpp | 7 +- editor/scene/material_editor_plugin.h | 7 + editor/scene/packed_scene_editor_plugin.cpp | 6 + editor/scene/packed_scene_editor_plugin.h | 6 + ...article_process_material_editor_plugin.cpp | 8 +- .../particle_process_material_editor_plugin.h | 6 + editor/scene/particles_editor_plugin.cpp | 6 + editor/scene/particles_editor_plugin.h | 6 + editor/scene/rename_dialog.cpp | 6 + editor/scene/rename_dialog.h | 6 + editor/scene/reparent_dialog.cpp | 6 + editor/scene/reparent_dialog.h | 6 + .../resource_preloader_editor_plugin.cpp | 6 + .../scene/resource_preloader_editor_plugin.h | 6 + editor/scene/scene_create_dialog.cpp | 6 + editor/scene/scene_create_dialog.h | 6 + editor/scene/scene_tree_editor.cpp | 14 +- editor/scene/scene_tree_editor.h | 16 +- editor/scene/sprite_frames_editor_plugin.cpp | 10 +- editor/scene/sprite_frames_editor_plugin.h | 20 +- .../scene/texture/bit_map_editor_plugin.cpp | 6 + editor/scene/texture/bit_map_editor_plugin.h | 6 + .../scene/texture/color_channel_selector.cpp | 7 +- editor/scene/texture/color_channel_selector.h | 8 +- .../gradient_texture_2d_editor_plugin.cpp | 6 + .../gradient_texture_2d_editor_plugin.h | 6 + .../texture/texture_3d_editor_plugin.cpp | 6 + .../scene/texture/texture_3d_editor_plugin.h | 6 + .../scene/texture/texture_editor_plugin.cpp | 14 +- editor/scene/texture/texture_editor_plugin.h | 6 + .../texture/texture_layered_editor_plugin.cpp | 6 + .../texture/texture_layered_editor_plugin.h | 6 + .../texture/texture_region_editor_plugin.cpp | 9 +- .../texture/texture_region_editor_plugin.h | 10 +- editor/script/editor_script.cpp | 6 + editor/script/editor_script.h | 6 + editor/script/editor_script_plugin.cpp | 6 + editor/script/editor_script_plugin.h | 6 + editor/script/find_in_files.cpp | 14 +- editor/script/find_in_files.h | 24 +- editor/script/script_create_dialog.cpp | 6 + editor/script/script_create_dialog.h | 6 + editor/script/script_editor_plugin.cpp | 12 +- editor/script/script_editor_plugin.h | 16 +- editor/script/script_text_editor.cpp | 13 +- editor/script/script_text_editor.h | 8 +- editor/script/text_editor.cpp | 6 + editor/script/text_editor.h | 6 + editor/settings/action_map_editor.cpp | 6 + editor/settings/action_map_editor.h | 25 +- editor/settings/editor_autoload_settings.cpp | 6 + editor/settings/editor_autoload_settings.h | 6 + editor/settings/editor_build_profile.cpp | 12 +- editor/settings/editor_build_profile.h | 6 + editor/settings/editor_command_palette.cpp | 6 + editor/settings/editor_command_palette.h | 8 +- editor/settings/editor_event_search_bar.cpp | 6 + editor/settings/editor_event_search_bar.h | 6 + editor/settings/editor_feature_profile.cpp | 10 +- editor/settings/editor_feature_profile.h | 6 + editor/settings/editor_folding.cpp | 6 + editor/settings/editor_folding.h | 6 + editor/settings/editor_layouts_dialog.cpp | 6 + editor/settings/editor_layouts_dialog.h | 6 + editor/settings/editor_settings.cpp | 10 +- editor/settings/editor_settings.h | 13 +- editor/settings/editor_settings_dialog.cpp | 15 +- editor/settings/editor_settings_dialog.h | 13 +- editor/settings/event_listener_line_edit.cpp | 8 +- editor/settings/event_listener_line_edit.h | 6 + .../input_event_configuration_dialog.cpp | 6 + .../input_event_configuration_dialog.h | 14 +- editor/settings/project_settings_editor.cpp | 6 + editor/settings/project_settings_editor.h | 6 + ...editor_native_shader_source_visualizer.cpp | 6 + .../editor_native_shader_source_visualizer.h | 6 + ...der_baker_export_plugin_platform_d3d12.cpp | 6 + ...hader_baker_export_plugin_platform_d3d12.h | 6 + ...der_baker_export_plugin_platform_metal.cpp | 6 + ...hader_baker_export_plugin_platform_metal.h | 6 + ...er_baker_export_plugin_platform_vulkan.cpp | 6 + ...ader_baker_export_plugin_platform_vulkan.h | 6 + editor/shader/shader_create_dialog.cpp | 6 + editor/shader/shader_create_dialog.h | 6 + editor/shader/shader_editor.h | 6 + editor/shader/shader_editor_plugin.cpp | 10 +- editor/shader/shader_editor_plugin.h | 6 + editor/shader/shader_file_editor_plugin.cpp | 6 + editor/shader/shader_file_editor_plugin.h | 6 + editor/shader/shader_globals_editor.cpp | 6 + editor/shader/shader_globals_editor.h | 6 + editor/shader/text_shader_editor.cpp | 8 +- editor/shader/text_shader_editor.h | 8 +- editor/shader/visual_shader_editor_plugin.cpp | 35 +- editor/shader/visual_shader_editor_plugin.h | 27 +- editor/themes/editor_color_map.cpp | 6 + editor/themes/editor_color_map.h | 18 +- editor/themes/editor_fonts.cpp | 6 + editor/themes/editor_fonts.h | 6 + editor/themes/editor_icons.cpp | 10 +- editor/themes/editor_icons.h | 6 + editor/themes/editor_scale.cpp | 6 + editor/themes/editor_scale.h | 6 + editor/themes/editor_theme.cpp | 14 +- editor/themes/editor_theme.h | 12 + editor/themes/editor_theme_manager.cpp | 22 +- editor/themes/editor_theme_manager.h | 6 + editor/translations/editor_locale_dialog.cpp | 6 + editor/translations/editor_locale_dialog.h | 6 + editor/translations/editor_translation.cpp | 6 + editor/translations/editor_translation.h | 6 + .../editor_translation_parser.cpp | 6 + .../translations/editor_translation_parser.h | 10 +- .../editor_translation_preview_button.cpp | 6 + .../editor_translation_preview_button.h | 6 + .../editor_translation_preview_menu.cpp | 6 + .../editor_translation_preview_menu.h | 6 + editor/translations/localization_editor.cpp | 6 + editor/translations/localization_editor.h | 6 + ...packed_scene_translation_parser_plugin.cpp | 17 +- .../packed_scene_translation_parser_plugin.h | 8 + editor/translations/pot_generator.cpp | 6 + editor/translations/pot_generator.h | 8 +- .../version_control/editor_vcs_interface.cpp | 6 + editor/version_control/editor_vcs_interface.h | 19 +- .../version_control_editor_plugin.cpp | 10 +- .../version_control_editor_plugin.h | 6 + main/main.cpp | 131 +- main/main.h | 70 +- main/main_timer_sync.cpp | 27 +- main/main_timer_sync.h | 85 +- main/performance.cpp | 6 + main/performance.h | 6 + main/steam_tracker.cpp | 6 + main/steam_tracker.h | 24 +- modules/astcenc/image_compress_astcenc.cpp | 6 + modules/astcenc/image_compress_astcenc.h | 6 + modules/astcenc/register_types.cpp | 6 + modules/astcenc/register_types.h | 6 + .../basis_universal/image_compress_basisu.cpp | 6 + .../basis_universal/image_compress_basisu.h | 6 + modules/basis_universal/register_types.cpp | 6 + modules/basis_universal/register_types.h | 6 + modules/bcdec/image_decompress_bcdec.cpp | 6 + modules/bcdec/image_decompress_bcdec.h | 6 + modules/bcdec/register_types.cpp | 6 + modules/bcdec/register_types.h | 6 + modules/betsy/betsy_bc1.h | 6 + modules/betsy/image_compress_betsy.cpp | 13 +- modules/betsy/image_compress_betsy.h | 14 +- modules/betsy/register_types.cpp | 6 + modules/betsy/register_types.h | 6 + modules/bmp/image_loader_bmp.cpp | 10 +- modules/bmp/image_loader_bmp.h | 30 +- modules/bmp/register_types.cpp | 6 + modules/bmp/register_types.h | 6 + modules/camera/buffer_decoder.cpp | 6 + modules/camera/buffer_decoder.h | 6 + modules/camera/camera_android.cpp | 6 + modules/camera/camera_android.h | 6 + modules/camera/camera_feed_linux.cpp | 6 + modules/camera/camera_feed_linux.h | 6 + modules/camera/camera_linux.cpp | 8 +- modules/camera/camera_linux.h | 6 + modules/camera/camera_macos.h | 10 +- modules/camera/camera_win.cpp | 34 +- modules/camera/camera_win.h | 6 + modules/camera/register_types.cpp | 6 + modules/camera/register_types.h | 6 + modules/csg/csg.cpp | 6 + modules/csg/csg.h | 8 +- modules/csg/csg_shape.cpp | 6 + modules/csg/csg_shape.h | 10 +- modules/csg/editor/csg_gizmos.cpp | 6 + modules/csg/editor/csg_gizmos.h | 6 + modules/csg/register_types.cpp | 6 + modules/csg/register_types.h | 6 + modules/csg/tests/test_csg.h | 6 + modules/cvtt/image_compress_cvtt.cpp | 6 + modules/cvtt/image_compress_cvtt.h | 6 + modules/cvtt/register_types.cpp | 6 + modules/cvtt/register_types.h | 6 + modules/dds/dds_enums.h | 15 +- modules/dds/image_saver_dds.cpp | 6 + modules/dds/image_saver_dds.h | 6 + modules/dds/register_types.cpp | 6 + modules/dds/register_types.h | 6 + modules/dds/tests/test_dds.h | 6 + modules/dds/texture_loader_dds.cpp | 6 + modules/dds/texture_loader_dds.h | 6 + modules/enet/enet_connection.cpp | 12 +- modules/enet/enet_connection.h | 6 + modules/enet/enet_multiplayer_peer.cpp | 8 +- modules/enet/enet_multiplayer_peer.h | 10 +- modules/enet/enet_packet_peer.cpp | 6 + modules/enet/enet_packet_peer.h | 14 +- modules/enet/register_types.cpp | 6 + modules/enet/register_types.h | 6 + modules/etcpak/image_compress_etcpak.cpp | 6 + modules/etcpak/image_compress_etcpak.h | 6 + modules/etcpak/image_decompress_etcpak.cpp | 6 + modules/etcpak/image_decompress_etcpak.h | 6 + modules/etcpak/register_types.cpp | 6 + modules/etcpak/register_types.h | 6 + .../editor/editor_scene_importer_fbx2gltf.cpp | 8 +- .../editor/editor_scene_importer_fbx2gltf.h | 6 + .../fbx/editor/editor_scene_importer_ufbx.cpp | 8 +- .../fbx/editor/editor_scene_importer_ufbx.h | 6 + modules/fbx/fbx_document.cpp | 42 +- modules/fbx/fbx_document.h | 6 + modules/fbx/fbx_state.cpp | 6 + modules/fbx/fbx_state.h | 10 +- modules/fbx/register_types.cpp | 6 + modules/fbx/register_types.h | 6 + modules/freetype/register_types.h | 6 + modules/gdscript/editor/gdscript_docgen.cpp | 7 +- modules/gdscript/editor/gdscript_docgen.h | 9 +- .../gdscript/editor/gdscript_highlighter.cpp | 8 +- .../gdscript/editor/gdscript_highlighter.h | 22 +- .../gdscript_translation_parser_plugin.cpp | 13 +- .../gdscript_translation_parser_plugin.h | 20 +- modules/gdscript/gdscript.cpp | 19 +- modules/gdscript/gdscript.h | 80 +- modules/gdscript/gdscript_analyzer.cpp | 76 +- modules/gdscript/gdscript_analyzer.h | 27 +- modules/gdscript/gdscript_byte_codegen.cpp | 7 +- modules/gdscript/gdscript_byte_codegen.h | 20 +- modules/gdscript/gdscript_cache.cpp | 6 + modules/gdscript/gdscript_cache.h | 8 +- modules/gdscript/gdscript_codegen.h | 8 +- modules/gdscript/gdscript_compiler.cpp | 31 +- modules/gdscript/gdscript_compiler.h | 11 + modules/gdscript/gdscript_disassembler.cpp | 6 + modules/gdscript/gdscript_editor.cpp | 34 +- modules/gdscript/gdscript_function.cpp | 6 + modules/gdscript/gdscript_function.h | 18 +- modules/gdscript/gdscript_lambda_callable.cpp | 14 +- modules/gdscript/gdscript_lambda_callable.h | 8 +- modules/gdscript/gdscript_parser.cpp | 37 +- modules/gdscript/gdscript_parser.h | 165 +- modules/gdscript/gdscript_rpc_callable.cpp | 6 + modules/gdscript/gdscript_rpc_callable.h | 6 + modules/gdscript/gdscript_tokenizer.cpp | 10 +- modules/gdscript/gdscript_tokenizer.h | 36 +- .../gdscript/gdscript_tokenizer_buffer.cpp | 6 + modules/gdscript/gdscript_tokenizer_buffer.h | 12 +- .../gdscript/gdscript_utility_callable.cpp | 6 + modules/gdscript/gdscript_utility_callable.h | 6 + .../gdscript/gdscript_utility_functions.cpp | 6 + modules/gdscript/gdscript_utility_functions.h | 6 + modules/gdscript/gdscript_vm.cpp | 6 + modules/gdscript/gdscript_warning.cpp | 6 + modules/gdscript/gdscript_warning.h | 100 +- .../gdscript_extend_parser.cpp | 6 + .../language_server/gdscript_extend_parser.h | 6 + .../gdscript_language_protocol.cpp | 6 + .../gdscript_language_protocol.h | 6 + .../gdscript_language_server.cpp | 8 +- .../gdscript_language_server.h | 8 +- .../gdscript_text_document.cpp | 8 +- .../language_server/gdscript_text_document.h | 8 + .../language_server/gdscript_workspace.cpp | 10 +- .../language_server/gdscript_workspace.h | 9 +- modules/gdscript/language_server/godot_lsp.h | 13 +- modules/gdscript/register_types.cpp | 6 + modules/gdscript/register_types.h | 6 + .../gdscript/tests/gdscript_test_runner.cpp | 18 +- modules/gdscript/tests/gdscript_test_runner.h | 6 + .../tests/gdscript_test_runner_suite.h | 8 +- modules/gdscript/tests/test_completion.h | 6 + modules/gdscript/tests/test_gdscript.cpp | 6 + modules/gdscript/tests/test_gdscript.h | 6 + modules/gdscript/tests/test_lsp.h | 6 + modules/gif/gif_common.cpp | 6 + modules/gif/gif_common.h | 8 +- modules/gif/image_frames_loader_gif.cpp | 6 + modules/gif/image_frames_loader_gif.h | 6 + modules/gif/image_loader_gif.cpp | 6 + modules/gif/image_loader_gif.h | 6 + modules/gif/register_types.cpp | 6 + modules/gif/register_types.h | 6 + modules/glslang/register_types.cpp | 6 + modules/glslang/register_types.h | 6 + modules/glslang/shader_compile.h | 6 + .../editor/editor_import_blend_runner.cpp | 6 + .../gltf/editor/editor_import_blend_runner.h | 6 + .../editor_scene_exporter_gltf_plugin.cpp | 6 + .../editor_scene_exporter_gltf_plugin.h | 6 + .../editor_scene_exporter_gltf_settings.cpp | 7 +- .../editor_scene_exporter_gltf_settings.h | 7 + .../editor/editor_scene_importer_blend.cpp | 12 +- .../gltf/editor/editor_scene_importer_blend.h | 6 + .../editor/editor_scene_importer_gltf.cpp | 6 + .../gltf/editor/editor_scene_importer_gltf.h | 6 + .../extensions/gltf_document_extension.cpp | 6 + .../gltf/extensions/gltf_document_extension.h | 14 +- ...cument_extension_convert_importer_mesh.cpp | 6 + ...document_extension_convert_importer_mesh.h | 6 + .../gltf_document_extension_texture_ktx.cpp | 6 + .../gltf_document_extension_texture_ktx.h | 10 +- .../gltf_document_extension_texture_webp.cpp | 6 + .../gltf_document_extension_texture_webp.h | 14 +- modules/gltf/extensions/gltf_light.cpp | 6 + modules/gltf/extensions/gltf_light.h | 6 + modules/gltf/extensions/gltf_spec_gloss.cpp | 6 + modules/gltf/extensions/gltf_spec_gloss.h | 15 +- .../gltf_document_extension_physics.cpp | 10 +- .../physics/gltf_document_extension_physics.h | 14 +- .../extensions/physics/gltf_physics_body.cpp | 6 + .../extensions/physics/gltf_physics_body.h | 23 +- .../extensions/physics/gltf_physics_shape.cpp | 6 + .../extensions/physics/gltf_physics_shape.h | 15 +- modules/gltf/gltf_defines.h | 17 +- modules/gltf/gltf_document.cpp | 31 +- modules/gltf/gltf_document.h | 17 +- modules/gltf/gltf_state.cpp | 6 + modules/gltf/gltf_state.h | 8 +- modules/gltf/gltf_template_convert.h | 6 + modules/gltf/register_types.cpp | 6 + modules/gltf/register_types.h | 6 + modules/gltf/skin_tool.cpp | 14 +- modules/gltf/skin_tool.h | 9 + modules/gltf/structures/gltf_accessor.cpp | 8 +- modules/gltf/structures/gltf_accessor.h | 6 + modules/gltf/structures/gltf_animation.cpp | 6 + modules/gltf/structures/gltf_animation.h | 6 + modules/gltf/structures/gltf_buffer_view.cpp | 6 + modules/gltf/structures/gltf_buffer_view.h | 6 + modules/gltf/structures/gltf_camera.cpp | 6 + modules/gltf/structures/gltf_camera.h | 10 +- modules/gltf/structures/gltf_mesh.cpp | 6 + modules/gltf/structures/gltf_mesh.h | 6 + modules/gltf/structures/gltf_node.cpp | 6 + modules/gltf/structures/gltf_node.h | 6 + .../structures/gltf_object_model_property.cpp | 6 + .../structures/gltf_object_model_property.h | 6 + modules/gltf/structures/gltf_skeleton.cpp | 6 + modules/gltf/structures/gltf_skeleton.h | 16 +- modules/gltf/structures/gltf_skin.cpp | 6 + modules/gltf/structures/gltf_skin.h | 30 +- modules/gltf/structures/gltf_texture.cpp | 6 + modules/gltf/structures/gltf_texture.h | 6 + .../gltf/structures/gltf_texture_sampler.cpp | 6 + .../gltf/structures/gltf_texture_sampler.h | 12 +- modules/gltf/tests/test_gltf.h | 6 + modules/gltf/tests/test_gltf_extras.h | 6 + modules/gltf/tests/test_gltf_images.h | 6 + modules/godot_physics_2d/godot_area_2d.cpp | 6 + modules/godot_physics_2d/godot_area_2d.h | 6 + .../godot_physics_2d/godot_area_pair_2d.cpp | 6 + modules/godot_physics_2d/godot_area_pair_2d.h | 6 + modules/godot_physics_2d/godot_body_2d.cpp | 6 + modules/godot_physics_2d/godot_body_2d.h | 8 +- .../godot_body_direct_state_2d.cpp | 6 + .../godot_body_direct_state_2d.h | 6 + .../godot_physics_2d/godot_body_pair_2d.cpp | 13 +- modules/godot_physics_2d/godot_body_pair_2d.h | 25 +- .../godot_physics_2d/godot_broad_phase_2d.cpp | 6 + .../godot_physics_2d/godot_broad_phase_2d.h | 8 +- .../godot_broad_phase_2d_bvh.cpp | 6 + .../godot_broad_phase_2d_bvh.h | 6 + .../godot_collision_object_2d.cpp | 6 + .../godot_collision_object_2d.h | 8 +- .../godot_collision_solver_2d.cpp | 6 + .../godot_collision_solver_2d.h | 6 + .../godot_collision_solver_2d_sat.cpp | 6 + .../godot_collision_solver_2d_sat.h | 6 + .../godot_physics_2d/godot_constraint_2d.h | 6 + modules/godot_physics_2d/godot_joints_2d.cpp | 9 +- modules/godot_physics_2d/godot_joints_2d.h | 6 + .../godot_physics_server_2d.cpp | 6 + .../godot_physics_server_2d.h | 38 +- modules/godot_physics_2d/godot_shape_2d.cpp | 8 +- modules/godot_physics_2d/godot_shape_2d.h | 8 +- modules/godot_physics_2d/godot_space_2d.cpp | 16 +- modules/godot_physics_2d/godot_space_2d.h | 13 + modules/godot_physics_2d/godot_step_2d.cpp | 6 + modules/godot_physics_2d/godot_step_2d.h | 6 + modules/godot_physics_2d/register_types.cpp | 6 + modules/godot_physics_2d/register_types.h | 6 + modules/godot_physics_3d/gjk_epa.cpp | 69 +- modules/godot_physics_3d/gjk_epa.h | 6 + modules/godot_physics_3d/godot_area_3d.cpp | 6 + modules/godot_physics_3d/godot_area_3d.h | 6 + .../godot_physics_3d/godot_area_pair_3d.cpp | 6 + modules/godot_physics_3d/godot_area_pair_3d.h | 6 + modules/godot_physics_3d/godot_body_3d.cpp | 6 + modules/godot_physics_3d/godot_body_3d.h | 16 +- .../godot_body_direct_state_3d.cpp | 6 + .../godot_body_direct_state_3d.h | 6 + .../godot_physics_3d/godot_body_pair_3d.cpp | 15 +- modules/godot_physics_3d/godot_body_pair_3d.h | 27 +- .../godot_physics_3d/godot_broad_phase_3d.cpp | 6 + .../godot_physics_3d/godot_broad_phase_3d.h | 8 +- .../godot_broad_phase_3d_bvh.cpp | 6 + .../godot_broad_phase_3d_bvh.h | 8 +- .../godot_collision_object_3d.cpp | 6 + .../godot_collision_object_3d.h | 8 +- .../godot_collision_solver_3d.cpp | 6 + .../godot_collision_solver_3d.h | 6 + .../godot_collision_solver_3d_sat.cpp | 58 +- .../godot_collision_solver_3d_sat.h | 6 + .../godot_physics_3d/godot_constraint_3d.h | 6 + modules/godot_physics_3d/godot_joint_3d.h | 6 + .../godot_physics_server_3d.cpp | 6 + .../godot_physics_server_3d.h | 46 +- modules/godot_physics_3d/godot_shape_3d.cpp | 36 +- modules/godot_physics_3d/godot_shape_3d.h | 14 +- .../godot_physics_3d/godot_soft_body_3d.cpp | 52 +- modules/godot_physics_3d/godot_soft_body_3d.h | 60 +- modules/godot_physics_3d/godot_space_3d.cpp | 16 +- modules/godot_physics_3d/godot_space_3d.h | 13 + modules/godot_physics_3d/godot_step_3d.cpp | 6 + modules/godot_physics_3d/godot_step_3d.h | 6 + .../joints/godot_cone_twist_joint_3d.cpp | 40 +- .../joints/godot_cone_twist_joint_3d.h | 46 +- .../joints/godot_generic_6dof_joint_3d.cpp | 50 +- .../joints/godot_generic_6dof_joint_3d.h | 80 +- .../joints/godot_hinge_joint_3d.cpp | 42 +- .../joints/godot_hinge_joint_3d.h | 44 +- .../joints/godot_jacobian_entry_3d.h | 38 +- .../joints/godot_pin_joint_3d.cpp | 36 +- .../joints/godot_pin_joint_3d.h | 42 +- .../joints/godot_slider_joint_3d.cpp | 45 +- .../joints/godot_slider_joint_3d.h | 77 +- modules/godot_physics_3d/register_types.cpp | 6 + modules/godot_physics_3d/register_types.h | 6 + .../gridmap/editor/grid_map_editor_plugin.cpp | 8 +- .../gridmap/editor/grid_map_editor_plugin.h | 20 +- modules/gridmap/grid_map.cpp | 8 +- modules/gridmap/grid_map.h | 8 +- modules/gridmap/register_types.cpp | 6 + modules/gridmap/register_types.h | 6 + modules/hdr/image_loader_hdr.cpp | 6 + modules/hdr/image_loader_hdr.h | 6 + modules/hdr/register_types.cpp | 6 + modules/hdr/register_types.h | 6 + .../audio_stream_interactive.cpp | 6 + .../audio_stream_interactive.h | 26 +- .../audio_stream_playlist.cpp | 6 + .../interactive_music/audio_stream_playlist.h | 8 +- .../audio_stream_synchronized.cpp | 6 + .../audio_stream_synchronized.h | 8 +- ...audio_stream_interactive_editor_plugin.cpp | 6 + .../audio_stream_interactive_editor_plugin.h | 6 + modules/interactive_music/register_types.cpp | 6 + modules/interactive_music/register_types.h | 6 + .../joints/jolt_cone_twist_joint_3d.cpp | 6 + .../joints/jolt_cone_twist_joint_3d.h | 6 + .../joints/jolt_generic_6dof_joint_3d.cpp | 6 + .../joints/jolt_generic_6dof_joint_3d.h | 6 + .../joints/jolt_hinge_joint_3d.cpp | 6 + .../jolt_physics/joints/jolt_hinge_joint_3d.h | 6 + modules/jolt_physics/joints/jolt_joint_3d.cpp | 6 + modules/jolt_physics/joints/jolt_joint_3d.h | 6 + .../jolt_physics/joints/jolt_pin_joint_3d.cpp | 6 + .../jolt_physics/joints/jolt_pin_joint_3d.h | 6 + .../joints/jolt_slider_joint_3d.cpp | 6 + .../joints/jolt_slider_joint_3d.h | 6 + modules/jolt_physics/jolt_globals.cpp | 6 + modules/jolt_physics/jolt_globals.h | 6 + .../jolt_physics/jolt_physics_server_3d.cpp | 6 + modules/jolt_physics/jolt_physics_server_3d.h | 6 + .../jolt_physics/jolt_project_settings.cpp | 6 + modules/jolt_physics/jolt_project_settings.h | 6 + modules/jolt_physics/misc/jolt_math_funcs.cpp | 34 +- modules/jolt_physics/misc/jolt_math_funcs.h | 10 +- .../jolt_physics/misc/jolt_stream_wrappers.h | 6 + .../jolt_physics/misc/jolt_type_conversions.h | 6 + modules/jolt_physics/objects/jolt_area_3d.cpp | 6 + modules/jolt_physics/objects/jolt_area_3d.h | 6 + modules/jolt_physics/objects/jolt_body_3d.cpp | 10 +- modules/jolt_physics/objects/jolt_body_3d.h | 8 + .../objects/jolt_group_filter.cpp | 6 + .../jolt_physics/objects/jolt_group_filter.h | 6 + .../jolt_physics/objects/jolt_object_3d.cpp | 6 + modules/jolt_physics/objects/jolt_object_3d.h | 6 + .../jolt_physics_direct_body_state_3d.cpp | 6 + .../jolt_physics_direct_body_state_3d.h | 6 + .../objects/jolt_shaped_object_3d.cpp | 6 + .../objects/jolt_shaped_object_3d.h | 6 + .../objects/jolt_soft_body_3d.cpp | 14 +- .../jolt_physics/objects/jolt_soft_body_3d.h | 6 + modules/jolt_physics/register_types.cpp | 6 + modules/jolt_physics/register_types.h | 6 + .../jolt_physics/shapes/jolt_box_shape_3d.cpp | 6 + .../jolt_physics/shapes/jolt_box_shape_3d.h | 6 + .../shapes/jolt_capsule_shape_3d.cpp | 6 + .../shapes/jolt_capsule_shape_3d.h | 6 + .../shapes/jolt_concave_polygon_shape_3d.cpp | 6 + .../shapes/jolt_concave_polygon_shape_3d.h | 6 + .../shapes/jolt_convex_polygon_shape_3d.cpp | 6 + .../shapes/jolt_convex_polygon_shape_3d.h | 6 + .../shapes/jolt_custom_decorated_shape.h | 6 + .../shapes/jolt_custom_double_sided_shape.cpp | 6 + .../shapes/jolt_custom_double_sided_shape.h | 6 + .../shapes/jolt_custom_motion_shape.cpp | 9 +- .../shapes/jolt_custom_motion_shape.h | 9 + .../shapes/jolt_custom_ray_shape.cpp | 6 + .../shapes/jolt_custom_ray_shape.h | 6 + .../shapes/jolt_custom_shape_type.h | 6 + .../shapes/jolt_custom_user_data_shape.cpp | 6 + .../shapes/jolt_custom_user_data_shape.h | 6 + .../shapes/jolt_cylinder_shape_3d.cpp | 6 + .../shapes/jolt_cylinder_shape_3d.h | 6 + .../shapes/jolt_height_map_shape_3d.cpp | 6 + .../shapes/jolt_height_map_shape_3d.h | 6 + .../shapes/jolt_separation_ray_shape_3d.cpp | 6 + .../shapes/jolt_separation_ray_shape_3d.h | 6 + modules/jolt_physics/shapes/jolt_shape_3d.cpp | 6 + modules/jolt_physics/shapes/jolt_shape_3d.h | 6 + .../shapes/jolt_shape_instance_3d.cpp | 6 + .../shapes/jolt_shape_instance_3d.h | 8 +- .../shapes/jolt_sphere_shape_3d.cpp | 6 + .../shapes/jolt_sphere_shape_3d.h | 6 + .../shapes/jolt_world_boundary_shape_3d.cpp | 6 + .../shapes/jolt_world_boundary_shape_3d.h | 6 + .../jolt_body_activation_listener_3d.cpp | 8 +- .../spaces/jolt_body_activation_listener_3d.h | 7 + .../spaces/jolt_broad_phase_layer.h | 6 + .../spaces/jolt_contact_listener_3d.cpp | 6 + .../spaces/jolt_contact_listener_3d.h | 6 + .../jolt_physics/spaces/jolt_job_system.cpp | 6 + modules/jolt_physics/spaces/jolt_job_system.h | 12 +- modules/jolt_physics/spaces/jolt_layers.cpp | 10 +- modules/jolt_physics/spaces/jolt_layers.h | 6 + .../spaces/jolt_motion_filter_3d.cpp | 6 + .../spaces/jolt_motion_filter_3d.h | 6 + .../jolt_physics_direct_space_state_3d.cpp | 6 + .../jolt_physics_direct_space_state_3d.h | 6 + .../spaces/jolt_query_collectors.h | 6 + .../spaces/jolt_query_filter_3d.cpp | 6 + .../spaces/jolt_query_filter_3d.h | 6 + modules/jolt_physics/spaces/jolt_space_3d.cpp | 7 +- modules/jolt_physics/spaces/jolt_space_3d.h | 7 + .../spaces/jolt_temp_allocator.cpp | 34 +- .../jolt_physics/spaces/jolt_temp_allocator.h | 6 + modules/jpg/image_loader_libjpeg_turbo.cpp | 6 + modules/jpg/image_loader_libjpeg_turbo.h | 6 + modules/jpg/movie_writer_mjpeg.cpp | 6 + modules/jpg/movie_writer_mjpeg.h | 6 + modules/jpg/register_types.cpp | 6 + modules/jpg/register_types.h | 6 + modules/jsonrpc/jsonrpc.cpp | 6 + modules/jsonrpc/jsonrpc.h | 6 + modules/jsonrpc/register_types.cpp | 6 + modules/jsonrpc/register_types.h | 6 + modules/jsonrpc/tests/test_jsonrpc.cpp | 6 + modules/jsonrpc/tests/test_jsonrpc.h | 6 + modules/ktx/register_types.cpp | 6 + modules/ktx/register_types.h | 6 + modules/ktx/texture_loader_ktx.cpp | 18 +- modules/ktx/texture_loader_ktx.h | 6 + modules/lightmapper_rd/lightmapper_rd.cpp | 6 + modules/lightmapper_rd/lightmapper_rd.h | 6 + modules/lightmapper_rd/register_types.cpp | 6 + modules/lightmapper_rd/register_types.h | 6 + modules/mbedtls/crypto_mbedtls.cpp | 6 + modules/mbedtls/crypto_mbedtls.h | 6 + modules/mbedtls/dtls_server_mbedtls.cpp | 6 + modules/mbedtls/dtls_server_mbedtls.h | 6 + modules/mbedtls/packet_peer_mbed_dtls.cpp | 6 + modules/mbedtls/packet_peer_mbed_dtls.h | 6 + modules/mbedtls/register_types.cpp | 6 + modules/mbedtls/register_types.h | 6 + modules/mbedtls/stream_peer_mbedtls.cpp | 6 + modules/mbedtls/stream_peer_mbedtls.h | 6 + modules/mbedtls/tests/test_crypto_mbedtls.cpp | 6 + modules/mbedtls/tests/test_crypto_mbedtls.h | 6 + modules/mbedtls/tls_context_mbedtls.cpp | 8 +- modules/mbedtls/tls_context_mbedtls.h | 6 + modules/mcp/mcp_bridge.cpp | 6 + modules/mcp/mcp_bridge.h | 16 +- modules/mcp/mcp_protocol.cpp | 6 + modules/mcp/mcp_protocol.h | 17 +- modules/mcp/mcp_server.cpp | 6 + modules/mcp/mcp_server.h | 28 +- modules/mcp/mcp_tools.cpp | 6 + modules/mcp/mcp_tools.h | 27 +- modules/mcp/mcp_types.h | 16 +- modules/mcp/register_types.cpp | 6 + modules/mcp/register_types.h | 6 + modules/meshoptimizer/register_types.cpp | 6 + modules/meshoptimizer/register_types.h | 6 + modules/minimp3/audio_stream_mp3.cpp | 6 + modules/minimp3/audio_stream_mp3.h | 10 +- modules/minimp3/register_types.cpp | 6 + modules/minimp3/register_types.h | 6 + modules/minimp3/resource_importer_mp3.cpp | 6 + modules/minimp3/resource_importer_mp3.h | 6 + modules/mobile_vr/mobile_vr_interface.cpp | 10 +- modules/mobile_vr/mobile_vr_interface.h | 43 +- modules/mobile_vr/register_types.cpp | 6 + modules/mobile_vr/register_types.h | 6 + modules/mono/class_db_api_json.cpp | 6 + modules/mono/class_db_api_json.h | 6 + modules/mono/csharp_script.cpp | 47 +- modules/mono/csharp_script.h | 95 +- modules/mono/editor/bindings_generator.cpp | 92 +- modules/mono/editor/bindings_generator.h | 17 +- modules/mono/editor/code_completion.cpp | 6 + modules/mono/editor/code_completion.h | 6 + modules/mono/editor/editor_internal_calls.cpp | 10 +- modules/mono/editor/editor_internal_calls.h | 6 + modules/mono/editor/hostfxr_resolver.cpp | 66 +- modules/mono/editor/hostfxr_resolver.h | 6 + modules/mono/editor/semver.cpp | 6 + modules/mono/editor/semver.h | 6 + modules/mono/glue/runtime_interop.cpp | 10 +- modules/mono/glue/runtime_interop.h | 6 + modules/mono/godotsharp_defs.h | 6 + modules/mono/godotsharp_dirs.cpp | 8 +- modules/mono/godotsharp_dirs.h | 6 + modules/mono/interop_types.h | 14 +- modules/mono/managed_callable.cpp | 6 + modules/mono/managed_callable.h | 6 + modules/mono/mono_gc_handle.cpp | 6 + modules/mono/mono_gc_handle.h | 8 +- modules/mono/mono_gd/gd_mono.cpp | 6 + modules/mono/mono_gd/gd_mono.h | 6 + modules/mono/mono_gd/gd_mono_cache.cpp | 6 + modules/mono/mono_gd/gd_mono_cache.h | 10 +- modules/mono/register_types.cpp | 6 + modules/mono/register_types.h | 6 + modules/mono/signal_awaiter_utils.cpp | 8 +- modules/mono/signal_awaiter_utils.h | 6 + modules/mono/utils/macos_utils.cpp | 6 + modules/mono/utils/macos_utils.h | 6 + modules/mono/utils/macros.h | 6 + modules/mono/utils/naming_utils.cpp | 6 + modules/mono/utils/naming_utils.h | 6 + modules/mono/utils/path_utils.cpp | 9 +- modules/mono/utils/path_utils.h | 6 + modules/mono/utils/string_utils.cpp | 8 +- modules/mono/utils/string_utils.h | 6 + modules/msdfgen/register_types.h | 6 + .../editor/editor_network_profiler.cpp | 6 + .../editor/editor_network_profiler.h | 6 + .../editor/multiplayer_editor_plugin.cpp | 6 + .../editor/multiplayer_editor_plugin.h | 6 + .../multiplayer/editor/replication_editor.cpp | 6 + .../multiplayer/editor/replication_editor.h | 6 + modules/multiplayer/multiplayer_debugger.cpp | 6 + modules/multiplayer/multiplayer_debugger.h | 6 + modules/multiplayer/multiplayer_spawner.cpp | 8 +- modules/multiplayer/multiplayer_spawner.h | 7 + .../multiplayer/multiplayer_synchronizer.cpp | 6 + .../multiplayer/multiplayer_synchronizer.h | 8 +- modules/multiplayer/register_types.cpp | 6 + modules/multiplayer/register_types.h | 6 + modules/multiplayer/scene_cache_interface.cpp | 8 +- modules/multiplayer/scene_cache_interface.h | 16 +- modules/multiplayer/scene_multiplayer.cpp | 6 + modules/multiplayer/scene_multiplayer.h | 22 +- .../multiplayer/scene_replication_config.cpp | 6 + .../multiplayer/scene_replication_config.h | 8 +- .../scene_replication_interface.cpp | 8 +- .../multiplayer/scene_replication_interface.h | 23 +- modules/multiplayer/scene_rpc_interface.cpp | 8 +- modules/multiplayer/scene_rpc_interface.h | 6 + .../tests/test_multiplayer_spawner.h | 6 + .../tests/test_scene_multiplayer.h | 6 + .../2d/godot_navigation_server_2d.cpp | 24 +- .../2d/godot_navigation_server_2d.h | 22 +- .../navigation_2d/2d/nav_base_iteration_2d.h | 6 + .../navigation_2d/2d/nav_map_builder_2d.cpp | 6 + modules/navigation_2d/2d/nav_map_builder_2d.h | 6 + .../navigation_2d/2d/nav_map_iteration_2d.h | 8 +- .../2d/nav_mesh_generator_2d.cpp | 6 + .../navigation_2d/2d/nav_mesh_generator_2d.h | 6 + .../navigation_2d/2d/nav_mesh_queries_2d.cpp | 10 +- .../navigation_2d/2d/nav_mesh_queries_2d.h | 25 +- .../2d/nav_region_builder_2d.cpp | 6 + .../navigation_2d/2d/nav_region_builder_2d.h | 6 + .../2d/nav_region_iteration_2d.h | 6 + .../navigation_link_2d_editor_plugin.cpp | 6 + .../editor/navigation_link_2d_editor_plugin.h | 6 + .../navigation_obstacle_2d_editor_plugin.cpp | 6 + .../navigation_obstacle_2d_editor_plugin.h | 6 + .../navigation_region_2d_editor_plugin.cpp | 6 + .../navigation_region_2d_editor_plugin.h | 6 + modules/navigation_2d/nav_agent_2d.cpp | 13 +- modules/navigation_2d/nav_agent_2d.h | 18 +- modules/navigation_2d/nav_base_2d.h | 6 + modules/navigation_2d/nav_link_2d.cpp | 6 + modules/navigation_2d/nav_link_2d.h | 10 +- modules/navigation_2d/nav_map_2d.cpp | 6 + modules/navigation_2d/nav_map_2d.h | 16 +- modules/navigation_2d/nav_obstacle_2d.cpp | 6 + modules/navigation_2d/nav_obstacle_2d.h | 6 + modules/navigation_2d/nav_region_2d.cpp | 6 + modules/navigation_2d/nav_region_2d.h | 14 +- modules/navigation_2d/nav_rid_2d.h | 6 + modules/navigation_2d/nav_utils_2d.h | 8 +- modules/navigation_2d/register_types.cpp | 6 + modules/navigation_2d/register_types.h | 6 + modules/navigation_2d/triangle2.cpp | 6 + modules/navigation_2d/triangle2.h | 6 + .../3d/godot_navigation_server_3d.cpp | 19 +- .../3d/godot_navigation_server_3d.h | 20 +- .../navigation_3d/3d/nav_base_iteration_3d.h | 6 + .../navigation_3d/3d/nav_map_builder_3d.cpp | 6 + modules/navigation_3d/3d/nav_map_builder_3d.h | 6 + .../navigation_3d/3d/nav_map_iteration_3d.h | 8 +- .../3d/nav_mesh_generator_3d.cpp | 6 + .../navigation_3d/3d/nav_mesh_generator_3d.h | 6 + .../navigation_3d/3d/nav_mesh_queries_3d.cpp | 6 + .../navigation_3d/3d/nav_mesh_queries_3d.h | 24 +- .../3d/nav_region_builder_3d.cpp | 6 + .../navigation_3d/3d/nav_region_builder_3d.h | 6 + .../3d/nav_region_iteration_3d.h | 6 + .../3d/navigation_mesh_generator.cpp | 6 + .../3d/navigation_mesh_generator.h | 6 + .../navigation_link_3d_editor_plugin.cpp | 6 + .../editor/navigation_link_3d_editor_plugin.h | 6 + .../navigation_link_3d_gizmo_plugin.cpp | 6 + .../editor/navigation_link_3d_gizmo_plugin.h | 6 + .../navigation_obstacle_3d_editor_plugin.cpp | 6 + .../navigation_obstacle_3d_editor_plugin.h | 6 + .../navigation_region_3d_editor_plugin.cpp | 6 + .../navigation_region_3d_editor_plugin.h | 6 + .../navigation_region_3d_gizmo_plugin.cpp | 6 + .../navigation_region_3d_gizmo_plugin.h | 6 + modules/navigation_3d/nav_agent_3d.cpp | 13 +- modules/navigation_3d/nav_agent_3d.h | 16 +- modules/navigation_3d/nav_base_3d.h | 6 + modules/navigation_3d/nav_link_3d.cpp | 6 + modules/navigation_3d/nav_link_3d.h | 10 +- modules/navigation_3d/nav_map_3d.cpp | 6 + modules/navigation_3d/nav_map_3d.h | 16 +- modules/navigation_3d/nav_obstacle_3d.cpp | 6 + modules/navigation_3d/nav_obstacle_3d.h | 6 + modules/navigation_3d/nav_region_3d.cpp | 6 + modules/navigation_3d/nav_region_3d.h | 14 +- modules/navigation_3d/nav_rid_3d.h | 6 + modules/navigation_3d/nav_utils_3d.h | 8 +- modules/navigation_3d/register_types.cpp | 6 + modules/navigation_3d/register_types.h | 6 + modules/noise/editor/noise_editor_plugin.cpp | 6 + modules/noise/editor/noise_editor_plugin.h | 6 + modules/noise/fastnoise_lite.cpp | 6 + modules/noise/fastnoise_lite.h | 50 +- modules/noise/noise.cpp | 17 +- modules/noise/noise.h | 56 +- modules/noise/noise_texture_2d.cpp | 6 + modules/noise/noise_texture_2d.h | 6 + modules/noise/noise_texture_3d.cpp | 6 + modules/noise/noise_texture_3d.h | 6 + modules/noise/register_types.cpp | 6 + modules/noise/register_types.h | 6 + modules/noise/tests/test_fastnoise_lite.h | 6 + modules/noise/tests/test_noise_texture_2d.h | 6 + modules/noise/tests/test_noise_texture_3d.h | 6 + modules/ogg/ogg_packet_sequence.cpp | 8 +- modules/ogg/ogg_packet_sequence.h | 44 +- modules/ogg/register_types.cpp | 6 + modules/ogg/register_types.h | 6 + modules/openxr/action_map/openxr_action.cpp | 8 +- modules/openxr/action_map/openxr_action.h | 29 +- .../openxr/action_map/openxr_action_map.cpp | 8 +- modules/openxr/action_map/openxr_action_map.h | 52 +- .../openxr/action_map/openxr_action_set.cpp | 10 +- modules/openxr/action_map/openxr_action_set.h | 32 +- .../action_map/openxr_binding_modifier.cpp | 6 + .../action_map/openxr_binding_modifier.h | 14 +- .../action_map/openxr_haptic_feedback.cpp | 6 + .../action_map/openxr_haptic_feedback.h | 6 + .../action_map/openxr_interaction_profile.cpp | 8 +- .../action_map/openxr_interaction_profile.h | 78 +- .../openxr_interaction_profile_metadata.cpp | 12 +- .../openxr_interaction_profile_metadata.h | 72 +- .../openxr/editor/openxr_action_editor.cpp | 8 +- modules/openxr/editor/openxr_action_editor.h | 6 + .../editor/openxr_action_map_editor.cpp | 12 +- .../openxr/editor/openxr_action_map_editor.h | 17 +- .../editor/openxr_action_set_editor.cpp | 8 +- .../openxr/editor/openxr_action_set_editor.h | 10 +- .../editor/openxr_binding_modifier_editor.cpp | 6 + .../editor/openxr_binding_modifier_editor.h | 6 + .../openxr_binding_modifiers_dialog.cpp | 8 +- .../editor/openxr_binding_modifiers_dialog.h | 6 + .../openxr/editor/openxr_editor_plugin.cpp | 6 + modules/openxr/editor/openxr_editor_plugin.h | 6 + .../openxr_interaction_profile_editor.cpp | 14 +- .../openxr_interaction_profile_editor.h | 9 +- .../editor/openxr_select_action_dialog.cpp | 6 + .../editor/openxr_select_action_dialog.h | 6 + ...enxr_select_interaction_profile_dialog.cpp | 6 + ...openxr_select_interaction_profile_dialog.h | 6 + .../openxr/editor/openxr_select_runtime.cpp | 8 +- modules/openxr/editor/openxr_select_runtime.h | 6 + ...enxr_composition_layer_depth_extension.cpp | 7 +- ...openxr_composition_layer_depth_extension.h | 7 + .../openxr_composition_layer_extension.cpp | 6 + .../openxr_composition_layer_extension.h | 26 +- .../openxr_debug_utils_extension.cpp | 6 + .../extensions/openxr_debug_utils_extension.h | 12 +- .../openxr_dpad_binding_extension.cpp | 9 +- .../openxr_dpad_binding_extension.h | 6 + .../extensions/openxr_extension_wrapper.cpp | 6 + .../extensions/openxr_extension_wrapper.h | 136 +- .../openxr_extension_wrapper_extension.h | 6 + .../openxr_eye_gaze_interaction.cpp | 6 + .../extensions/openxr_eye_gaze_interaction.h | 6 + ...enxr_fb_display_refresh_rate_extension.cpp | 6 + ...openxr_fb_display_refresh_rate_extension.h | 18 +- .../openxr_fb_foveation_extension.cpp | 6 + .../openxr_fb_foveation_extension.h | 20 +- .../openxr_fb_update_swapchain_extension.cpp | 6 + .../openxr_fb_update_swapchain_extension.h | 22 +- .../extensions/openxr_future_extension.cpp | 6 + .../extensions/openxr_future_extension.h | 38 +- .../openxr_hand_interaction_extension.cpp | 6 + .../openxr_hand_interaction_extension.h | 38 +- .../openxr_hand_tracking_extension.cpp | 6 + .../openxr_hand_tracking_extension.h | 27 +- .../openxr_htc_controller_extension.cpp | 6 + .../openxr_htc_controller_extension.h | 8 +- .../openxr_htc_vive_tracker_extension.cpp | 6 + .../openxr_htc_vive_tracker_extension.h | 6 + .../openxr_huawei_controller_extension.cpp | 6 + .../openxr_huawei_controller_extension.h | 6 + .../openxr_local_floor_extension.cpp | 6 + .../extensions/openxr_local_floor_extension.h | 6 + .../openxr_meta_controller_extension.cpp | 6 + .../openxr_meta_controller_extension.h | 12 +- .../openxr_ml2_controller_extension.cpp | 6 + .../openxr_ml2_controller_extension.h | 6 + .../extensions/openxr_mxink_extension.cpp | 6 + .../extensions/openxr_mxink_extension.h | 6 + .../extensions/openxr_palm_pose_extension.cpp | 6 + .../extensions/openxr_palm_pose_extension.h | 6 + .../openxr_performance_settings_extension.cpp | 6 + .../openxr_performance_settings_extension.h | 6 + .../openxr_pico_controller_extension.cpp | 6 + .../openxr_pico_controller_extension.h | 6 + .../openxr_render_model_extension.cpp | 6 + .../openxr_render_model_extension.h | 30 +- ...penxr_valve_analog_threshold_extension.cpp | 6 + .../openxr_valve_analog_threshold_extension.h | 6 + .../openxr_visibility_mask_extension.cpp | 6 + .../openxr_visibility_mask_extension.h | 28 +- .../openxr_wmr_controller_extension.cpp | 6 + .../openxr_wmr_controller_extension.h | 6 + .../platform/openxr_android_extension.cpp | 10 +- .../platform/openxr_android_extension.h | 6 + .../platform/openxr_d3d12_extension.cpp | 6 + .../platform/openxr_d3d12_extension.h | 6 + .../platform/openxr_metal_extension.h | 6 + .../platform/openxr_opengl_extension.cpp | 39 +- .../platform/openxr_opengl_extension.h | 6 + .../platform/openxr_vulkan_extension.cpp | 14 +- .../platform/openxr_vulkan_extension.h | 11 +- modules/openxr/openxr_api.cpp | 74 +- modules/openxr/openxr_api.h | 109 +- modules/openxr/openxr_api_extension.cpp | 6 + modules/openxr/openxr_api_extension.h | 8 +- modules/openxr/openxr_interface.cpp | 13 +- modules/openxr/openxr_interface.h | 92 +- modules/openxr/openxr_platform_inc.h | 6 + modules/openxr/openxr_util.cpp | 23 +- modules/openxr/openxr_util.h | 25 + modules/openxr/openxr_uuid.h | 6 + modules/openxr/register_types.cpp | 6 + modules/openxr/register_types.h | 6 + .../openxr/scene/openxr_composition_layer.cpp | 6 + .../openxr/scene/openxr_composition_layer.h | 14 +- .../openxr_composition_layer_cylinder.cpp | 6 + .../scene/openxr_composition_layer_cylinder.h | 6 + .../openxr_composition_layer_equirect.cpp | 6 + .../scene/openxr_composition_layer_equirect.h | 6 + .../scene/openxr_composition_layer_quad.cpp | 6 + .../scene/openxr_composition_layer_quad.h | 6 + modules/openxr/scene/openxr_hand.cpp | 10 +- modules/openxr/scene/openxr_hand.h | 10 +- modules/openxr/scene/openxr_render_model.cpp | 6 + modules/openxr/scene/openxr_render_model.h | 6 + .../scene/openxr_render_model_manager.cpp | 6 + .../scene/openxr_render_model_manager.h | 8 +- .../openxr/scene/openxr_visibility_mask.cpp | 6 + modules/openxr/scene/openxr_visibility_mask.h | 6 + modules/openxr/util.h | 6 + modules/raycast/lightmap_raycaster_embree.cpp | 6 + modules/raycast/lightmap_raycaster_embree.h | 6 + modules/raycast/raycast_occlusion_cull.cpp | 12 +- modules/raycast/raycast_occlusion_cull.h | 10 +- modules/raycast/register_types.cpp | 6 + modules/raycast/register_types.h | 6 + modules/raycast/static_raycaster_embree.cpp | 6 + modules/raycast/static_raycaster_embree.h | 6 + modules/regex/regex.cpp | 6 + modules/regex/regex.h | 6 + modules/regex/register_types.cpp | 6 + modules/regex/register_types.h | 6 + modules/regex/tests/test_regex.h | 6 + modules/register_module_types.h | 6 + modules/soundsmith/register_types.cpp | 6 + modules/soundsmith/register_types.h | 6 + modules/soundsmith/soundsmith_module.cpp | 8 +- modules/soundsmith/soundsmith_module.h | 6 + modules/svg/image_loader_svg.cpp | 13 +- modules/svg/image_loader_svg.h | 12 + modules/svg/register_types.cpp | 6 + modules/svg/register_types.h | 6 + .../text_server_adv/icu_data/icudata_stub.cpp | 6 + modules/text_server_adv/register_types.cpp | 6 + modules/text_server_adv/register_types.h | 6 + modules/text_server_adv/script_iterator.cpp | 8 +- modules/text_server_adv/script_iterator.h | 7 + modules/text_server_adv/text_server_adv.cpp | 9 +- modules/text_server_adv/text_server_adv.h | 70 +- modules/text_server_adv/thorvg_svg_in_ot.cpp | 6 + modules/text_server_adv/thorvg_svg_in_ot.h | 6 + modules/text_server_fb/register_types.cpp | 6 + modules/text_server_fb/register_types.h | 6 + modules/text_server_fb/text_server_fb.cpp | 7 +- modules/text_server_fb/text_server_fb.h | 62 +- modules/text_server_fb/thorvg_svg_in_ot.cpp | 6 + modules/text_server_fb/thorvg_svg_in_ot.h | 6 + modules/tga/image_loader_tga.cpp | 6 + modules/tga/image_loader_tga.h | 6 + modules/tga/register_types.cpp | 6 + modules/tga/register_types.h | 6 + modules/theora/editor/movie_writer_ogv.cpp | 13 +- modules/theora/editor/movie_writer_ogv.h | 51 +- modules/theora/editor/rgb2yuv.h | 13 +- modules/theora/register_types.cpp | 6 + modules/theora/register_types.h | 6 + modules/theora/video_stream_theora.cpp | 15 +- modules/theora/video_stream_theora.h | 9 + modules/tinyexr/image_loader_tinyexr.cpp | 6 + modules/tinyexr/image_loader_tinyexr.h | 6 + modules/tinyexr/image_saver_tinyexr.cpp | 6 + modules/tinyexr/image_saver_tinyexr.h | 6 + modules/tinyexr/register_types.cpp | 6 + modules/tinyexr/register_types.h | 6 + modules/upnp/register_types.cpp | 6 + modules/upnp/register_types.h | 6 + modules/upnp/upnp.cpp | 6 + modules/upnp/upnp.h | 6 + modules/upnp/upnp_device.cpp | 6 + modules/upnp/upnp_device.h | 6 + modules/upnp/upnp_device_miniupnp.cpp | 6 + modules/upnp/upnp_device_miniupnp.h | 6 + modules/upnp/upnp_miniupnp.cpp | 6 + modules/upnp/upnp_miniupnp.h | 6 + modules/vhacd/register_types.cpp | 6 + modules/vhacd/register_types.h | 6 + modules/vorbis/audio_stream_ogg_vorbis.cpp | 6 + modules/vorbis/audio_stream_ogg_vorbis.h | 18 +- modules/vorbis/register_types.cpp | 6 + modules/vorbis/register_types.h | 6 + .../vorbis/resource_importer_ogg_vorbis.cpp | 6 + modules/vorbis/resource_importer_ogg_vorbis.h | 6 + modules/webp/image_frames_loader_webp.cpp | 6 + modules/webp/image_frames_loader_webp.h | 6 + modules/webp/image_loader_webp.cpp | 6 + modules/webp/image_loader_webp.h | 6 + modules/webp/register_types.cpp | 6 + modules/webp/register_types.h | 6 + modules/webp/resource_saver_webp.cpp | 6 + modules/webp/resource_saver_webp.h | 6 + modules/webp/webp_common.cpp | 8 +- modules/webp/webp_common.h | 14 +- modules/webrtc/register_types.cpp | 6 + modules/webrtc/register_types.h | 6 + modules/webrtc/webrtc_data_channel.cpp | 6 + modules/webrtc/webrtc_data_channel.h | 6 + .../webrtc/webrtc_data_channel_extension.cpp | 6 + .../webrtc/webrtc_data_channel_extension.h | 6 + modules/webrtc/webrtc_data_channel_js.cpp | 10 +- modules/webrtc/webrtc_data_channel_js.h | 8 +- modules/webrtc/webrtc_multiplayer_peer.cpp | 8 +- modules/webrtc/webrtc_multiplayer_peer.h | 12 +- modules/webrtc/webrtc_peer_connection.cpp | 6 + modules/webrtc/webrtc_peer_connection.h | 6 + .../webrtc_peer_connection_extension.cpp | 6 + .../webrtc/webrtc_peer_connection_extension.h | 6 + modules/webrtc/webrtc_peer_connection_js.cpp | 6 + modules/webrtc/webrtc_peer_connection_js.h | 6 + .../editor_debugger_server_websocket.cpp | 6 + .../editor/editor_debugger_server_websocket.h | 6 + modules/websocket/emws_peer.cpp | 6 + modules/websocket/emws_peer.h | 15 +- modules/websocket/packet_buffer.h | 6 + modules/websocket/register_types.cpp | 6 + modules/websocket/register_types.h | 6 + .../remote_debugger_peer_websocket.cpp | 6 + .../remote_debugger_peer_websocket.h | 6 + .../websocket/websocket_multiplayer_peer.cpp | 6 + .../websocket/websocket_multiplayer_peer.h | 20 +- modules/websocket/websocket_peer.cpp | 6 + modules/websocket/websocket_peer.h | 6 + modules/websocket/wsl_peer.cpp | 6 + modules/websocket/wsl_peer.h | 36 +- modules/webxr/godot_webxr.h | 6 + modules/webxr/register_types.cpp | 6 + modules/webxr/register_types.h | 6 + modules/webxr/webxr_interface.cpp | 6 + modules/webxr/webxr_interface.h | 11 +- modules/webxr/webxr_interface_js.cpp | 8 +- modules/webxr/webxr_interface_js.h | 14 +- modules/xatlas_unwrap/register_types.cpp | 6 + modules/xatlas_unwrap/register_types.h | 6 + modules/zip/register_types.cpp | 6 + modules/zip/register_types.h | 6 + modules/zip/tests/test_zip.cpp | 6 + modules/zip/tests/test_zip.h | 6 + modules/zip/zip_packer.cpp | 6 + modules/zip/zip_packer.h | 6 + modules/zip/zip_reader.cpp | 6 + modules/zip/zip_reader.h | 6 + scene/2d/animated_sprite_2d.cpp | 6 + scene/2d/animated_sprite_2d.h | 6 + scene/2d/audio_listener_2d.cpp | 6 + scene/2d/audio_listener_2d.h | 6 + scene/2d/audio_stream_player_2d.cpp | 7 +- scene/2d/audio_stream_player_2d.h | 9 +- scene/2d/back_buffer_copy.cpp | 6 + scene/2d/back_buffer_copy.h | 6 + scene/2d/camera_2d.cpp | 18 +- scene/2d/camera_2d.h | 12 +- scene/2d/canvas_group.cpp | 6 + scene/2d/canvas_group.h | 6 + scene/2d/canvas_modulate.cpp | 6 + scene/2d/canvas_modulate.h | 10 +- scene/2d/cpu_particles_2d.cpp | 16 +- scene/2d/cpu_particles_2d.h | 14 +- scene/2d/gpu_particles_2d.cpp | 10 +- scene/2d/gpu_particles_2d.h | 8 + scene/2d/light_2d.cpp | 7 +- scene/2d/light_2d.h | 7 + scene/2d/light_occluder_2d.cpp | 6 + scene/2d/light_occluder_2d.h | 6 + scene/2d/line_2d.cpp | 8 +- scene/2d/line_2d.h | 6 + scene/2d/line_builder.cpp | 6 + scene/2d/line_builder.h | 27 +- scene/2d/marker_2d.cpp | 6 + scene/2d/marker_2d.h | 6 + scene/2d/mesh_instance_2d.cpp | 6 + scene/2d/mesh_instance_2d.h | 6 + scene/2d/multimesh_instance_2d.cpp | 6 + scene/2d/multimesh_instance_2d.h | 6 + scene/2d/navigation/navigation_agent_2d.cpp | 6 + scene/2d/navigation/navigation_agent_2d.h | 22 +- scene/2d/navigation/navigation_link_2d.cpp | 6 + scene/2d/navigation/navigation_link_2d.h | 6 + .../2d/navigation/navigation_obstacle_2d.cpp | 6 + scene/2d/navigation/navigation_obstacle_2d.h | 6 + scene/2d/navigation/navigation_region_2d.cpp | 7 +- scene/2d/navigation/navigation_region_2d.h | 7 + scene/2d/node_2d.cpp | 6 + scene/2d/node_2d.h | 6 + scene/2d/parallax_2d.cpp | 6 + scene/2d/parallax_2d.h | 6 + scene/2d/parallax_background.cpp | 6 + scene/2d/parallax_background.h | 6 + scene/2d/parallax_layer.cpp | 6 + scene/2d/parallax_layer.h | 6 + scene/2d/path_2d.cpp | 6 + scene/2d/path_2d.h | 6 + scene/2d/physics/animatable_body_2d.cpp | 6 + scene/2d/physics/animatable_body_2d.h | 6 + scene/2d/physics/area_2d.cpp | 6 + scene/2d/physics/area_2d.h | 10 +- scene/2d/physics/character_body_2d.cpp | 9 +- scene/2d/physics/character_body_2d.h | 7 + scene/2d/physics/collision_object_2d.cpp | 6 + scene/2d/physics/collision_object_2d.h | 8 +- scene/2d/physics/collision_polygon_2d.cpp | 6 + scene/2d/physics/collision_polygon_2d.h | 6 + scene/2d/physics/collision_shape_2d.cpp | 6 + scene/2d/physics/collision_shape_2d.h | 8 +- .../physics/joints/damped_spring_joint_2d.cpp | 6 + .../physics/joints/damped_spring_joint_2d.h | 6 + scene/2d/physics/joints/groove_joint_2d.cpp | 6 + scene/2d/physics/joints/groove_joint_2d.h | 6 + scene/2d/physics/joints/joint_2d.cpp | 6 + scene/2d/physics/joints/joint_2d.h | 6 + scene/2d/physics/joints/pin_joint_2d.cpp | 6 + scene/2d/physics/joints/pin_joint_2d.h | 6 + scene/2d/physics/kinematic_collision_2d.cpp | 6 + scene/2d/physics/kinematic_collision_2d.h | 6 + scene/2d/physics/physical_bone_2d.cpp | 6 + scene/2d/physics/physical_bone_2d.h | 6 + scene/2d/physics/physics_body_2d.cpp | 6 + scene/2d/physics/physics_body_2d.h | 8 +- scene/2d/physics/ray_cast_2d.cpp | 6 + scene/2d/physics/ray_cast_2d.h | 6 + scene/2d/physics/rigid_body_2d.cpp | 6 + scene/2d/physics/rigid_body_2d.h | 8 +- scene/2d/physics/shape_cast_2d.cpp | 6 + scene/2d/physics/shape_cast_2d.h | 6 + scene/2d/physics/static_body_2d.cpp | 6 + scene/2d/physics/static_body_2d.h | 6 + scene/2d/physics/touch_screen_button.cpp | 6 + scene/2d/physics/touch_screen_button.h | 6 + scene/2d/polygon_2d.cpp | 6 + scene/2d/polygon_2d.h | 6 + scene/2d/remote_transform_2d.cpp | 8 +- scene/2d/remote_transform_2d.h | 6 + scene/2d/skeleton_2d.cpp | 16 +- scene/2d/skeleton_2d.h | 8 +- scene/2d/sprite_2d.cpp | 8 +- scene/2d/sprite_2d.h | 8 + scene/2d/tile_map.cpp | 14 +- scene/2d/tile_map.h | 86 +- scene/2d/tile_map_layer.cpp | 17 +- scene/2d/tile_map_layer.h | 50 +- scene/2d/visible_on_screen_notifier_2d.cpp | 6 + scene/2d/visible_on_screen_notifier_2d.h | 6 + scene/3d/aim_modifier_3d.cpp | 6 + scene/3d/aim_modifier_3d.h | 6 + scene/3d/audio_listener_3d.cpp | 6 + scene/3d/audio_listener_3d.h | 6 + scene/3d/audio_stream_player_3d.cpp | 25 +- scene/3d/audio_stream_player_3d.h | 11 +- scene/3d/bone_attachment_3d.cpp | 7 +- scene/3d/bone_attachment_3d.h | 7 + scene/3d/bone_constraint_3d.cpp | 6 + scene/3d/bone_constraint_3d.h | 12 +- scene/3d/camera_3d.cpp | 10 +- scene/3d/camera_3d.h | 10 +- scene/3d/convert_transform_modifier_3d.cpp | 8 +- scene/3d/convert_transform_modifier_3d.h | 6 + scene/3d/copy_transform_modifier_3d.cpp | 6 + scene/3d/copy_transform_modifier_3d.h | 6 + scene/3d/cpu_particles_3d.cpp | 8 +- scene/3d/cpu_particles_3d.h | 6 + scene/3d/decal.cpp | 6 + scene/3d/decal.h | 6 + scene/3d/fog_volume.cpp | 6 + scene/3d/fog_volume.h | 6 + scene/3d/gpu_particles_3d.cpp | 8 +- scene/3d/gpu_particles_3d.h | 6 + scene/3d/gpu_particles_collision_3d.cpp | 8 +- scene/3d/gpu_particles_collision_3d.h | 8 +- scene/3d/importer_mesh_instance_3d.cpp | 6 + scene/3d/importer_mesh_instance_3d.h | 6 + scene/3d/label_3d.cpp | 8 +- scene/3d/label_3d.h | 8 +- scene/3d/light_3d.cpp | 12 +- scene/3d/light_3d.h | 8 +- scene/3d/lightmap_gi.cpp | 10 +- scene/3d/lightmap_gi.h | 15 +- scene/3d/lightmap_probe.cpp | 6 + scene/3d/lightmap_probe.h | 6 + scene/3d/lightmapper.cpp | 6 + scene/3d/lightmapper.h | 14 +- scene/3d/look_at_modifier_3d.cpp | 8 +- scene/3d/look_at_modifier_3d.h | 10 +- scene/3d/marker_3d.cpp | 6 + scene/3d/marker_3d.h | 6 + scene/3d/mesh_instance_3d.cpp | 9 +- scene/3d/mesh_instance_3d.h | 8 + scene/3d/modifier_bone_target_3d.cpp | 6 + scene/3d/modifier_bone_target_3d.h | 6 + scene/3d/multimesh_instance_3d.cpp | 6 + scene/3d/multimesh_instance_3d.h | 6 + scene/3d/navigation/navigation_agent_3d.cpp | 19 +- scene/3d/navigation/navigation_agent_3d.h | 28 +- scene/3d/navigation/navigation_link_3d.cpp | 6 + scene/3d/navigation/navigation_link_3d.h | 6 + .../3d/navigation/navigation_obstacle_3d.cpp | 6 + scene/3d/navigation/navigation_obstacle_3d.h | 6 + scene/3d/navigation/navigation_region_3d.cpp | 6 + scene/3d/navigation/navigation_region_3d.h | 6 + scene/3d/node_3d.cpp | 79 +- scene/3d/node_3d.h | 102 +- scene/3d/occluder_instance_3d.cpp | 6 + scene/3d/occluder_instance_3d.h | 6 + scene/3d/path_3d.cpp | 6 + scene/3d/path_3d.h | 8 +- scene/3d/physics/animatable_body_3d.cpp | 6 + scene/3d/physics/animatable_body_3d.h | 6 + scene/3d/physics/area_3d.cpp | 6 + scene/3d/physics/area_3d.h | 6 + scene/3d/physics/character_body_3d.cpp | 8 +- scene/3d/physics/character_body_3d.h | 6 + scene/3d/physics/collision_object_3d.cpp | 6 + scene/3d/physics/collision_object_3d.h | 8 +- scene/3d/physics/collision_polygon_3d.cpp | 6 + scene/3d/physics/collision_polygon_3d.h | 6 + scene/3d/physics/collision_shape_3d.cpp | 6 + scene/3d/physics/collision_shape_3d.h | 6 + .../3d/physics/joints/cone_twist_joint_3d.cpp | 6 + scene/3d/physics/joints/cone_twist_joint_3d.h | 6 + .../physics/joints/generic_6dof_joint_3d.cpp | 6 + .../3d/physics/joints/generic_6dof_joint_3d.h | 6 + scene/3d/physics/joints/hinge_joint_3d.cpp | 6 + scene/3d/physics/joints/hinge_joint_3d.h | 6 + scene/3d/physics/joints/joint_3d.cpp | 6 + scene/3d/physics/joints/joint_3d.h | 6 + scene/3d/physics/joints/pin_joint_3d.cpp | 6 + scene/3d/physics/joints/pin_joint_3d.h | 6 + scene/3d/physics/joints/slider_joint_3d.cpp | 6 + scene/3d/physics/joints/slider_joint_3d.h | 6 + scene/3d/physics/kinematic_collision_3d.cpp | 6 + scene/3d/physics/kinematic_collision_3d.h | 6 + scene/3d/physics/physical_bone_3d.cpp | 6 + scene/3d/physics/physical_bone_3d.h | 10 +- .../3d/physics/physical_bone_simulator_3d.cpp | 6 + scene/3d/physics/physical_bone_simulator_3d.h | 10 +- scene/3d/physics/physics_body_3d.cpp | 6 + scene/3d/physics/physics_body_3d.h | 8 +- scene/3d/physics/ray_cast_3d.cpp | 6 + scene/3d/physics/ray_cast_3d.h | 6 + scene/3d/physics/rigid_body_3d.cpp | 6 + scene/3d/physics/rigid_body_3d.h | 6 + scene/3d/physics/shape_cast_3d.cpp | 6 + scene/3d/physics/shape_cast_3d.h | 6 + scene/3d/physics/soft_body_3d.cpp | 6 + scene/3d/physics/soft_body_3d.h | 8 +- scene/3d/physics/spring_arm_3d.cpp | 6 + scene/3d/physics/spring_arm_3d.h | 6 + scene/3d/physics/static_body_3d.cpp | 6 + scene/3d/physics/static_body_3d.h | 6 + scene/3d/physics/vehicle_body_3d.cpp | 24 +- scene/3d/physics/vehicle_body_3d.h | 31 +- scene/3d/reflection_probe.cpp | 6 + scene/3d/reflection_probe.h | 6 + scene/3d/remote_transform_3d.cpp | 6 + scene/3d/remote_transform_3d.h | 6 + scene/3d/retarget_modifier_3d.cpp | 6 + scene/3d/retarget_modifier_3d.h | 6 + scene/3d/skeleton_3d.cpp | 6 + scene/3d/skeleton_3d.h | 38 +- scene/3d/skeleton_ik_3d.cpp | 17 +- scene/3d/skeleton_ik_3d.h | 27 +- scene/3d/skeleton_modifier_3d.cpp | 6 + scene/3d/skeleton_modifier_3d.h | 17 +- scene/3d/spring_bone_collision_3d.cpp | 6 + scene/3d/spring_bone_collision_3d.h | 6 + scene/3d/spring_bone_collision_capsule_3d.cpp | 6 + scene/3d/spring_bone_collision_capsule_3d.h | 8 +- scene/3d/spring_bone_collision_plane_3d.cpp | 6 + scene/3d/spring_bone_collision_plane_3d.h | 6 + scene/3d/spring_bone_collision_sphere_3d.cpp | 6 + scene/3d/spring_bone_collision_sphere_3d.h | 6 + scene/3d/spring_bone_simulator_3d.cpp | 8 +- scene/3d/spring_bone_simulator_3d.h | 28 +- scene/3d/sprite_3d.cpp | 7 +- scene/3d/sprite_3d.h | 9 +- scene/3d/velocity_tracker_3d.cpp | 6 + scene/3d/velocity_tracker_3d.h | 6 + scene/3d/visible_on_screen_notifier_3d.cpp | 6 + scene/3d/visible_on_screen_notifier_3d.h | 6 + scene/3d/visual_instance_3d.cpp | 8 +- scene/3d/visual_instance_3d.h | 10 +- scene/3d/voxel_gi.cpp | 6 + scene/3d/voxel_gi.h | 6 + scene/3d/voxelizer.cpp | 14 +- scene/3d/voxelizer.h | 17 +- scene/3d/world_environment.cpp | 6 + scene/3d/world_environment.h | 6 + scene/3d/xr/xr_body_modifier_3d.cpp | 6 + scene/3d/xr/xr_body_modifier_3d.h | 11 +- scene/3d/xr/xr_face_modifier_3d.cpp | 63 +- scene/3d/xr/xr_face_modifier_3d.h | 20 +- scene/3d/xr/xr_hand_modifier_3d.cpp | 8 +- scene/3d/xr/xr_hand_modifier_3d.h | 11 +- scene/3d/xr/xr_nodes.cpp | 12 +- scene/3d/xr/xr_nodes.h | 67 +- scene/animation/animation_blend_space_1d.cpp | 6 + scene/animation/animation_blend_space_1d.h | 6 + scene/animation/animation_blend_space_2d.cpp | 6 + scene/animation/animation_blend_space_2d.h | 6 + scene/animation/animation_blend_tree.cpp | 14 +- scene/animation/animation_blend_tree.h | 10 +- scene/animation/animation_mixer.cpp | 12 +- scene/animation/animation_mixer.h | 107 +- scene/animation/animation_node_extension.cpp | 6 + scene/animation/animation_node_extension.h | 6 + .../animation_node_state_machine.cpp | 6 + .../animation/animation_node_state_machine.h | 6 + scene/animation/animation_player.cpp | 6 + scene/animation/animation_player.h | 12 +- scene/animation/animation_tree.cpp | 7 +- scene/animation/animation_tree.h | 47 +- scene/animation/easing_equations.h | 16 +- scene/animation/root_motion_view.cpp | 6 + scene/animation/root_motion_view.h | 6 + scene/animation/tween.cpp | 6 + scene/animation/tween.h | 10 +- scene/audio/audio_stream_player.cpp | 14 +- scene/audio/audio_stream_player.h | 6 + scene/audio/audio_stream_player_internal.cpp | 12 +- scene/audio/audio_stream_player_internal.h | 8 +- scene/debugger/scene_debugger.cpp | 18 +- scene/debugger/scene_debugger.h | 18 +- scene/gui/aspect_ratio_container.cpp | 6 + scene/gui/aspect_ratio_container.h | 6 + scene/gui/base_button.cpp | 6 + scene/gui/base_button.h | 8 +- scene/gui/box_container.cpp | 6 + scene/gui/box_container.h | 6 + scene/gui/button.cpp | 6 + scene/gui/button.h | 6 + scene/gui/center_container.cpp | 6 + scene/gui/center_container.h | 6 + scene/gui/check_box.cpp | 6 + scene/gui/check_box.h | 6 + scene/gui/check_button.cpp | 6 + scene/gui/check_button.h | 6 + scene/gui/code_edit.cpp | 8 +- scene/gui/code_edit.h | 187 +- scene/gui/color_mode.cpp | 6 + scene/gui/color_mode.h | 6 + scene/gui/color_picker.cpp | 12 +- scene/gui/color_picker.h | 33 +- scene/gui/color_picker_shape.cpp | 6 + scene/gui/color_picker_shape.h | 6 + scene/gui/color_rect.cpp | 6 + scene/gui/color_rect.h | 6 + scene/gui/container.cpp | 6 + scene/gui/container.h | 6 + scene/gui/control.cpp | 8 +- scene/gui/control.h | 223 +-- scene/gui/dialogs.cpp | 6 + scene/gui/dialogs.h | 8 +- scene/gui/file_dialog.cpp | 12 +- scene/gui/file_dialog.h | 8 +- scene/gui/flow_container.cpp | 6 + scene/gui/flow_container.h | 6 + scene/gui/foldable_container.cpp | 6 + scene/gui/foldable_container.h | 6 + scene/gui/graph_edit.cpp | 6 + scene/gui/graph_edit.h | 41 +- scene/gui/graph_edit_arranger.cpp | 6 + scene/gui/graph_edit_arranger.h | 6 + scene/gui/graph_element.cpp | 6 + scene/gui/graph_element.h | 6 + scene/gui/graph_frame.cpp | 6 + scene/gui/graph_frame.h | 6 + scene/gui/graph_node.cpp | 6 + scene/gui/graph_node.h | 6 + scene/gui/grid_container.cpp | 6 + scene/gui/grid_container.h | 6 + scene/gui/item_list.cpp | 6 + scene/gui/item_list.h | 6 + scene/gui/label.cpp | 14 +- scene/gui/label.h | 8 + scene/gui/line_edit.cpp | 8 +- scene/gui/line_edit.h | 10 +- scene/gui/link_button.cpp | 6 + scene/gui/link_button.h | 6 + scene/gui/margin_container.cpp | 6 + scene/gui/margin_container.h | 6 + scene/gui/menu_bar.cpp | 6 + scene/gui/menu_bar.h | 6 + scene/gui/menu_button.cpp | 6 + scene/gui/menu_button.h | 6 + scene/gui/nine_patch_rect.cpp | 6 + scene/gui/nine_patch_rect.h | 6 + scene/gui/option_button.cpp | 6 + scene/gui/option_button.h | 12 +- scene/gui/panel.cpp | 6 + scene/gui/panel.h | 6 + scene/gui/panel_container.cpp | 6 + scene/gui/panel_container.h | 6 + scene/gui/popup.cpp | 6 + scene/gui/popup.h | 10 +- scene/gui/popup_menu.cpp | 7 +- scene/gui/popup_menu.h | 15 +- scene/gui/progress_bar.cpp | 6 + scene/gui/progress_bar.h | 6 + scene/gui/range.cpp | 6 + scene/gui/range.h | 6 + scene/gui/reference_rect.cpp | 6 + scene/gui/reference_rect.h | 6 + scene/gui/rich_text_effect.cpp | 6 + scene/gui/rich_text_effect.h | 6 + scene/gui/rich_text_label.cpp | 6 + scene/gui/rich_text_label.h | 14 +- scene/gui/scroll_bar.cpp | 6 + scene/gui/scroll_bar.h | 6 + scene/gui/scroll_container.cpp | 6 + scene/gui/scroll_container.h | 8 +- scene/gui/separator.cpp | 6 + scene/gui/separator.h | 6 + scene/gui/slider.cpp | 6 + scene/gui/slider.h | 8 +- scene/gui/spin_box.cpp | 6 + scene/gui/spin_box.h | 6 + scene/gui/split_container.cpp | 6 + scene/gui/split_container.h | 6 + scene/gui/subviewport_container.cpp | 6 + scene/gui/subviewport_container.h | 6 + scene/gui/tab_bar.cpp | 6 + scene/gui/tab_bar.h | 8 +- scene/gui/tab_container.cpp | 6 + scene/gui/tab_container.h | 8 +- scene/gui/text_edit.cpp | 25 +- scene/gui/text_edit.h | 279 ++- scene/gui/texture_button.cpp | 8 +- scene/gui/texture_button.h | 6 + scene/gui/texture_progress_bar.cpp | 6 + scene/gui/texture_progress_bar.h | 6 + scene/gui/texture_rect.cpp | 6 + scene/gui/texture_rect.h | 6 + scene/gui/tree.cpp | 6 + scene/gui/tree.h | 64 +- scene/gui/video_stream_player.cpp | 8 +- scene/gui/video_stream_player.h | 10 +- scene/gui/view_panner.cpp | 6 + scene/gui/view_panner.h | 6 + scene/main/canvas_item.cpp | 11 +- scene/main/canvas_item.h | 66 +- scene/main/canvas_layer.cpp | 6 + scene/main/canvas_layer.h | 8 +- scene/main/http_request.cpp | 6 + scene/main/http_request.h | 10 +- scene/main/instance_placeholder.cpp | 10 +- scene/main/instance_placeholder.h | 10 + scene/main/missing_node.cpp | 6 + scene/main/missing_node.h | 6 + scene/main/multiplayer_api.cpp | 16 +- scene/main/multiplayer_api.h | 16 +- scene/main/multiplayer_peer.cpp | 6 + scene/main/multiplayer_peer.h | 10 +- scene/main/node.cpp | 25 +- scene/main/node.h | 134 +- scene/main/resource_preloader.cpp | 6 + scene/main/resource_preloader.h | 6 + scene/main/scene_tree.cpp | 21 +- scene/main/scene_tree.h | 36 +- scene/main/scene_tree_fti.cpp | 20 +- scene/main/scene_tree_fti.h | 53 +- scene/main/scene_tree_fti_tests.cpp | 6 + scene/main/scene_tree_fti_tests.h | 6 + scene/main/shader_globals_override.cpp | 6 + scene/main/shader_globals_override.h | 6 + scene/main/status_indicator.cpp | 6 + scene/main/status_indicator.h | 6 + scene/main/timer.cpp | 10 +- scene/main/timer.h | 10 +- scene/main/viewport.cpp | 35 +- scene/main/viewport.h | 72 +- scene/main/window.cpp | 6 + scene/main/window.h | 23 +- scene/property_list_helper.cpp | 6 + scene/property_list_helper.h | 8 +- scene/property_utils.cpp | 16 +- scene/property_utils.h | 24 +- scene/register_scene_types.cpp | 6 + scene/register_scene_types.h | 6 + scene/resources/2d/capsule_shape_2d.cpp | 6 + scene/resources/2d/capsule_shape_2d.h | 6 + scene/resources/2d/circle_shape_2d.cpp | 6 + scene/resources/2d/circle_shape_2d.h | 6 + .../resources/2d/concave_polygon_shape_2d.cpp | 6 + scene/resources/2d/concave_polygon_shape_2d.h | 6 + .../resources/2d/convex_polygon_shape_2d.cpp | 8 +- scene/resources/2d/convex_polygon_shape_2d.h | 6 + ...avigation_mesh_source_geometry_data_2d.cpp | 6 + .../navigation_mesh_source_geometry_data_2d.h | 16 +- scene/resources/2d/navigation_polygon.cpp | 6 + scene/resources/2d/navigation_polygon.h | 6 + scene/resources/2d/polygon_path_finder.cpp | 6 + scene/resources/2d/polygon_path_finder.h | 6 + scene/resources/2d/rectangle_shape_2d.cpp | 6 + scene/resources/2d/rectangle_shape_2d.h | 6 + scene/resources/2d/segment_shape_2d.cpp | 6 + scene/resources/2d/segment_shape_2d.h | 6 + .../resources/2d/separation_ray_shape_2d.cpp | 6 + scene/resources/2d/separation_ray_shape_2d.h | 6 + scene/resources/2d/shape_2d.cpp | 6 + scene/resources/2d/shape_2d.h | 8 +- .../2d/skeleton/skeleton_modification_2d.cpp | 6 + .../2d/skeleton/skeleton_modification_2d.h | 8 +- .../skeleton_modification_2d_ccdik.cpp | 6 + .../skeleton/skeleton_modification_2d_ccdik.h | 6 + .../skeleton_modification_2d_fabrik.cpp | 6 + .../skeleton_modification_2d_fabrik.h | 14 +- .../skeleton_modification_2d_jiggle.cpp | 9 +- .../skeleton_modification_2d_jiggle.h | 8 + .../skeleton_modification_2d_lookat.cpp | 6 + .../skeleton_modification_2d_lookat.h | 6 + ...skeleton_modification_2d_physicalbones.cpp | 6 + .../skeleton_modification_2d_physicalbones.h | 6 + .../skeleton_modification_2d_stackholder.cpp | 6 + .../skeleton_modification_2d_stackholder.h | 6 + .../skeleton_modification_2d_twoboneik.cpp | 6 + .../skeleton_modification_2d_twoboneik.h | 6 + .../skeleton_modification_stack_2d.cpp | 6 + .../skeleton/skeleton_modification_stack_2d.h | 6 + scene/resources/2d/tile_set.cpp | 29 +- scene/resources/2d/tile_set.h | 259 ++- .../resources/2d/world_boundary_shape_2d.cpp | 6 + scene/resources/2d/world_boundary_shape_2d.h | 8 +- scene/resources/3d/box_shape_3d.cpp | 6 + scene/resources/3d/box_shape_3d.h | 6 + scene/resources/3d/capsule_shape_3d.cpp | 6 + scene/resources/3d/capsule_shape_3d.h | 6 + .../resources/3d/concave_polygon_shape_3d.cpp | 6 + scene/resources/3d/concave_polygon_shape_3d.h | 6 + .../resources/3d/convex_polygon_shape_3d.cpp | 6 + scene/resources/3d/convex_polygon_shape_3d.h | 6 + scene/resources/3d/cylinder_shape_3d.cpp | 6 + scene/resources/3d/cylinder_shape_3d.h | 6 + scene/resources/3d/fog_material.cpp | 6 + scene/resources/3d/fog_material.h | 6 + scene/resources/3d/height_map_shape_3d.cpp | 6 + scene/resources/3d/height_map_shape_3d.h | 6 + scene/resources/3d/importer_mesh.cpp | 6 + scene/resources/3d/importer_mesh.h | 12 +- scene/resources/3d/mesh_library.cpp | 6 + scene/resources/3d/mesh_library.h | 6 + ...avigation_mesh_source_geometry_data_3d.cpp | 6 + .../navigation_mesh_source_geometry_data_3d.h | 16 +- scene/resources/3d/primitive_meshes.cpp | 16 +- scene/resources/3d/primitive_meshes.h | 70 +- .../resources/3d/separation_ray_shape_3d.cpp | 6 + scene/resources/3d/separation_ray_shape_3d.h | 6 + scene/resources/3d/shape_3d.cpp | 6 + scene/resources/3d/shape_3d.h | 10 +- scene/resources/3d/skin.cpp | 6 + scene/resources/3d/skin.h | 6 + scene/resources/3d/sky_material.cpp | 6 + scene/resources/3d/sky_material.h | 6 + scene/resources/3d/sphere_shape_3d.cpp | 6 + scene/resources/3d/sphere_shape_3d.h | 6 + scene/resources/3d/world_3d.cpp | 6 + scene/resources/3d/world_3d.h | 6 + .../resources/3d/world_boundary_shape_3d.cpp | 6 + scene/resources/3d/world_boundary_shape_3d.h | 6 + scene/resources/animated_texture.cpp | 6 + scene/resources/animated_texture.h | 8 +- scene/resources/animation.cpp | 18 +- scene/resources/animation.h | 60 +- scene/resources/animation_library.cpp | 6 + scene/resources/animation_library.h | 8 +- scene/resources/atlas_texture.cpp | 6 + scene/resources/atlas_texture.h | 6 + scene/resources/audio_stream_polyphonic.cpp | 6 + scene/resources/audio_stream_polyphonic.h | 8 +- scene/resources/audio_stream_wav.cpp | 10 +- scene/resources/audio_stream_wav.h | 13 +- scene/resources/bit_map.cpp | 6 + scene/resources/bit_map.h | 6 + scene/resources/bone_map.cpp | 6 + scene/resources/bone_map.h | 8 +- scene/resources/camera_attributes.cpp | 6 + scene/resources/camera_attributes.h | 33 +- scene/resources/camera_texture.cpp | 11 +- scene/resources/camera_texture.h | 9 + scene/resources/canvas_item_material.cpp | 6 + scene/resources/canvas_item_material.h | 6 + scene/resources/color_palette.cpp | 6 + scene/resources/color_palette.h | 6 + scene/resources/compositor.cpp | 6 + scene/resources/compositor.h | 8 +- scene/resources/compressed_texture.cpp | 6 + scene/resources/compressed_texture.h | 6 + scene/resources/curve.cpp | 14 +- scene/resources/curve.h | 29 +- scene/resources/curve_texture.cpp | 6 + scene/resources/curve_texture.h | 6 + scene/resources/dpi_texture.cpp | 6 + scene/resources/dpi_texture.h | 6 + scene/resources/environment.cpp | 11 +- scene/resources/environment.h | 131 +- scene/resources/external_texture.cpp | 6 + scene/resources/external_texture.h | 8 +- scene/resources/font.cpp | 6 + scene/resources/font.h | 76 +- scene/resources/gradient.cpp | 6 + scene/resources/gradient.h | 6 + scene/resources/gradient_texture.cpp | 6 + scene/resources/gradient_texture.h | 6 + scene/resources/image_texture.cpp | 6 + scene/resources/image_texture.h | 6 + scene/resources/immediate_mesh.cpp | 6 + scene/resources/immediate_mesh.h | 6 + scene/resources/label_settings.cpp | 6 + scene/resources/label_settings.h | 6 + scene/resources/material.cpp | 8 +- scene/resources/material.h | 36 +- scene/resources/mesh.cpp | 10 +- scene/resources/mesh.h | 12 +- scene/resources/mesh_data_tool.cpp | 6 + scene/resources/mesh_data_tool.h | 8 +- scene/resources/mesh_texture.cpp | 6 + scene/resources/mesh_texture.h | 6 + scene/resources/multimesh.cpp | 6 + scene/resources/multimesh.h | 8 +- scene/resources/navigation_mesh.cpp | 6 + scene/resources/navigation_mesh.h | 6 + scene/resources/packed_scene.cpp | 11 +- scene/resources/packed_scene.h | 25 +- scene/resources/particle_process_material.cpp | 8 +- scene/resources/particle_process_material.h | 31 +- scene/resources/physics_material.cpp | 6 + scene/resources/physics_material.h | 6 + scene/resources/placeholder_textures.cpp | 6 + scene/resources/placeholder_textures.h | 6 + .../resources/portable_compressed_texture.cpp | 6 + scene/resources/portable_compressed_texture.h | 6 + scene/resources/resource_format_text.cpp | 8 +- scene/resources/resource_format_text.h | 16 +- scene/resources/shader.cpp | 8 +- scene/resources/shader.h | 10 +- scene/resources/shader_include.cpp | 6 + scene/resources/shader_include.h | 6 + scene/resources/skeleton_profile.cpp | 6 + scene/resources/skeleton_profile.h | 10 +- scene/resources/sky.cpp | 6 + scene/resources/sky.h | 6 + scene/resources/sprite_frames.cpp | 6 + scene/resources/sprite_frames.h | 6 + scene/resources/style_box.cpp | 6 + scene/resources/style_box.h | 6 + scene/resources/style_box_flat.cpp | 6 + scene/resources/style_box_flat.h | 6 + scene/resources/style_box_line.cpp | 6 + scene/resources/style_box_line.h | 6 + scene/resources/style_box_texture.cpp | 6 + scene/resources/style_box_texture.h | 6 + scene/resources/surface_tool.cpp | 6 + scene/resources/surface_tool.h | 32 +- scene/resources/syntax_highlighter.cpp | 6 + scene/resources/syntax_highlighter.h | 6 + scene/resources/text_file.cpp | 6 + scene/resources/text_file.h | 6 + scene/resources/text_line.cpp | 6 + scene/resources/text_line.h | 6 + scene/resources/text_paragraph.cpp | 6 + scene/resources/text_paragraph.h | 6 + scene/resources/texture.cpp | 6 + scene/resources/texture.h | 8 +- scene/resources/texture_rd.cpp | 6 + scene/resources/texture_rd.h | 22 +- scene/resources/theme.cpp | 9 +- scene/resources/theme.h | 13 +- scene/resources/video_stream.cpp | 6 + scene/resources/video_stream.h | 8 +- scene/resources/visual_shader.cpp | 13 +- scene/resources/visual_shader.h | 16 +- scene/resources/visual_shader_nodes.cpp | 6 + scene/resources/visual_shader_nodes.h | 6 + .../visual_shader_particle_nodes.cpp | 6 + .../resources/visual_shader_particle_nodes.h | 6 + scene/resources/visual_shader_sdf_nodes.cpp | 6 + scene/resources/visual_shader_sdf_nodes.h | 6 + scene/resources/world_2d.cpp | 6 + scene/resources/world_2d.h | 6 + scene/scene_string_names.h | 10 +- scene/theme/default_theme.cpp | 8 +- scene/theme/default_theme.h | 6 + scene/theme/theme_db.cpp | 10 +- scene/theme/theme_db.h | 65 +- scene/theme/theme_owner.cpp | 15 +- scene/theme/theme_owner.h | 31 +- servers/audio/audio_driver_dummy.cpp | 6 + servers/audio/audio_driver_dummy.h | 6 + servers/audio/audio_effect.cpp | 6 + servers/audio/audio_effect.h | 6 + servers/audio/audio_filter_sw.cpp | 6 + servers/audio/audio_filter_sw.h | 10 +- servers/audio/audio_rb_resampler.cpp | 9 +- servers/audio/audio_rb_resampler.h | 11 +- servers/audio/audio_stream.cpp | 8 +- servers/audio/audio_stream.h | 27 +- .../audio/effects/audio_effect_amplify.cpp | 6 + servers/audio/effects/audio_effect_amplify.h | 6 + .../audio/effects/audio_effect_capture.cpp | 6 + servers/audio/effects/audio_effect_capture.h | 6 + servers/audio/effects/audio_effect_chorus.cpp | 6 + servers/audio/effects/audio_effect_chorus.h | 6 + .../audio/effects/audio_effect_compressor.cpp | 6 + .../audio/effects/audio_effect_compressor.h | 6 + servers/audio/effects/audio_effect_delay.cpp | 6 + servers/audio/effects/audio_effect_delay.h | 6 + .../audio/effects/audio_effect_distortion.cpp | 6 + .../audio/effects/audio_effect_distortion.h | 6 + servers/audio/effects/audio_effect_eq.cpp | 6 + servers/audio/effects/audio_effect_eq.h | 6 + servers/audio/effects/audio_effect_filter.cpp | 6 + servers/audio/effects/audio_effect_filter.h | 6 + .../effects/audio_effect_hard_limiter.cpp | 6 + .../audio/effects/audio_effect_hard_limiter.h | 6 + .../audio/effects/audio_effect_limiter.cpp | 6 + servers/audio/effects/audio_effect_limiter.h | 6 + servers/audio/effects/audio_effect_panner.cpp | 6 + servers/audio/effects/audio_effect_panner.h | 6 + servers/audio/effects/audio_effect_phaser.cpp | 6 + servers/audio/effects/audio_effect_phaser.h | 6 + .../effects/audio_effect_pitch_shift.cpp | 89 +- .../audio/effects/audio_effect_pitch_shift.h | 16 + servers/audio/effects/audio_effect_record.cpp | 6 + servers/audio/effects/audio_effect_record.h | 6 + servers/audio/effects/audio_effect_reverb.cpp | 6 + servers/audio/effects/audio_effect_reverb.h | 6 + .../audio_effect_spectrum_analyzer.cpp | 29 +- .../effects/audio_effect_spectrum_analyzer.h | 6 + .../effects/audio_effect_stereo_enhance.cpp | 6 + .../effects/audio_effect_stereo_enhance.h | 6 + .../audio/effects/audio_stream_generator.cpp | 6 + .../audio/effects/audio_stream_generator.h | 8 +- servers/audio/effects/eq_filter.cpp | 10 +- servers/audio/effects/eq_filter.h | 6 + servers/audio/effects/reverb_filter.cpp | 6 + servers/audio/effects/reverb_filter.h | 14 +- servers/audio_server.cpp | 24 +- servers/audio_server.h | 71 +- servers/camera/camera_feed.cpp | 12 +- servers/camera/camera_feed.h | 36 +- servers/camera_server.cpp | 6 + servers/camera_server.h | 23 +- servers/debugger/servers_debugger.cpp | 7 +- servers/debugger/servers_debugger.h | 26 +- servers/display/native_menu.cpp | 6 + servers/display/native_menu.h | 6 + servers/display_server.cpp | 6 + servers/display_server.h | 32 +- servers/display_server_headless.h | 6 + .../physics_server_2d_extension.cpp | 6 + .../extensions/physics_server_2d_extension.h | 35 +- .../physics_server_3d_extension.cpp | 6 + .../extensions/physics_server_3d_extension.h | 40 +- servers/movie_writer/movie_writer.cpp | 6 + servers/movie_writer/movie_writer.h | 10 +- servers/movie_writer/movie_writer_pngwav.cpp | 6 + servers/movie_writer/movie_writer_pngwav.h | 8 +- servers/navigation/nav_heap.h | 6 + servers/navigation/navigation_globals.h | 44 +- .../navigation_path_query_parameters_2d.cpp | 6 + .../navigation_path_query_parameters_2d.h | 6 + .../navigation_path_query_parameters_3d.cpp | 6 + .../navigation_path_query_parameters_3d.h | 6 + .../navigation_path_query_result_2d.cpp | 6 + .../navigation_path_query_result_2d.h | 6 + .../navigation_path_query_result_3d.cpp | 6 + .../navigation_path_query_result_3d.h | 6 + servers/navigation/navigation_utilities.h | 6 + servers/navigation_server_2d.cpp | 6 + servers/navigation_server_2d.h | 42 +- servers/navigation_server_2d_dummy.h | 6 + servers/navigation_server_3d.cpp | 6 + servers/navigation_server_3d.h | 42 +- servers/navigation_server_3d_dummy.h | 6 + servers/physics_server_2d.cpp | 6 + servers/physics_server_2d.h | 62 +- servers/physics_server_2d_dummy.h | 26 +- servers/physics_server_2d_wrap_mt.cpp | 6 + servers/physics_server_2d_wrap_mt.h | 34 +- servers/physics_server_3d.cpp | 6 + servers/physics_server_3d.h | 54 +- servers/physics_server_3d_dummy.h | 30 +- servers/physics_server_3d_wrap_mt.cpp | 6 + servers/physics_server_3d_wrap_mt.h | 38 +- servers/register_server_types.cpp | 6 + servers/register_server_types.h | 6 + servers/rendering/dummy/environment/fog.h | 10 +- servers/rendering/dummy/environment/gi.h | 10 +- .../rendering/dummy/rasterizer_canvas_dummy.h | 6 + servers/rendering/dummy/rasterizer_dummy.h | 6 + .../rendering/dummy/rasterizer_scene_dummy.h | 25 +- .../rendering/dummy/storage/light_storage.cpp | 6 + .../rendering/dummy/storage/light_storage.h | 45 +- .../dummy/storage/material_storage.cpp | 6 + .../dummy/storage/material_storage.h | 20 +- .../rendering/dummy/storage/mesh_storage.cpp | 6 + .../rendering/dummy/storage/mesh_storage.h | 31 +- .../dummy/storage/particles_storage.h | 15 +- .../dummy/storage/texture_storage.cpp | 6 + .../rendering/dummy/storage/texture_storage.h | 31 +- servers/rendering/dummy/storage/utilities.cpp | 6 + servers/rendering/dummy/storage/utilities.h | 34 +- servers/rendering/environment/renderer_fog.h | 6 + servers/rendering/environment/renderer_gi.h | 6 + servers/rendering/instance_uniforms.cpp | 8 +- servers/rendering/instance_uniforms.h | 8 +- servers/rendering/renderer_canvas_cull.cpp | 16 +- servers/rendering/renderer_canvas_cull.h | 16 +- servers/rendering/renderer_canvas_render.cpp | 6 + servers/rendering/renderer_canvas_render.h | 23 +- servers/rendering/renderer_compositor.cpp | 6 + servers/rendering/renderer_compositor.h | 10 +- .../rendering/renderer_geometry_instance.cpp | 6 + .../rendering/renderer_geometry_instance.h | 14 +- .../renderer_rd/cluster_builder_rd.cpp | 6 + .../renderer_rd/cluster_builder_rd.h | 40 +- .../renderer_rd/effects/bokeh_dof.cpp | 6 + .../rendering/renderer_rd/effects/bokeh_dof.h | 19 +- .../renderer_rd/effects/copy_effects.cpp | 10 +- .../renderer_rd/effects/copy_effects.h | 40 +- .../renderer_rd/effects/debug_effects.cpp | 6 + .../renderer_rd/effects/debug_effects.h | 6 + servers/rendering/renderer_rd/effects/fsr.cpp | 6 + servers/rendering/renderer_rd/effects/fsr.h | 6 + .../rendering/renderer_rd/effects/fsr2.cpp | 15 +- servers/rendering/renderer_rd/effects/fsr2.h | 8 +- .../renderer_rd/effects/luminance.cpp | 6 + .../rendering/renderer_rd/effects/luminance.h | 6 + .../rendering/renderer_rd/effects/metal_fx.h | 6 + .../effects/motion_vectors_store.cpp | 6 + .../effects/motion_vectors_store.h | 6 + .../rendering/renderer_rd/effects/resolve.cpp | 6 + .../rendering/renderer_rd/effects/resolve.h | 8 +- .../renderer_rd/effects/roughness_limiter.cpp | 6 + .../renderer_rd/effects/roughness_limiter.h | 8 +- .../rendering/renderer_rd/effects/smaa.cpp | 6 + servers/rendering/renderer_rd/effects/smaa.h | 6 + .../renderer_rd/effects/sort_effects.cpp | 6 + .../renderer_rd/effects/sort_effects.h | 6 + .../renderer_rd/effects/spatial_upscaler.h | 6 + .../renderer_rd/effects/ss_effects.cpp | 10 +- .../renderer_rd/effects/ss_effects.h | 77 +- servers/rendering/renderer_rd/effects/taa.cpp | 6 + servers/rendering/renderer_rd/effects/taa.h | 6 + .../renderer_rd/effects/tone_mapper.cpp | 6 + .../renderer_rd/effects/tone_mapper.h | 37 +- servers/rendering/renderer_rd/effects/vrs.cpp | 6 + servers/rendering/renderer_rd/effects/vrs.h | 8 +- .../rendering/renderer_rd/environment/fog.cpp | 6 + .../rendering/renderer_rd/environment/fog.h | 29 +- .../rendering/renderer_rd/environment/gi.cpp | 10 +- .../rendering/renderer_rd/environment/gi.h | 88 +- .../rendering/renderer_rd/environment/sky.cpp | 12 +- .../rendering/renderer_rd/environment/sky.h | 80 +- .../render_forward_clustered.cpp | 8 +- .../render_forward_clustered.h | 100 +- .../scene_shader_forward_clustered.cpp | 6 + .../scene_shader_forward_clustered.h | 18 +- .../forward_mobile/render_forward_mobile.cpp | 10 +- .../forward_mobile/render_forward_mobile.h | 124 +- .../scene_shader_forward_mobile.cpp | 6 + .../scene_shader_forward_mobile.h | 8 +- .../renderer_rd/framebuffer_cache_rd.cpp | 6 + .../renderer_rd/framebuffer_cache_rd.h | 10 +- .../renderer_rd/pipeline_cache_rd.cpp | 8 +- .../rendering/renderer_rd/pipeline_cache_rd.h | 6 + .../renderer_rd/pipeline_hash_map_rd.h | 15 +- .../renderer_rd/renderer_canvas_render_rd.cpp | 10 +- .../renderer_rd/renderer_canvas_render_rd.h | 87 +- .../renderer_rd/renderer_compositor_rd.cpp | 6 + .../renderer_rd/renderer_compositor_rd.h | 6 + .../renderer_rd/renderer_scene_render_rd.cpp | 14 +- .../renderer_rd/renderer_scene_render_rd.h | 75 +- servers/rendering/renderer_rd/shader_rd.cpp | 9 +- servers/rendering/renderer_rd/shader_rd.h | 19 +- .../storage_rd/forward_id_storage.cpp | 6 + .../storage_rd/forward_id_storage.h | 6 + .../renderer_rd/storage_rd/light_storage.cpp | 8 +- .../renderer_rd/storage_rd/light_storage.h | 162 +- .../storage_rd/material_storage.cpp | 6 + .../renderer_rd/storage_rd/material_storage.h | 73 +- .../renderer_rd/storage_rd/mesh_storage.cpp | 7 +- .../renderer_rd/storage_rd/mesh_storage.h | 64 +- .../storage_rd/particles_storage.cpp | 12 +- .../storage_rd/particles_storage.h | 47 +- .../storage_rd/render_buffer_custom_data_rd.h | 8 +- .../renderer_rd/storage_rd/render_data_rd.cpp | 6 + .../renderer_rd/storage_rd/render_data_rd.h | 24 +- .../storage_rd/render_scene_buffers_rd.cpp | 18 +- .../storage_rd/render_scene_buffers_rd.h | 54 +- .../storage_rd/render_scene_data_rd.cpp | 8 +- .../storage_rd/render_scene_data_rd.h | 29 +- .../storage_rd/texture_storage.cpp | 25 +- .../renderer_rd/storage_rd/texture_storage.h | 89 +- .../renderer_rd/storage_rd/utilities.cpp | 6 + .../renderer_rd/storage_rd/utilities.h | 32 +- .../renderer_rd/uniform_set_cache_rd.cpp | 6 + .../renderer_rd/uniform_set_cache_rd.h | 8 +- servers/rendering/renderer_scene_cull.cpp | 16 +- servers/rendering/renderer_scene_cull.h | 193 +- .../renderer_scene_occlusion_cull.cpp | 6 + .../rendering/renderer_scene_occlusion_cull.h | 6 + servers/rendering/renderer_scene_render.cpp | 6 + servers/rendering/renderer_scene_render.h | 104 +- servers/rendering/renderer_viewport.cpp | 8 +- servers/rendering/renderer_viewport.h | 8 +- .../rendering/rendering_context_driver.cpp | 6 + servers/rendering/rendering_context_driver.h | 14 +- servers/rendering/rendering_device.cpp | 43 +- servers/rendering/rendering_device.h | 475 +++-- servers/rendering/rendering_device_binds.cpp | 6 + servers/rendering/rendering_device_binds.h | 6 + .../rendering/rendering_device_commons.cpp | 7 +- servers/rendering/rendering_device_commons.h | 245 +-- servers/rendering/rendering_device_driver.cpp | 6 + servers/rendering/rendering_device_driver.h | 303 ++-- servers/rendering/rendering_device_graph.cpp | 12 +- servers/rendering/rendering_device_graph.h | 26 +- servers/rendering/rendering_light_culler.cpp | 63 +- servers/rendering/rendering_light_culler.h | 116 +- servers/rendering/rendering_method.cpp | 6 + servers/rendering/rendering_method.h | 103 +- .../rendering/rendering_server_constants.h | 6 + .../rendering/rendering_server_default.cpp | 8 +- servers/rendering/rendering_server_default.h | 189 +- .../rendering/rendering_server_globals.cpp | 6 + servers/rendering/rendering_server_globals.h | 6 + .../rendering/rendering_shader_container.cpp | 6 + .../rendering/rendering_shader_container.h | 21 +- servers/rendering/rendering_shader_library.h | 10 +- servers/rendering/shader_compiler.cpp | 6 + servers/rendering/shader_compiler.h | 6 + servers/rendering/shader_include_db.cpp | 6 + servers/rendering/shader_include_db.h | 6 + servers/rendering/shader_language.cpp | 61 +- servers/rendering/shader_language.h | 15 +- servers/rendering/shader_preprocessor.cpp | 6 + servers/rendering/shader_preprocessor.h | 10 +- servers/rendering/shader_types.cpp | 8 +- servers/rendering/shader_types.h | 6 + servers/rendering/shader_warnings.cpp | 6 + servers/rendering/shader_warnings.h | 6 + .../storage/camera_attributes_storage.cpp | 6 + .../storage/camera_attributes_storage.h | 8 +- .../rendering/storage/compositor_storage.cpp | 6 + .../rendering/storage/compositor_storage.h | 10 +- .../rendering/storage/environment_storage.cpp | 6 + .../rendering/storage/environment_storage.h | 130 +- servers/rendering/storage/light_storage.h | 45 +- servers/rendering/storage/material_storage.h | 20 +- servers/rendering/storage/mesh_storage.cpp | 13 +- servers/rendering/storage/mesh_storage.h | 42 +- servers/rendering/storage/particles_storage.h | 29 +- servers/rendering/storage/render_data.cpp | 6 + servers/rendering/storage/render_data.h | 6 + .../storage/render_scene_buffers.cpp | 8 +- .../rendering/storage/render_scene_buffers.h | 10 +- .../rendering/storage/render_scene_data.cpp | 6 + servers/rendering/storage/render_scene_data.h | 6 + servers/rendering/storage/texture_storage.h | 36 +- servers/rendering/storage/utilities.cpp | 6 + servers/rendering/storage/utilities.h | 36 +- .../rendering/storage/variant_converters.h | 11 +- servers/rendering_server.cpp | 13 +- servers/rendering_server.h | 248 ++- servers/server_wrap_mt_common.h | 8 +- servers/text/text_server_dummy.h | 6 + servers/text/text_server_extension.cpp | 6 + servers/text/text_server_extension.h | 14 +- servers/text_server.cpp | 6 + servers/text_server.h | 81 +- servers/xr/xr_body_tracker.cpp | 6 + servers/xr/xr_body_tracker.h | 31 +- servers/xr/xr_controller_tracker.cpp | 6 + servers/xr/xr_controller_tracker.h | 11 +- servers/xr/xr_face_tracker.cpp | 14 +- servers/xr/xr_face_tracker.h | 313 ++-- servers/xr/xr_hand_tracker.cpp | 6 + servers/xr/xr_hand_tracker.h | 6 + servers/xr/xr_interface.cpp | 18 +- servers/xr/xr_interface.h | 141 +- servers/xr/xr_interface_extension.cpp | 22 +- servers/xr/xr_interface_extension.h | 44 +- servers/xr/xr_pose.cpp | 6 + servers/xr/xr_pose.h | 14 +- servers/xr/xr_positional_tracker.cpp | 14 +- servers/xr/xr_positional_tracker.h | 25 +- servers/xr/xr_tracker.cpp | 6 + servers/xr/xr_tracker.h | 17 +- servers/xr/xr_vrs.cpp | 6 + servers/xr/xr_vrs.h | 9 +- servers/xr_server.cpp | 6 + servers/xr_server.h | 189 +- 2980 files changed, 30275 insertions(+), 10468 deletions(-) diff --git a/.gitignore b/.gitignore index 99333856f14..24d40988d53 100644 --- a/.gitignore +++ b/.gitignore @@ -81,7 +81,8 @@ __pycache__/ .*_cache/ # Documentation -doc/_build/ +doc/_doxygen_output/ +doc/_doxygen_issues.txt # Android .gradle/ diff --git a/core/config/engine.cpp b/core/config/engine.cpp index bd13b95141a..520efeabab5 100644 --- a/core/config/engine.cpp +++ b/core/config/engine.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file engine.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "engine.h" #include "core/authors.gen.h" diff --git a/core/config/engine.h b/core/config/engine.h index 35108fc2539..d2fe410eb23 100644 --- a/core/config/engine.h +++ b/core/config/engine.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file engine.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/os/main_loop.h" @@ -44,7 +50,7 @@ class Engine { struct Singleton { StringName name; Object *ptr = nullptr; - StringName class_name; // Used for binding generation hinting. + StringName class_name; ///< Used for binding generation hinting. // Singleton scope flags. bool user_created = false; bool editor_only = false; diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 4ddb2e6a136..8f3577290fc 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file project_settings.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "project_settings.h" #include "core/core_bind.h" // For Compression enum. @@ -71,8 +77,7 @@ String ProjectSettings::get_imported_files_path() const { } #ifdef TOOLS_ENABLED -// Returns the features that a project must have when opened with this build of Redot. -// This is used by the project manager to provide the initial_settings for config/features. + const PackedStringArray ProjectSettings::get_required_features() { PackedStringArray features; features.append(REDOT_VERSION_BRANCH); @@ -83,7 +88,6 @@ const PackedStringArray ProjectSettings::get_required_features() { return features; } -// Returns the features supported by this build of Redot. Includes all required features. const PackedStringArray ProjectSettings::_get_supported_features() { PackedStringArray features = get_required_features(); #ifdef MODULE_MONO_ENABLED @@ -106,7 +110,6 @@ const PackedStringArray ProjectSettings::_get_supported_features() { return features; } -// Returns the features that this project needs but this build of Redot lacks. const PackedStringArray ProjectSettings::get_unsupported_features(const PackedStringArray &p_project_features) { PackedStringArray unsupported_features; PackedStringArray supported_features = singleton->_get_supported_features(); @@ -123,7 +126,6 @@ const PackedStringArray ProjectSettings::get_unsupported_features(const PackedSt return unsupported_features; } -// Returns the features that both this project has and this build of Redot has, ensuring required features exist. const PackedStringArray ProjectSettings::_trim_to_supported_features(const PackedStringArray &p_project_features) { // Remove unsupported features if present. PackedStringArray features = PackedStringArray(p_project_features); @@ -602,33 +604,6 @@ void ProjectSettings::_convert_to_last_version(int p_from_version) { #endif // DISABLE_DEPRECATED } -/* - * This method is responsible for loading a project.godot file and/or data file - * using the following merit order: - * - If using NetworkClient, try to lookup project file or fail. - * - If --main-pack was passed by the user (`p_main_pack`), load it or fail. - * - Search for project PCKs automatically. For each step we try loading a potential - * PCK, and if it doesn't work, we proceed to the next step. If any step succeeds, - * we try loading the project settings, and abort if it fails. Steps: - * o Bundled PCK in the executable. - * o [macOS only] PCK with same basename as the binary in the .app resource dir. - * o PCK with same basename as the binary in the binary's directory. We handle both - * changing the extension to '.pck' (e.g. 'win_game.exe' -> 'win_game.pck') and - * appending '.pck' to the binary name (e.g. 'linux_game' -> 'linux_game.pck'). - * o PCK with the same basename as the binary in the current working directory. - * Same as above for the two possible PCK file names. - * - On Android, look for 'assets.sparsepck' and try loading it, if it doesn't work, - * proceed to the next step. - * - On relevant platforms (Android/iOS), lookup project file in OS resource path. - * If found, load it or fail. - * - Lookup project file in passed `p_path` (--path passed by the user), i.e. we - * are running from source code. - * If not found and `p_upwards` is true (--upwards passed by the user), look for - * project files in parent folders up to the system root (used to run a game - * from command line while in a subfolder). - * If a project file is found, load it or fail. - * If nothing was found, error out. - */ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, bool p_upwards, bool p_ignore_override) { if (!OS::get_singleton()->get_resource_dir().is_empty()) { // OS will call ProjectSettings->get_resource_path which will be empty if not overridden! @@ -864,8 +839,8 @@ Error ProjectSettings::_load_settings_text(const String &p_path) { Ref f = FileAccess::open(p_path, FileAccess::READ, &err); if (f.is_null()) { - // FIXME: Above 'err' error code is ERR_FILE_CANT_OPEN if the file is missing - // This needs to be streamlined if we want decent error reporting + /// @todo FIXME: Above 'err' error code is ERR_FILE_CANT_OPEN if the file is missing + /// This needs to be streamlined if we want decent error reporting return ERR_FILE_NOT_FOUND; } @@ -1317,7 +1292,6 @@ Variant ProjectSettings::get_setting(const String &p_setting, const Variant &p_d } void ProjectSettings::refresh_global_class_list() { - // This is called after mounting a new PCK file to pick up class changes. is_global_class_list_loaded = false; // Make sure we read from the freshly mounted PCK. Array script_classes = get_global_class_list(); for (int i = 0; i < script_classes.size(); i++) { @@ -1539,9 +1513,6 @@ void ProjectSettings::_add_builtin_input_map() { } ProjectSettings::ProjectSettings() { - // Initialization of engine variables should be done in the setup() method, - // so that the values can be overridden from project.redot or project.binary. - CRASH_COND_MSG(singleton != nullptr, "Instantiating a new ProjectSettings singleton is not supported."); singleton = this; diff --git a/core/config/project_settings.h b/core/config/project_settings.h index 54cde2e174c..d6bf7ca0636 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file project_settings.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/class_db.h" @@ -44,8 +50,8 @@ class ProjectSettings : public Object { bool is_changed = false; - // Starting version from 1 ensures that all callers can reset their tested version to 0, - // and will always detect the initial project settings as a "change". + /// Starting version from 1 ensures that all callers can reset their tested version to 0, + /// and will always detect the initial project settings as a "change". uint32_t _version = 1; public: @@ -53,11 +59,14 @@ class ProjectSettings : public Object { static inline const String PROJECT_DATA_DIR_NAME_SUFFIX = "godot"; static inline const String EDITOR_SETTING_OVERRIDE_PREFIX = "editor_overrides/"; - // Properties that are not for built in values begin from this value, so builtin ones are displayed first. + /// Properties that are not for built in values begin from this value, so builtin ones are displayed first. constexpr static const int32_t NO_BUILTIN_ORDER_BASE = 1 << 16; #ifdef TOOLS_ENABLED + /// Returns the features that a project must have when opened with this build of Redot. + /// This is used by the project manager to provide the initial_settings for config/features. const static PackedStringArray get_required_features(); + /// Returns the features that this project needs but this build of Redot lacks. const static PackedStringArray get_unsupported_features(const PackedStringArray &p_project_features); #endif // TOOLS_ENABLED @@ -94,7 +103,7 @@ class ProjectSettings : public Object { int last_builtin_order = 0; uint64_t last_save_time = 0; - RBMap props; // NOTE: Key order is used e.g. in the save_custom method. + RBMap props; ///< @note Key order is used e.g. in the save_custom method. String resource_path; HashMap custom_prop_info; bool using_datapack = false; @@ -135,7 +144,9 @@ class ProjectSettings : public Object { Error _save_custom_bnd(const String &p_file); #ifdef TOOLS_ENABLED + /// @return The features supported by this build of Redot. Includes all required features. const static PackedStringArray _get_supported_features(); + /// @return The features that both this project has and this build of Redot has, ensuring required features exist. const static PackedStringArray _trim_to_supported_features(const PackedStringArray &p_project_features); #endif // TOOLS_ENABLED @@ -146,6 +157,33 @@ class ProjectSettings : public Object { void _add_property_info_bind(const Dictionary &p_info); + /** + * This method is responsible for loading a project.godot file and/or data file + * using the following merit order: + * - If using NetworkClient, try to lookup project file or fail. + * - If --main-pack was passed by the user (`p_main_pack`), load it or fail. + * - Search for project PCKs automatically. For each step we try loading a potential + * PCK, and if it doesn't work, we proceed to the next step. If any step succeeds, + * we try loading the project settings, and abort if it fails. Steps: + * o Bundled PCK in the executable. + * o [macOS only] PCK with same basename as the binary in the .app resource dir. + * o PCK with same basename as the binary in the binary's directory. We handle both + * changing the extension to '.pck' (e.g. 'win_game.exe' -> 'win_game.pck') and + * appending '.pck' to the binary name (e.g. 'linux_game' -> 'linux_game.pck'). + * o PCK with the same basename as the binary in the current working directory. + * Same as above for the two possible PCK file names. + * - On Android, look for 'assets.sparsepck' and try loading it, if it doesn't work, + * proceed to the next step. + * - On relevant platforms (Android/iOS), lookup project file in OS resource path. + * If found, load it or fail. + * - Lookup project file in passed `p_path` (--path passed by the user), i.e. we + * are running from source code. + * If not found and `p_upwards` is true (--upwards passed by the user), look for + * project files in parent folders up to the system root (used to run a game + * from command line while in a subfolder). + * If a project file is found, load it or fail. + * If nothing was found, error out. + */ Error _setup(const String &p_path, const String &p_main_pack, bool p_upwards = false, bool p_ignore_override = false); void _add_builtin_input_map(); @@ -163,7 +201,7 @@ class ProjectSettings : public Object { void set_setting(const String &p_setting, const Variant &p_value); Variant get_setting(const String &p_setting, const Variant &p_default_value = Variant()) const; TypedArray get_global_class_list(); - void refresh_global_class_list(); + void refresh_global_class_list(); ///< This is called after mounting a new PCK file to pick up class changes. void store_global_class_list(const Array &p_classes); String get_global_class_list_path() const; @@ -229,7 +267,7 @@ class ProjectSettings : public Object { String get_scene_groups_cache_path() const; void load_scene_groups_cache(); - // Testing a version allows fast cached GET_GLOBAL macros. + /// Testing a version allows fast cached GET_GLOBAL macros. uint32_t get_version() const { return _version; } #ifdef TOOLS_ENABLED @@ -240,6 +278,8 @@ class ProjectSettings : public Object { bool has_editor_setting_override(const String &p_setting) const; Variant get_editor_setting_override(const String &p_setting) const; + /// Initialization of engine variables should be done in the setup() method, + /// so that the values can be overridden from project.redot or project.binary. ProjectSettings(); ProjectSettings(const String &p_path); ~ProjectSettings(); @@ -263,9 +303,9 @@ Variant _GLOBAL_DEF(const PropertyInfo &p_info, const Variant &p_default, bool p #define GLOBAL_DEF_INTERNAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, false, false, true) ///////////////////////////////////////////////////////////////////////////////////////// -// Cached versions of GLOBAL_GET. -// Cached but uses a typed variable for storage, this can be more efficient. -// Variables prefixed with _ggc_ to avoid shadowing warnings. +/// Cached versions of GLOBAL_GET. +/// Cached but uses a typed variable for storage, this can be more efficient. +/// Variables prefixed with _ggc_ to avoid shadowing warnings. #define GLOBAL_GET_CACHED(m_type, m_setting_name) ([](const char *p_name) -> m_type {\ static_assert(std::is_trivially_destructible::value, "GLOBAL_GET_CACHED must use a trivial type that allows static lifetime.");\ static m_type _ggc_local_var;\ diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 3690cdf7d65..6a6942fdcf2 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file core_bind.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "core_bind.h" #include "core_bind.compat.inc" @@ -598,7 +604,6 @@ Dictionary OS::get_memory_info() const { return ::OS::get_singleton()->get_memory_info(); } -/** This method uses a signed argument for better error reporting as it's used from the scripting API. */ void OS::delay_usec(int p_usec) const { ERR_FAIL_COND_MSG( p_usec < 0, @@ -606,7 +611,6 @@ void OS::delay_usec(int p_usec) const { ::OS::get_singleton()->delay_usec(p_usec); } -/** This method uses a signed argument for better error reporting as it's used from the scripting API. */ void OS::delay_msec(int p_msec) const { ERR_FAIL_COND_MSG( p_msec < 0, @@ -639,22 +643,18 @@ String OS::get_user_data_dir() const { } String OS::get_config_dir() const { - // Exposed as `get_config_dir()` instead of `get_config_path()` for consistency with other exposed OS methods. return ::OS::get_singleton()->get_config_path(); } String OS::get_data_dir() const { - // Exposed as `get_data_dir()` instead of `get_data_path()` for consistency with other exposed OS methods. return ::OS::get_singleton()->get_data_path(); } String OS::get_cache_dir() const { - // Exposed as `get_cache_dir()` instead of `get_cache_path()` for consistency with other exposed OS methods. return ::OS::get_singleton()->get_cache_path(); } String OS::get_temp_dir() const { - // Exposed as `get_temp_dir()` instead of `get_temp_path()` for consistency with other exposed OS methods. return ::OS::get_singleton()->get_temp_path(); } diff --git a/core/core_bind.h b/core/core_bind.h index 499c3f14eca..ac6077c74a3 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file core_bind.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/debugger/engine_profiler.h" @@ -267,7 +273,9 @@ class OS : public Object { uint64_t get_static_memory_peak_usage() const; Dictionary get_memory_info() const; + /** This method uses a signed argument for better error reporting as it's used from the scripting API. */ void delay_usec(int p_usec) const; + /** This method uses a signed argument for better error reporting as it's used from the scripting API. */ void delay_msec(int p_msec) const; uint64_t get_ticks_msec() const; uint64_t get_ticks_usec() const; @@ -294,10 +302,10 @@ class OS : public Object { Error move_to_trash(const String &p_path) const; String get_user_data_dir() const; - String get_config_dir() const; - String get_data_dir() const; - String get_cache_dir() const; - String get_temp_dir() const; + String get_config_dir() const; ///< Exposed as `get_config_dir()` instead of `get_config_path()` for consistency with other exposed OS methods. + String get_data_dir() const; ///< Exposed as `get_data_dir()` instead of `get_data_path()` for consistency with other exposed OS methods. + String get_cache_dir() const; ///< Exposed as `get_cache_dir()` instead of `get_cache_path()` for consistency with other exposed OS methods. + String get_temp_dir() const; ///< Exposed as `get_temp_dir()` instead of `get_temp_path()` for consistency with other exposed OS methods. Error set_thread_name(const String &p_name); ::Thread::ID get_thread_caller_id() const; @@ -354,17 +362,22 @@ class Geometry2D : public Object { OPERATION_INTERSECTION, OPERATION_XOR }; - // 2D polygon boolean operations. + + /// @name 2D polygon boolean operations + /// @{ TypedArray merge_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // Union (add). TypedArray clip_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // Difference (subtract). TypedArray intersect_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // Common area (multiply). TypedArray exclude_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // All but common area (xor). - - // 2D polyline vs polygon operations. + /// @} + /// @name 2D polyline vs polygon operations + /// @{ TypedArray clip_polyline_with_polygon(const Vector &p_polyline, const Vector &p_polygon); // Cut. TypedArray intersect_polyline_with_polygon(const Vector &p_polyline, const Vector &p_polygon); // Chop. + /// @} - // 2D offset polygons/polylines. + /// @name 2D offset polygons/polylines + /// @{ enum PolyJoinType { JOIN_SQUARE, JOIN_ROUND, @@ -379,6 +392,7 @@ class Geometry2D : public Object { }; TypedArray offset_polygon(const Vector &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE); TypedArray offset_polyline(const Vector &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE, PolyEndType p_end_type = END_SQUARE); + /// @} Dictionary make_atlas(const Vector &p_rects); @@ -634,7 +648,7 @@ class Engine : public Object { bool is_embedded_in_editor() const; - // `set_write_movie_path()` is not exposed to the scripting API as changing it at run-time has no effect. + /// `set_write_movie_path()` is not exposed to the scripting API as changing it at run-time has no effect. String get_write_movie_path() const; void set_print_to_stdout(bool p_enabled); diff --git a/core/core_constants.cpp b/core/core_constants.cpp index aaccd889162..00f8e5e7f47 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file core_constants.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "core_constants.h" #include "core/input/input_event.h" @@ -91,7 +97,7 @@ static HashMap> _global_enums; _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -// This just binds enum classes as if they were regular enum constants. +/// This just binds enum classes as if they were regular enum constants. #define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \ { \ StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \ @@ -182,7 +188,7 @@ static HashMap> _global_enums; _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ } -// This just binds enum classes as if they were regular enum constants. +/// This just binds enum classes as if they were regular enum constants. #define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \ { \ StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \ diff --git a/core/core_constants.h b/core/core_constants.h index 3db65d093a9..973f2c27250 100644 --- a/core/core_constants.h +++ b/core/core_constants.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file core_constants.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/string/string_name.h" diff --git a/core/core_globals.h b/core/core_globals.h index 0f52ffa90ed..22e06b149bb 100644 --- a/core/core_globals.h +++ b/core/core_globals.h @@ -30,11 +30,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +/** + * @file core_globals.h + * + * [Add any documentation that applies to the entire file here!] + */ -// Home for state needed from global functions -// that cannot be stored in Engine or OS due to e.g. circular includes +#pragma once +/// Home for state needed from global functions +/// that cannot be stored in Engine or OS due to e.g. circular includes class CoreGlobals { public: static inline bool leak_reporting_enabled = true; diff --git a/core/core_string_names.h b/core/core_string_names.h index 8e9aafbe5f4..07e4e2b8b90 100644 --- a/core/core_string_names.h +++ b/core/core_string_names.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file core_string_names.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/string/string_name.h" @@ -46,7 +52,7 @@ class CoreStringNames { _FORCE_INLINE_ static CoreStringNames *get_singleton() { return singleton; } - const StringName free_ = "free"; // free would conflict with C++ keyword. + const StringName free_ = "free"; ///< free would conflict with C++ keyword. const StringName changed = "changed"; const StringName script = "script"; const StringName script_changed = "script_changed"; diff --git a/core/crypto/aes_context.cpp b/core/crypto/aes_context.cpp index 2c3cd5ae700..819ed1bdb68 100644 --- a/core/crypto/aes_context.cpp +++ b/core/crypto/aes_context.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file aes_context.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "core/crypto/aes_context.h" Error AESContext::start(Mode p_mode, const PackedByteArray &p_key, const PackedByteArray &p_iv) { diff --git a/core/crypto/aes_context.h b/core/crypto/aes_context.h index 8af13c2e481..cf2bf659766 100644 --- a/core/crypto/aes_context.h +++ b/core/crypto/aes_context.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file aes_context.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/crypto/crypto_core.h" diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp index 9e8905dd9ec..a7da5e3e410 100644 --- a/core/crypto/crypto.cpp +++ b/core/crypto/crypto.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file crypto.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "crypto.h" /// Resources @@ -149,8 +155,6 @@ PackedByteArray Crypto::hmac_digest(HashingContext::HashType p_hash_type, const return ctx->finish(); } -// Compares two HMACS for equality without leaking timing information in order to prevent timing attacks. -// @see: https://paragonie.com/blog/2015/11/preventing-timing-attacks-on-string-comparison-with-double-hmac-strategy bool Crypto::constant_time_compare(const PackedByteArray &p_trusted, const PackedByteArray &p_received) { const uint8_t *t = p_trusted.ptr(); const uint8_t *r = p_received.ptr(); diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h index ceaba880da4..63021804db6 100644 --- a/core/crypto/crypto.h +++ b/core/crypto/crypto.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file crypto.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/crypto/hashing_context.h" @@ -143,8 +149,8 @@ class Crypto : public RefCounted { PackedByteArray hmac_digest(HashingContext::HashType p_hash_type, const PackedByteArray &p_key, const PackedByteArray &p_msg); - // Compares two PackedByteArrays for equality without leaking timing information in order to prevent timing attacks. - // @see: https://paragonie.com/blog/2015/11/preventing-timing-attacks-on-string-comparison-with-double-hmac-strategy + /// Compares two PackedByteArrays for equality without leaking timing information in order to prevent timing attacks. + /// @see https://paragonie.com/blog/2015/11/preventing-timing-attacks-on-string-comparison-with-double-hmac-strategy bool constant_time_compare(const PackedByteArray &p_trusted, const PackedByteArray &p_received); Crypto() {} @@ -157,7 +163,7 @@ class ResourceFormatLoaderCrypto : public ResourceFormatLoader { virtual bool handles_type(const String &p_type) const override; virtual String get_resource_type(const String &p_path) const override; - // Treat certificates as text files, do not generate a `*.{crt,key,pub}.uid` file. + /// Treat certificates as text files, do not generate a `*.{crt,key,pub}.uid` file. virtual ResourceUID::ID get_resource_uid(const String &p_path) const override { return ResourceUID::INVALID_ID; } virtual bool has_custom_uid_support() const override { return true; } }; diff --git a/core/crypto/crypto_core.cpp b/core/crypto/crypto_core.cpp index 553194d2b88..cb6bfb790b9 100644 --- a/core/crypto/crypto_core.cpp +++ b/core/crypto/crypto_core.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file crypto_core.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "crypto_core.h" #include "core/os/os.h" diff --git a/core/crypto/crypto_core.h b/core/crypto/crypto_core.h index 53e77533262..f36eedb346d 100644 --- a/core/crypto/crypto_core.h +++ b/core/crypto/crypto_core.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file crypto_core.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/ref_counted.h" diff --git a/core/crypto/hashing_context.cpp b/core/crypto/hashing_context.cpp index 5108058e22c..eb8da3e3bd2 100644 --- a/core/crypto/hashing_context.cpp +++ b/core/crypto/hashing_context.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file hashing_context.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "hashing_context.h" #include "core/crypto/crypto_core.h" diff --git a/core/crypto/hashing_context.h b/core/crypto/hashing_context.h index abd35cbb394..4a87a2b8163 100644 --- a/core/crypto/hashing_context.h +++ b/core/crypto/hashing_context.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file hashing_context.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/ref_counted.h" diff --git a/core/debugger/debugger_marshalls.cpp b/core/debugger/debugger_marshalls.cpp index bd9de66f328..3dee4cfef75 100644 --- a/core/debugger/debugger_marshalls.cpp +++ b/core/debugger/debugger_marshalls.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file debugger_marshalls.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "debugger_marshalls.h" #include "core/io/marshalls.h" diff --git a/core/debugger/debugger_marshalls.h b/core/debugger/debugger_marshalls.h index 3871af4fefe..214fa21e425 100644 --- a/core/debugger/debugger_marshalls.h +++ b/core/debugger/debugger_marshalls.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file debugger_marshalls.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/input/shortcut.h" diff --git a/core/debugger/engine_debugger.cpp b/core/debugger/engine_debugger.cpp index e7f2978ee90..e4417518dee 100644 --- a/core/debugger/engine_debugger.cpp +++ b/core/debugger/engine_debugger.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file engine_debugger.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "engine_debugger.h" #include "core/debugger/local_debugger.h" diff --git a/core/debugger/engine_debugger.h b/core/debugger/engine_debugger.h index c8609332303..6c9361f75a1 100644 --- a/core/debugger/engine_debugger.h +++ b/core/debugger/engine_debugger.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file engine_debugger.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/string/string_name.h" @@ -126,8 +132,9 @@ class EngineDebugger { void profiler_enable(const StringName &p_name, bool p_enabled, const Array &p_opts = Array()); Error capture_parse(const StringName &p_name, const String &p_msg, const Array &p_args, bool &r_captured); + /// The purpose of this is just processing events every now and then when the script might get too busy + /// otherwise bugs like infinite loops can't be caught. void line_poll() { - // The purpose of this is just processing events every now and then when the script might get too busy otherwise bugs like infinite loops can't be caught. if (unlikely(poll_every % 2048) == 0) { poll_events(false); } diff --git a/core/debugger/engine_profiler.cpp b/core/debugger/engine_profiler.cpp index 1a92cea9987..83146533e7a 100644 --- a/core/debugger/engine_profiler.cpp +++ b/core/debugger/engine_profiler.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file engine_profiler.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "engine_profiler.h" #include "core/debugger/engine_debugger.h" diff --git a/core/debugger/engine_profiler.h b/core/debugger/engine_profiler.h index 614734d912a..3c62d64acc2 100644 --- a/core/debugger/engine_profiler.h +++ b/core/debugger/engine_profiler.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file engine_profiler.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/gdvirtual.gen.inc" diff --git a/core/debugger/local_debugger.cpp b/core/debugger/local_debugger.cpp index cdf221f6e10..fff35a6698b 100644 --- a/core/debugger/local_debugger.cpp +++ b/core/debugger/local_debugger.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file local_debugger.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "local_debugger.h" #include "core/debugger/script_debugger.h" @@ -359,8 +365,8 @@ Pair LocalDebugger::to_breakpoint(const String &p_line) { } void LocalDebugger::send_message(const String &p_message, const Array &p_args) { - // This needs to be cleaned up entirely. - // print_line("MESSAGE: '" + p_message + "' - " + String(Variant(p_args))); + /// @todo This needs to be cleaned up entirely. + /// print_line("MESSAGE: '" + p_message + "' - " + String(Variant(p_args))); } void LocalDebugger::send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, bool p_editor_notify, ErrorHandlerType p_type) { diff --git a/core/debugger/local_debugger.h b/core/debugger/local_debugger.h index 650a1815a17..73b1744a9d7 100644 --- a/core/debugger/local_debugger.h +++ b/core/debugger/local_debugger.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file local_debugger.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/debugger/engine_debugger.h" diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp index e971ca634aa..bd5a278f6c7 100644 --- a/core/debugger/remote_debugger.cpp +++ b/core/debugger/remote_debugger.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file remote_debugger.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "remote_debugger.h" #include "core/config/project_settings.h" @@ -388,9 +394,6 @@ Array RemoteDebugger::_get_message() { } void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { - //this function is called when there is a debugger break (bug on script) - //or when execution is paused from editor - { MutexLock lock(mutex); // Tests that require mutex. diff --git a/core/debugger/remote_debugger.h b/core/debugger/remote_debugger.h index 0e91b147f30..c3e86bf1b31 100644 --- a/core/debugger/remote_debugger.h +++ b/core/debugger/remote_debugger.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file remote_debugger.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/debugger/debugger_marshalls.h" @@ -118,6 +124,8 @@ class RemoteDebugger : public EngineDebugger { void poll_events(bool p_is_idle); void send_message(const String &p_message, const Array &p_args); void send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, bool p_editor_notify, ErrorHandlerType p_type); + /// This function is called when there is a debugger break (bug on script) + /// or when execution is paused from editor void debug(bool p_can_continue = true, bool p_is_error_breakpoint = false); explicit RemoteDebugger(Ref p_peer); diff --git a/core/debugger/remote_debugger_peer.cpp b/core/debugger/remote_debugger_peer.cpp index f54516fb318..c098d4489b0 100644 --- a/core/debugger/remote_debugger_peer.cpp +++ b/core/debugger/remote_debugger_peer.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file remote_debugger_peer.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "remote_debugger_peer.h" #include "core/config/project_settings.h" diff --git a/core/debugger/remote_debugger_peer.h b/core/debugger/remote_debugger_peer.h index ad70bab3347..ffe262b8698 100644 --- a/core/debugger/remote_debugger_peer.h +++ b/core/debugger/remote_debugger_peer.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file remote_debugger_peer.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/stream_peer_tcp.h" @@ -50,7 +56,7 @@ class RemoteDebuggerPeer : public RefCounted { virtual Array get_message() = 0; virtual void close() = 0; virtual void poll() = 0; - virtual bool can_block() const { return true; } // If blocking io is allowed on main thread (debug). + virtual bool can_block() const { return true; } ///< If blocking io is allowed on main thread (debug). RemoteDebuggerPeer(); }; diff --git a/core/debugger/script_debugger.cpp b/core/debugger/script_debugger.cpp index 0ba9fd2f17f..f7a1603aded 100644 --- a/core/debugger/script_debugger.cpp +++ b/core/debugger/script_debugger.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file script_debugger.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "script_debugger.h" #include "core/debugger/engine_debugger.h" @@ -94,7 +100,7 @@ void ScriptDebugger::debug(ScriptLanguage *p_lang, bool p_can_continue, bool p_i } void ScriptDebugger::send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, bool p_editor_notify, ErrorHandlerType p_type, const Vector &p_stack_info) { - // Store stack info, this is ugly, but allows us to separate EngineDebugger and ScriptDebugger. There might be a better way. + /// @todo Store stack info, this is ugly, but allows us to separate EngineDebugger and ScriptDebugger. There might be a better way. error_stack_info.append_array(p_stack_info); EngineDebugger::get_singleton()->send_error(p_func, p_file, p_line, p_err, p_descr, p_editor_notify, p_type); error_stack_info.clear(); // Clear because this is thread local diff --git a/core/debugger/script_debugger.h b/core/debugger/script_debugger.h index 78128cd0ca3..392793b4f81 100644 --- a/core/debugger/script_debugger.h +++ b/core/debugger/script_debugger.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file script_debugger.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/script_language.h" diff --git a/core/doc_data.cpp b/core/doc_data.cpp index 5e7f2ba5254..3daec09258d 100644 --- a/core/doc_data.cpp +++ b/core/doc_data.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file doc_data.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "doc_data.h" String DocData::get_default_value_string(const Variant &p_value) { diff --git a/core/doc_data.h b/core/doc_data.h index b84c5695487..63fd3cb7865 100644 --- a/core/doc_data.h +++ b/core/doc_data.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file doc_data.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/xml_parser.h" @@ -109,7 +115,7 @@ class DocData { bool is_experimental = false; String experimental_message; Vector arguments; - // NOTE: Only for GDScript for now. The rest argument is not saved to the XML file. + /// @note Only for GDScript for now. The rest argument is not saved to the XML file. ArgumentDoc rest_argument; Vector errors_returned; String keywords; diff --git a/core/error/error_list.cpp b/core/error/error_list.cpp index 6d11e821786..4c5e9b84bce 100644 --- a/core/error/error_list.cpp +++ b/core/error/error_list.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file error_list.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "error_list.h" #include diff --git a/core/error/error_list.h b/core/error/error_list.h index 769e9c7dbec..6d3af919aa1 100644 --- a/core/error/error_list.h +++ b/core/error/error_list.h @@ -30,9 +30,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file error_list.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once -/** Error List. Please never compare an error against FAILED +/** + * Error List. Please never compare an error against FAILED * Either do result != OK , or !result. This way, Error fail * values can be more detailed in the future. * @@ -44,7 +51,6 @@ * - Are bound with BIND_CORE_ENUM_CONSTANT() in core/core_constants.cpp * - Have a matching Android version in platform/android/java/lib/src/org/godotengine/godot/error/Error.kt */ - enum Error { OK, // (0) FAILED, ///< Generic fail error diff --git a/core/error/error_macros.cpp b/core/error/error_macros.cpp index cc8e4c2730d..dd357f7cc75 100644 --- a/core/error/error_macros.cpp +++ b/core/error/error_macros.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file error_macros.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "error_macros.h" #include "core/io/logger.h" @@ -136,9 +142,6 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co is_printing_error = false; } -// For printing errors when we may crash at any point, so we must flush ASAP a lot of lines -// but we don't want to make it noisy by printing lots of file & line info (because it's already -// been printing by a preceding _err_print_error). void _err_print_error_asap(const String &p_error, ErrorHandlerType p_type) { const char *err_details = p_error.utf8().get_data(); diff --git a/core/error/error_macros.h b/core/error/error_macros.h index db80dee8d49..0d9dea5439b 100644 --- a/core/error/error_macros.h +++ b/core/error/error_macros.h @@ -30,6 +30,27 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file error_macros.h + * + * + * @section error_macros Error Macros (ERR_) + * @warning These macros work in the opposite way to assert(). + * + * @warning Unlike exceptions and asserts, these macros try to maintain consistency and stability. + * In most cases, bugs and/or invalid data are not fatal. They should never allow a perfectly + * running application to fail or crash. + * Always try to return processable data, so the engine can keep running well. + * Use the _MSG versions to print a meaningful message to help with debugging. + * + * The `((void)0)` no-op statement is used as a trick to force us to put a semicolon after + * those macros, making them look like proper statements. + * The if wrappers are used to ensure that the macro replacement does not trigger unexpected + * issues when expanded e.g. after an `if (cond) ERR_FAIL();` without braces. + * + * These macros should be used instead of `ERR_FAIL_COND` for bounds checking. + */ + #pragma once #include "core/typedefs.h" @@ -78,17 +99,32 @@ struct ErrorHandlerList { void add_error_handler(ErrorHandlerList *p_handler); void remove_error_handler(const ErrorHandlerList *p_handler); -// Functions used by the error macros. +/// @name Functions used by the error macros +/// @{ +/** + * For printing errors when we may crash at any point, so we must flush ASAP a lot of lines + * but we don't want to make it noisy by printing lots of file & line info (because it's already + * been printing by a preceding _err_print_error). + * */ +void _err_print_error_asap(const String &p_error, ErrorHandlerType p_type = ERR_HANDLER_ERROR); +/// @} + +/// @name Functions used by the error macros: Errors with messages (All combinations of p_error and p_message as String or char*.) +/// @{ _NO_INLINE_ void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR); _NO_INLINE_ void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR); _NO_INLINE_ void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR); _NO_INLINE_ void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const char *p_message, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR); _NO_INLINE_ void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const String &p_message, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR); _NO_INLINE_ void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const String &p_message, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR); -void _err_print_error_asap(const String &p_error, ErrorHandlerType p_type = ERR_HANDLER_ERROR); +/// @} + +/// @name Functions used by the error macros: Index errors. (All combinations of p_message as String or char*.) +/// @{ _NO_INLINE_ void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const char *p_message = "", bool p_editor_notify = false, bool fatal = false); _NO_INLINE_ void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const String &p_message, bool p_editor_notify = false, bool fatal = false); _NO_INLINE_ void _err_flush_stdout(); +/// @} void _physics_interpolation_warning(const char *p_function, const char *p_file, int p_line, ObjectID p_id, const char *p_warn_string); @@ -112,26 +148,10 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file, #endif /** - * Error macros. - * WARNING: These macros work in the opposite way to assert(). - * - * Unlike exceptions and asserts, these macros try to maintain consistency and stability. - * In most cases, bugs and/or invalid data are not fatal. They should never allow a perfectly - * running application to fail or crash. - * Always try to return processable data, so the engine can keep running well. - * Use the _MSG versions to print a meaningful message to help with debugging. - * - * The `((void)0)` no-op statement is used as a trick to force us to put a semicolon after - * those macros, making them look like proper statements. - * The if wrappers are used to ensure that the macro replacement does not trigger unexpected - * issues when expanded e.g. after an `if (cond) ERR_FAIL();` without braces. + * @name Error Macros: Integer index out of bounds error macros + * @{ */ -// Index out of bounds error macros. -// These macros should be used instead of `ERR_FAIL_COND` for bounds checking. - -// Integer index out of bounds error macros. - /** * Try using `ERR_FAIL_INDEX_MSG`. * Only use this macro if there is no sensible error message. @@ -233,7 +253,9 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file, } else \ ((void)0) -// Unsigned integer index out of bounds error macros. +/// @} +/// @name Error Macros: Unsigned integer index out of bounds error macros +/// @{ /** * Try using `ERR_FAIL_UNSIGNED_INDEX_MSG`. @@ -336,7 +358,9 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file, } else \ ((void)0) -// Null reference error macros. +/// @} +/// @name Error Macros: Null reference error macros +/// @{ /** * Try using `ERR_FAIL_NULL_MSG`. @@ -589,7 +613,9 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file, } else \ ((void)0) -// Generic error macros. +/// @} +/// @name Error Macros: Generic error macros +/// @{ /** * Try using `ERR_FAIL_COND_MSG` or `ERR_FAIL_MSG`. @@ -707,7 +733,9 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file, } else \ ((void)0) -// Print warning message macros. +/// @} +/// @name Print warning message macros +/// @{ /** * Prints `m_msg`. @@ -761,7 +789,9 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file, } \ } -// Print deprecated warning message macros. +/// @} +/// @name Print deprecated warning message macros +/// @{ /** * Warns that the current function is deprecated. @@ -817,7 +847,7 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file, ((void)0) /** - * Note: IN MOST CASES YOU SHOULD NOT USE THIS MACRO. + * @warning IN MOST CASES YOU SHOULD NOT USE THIS MACRO. * Do not use unless you understand the trade-offs. * * DEV macros will be compiled out in releases, they are wrapped in DEV_ENABLED. @@ -858,11 +888,15 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file, #endif /** - * Physics Interpolation warnings. + * @} + * @name Physics Interpolation warnings. * These are spam protection warnings. + * @{ */ + #define PHYSICS_INTERPOLATION_NODE_WARNING(m_object_id, m_string) \ _physics_interpolation_warning(FUNCTION_STR, __FILE__, __LINE__, m_object_id, m_string) #define PHYSICS_INTERPOLATION_WARNING(m_string) \ _physics_interpolation_warning(FUNCTION_STR, __FILE__, __LINE__, ObjectID(UINT64_MAX), m_string) +/// @} diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp index a514612bee5..1d79ee17f59 100644 --- a/core/extension/extension_api_dump.cpp +++ b/core/extension/extension_api_dump.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file extension_api_dump.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "extension_api_dump.h" #include "core/config/engine.h" @@ -94,9 +100,8 @@ static String get_type_meta_name(const GodotTypeInfo::Metadata metadata) { return argmeta[metadata]; } +/// Based on what EditorHelp does. static String fix_doc_description(const String &p_bbcode) { - // Based on what EditorHelp does. - return p_bbcode.dedent() .remove_chars("\r") .strip_edges(); diff --git a/core/extension/extension_api_dump.h b/core/extension/extension_api_dump.h index d5c5e7579c7..972062713ab 100644 --- a/core/extension/extension_api_dump.h +++ b/core/extension/extension_api_dump.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file extension_api_dump.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/extension/gdextension.h" diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp index d9fe4164ac0..435e9b91d25 100644 --- a/core/extension/gdextension.cpp +++ b/core/extension/gdextension.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "gdextension.h" #include "gdextension.compat.inc" @@ -863,7 +869,7 @@ Error GDExtensionResourceLoader::load_gdextension_resource(const String &p_path, } Ref GDExtensionResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { - // We can't have two GDExtension resource object representing the same library, because + // We can't have two GDExtension resource objects representing the same library, because // loading (or unloading) a GDExtension affects global data. So, we need reuse the same // object if one has already been loaded (even if caching is disabled at the resource // loader level). diff --git a/core/extension/gdextension.h b/core/extension/gdextension.h index 475c53c9e62..310423b8228 100644 --- a/core/extension/gdextension.h +++ b/core/extension/gdextension.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/extension/gdextension_interface.h" @@ -114,7 +120,7 @@ class GDExtension : public Resource { void _clear_extension(Extension *p_extension); - // Only called by GDExtensionManager during the reload process. + /// Only called by GDExtensionManager during the reload process. void prepare_reload(); void finish_reload(); void clear_instance_bindings(); @@ -132,7 +138,7 @@ class GDExtension : public Resource { public: HashMap class_icon_paths; - virtual bool editor_can_reload_from_file() override { return false; } // Reloading is handled in a special way. + virtual bool editor_can_reload_from_file() override { return false; } ///< Reloading is handled in a special way. static String get_extension_list_config_file(); diff --git a/core/extension/gdextension_interface.cpp b/core/extension/gdextension_interface.cpp index 988446e4cdf..18a92bc6a1e 100644 --- a/core/extension/gdextension_interface.cpp +++ b/core/extension/gdextension_interface.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension_interface.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "gdextension_interface.h" #include "core/config/engine.h" @@ -1428,7 +1434,7 @@ static void gdextension_object_call_script_method(GDExtensionObjectPtr p_object, const StringName method = *reinterpret_cast(p_method); const Variant **args = (const Variant **)p_args; - Callable::CallError error; // TODO: Check `error`? + Callable::CallError error; /// @todo Check `error`? memnew_placement(r_return, Variant); *(Variant *)r_return = o->callp(method, args, p_argument_count, error); diff --git a/core/extension/gdextension_interface.h b/core/extension/gdextension_interface.h index 3359c381bc2..4f1b696eed0 100644 --- a/core/extension/gdextension_interface.h +++ b/core/extension/gdextension_interface.h @@ -30,6 +30,28 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension_interface.h + * + * + * @brief In this API there are multiple functions which expect the caller to pass a pointer + * on return value as parameter. + * + * In order to make it clear if the caller should initialize the return value or not + * we have two flavor of types: + * - `GDExtensionXXXPtr` for pointer on an initialized value + * - `GDExtensionUninitializedXXXPtr` for pointer on uninitialized value + * + * @note + * - Not respecting those requirements can seems harmless, but will lead to unexpected + * segfault or memory leak (for instance with a specific compiler/OS, or when two + * native extensions start doing ptrcall on each other). + * - Initialization must be done with the function pointer returned by `variant_get_ptr_constructor`, + * zero-initializing the variable should not be considered a valid initialization method here ! + * - Some types have no destructor (see `extension_api.json`'s `has_destructor` field), for + * them it is always safe to skip the constructor for the return value if you are in a hurry ;-) + */ + #pragma once /* This is a C class header, you can copy it and use it directly in your own binders. @@ -142,22 +164,6 @@ typedef enum { } GDExtensionVariantOperator; -// In this API there are multiple functions which expect the caller to pass a pointer -// on return value as parameter. -// In order to make it clear if the caller should initialize the return value or not -// we have two flavor of types: -// - `GDExtensionXXXPtr` for pointer on an initialized value -// - `GDExtensionUninitializedXXXPtr` for pointer on uninitialized value -// -// Notes: -// - Not respecting those requirements can seems harmless, but will lead to unexpected -// segfault or memory leak (for instance with a specific compiler/OS, or when two -// native extensions start doing ptrcall on each other). -// - Initialization must be done with the function pointer returned by `variant_get_ptr_constructor`, -// zero-initializing the variable should not be considered a valid initialization method here ! -// - Some types have no destructor (see `extension_api.json`'s `has_destructor` field), for -// them it is always safe to skip the constructor for the return value if you are in a hurry ;-) - typedef void *GDExtensionVariantPtr; typedef const void *GDExtensionConstVariantPtr; typedef void *GDExtensionUninitializedVariantPtr; @@ -185,11 +191,11 @@ typedef const void *GDExtensionConstRefPtr; typedef enum { GDEXTENSION_CALL_OK, GDEXTENSION_CALL_ERROR_INVALID_METHOD, - GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT, // Expected a different variant type. - GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS, // Expected lower number of arguments. - GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS, // Expected higher number of arguments. + GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT, ///< Expected a different variant type. + GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS, ///< Expected lower number of arguments. + GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS, ///< Expected higher number of arguments. GDEXTENSION_CALL_ERROR_INSTANCE_IS_NULL, - GDEXTENSION_CALL_ERROR_METHOD_NOT_CONST, // Used for const call. + GDEXTENSION_CALL_ERROR_METHOD_NOT_CONST, ///< Used for const call. } GDExtensionCallErrorType; typedef struct { @@ -238,24 +244,34 @@ typedef struct { GDExtensionVariantType type; GDExtensionStringNamePtr name; GDExtensionStringNamePtr class_name; - uint32_t hint; // Bitfield of `PropertyHint` (defined in `extension_api.json`). + uint32_t hint; ///< Bitfield of `PropertyHint` (defined in `extension_api.json`). GDExtensionStringPtr hint_string; - uint32_t usage; // Bitfield of `PropertyUsageFlags` (defined in `extension_api.json`). + uint32_t usage; ///< Bitfield of `PropertyUsageFlags` (defined in `extension_api.json`). } GDExtensionPropertyInfo; typedef struct { GDExtensionStringNamePtr name; GDExtensionPropertyInfo return_value; - uint32_t flags; // Bitfield of `GDExtensionClassMethodFlags`. + uint32_t flags; ///< Bitfield of `GDExtensionClassMethodFlags`. int32_t id; - /* Arguments: `default_arguments` is an array of size `argument_count`. */ + /** + * @name Arguments + * @details `arguments` is an array of size `argument_count`. + * @{ + */ uint32_t argument_count; GDExtensionPropertyInfo *arguments; - /* Default arguments: `default_arguments` is an array of size `default_argument_count`. */ + /** + * @} + * @name Default arguments + * @details `default_arguments` is an array of size `default_argument_count`. + * @{ + */ uint32_t default_argument_count; GDExtensionVariantPtr *default_arguments; + /// @} } GDExtensionMethodInfo; typedef const GDExtensionPropertyInfo *(*GDExtensionClassGetPropertyList)(GDExtensionClassInstancePtr p_instance, uint32_t *r_count); @@ -264,7 +280,7 @@ typedef void (*GDExtensionClassFreePropertyList2)(GDExtensionClassInstancePtr p_ typedef GDExtensionBool (*GDExtensionClassPropertyCanRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name); typedef GDExtensionBool (*GDExtensionClassPropertyGetRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret); typedef GDExtensionBool (*GDExtensionClassValidateProperty)(GDExtensionClassInstancePtr p_instance, GDExtensionPropertyInfo *p_property); -typedef void (*GDExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what); // Deprecated. Use GDExtensionClassNotification2 instead. +typedef void (*GDExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what); ///< Deprecated. Use GDExtensionClassNotification2 instead. typedef void (*GDExtensionClassNotification2)(GDExtensionClassInstancePtr p_instance, int32_t p_what, GDExtensionBool p_reversed); typedef void (*GDExtensionClassToString)(GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr p_out); typedef void (*GDExtensionClassReference)(GDExtensionClassInstancePtr p_instance); @@ -293,12 +309,12 @@ typedef struct { GDExtensionClassToString to_string_func; GDExtensionClassReference reference_func; GDExtensionClassUnreference unreference_func; - GDExtensionClassCreateInstance create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. - GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory. - GDExtensionClassGetVirtual get_virtual_func; // Queries a virtual function by name and returns a callback to invoke the requested virtual function. + GDExtensionClassCreateInstance create_instance_func; ///< (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. + GDExtensionClassFreeInstance free_instance_func; ///< Destructor; mandatory. + GDExtensionClassGetVirtual get_virtual_func; ///< Queries a virtual function by name and returns a callback to invoke the requested virtual function. GDExtensionClassGetRID get_rid_func; - void *class_userdata; // Per-class user data, later accessible in instance bindings. -} GDExtensionClassCreationInfo; // Deprecated. Use GDExtensionClassCreationInfo4 instead. + void *class_userdata; ///< Per-class user data, later accessible in instance bindings. +} GDExtensionClassCreationInfo; ///< Deprecated. Use GDExtensionClassCreationInfo4 instead. typedef struct { GDExtensionBool is_virtual; @@ -315,23 +331,25 @@ typedef struct { GDExtensionClassToString to_string_func; GDExtensionClassReference reference_func; GDExtensionClassUnreference unreference_func; - GDExtensionClassCreateInstance create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. - GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory. + GDExtensionClassCreateInstance create_instance_func; ///< (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. + GDExtensionClassFreeInstance free_instance_func; ///< Destructor; mandatory. GDExtensionClassRecreateInstance recreate_instance_func; - // Queries a virtual function by name and returns a callback to invoke the requested virtual function. + /// Queries a virtual function by name and returns a callback to invoke the requested virtual function. GDExtensionClassGetVirtual get_virtual_func; - // Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that - // need or benefit from extra data when calling virtual functions. - // Returns user data that will be passed to `call_virtual_with_data_func`. - // Returning `NULL` from this function signals to Godot that the virtual function is not overridden. - // Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized. - // You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`. + /** + * Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that + * need or benefit from extra data when calling virtual functions. + * Returns user data that will be passed to `call_virtual_with_data_func`. + * Returning `NULL` from this function signals to Godot that the virtual function is not overridden. + * Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized. + * You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`. + */ GDExtensionClassGetVirtualCallData get_virtual_call_data_func; - // Used to call virtual functions when `get_virtual_call_data_func` is not null. + /// Used to call virtual functions when `get_virtual_call_data_func` is not null. GDExtensionClassCallVirtualWithData call_virtual_with_data_func; GDExtensionClassGetRID get_rid_func; - void *class_userdata; // Per-class user data, later accessible in instance bindings. -} GDExtensionClassCreationInfo2; // Deprecated. Use GDExtensionClassCreationInfo4 instead. + void *class_userdata; ///< Per-class user data, later accessible in instance bindings. +} GDExtensionClassCreationInfo2; ///< Deprecated. Use GDExtensionClassCreationInfo4 instead. typedef struct { GDExtensionBool is_virtual; @@ -349,23 +367,25 @@ typedef struct { GDExtensionClassToString to_string_func; GDExtensionClassReference reference_func; GDExtensionClassUnreference unreference_func; - GDExtensionClassCreateInstance create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. - GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory. + GDExtensionClassCreateInstance create_instance_func; ///< (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. + GDExtensionClassFreeInstance free_instance_func; ///< Destructor; mandatory. GDExtensionClassRecreateInstance recreate_instance_func; - // Queries a virtual function by name and returns a callback to invoke the requested virtual function. + /// Queries a virtual function by name and returns a callback to invoke the requested virtual function. GDExtensionClassGetVirtual get_virtual_func; - // Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that - // need or benefit from extra data when calling virtual functions. - // Returns user data that will be passed to `call_virtual_with_data_func`. - // Returning `NULL` from this function signals to Godot that the virtual function is not overridden. - // Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized. - // You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`. + /** + * Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that + * need or benefit from extra data when calling virtual functions. + * Returns user data that will be passed to `call_virtual_with_data_func`. + * Returning `NULL` from this function signals to Godot that the virtual function is not overridden. + * Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized. + * You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`. + */ GDExtensionClassGetVirtualCallData get_virtual_call_data_func; - // Used to call virtual functions when `get_virtual_call_data_func` is not null. + /// Used to call virtual functions when `get_virtual_call_data_func` is not null. GDExtensionClassCallVirtualWithData call_virtual_with_data_func; GDExtensionClassGetRID get_rid_func; - void *class_userdata; // Per-class user data, later accessible in instance bindings. -} GDExtensionClassCreationInfo3; // Deprecated. Use GDExtensionClassCreationInfo4 instead. + void *class_userdata; ///< Per-class user data, later accessible in instance bindings. +} GDExtensionClassCreationInfo3; ///< Deprecated. Use GDExtensionClassCreationInfo4 instead. typedef struct { GDExtensionBool is_virtual; @@ -384,28 +404,30 @@ typedef struct { GDExtensionClassToString to_string_func; GDExtensionClassReference reference_func; GDExtensionClassUnreference unreference_func; - GDExtensionClassCreateInstance2 create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. - GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory. + GDExtensionClassCreateInstance2 create_instance_func; ///< (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. + GDExtensionClassFreeInstance free_instance_func; ///< Destructor; mandatory. GDExtensionClassRecreateInstance recreate_instance_func; - // Queries a virtual function by name and returns a callback to invoke the requested virtual function. + /// Queries a virtual function by name and returns a callback to invoke the requested virtual function. GDExtensionClassGetVirtual2 get_virtual_func; - // Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that - // need or benefit from extra data when calling virtual functions. - // Returns user data that will be passed to `call_virtual_with_data_func`. - // Returning `NULL` from this function signals to Godot that the virtual function is not overridden. - // Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized. - // You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`. + /** + * Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that + * need or benefit from extra data when calling virtual functions. + * Returns user data that will be passed to `call_virtual_with_data_func`. + * Returning `NULL` from this function signals to Godot that the virtual function is not overridden. + * Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized. + * You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`. + */ GDExtensionClassGetVirtualCallData2 get_virtual_call_data_func; - // Used to call virtual functions when `get_virtual_call_data_func` is not null. + /// Used to call virtual functions when `get_virtual_call_data_func` is not null. GDExtensionClassCallVirtualWithData call_virtual_with_data_func; - void *class_userdata; // Per-class user data, later accessible in instance bindings. + void *class_userdata; ///< Per-class user data, later accessible in instance bindings. } GDExtensionClassCreationInfo4; typedef GDExtensionClassCreationInfo4 GDExtensionClassCreationInfo5; typedef void *GDExtensionClassLibraryPtr; -/* Passed a pointer to a PackedStringArray that should be filled with the classes that may be used by the GDExtension. */ +/** Passed a pointer to a PackedStringArray that should be filled with the classes that may be used by the GDExtension. */ typedef void (*GDExtensionEditorGetClassesUsedCallback)(GDExtensionTypePtr p_packed_string_array); /* Method */ @@ -445,9 +467,10 @@ typedef struct { void *method_userdata; GDExtensionClassMethodCall call_func; GDExtensionClassMethodPtrCall ptrcall_func; - uint32_t method_flags; // Bitfield of `GDExtensionClassMethodFlags`. + uint32_t method_flags; ///< Bitfield of `GDExtensionClassMethodFlags`. - /* If `has_return_value` is false, `return_value_info` and `return_value_metadata` are ignored. + /** + * If `has_return_value` is false, `return_value_info` and `return_value_metadata` are ignored. * * @todo Consider dropping `has_return_value` and making the other two properties match `GDExtensionMethodInfo` and `GDExtensionClassVirtualMethod` for consistency in future version of this struct. */ @@ -455,7 +478,8 @@ typedef struct { GDExtensionPropertyInfo *return_value_info; GDExtensionClassMethodArgumentMetadata return_value_metadata; - /* Arguments: `arguments_info` and `arguments_metadata` are array of size `argument_count`. + /** + * Arguments: `arguments_info` and `arguments_metadata` are array of size `argument_count`. * Name and hint information for the argument can be omitted in release builds. Class name should always be present if it applies. * * @todo Consider renaming `arguments_info` to `arguments` for consistency in future version of this struct. @@ -464,14 +488,19 @@ typedef struct { GDExtensionPropertyInfo *arguments_info; GDExtensionClassMethodArgumentMetadata *arguments_metadata; - /* Default arguments: `default_arguments` is an array of size `default_argument_count`. */ + /** + * @name Default arguments + * @details `default_arguments` is an array of size `default_argument_count`. + * @{ + */ uint32_t default_argument_count; GDExtensionVariantPtr *default_arguments; + /// @} } GDExtensionClassMethodInfo; typedef struct { GDExtensionStringNamePtr name; - uint32_t method_flags; // Bitfield of `GDExtensionClassMethodFlags`. + uint32_t method_flags; ///< Bitfield of `GDExtensionClassMethodFlags`. GDExtensionPropertyInfo return_value; GDExtensionClassMethodArgumentMetadata return_value_metadata; @@ -493,21 +522,22 @@ typedef void (*GDExtensionCallableCustomToString)(void *callable_userdata, GDExt typedef GDExtensionInt (*GDExtensionCallableCustomGetArgumentCount)(void *callable_userdata, GDExtensionBool *r_is_valid); +/** + * Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method. + * + * `token` should point to an address that uniquely identifies the GDExtension (for example, the + * `GDExtensionClassLibraryPtr` passed to the entry symbol function. + * + * `hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and + * `callable_userdata` together are used as the identity of the callable for hashing and comparison purposes. + * + * The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable. + * + * `is_valid_func` is necessary if the validity of the callable can change before destruction. + * + * `free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed. + */ typedef struct { - /* Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method. - * - * `token` should point to an address that uniquely identifies the GDExtension (for example, the - * `GDExtensionClassLibraryPtr` passed to the entry symbol function. - * - * `hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and - * `callable_userdata` together are used as the identity of the callable for hashing and comparison purposes. - * - * The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable. - * - * `is_valid_func` is necessary if the validity of the callable can change before destruction. - * - * `free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed. - */ void *callable_userdata; void *token; @@ -522,23 +552,24 @@ typedef struct { GDExtensionCallableCustomLessThan less_than_func; GDExtensionCallableCustomToString to_string_func; -} GDExtensionCallableCustomInfo; // Deprecated. Use GDExtensionCallableCustomInfo2 instead. +} GDExtensionCallableCustomInfo; ///< Deprecated. Use GDExtensionCallableCustomInfo2 instead. +/** + * Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method. + * + * `token` should point to an address that uniquely identifies the GDExtension (for example, the + * `GDExtensionClassLibraryPtr` passed to the entry symbol function. + * + * `hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and + * `callable_userdata` together are used as the identity of the callable for hashing and comparison purposes. + * + * The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable. + * + * `is_valid_func` is necessary if the validity of the callable can change before destruction. + * + * `free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed. + */ typedef struct { - /* Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method. - * - * `token` should point to an address that uniquely identifies the GDExtension (for example, the - * `GDExtensionClassLibraryPtr` passed to the entry symbol function. - * - * `hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and - * `callable_userdata` together are used as the identity of the callable for hashing and comparison purposes. - * - * The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable. - * - * `is_valid_func` is necessary if the validity of the callable can change before destruction. - * - * `free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed. - */ void *callable_userdata; void *token; @@ -559,12 +590,12 @@ typedef struct { /* SCRIPT INSTANCE EXTENSION */ -typedef void *GDExtensionScriptInstanceDataPtr; // Pointer to custom ScriptInstance native implementation. +typedef void *GDExtensionScriptInstanceDataPtr; ///< Pointer to custom ScriptInstance native implementation. typedef GDExtensionBool (*GDExtensionScriptInstanceSet)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value); typedef GDExtensionBool (*GDExtensionScriptInstanceGet)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret); typedef const GDExtensionPropertyInfo *(*GDExtensionScriptInstanceGetPropertyList)(GDExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count); -typedef void (*GDExtensionScriptInstanceFreePropertyList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionPropertyInfo *p_list); // Deprecated. Use GDExtensionScriptInstanceFreePropertyList2 instead. +typedef void (*GDExtensionScriptInstanceFreePropertyList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionPropertyInfo *p_list); ///< Deprecated. Use GDExtensionScriptInstanceFreePropertyList2 instead. typedef void (*GDExtensionScriptInstanceFreePropertyList2)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionPropertyInfo *p_list, uint32_t p_count); typedef GDExtensionBool (*GDExtensionScriptInstanceGetClassCategory)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionPropertyInfo *p_class_category); @@ -579,7 +610,7 @@ typedef void (*GDExtensionScriptInstancePropertyStateAdd)(GDExtensionConstString typedef void (*GDExtensionScriptInstanceGetPropertyState)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionScriptInstancePropertyStateAdd p_add_func, void *p_userdata); typedef const GDExtensionMethodInfo *(*GDExtensionScriptInstanceGetMethodList)(GDExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count); -typedef void (*GDExtensionScriptInstanceFreeMethodList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionMethodInfo *p_list); // Deprecated. Use GDExtensionScriptInstanceFreeMethodList2 instead. +typedef void (*GDExtensionScriptInstanceFreeMethodList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionMethodInfo *p_list); ///< Deprecated. Use GDExtensionScriptInstanceFreeMethodList2 instead. typedef void (*GDExtensionScriptInstanceFreeMethodList2)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionMethodInfo *p_list, uint32_t p_count); typedef GDExtensionBool (*GDExtensionScriptInstanceHasMethod)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name); @@ -587,7 +618,7 @@ typedef GDExtensionBool (*GDExtensionScriptInstanceHasMethod)(GDExtensionScriptI typedef GDExtensionInt (*GDExtensionScriptInstanceGetMethodArgumentCount)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionBool *r_is_valid); typedef void (*GDExtensionScriptInstanceCall)(GDExtensionScriptInstanceDataPtr p_self, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error); -typedef void (*GDExtensionScriptInstanceNotification)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what); // Deprecated. Use GDExtensionScriptInstanceNotification2 instead. +typedef void (*GDExtensionScriptInstanceNotification)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what); ///< Deprecated. Use GDExtensionScriptInstanceNotification2 instead. typedef void (*GDExtensionScriptInstanceNotification2)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what, GDExtensionBool p_reversed); typedef void (*GDExtensionScriptInstanceToString)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out); @@ -603,7 +634,7 @@ typedef GDExtensionScriptLanguagePtr (*GDExtensionScriptInstanceGetLanguage)(GDE typedef void (*GDExtensionScriptInstanceFree)(GDExtensionScriptInstanceDataPtr p_instance); -typedef void *GDExtensionScriptInstancePtr; // Pointer to ScriptInstance. +typedef void *GDExtensionScriptInstancePtr; ///< Pointer to ScriptInstance. typedef struct { GDExtensionScriptInstanceSet set_func; @@ -642,14 +673,14 @@ typedef struct { GDExtensionScriptInstanceFree free_func; -} GDExtensionScriptInstanceInfo; // Deprecated. Use GDExtensionScriptInstanceInfo3 instead. +} GDExtensionScriptInstanceInfo; ///< Deprecated. Use GDExtensionScriptInstanceInfo3 instead. typedef struct { GDExtensionScriptInstanceSet set_func; GDExtensionScriptInstanceGet get_func; GDExtensionScriptInstanceGetPropertyList get_property_list_func; GDExtensionScriptInstanceFreePropertyList free_property_list_func; - GDExtensionScriptInstanceGetClassCategory get_class_category_func; // Optional. Set to NULL for the default behavior. + GDExtensionScriptInstanceGetClassCategory get_class_category_func; ///< Optional. Set to NULL for the default behavior. GDExtensionScriptInstancePropertyCanRevert property_can_revert_func; GDExtensionScriptInstancePropertyGetRevert property_get_revert_func; @@ -683,14 +714,14 @@ typedef struct { GDExtensionScriptInstanceFree free_func; -} GDExtensionScriptInstanceInfo2; // Deprecated. Use GDExtensionScriptInstanceInfo3 instead. +} GDExtensionScriptInstanceInfo2; ///< Deprecated. Use GDExtensionScriptInstanceInfo3 instead. typedef struct { GDExtensionScriptInstanceSet set_func; GDExtensionScriptInstanceGet get_func; GDExtensionScriptInstanceGetPropertyList get_property_list_func; GDExtensionScriptInstanceFreePropertyList2 free_property_list_func; - GDExtensionScriptInstanceGetClassCategory get_class_category_func; // Optional. Set to NULL for the default behavior. + GDExtensionScriptInstanceGetClassCategory get_class_category_func; ///< Optional. Set to NULL for the default behavior. GDExtensionScriptInstancePropertyCanRevert property_can_revert_func; GDExtensionScriptInstancePropertyGetRevert property_get_revert_func; @@ -745,12 +776,14 @@ typedef void (*GDExtensionInitializeCallback)(void *p_userdata, GDExtensionIniti typedef void (*GDExtensionDeinitializeCallback)(void *p_userdata, GDExtensionInitializationLevel p_level); typedef struct { - /* Minimum initialization level required. - * If Core or Servers, the extension needs editor or game restart to take effect */ + /** + * Minimum initialization level required. + * If Core or Servers, the extension needs editor or game restart to take effect + */ GDExtensionInitializationLevel minimum_initialization_level; - /* Up to the user to supply when initializing */ + /** Up to the user to supply when initializing */ void *userdata; - /* This function will be called multiple times for each initialization level. */ + /** This function will be called multiple times for each initialization level. */ GDExtensionInitializeCallback initialize; GDExtensionDeinitializeCallback deinitialize; } GDExtensionInitialization; @@ -758,7 +791,7 @@ typedef struct { typedef void (*GDExtensionInterfaceFunctionPtr)(); typedef GDExtensionInterfaceFunctionPtr (*GDExtensionInterfaceGetProcAddress)(const char *p_function_name); -/* +/** * Each GDExtension should define a C function that matches the signature of GDExtensionInitializationFunction, * and export it so that it can be loaded via dlopen() or equivalent for the given platform. * @@ -807,43 +840,43 @@ typedef struct { uint32_t major; uint32_t minor; uint32_t patch; - uint32_t hex; // Full version encoded as hexadecimal with one byte (2 hex digits) per number (e.g. for "3.1.12" it would be 0x03010C) - const char *status; // (e.g. "stable", "beta", "rc1", "rc2") - const char *build; // (e.g. "custom_build") - const char *hash; // Full Git commit hash. - uint64_t timestamp; // Git commit date UNIX timestamp in seconds, or 0 if unavailable. - const char *string; // (e.g. "Godot v3.1.4.stable.official.mono") + uint32_t hex; ///< Full version encoded as hexadecimal with one byte (2 hex digits) per number (e.g. for "3.1.12" it would be 0x03010C) + const char *status; ///< (e.g. "stable", "beta", "rc1", "rc2") + const char *build; ///< (e.g. "custom_build") + const char *hash; ///< Full Git commit hash. + uint64_t timestamp; ///< Git commit date UNIX timestamp in seconds, or 0 if unavailable. + const char *string; ///< (e.g. "Godot v3.1.4.stable.official.mono") } GDExtensionGodotVersion2; typedef struct { uint32_t major; uint32_t minor; uint32_t patch; - uint32_t hex; // Full version encoded as hexadecimal with one byte (2 hex digits) per number (e.g. for "3.1.12" it would be 0x03010C) - const char *status; // (e.g. "stable", "beta", "rc") + uint32_t hex; ///< Full version encoded as hexadecimal with one byte (2 hex digits) per number (e.g. for "3.1.12" it would be 0x03010C) + const char *status; ///< (e.g. "stable", "beta", "rc") uint32_t status_version; - const char *build; // (e.g. "custom_build") - const char *hash; // Full Git commit hash. - uint64_t timestamp; // Git commit date UNIX timestamp in seconds, or 0 if unavailable. - const char *string; // (e.g. "Redot v3.1.4.stable.official.mono") + const char *build; ///< (e.g. "custom_build") + const char *hash; ///< Full Git commit hash. + uint64_t timestamp; ///< Git commit date UNIX timestamp in seconds, or 0 if unavailable. + const char *string; ///< (e.g. "Redot v3.1.4.stable.official.mono") } GDExtensionRedotVersion; -/* Called when starting the main loop. */ +/** Called when starting the main loop. */ typedef void (*GDExtensionMainLoopStartupCallback)(); -/* Called when shutting down the main loop. */ +/** Called when shutting down the main loop. */ typedef void (*GDExtensionMainLoopShutdownCallback)(); -/* Called for every frame iteration of the main loop. */ +/** Called for every frame iteration of the main loop. */ typedef void (*GDExtensionMainLoopFrameCallback)(); typedef struct { - // Will be called after Godot is started and is fully initialized. + /// Will be called after Godot is started and is fully initialized. GDExtensionMainLoopStartupCallback startup_func; - // Will be called before Godot is shutdown when it is still fully initialized. + /// Will be called before Godot is shutdown when it is still fully initialized. GDExtensionMainLoopShutdownCallback shutdown_func; - // Will be called for each process frame. This will run after all `_process()` methods on Node, and before `ScriptServer::frame()`. - // This is intended to be the equivalent of `ScriptLanguage::frame()` for GDExtension language bindings that don't use the script API. + /// Will be called for each process frame. This will run after all `_process()` methods on Node, and before `ScriptServer::frame()`. + /// This is intended to be the equivalent of `ScriptLanguage::frame()` for GDExtension language bindings that don't use the script API. GDExtensionMainLoopFrameCallback frame_func; } GDExtensionMainLoopCallbacks; diff --git a/core/extension/gdextension_library_loader.cpp b/core/extension/gdextension_library_loader.cpp index 990794fd887..ab2bb681e57 100644 --- a/core/extension/gdextension_library_loader.cpp +++ b/core/extension/gdextension_library_loader.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension_library_loader.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "gdextension_library_loader.h" #include "core/config/project_settings.h" diff --git a/core/extension/gdextension_library_loader.h b/core/extension/gdextension_library_loader.h index 1874789ff34..93753c8e20c 100644 --- a/core/extension/gdextension_library_loader.h +++ b/core/extension/gdextension_library_loader.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension_library_loader.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include @@ -47,7 +53,7 @@ class GDExtensionLibraryLoader : public GDExtensionLoader { private: String resource_path; - void *library = nullptr; // pointer if valid. + void *library = nullptr; ///< pointer if valid. String library_path; String entry_symbol; diff --git a/core/extension/gdextension_loader.h b/core/extension/gdextension_loader.h index 72eb8a62bdd..9312b9699a2 100644 --- a/core/extension/gdextension_loader.h +++ b/core/extension/gdextension_loader.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension_loader.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/ref_counted.h" diff --git a/core/extension/gdextension_manager.cpp b/core/extension/gdextension_manager.cpp index 6a62696cc3f..d4e36034964 100644 --- a/core/extension/gdextension_manager.cpp +++ b/core/extension/gdextension_manager.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension_manager.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "gdextension_manager.h" #include "core/extension/gdextension_library_loader.h" @@ -238,12 +244,12 @@ Ref GDExtensionManager::get_extension(const String &p_path) { } bool GDExtensionManager::class_has_icon_path(const String &p_class) const { - // TODO: Check that the icon belongs to a registered class somehow. + /// @todo Check that the icon belongs to a registered class somehow. return gdextension_class_icon_paths.has(p_class); } String GDExtensionManager::class_get_icon_path(const String &p_class) const { - // TODO: Check that the icon belongs to a registered class somehow. + /// @todo Check that the icon belongs to a registered class somehow. if (gdextension_class_icon_paths.has(p_class)) { return gdextension_class_icon_paths[p_class]; } diff --git a/core/extension/gdextension_manager.h b/core/extension/gdextension_manager.h index c7082cd399a..375e969b083 100644 --- a/core/extension/gdextension_manager.h +++ b/core/extension/gdextension_manager.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension_manager.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/extension/gdextension.h" diff --git a/core/extension/gdextension_special_compat_hashes.cpp b/core/extension/gdextension_special_compat_hashes.cpp index 04d43fe6002..ba3534116cb 100644 --- a/core/extension/gdextension_special_compat_hashes.cpp +++ b/core/extension/gdextension_special_compat_hashes.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension_special_compat_hashes.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "gdextension_special_compat_hashes.h" #ifndef DISABLE_DEPRECATED diff --git a/core/extension/gdextension_special_compat_hashes.h b/core/extension/gdextension_special_compat_hashes.h index 01b27b54d49..2d323a35595 100644 --- a/core/extension/gdextension_special_compat_hashes.h +++ b/core/extension/gdextension_special_compat_hashes.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file gdextension_special_compat_hashes.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #ifndef DISABLE_DEPRECATED @@ -38,10 +44,9 @@ #include "core/templates/hash_map.h" #include "core/templates/local_vector.h" -// Note: In most situations, compatibility methods should be registered via ClassDB::bind_compatibility_method(). -// This class is only meant to be used in exceptional circumstances, for example, when Godot's hashing -// algorithm changes and registering compatibility methods for all affect methods would be onerous. - +/// @note In most situations, compatibility methods should be registered via ClassDB::bind_compatibility_method(). +/// This class is only meant to be used in exceptional circumstances, for example, when Godot's hashing +/// algorithm changes and registering compatibility methods for all affect methods would be onerous. class GDExtensionSpecialCompatHashes { struct Mapping { StringName method; diff --git a/core/input/default_controller_mappings.h b/core/input/default_controller_mappings.h index b4e510d687e..6816180713f 100644 --- a/core/input/default_controller_mappings.h +++ b/core/input/default_controller_mappings.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file default_controller_mappings.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once class DefaultControllerMappings { diff --git a/core/input/input.cpp b/core/input/input.cpp index 0c87ec5b27f..e239bad06ca 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file input.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "input.h" #include "input.compat.inc" @@ -740,8 +746,6 @@ Vector3 Input::get_gyroscope() const { } void Input::_parse_input_event_impl(const Ref &p_event, bool p_is_emulated) { - // This function does the final delivery of the input event to user land. - // Regardless where the event came from originally, this has to happen on the main thread. DEV_ASSERT(Thread::get_caller_id() == Thread::get_main_id()); // Notes on mouse-touch emulation: @@ -1073,15 +1077,6 @@ void Input::warp_mouse(const Vector2 &p_position) { } Point2 Input::warp_mouse_motion(const Ref &p_motion, const Rect2 &p_rect) { - // The relative distance reported for the next event after a warp is in the boundaries of the - // size of the rect on that axis, but it may be greater, in which case there's no problem as fmod() - // will warp it, but if the pointer has moved in the opposite direction between the pointer relocation - // and the subsequent event, the reported relative distance will be less than the size of the rect - // and thus fmod() will be disabled for handling the situation. - // And due to this mouse warping mechanism being stateless, we need to apply some heuristics to - // detect the warp: if the relative distance is greater than the half of the size of the relevant rect - // (checked per each axis), it will be considered as the consequence of a former pointer warp. - const Point2 rel_sign(p_motion->get_relative().x >= 0.0f ? 1 : -1, p_motion->get_relative().y >= 0.0 ? 1 : -1); const Size2 warp_margin = p_rect.size * 0.5f; const Point2 rel_warped( @@ -1141,8 +1136,6 @@ bool Input::is_emulating_touch_from_mouse() const { return emulate_touch_from_mouse; } -// Calling this whenever the game window is focused helps unsticking the "touch mouse" -// if the OS or its abstraction class hasn't properly reported that touch pointers raised void Input::ensure_touch_mouse_raised() { _THREAD_SAFE_METHOD_ if (mouse_from_touch_index != -1) { @@ -1777,9 +1770,6 @@ void Input::add_joy_mapping(const String &p_mapping, bool p_update_existing) { } void Input::remove_joy_mapping(const String &p_guid) { - // One GUID can exist multiple times in `map_db`, and - // `add_joy_mapping` can choose not to update the existing mapping, - // so the indices can be all over the place. Therefore we need to remember them. Vector removed_idx; int min_removed_idx = -1; int max_removed_idx = -1; @@ -1867,7 +1857,6 @@ void Input::set_fallback_mapping(const String &p_guid) { } } -//platforms that use the remapping system can override and call to these ones bool Input::is_joy_known(int p_device) { return joy_names.has(p_device) && joy_names[p_device].is_known; } diff --git a/core/input/input.h b/core/input/input.h index f6dc23feb46..6f787d6f3bb 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file input.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/input/input_event.h" @@ -48,7 +54,7 @@ class Input : public Object { static constexpr uint64_t MAX_EVENT = 32; public: - // Keep synced with "DisplayServer::MouseMode" enum. + /// Keep synced with `DisplayServer::MouseMode` enum. enum MouseMode { MOUSE_MODE_VISIBLE, MOUSE_MODE_HIDDEN, @@ -124,7 +130,7 @@ class Input : public Object { float api_strength = 0.0; HashMap device_states; - // Cache. + /// Cache struct ActionStateCache { bool pressed = false; float strength = false; @@ -144,7 +150,7 @@ class Input : public Object { struct VibrationInfo { float weak_magnitude; float strong_magnitude; - float duration; // Duration in seconds + float duration; ///< Duration in seconds uint64_t timestamp; }; @@ -184,7 +190,7 @@ class Input : public Object { HashSet ignored_device_ids; - int fallback_mapping = -1; // Index of the guid in map_db. + int fallback_mapping = -1; ///< Index of the guid in map_db. CursorShape default_shape = CURSOR_ARROW; @@ -203,7 +209,7 @@ class Input : public Object { struct JoyEvent { int type = TYPE_MAX; - int index = -1; // Can be either JoyAxis or JoyButton. + int index = -1; ///< Can be either JoyAxis or JoyButton. float value = 0.f; }; @@ -256,6 +262,8 @@ class Input : public Object { void _axis_event(int p_device, JoyAxis p_axis, float p_value); void _update_action_cache(const StringName &p_action_name, ActionState &r_action_state); + /// This function does the final delivery of the input event to user land. + /// Regardless where the event came from originally, this has to happen on the main thread. void _parse_input_event_impl(const Ref &p_event, bool p_is_emulated); List> buffered_events; @@ -338,6 +346,17 @@ class Input : public Object { BitField get_mouse_button_mask() const; void warp_mouse(const Vector2 &p_position); + + /** + * The relative distance reported for the next event after a warp is in the boundaries of the + * size of the rect on that axis, but it may be greater, in which case there's no problem as fmod() + * will warp it, but if the pointer has moved in the opposite direction between the pointer relocation + * and the subsequent event, the reported relative distance will be less than the size of the rect + * and thus fmod() will be disabled for handling the situation. + * And due to this mouse warping mechanism being stateless, we need to apply some heuristics to + * detect the warp: if the relative distance is greater than the half of the size of the relevant rect + * (checked per each axis), it will be considered as the consequence of a former pointer warp. + */ Point2 warp_mouse_motion(const Ref &p_motion, const Rect2 &p_rect); void parse_input_event(const Ref &p_event); @@ -359,6 +378,9 @@ class Input : public Object { void set_emulate_touch_from_mouse(bool p_emulate); bool is_emulating_touch_from_mouse() const; + + /// Calling this whenever the game window is focused helps unsticking the "touch mouse" + /// if the OS or its abstraction class hasn't properly reported that touch pointers raised void ensure_touch_mouse_raised(); void set_emulate_mouse_from_touch(bool p_emulate); @@ -375,10 +397,15 @@ class Input : public Object { void joy_hat(int p_device, BitField p_val); void add_joy_mapping(const String &p_mapping, bool p_update_existing = false); + + /// One GUID can exist multiple times in `map_db`, and + /// `add_joy_mapping` can choose not to update the existing mapping, + /// so the indices can be all over the place. Therefore we need to remember them. void remove_joy_mapping(const String &p_guid); int get_unused_joy_id(); + /// Platforms that use the remapping system can override and call to these ones bool is_joy_known(int p_device); String get_joy_guid(int p_device) const; bool should_ignore_device(int p_vendor_id, int p_product_id) const; diff --git a/core/input/input_enums.h b/core/input/input_enums.h index fb679467494..b8e34dfbac4 100644 --- a/core/input/input_enums.h +++ b/core/input/input_enums.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file input_enums.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/error/error_macros.h" @@ -76,7 +82,7 @@ enum class JoyAxis { TRIGGER_LEFT = 4, TRIGGER_RIGHT = 5, SDL_MAX = 6, - MAX = 10, // OpenVR supports up to 5 Joysticks making a total of 10 axes. + MAX = 10, ///< OpenVR supports up to 5 Joysticks making a total of 10 axes. }; enum class JoyButton { @@ -103,7 +109,7 @@ enum class JoyButton { PADDLE4 = 19, TOUCHPAD = 20, SDL_MAX = 21, - MAX = 128, // Android supports up to 36 buttons. DirectInput supports up to 128 buttons. + MAX = 128, ///< Android supports up to 36 buttons. DirectInput supports up to 128 buttons. }; enum class MIDIMessage { @@ -137,8 +143,8 @@ enum class MouseButton { WHEEL_DOWN = 5, WHEEL_LEFT = 6, WHEEL_RIGHT = 7, - MB_XBUTTON1 = 8, // "XBUTTON1" is a reserved word on Windows. - MB_XBUTTON2 = 9, // "XBUTTON2" is a reserved word on Windows. + MB_XBUTTON1 = 8, ///< "XBUTTON1" is a reserved word on Windows. + MB_XBUTTON2 = 9, ///< "XBUTTON2" is a reserved word on Windows. }; enum class MouseButtonMask { diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index 3cb9920bd9e..0c007cf133f 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file input_event.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "input_event.h" #include "core/input/input_map.h" diff --git a/core/input/input_event.h b/core/input/input_event.h index 1fcef8c7aea..6a80024d746 100644 --- a/core/input/input_event.h +++ b/core/input/input_event.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file input_event.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/input/input_enums.h" @@ -118,7 +124,7 @@ class InputEventWithModifiers : public InputEventFromWindow { bool shift_pressed = false; bool alt_pressed = false; - bool meta_pressed = false; // "Command" on macOS, "Meta/Win" key on other platforms. + bool meta_pressed = false; ///< "Command" on macOS, "Meta/Win" key on other platforms. bool ctrl_pressed = false; protected: @@ -156,13 +162,13 @@ class InputEventWithModifiers : public InputEventFromWindow { class InputEventKey : public InputEventWithModifiers { GDCLASS(InputEventKey, InputEventWithModifiers); - Key keycode = Key::NONE; // Key enum, without modifier masks. + Key keycode = Key::NONE; ///< Key enum, without modifier masks. Key physical_keycode = Key::NONE; Key key_label = Key::NONE; - uint32_t unicode = 0; ///unicode + uint32_t unicode = 0; ///< Unicode KeyLocation location = KeyLocation::UNSPECIFIED; - bool echo = false; /// true if this is an echo key + bool echo = false; ///< true if this is an echo key protected: static void _bind_methods(); @@ -240,7 +246,7 @@ class InputEventMouseButton : public InputEventMouse { float factor = 1; MouseButton button_index = MouseButton::NONE; - bool double_click = false; //last even less than double click time + bool double_click = false; ///< Last even less than double click time protected: static void _bind_methods(); @@ -352,7 +358,7 @@ class InputEventJoypadButton : public InputEvent { GDCLASS(InputEventJoypadButton, InputEvent); JoyButton button_index = (JoyButton)0; - float pressure = 0; //0 to 1 + float pressure = 0; ///< 0 to 1 protected: static void _bind_methods(); diff --git a/core/input/input_event_codec.cpp b/core/input/input_event_codec.cpp index 170f1a85eaa..2299ae824e8 100644 --- a/core/input/input_event_codec.cpp +++ b/core/input/input_event_codec.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file input_event_codec.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "input_event_codec.h" #include "core/input/input.h" @@ -47,7 +53,7 @@ enum class BoolShift : uint8_t { PEN_INVERTED, }; -// cast operator for BoolShift to uint8_t +/// cast operator for BoolShift to uint8_t inline uint8_t operator<<(uint8_t a, BoolShift b) { return a << static_cast(b); } diff --git a/core/input/input_event_codec.h b/core/input/input_event_codec.h index 79f7a5b510f..b64dec7f871 100644 --- a/core/input/input_event_codec.h +++ b/core/input/input_event_codec.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file input_event_codec.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/input/input_event.h" @@ -37,7 +43,7 @@ /** * Encodes the input event as a byte array. * - * Returns `true` if the event was successfully encoded, `false` otherwise. + * @returns `true` if the event was successfully encoded, `false` otherwise. */ bool encode_input_event(const Ref &p_event, PackedByteArray &r_data); void decode_input_event(const PackedByteArray &p_data, Ref &r_event); diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp index 39d56e6df37..5e62dd1042b 100644 --- a/core/input/input_map.cpp +++ b/core/input/input_map.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file input_map.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "input_map.h" #include "input_map.compat.inc" diff --git a/core/input/input_map.h b/core/input/input_map.h index a249b50da72..cd5dfb5abb2 100644 --- a/core/input/input_map.h +++ b/core/input/input_map.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file input_map.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/input/input_event.h" @@ -55,7 +61,7 @@ class InputMap : public Object { }; static constexpr float DEFAULT_DEADZONE = 0.2f; - // Keep bigger deadzone for toggle actions (default `ui_*` actions, axis `pressed`) (GH-103360). + /// Keep bigger deadzone for toggle actions (default `ui_*` actions, axis `pressed`) (GH-103360). static constexpr float DEFAULT_TOGGLE_DEADZONE = 0.5f; private: @@ -110,7 +116,7 @@ class InputMap : public Object { #endif String get_builtin_display_name(const String &p_name) const; - // Use an Ordered Map so insertion order is preserved. We want the elements to be 'grouped' somewhat. + /// Use an Ordered Map so insertion order is preserved. We want the elements to be 'grouped' somewhat. const HashMap>> &get_builtins(); const HashMap>> &get_builtins_with_feature_overrides_applied(); diff --git a/core/input/shortcut.cpp b/core/input/shortcut.cpp index 175c7271ccb..9b165d42e56 100644 --- a/core/input/shortcut.cpp +++ b/core/input/shortcut.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file shortcut.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "shortcut.h" void Shortcut::set_events(const Array &p_events) { diff --git a/core/input/shortcut.h b/core/input/shortcut.h index 7024fd5b57c..8b01a35ca79 100644 --- a/core/input/shortcut.h +++ b/core/input/shortcut.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file shortcut.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/input/input_event.h" diff --git a/core/io/compression.cpp b/core/io/compression.cpp index 39360f92b3b..54dfaf942cd 100644 --- a/core/io/compression.cpp +++ b/core/io/compression.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file compression.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "compression.h" #include "core/config/project_settings.h" @@ -223,11 +229,6 @@ int64_t Compression::decompress(uint8_t *p_dst, int64_t p_dst_max_size, const ui ERR_FAIL_V(-1); } -/** - This will handle both Gzip and Deflate streams. It will automatically allocate the output buffer into the provided p_dst_vect Vector. - This is required for compressed data whose final uncompressed size is unknown, as is the case for HTTP response bodies. - This is much slower however than using Compression::decompress because it may result in multiple full copies of the output buffer. -*/ int Compression::decompress_dynamic(Vector *p_dst_vect, int64_t p_max_dst_size, const uint8_t *p_src, int64_t p_src_size, Mode p_mode) { uint8_t *dst = nullptr; int out_mark = 0; diff --git a/core/io/compression.h b/core/io/compression.h index 9b310be5a77..3dfb20063fc 100644 --- a/core/io/compression.h +++ b/core/io/compression.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file compression.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/templates/vector.h" @@ -43,7 +49,7 @@ class Compression { static inline int gzip_level = Z_DEFAULT_COMPRESSION; static inline int zstd_level = 3; static inline bool zstd_long_distance_matching = false; - static inline int zstd_window_log_size = 27; // ZSTD_WINDOWLOG_LIMIT_DEFAULT + static inline int zstd_window_log_size = 27; ///< ZSTD_WINDOWLOG_LIMIT_DEFAULT static inline int gzip_chunk = 16384; enum Mode : int32_t { @@ -57,5 +63,10 @@ class Compression { static int64_t compress(uint8_t *p_dst, const uint8_t *p_src, int64_t p_src_size, Mode p_mode = MODE_ZSTD); static int64_t get_max_compressed_buffer_size(int64_t p_src_size, Mode p_mode = MODE_ZSTD); static int64_t decompress(uint8_t *p_dst, int64_t p_dst_max_size, const uint8_t *p_src, int64_t p_src_size, Mode p_mode = MODE_ZSTD); + /** + * This will handle both Gzip and Deflate streams. It will automatically allocate the output buffer into the provided p_dst_vect Vector. + * This is required for compressed data whose final uncompressed size is unknown, as is the case for HTTP response bodies. + * This is much slower however than using Compression::decompress because it may result in multiple full copies of the output buffer. + */ static int decompress_dynamic(Vector *p_dst_vect, int64_t p_max_dst_size, const uint8_t *p_src, int64_t p_src_size, Mode p_mode); }; diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 48f17043631..a6f51c6bf47 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file config_file.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "config_file.h" #include "config_file.compat.inc" diff --git a/core/io/config_file.h b/core/io/config_file.h index 9c542ace257..5c9d7a7c835 100644 --- a/core/io/config_file.h +++ b/core/io/config_file.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file config_file.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/file_access.h" diff --git a/core/io/dir_access.cpp b/core/io/dir_access.cpp index bbd8be65439..1f76e02608c 100644 --- a/core/io/dir_access.cpp +++ b/core/io/dir_access.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file dir_access.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "dir_access.h" #include "core/config/project_settings.h" @@ -465,8 +471,8 @@ Error DirAccess::copy(const String &p_from, const String &p_to, int p_chmod_flag return err; } -// Changes dir for the current scope, returning back to the original dir -// when scope exits +/// Changes dir for the current scope, returning back to the original dir +/// when scope exits class DirChanger { DirAccess *da; String original_dir; diff --git a/core/io/dir_access.h b/core/io/dir_access.h index 700fc1e9a8e..ac200612238 100644 --- a/core/io/dir_access.h +++ b/core/io/dir_access.h @@ -30,13 +30,19 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file dir_access.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/ref_counted.h" #include "core/string/ustring.h" #include "core/typedefs.h" -//@ TODO, excellent candidate for THREAD_SAFE MACRO, should go through all these and add THREAD_SAFE where it applies +/// @todo Excellent candidate for THREAD_SAFE MACRO, should go through all these and add THREAD_SAFE where it applies class DirAccess : public RefCounted { GDCLASS(DirAccess, RefCounted); @@ -100,7 +106,7 @@ class DirAccess : public RefCounted { virtual String get_current_dir(bool p_include_drive = true) const = 0; ///< return current dir location virtual Error make_dir(String p_dir) = 0; virtual Error make_dir_recursive(const String &p_dir); - virtual Error erase_contents_recursive(); //super dangerous, use with care! + virtual Error erase_contents_recursive(); ///< @warning Super dangerous, use with care! virtual bool file_exists(String p_file) = 0; virtual bool dir_exists(String p_dir) = 0; @@ -118,8 +124,8 @@ class DirAccess : public RefCounted { virtual String read_link(String p_file) = 0; virtual Error create_link(String p_source, String p_target) = 0; - // Meant for editor code when we want to quickly remove a file without custom - // handling (e.g. removing a cache file). + /// Meant for editor code when we want to quickly remove a file without custom + /// handling (e.g. removing a cache file). static void remove_file_or_error(const String &p_path) { Ref da = create(ACCESS_FILESYSTEM); if (da->file_exists(p_path)) { diff --git a/core/io/dtls_server.cpp b/core/io/dtls_server.cpp index 98b34a153cf..111a6a1f7e3 100644 --- a/core/io/dtls_server.cpp +++ b/core/io/dtls_server.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file dtls_server.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "dtls_server.h" DTLSServer *DTLSServer::create(bool p_notify_postinitialize) { diff --git a/core/io/dtls_server.h b/core/io/dtls_server.h index 06e738e5ba4..c3377e74420 100644 --- a/core/io/dtls_server.h +++ b/core/io/dtls_server.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file dtls_server.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/net_socket.h" diff --git a/core/io/file_access.cpp b/core/io/file_access.cpp index cf8e120e097..9ca53f862e8 100644 --- a/core/io/file_access.cpp +++ b/core/io/file_access.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "file_access.h" #include "file_access.compat.inc" @@ -252,8 +258,6 @@ FileAccess::AccessType FileAccess::get_access_type() const { } String FileAccess::fix_path(const String &p_path) const { - // Helper used by file accesses that use a single filesystem. - String r_path = p_path.replace_char('\\', '/'); switch (_access_type) { @@ -301,7 +305,6 @@ String FileAccess::fix_path(const String &p_path) const { return r_path; } -/* these are all implemented for ease of porting, then can later be optimized */ uint8_t FileAccess::get_8() const { uint8_t data = 0; get_buffer(&data, sizeof(uint8_t)); diff --git a/core/io/file_access.h b/core/io/file_access.h index 64f6c6589d5..4d7775ac17d 100644 --- a/core/io/file_access.h +++ b/core/io/file_access.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/compression.h" @@ -108,7 +114,7 @@ class FileAccess : public RefCounted { static void _bind_methods(); AccessType get_access_type() const; - virtual String fix_path(const String &p_path) const; + virtual String fix_path(const String &p_path) const; ///< Helper used by file accesses that use a single filesystem. virtual Error open_internal(const String &p_path, int p_mode_flags) = 0; ///< open a file virtual uint64_t _get_modified_time(const String &p_file) = 0; virtual uint64_t _get_access_time(const String &p_file) = 0; @@ -163,8 +169,8 @@ class FileAccess : public RefCounted { virtual bool is_open() const = 0; ///< true when file is open - virtual String get_path() const { return ""; } /// returns the path for the current open file - virtual String get_path_absolute() const { return ""; } /// returns the absolute path for the current open file + virtual String get_path() const { return ""; } ///< returns the path for the current open file + virtual String get_path_absolute() const { return ""; } ///< returns the absolute path for the current open file virtual void seek(uint64_t p_position) = 0; ///< seek to a given position virtual void seek_end(int64_t p_position = 0) = 0; ///< seek from the end of file with negative offset @@ -173,6 +179,8 @@ class FileAccess : public RefCounted { virtual bool eof_reached() const = 0; ///< reading passed EOF + /// @name These are all implemented for ease of porting, then can later be optimized + /// @{ virtual uint8_t get_8() const; ///< get a byte virtual uint16_t get_16() const; ///< get 16 bits uint virtual uint32_t get_32() const; ///< get 32 bits uint @@ -182,6 +190,7 @@ class FileAccess : public RefCounted { virtual float get_float() const; virtual double get_double() const; virtual real_t get_real() const; + /// @} Variant get_var(bool p_allow_objects = false) const; @@ -194,7 +203,6 @@ class FileAccess : public RefCounted { virtual String get_as_utf8_string(bool p_skip_cr = false) const; /** - * Use this for files WRITTEN in _big_ endian machines (ie, amiga/mac) * It's not about the current CPU type but file formats. * This flag gets reset to `false` (little endian) on each open. @@ -234,9 +242,9 @@ class FileAccess : public RefCounted { virtual Error reopen(const String &p_path, int p_mode_flags); ///< does not change the AccessType - static Ref create(AccessType p_access); /// Create a file access (for the current platform) this is the only portable way of accessing files. + static Ref create(AccessType p_access); ///< Create a file access (for the current platform) this is the only portable way of accessing files. static Ref create_for_path(const String &p_path); - static Ref open(const String &p_path, int p_mode_flags, Error *r_error = nullptr); /// Create a file access (for the current platform) this is the only portable way of accessing files. + static Ref open(const String &p_path, int p_mode_flags, Error *r_error = nullptr); ///< Create a file access (for the current platform) this is the only portable way of accessing files. static Ref create_temp(int p_mode_flags, const String &p_prefix = "", const String &p_extension = "", bool p_keep = false, Error *r_error = nullptr); static Ref open_encrypted(const String &p_path, ModeFlags p_mode_flags, const Vector &p_key, const Vector &p_iv = Vector()); @@ -245,7 +253,7 @@ class FileAccess : public RefCounted { static Error get_open_error(); static CreateFunc get_create_func(AccessType p_access); - static bool exists(const String &p_name); ///< return true if a file exists + static bool exists(const String &p_name); ///< @return true if a file exists static uint64_t get_modified_time(const String &p_file); static uint64_t get_access_time(const String &p_file); static int64_t get_size(const String &p_file); diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index cf3af2c78f4..a87a62d8707 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access_compressed.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "file_access_compressed.h" void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_mode, uint32_t p_block_size) { diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h index c73bbe8f246..702aca2df3e 100644 --- a/core/io/file_access_compressed.h +++ b/core/io/file_access_compressed.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access_compressed.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/compression.h" @@ -73,10 +79,10 @@ class FileAccessCompressed : public FileAccess { Error open_after_magic(Ref p_base); virtual Error open_internal(const String &p_path, int p_mode_flags) override; ///< open a file - virtual bool is_open() const override; ///< true when file is open + virtual bool is_open() const override; ///< @return `true` when file is open - virtual String get_path() const override; /// returns the path for the current open file - virtual String get_path_absolute() const override; /// returns the absolute path for the current open file + virtual String get_path() const override; ///< @return The path for the current open file + virtual String get_path_absolute() const override; /// @return The absolute path for the current open file virtual void seek(uint64_t p_position) override; ///< seek to a given position virtual void seek_end(int64_t p_position = 0) override; ///< seek from the end of file @@ -93,7 +99,7 @@ class FileAccessCompressed : public FileAccess { virtual void flush() override; virtual bool store_buffer(const uint8_t *p_src, uint64_t p_length) override; - virtual bool file_exists(const String &p_name) override; ///< return true if a file exists + virtual bool file_exists(const String &p_name) override; ///< @return `true` if a file exists virtual uint64_t _get_modified_time(const String &p_file) override; virtual uint64_t _get_access_time(const String &p_file) override; diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index f38502a2401..1cdb8b01b57 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access_encrypted.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "file_access_encrypted.h" #include "core/variant/variant.h" diff --git a/core/io/file_access_encrypted.h b/core/io/file_access_encrypted.h index 02b8fd69aaf..b6d864883f8 100644 --- a/core/io/file_access_encrypted.h +++ b/core/io/file_access_encrypted.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access_encrypted.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/crypto/crypto_core.h" @@ -70,10 +76,10 @@ class FileAccessEncrypted : public FileAccess { Vector get_iv() const { return iv; } virtual Error open_internal(const String &p_path, int p_mode_flags) override; ///< open a file - virtual bool is_open() const override; ///< true when file is open + virtual bool is_open() const override; ///< @return `true` when file is open - virtual String get_path() const override; /// returns the path for the current open file - virtual String get_path_absolute() const override; /// returns the absolute path for the current open file + virtual String get_path() const override; /// @return The path for the current open file + virtual String get_path_absolute() const override; ///< @return The absolute path for the current open file virtual void seek(uint64_t p_position) override; ///< seek to a given position virtual void seek_end(int64_t p_position = 0) override; ///< seek from the end of file @@ -90,7 +96,7 @@ class FileAccessEncrypted : public FileAccess { virtual void flush() override; virtual bool store_buffer(const uint8_t *p_src, uint64_t p_length) override; ///< store an array of bytes - virtual bool file_exists(const String &p_name) override; ///< return true if a file exists + virtual bool file_exists(const String &p_name) override; ///< @return true if a file exists virtual uint64_t _get_modified_time(const String &p_file) override; virtual uint64_t _get_access_time(const String &p_file) override; diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 28525980da0..f19dac1811f 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access_memory.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "file_access_memory.h" #include "core/config/project_settings.h" diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h index 8997eb466d6..75b6d5724d3 100644 --- a/core/io/file_access_memory.h +++ b/core/io/file_access_memory.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access_memory.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/file_access.h" @@ -48,7 +54,7 @@ class FileAccessMemory : public FileAccess { virtual Error open_custom(const uint8_t *p_data, uint64_t p_len); ///< open a file virtual Error open_internal(const String &p_path, int p_mode_flags) override; ///< open a file - virtual bool is_open() const override; ///< true when file is open + virtual bool is_open() const override; ///< @return `true` when file is open virtual void seek(uint64_t p_position) override; ///< seek to a given position virtual void seek_end(int64_t p_position) override; ///< seek from the end of file @@ -65,7 +71,7 @@ class FileAccessMemory : public FileAccess { virtual void flush() override; virtual bool store_buffer(const uint8_t *p_src, uint64_t p_length) override; ///< store an array of bytes - virtual bool file_exists(const String &p_name) override; ///< return true if a file exists + virtual bool file_exists(const String &p_name) override; ///< @return `true` if a file exists virtual uint64_t _get_modified_time(const String &p_file) override { return 0; } virtual uint64_t _get_access_time(const String &p_file) override { return 0; } diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index b25bad2e046..52c2e3620f3 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access_pack.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "file_access_pack.h" #include "core/io/file_access_encrypted.h" diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 5e7e71cedbf..736c3294159 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access_pack.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/dir_access.h" @@ -38,13 +44,13 @@ #include "core/templates/hash_set.h" #include "core/templates/list.h" -// Redot's packed file magic header ("GDPC" in ASCII). +/// Redot's packed file magic header ("GDPC" in ASCII). #define PACK_HEADER_MAGIC 0x43504447 #define PACK_FORMAT_VERSION_V2 2 #define PACK_FORMAT_VERSION_V3 3 -// The current packed file format version number. +/// The current packed file format version number. #define PACK_FORMAT_VERSION PACK_FORMAT_VERSION_V3 enum PackFlags { @@ -68,7 +74,7 @@ class PackedData { public: struct PackedFile { String pack; - uint64_t offset; //if offset is ZERO, the file was ERASED + uint64_t offset; ///< If offset is ZERO, the file was ERASED uint64_t size; uint8_t md5[16]; PackSource *src = nullptr; @@ -118,7 +124,8 @@ class PackedData { public: void add_pack_source(PackSource *p_source); - void add_path(const String &p_pkg_path, const String &p_path, uint64_t p_ofs, uint64_t p_size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files, bool p_encrypted = false, bool p_bundle = false); // for PackSource + /// For PackSource + void add_path(const String &p_pkg_path, const String &p_path, uint64_t p_ofs, uint64_t p_size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files, bool p_encrypted = false, bool p_bundle = false); void remove_path(const String &p_path); uint8_t *get_file_hash(const String &p_path); HashSet get_file_paths() const; diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index 2065a5e1b81..043b5bef39c 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access_zip.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #ifdef MINIZIP_ENABLED #include "file_access_zip.h" @@ -147,7 +153,6 @@ unzFile ZipArchive::get_file_handle(const String &p_file) const { } bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, uint64_t p_offset = 0) { - // load with offset feature only supported for PCK files ERR_FAIL_COND_V_MSG(p_offset != 0, false, "Invalid PCK data. Note that loading files with a non-zero offset isn't supported with ZIP archives."); if (p_path.get_extension().nocasecmp_to("zip") != 0 && p_path.get_extension().nocasecmp_to("pcz") != 0) { diff --git a/core/io/file_access_zip.h b/core/io/file_access_zip.h index db777726d50..3ce1b5dee28 100644 --- a/core/io/file_access_zip.h +++ b/core/io/file_access_zip.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file file_access_zip.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #ifdef MINIZIP_ENABLED @@ -63,7 +69,7 @@ class ZipArchive : public PackSource { Error add_package(const String &p_name); bool file_exists(const String &p_name) const; - + /// Load with offset feature only supported for PCK files virtual bool try_open_pack(const String &p_path, bool p_replace_files, uint64_t p_offset) override; Ref get_file(const String &p_path, PackedData::PackedFile *p_file) override; @@ -84,7 +90,7 @@ class FileAccessZip : public FileAccess { public: virtual Error open_internal(const String &p_path, int p_mode_flags) override; ///< open a file - virtual bool is_open() const override; ///< true when file is open + virtual bool is_open() const override; ///< @return `true` when file is open virtual void seek(uint64_t p_position) override; ///< seek to a given position virtual void seek_end(int64_t p_position = 0) override; ///< seek from the end of file @@ -101,7 +107,7 @@ class FileAccessZip : public FileAccess { virtual void flush() override; virtual bool store_buffer(const uint8_t *p_src, uint64_t p_length) override; - virtual bool file_exists(const String &p_name) override; ///< return true if a file exists + virtual bool file_exists(const String &p_name) override; ///< @return `true` if a file exists virtual uint64_t _get_modified_time(const String &p_file) override { return 0; } virtual uint64_t _get_access_time(const String &p_file) override { return 0; } diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index ab95d649ed9..a3c1dea5aab 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file http_client.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "http_client.h" const char *HTTPClient::_methods[METHOD_MAX] = { diff --git a/core/io/http_client.h b/core/io/http_client.h index 57e2b20d0a0..3efd65bcdfe 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file http_client.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/crypto/crypto.h" @@ -132,13 +138,13 @@ class HTTPClient : public RefCounted { enum Status { STATUS_DISCONNECTED, - STATUS_RESOLVING, // Resolving hostname (if passed a hostname) + STATUS_RESOLVING, ///< Resolving hostname (if passed a hostname) STATUS_CANT_RESOLVE, - STATUS_CONNECTING, // Connecting to IP + STATUS_CONNECTING, ///< Connecting to IP STATUS_CANT_CONNECT, - STATUS_CONNECTED, // Connected, requests can be made - STATUS_REQUESTING, // Request in progress - STATUS_BODY, // Request resulted in body, which must be read + STATUS_CONNECTED, ///< Connected, requests can be made + STATUS_REQUESTING, ///< Request in progress + STATUS_BODY, ///< Request resulted in body, which must be read STATUS_CONNECTION_ERROR, STATUS_TLS_HANDSHAKE_ERROR, @@ -185,9 +191,9 @@ class HTTPClient : public RefCounted { virtual Error get_response_headers(List *r_response) = 0; virtual int64_t get_response_body_length() const = 0; - virtual PackedByteArray read_response_body_chunk() = 0; // Can't get body as partial text because of most encodings UTF8, gzip, etc. + virtual PackedByteArray read_response_body_chunk() = 0; ///< Can't get body as partial text because of most encodings UTF8, gzip, etc. - virtual void set_blocking_mode(bool p_enable) = 0; // Useful mostly if running in a thread + virtual void set_blocking_mode(bool p_enable) = 0; ///< Useful mostly if running in a thread virtual bool is_blocking_mode_enabled() const = 0; virtual void set_read_chunk_size(int p_size) = 0; @@ -195,9 +201,11 @@ class HTTPClient : public RefCounted { virtual Error poll() = 0; - // Use empty string or -1 to unset + /// @name Use empty string or -1 to unset + /// @{ virtual void set_http_proxy(const String &p_host, int p_port); virtual void set_https_proxy(const String &p_host, int p_port); + // @} HTTPClient() {} virtual ~HTTPClient() {} diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp index f0744c8bd37..4d0cf577c41 100644 --- a/core/io/http_client_tcp.cpp +++ b/core/io/http_client_tcp.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file http_client_tcp.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #ifndef WEB_ENABLED #include "http_client_tcp.h" diff --git a/core/io/http_client_tcp.h b/core/io/http_client_tcp.h index 8376e04d4e7..997b6e54236 100644 --- a/core/io/http_client_tcp.h +++ b/core/io/http_client_tcp.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file http_client_tcp.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "http_client.h" @@ -41,13 +47,13 @@ class HTTPClientTCP : public HTTPClient { Status status = STATUS_DISCONNECTED; IP::ResolverID resolving = IP::RESOLVER_INVALID_ID; Array ip_candidates; - int conn_port = -1; // Server to make requests to. + int conn_port = -1; ///< Server to make requests to. String conn_host; - int server_port = -1; // Server to connect to (might be a proxy server). + int server_port = -1; ///< Server to connect to (might be a proxy server). String server_host; - int http_proxy_port = -1; // Proxy server for http requests. + int http_proxy_port = -1; ///< Proxy server for http requests. String http_proxy_host; - int https_proxy_port = -1; // Proxy server for https requests. + int https_proxy_port = -1; ///< Proxy server for https requests. String https_proxy_host; bool blocking = false; bool handshaking = false; @@ -67,11 +73,11 @@ class HTTPClientTCP : public HTTPClient { Ref request_buffer; Ref tcp_connection; Ref connection; - Ref proxy_client; // Negotiate with proxy server. + Ref proxy_client; ///< Negotiate with proxy server. int response_num = 0; Vector response_headers; - // 64 KiB by default (favors fast download speeds at the cost of memory usage). + /// 64 KiB by default (favors fast download speeds at the cost of memory usage). int read_chunk_size = 65536; Error _get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received); diff --git a/core/io/image.cpp b/core/io/image.cpp index a9edd754949..a1fc2ec9379 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file image.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "image.h" #include "core/config/project_settings.h" @@ -469,7 +475,7 @@ int Image::get_mipmap_count() const { } } -// Using template generates perfectly optimized code due to constant expression reduction and unused variable removal present in all compilers. +/// Using template generates perfectly optimized code due to constant expression reduction and unused variable removal present in all compilers. template static void _convert(int p_width, int p_height, const uint8_t *p_src, uint8_t *p_dst) { constexpr uint32_t max_bytes = MAX(read_bytes, write_bytes); @@ -1558,10 +1564,10 @@ void Image::rotate_90(ClockDirection p_direction) { continue; } - // Check whether we already processed this cycle. - // We iterate over it and if we'll find an index smaller than `i` then we already - // processed this cycle because we always start at the smallest index in the cycle. - // TODO: Improve this naive approach, can be done better. + /// Check whether we already processed this cycle. + /// We iterate over it and if we'll find an index smaller than `i` then we already + /// processed this cycle because we always start at the smallest index in the cycle. + /// @todo Improve this naive approach, can be done better. while (prev > i) { prev = PREV_INDEX_IN_CYCLE(prev); } @@ -3062,8 +3068,6 @@ void Image::blend_rect_mask(const Ref &p_src, const Ref &p_mask, c } } -// Repeats `p_pixel` `p_count` times in consecutive memory. -// Results in the original pixel and `p_count - 1` subsequent copies of it. void Image::_repeat_pixel_over_subsequent_memory(uint8_t *p_pixel, int p_pixel_size, int p_count) { int offset = 1; for (int stride = 1; offset + stride <= p_count; stride *= 2) { @@ -4314,25 +4318,6 @@ void Image::copy_internals_from(const Ref &p_image) { } Dictionary Image::compute_image_metrics(const Ref p_compared_image, bool p_luma_metric) { - // https://github.com/richgel999/bc7enc_rdo/blob/master/LICENSE - // - // This is free and unencumbered software released into the public domain. - // Anyone is free to copy, modify, publish, use, compile, sell, or distribute this - // software, either in source code form or as a compiled binary, for any purpose, - // commercial or non - commercial, and by any means. - // In jurisdictions that recognize copyright laws, the author or authors of this - // software dedicate any and all copyright interest in the software to the public - // domain. We make this dedication for the benefit of the public at large and to - // the detriment of our heirs and successors. We intend this dedication to be an - // overt act of relinquishment in perpetuity of all present and future rights to - // this software under copyright law. - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE - // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - Dictionary result; result["max"] = Math::INF; result["mean"] = Math::INF; diff --git a/core/io/image.h b/core/io/image.h index 57b86fd8fa1..52edb115261 100644 --- a/core/io/image.h +++ b/core/io/image.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file image.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/resource.h" @@ -43,8 +49,8 @@ class Image; -// Function pointer prototypes. - +/// @name Function pointer prototypes. +/// @{ typedef Error (*SavePNGFunc)(const String &p_path, const Ref &p_img); typedef Vector (*SavePNGBufferFunc)(const Ref &p_img); @@ -62,53 +68,54 @@ typedef Vector (*SaveEXRBufferFunc)(const Ref &p_img, bool p_gra typedef Error (*SaveDDSFunc)(const String &p_path, const Ref &p_img); typedef Vector (*SaveDDSBufferFunc)(const Ref &p_img); +/// @} class Image : public Resource { GDCLASS(Image, Resource); public: enum { - MAX_WIDTH = (1 << 24), // Force a limit somehow. - MAX_HEIGHT = (1 << 24), // Force a limit somehow. - MAX_PIXELS = 268435456 // 16384 ^ 2 + MAX_WIDTH = (1 << 24), ///< Force a limit somehow. + MAX_HEIGHT = (1 << 24), ///< Force a limit somehow. + MAX_PIXELS = 268435456 ///< 16384 ^ 2 }; enum Format : int32_t { - FORMAT_L8, // Luminance - FORMAT_LA8, // Luminance-Alpha + FORMAT_L8, ///< Luminance + FORMAT_LA8, ///< Luminance-Alpha FORMAT_R8, FORMAT_RG8, FORMAT_RGB8, FORMAT_RGBA8, FORMAT_RGBA4444, FORMAT_RGB565, - FORMAT_RF, // Float + FORMAT_RF, ///< Float FORMAT_RGF, FORMAT_RGBF, FORMAT_RGBAF, - FORMAT_RH, // Half + FORMAT_RH, ///< Half FORMAT_RGH, FORMAT_RGBH, FORMAT_RGBAH, FORMAT_RGBE9995, - FORMAT_DXT1, // BC1 - FORMAT_DXT3, // BC2 - FORMAT_DXT5, // BC3 - FORMAT_RGTC_R, // BC4 - FORMAT_RGTC_RG, // BC5 - FORMAT_BPTC_RGBA, // BC7 - FORMAT_BPTC_RGBF, // BC6 Signed - FORMAT_BPTC_RGBFU, // BC6 Unsigned - FORMAT_ETC, // ETC1 + FORMAT_DXT1, ///< BC1 + FORMAT_DXT3, ///< BC2 + FORMAT_DXT5, ///< BC3 + FORMAT_RGTC_R, ///< BC4 + FORMAT_RGTC_RG, ///< BC5 + FORMAT_BPTC_RGBA, ///< BC7 + FORMAT_BPTC_RGBF, ///< BC6 Signed + FORMAT_BPTC_RGBFU, ///< BC6 Unsigned + FORMAT_ETC, ///< ETC1 FORMAT_ETC2_R11, - FORMAT_ETC2_R11S, // Signed, NOT srgb. + FORMAT_ETC2_R11S, ///< Signed, NOT srgb. FORMAT_ETC2_RG11, - FORMAT_ETC2_RG11S, // Signed, NOT srgb. + FORMAT_ETC2_RG11S, ///< Signed, NOT srgb. FORMAT_ETC2_RGB8, FORMAT_ETC2_RGBA8, FORMAT_ETC2_RGB8A1, - FORMAT_ETC2_RA_AS_RG, // ETC2 RGBA with a RA-RG swizzle for normal maps. - FORMAT_DXT5_RA_AS_RG, // BC3 with a RA-RG swizzle for normal maps. + FORMAT_ETC2_RA_AS_RG, ///< ETC2 RGBA with a RA-RG swizzle for normal maps. + FORMAT_DXT5_RA_AS_RG, ///< BC3 with a RA-RG swizzle for normal maps. FORMAT_ASTC_4x4, FORMAT_ASTC_4x4_HDR, FORMAT_ASTC_8x8, @@ -128,7 +135,7 @@ class Image : public Resource { // INTERPOLATE_GAUSS }; - // Used for obtaining optimal compression quality. + /// Used for obtaining optimal compression quality. enum UsedChannels { USED_CHANNELS_L, USED_CHANNELS_LA, @@ -138,7 +145,7 @@ class Image : public Resource { USED_CHANNELS_RGBA, }; - // ASTC supports block formats other than 4x4. + /// ASTC supports block formats other than 4x4. enum ASTCFormat { ASTC_FORMAT_4x4, ASTC_FORMAT_8x8, @@ -189,7 +196,8 @@ class Image : public Resource { float rdo_quality_loss = 0; }; - // External saver function pointers. + /// @name External saver function pointers + /// @{ static inline SavePNGFunc save_png_func = nullptr; static inline SaveJPGFunc save_jpg_func = nullptr; @@ -202,7 +210,9 @@ class Image : public Resource { static inline SaveWebPBufferFunc save_webp_buffer_func = nullptr; static inline SaveDDSBufferFunc save_dds_buffer_func = nullptr; - // External loader function pointers. + /// @} + /// @name External loader function pointers + /// @{ static inline ImageMemLoadFunc _png_mem_loader_func = nullptr; static inline ImageMemLoadFunc _png_mem_unpacker_func = nullptr; @@ -215,7 +225,9 @@ class Image : public Resource { static inline ImageMemLoadFunc _dds_mem_loader_func = nullptr; static inline ImageMemLoadFunc _gif_mem_loader_func = nullptr; - // External VRAM compression function pointers. + /// @} + /// @name External VRAM compression function pointers + /// @{ static void (*_image_compress_bc_func)(Image *, UsedChannels p_channels); static void (*_image_compress_bptc_func)(Image *, UsedChannels p_channels); @@ -226,7 +238,9 @@ class Image : public Resource { static Error (*_image_compress_bptc_rd_func)(Image *, UsedChannels p_channels); static Error (*_image_compress_bc_rd_func)(Image *, UsedChannels p_channels); - // External VRAM decompression function pointers. + /// @} + /// @name External VRAM decompression function pointers + /// @{ static void (*_image_decompress_bc)(Image *); static void (*_image_decompress_bptc)(Image *); @@ -234,7 +248,9 @@ class Image : public Resource { static void (*_image_decompress_etc2)(Image *); static void (*_image_decompress_astc)(Image *); - // External packer function pointers. + /// @} + /// @name External packer function pointers + /// @{ static Vector (*webp_lossy_packer)(const Ref &p_image, float p_quality); static Vector (*webp_lossless_packer)(const Ref &p_image); @@ -245,6 +261,7 @@ class Image : public Resource { static Ref (*png_unpacker)(const Vector &p_buffer); static Ref (*basis_universal_unpacker)(const Vector &p_buffer); static Ref (*basis_universal_unpacker_ptr)(const uint8_t *p_data, int p_size); + /// @} protected: virtual Ref _duplicate(const DuplicateParams &p_params) const override; @@ -272,6 +289,8 @@ class Image : public Resource { _FORCE_INLINE_ void _put_pixelb(int p_x, int p_y, uint32_t p_pixel_size, uint8_t *p_data, const uint8_t *p_pixel); _FORCE_INLINE_ void _get_pixelb(int p_x, int p_y, uint32_t p_pixel_size, const uint8_t *p_data, uint8_t *p_pixel); + /// Repeats `p_pixel` `p_count` times in consecutive memory. + /// Results in the original pixel and `p_count - 1` subsequent copies of it. _FORCE_INLINE_ void _repeat_pixel_over_subsequent_memory(uint8_t *p_pixel, int p_pixel_size, int p_count); void _set_data(const Dictionary &p_data); @@ -297,28 +316,34 @@ class Image : public Resource { bool has_mipmaps() const; int get_mipmap_count() const; - // Convert the image to another format, conversion only to raw byte format. + /// Convert the image to another format, conversion only to raw byte format. void convert(Format p_new_format); Format get_format() const; - // Get where the mipmap begins in data. + /// @name Get where the mipmap begins in data + /// @{ int64_t get_mipmap_offset(int p_mipmap) const; void get_mipmap_offset_and_size(int p_mipmap, int64_t &r_ofs, int64_t &r_size) const; void get_mipmap_offset_size_and_dimensions(int p_mipmap, int64_t &r_ofs, int64_t &r_size, int &w, int &h) const; + /// @} static Image3DValidateError validate_3d_image(Format p_format, int p_width, int p_height, int p_depth, bool p_mipmaps, const Vector> &p_images); static String get_3d_image_validation_error_text(Image3DValidateError p_error); - // Resize the image, using the preferred interpolation method. + /// @name Resize the image, using the preferred interpolation method + /// @{ void resize_to_po2(bool p_square = false, Interpolation p_interpolation = INTERPOLATE_BILINEAR); void resize(int p_width, int p_height, Interpolation p_interpolation = INTERPOLATE_BILINEAR); void shrink_x2(); bool is_size_po2() const; + /// @} - // Crop the image to a specific size, if larger, then the image is filled by black. + /// @name Crop the image to a specific size, if larger, then the image is filled by black. + /// @{ void crop_from_point(int p_x, int p_y, int p_width, int p_height); void crop(int p_width, int p_height); + /// @} void rotate_90(ClockDirection p_direction); void rotate_180(); @@ -326,7 +351,7 @@ class Image : public Resource { void flip_x(); void flip_y(); - // Generate a mipmap chain of an image (creates an image 1/4 the size, with averaging of 4->1). + /// Generate a mipmap chain of an image (creates an image 1/4 the size, with averaging of 4->1). Error generate_mipmaps(bool p_renormalize = false); Error generate_mipmap_roughness(RoughnessChannel p_roughness_channel, const Ref &p_normal_map); @@ -334,12 +359,14 @@ class Image : public Resource { void clear_mipmaps(); void normalize(); - // Creates new internal image data of a given size and format. Current image will be lost. + /// @name Creates new internal image data of a given size and format. Current image will be lost. + /// @{ void initialize_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format); void initialize_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector &p_data); void initialize_data(const char **p_xpm); + /// @} - // Returns true when the image is empty (0,0) in size. + /// @return `true` when the image is empty (0,0) in size. bool is_empty() const; Vector get_data() const; @@ -361,11 +388,11 @@ class Image : public Resource { static Ref create_from_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector &p_data); void set_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector &p_data); - Image() = default; // Create an empty image. - Image(int p_width, int p_height, bool p_use_mipmaps, Format p_format); // Create an empty image of a specific size and format. - Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector &p_data); // Import an image of a specific size and format from a byte vector. - Image(const uint8_t *p_mem_png_jpg, int p_len = -1); // Import either a png or jpg from a pointer. - Image(const char **p_xpm); // Import an XPM image. + Image() = default; ///< Create an empty image. + Image(int p_width, int p_height, bool p_use_mipmaps, Format p_format); ///< Create an empty image of a specific size and format. + Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector &p_data); ///< Import an image of a specific size and format from a byte vector. + Image(const uint8_t *p_mem_png_jpg, int p_len = -1); ///< Import either a png or jpg from a pointer. + Image(const char **p_xpm); ///< Import an XPM image. ~Image() {} @@ -449,6 +476,26 @@ class Image : public Resource { void copy_internals_from(const Ref &p_image); + /** + * https://github.com/richgel999/bc7enc_rdo/blob/master/LICENSE + * + * @copyright This is free and unencumbered software released into the public domain. + * Anyone is free to copy, modify, publish, use, compile, sell, or distribute this + * software, either in source code form or as a compiled binary, for any purpose, + * commercial or non - commercial, and by any means. + * In jurisdictions that recognize copyright laws, the author or authors of this + * software dedicate any and all copyright interest in the software to the public + * domain. We make this dedication for the benefit of the public at large and to + * the detriment of our heirs and successors. We intend this dedication to be an + * overt act of relinquishment in perpetuity of all present and future rights to + * this software under copyright law. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ Dictionary compute_image_metrics(const Ref p_compared_image, bool p_luma_metric = true); }; diff --git a/core/io/image_frames.cpp b/core/io/image_frames.cpp index 3536391a722..59c3b47e671 100644 --- a/core/io/image_frames.cpp +++ b/core/io/image_frames.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file image_frames.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "image_frames.h" #include "core/error/error_macros.h" diff --git a/core/io/image_frames.h b/core/io/image_frames.h index 61983ffd72f..cb46efb61c8 100644 --- a/core/io/image_frames.h +++ b/core/io/image_frames.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file image_frames.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/image.h" @@ -76,10 +82,10 @@ class ImageFrames : public Resource { bool is_empty() const; - ImageFrames() = default; // Create empty image frames. + ImageFrames() = default; ///< Create empty image frames. ImageFrames(const uint8_t *p_mem_apng, int p_len); - ImageFrames(const Vector> &p_images, float p_delay = 1.0); // Import images from an image vector and delay. - ImageFrames(const Vector> &p_images, const Vector &p_delays); // Import images from an image vector and delay vector. + ImageFrames(const Vector> &p_images, float p_delay = 1.0); ///< Import images from an image vector and delay. + ImageFrames(const Vector> &p_images, const Vector &p_delays); ///< Import images from an image vector and delay vector. ~ImageFrames() {} diff --git a/core/io/image_frames_loader.cpp b/core/io/image_frames_loader.cpp index f1112d4ff74..056499da86a 100644 --- a/core/io/image_frames_loader.cpp +++ b/core/io/image_frames_loader.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file image_frames_loader.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "image_frames_loader.h" void ImageFramesFormatLoader::_bind_methods() { diff --git a/core/io/image_frames_loader.h b/core/io/image_frames_loader.h index 080a1ee7ca7..f5af65c78c0 100644 --- a/core/io/image_frames_loader.h +++ b/core/io/image_frames_loader.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file image_frames_loader.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/file_access.h" diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp index b8ce2606041..a5b8617b7ab 100644 --- a/core/io/image_loader.cpp +++ b/core/io/image_loader.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file image_loader.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "image_loader.h" void ImageFormatLoader::_bind_methods() { diff --git a/core/io/image_loader.h b/core/io/image_loader.h index 2fcd312b9e6..1a0ea1711b9 100644 --- a/core/io/image_loader.h +++ b/core/io/image_loader.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file image_loader.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/core_bind.h" diff --git a/core/io/ip.cpp b/core/io/ip.cpp index 78d9a062ebd..30e2f932bb2 100644 --- a/core/io/ip.cpp +++ b/core/io/ip.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file ip.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "ip.h" #include "core/os/semaphore.h" diff --git a/core/io/ip.h b/core/io/ip.h index f75790fb873..51c9b9f5d46 100644 --- a/core/io/ip.h +++ b/core/io/ip.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file ip.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/ip_address.h" @@ -87,7 +93,7 @@ class IP : public Object { IPAddress resolve_hostname(const String &p_hostname, Type p_type = TYPE_ANY); PackedStringArray resolve_hostname_addresses(const String &p_hostname, Type p_type = TYPE_ANY); - // async resolver hostname + /// async resolver hostname ResolverID resolve_hostname_queue_item(const String &p_hostname, Type p_type = TYPE_ANY); ResolverStatus get_resolve_item_status(ResolverID p_id) const; IPAddress get_resolve_item_address(ResolverID p_id) const; diff --git a/core/io/ip_address.cpp b/core/io/ip_address.cpp index e1a43cb0df9..31113951afe 100644 --- a/core/io/ip_address.cpp +++ b/core/io/ip_address.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file ip_address.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "ip_address.h" /* IPAddress::operator Variant() const { diff --git a/core/io/ip_address.h b/core/io/ip_address.h index e36556080dc..a8f4a1a45e4 100644 --- a/core/io/ip_address.h +++ b/core/io/ip_address.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file ip_address.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/string/ustring.h" @@ -97,6 +103,6 @@ struct [[nodiscard]] IPAddress { IPAddress() { clear(); } }; -// Zero-constructing IPAddress initializes field, valid, and wildcard to 0 (and thus empty). +/// Zero-constructing IPAddress initializes field, valid, and wildcard to 0 (and thus empty). template <> struct is_zero_constructible : std::true_type {}; diff --git a/core/io/json.cpp b/core/io/json.cpp index 96ecc9f8a7b..b4739ad1e47 100644 --- a/core/io/json.cpp +++ b/core/io/json.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file json.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "json.h" #include "core/config/engine.h" diff --git a/core/io/json.h b/core/io/json.h index e0474e9322c..343025a9374 100644 --- a/core/io/json.h +++ b/core/io/json.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file json.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/resource.h" @@ -115,7 +121,7 @@ class ResourceFormatLoaderJSON : public ResourceFormatLoader { virtual bool handles_type(const String &p_type) const override; virtual String get_resource_type(const String &p_path) const override; - // Treat JSON as a text file, do not generate a `*.json.uid` file. + /// Treat JSON as a text file, do not generate a `*.json.uid` file. virtual ResourceUID::ID get_resource_uid(const String &p_path) const override { return ResourceUID::INVALID_ID; } virtual bool has_custom_uid_support() const override { return true; } }; diff --git a/core/io/logger.cpp b/core/io/logger.cpp index fa30fa46d4b..9e1b26955d2 100644 --- a/core/io/logger.cpp +++ b/core/io/logger.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file logger.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "logger.h" #include "core/core_globals.h" @@ -174,7 +180,7 @@ RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) #ifdef MODULE_REGEX_ENABLED strip_ansi_regex.instantiate(); - strip_ansi_regex->detach_from_objectdb(); // Note: This RegEx instance will exist longer than ObjectDB, therefore can't be registered in ObjectDB. + strip_ansi_regex->detach_from_objectdb(); /// @note This RegEx instance will exist longer than ObjectDB, therefore can't be registered in ObjectDB. strip_ansi_regex->compile("\u001b\\[((?:\\d|;)*)([a-zA-Z])"); #endif // MODULE_REGEX_ENABLED } diff --git a/core/io/logger.h b/core/io/logger.h index 55bab59fba9..c08108f4fde 100644 --- a/core/io/logger.h +++ b/core/io/logger.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file logger.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/file_access.h" diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 689ea4d6812..dc857f044cd 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file marshalls.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "marshalls.h" #include "core/io/resource_loader.h" @@ -58,25 +64,25 @@ ObjectID EncodedObjectAsID::get_object_id() const { #define ERR_FAIL_ADD_OF(a, b, err) ERR_FAIL_COND_V(((int32_t)(b)) < 0 || ((int32_t)(a)) < 0 || ((int32_t)(a)) > INT_MAX - ((int32_t)(b)), err) #define ERR_FAIL_MUL_OF(a, b, err) ERR_FAIL_COND_V(((int32_t)(a)) < 0 || ((int32_t)(b)) <= 0 || ((int32_t)(a)) > INT_MAX / ((int32_t)(b)), err) -// Byte 0: `Variant::Type`, byte 1: unused, bytes 2 and 3: additional data. +/// Byte 0: `Variant::Type`, byte 1: unused, bytes 2 and 3: additional data. #define HEADER_TYPE_MASK 0xFF -// For `Variant::INT`, `Variant::FLOAT` and other math types. +/// For `Variant::INT`, `Variant::FLOAT` and other math types. #define HEADER_DATA_FLAG_64 (1 << 16) -// For `Variant::OBJECT`. +/// For `Variant::OBJECT`. #define HEADER_DATA_FLAG_OBJECT_AS_ID (1 << 16) -// For `Variant::ARRAY`. -// Occupies bits 16 and 17. +/// For `Variant::ARRAY`. +/// Occupies bits 16 and 17. #define HEADER_DATA_FIELD_TYPED_ARRAY_MASK (0b11 << 16) #define HEADER_DATA_FIELD_TYPED_ARRAY_SHIFT 16 -// For `Variant::DICTIONARY`. -// Occupies bits 16 and 17. +/// For `Variant::DICTIONARY`. +/// Occupies bits 16 and 17. #define HEADER_DATA_FIELD_TYPED_DICTIONARY_KEY_MASK (0b11 << 16) #define HEADER_DATA_FIELD_TYPED_DICTIONARY_KEY_SHIFT 16 -// Occupies bits 18 and 19. +/// Occupies bits 18 and 19. #define HEADER_DATA_FIELD_TYPED_DICTIONARY_VALUE_MASK (0b11 << 18) #define HEADER_DATA_FIELD_TYPED_DICTIONARY_VALUE_SHIFT 18 @@ -201,9 +207,9 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = 4; } - // NOTE: We cannot use `sizeof(real_t)` for decoding, in case a different size is encoded. - // Decoding math types always checks for the encoded size, while encoding always uses compilation setting. - // This does lead to some code duplication for decoding, but compatibility is the priority. + /// @note We cannot use `sizeof(real_t)` for decoding, in case a different size is encoded. + /// Decoding math types always checks for the encoded size, while encoding always uses compilation setting. + /// This does lead to some code duplication for decoding, but compatibility is the priority. switch (header & HEADER_TYPE_MASK) { case Variant::NIL: { r_variant = Variant(); @@ -2133,10 +2139,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo } Vector vector3_to_float32_array(const Vector3 *vecs, size_t count) { - // We always allocate a new array, and we don't `memcpy()`. - // We also don't consider returning a pointer to the passed vectors when `sizeof(real_t) == 4`. - // One reason is that we could decide to put a 4th component in `Vector3` for SIMD/mobile performance, - // which would cause trouble with these optimizations. Vector floats; if (count == 0) { return floats; diff --git a/core/io/marshalls.h b/core/io/marshalls.h index 5220e7df860..17daa19cbe3 100644 --- a/core/io/marshalls.h +++ b/core/io/marshalls.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file marshalls.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/math_defs.h" @@ -226,4 +232,8 @@ class EncodedObjectAsID : public RefCounted { Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = nullptr, bool p_allow_objects = false, int p_depth = 0); Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects = false, int p_depth = 0); +/// We always allocate a new array, and we don't `memcpy()`. +/// We also don't consider returning a pointer to the passed vectors when `sizeof(real_t) == 4`. +/// One reason is that we could decide to put a 4th component in `Vector3` for SIMD/mobile performance, +/// which would cause trouble with these optimizations. Vector vector3_to_float32_array(const Vector3 *vecs, size_t count); diff --git a/core/io/missing_resource.cpp b/core/io/missing_resource.cpp index 77b50fa27f8..5d476ef3373 100644 --- a/core/io/missing_resource.cpp +++ b/core/io/missing_resource.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file missing_resource.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "missing_resource.h" bool MissingResource::_set(const StringName &p_name, const Variant &p_value) { diff --git a/core/io/missing_resource.h b/core/io/missing_resource.h index 3a089c1eb20..d547d669aea 100644 --- a/core/io/missing_resource.h +++ b/core/io/missing_resource.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file missing_resource.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/resource.h" diff --git a/core/io/net_socket.cpp b/core/io/net_socket.cpp index e0c7961c0e3..ac604e14f50 100644 --- a/core/io/net_socket.cpp +++ b/core/io/net_socket.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file net_socket.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "net_socket.h" NetSocket *(*NetSocket::_create)() = nullptr; diff --git a/core/io/net_socket.h b/core/io/net_socket.h index 12723cc27c7..7e37051e860 100644 --- a/core/io/net_socket.h +++ b/core/io/net_socket.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file net_socket.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/ip.h" @@ -70,7 +76,7 @@ class NetSocket : public RefCounted { virtual int get_available_bytes() const = 0; virtual Error get_socket_address(IPAddress *r_ip, uint16_t *r_port) const = 0; - virtual Error set_broadcasting_enabled(bool p_enabled) = 0; // Returns OK if the socket option has been set successfully. + virtual Error set_broadcasting_enabled(bool p_enabled) = 0; ///< @return OK if the socket option has been set successfully. virtual void set_blocking_enabled(bool p_enabled) = 0; virtual void set_ipv6_only_enabled(bool p_enabled) = 0; virtual void set_tcp_no_delay_enabled(bool p_enabled) = 0; diff --git a/core/io/packed_data_container.cpp b/core/io/packed_data_container.cpp index 1a8fb9433c0..fdfee179c48 100644 --- a/core/io/packed_data_container.cpp +++ b/core/io/packed_data_container.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file packed_data_container.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "packed_data_container.h" #include "core/io/marshalls.h" diff --git a/core/io/packed_data_container.h b/core/io/packed_data_container.h index ee20d6b4aa5..3827264cb47 100644 --- a/core/io/packed_data_container.h +++ b/core/io/packed_data_container.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file packed_data_container.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/resource.h" diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 50fd7136e11..e11b98a29cf 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file packet_peer.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "packet_peer.h" #include "core/config/project_settings.h" diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h index c191628067f..b844bd96427 100644 --- a/core/io/packet_peer.h +++ b/core/io/packet_peer.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file packet_peer.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/stream_peer.h" @@ -63,7 +69,8 @@ class PacketPeer : public RefCounted { virtual int get_max_packet_size() const = 0; - /* helpers / binders */ + /// @name helpers / binders + /// @{ virtual Error get_packet_buffer(Vector &r_buffer); virtual Error put_packet_buffer(const Vector &p_buffer); @@ -73,6 +80,7 @@ class PacketPeer : public RefCounted { void set_encode_buffer_max_size(int p_max_size); int get_encode_buffer_max_size() const; + /// @} PacketPeer() {} ~PacketPeer() {} @@ -98,7 +106,7 @@ class PacketPeerExtension : public PacketPeer { class PacketPeerStream : public PacketPeer { GDCLASS(PacketPeerStream, PacketPeer); - //the way the buffers work sucks, will change later + /// @todo The way the buffers work sucks, will change later mutable Ref peer; mutable RingBuffer ring_buffer; diff --git a/core/io/packet_peer_dtls.cpp b/core/io/packet_peer_dtls.cpp index 1a29fea4b3d..a95400a2206 100644 --- a/core/io/packet_peer_dtls.cpp +++ b/core/io/packet_peer_dtls.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file packet_peer_dtls.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "packet_peer_dtls.h" PacketPeerDTLS *PacketPeerDTLS::create(bool p_notify_postinitialize) { diff --git a/core/io/packet_peer_dtls.h b/core/io/packet_peer_dtls.h index 102b4537b15..2d556f4d50a 100644 --- a/core/io/packet_peer_dtls.h +++ b/core/io/packet_peer_dtls.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file packet_peer_dtls.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/crypto/crypto.h" diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index 4dccda95559..2dec0736921 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file packet_peer_udp.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "packet_peer_udp.h" #include "core/io/ip.h" @@ -89,7 +95,7 @@ Error PacketPeerUDP::_set_dest_address(const String &p_address, int p_port) { } int PacketPeerUDP::get_available_packet_count() const { - // TODO we should deprecate this, and expose poll instead! + /// @todo We should deprecate this, and expose poll instead! Error err = const_cast(this)->_poll(); if (err != OK) { return -1; @@ -107,7 +113,8 @@ Error PacketPeerUDP::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { return ERR_UNAVAILABLE; } - /* Bogus GCC warning here: + /** + * Bogus GCC warning here: * In member function 'int RingBuffer::read(T*, int, bool) [with T = unsigned char]', * inlined from 'virtual Error PacketPeerUDP::get_packet(const uint8_t**, int&)' at core/io/packet_peer_udp.cpp:112:9, * inlined from 'virtual Error PacketPeerUDP::get_packet(const uint8_t**, int&)' at core/io/packet_peer_udp.cpp:99:7: diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h index c688b4121c5..c557420658e 100644 --- a/core/io/packet_peer_udp.h +++ b/core/io/packet_peer_udp.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file packet_peer_udp.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/ip.h" @@ -76,9 +82,9 @@ class PacketPeerUDP : public PacketPeer { Error wait(); bool is_bound() const; - Error connect_shared_socket(Ref p_sock, IPAddress p_ip, uint16_t p_port, UDPServer *ref); // Used by UDPServer - void disconnect_shared_socket(); // Used by UDPServer - Error store_packet(IPAddress p_ip, uint32_t p_port, uint8_t *p_buf, int p_buf_size); // Used internally and by UDPServer + Error connect_shared_socket(Ref p_sock, IPAddress p_ip, uint16_t p_port, UDPServer *ref); ///< Used by UDPServer + void disconnect_shared_socket(); ///< Used by UDPServer + Error store_packet(IPAddress p_ip, uint32_t p_port, uint8_t *p_buf, int p_buf_size); ///< Used internally and by UDPServer Error connect_to_host(const IPAddress &p_host, int p_port); bool is_socket_connected() const; diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 1702dad3fd3..a93285c5829 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file pck_packer.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "pck_packer.h" #include "core/crypto/crypto_core.h" diff --git a/core/io/pck_packer.h b/core/io/pck_packer.h index 31ce694e3bc..f2feb9ac558 100644 --- a/core/io/pck_packer.h +++ b/core/io/pck_packer.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file pck_packer.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/ref_counted.h" diff --git a/core/io/plist.cpp b/core/io/plist.cpp index bb7201d9492..b88b0b855e6 100644 --- a/core/io/plist.cpp +++ b/core/io/plist.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file plist.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "plist.h" #include "core/crypto/crypto_core.h" @@ -227,7 +233,6 @@ bool PListNode::push_subnode(const Ref &p_node, const String &p_key) } size_t PListNode::get_asn1_size(uint8_t p_len_octets) const { - // Get size of all data, excluding type and size information. switch (data_type) { case PList::PLNodeType::PL_NODE_TYPE_NIL: { return 0; @@ -289,7 +294,6 @@ void PListNode::store_asn1_size(PackedByteArray &p_stream, uint8_t p_len_octets) } bool PListNode::store_asn1(PackedByteArray &p_stream, uint8_t p_len_octets) const { - // Convert to binary ASN1 stream. bool valid = true; switch (data_type) { case PList::PLNodeType::PL_NODE_TYPE_NIL: { @@ -376,7 +380,6 @@ bool PListNode::store_asn1(PackedByteArray &p_stream, uint8_t p_len_octets) cons } void PListNode::store_text(String &p_stream, uint8_t p_indent) const { - // Convert to text XML stream. switch (data_type) { case PList::PLNodeType::PL_NODE_TYPE_NIL: { // Nothing to store. diff --git a/core/io/plist.h b/core/io/plist.h index 9a21bf665ec..b2ca60e6b28 100644 --- a/core/io/plist.h +++ b/core/io/plist.h @@ -30,9 +30,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +/** + * @file plist.h + * + * Property list file format (application/x-plist) parser, property list ASN-1 serialization. + */ -// Property list file format (application/x-plist) parser, property list ASN-1 serialization. +#pragma once #include "core/io/file_access.h" @@ -116,11 +120,11 @@ class PListNode : public RefCounted { bool push_subnode(const Ref &p_node, const String &p_key = ""); - size_t get_asn1_size(uint8_t p_len_octets) const; + size_t get_asn1_size(uint8_t p_len_octets) const; ///< Get size of all data, excluding type and size information. void store_asn1_size(PackedByteArray &p_stream, uint8_t p_len_octets) const; - bool store_asn1(PackedByteArray &p_stream, uint8_t p_len_octets) const; - void store_text(String &p_stream, uint8_t p_indent) const; + bool store_asn1(PackedByteArray &p_stream, uint8_t p_len_octets) const; ///< Convert to binary ASN1 stream. + void store_text(String &p_stream, uint8_t p_indent) const; ///< Convert to text XML stream. PListNode() {} ~PListNode() {} diff --git a/core/io/remote_filesystem_client.cpp b/core/io/remote_filesystem_client.cpp index abb2f5d2336..50ef45b5308 100644 --- a/core/io/remote_filesystem_client.cpp +++ b/core/io/remote_filesystem_client.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file remote_filesystem_client.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "remote_filesystem_client.h" #include "core/io/dir_access.h" @@ -170,8 +176,8 @@ Error RemoteFilesystemClient::_synchronize_with_server(const String &p_host, int // Connection OK, now send the current file state. print_verbose("Remote Filesystem: Connection OK."); - // FIXME: Is rebranding needed here, to "GDFS"? - // Header (GRFS) - Godot Remote File System + /// @todo FIXME: Is rebranding needed here, to "GDFS"? + /// Header (GRFS) - Godot Remote File System print_verbose("Remote Filesystem: Sending header"); tcp_client->put_u8('G'); tcp_client->put_u8('R'); diff --git a/core/io/remote_filesystem_client.h b/core/io/remote_filesystem_client.h index 6a0d513af34..c2a6e2a95e3 100644 --- a/core/io/remote_filesystem_client.h +++ b/core/io/remote_filesystem_client.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file remote_filesystem_client.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/string/ustring.h" @@ -43,12 +49,12 @@ class RemoteFilesystemClient { protected: String _get_cache_path() { return cache_path; } struct FileCache { - String path; // Local path (as in "folder/to/file.png") - uint64_t server_modified_time = 0; // MD5 checksum. + String path; ///< Local path (as in "folder/to/file.png") + uint64_t server_modified_time = 0; ///< MD5 checksum. uint64_t modified_time = 0; }; virtual bool _is_configured() { return !cache_path.is_empty(); } - // Can be re-implemented per platform. If so, feel free to ignore get_cache_path() + /// Can be re-implemented per platform. If so, feel free to ignore get_cache_path() virtual Vector _load_cache_file(); virtual Error _store_file(const String &p_path, const LocalVector &p_file, uint64_t &modified_time); virtual Error _remove_file(const String &p_path); diff --git a/core/io/resource.cpp b/core/io/resource.cpp index c9683d4cd7b..300d83ae589 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "resource.h" #include "core/io/resource_loader.h" @@ -124,8 +130,6 @@ void Resource::seed_scene_unique_id(uint32_t p_seed) { } String Resource::generate_scene_unique_id() { - // Generate a unique enough hash, but still user-readable. - // If it's not unique it does not matter because the saver will try again. if (unique_id_gen.get_seed() == 0) { OS::DateTime dt = OS::get_singleton()->get_datetime(); uint32_t hash = hash_murmur3_one_32(OS::get_singleton()->get_ticks_usec()); @@ -366,19 +370,21 @@ Variant Resource::_duplicate_recursive(const Variant &p_variant, const Duplicate } } +/// @name These are for avoiding potential duplicates +/// @brief This can happen in custom code from participating in the same duplication session (remap cache). +/// @{ +#define BEFORE_USER_CODE thread_duplicate_remap_cache = nullptr; +#define AFTER_USER_CODE \ + thread_duplicate_remap_cache = remap_cache_backup; \ + thread_duplicate_remap_cache_needs_deallocation = remap_cache_needs_deallocation_backup; +/// @} + Ref Resource::_duplicate(const DuplicateParams &p_params) const { ERR_FAIL_COND_V_MSG(p_params.local_scene && p_params.subres_mode != RESOURCE_DEEP_DUPLICATE_MAX, Ref(), "Duplication for local-to-scene can't specify a deep duplicate mode."); DuplicateRemapCacheT *remap_cache_backup = thread_duplicate_remap_cache; bool remap_cache_needs_deallocation_backup = thread_duplicate_remap_cache_needs_deallocation; -// These are for avoiding potential duplicates that can happen in custom code -// from participating in the same duplication session (remap cache). -#define BEFORE_USER_CODE thread_duplicate_remap_cache = nullptr; -#define AFTER_USER_CODE \ - thread_duplicate_remap_cache = remap_cache_backup; \ - thread_duplicate_remap_cache_needs_deallocation = remap_cache_needs_deallocation_backup; - List plist; get_property_list(&plist); @@ -668,7 +674,6 @@ void Resource::setup_local_to_scene() { } void Resource::reset_local_to_scene() { - // Restores the state as if setup_local_to_scene() hadn't been called. } Node *(*Resource::_get_local_scene_func)() = nullptr; @@ -688,7 +693,6 @@ void Resource::set_as_translation_remapped(bool p_remapped) { } } -// Helps keep IDs the same when loading/saving scenes. An empty ID clears the entry, and an empty ID is returned when not found. void Resource::set_resource_id_for_path(const String &p_referrer_path, const String &p_resource_path, const String &p_id) { #ifdef TOOLS_ENABLED if (p_id.is_empty()) { diff --git a/core/io/resource.h b/core/io/resource.h index e109e53d752..39d56786e19 100644 --- a/core/io/resource.h +++ b/core/io/resource.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/resource_uid.h" @@ -99,7 +105,7 @@ class Resource : public RefCounted { Variant _duplicate_recursive(const Variant &p_variant, const DuplicateParams &p_params, uint32_t p_usage = 0) const; void _find_sub_resources(const Variant &p_variant, HashSet> &p_resources_found); - // Only for binding the deep duplicate method, so it doesn't need actual members. + /// Only for binding the deep duplicate method, so it doesn't need actual members. enum DeepDuplicateMode : int; _ALWAYS_INLINE_ Ref _duplicate_deep_bind(DeepDuplicateMode p_deep_subresources_mode) const; @@ -114,7 +120,7 @@ class Resource : public RefCounted { void _set_path(const String &p_path); void _take_over_path(const String &p_path); - virtual void reset_local_to_scene(); + virtual void reset_local_to_scene(); ///< Restores the state as if setup_local_to_scene() hadn't been called. GDVIRTUAL0(_setup_local_to_scene); GDVIRTUAL0RC(RID, _get_rid); @@ -125,12 +131,12 @@ class Resource : public RefCounted { virtual Ref _duplicate(const DuplicateParams &p_params) const; public: - static Node *(*_get_local_scene_func)(); // Used by the editor. - static void (*_update_configuration_warning)(); // Used by the editor. + static Node *(*_get_local_scene_func)(); ///< Used by the editor. + static void (*_update_configuration_warning)(); ///< Used by the editor. void update_configuration_warning(); virtual bool editor_can_reload_from_file(); - virtual void reset_state(); // For resources that store state in non-exposed properties, such as via _validate_property or _get_property_list, this function must be implemented to clear them. + virtual void reset_state(); ///< For resources that store state in non-exposed properties, such as via _validate_property or _get_property_list, this function must be implemented to clear them. virtual Error copy_from(const Ref &p_resource); virtual void reload_from_file(); @@ -143,10 +149,12 @@ class Resource : public RefCounted { virtual void set_path(const String &p_path, bool p_take_over = false); String get_path() const; - virtual void set_path_cache(const String &p_path); // Set raw path without involving resource cache. + virtual void set_path_cache(const String &p_path); ///< Set raw path without involving resource cache. _FORCE_INLINE_ bool is_built_in() const { return path_cache.is_empty() || path_cache.contains("::") || path_cache.begins_with("local://"); } static void seed_scene_unique_id(uint32_t p_seed); + /// Generate a unique enough hash, but still user-readable. + /// If it's not unique it does not matter because the saver will try again. static String generate_scene_unique_id(); void set_scene_unique_id(const String &p_id); String get_scene_unique_id() const; @@ -181,9 +189,9 @@ class Resource : public RefCounted { void set_as_translation_remapped(bool p_remapped); - virtual RID get_rid() const; // Some resources may offer conversion to RID. + virtual RID get_rid() const; ///< Some resources may offer conversion to RID. - // Helps keep IDs the same when loading/saving scenes. An empty ID clears the entry, and an empty ID is returned when not found. + /// Helps keep IDs the same when loading/saving scenes. An empty ID clears the entry, and an empty ID is returned when not found. static void set_resource_id_for_path(const String &p_referrer_path, const String &p_resource_path, const String &p_id); void set_id_for_path(const String &p_referrer_path, const String &p_id) { set_resource_id_for_path(p_referrer_path, get_path(), p_id); } String get_id_for_path(const String &p_referrer_path) const; @@ -196,11 +204,11 @@ VARIANT_ENUM_CAST(Resource::DeepDuplicateMode); class ResourceCache { friend class Resource; - friend class ResourceLoader; // Need the lock. + friend class ResourceLoader; ///< Need the lock. static Mutex lock; static HashMap resources; #ifdef TOOLS_ENABLED - static HashMap> resource_path_cache; // Each tscn has a set of resource paths and IDs. + static HashMap> resource_path_cache; ///< Each tscn has a set of resource paths and IDs. static RWLock path_cache_lock; #endif // TOOLS_ENABLED friend void unregister_core_types(); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index be48a077345..987645de53c 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource_format_binary.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "resource_format_binary.h" #include "core/config/project_settings.h" @@ -44,8 +50,8 @@ //#define print_bl(m_what) print_line(m_what) #define print_bl(m_what) (void)(m_what) +// Numbering must be different from variant, in case new variant types are added (variant must be always contiguous for jumptable optimization) enum { - //numbering must be different from variant, in case new variant types are added (variant must be always contiguous for jumptable optimization) VARIANT_NIL = 1, VARIANT_BOOL = 2, VARIANT_INT = 3, diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h index a1efc740975..8b97ba5b0b3 100644 --- a/core/io/resource_format_binary.h +++ b/core/io/resource_format_binary.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource_format_binary.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/file_access.h" @@ -136,7 +142,8 @@ class ResourceFormatSaverBinaryInstance { String magic; HashSet> resource_set; - struct NonPersistentKey { //for resource properties generated on the fly + /// For resource properties generated on the fly + struct NonPersistentKey { Ref base; StringName property; bool operator<(const NonPersistentKey &p_key) const { return base == p_key.base ? property < p_key.property : base < p_key.base; } @@ -172,8 +179,7 @@ class ResourceFormatSaverBinaryInstance { FORMAT_FLAG_REAL_T_IS_DOUBLE = 4, FORMAT_FLAG_HAS_SCRIPT_CLASS = 8, - // Amount of reserved 32-bit fields in resource header - RESERVED_FIELDS = 11 + RESERVED_FIELDS = 11 ///< Amount of reserved 32-bit fields in resource header }; Error save(const String &p_path, const Ref &p_resource, uint32_t p_flags = 0); Error set_uid(const String &p_path, ResourceUID::ID p_uid); diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp index e55816c189f..3c573fa1e27 100644 --- a/core/io/resource_importer.cpp +++ b/core/io/resource_importer.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource_importer.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "resource_importer.h" #include "core/config/project_settings.h" @@ -183,7 +189,7 @@ Ref ResourceFormatImporter::load_internal(const String &p_path, Error } if (p_silence_errors) { - // Note: Some importers do not create files in the .godot folder, so we need to check if the path is empty. + /// @note Some importers do not create files in the .godot folder, so we need to check if the path is empty. if (!pat.path.is_empty() && !FileAccess::exists(pat.path)) { return Ref(); } diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h index 4849fe59b15..e6a1f56806d 100644 --- a/core/io/resource_importer.h +++ b/core/io/resource_importer.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource_importer.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/resource_loader.h" @@ -54,7 +60,7 @@ class ResourceFormatImporter : public ResourceFormatLoader { static inline ResourceFormatImporter *singleton = nullptr; - //need them to stay in order to compute the settings hash + /// Need them to stay in order to compute the settings hash struct SortImporterByName { bool operator()(const Ref &p_a, const Ref &p_b) const; }; diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 433c5aaad37..b012d8b5a09 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource_loader.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "resource_loader.h" #include "core/config/project_settings.h" @@ -222,10 +228,13 @@ void ResourceFormatLoader::_bind_methods() { /////////////////////////////////// -// These are used before and after a wait for a WorkerThreadPool task -// because that can lead to another load started in the same thread, -// something we must treat as a different stack for the purposes -// of tracking nesting. +/** + * @name These are used before and after a wait for a WorkerThreadPool task + * @details Because that can lead to another load started in the same thread, + * something we must treat as a different stack for the purposes + * of tracking nesting. + * @{ + */ #define PREPARE_FOR_WTP_WAIT \ int load_nesting_backup = ResourceLoader::load_nesting; \ @@ -239,8 +248,8 @@ void ResourceFormatLoader::_bind_methods() { ResourceLoader::load_nesting = load_nesting_backup; \ ResourceLoader::load_paths_stack = load_paths_stack_backup; \ load_paths_stack_backup.clear(); +/// @} -// This should be robust enough to be called redundantly without issues. void ResourceLoader::LoadToken::clear() { WorkerThreadPool::TaskID task_to_await = 0; @@ -360,8 +369,6 @@ Ref ResourceLoader::_load(const String &p_path, const String &p_origin ERR_FAIL_V_MSG(Ref(), vformat("No loader found for resource: %s (expected type: %s)", p_path, !p_type_hint.is_empty() ? p_type_hint : "unknown")); } -// This implementation must allow re-entrancy for a task that started awaiting in a deeper stack frame. -// The load task token must be manually re-referenced before this is called, which includes threaded runs. void ResourceLoader::_run_load_task(void *p_userdata) { ThreadLoadTask &load_task = *(ThreadLoadTask *)p_userdata; @@ -944,9 +951,9 @@ Ref ResourceLoader::_load_complete_inner(LoadToken &p_load_token, Erro } bool ResourceLoader::_ensure_load_progress() { - // Some servers may need a new engine iteration to allow the load to progress. - // Since the only known one is the rendering server (in single thread mode), let's keep it simple and just sync it. - // This may be refactored in the future to support other servers and have less coupling. + /// Some servers may need a new engine iteration to allow the load to progress. + /// Since the only known one is the rendering server (in single thread mode), let's keep it simple and just sync it. + /// @todo This may be refactored in the future to support other servers and have less coupling. if (OS::get_singleton()->is_separate_thread_rendering_enabled()) { return false; // Not needed. } @@ -1401,8 +1408,6 @@ void ResourceLoader::clear_translation_remaps() { } void ResourceLoader::clear_thread_load_tasks() { - // Bring the thing down as quickly as possible without causing deadlocks or leaks. - MutexLock thread_load_lock(thread_load_mutex); cleaning_tasks = true; @@ -1485,8 +1490,6 @@ void ResourceLoader::set_create_missing_resources_if_class_unavailable(bool p_en } void ResourceLoader::add_custom_loaders() { - // Custom loaders registration exploits global class names - String custom_loader_base_class = ResourceFormatLoader::get_class_static(); List global_classes; diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h index 29c61da97c2..132826ac32c 100644 --- a/core/io/resource_loader.h +++ b/core/io/resource_loader.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource_loader.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/resource.h" @@ -131,10 +137,10 @@ class ResourceLoader { struct LoadToken : public RefCounted { String local_path; String user_path; - uint32_t user_rc = 0; // Having user RC implies regular RC incremented in one, until the user RC reaches zero. + uint32_t user_rc = 0; ///< Having user RC implies regular RC incremented in one, until the user RC reaches zero. ThreadLoadTask *task_if_unregistered = nullptr; - void clear(); + void clear(); ///< This should be robust enough to be called redundantly without issues. virtual ~LoadToken(); }; @@ -176,10 +182,10 @@ class ResourceLoader { static Ref _find_custom_resource_format_loader(const String &path); struct ThreadLoadTask { - WorkerThreadPool::TaskID task_id = 0; // Used if run on a worker thread from the pool. - Thread::ID thread_id = 0; // Used if running on an user thread (e.g., simple non-threaded load). - bool awaited = false; // If it's in the pool, this helps not awaiting from more than one dependent thread. - ConditionVariable *cond_var = nullptr; // In not in the worker pool or already awaiting, this is used as a secondary awaiting mechanism. + WorkerThreadPool::TaskID task_id = 0; ///< Used if run on a worker thread from the pool. + Thread::ID thread_id = 0; ///< Used if running on an user thread (e.g., simple non-threaded load). + bool awaited = false; ///< If it's in the pool, this helps not awaiting from more than one dependent thread. + ConditionVariable *cond_var = nullptr; ///< In not in the worker pool or already awaiting, this is used as a secondary awaiting mechanism. uint32_t awaiters_count = 0; bool need_wait = true; LoadToken *load_token = nullptr; @@ -203,6 +209,8 @@ class ResourceLoader { LocalVector resource_changed_connections; }; + /// This implementation must allow re-entrancy for a task that started awaiting in a deeper stack frame. + /// The load task token must be manually re-referenced before this is called, which includes threaded runs. static void _run_load_task(void *p_userdata); static thread_local bool import_thread; @@ -260,7 +268,7 @@ class ResourceLoader { static void set_timestamp_on_load(bool p_timestamp) { timestamp_on_load = p_timestamp; } static bool get_timestamp_on_load() { return timestamp_on_load; } - // Loaders can safely use this regardless which thread they are running on. + /// Loaders can safely use this regardless which thread they are running on. static void notify_load_error(const String &p_err) { if (err_notify) { MessageQueue::get_main_singleton()->push_callable(callable_mp_static(err_notify).bind(p_err)); @@ -270,7 +278,7 @@ class ResourceLoader { err_notify = p_err_notify; } - // Loaders can safely use this regardless which thread they are running on. + /// Loaders can safely use this regardless which thread they are running on. static void notify_dependency_error(const String &p_path, const String &p_dependency, const String &p_type) { if (dep_err_notify) { if (Thread::get_caller_id() == Thread::get_main_id()) { @@ -294,13 +302,13 @@ class ResourceLoader { static void load_translation_remaps(); static void clear_translation_remaps(); - static void clear_thread_load_tasks(); + static void clear_thread_load_tasks(); ///< Bring the thing down as quickly as possible without causing deadlocks or leaks. static void set_load_callback(ResourceLoadedCallback p_callback); static ResourceLoaderImport import; static bool add_custom_resource_format_loader(const String &script_path); - static void add_custom_loaders(); + static void add_custom_loaders(); ///< Custom loaders registration exploits global class names static void remove_custom_loaders(); static void set_create_missing_resources_if_class_unavailable(bool p_enable); diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index b0c551abd2e..f3f0f86b7f4 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource_saver.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "resource_saver.h" #include "core/config/project_settings.h" #include "core/io/file_access.h" @@ -253,8 +259,6 @@ bool ResourceSaver::add_custom_resource_format_saver(const String &script_path) } void ResourceSaver::add_custom_savers() { - // Custom resource savers exploits global class names - String custom_saver_base_class = ResourceFormatSaver::get_class_static(); List global_classes; diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h index dc082bed096..92be09c6afc 100644 --- a/core/io/resource_saver.h +++ b/core/io/resource_saver.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource_saver.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/resource.h" @@ -101,6 +107,6 @@ class ResourceSaver { static void set_get_resource_id_for_path(ResourceSaverGetResourceIDForPath p_callback); static bool add_custom_resource_format_saver(const String &script_path); - static void add_custom_savers(); + static void add_custom_savers(); ///< Custom resource savers exploits global class names static void remove_custom_savers(); }; diff --git a/core/io/resource_uid.cpp b/core/io/resource_uid.cpp index 9c5815cc094..c4454e53d46 100644 --- a/core/io/resource_uid.cpp +++ b/core/io/resource_uid.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource_uid.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "resource_uid.h" #include "core/config/project_settings.h" @@ -39,10 +45,13 @@ #include "core/io/resource_loader.h" #include "core/math/random_pcg.h" -// These constants are off by 1, causing the 'z' and '9' characters never to be used. -// This cannot be fixed without breaking compatibility; see GH-83843. +/// @name char_count & base +/// @details These constants are off by 1, causing the 'z' and '9' characters never to be used. +/// This cannot be fixed without breaking compatibility; @see GH-83843. +/// @{ static constexpr uint32_t char_count = ('z' - 'a'); static constexpr uint32_t base = char_count + ('9' - '0'); +/// @} String ResourceUID::get_cache_file() { return ProjectSettings::get_singleton()->get_project_data_path().path_join("uid_cache.bin"); diff --git a/core/io/resource_uid.h b/core/io/resource_uid.h index 9830c5de4ec..2e7afd98a89 100644 --- a/core/io/resource_uid.h +++ b/core/io/resource_uid.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file resource_uid.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/ref_counted.h" @@ -49,14 +55,14 @@ class ResourceUID : public Object { static String get_cache_file(); private: - void *crypto = nullptr; // CryptoCore::RandomGenerator (avoid including crypto_core.h) + void *crypto = nullptr; ///< CryptoCore::RandomGenerator (avoid including crypto_core.h) Mutex mutex; struct Cache { CharString cs; bool saved_to_cache = false; }; - HashMap unique_ids; //unique IDs and utf8 paths (less memory used) + HashMap unique_ids; ///< Unique IDs and utf8 paths (less memory used) static ResourceUID *singleton; uint32_t cache_entries = 0; diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index 88ba27d4dcf..66594ade380 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file stream_peer.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "stream_peer.h" #include "core/io/marshalls.h" @@ -675,8 +681,8 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_ memcpy(p_buffer, r + pointer, r_received); pointer += r_received; - // FIXME: return what? OK or ERR_* - // return OK for now so we don't maybe return garbage + /// @todo FIXME: return what? OK or ERR_* + /// return OK for now so we don't maybe return garbage return OK; } diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h index 62e78832644..fc62a42bc37 100644 --- a/core/io/stream_peer.h +++ b/core/io/stream_peer.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file stream_peer.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/ref_counted.h" @@ -66,7 +72,8 @@ class StreamPeer : public RefCounted { virtual int get_available_bytes() const = 0; - /* helpers */ + /// @name Helpers + /// @{ void set_big_endian(bool p_big_endian); bool is_big_endian_enabled() const; @@ -99,6 +106,7 @@ class StreamPeer : public RefCounted { String get_string(int p_bytes = -1); String get_utf8_string(int p_bytes = -1); Variant get_var(bool p_allow_objects = false); + /// @} StreamPeer() {} }; diff --git a/core/io/stream_peer_gzip.cpp b/core/io/stream_peer_gzip.cpp index c8ad401a2c4..9d993b8dd91 100644 --- a/core/io/stream_peer_gzip.cpp +++ b/core/io/stream_peer_gzip.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file stream_peer_gzip.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "core/io/stream_peer_gzip.h" #include "core/io/zip_io.h" diff --git a/core/io/stream_peer_gzip.h b/core/io/stream_peer_gzip.h index c4fa804541f..e1136d72a36 100644 --- a/core/io/stream_peer_gzip.h +++ b/core/io/stream_peer_gzip.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file stream_peer_gzip.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/stream_peer.h" @@ -42,7 +48,7 @@ class StreamPeerGZIP : public StreamPeer { GDCLASS(StreamPeerGZIP, StreamPeer); private: - void *ctx = nullptr; // Will hold our z_stream instance. + void *ctx = nullptr; ///< Will hold our z_stream instance. bool compressing = true; RingBuffer rb; diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 346a35432d3..c15780cde2c 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file stream_peer_tcp.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "stream_peer_tcp.h" #include "core/config/project_settings.h" diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h index 1ac3ccded50..80a78967c67 100644 --- a/core/io/stream_peer_tcp.h +++ b/core/io/stream_peer_tcp.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file stream_peer_tcp.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/ip.h" @@ -76,17 +82,19 @@ class StreamPeerTCP : public StreamPeer { void set_no_delay(bool p_enabled); - // Poll socket updating its state. + /// Poll socket updating its state. Error poll(); - // Wait or check for writable, readable. + /// Wait or check for writable, readable. Error wait(NetSocket::PollType p_type, int p_timeout = 0); - // Read/Write from StreamPeer + /// @name Read/Write from StreamPeer + /// @{ Error put_data(const uint8_t *p_data, int p_bytes) override; Error put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) override; Error get_data(uint8_t *p_buffer, int p_bytes) override; Error get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) override; + /// @} StreamPeerTCP(); ~StreamPeerTCP(); diff --git a/core/io/stream_peer_tls.cpp b/core/io/stream_peer_tls.cpp index 86dee63b9fb..374d808ecd8 100644 --- a/core/io/stream_peer_tls.cpp +++ b/core/io/stream_peer_tls.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file stream_peer_tls.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "stream_peer_tls.h" #include "core/config/engine.h" diff --git a/core/io/stream_peer_tls.h b/core/io/stream_peer_tls.h index cac23f2bc4b..77fa9726372 100644 --- a/core/io/stream_peer_tls.h +++ b/core/io/stream_peer_tls.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file stream_peer_tls.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/crypto/crypto.h" diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp index bbca4ba1e88..524df130fef 100644 --- a/core/io/tcp_server.cpp +++ b/core/io/tcp_server.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file tcp_server.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "tcp_server.h" void TCPServer::_bind_methods() { diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h index 3c9ff72876d..80b4062c87e 100644 --- a/core/io/tcp_server.h +++ b/core/io/tcp_server.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file tcp_server.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/ip.h" @@ -55,7 +61,7 @@ class TCPServer : public RefCounted { bool is_connection_available() const; Ref take_connection(); - void stop(); // Stop listening + void stop(); ///< Stop listening TCPServer(); ~TCPServer(); diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index 1f463e0066e..723028a4e7b 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file translation_loader_po.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "translation_loader_po.h" #include "core/io/file_access.h" diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h index 7c1ea5642ac..988da75c1fd 100644 --- a/core/io/translation_loader_po.h +++ b/core/io/translation_loader_po.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file translation_loader_po.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/file_access.h" diff --git a/core/io/udp_server.cpp b/core/io/udp_server.cpp index 1a092327c50..bc0a23c870b 100644 --- a/core/io/udp_server.cpp +++ b/core/io/udp_server.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file udp_server.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "udp_server.h" void UDPServer::_bind_methods() { diff --git a/core/io/udp_server.h b/core/io/udp_server.h index 6c9c1dbe478..05785d17a2c 100644 --- a/core/io/udp_server.h +++ b/core/io/udp_server.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file udp_server.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/net_socket.h" diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 8b507ad87cd..a79b6d9fa1c 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file xml_parser.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "xml_parser.h" #include "core/io/file_access.h" @@ -40,7 +46,6 @@ static inline bool _is_white_space(char c) { return (c == ' ' || c == '\t' || c == '\n' || c == '\r'); } -//! sets the state that text was found. Returns true if set should be set bool XMLParser::_set_text(const char *start, const char *end) { // check if text is more than 2 characters, and if not, check if there is // only white space, so that this text won't be reported diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h index 9b87bb72650..a7b1b305bcb 100644 --- a/core/io/xml_parser.h +++ b/core/io/xml_parser.h @@ -30,16 +30,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file xml_parser.h + * + * @brief Based on irrXML (see their zlib license). Added mainly for compatibility with their Collada loader. + */ + #pragma once #include "core/object/ref_counted.h" #include "core/string/ustring.h" #include "core/templates/vector.h" -/* - Based on irrXML (see their zlib license). Added mainly for compatibility with their Collada loader. -*/ - class XMLParser : public RefCounted { GDCLASS(XMLParser, RefCounted); @@ -82,7 +84,7 @@ class XMLParser : public RefCounted { Vector attributes; - bool _set_text(const char *start, const char *end); + bool _set_text(const char *start, const char *end); ///< Sets the state that text was found. @return `true` if set should be set void _parse_closing_xml_element(); void _ignore_definition(); bool _parse_cdata(); @@ -110,7 +112,7 @@ class XMLParser : public RefCounted { String get_attribute_value(int p_idx) const; bool has_attribute(const String &p_name) const; String get_named_attribute_value(const String &p_name) const; - String get_named_attribute_value_safe(const String &p_name) const; // do not print error if doesn't exist + String get_named_attribute_value_safe(const String &p_name) const; ///< Do not print error if doesn't exist bool is_empty() const; int get_current_line() const; diff --git a/core/io/zip_io.cpp b/core/io/zip_io.cpp index 7e66304d634..ec177872fb3 100644 --- a/core/io/zip_io.cpp +++ b/core/io/zip_io.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file zip_io.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "zip_io.h" #include "core/templates/local_vector.h" diff --git a/core/io/zip_io.h b/core/io/zip_io.h index c212e4c21cb..1e429023654 100644 --- a/core/io/zip_io.h +++ b/core/io/zip_io.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file zip_io.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/io/file_access.h" @@ -40,7 +46,7 @@ #include "thirdparty/minizip/unzip.h" #include "thirdparty/minizip/zip.h" -// Get the current file info and safely convert the full filepath to a String. +/// Get the current file info and safely convert the full filepath to a String. int godot_unzip_get_current_file_info(unzFile p_zip_file, unz_file_info64 &r_file_info, String &r_filepath); // Try to locate the file in the archive specified by the filepath (works with large paths and Unicode). int godot_unzip_locate_file(unzFile p_zip_file, const String &p_filepath, bool p_case_sensitive = true); diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 9d36a54c51f..a8129b252e7 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file a_star.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "a_star.h" #include "a_star.compat.inc" diff --git a/core/math/a_star.h b/core/math/a_star.h index 1f522cfa219..810420943b5 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -30,16 +30,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file a_star.h + * + * @brief A* pathfinding algorithm. + */ + #pragma once #include "core/object/gdvirtual.gen.inc" #include "core/object/ref_counted.h" #include "core/templates/a_hash_map.h" -/** - A* pathfinding algorithm. -*/ - class AStar3D : public RefCounted { GDCLASS(AStar3D, RefCounted); friend class AStar2D; @@ -55,20 +57,20 @@ class AStar3D : public RefCounted { AHashMap neighbors = 4u; AHashMap unlinked_neighbours = 4u; - // Used for pathfinding. + /// Used for pathfinding. Point *prev_point = nullptr; real_t g_score = 0; real_t f_score = 0; uint64_t open_pass = 0; uint64_t closed_pass = 0; - // Used for getting closest_point_of_last_pathing_call. + /// Used for getting closest_point_of_last_pathing_call. real_t abs_g_score = 0; real_t abs_f_score = 0; }; struct SortPoints { - _FORCE_INLINE_ bool operator()(const Point *A, const Point *B) const { // Returns true when the Point A is worse than Point B. + _FORCE_INLINE_ bool operator()(const Point *A, const Point *B) const { ///< Returns true when the Point A is worse than Point B. if (A->f_score > B->f_score) { return true; } else if (A->f_score < B->f_score) { diff --git a/core/math/a_star_grid_2d.cpp b/core/math/a_star_grid_2d.cpp index 9044e5d6051..ea1de257391 100644 --- a/core/math/a_star_grid_2d.cpp +++ b/core/math/a_star_grid_2d.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file a_star_grid_2d.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "a_star_grid_2d.h" #include "a_star_grid_2d.compat.inc" @@ -555,7 +561,7 @@ bool AStarGrid2D::_solve(Point *p_begin_point, Point *p_end_point, bool p_allow_ real_t weight_scale = 1.0; if (jumping_enabled) { - // TODO: Make it works with weight_scale. + /// @todo Make it work with weight_scale. e = _jump(p, e); if (!e || e->closed_pass == pass) { continue; diff --git a/core/math/a_star_grid_2d.h b/core/math/a_star_grid_2d.h index 3363042a0c1..a9969996ec3 100644 --- a/core/math/a_star_grid_2d.h +++ b/core/math/a_star_grid_2d.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file a_star_grid_2d.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/gdvirtual.gen.inc" @@ -82,14 +88,14 @@ class AStarGrid2D : public RefCounted { Vector2 pos; real_t weight_scale = 1.0; - // Used for pathfinding. + /// Used for pathfinding. Point *prev_point = nullptr; real_t g_score = 0; real_t f_score = 0; uint64_t open_pass = 0; uint64_t closed_pass = 0; - // Used for getting last_closest_point. + /// Used for getting last_closest_point. real_t abs_g_score = 0; real_t abs_f_score = 0; @@ -100,7 +106,7 @@ class AStarGrid2D : public RefCounted { }; struct SortPoints { - _FORCE_INLINE_ bool operator()(const Point *A, const Point *B) const { // Returns true when the Point A is worse than Point B. + _FORCE_INLINE_ bool operator()(const Point *A, const Point *B) const { ///< Returns true when the Point A is worse than Point B. if (A->f_score > B->f_score) { return true; } else if (A->f_score < B->f_score) { diff --git a/core/math/aabb.cpp b/core/math/aabb.cpp index 7674af5c5bc..24d3f831f6c 100644 --- a/core/math/aabb.cpp +++ b/core/math/aabb.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file aabb.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "aabb.h" #include "core/string/ustring.h" diff --git a/core/math/aabb.h b/core/math/aabb.h index be171fef39f..859095081b2 100644 --- a/core/math/aabb.h +++ b/core/math/aabb.h @@ -30,16 +30,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file aabb.h + * + * @brief AABB (Axis Aligned Bounding Box) + * @details This is implemented by a point (position) and the box size. + */ + #pragma once #include "core/math/plane.h" #include "core/math/vector3.h" -/** - * AABB (Axis Aligned Bounding Box) - * This is implemented by a point (position) and the box size. - */ - class Variant; struct [[nodiscard]] AABB { @@ -70,13 +72,13 @@ struct [[nodiscard]] AABB { bool is_equal_approx(const AABB &p_aabb) const; bool is_same(const AABB &p_aabb) const; bool is_finite() const; - _FORCE_INLINE_ bool intersects(const AABB &p_aabb) const; /// Both AABBs overlap - _FORCE_INLINE_ bool intersects_inclusive(const AABB &p_aabb) const; /// Both AABBs (or their faces) overlap - _FORCE_INLINE_ bool encloses(const AABB &p_aabb) const; /// p_aabb is completely inside this + _FORCE_INLINE_ bool intersects(const AABB &p_aabb) const; ///< Both AABBs overlap + _FORCE_INLINE_ bool intersects_inclusive(const AABB &p_aabb) const; ///< Both AABBs (or their faces) overlap + _FORCE_INLINE_ bool encloses(const AABB &p_aabb) const; ///< p_aabb is completely inside this AABB merge(const AABB &p_with) const; - void merge_with(const AABB &p_aabb); ///merge with another AABB - AABB intersection(const AABB &p_aabb) const; ///get box where two intersect, empty if no intersection occurs + void merge_with(const AABB &p_aabb); ///< Merge with another AABB + AABB intersection(const AABB &p_aabb) const; ///< Get box where two intersect, empty if no intersection occurs _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t p_t0, real_t p_t1) const; bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_intersection_point = nullptr, Vector3 *r_normal = nullptr) const; @@ -271,8 +273,7 @@ bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count, con } } - // Make sure all points in the shape aren't fully separated from the AABB on - // each axis. + // Make sure all points in the shape aren't fully separated from the AABB on each axis. int bad_point_counts_positive[3] = { 0 }; int bad_point_counts_negative[3] = { 0 }; diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h index af24669e393..8a1f98dd3d8 100644 --- a/core/math/audio_frame.h +++ b/core/math/audio_frame.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file audio_frame.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/vector2.h" @@ -49,7 +55,7 @@ static _FORCE_INLINE_ float undenormalize(float f) { } static const float AUDIO_PEAK_OFFSET = 0.0000000001f; -static const float AUDIO_MIN_PEAK_DB = -200.0f; // linear_to_db(AUDIO_PEAK_OFFSET) +static const float AUDIO_MIN_PEAK_DB = -200.0f; ///< linear_to_db(AUDIO_PEAK_OFFSET) struct AudioFrame { // Left and right samples. diff --git a/core/math/basis.cpp b/core/math/basis.cpp index 3a85505f234..83752a498b5 100644 --- a/core/math/basis.cpp +++ b/core/math/basis.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file basis.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "basis.h" #include "core/math/math_funcs.h" @@ -56,8 +62,6 @@ void Basis::invert() { } void Basis::orthonormalize() { - // Gram-Schmidt Process - Vector3 x = get_column(0); Vector3 y = get_column(1); Vector3 z = get_column(2); @@ -91,8 +95,6 @@ Basis Basis::orthogonalized() const { return c; } -// Returns true if the basis vectors are orthogonal (perpendicular), so it has no skew or shear, and can be decomposed into rotation and scale. -// See https://en.wikipedia.org/wiki/Orthogonal_basis bool Basis::is_orthogonal() const { const Vector3 x = get_column(0); const Vector3 y = get_column(1); @@ -100,8 +102,6 @@ bool Basis::is_orthogonal() const { return Math::is_zero_approx(x.dot(y)) && Math::is_zero_approx(x.dot(z)) && Math::is_zero_approx(y.dot(z)); } -// Returns true if the basis vectors are orthonormal (orthogonal and normalized), so it has no scale, skew, or shear. -// See https://en.wikipedia.org/wiki/Orthonormal_basis bool Basis::is_orthonormal() const { const Vector3 x = get_column(0); const Vector3 y = get_column(1); @@ -109,8 +109,6 @@ bool Basis::is_orthonormal() const { return Math::is_equal_approx(x.length_squared(), 1) && Math::is_equal_approx(y.length_squared(), 1) && Math::is_equal_approx(z.length_squared(), 1) && Math::is_zero_approx(x.dot(y)) && Math::is_zero_approx(x.dot(z)) && Math::is_zero_approx(y.dot(z)); } -// Returns true if the basis is conformal (orthogonal, uniform scale, preserves angles and distance ratios). -// See https://en.wikipedia.org/wiki/Conformal_linear_transformation bool Basis::is_conformal() const { const Vector3 x = get_column(0); const Vector3 y = get_column(1); @@ -119,7 +117,6 @@ bool Basis::is_conformal() const { return Math::is_equal_approx(x_len_sq, y.length_squared()) && Math::is_equal_approx(x_len_sq, z.length_squared()) && Math::is_zero_approx(x.dot(y)) && Math::is_zero_approx(x.dot(z)) && Math::is_zero_approx(y.dot(z)); } -// Returns true if the basis only has diagonal elements, so it may only have scale or flip, but no rotation, skew, or shear. bool Basis::is_diagonal() const { return ( Math::is_zero_approx(rows[0][1]) && Math::is_zero_approx(rows[0][2]) && @@ -127,13 +124,12 @@ bool Basis::is_diagonal() const { Math::is_zero_approx(rows[2][0]) && Math::is_zero_approx(rows[2][1])); } -// Returns true if the basis is a pure rotation matrix, so it has no scale, skew, shear, or flip. bool Basis::is_rotation() const { return is_conformal() && Math::is_equal_approx(determinant(), 1, (real_t)UNIT_EPSILON); } #ifdef MATH_CHECKS -// This method is only used once, in diagonalize. If it's desired elsewhere, feel free to remove the #ifdef. + bool Basis::is_symmetric() const { if (!Math::is_equal_approx(rows[0][1], rows[1][0])) { return false; @@ -150,8 +146,6 @@ bool Basis::is_symmetric() const { #endif Basis Basis::diagonalize() { -// NOTE: only implemented for symmetric matrices -// with the Jacobi iterative method #ifdef MATH_CHECKS ERR_FAIL_COND_V(!is_symmetric(), Basis()); #endif @@ -231,8 +225,6 @@ Basis Basis::from_scale(const Vector3 &p_scale) { return Basis(p_scale.x, 0, 0, 0, p_scale.y, 0, 0, 0, p_scale.z); } -// Multiplies the matrix from left by the scaling matrix: M -> S.M -// See the comment for Basis::rotated for further explanation. void Basis::scale(const Vector3 &p_scale) { rows[0] *= p_scale.x; rows[1] *= p_scale.y; @@ -246,8 +238,6 @@ Basis Basis::scaled(const Vector3 &p_scale) const { } void Basis::scale_local(const Vector3 &p_scale) { - // performs a scaling in object-local coordinate system: - // M -> (M.S.Minv).M = M.S. rows[0] *= p_scale; rows[1] *= p_scale; rows[2] *= p_scale; @@ -298,35 +288,33 @@ Vector3 Basis::get_scale_global() const { return det_sign * Vector3(rows[0].length(), rows[1].length(), rows[2].length()); } -// get_scale works with get_rotation, use get_scale_abs if you need to enforce positive signature. Vector3 Basis::get_scale() const { - // FIXME: We are assuming M = R.S (R is rotation and S is scaling), and use polar decomposition to extract R and S. - // A polar decomposition is M = O.P, where O is an orthogonal matrix (meaning rotation and reflection) and - // P is a positive semi-definite matrix (meaning it contains absolute values of scaling along its diagonal). - // - // Despite being different from what we want to achieve, we can nevertheless make use of polar decomposition - // here as follows. We can split O into a rotation and a reflection as O = R.Q, and obtain M = R.S where - // we defined S = Q.P. Now, R is a proper rotation matrix and S is a (signed) scaling matrix, - // which can involve negative scalings. However, there is a catch: unlike the polar decomposition of M = O.P, - // the decomposition of O into a rotation and reflection matrix as O = R.Q is not unique. - // Therefore, we are going to do this decomposition by sticking to a particular convention. - // This may lead to confusion for some users though. - // - // The convention we use here is to absorb the sign flip into the scaling matrix. - // The same convention is also used in other similar functions such as get_rotation_axis_angle, get_rotation, ... - // - // A proper way to get rid of this issue would be to store the scaling values (or at least their signs) - // as a part of Basis. However, if we go that path, we need to disable direct (write) access to the - // matrix elements. - // - // The rotation part of this decomposition is returned by get_rotation* functions. + /** + * @todo FIXME: We are assuming M = R.S (R is rotation and S is scaling), and use polar decomposition to extract R and S. + * A polar decomposition is M = O.P, where O is an orthogonal matrix (meaning rotation and reflection) and + * P is a positive semi-definite matrix (meaning it contains absolute values of scaling along its diagonal). + * + * Despite being different from what we want to achieve, we can nevertheless make use of polar decomposition + * here as follows. We can split O into a rotation and a reflection as O = R.Q, and obtain M = R.S where + * we defined S = Q.P. Now, R is a proper rotation matrix and S is a (signed) scaling matrix, + * which can involve negative scalings. However, there is a catch: unlike the polar decomposition of M = O.P, + * the decomposition of O into a rotation and reflection matrix as O = R.Q is not unique. + * Therefore, we are going to do this decomposition by sticking to a particular convention. + * This may lead to confusion for some users though. + * + * The convention we use here is to absorb the sign flip into the scaling matrix. + * The same convention is also used in other similar functions such as get_rotation_axis_angle, get_rotation, ... + * + * A proper way to get rid of this issue would be to store the scaling values (or at least their signs) + * as a part of Basis. However, if we go that path, we need to disable direct (write) access to the + * matrix elements. + * + * The rotation part of this decomposition is returned by get_rotation* functions. + */ real_t det_sign = SIGN(determinant()); return det_sign * get_scale_abs(); } -// Decomposes a Basis into a rotation-reflection matrix (an element of the group O(3)) and a positive scaling matrix as B = O.S. -// Returns the rotation-reflection matrix via reference argument, and scaling information is returned as a Vector3. -// This (internal) function is too specific and named too ugly to expose to users, and probably there's no need to do so. Vector3 Basis::rotref_posscale_decomposition(Basis &rotref) const { #ifdef MATH_CHECKS ERR_FAIL_COND_V(determinant() == 0, Vector3()); @@ -344,12 +332,6 @@ Vector3 Basis::rotref_posscale_decomposition(Basis &rotref) const { return scale.abs(); } -// Multiplies the matrix from left by the rotation matrix: M -> R.M -// Note that this does *not* rotate the matrix itself. -// -// The main use of Basis is as Transform.basis, which is used by the transformation matrix -// of 3D object. Rotate here refers to rotation of the object (which is R * (*this)), -// not the matrix itself (which is R * (*this) * R.transposed()). Basis Basis::rotated(const Vector3 &p_axis, real_t p_angle) const { return Basis(p_axis, p_angle) * (*this); } @@ -359,8 +341,6 @@ void Basis::rotate(const Vector3 &p_axis, real_t p_angle) { } void Basis::rotate_local(const Vector3 &p_axis, real_t p_angle) { - // performs a rotation in object-local coordinate system: - // M -> (M.R.Minv).M = M.R. *this = rotated_local(p_axis, p_angle); } @@ -385,9 +365,6 @@ void Basis::rotate(const Quaternion &p_quaternion) { } Vector3 Basis::get_euler_normalized(EulerOrder p_order) const { - // Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S, - // and returns the Euler angles corresponding to the rotation part, complementing get_scale(). - // See the comment in get_scale() for further information. Basis m = orthonormalized(); real_t det = m.determinant(); if (det < 0) { @@ -399,9 +376,6 @@ Vector3 Basis::get_euler_normalized(EulerOrder p_order) const { } Quaternion Basis::get_rotation_quaternion() const { - // Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S, - // and returns the Euler angles corresponding to the rotation part, complementing get_scale(). - // See the comment in get_scale() for further information. Basis m = orthonormalized(); real_t det = m.determinant(); if (det < 0) { @@ -413,8 +387,6 @@ Quaternion Basis::get_rotation_quaternion() const { } void Basis::rotate_to_align(Vector3 p_start_direction, Vector3 p_end_direction) { - // Takes two vectors and rotates the basis from the first vector to the second vector. - // Adopted from: https://gist.github.com/kevinmoran/b45980723e53edeb8a5a43c49f134724 const Vector3 axis = p_start_direction.cross(p_end_direction).normalized(); if (axis.length_squared() != 0) { real_t dot = p_start_direction.dot(p_end_direction); @@ -425,9 +397,6 @@ void Basis::rotate_to_align(Vector3 p_start_direction, Vector3 p_end_direction) } void Basis::get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const { - // Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S, - // and returns the Euler angles corresponding to the rotation part, complementing get_scale(). - // See the comment in get_scale() for further information. Basis m = orthonormalized(); real_t det = m.determinant(); if (det < 0) { @@ -439,9 +408,6 @@ void Basis::get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const { } void Basis::get_rotation_axis_angle_local(Vector3 &p_axis, real_t &p_angle) const { - // Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S, - // and returns the Euler angles corresponding to the rotation part, complementing get_scale(). - // See the comment in get_scale() for further information. Basis m = transposed(); m.orthonormalize(); real_t det = m.determinant(); @@ -455,9 +421,6 @@ void Basis::get_rotation_axis_angle_local(Vector3 &p_axis, real_t &p_angle) cons } Vector3 Basis::get_euler(EulerOrder p_order) const { - // This epsilon value results in angles within a +/- 0.04 degree range being simplified/truncated. - // Based on testing, this is the largest the epsilon can be without the angle truncation becoming - // visually noticeable. const real_t epsilon = 0.00000025; switch (p_order) { @@ -884,8 +847,6 @@ void Basis::set_quaternion_scale(const Quaternion &p_quaternion, const Vector3 & rotate(p_quaternion); } -// This also sets the non-diagonal elements to 0, which is misleading from the -// name, so we want this method to be private. Use `from_scale` externally. void Basis::_set_diagonal(const Vector3 &p_diag) { rows[0][0] = p_diag.x; rows[0][1] = 0; @@ -923,10 +884,6 @@ Basis Basis::slerp(const Basis &p_to, real_t p_weight) const { } void Basis::rotate_sh(real_t *p_values) { - // code by John Hable - // http://filmicworlds.com/blog/simple-and-fast-spherical-harmonic-rotation/ - // this code is Public Domain - const static real_t s_c3 = 0.94617469575; // (3*sqrt(5))/(4*sqrt(pi)) const static real_t s_c4 = -0.31539156525; // (-sqrt(5))/(4*sqrt(pi)) const static real_t s_c5 = 0.54627421529; // (sqrt(15))/(4*sqrt(pi)) diff --git a/core/math/basis.h b/core/math/basis.h index 10fba3346c9..a825667464d 100644 --- a/core/math/basis.h +++ b/core/math/basis.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file basis.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/quaternion.h" @@ -58,8 +64,16 @@ struct [[nodiscard]] Basis { _FORCE_INLINE_ real_t determinant() const; void rotate(const Vector3 &p_axis, real_t p_angle); + /// Multiplies the matrix from left by the rotation matrix: M -> R.M + /// Note that this does *not* rotate the matrix itself. + /// + /// The main use of Basis is as Transform.basis, which is used by the transformation matrix + /// of 3D object. Rotate here refers to rotation of the object (which is R * (*this)), + /// not the matrix itself (which is R * (*this) * R.transposed()). Basis rotated(const Vector3 &p_axis, real_t p_angle) const; + /// Performs a rotation in object-local coordinate system: + /// M -> (M.R.Minv).M = M.R. void rotate_local(const Vector3 &p_axis, real_t p_angle); Basis rotated_local(const Vector3 &p_axis, real_t p_angle) const; @@ -69,15 +83,36 @@ struct [[nodiscard]] Basis { void rotate(const Quaternion &p_quaternion); Basis rotated(const Quaternion &p_quaternion) const; + /// Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S, + /// and returns the Euler angles corresponding to the rotation part, complementing get_scale(). + /// @see The comment in get_scale() for further information. Vector3 get_euler_normalized(EulerOrder p_order = EulerOrder::YXZ) const; + /// Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S, + /// and returns the Euler angles corresponding to the rotation part, complementing get_scale(). + /// @see The comment in get_scale() for further information. void get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const; + /// Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S, + /// and returns the Euler angles corresponding to the rotation part, complementing get_scale(). + /// @see The comment in get_scale() for further information. void get_rotation_axis_angle_local(Vector3 &p_axis, real_t &p_angle) const; + + /// Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S, + /// and returns the Euler angles corresponding to the rotation part, complementing get_scale(). + /// See the comment in get_scale() for further information. Quaternion get_rotation_quaternion() const; + /// Takes two vectors and rotates the basis from the first vector to the second vector. + /// Adopted from: https://gist.github.com/kevinmoran/b45980723e53edeb8a5a43c49f134724 void rotate_to_align(Vector3 p_start_direction, Vector3 p_end_direction); + /// Decomposes a Basis into a rotation-reflection matrix (an element of the group O(3)) and a positive scaling matrix as B = O.S. + /// @return The rotation-reflection matrix via reference argument, and scaling information is returned as a Vector3. + /// This (internal) function is too specific and named too ugly to expose to users, and probably there's no need to do so. Vector3 rotref_posscale_decomposition(Basis &rotref) const; + /// This epsilon value results in angles within a +/- 0.04 degree range being simplified/truncated. + /// Based on testing, this is the largest the epsilon can be without the angle truncation becoming + /// visually noticeable. Vector3 get_euler(EulerOrder p_order = EulerOrder::YXZ) const; void set_euler(const Vector3 &p_euler, EulerOrder p_order = EulerOrder::YXZ); static Basis from_euler(const Vector3 &p_euler, EulerOrder p_order = EulerOrder::YXZ) { @@ -91,10 +126,13 @@ struct [[nodiscard]] Basis { void get_axis_angle(Vector3 &r_axis, real_t &r_angle) const; void set_axis_angle(const Vector3 &p_axis, real_t p_angle); - + /// Multiplies the matrix from left by the scaling matrix: M -> S.M + /// @see The comment for Basis::rotated for further explanation. void scale(const Vector3 &p_scale); Basis scaled(const Vector3 &p_scale) const; + /// Performs a scaling in object-local coordinate system: + /// M -> (M.S.Minv).M = M.S. void scale_local(const Vector3 &p_scale); Basis scaled_local(const Vector3 &p_scale) const; @@ -102,6 +140,7 @@ struct [[nodiscard]] Basis { Basis scaled_orthogonal(const Vector3 &p_scale) const; real_t get_uniform_scale() const; + /// get_scale works with get_rotation, use get_scale_abs if you need to enforce positive signature. Vector3 get_scale() const; Vector3 get_scale_abs() const; Vector3 get_scale_global() const; @@ -110,7 +149,8 @@ struct [[nodiscard]] Basis { void set_euler_scale(const Vector3 &p_euler, const Vector3 &p_scale, EulerOrder p_order = EulerOrder::YXZ); void set_quaternion_scale(const Quaternion &p_quaternion, const Vector3 &p_scale); - // transposed dot products + /// @name Transposed dot products + /// @{ _FORCE_INLINE_ real_t tdotx(const Vector3 &p_v) const { return rows[0][0] * p_v[0] + rows[1][0] * p_v[1] + rows[2][0] * p_v[2]; } @@ -120,6 +160,7 @@ struct [[nodiscard]] Basis { _FORCE_INLINE_ real_t tdotz(const Vector3 &p_v) const { return rows[0][2] * p_v[0] + rows[1][2] * p_v[1] + rows[2][2] * p_v[2]; } + /// @} bool is_equal_approx(const Basis &p_basis) const; bool is_same(const Basis &p_basis) const; @@ -141,14 +182,25 @@ struct [[nodiscard]] Basis { constexpr void operator/=(real_t p_val); constexpr Basis operator/(real_t p_val) const; + /// @return `true` if the basis vectors are orthogonal (perpendicular), so it has no skew or shear, and can be decomposed into rotation and scale. + /// @see https://en.wikipedia.org/wiki/Orthogonal_basis bool is_orthogonal() const; + /// @return `true` if the basis vectors are orthonormal (orthogonal and normalized), so it has no scale, skew, or shear. + /// @see https://en.wikipedia.org/wiki/Orthonormal_basis bool is_orthonormal() const; + /// @return `true` if the basis is conformal (orthogonal, uniform scale, preserves angles and distance ratios). + /// @see https://en.wikipedia.org/wiki/Conformal_linear_transformation bool is_conformal() const; + /// @return `true` if the basis only has diagonal elements, so it may only have scale or flip, but no rotation, skew, or shear. bool is_diagonal() const; + /// @return `true` if the basis is a pure rotation matrix, so it has no scale, skew, shear, or flip. bool is_rotation() const; Basis lerp(const Basis &p_to, real_t p_weight) const; Basis slerp(const Basis &p_to, real_t p_weight) const; + /// Code by John Hable + /// http://filmicworlds.com/blog/simple-and-fast-spherical-harmonic-rotation/ + /// @copyright This code is Public Domain void rotate_sh(real_t *p_values); explicit operator String() const; @@ -172,13 +224,13 @@ struct [[nodiscard]] Basis { set_column(2, p_z); } + /// Get actual basis axis column (we store transposed as rows for performance). _FORCE_INLINE_ Vector3 get_column(int p_index) const { - // Get actual basis axis column (we store transposed as rows for performance). return Vector3(rows[0][p_index], rows[1][p_index], rows[2][p_index]); } + /// Set actual basis axis column (we store transposed as rows for performance). _FORCE_INLINE_ void set_column(int p_index, const Vector3 &p_value) { - // Set actual basis axis column (we store transposed as rows for performance). rows[0][p_index] = p_value.x; rows[1][p_index] = p_value.y; rows[2][p_index] = p_value.z; @@ -213,15 +265,17 @@ struct [[nodiscard]] Basis { { p_zx, p_zy, p_zz }, } {} - void orthonormalize(); + void orthonormalize(); ///< Gram-Schmidt Process Basis orthonormalized() const; void orthogonalize(); Basis orthogonalized() const; #ifdef MATH_CHECKS + /// This method is only used once, in diagonalize. If it's desired elsewhere, feel free to remove the #ifdef. bool is_symmetric() const; #endif + /// @note Only implemented for symmetric matrices with the Jacobi iterative method Basis diagonalize(); operator Quaternion() const { return get_quaternion(); } @@ -245,7 +299,9 @@ struct [[nodiscard]] Basis { Basis() = default; private: - // Helper method. + /// @brief Helper Method + /// @details This also sets the non-diagonal elements to 0, which is misleading from the + /// name, so we want this method to be private. Use `from_scale` externally. void _set_diagonal(const Vector3 &p_diag); }; diff --git a/core/math/bvh.h b/core/math/bvh.h index 4fb2c21b268..ef0a28d30ec 100644 --- a/core/math/bvh.h +++ b/core/math/bvh.h @@ -30,27 +30,30 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -// BVH -// This class provides a wrapper around BVH tree, which contains most of the functionality -// for a dynamic BVH with templated leaf size. -// However BVH also adds facilities for pairing, to maintain compatibility with Godot 3.2. -// Pairing is a collision pairing system, on top of the basic BVH. - -// Some notes on the use of BVH / Octree from Godot 3.2. -// This is not well explained elsewhere. -// The rendering tree mask and types that are sent to the BVH are NOT layer masks. -// They are INSTANCE_TYPES (defined in visual_server.h), e.g. MESH, MULTIMESH, PARTICLES etc. -// Thus the lights do no cull by layer mask in the BVH. - -// Layer masks are implemented in the renderers as a later step, and light_cull_mask appears to be -// implemented in GLES3 but not GLES2. Layer masks are not yet implemented for directional lights. +/** + * @file bvh.h + * + * @brief This class provides a wrapper around BVH tree, which contains most of the functionality for a dynamic BVH with templated leaf size. + * + * @details However BVH also adds facilities for pairing, to maintain compatibility with Godot 3.2. + * Pairing is a collision pairing system, on top of the basic BVH. + * + * Some notes on the use of BVH / Octree from Godot 3.2. + * This is not well explained elsewhere. + * The rendering tree mask and types that are sent to the BVH are NOT layer masks. + * They are INSTANCE_TYPES (defined in visual_server.h), e.g. MESH, MULTIMESH, PARTICLES etc. + * Thus the lights do no cull by layer mask in the BVH. + * + * Layer masks are implemented in the renderers as a later step, and light_cull_mask appears to be + * implemented in GLES3 but not GLES2. Layer masks are not yet implemented for directional lights. + * + * In the physics, the pairable_type is based on 1 << p_object->get_type() where: + * TYPE_AREA, + * TYPE_BODY + * and pairable_mask is either 0 if static, or set to all if non static + */ -// In the physics, the pairable_type is based on 1 << p_object->get_type() where: -// TYPE_AREA, -// TYPE_BODY -// and pairable_mask is either 0 if static, or set to all if non static +#pragma once #include "bvh_tree.h" @@ -63,19 +66,20 @@ template , typename USER_CULL_TEST_FUNCTION = BVH_DummyCullTestFunction, typename BOUNDS = AABB, typename POINT = Vector3, bool BVH_THREAD_SAFE = true> class BVH_Manager { public: - // note we are using uint32_t instead of BVHHandle, losing type safety, but this - // is for compatibility with octree + /// @note We are using uint32_t instead of BVHHandle, losing type safety, but this + /// is for compatibility with octree typedef void *(*PairCallback)(void *, uint32_t, T *, int, uint32_t, T *, int); typedef void (*UnpairCallback)(void *, uint32_t, T *, int, uint32_t, T *, int, void *); typedef void *(*CheckPairCallback)(void *, uint32_t, T *, int, uint32_t, T *, int, void *); - // allow locally toggling thread safety if the template has been compiled with BVH_THREAD_SAFE + /// Allow locally toggling thread safety if the template has been compiled with BVH_THREAD_SAFE void params_set_thread_safe(bool p_enable) { _thread_safe = p_enable; } - // these 2 are crucial for fine tuning, and can be applied manually - // see the variable declarations for more info. + /// @name These 2 are crucial for fine tuning, and can be applied manually + /// @details @see The variable declarations for more info. + /// @{ void params_set_node_expansion(real_t p_value) { BVH_LOCKED_FUNCTION if (p_value >= 0.0) { @@ -90,6 +94,7 @@ class BVH_Manager { BVH_LOCKED_FUNCTION tree.params_set_pairing_expansion(p_value); } + /// @} void set_pair_callback(PairCallback p_callback, void *p_userdata) { BVH_LOCKED_FUNCTION @@ -135,8 +140,9 @@ class BVH_Manager { } //////////////////////////////////////////////////// - // wrapper versions that use uint32_t instead of handle - // for backward compatibility. Less type safe + /// @name Wrapper versions that use uint32_t instead of handle + /// @details For backward compatibility. Less type safe + /// @{ void move(uint32_t p_handle, const BOUNDS &p_aabb) { BVHHandle h; h.set(p_handle); @@ -195,7 +201,7 @@ class BVH_Manager { h.set(p_handle); return item_get_userdata(h); } - + /// @} //////////////////////////////////////////////////// void move(BVHHandle p_handle, const BOUNDS &p_aabb) { @@ -227,9 +233,9 @@ class BVH_Manager { _check_for_collisions(true); } - // use in conjunction with activate if you have deferred the collision check, and - // set pairable has never been called. - // (deferred collision checks are a workaround for visual server for historical reasons) + /// Use in conjunction with activate if you have deferred the collision check, and + /// set pairable has never been called. + /// (deferred collision checks are a workaround for visual server for historical reasons) void force_collision_check(BVHHandle p_handle) { DEV_ASSERT(!p_handle.is_invalid()); BVH_LOCKED_FUNCTION @@ -246,9 +252,10 @@ class BVH_Manager { } } - // these should be read as set_visible for render trees, - // but generically this makes items add or remove from the - // tree internally, to speed things up by ignoring inactive items + /// @name These should be read as set_visible for render trees + /// @details ...but generically this makes items add or remove from the + /// tree internally, to speed things up by ignoring inactive items + /// @{ bool activate(BVHHandle p_handle, const BOUNDS &p_aabb, bool p_delay_collision_check = false) { DEV_ASSERT(!p_handle.is_invalid()); BVH_LOCKED_FUNCTION @@ -292,6 +299,7 @@ class BVH_Manager { return false; } + /// @} bool get_active(BVHHandle p_handle) { DEV_ASSERT(!p_handle.is_invalid()); @@ -299,7 +307,7 @@ class BVH_Manager { return tree.item_get_active(p_handle); } - // call e.g. once per frame (this does a trickle optimize) + /// Call e.g. once per frame (this does a trickle optimize) void update() { BVH_LOCKED_FUNCTION tree.update(); @@ -309,13 +317,13 @@ class BVH_Manager { #endif } - // this can be called more frequently than per frame if necessary + /// This can be called more frequently than per frame if necessary void update_collisions() { BVH_LOCKED_FUNCTION _check_for_collisions(); } - // prefer calling this directly as type safe + /// Prefer calling this directly as type safe void set_tree(const BVHHandle &p_handle, uint32_t p_tree_id, uint32_t p_tree_collision_mask, bool p_force_collision_check = true) { DEV_ASSERT(!p_handle.is_invalid()); BVH_LOCKED_FUNCTION @@ -347,7 +355,8 @@ class BVH_Manager { } } - // cull tests + /// @name Cull tests + /// @{ int cull_aabb(const BOUNDS &p_aabb, T **p_result_array, int p_result_max, const T *p_tester, uint32_t p_tree_collision_mask = 0xFFFFFFFF, int *p_subindex_array = nullptr) { BVH_LOCKED_FUNCTION typename BVHTREE_CLASS::CullParams params; @@ -429,9 +438,10 @@ class BVH_Manager { return params.result_count_overall; } + /// @} private: - // do this after moving etc. + /// Do this after moving etc. void _check_for_collisions(bool p_full_check = false) { if (!changed_items.size()) { // noop @@ -490,10 +500,12 @@ class BVH_Manager { } private: - // supplemental funcs + /// @name Supplemental funcs + /// @{ uint32_t item_get_tree_id(BVHHandle p_handle) const { return _get_extra(p_handle).tree_id; } T *item_get_userdata(BVHHandle p_handle) const { return _get_extra(p_handle).userdata; } int item_get_subindex(BVHHandle p_handle) const { return _get_extra(p_handle).subindex; } + /// @} void _unpair(BVHHandle p_from, BVHHandle p_to) { tree._handle_sort(p_from, p_to); @@ -541,7 +553,7 @@ class BVH_Manager { return p_pair_data; } - // returns true if unpair + /// @return `true` if unpair bool _find_leavers_process_pair(typename BVHTREE_CLASS::ItemPairs &p_pairs_from, const BVHABB_CLASS &p_abb_from, BVHHandle p_from, BVHHandle p_to, bool p_full_check) { BVHABB_CLASS abb_to; tree.item_get_ABB(p_to, abb_to); @@ -573,8 +585,7 @@ class BVH_Manager { return true; } - // find all the existing paired aabbs that are no longer - // paired, and send callbacks + /// Find all the existing paired aabbs that are no longer paired, and send callbacks void _find_leavers(BVHHandle p_handle, const BVHABB_CLASS &expanded_abb_from, bool p_full_check) { typename BVHTREE_CLASS::ItemPairs &p_from = tree._pairs[p_handle.id()]; @@ -592,8 +603,7 @@ class BVH_Manager { } } - // find NEW enterers, and send callbacks for them only - // handle a and b + /// Find NEW enterers, and send callbacks for them only handle a and b void _collide(BVHHandle p_ha, BVHHandle p_hb) { // only have to do this oneway, lower ID then higher ID tree._handle_sort(p_ha, p_hb); @@ -642,7 +652,7 @@ class BVH_Manager { p_to.add_pair_to(p_ha, callback_userdata); } - // if we remove an item, we need to immediately remove the pairs, to prevent reading the pair after deletion + /// If we remove an item, we need to immediately remove the pairs, to prevent reading the pair after deletion void _remove_pairs_containing(BVHHandle p_handle) { typename BVHTREE_CLASS::ItemPairs &p_from = tree._pairs[p_handle.id()]; @@ -654,7 +664,7 @@ class BVH_Manager { } } - // Send pair callbacks again for all existing pairs for the given handle. + /// Send pair callbacks again for all existing pairs for the given handle. void _recheck_pairs(BVHHandle p_handle) { typename BVHTREE_CLASS::ItemPairs &from = tree._pairs[p_handle.id()]; @@ -735,11 +745,10 @@ class BVH_Manager { changed_items.push_back(p_handle); } + /// Care has to be taken here for items that are deleted. The ref ID + /// could be reused on the same tick for new items. This is probably + /// rare but should be taken into consideration void _remove_changed_item(BVHHandle p_handle) { - // Care has to be taken here for items that are deleted. The ref ID - // could be reused on the same tick for new items. This is probably - // rare but should be taken into consideration - // callbacks _remove_pairs_containing(p_handle); @@ -769,10 +778,9 @@ class BVH_Manager { BVHTREE_CLASS tree; - // for collision pairing, - // maintain a list of all items moved etc on each frame / tick + /// For collision pairing, maintain a list of all items moved etc on each frame / tick LocalVector changed_items; - uint32_t _tick = 1; // Start from 1 so items with 0 indicate never updated. + uint32_t _tick = 1; ///< Start from 1 so items with 0 indicate never updated. class BVHLockedFunction { public: diff --git a/core/math/bvh_abb.h b/core/math/bvh_abb.h index 04e8e2d10d6..07814b83d80 100644 --- a/core/math/bvh_abb.h +++ b/core/math/bvh_abb.h @@ -30,11 +30,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file bvh_abb.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/aabb.h" -// special optimized version of axis aligned bounding box +/// Special optimized version of axis aligned bounding box template struct BVH_ABB { struct ConvexHull { @@ -56,7 +62,7 @@ struct BVH_ABB { IR_FULL, }; - // we store mins with a negative value in order to test them with SIMD + /// We store mins with a negative value in order to test them with SIMD POINT min; POINT neg_max; @@ -68,7 +74,8 @@ struct BVH_ABB { neg_max = -_max; } - // to and from standard AABB + /// @name to and from standard AABB + /// @{ void from(const BOUNDS &p_aabb) { min = p_aabb.position; neg_max = -(p_aabb.position + p_aabb.size); @@ -78,6 +85,7 @@ struct BVH_ABB { r_aabb.position = min; r_aabb.size = calculate_size(); } + /// @} void merge(const BVH_ABB &p_o) { for (int axis = 0; axis < POINT::AXIS_COUNT; ++axis) { @@ -215,7 +223,7 @@ struct BVH_ABB { return true; } - // Very hot in profiling, make sure optimized + /// @warning Very hot in profiling, make sure optimized bool intersects(const BVH_ABB &p_o) const { if (_any_morethan(p_o.min, -neg_max)) { return false; @@ -226,7 +234,7 @@ struct BVH_ABB { return true; } - // for pre-swizzled tester (this object) + /// For pre-swizzled tester (this object) bool intersects_swizzled(const BVH_ABB &p_o) const { if (_any_lessthan(min, p_o.min)) { return false; @@ -260,7 +268,7 @@ struct BVH_ABB { grow(change); } - // Actually surface area metric. + /// Actually surface area metric. real_t get_area() const { POINT d = calculate_size(); return 2.0f * (d.x * d.y + d.y * d.z + d.z * d.x); diff --git a/core/math/bvh_tree.h b/core/math/bvh_tree.h index 521d1052717..09ddae3bef5 100644 --- a/core/math/bvh_tree.h +++ b/core/math/bvh_tree.h @@ -30,15 +30,19 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +/** + * @file bvh_tree.h + * + * @brief BVH Tree: This is an implementation of a dynamic BVH with templated leaf size. + * + * @details This differs from most dynamic BVH in that it can handle more than 1 object + * in leaf nodes. This can make it far more efficient in certain circumstances. + * It also means that the splitting logic etc have to be completely different + * to a simpler tree. + * @note MAX_CHILDREN should be fixed at 2 for now. + */ -// BVH Tree -// This is an implementation of a dynamic BVH with templated leaf size. -// This differs from most dynamic BVH in that it can handle more than 1 object -// in leaf nodes. This can make it far more efficient in certain circumstances. -// It also means that the splitting logic etc have to be completely different -// to a simpler tree. -// Note that MAX_CHILDREN should be fixed at 2 for now. +#pragma once #include "core/math/aabb.h" #include "core/math/bvh_abb.h" @@ -50,7 +54,7 @@ #define BVHABB_CLASS BVH_ABB -// not sure if this is better yet so making optional +/// Not sure if this is better yet so making optional #define BVH_EXPAND_LEAF_AABBS // never do these checks in release @@ -78,18 +82,20 @@ #define VERBOSE_PRINT(a) #endif -// really just a namespace +/// Really just a namespace struct BVHCommon { - // these could possibly also be the same constant, - // although this may be useful for debugging. - // or use zero for invalid and +1 based indices. + /// @name These could possibly also be the same constant, + /// @details ...although this may be useful for debugging. + /// or use zero for invalid and +1 based indices. + /// @{ static const uint32_t INVALID = (0xffffffff); static const uint32_t INACTIVE = (0xfffffffe); + /// @} }; -// really a handle, can be anything -// note that zero is a valid reference for the BVH .. this may involve using -// a plus one based ID for clients that expect 0 to be invalid. +/// Really a handle, can be anything +/// @note zero is a valid reference for the BVH .. this may involve using +/// a plus one based ID for clients that expect 0 to be invalid. struct BVHHandle { // conversion operator operator uint32_t() const { return _data; } @@ -106,7 +112,7 @@ struct BVHHandle { bool operator!=(const BVHHandle &p_h) const { return (*this == p_h) == false; } }; -// helper class to make iterative versions of recursive functions +/// Helper class to make iterative versions of recursive functions template class BVH_IterativeInfo { public: @@ -115,7 +121,7 @@ class BVH_IterativeInfo { int32_t depth = 1; int32_t threshold = ALLOCA_STACK_SIZE - 2; T *stack; - //only used in rare occasions when you run out of alloca memory + // only used in rare occasions when you run out of alloca memory // because tree is too unbalanced. LocalVector aux_stack; int32_t get_alloca_stacksize() const { return ALLOCA_STACK_SIZE * sizeof(T); } @@ -276,8 +282,8 @@ class BVH_Tree { node_free_node_and_leaf(p_parent_id); } - // A node can either be a node, or a node AND a leaf combo. - // Both must be deleted to prevent a leak. + /// A node can either be a node, or a node AND a leaf combo. + /// Both must be deleted to prevent a leak. void node_free_node_and_leaf(uint32_t p_node_id) { TNode &node = _nodes[p_node_id]; if (node.is_leaf()) { @@ -387,8 +393,8 @@ class BVH_Tree { ref.item_id = BVHCommon::INVALID; // unset } - // returns true if needs refit of PARENT tree only, the node itself AABB is calculated - // within this routine + /// @return `true` if needs refit of PARENT tree only, the node itself AABB is calculated + /// within this routine bool _node_add_item(uint32_t p_node_id, uint32_t p_ref_id, const BVHABB_CLASS &p_aabb) { ItemRef &ref = _refs[p_ref_id]; ref.tnode_id = p_node_id; diff --git a/core/math/color.cpp b/core/math/color.cpp index 1c0cf46170b..dffb63bef20 100644 --- a/core/math/color.cpp +++ b/core/math/color.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file color.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "color.h" #include "color_names.inc" diff --git a/core/math/color.h b/core/math/color.h index 6afb1d0c56e..b0657819133 100644 --- a/core/math/color.h +++ b/core/math/color.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file color.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/math_funcs.h" diff --git a/core/math/convex_hull.cpp b/core/math/convex_hull.cpp index 3d88a545a19..e1761c81dff 100644 --- a/core/math/convex_hull.cpp +++ b/core/math/convex_hull.cpp @@ -30,34 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -/* - * Based on Godot's patched VHACD-version of Bullet's btConvexHullComputer. - * See /thirdparty/vhacd/btConvexHullComputer.cpp at 64403ddcab9f1dca2408f0a412a22d899708bbb1 - * In turn, based on /src/LinearMath/btConvexHullComputer.cpp in - * at 73b217fb07e7e3ce126caeb28ab3c9ddd0718467 +/** + * @file convex_hull.cpp * - * Changes: - * - int32_t is consistently used instead of int in some cases - * - integrated patch db0d6c92927f5a1358b887f2645c11f3014f0e8a from Bullet (CWE-190 integer overflow in btConvexHullComputer) - * - adapted to Godot's code style - * - replaced Bullet's types (e.g. vectors) with Godot's - * - replaced custom Pool implementation with PagedAllocator + * [Add any documentation that applies to the entire file here!] */ -/* -Copyright (c) 2011 Ole Kniemeyer, MAXON, www.maxon.net - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - #include "convex_hull.h" #include "core/error/error_macros.h" @@ -93,8 +71,8 @@ subject to the following restrictions: #include #endif -// Convex hull implementation based on Preparata and Hong -// Ole Kniemeyer, MAXON Computer GmbH +/// Convex hull implementation based on Preparata and Hong +/// Ole Kniemeyer, MAXON Computer GmbH class ConvexHullInternal { public: class Point64 { diff --git a/core/math/convex_hull.h b/core/math/convex_hull.h index d72f8e8dc28..03b71f8d7c0 100644 --- a/core/math/convex_hull.h +++ b/core/math/convex_hull.h @@ -30,19 +30,35 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +/** + * @file convex_hull.h + * + * Based on Godot's patched VHACD-version of Bullet's btConvexHullComputer. + * See /thirdparty/vhacd/btConvexHullComputer.cpp at 64403ddcab9f1dca2408f0a412a22d899708bbb1 + * In turn, based on /src/LinearMath/btConvexHullComputer.cpp in + * at 73b217fb07e7e3ce126caeb28ab3c9ddd0718467 + * + * Changes: + * - int32_t is consistently used instead of int in some cases + * - integrated patch db0d6c92927f5a1358b887f2645c11f3014f0e8a from Bullet (CWE-190 integer overflow in btConvexHullComputer) + * - adapted to Godot's code style + * - replaced Bullet's types (e.g. vectors) with Godot's + * - replaced custom Pool implementation with PagedAllocator + * + * @copyright Copyright (c) 2011 Ole Kniemeyer, MAXON, www.maxon.net + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the use of this software. + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it freely, + * subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ -/* -Copyright (c) 2011 Ole Kniemeyer, MAXON, www.maxon.net -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ +#pragma once #include "core/math/geometry_3d.h" #include "core/math/vector3.h" @@ -90,25 +106,25 @@ class ConvexHullComputer { } }; - // Vertices of the output hull + /// Vertices of the output hull LocalVector vertices; - // Edges of the output hull + /// Edges of the output hull LocalVector edges; - // Faces of the convex hull. Each entry is an index into the "edges" array pointing to an edge of the face. Faces are planar n-gons + /// Faces of the convex hull. Each entry is an index into the "edges" array pointing to an edge of the face. Faces are planar n-gons LocalVector faces; - /* - Compute convex hull of "count" vertices stored in "coords". - If "shrink" is positive, the convex hull is shrunken by that amount (each face is moved by "shrink" length units - towards the center along its normal). - If "shrinkClamp" is positive, "shrink" is clamped to not exceed "shrinkClamp * innerRadius", where "innerRadius" - is the minimum distance of a face to the center of the convex hull. - The returned value is the amount by which the hull has been shrunken. If it is negative, the amount was so large - that the resulting convex hull is empty. - The output convex hull can be found in the member variables "vertices", "edges", "faces". - */ + /** + * Compute convex hull of "count" vertices stored in "coords". + * If "shrink" is positive, the convex hull is shrunken by that amount (each face is moved by "shrink" length units + * towards the center along its normal). + * If "shrinkClamp" is positive, "shrink" is clamped to not exceed "shrinkClamp * innerRadius", where "innerRadius" + * is the minimum distance of a face to the center of the convex hull. + * The returned value is the amount by which the hull has been shrunken. If it is negative, the amount was so large + * that the resulting convex hull is empty. + * The output convex hull can be found in the member variables "vertices", "edges", "faces". + */ real_t compute(const Vector3 *p_coords, int32_t p_count, real_t p_shrink, real_t p_shrink_clamp); static Error convex_hull(const Vector &p_points, Geometry3D::MeshData &r_mesh); diff --git a/core/math/delaunay_2d.h b/core/math/delaunay_2d.h index c00c8e1d3a1..a5d98e02d4c 100644 --- a/core/math/delaunay_2d.h +++ b/core/math/delaunay_2d.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file delaunay_2d.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/rect2.h" diff --git a/core/math/delaunay_3d.h b/core/math/delaunay_3d.h index 2eceebc3946..eb6f25b7f2f 100644 --- a/core/math/delaunay_3d.h +++ b/core/math/delaunay_3d.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file delaunay_3d.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/aabb.h" @@ -47,7 +53,7 @@ class Delaunay3D { enum { ACCEL_GRID_SIZE = 16, - QUANTIZATION_MAX = 1 << 16 // A power of two smaller than the 23 bit significand of a float. + QUANTIZATION_MAX = 1 << 16 ///< A power of two smaller than the 23 bit significand of a float. }; struct GridPos { Vector3i pos; @@ -105,10 +111,9 @@ class Delaunay3D { } }; + /// The only part in the algorithm where there may be precision errors is this one, + /// so ensure that we do it with the maximum precision possible. _FORCE_INLINE_ static void circum_sphere_compute(const Vector3 *p_points, Simplex *p_simplex) { - // The only part in the algorithm where there may be precision errors is this one, - // so ensure that we do it with the maximum precision possible. - R128 v0_x = p_points[p_simplex->points[0]].x; R128 v0_y = p_points[p_simplex->points[0]].y; R128 v0_z = p_points[p_simplex->points[0]].z; diff --git a/core/math/disjoint_set.h b/core/math/disjoint_set.h index 8287b5b7f42..5b7cef6710c 100644 --- a/core/math/disjoint_set.h +++ b/core/math/disjoint_set.h @@ -30,12 +30,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file disjoint_set.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/templates/hash_map.h" #include "core/templates/vector.h" -/* This DisjointSet class uses Find with path compression and Union by rank */ +/** This DisjointSet class uses Find with path compression and Union by rank */ template , typename AL = DefaultAllocator> class DisjointSet { struct Element { diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp index 5e391cae2f0..a45c201f961 100644 --- a/core/math/dynamic_bvh.cpp +++ b/core/math/dynamic_bvh.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file dynamic_bvh.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "dynamic_bvh.h" void DynamicBVH::_delete_node(Node *p_node) { @@ -139,9 +145,6 @@ void DynamicBVH::_fetch_leaves(Node *p_root, LocalVector &r_leaves, int } } -// Partitions leaves such that leaves[0, n) are on the -// left of axis, and leaves[n, count) are on the right -// of axis. returns N. int DynamicBVH::_split(Node **leaves, int p_count, const Vector3 &p_org, const Vector3 &p_axis) { int begin = 0; int end = p_count; diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h index 15cefb9bf91..540377d0c6c 100644 --- a/core/math/dynamic_bvh.h +++ b/core/math/dynamic_bvh.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file dynamic_bvh.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/aabb.h" @@ -241,6 +247,9 @@ class DynamicBVH { _FORCE_INLINE_ void _insert_leaf(Node *p_root, Node *p_leaf); _FORCE_INLINE_ Node *_remove_leaf(Node *leaf); void _fetch_leaves(Node *p_root, LocalVector &r_leaves, int p_depth = -1); + /// Partitions leaves such that leaves[0, n) are on the + /// left of axis, and leaves[n, count) are on the right + /// of axis. returns N. static int _split(Node **leaves, int p_count, const Vector3 &p_org, const Vector3 &p_axis); static Volume _bounds(Node **leaves, int p_count); void _bottom_up(Node **leaves, int p_count); diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 24f74f76c61..c1c86ca30b9 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file expression.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "expression.h" #include "core/object/class_db.h" diff --git a/core/math/expression.h b/core/math/expression.h index f3925d24962..c3c0c4feda2 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file expression.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/ref_counted.h" diff --git a/core/math/face3.cpp b/core/math/face3.cpp index 64c1cfd4857..50d9cdc145a 100644 --- a/core/math/face3.cpp +++ b/core/math/face3.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file face3.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "face3.h" #include "core/math/geometry_3d.h" diff --git a/core/math/face3.h b/core/math/face3.h index 4acc27f045f..7703f661c34 100644 --- a/core/math/face3.h +++ b/core/math/face3.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file face3.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/aabb.h" diff --git a/core/math/geometry_2d.cpp b/core/math/geometry_2d.cpp index 01ad6165b75..8f78e3bcf31 100644 --- a/core/math/geometry_2d.cpp +++ b/core/math/geometry_2d.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file geometry_2d.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "geometry_2d.h" GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Walloc-zero") @@ -39,7 +45,7 @@ GODOT_GCC_WARNING_POP #define STB_RECT_PACK_IMPLEMENTATION #include "thirdparty/misc/stb_rect_pack.h" -const int clipper_precision = 5; // Based on CMP_EPSILON. +const int clipper_precision = 5; ///< Based on CMP_EPSILON. const double clipper_scale = Math::pow(10.0, clipper_precision); void Geometry2D::merge_many_polygons(const Vector> &p_polygons, Vector> &r_out_polygons, Vector> &r_out_holes) { @@ -138,14 +144,6 @@ struct _AtlasWorkRectResult { }; void Geometry2D::make_atlas(const Vector &p_rects, Vector &r_result, Size2i &r_size) { - // Super simple, almost brute force scanline stacking fitter. - // It's pretty basic for now, but it tries to make sure that the aspect ratio of the - // resulting atlas is somehow square. This is necessary because video cards have limits - // on texture size (usually 2048 or 4096), so the squarer a texture, the more the chances - // that it will work in every hardware. - // For example, it will prioritize a 1024x1024 atlas (works everywhere) instead of a - // 256x8192 atlas (won't work anywhere). - ERR_FAIL_COND(p_rects.is_empty()); for (int i = 0; i < p_rects.size(); i++) { ERR_FAIL_COND(p_rects[i].width <= 0); diff --git a/core/math/geometry_2d.h b/core/math/geometry_2d.h index 122b7a48501..0c16232c58a 100644 --- a/core/math/geometry_2d.h +++ b/core/math/geometry_2d.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file geometry_2d.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/delaunay_2d.h" @@ -362,8 +368,8 @@ class Geometry2D { return triangles; } - // Assumes cartesian coordinate system with +x to the right, +y up. - // If using screen coordinates (+x to the right, +y down) the result will need to be flipped. + /// Assumes cartesian coordinate system with +x to the right, +y up. + /// If using screen coordinates (+x to the right, +y down) the result will need to be flipped. static bool is_polygon_clockwise(const Vector &p_polygon) { int c = p_polygon.size(); if (c < 3) { @@ -380,7 +386,7 @@ class Geometry2D { return sum > 0.0f; } - // Alternate implementation that should be faster. + /// Alternate implementation that should be faster. static bool is_point_in_polygon(const Vector2 &p_point, const Vector &p_polygon) { int c = p_polygon.size(); if (c < 3) { @@ -433,8 +439,8 @@ class Geometry2D { return (real_t)(A.x - O.x) * (B.y - O.y) - (real_t)(A.y - O.y) * (B.x - O.x); } - // Returns a list of points on the convex hull in counter-clockwise order. - // Note: the last point in the returned list is the same as the first one. + /// @return A list of points on the convex hull in counter-clockwise order. + /// @note The last point in the returned list is the same as the first one. static Vector convex_hull(Vector P) { int n = P.size(), k = 0; Vector H; @@ -506,6 +512,13 @@ class Geometry2D { static Vector> decompose_polygon_in_convex(const Vector &p_polygon); + /// Super simple, almost brute force scanline stacking fitter. + /// It's pretty basic for now, but it tries to make sure that the aspect ratio of the + /// resulting atlas is somehow square. This is necessary because video cards have limits + /// on texture size (usually 2048 or 4096), so the squarer a texture, the more the chances + /// that it will work in every hardware. + /// For example, it will prioritize a 1024x1024 atlas (works everywhere) instead of a + /// 256x8192 atlas (won't work anywhere). static void make_atlas(const Vector &p_rects, Vector &r_result, Size2i &r_size); static Vector partial_pack_rects(const Vector &p_sizes, const Size2i &p_atlas_size); diff --git a/core/math/geometry_3d.cpp b/core/math/geometry_3d.cpp index ad00ff8a2d2..551ab697727 100644 --- a/core/math/geometry_3d.cpp +++ b/core/math/geometry_3d.cpp @@ -30,13 +30,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file geometry_3d.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "geometry_3d.h" #include "core/templates/hash_map.h" void Geometry3D::get_closest_points_between_segments(const Vector3 &p_p0, const Vector3 &p_p1, const Vector3 &p_q0, const Vector3 &p_q1, Vector3 &r_ps, Vector3 &r_qt) { - // Based on David Eberly's Computation of Distance Between Line Segments algorithm. - Vector3 p = p_p1 - p_p0; Vector3 q = p_q1 - p_q0; Vector3 r = p_p0 - p_q0; @@ -866,7 +870,7 @@ Vector Geometry3D::compute_convex_mesh_points(const Plane *p_planes, in #define square(m_s) ((m_s) * (m_s)) #define BIG_VAL 1e20 -/* dt of 1d function using squared distance */ +/** dt of 1d function using squared distance */ static void edt(float *f, int stride, int n) { float *d = (float *)alloca(sizeof(float) * n + sizeof(int) * n + sizeof(float) * (n + 1)); int *v = reinterpret_cast(&(d[n])); diff --git a/core/math/geometry_3d.h b/core/math/geometry_3d.h index bc2ac5ec0b9..f6daae493b0 100644 --- a/core/math/geometry_3d.h +++ b/core/math/geometry_3d.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file geometry_3d.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/delaunay_3d.h" @@ -39,6 +45,7 @@ class Geometry3D { public: + /// Based on David Eberly's Computation of Distance Between Line Segments algorithm. static void get_closest_points_between_segments(const Vector3 &p_p0, const Vector3 &p_p1, const Vector3 &p_q0, const Vector3 &p_q1, Vector3 &r_ps, Vector3 &r_qt); static real_t get_closest_distance_between_segments(const Vector3 &p_p0, const Vector3 &p_p1, const Vector3 &p_q0, const Vector3 &p_q1); @@ -430,7 +437,7 @@ class Geometry3D { Vector3 n1 = verts[i] - verts[i + 1]; Vector3 n2 = p_sphere_pos - verts[i + 1]; - ///@TODO Maybe discard by range here to make the algorithm quicker. + /// @todo Maybe discard by range here to make the algorithm quicker. // Check point within cylinder radius. Vector3 axis = n1.cross(n2).cross(n1); @@ -566,7 +573,7 @@ class Geometry3D { return tetrahedrons; } - // Create a "wrap" that encloses the given geometry. + /// Create a "wrap" that encloses the given geometry. static Vector wrap_geometry(const Vector &p_array, real_t *p_error = nullptr); struct MeshData { @@ -727,14 +734,16 @@ class Geometry3D { return false; \ } + /** + * Use separating axis theorem to test overlap between triangle and box + * need to test for overlap in these directions: + * 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle + * we do not even need to test these) + * 2) normal of the triangle + * 3) crossproduct(edge from tri, {x,y,z}-directin) + * this gives 3x3=9 more tests + */ _FORCE_INLINE_ static bool triangle_box_overlap(const Vector3 &boxcenter, const Vector3 boxhalfsize, const Vector3 *triverts) { - /* use separating axis theorem to test overlap between triangle and box */ - /* need to test for overlap in these directions: */ - /* 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle */ - /* we do not even need to test these) */ - /* 2) normal of the triangle */ - /* 3) crossproduct(edge from tri, {x,y,z}-directin) */ - /* this gives 3x3=9 more tests */ real_t min, max, p0, p1, p2, rad, fex, fey, fez; /* This is the fastest branch on Sun */ @@ -848,8 +857,8 @@ class Geometry3D { #undef STP } + /// https://twitter.com/Stubbesaurus/status/937994790553227264 _FORCE_INLINE_ static Vector3 octahedron_map_decode(const Vector2 &p_uv) { - // https://twitter.com/Stubbesaurus/status/937994790553227264 const Vector2 f = p_uv * 2.0f - Vector2(1.0f, 1.0f); Vector3 n = Vector3(f.x, f.y, 1.0f - Math::abs(f.x) - Math::abs(f.y)); const real_t t = CLAMP(-n.z, 0.0f, 1.0f); diff --git a/core/math/math_defs.h b/core/math/math_defs.h index 18303045883..2ae0fecd7a8 100644 --- a/core/math/math_defs.h +++ b/core/math/math_defs.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file math_defs.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/typedefs.h" @@ -63,7 +69,7 @@ inline constexpr double NaN = std::numeric_limits::quiet_NaN(); #ifdef PRECISE_MATH_CHECKS #define UNIT_EPSILON 0.00001 #else -//tolerate some more floating point error normally +/// Tolerate some more floating point error normally #define UNIT_EPSILON 0.001 #endif diff --git a/core/math/math_fieldwise.cpp b/core/math/math_fieldwise.cpp index f1cf9ddaa44..26750cfc3ba 100644 --- a/core/math/math_fieldwise.cpp +++ b/core/math/math_fieldwise.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file math_fieldwise.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #ifdef DEBUG_ENABLED #include "math_fieldwise.h" diff --git a/core/math/math_fieldwise.h b/core/math/math_fieldwise.h index dfb63868f55..1a3d911639e 100644 --- a/core/math/math_fieldwise.h +++ b/core/math/math_fieldwise.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file math_fieldwise.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #ifdef DEBUG_ENABLED diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp index d0cebd758e3..6a9834dc88a 100644 --- a/core/math/math_funcs.cpp +++ b/core/math/math_funcs.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file math_funcs.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "math_funcs.h" #include "core/error/error_macros.h" @@ -86,8 +92,6 @@ int Math::step_decimals(double p_step) { return 0; } -// Only meant for editor usage in float ranges, where a step of 0 -// means that decimal digits should not be limited in String::num. int Math::range_step_decimals(double p_step) { if (p_step < 0.0000000000001) { return 16; // Max value hardcoded in String::num diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 55b91beba1f..6586ae237d9 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file math_funcs.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/error/error_macros.h" @@ -97,7 +103,7 @@ _ALWAYS_INLINE_ float tanh(float p_x) { return std::tanh(p_x); } -// Always does clamping so always safe to use. +/// Always does clamping so always safe to use. _ALWAYS_INLINE_ double asin(double p_x) { return p_x < -1 ? (-PI / 2) : (p_x > 1 ? (PI / 2) : std::asin(p_x)); } @@ -105,7 +111,7 @@ _ALWAYS_INLINE_ float asin(float p_x) { return p_x < -1 ? (-(float)PI / 2) : (p_x > 1 ? ((float)PI / 2) : std::asin(p_x)); } -// Always does clamping so always safe to use. +/// Always does clamping so always safe to use. _ALWAYS_INLINE_ double acos(double p_x) { return p_x < -1 ? PI : (p_x > 1 ? 0 : std::acos(p_x)); } @@ -134,7 +140,7 @@ _ALWAYS_INLINE_ float asinh(float p_x) { return std::asinh(p_x); } -// Always does clamping so always safe to use. +/// Always does clamping so always safe to use. _ALWAYS_INLINE_ double acosh(double p_x) { return p_x < 1 ? 0 : std::acosh(p_x); } @@ -142,7 +148,7 @@ _ALWAYS_INLINE_ float acosh(float p_x) { return p_x < 1 ? 0 : std::acosh(p_x); } -// Always does clamping so always safe to use. +/// Always does clamping so always safe to use. _ALWAYS_INLINE_ double atanh(double p_x) { return p_x <= -1 ? -INF : (p_x >= 1 ? INF : std::atanh(p_x)); } @@ -236,7 +242,8 @@ _ALWAYS_INLINE_ bool is_inf(float p_val) { return std::isinf(p_val); } -// These methods assume (p_num + p_den) doesn't overflow. +/// @name These methods assume (p_num + p_den) doesn't overflow. +/// @{ _ALWAYS_INLINE_ int32_t division_round_up(int32_t p_num, int32_t p_den) { int32_t offset = (p_num < 0 && p_den < 0) ? 1 : -1; return (p_num + p_den + offset) / p_den; @@ -251,6 +258,7 @@ _ALWAYS_INLINE_ int64_t division_round_up(int64_t p_num, int64_t p_den) { _ALWAYS_INLINE_ uint64_t division_round_up(uint64_t p_num, uint64_t p_den) { return (p_num + p_den - 1) / p_den; } +/// @} _ALWAYS_INLINE_ bool is_finite(double p_val) { return std::isfinite(p_val); @@ -441,8 +449,8 @@ _ALWAYS_INLINE_ float cubic_interpolate_angle_in_time(float p_from, float p_to, return cubic_interpolate_in_time(from_rot, to_rot, pre_rot, post_rot, p_weight, p_to_t, p_pre_t, p_post_t); } +/** Formula from Wikipedia article on Bezier curves. */ _ALWAYS_INLINE_ double bezier_interpolate(double p_start, double p_control_1, double p_control_2, double p_end, double p_t) { - /* Formula from Wikipedia article on Bezier curves. */ double omt = (1.0 - p_t); double omt2 = omt * omt; double omt3 = omt2 * omt; @@ -451,8 +459,9 @@ _ALWAYS_INLINE_ double bezier_interpolate(double p_start, double p_control_1, do return p_start * omt3 + p_control_1 * omt2 * p_t * 3.0 + p_control_2 * omt * t2 * 3.0 + p_end * t3; } + +/** Formula from Wikipedia article on Bezier curves. */ _ALWAYS_INLINE_ float bezier_interpolate(float p_start, float p_control_1, float p_control_2, float p_end, float p_t) { - /* Formula from Wikipedia article on Bezier curves. */ float omt = (1.0f - p_t); float omt2 = omt * omt; float omt3 = omt2 * omt; @@ -462,8 +471,8 @@ _ALWAYS_INLINE_ float bezier_interpolate(float p_start, float p_control_1, float return p_start * omt3 + p_control_1 * omt2 * p_t * 3.0f + p_control_2 * omt * t2 * 3.0f + p_end * t3; } +/** Formula from Wikipedia article on Bezier curves. */ _ALWAYS_INLINE_ double bezier_derivative(double p_start, double p_control_1, double p_control_2, double p_end, double p_t) { - /* Formula from Wikipedia article on Bezier curves. */ double omt = (1.0 - p_t); double omt2 = omt * omt; double t2 = p_t * p_t; @@ -471,8 +480,9 @@ _ALWAYS_INLINE_ double bezier_derivative(double p_start, double p_control_1, dou double d = (p_control_1 - p_start) * 3.0 * omt2 + (p_control_2 - p_control_1) * 6.0 * omt * p_t + (p_end - p_control_2) * 3.0 * t2; return d; } + +/** Formula from Wikipedia article on Bezier curves. */ _ALWAYS_INLINE_ float bezier_derivative(float p_start, float p_control_1, float p_control_2, float p_end, float p_t) { - /* Formula from Wikipedia article on Bezier curves. */ float omt = (1.0f - p_t); float omt2 = omt * omt; float t2 = p_t * p_t; @@ -673,9 +683,11 @@ _ALWAYS_INLINE_ float pingpong(float p_value, float p_length) { return (p_length != 0.0f) ? abs(fract((p_value - p_length) / (p_length * 2.0f)) * p_length * 2.0f - p_length) : 0.0f; } -// double only, as these functions are mainly used by the editor and not performance-critical, +/// double only, as these functions are mainly used by the editor and not performance-critical, double ease(double p_x, double p_c); int step_decimals(double p_step); +/// Only meant for editor usage in float ranges, where a step of 0 +/// means that decimal digits should not be limited in String::num. int range_step_decimals(double p_step); // For editor use only. double snapped(double p_value, double p_step); @@ -697,7 +709,7 @@ double random(double p_from, double p_to); float random(float p_from, float p_to); int random(int p_from, int p_to); -// This function should be as fast as possible and rounding mode should not matter. +/// This function should be as fast as possible and rounding mode should not matter. _ALWAYS_INLINE_ int fast_ftoi(float p_value) { return std::rint(p_value); } diff --git a/core/math/plane.cpp b/core/math/plane.cpp index 48c1fe52e5c..af6a2abc451 100644 --- a/core/math/plane.cpp +++ b/core/math/plane.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file plane.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "plane.h" #include "core/math/math_funcs.h" diff --git a/core/math/plane.h b/core/math/plane.h index 37f430dd3a2..606a070814b 100644 --- a/core/math/plane.h +++ b/core/math/plane.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file plane.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/vector3.h" @@ -46,7 +52,8 @@ struct [[nodiscard]] Plane { void normalize(); Plane normalized() const; - /* Plane-Point operations */ + /// @name Plane-Point operations + /// @{ _FORCE_INLINE_ Vector3 get_center() const { return normal * d; } Vector3 get_any_perpendicular_normal() const; @@ -55,22 +62,28 @@ struct [[nodiscard]] Plane { _FORCE_INLINE_ real_t distance_to(const Vector3 &p_point) const; _FORCE_INLINE_ bool has_point(const Vector3 &p_point, real_t p_tolerance = CMP_EPSILON) const; - /* intersections */ + /// @} + /// @name Intersections + /// @{ bool intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r_result = nullptr) const; bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection) const; bool intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 *p_intersection) const; + /// @} - // For Variant bindings. + /// @name For Variant bindings + /// @{ Variant intersect_3_bind(const Plane &p_plane1, const Plane &p_plane2) const; Variant intersects_ray_bind(const Vector3 &p_from, const Vector3 &p_dir) const; Variant intersects_segment_bind(const Vector3 &p_begin, const Vector3 &p_end) const; + /// @} _FORCE_INLINE_ Vector3 project(const Vector3 &p_point) const { return p_point - normal * distance_to(p_point); } - /* misc */ + /// @name Misc. + /// @{ constexpr Plane operator-() const { return Plane(-normal, -d); } bool is_equal_approx(const Plane &p_plane) const; @@ -90,6 +103,7 @@ struct [[nodiscard]] Plane { constexpr Plane(const Vector3 &p_normal, real_t p_d = 0.0); _FORCE_INLINE_ Plane(const Vector3 &p_normal, const Vector3 &p_point); _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir = CLOCKWISE); + /// @} }; bool Plane::is_point_over(const Vector3 &p_point) const { diff --git a/core/math/projection.cpp b/core/math/projection.cpp index 43c0d98af72..ee7743a9fdc 100644 --- a/core/math/projection.cpp +++ b/core/math/projection.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file projection.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "projection.h" #include "core/math/aabb.h" @@ -404,33 +410,19 @@ void Projection::set_frustum(real_t p_size, real_t p_aspect, Vector2 p_offset, r } real_t Projection::get_z_far() const { - // NOTE: This assumes z-facing near and far planes, i.e. that : - // - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) - // - near and far planes are z-facing (i.e. columns[0][2] and [1][2] == 0) return (columns[3][3] - columns[3][2]) / (columns[2][3] - columns[2][2]); } real_t Projection::get_z_near() const { - // NOTE: This assumes z-facing near and far planes, i.e. that : - // - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) - // - near and far planes are z-facing (i.e. columns[0][2] and [1][2] == 0) return (columns[3][3] + columns[3][2]) / (columns[2][3] + columns[2][2]); } Vector2 Projection::get_viewport_half_extents() const { - // NOTE: This assumes a symmetrical frustum, i.e. that : - // - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) - // - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) - // - there is no offset / skew (i.e. columns[2][0] == columns[2][1] == 0) real_t w = -get_z_near() * columns[2][3] + columns[3][3]; return Vector2(w / columns[0][0], w / columns[1][1]); } Vector2 Projection::get_far_plane_half_extents() const { - // NOTE: This assumes a symmetrical frustum, i.e. that : - // - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) - // - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) - // - there is no offset / skew (i.e. columns[2][0] == columns[2][1] == 0) real_t w = -get_z_far() * columns[2][3] + columns[3][3]; return Vector2(w / columns[0][0], w / columns[1][1]); } @@ -462,12 +454,6 @@ bool Projection::get_endpoints(const Transform3D &p_transform, Vector3 *p_8point } Vector Projection::get_projection_planes(const Transform3D &p_transform) const { - /** Fast Plane Extraction from combined modelview/projection matrices. - * References: - * https://web.archive.org/web/20011221205252/https://www.markmorley.com/opengl/frustumculling.html - * https://web.archive.org/web/20061020020112/https://www2.ravensoft.com/users/ggribb/plane%20extraction.pdf - */ - Vector planes; planes.resize(6); @@ -551,8 +537,6 @@ Projection Projection::inverse() const { } void Projection::invert() { - // Adapted from Mesa's `src/util/u_math.c` `util_invert_mat4x4`. - // MIT licensed. Copyright 2008 VMware, Inc. Authored by Jacques Leroy. Projection temp; real_t *out = (real_t *)temp.columns; real_t *m = (real_t *)columns; @@ -786,8 +770,8 @@ bool Projection::is_same(const Projection &p_cam) const { return columns[0].is_same(p_cam.columns[0]) && columns[1].is_same(p_cam.columns[1]) && columns[2].is_same(p_cam.columns[2]) && columns[3].is_same(p_cam.columns[3]); } +/// p_remap_z is used to convert from OpenGL-style clip space (-1 - 1) to Vulkan style (0 - 1). void Projection::set_depth_correction(bool p_flip_y, bool p_reverse_z, bool p_remap_z) { - // p_remap_z is used to convert from OpenGL-style clip space (-1 - 1) to Vulkan style (0 - 1). real_t *m = &columns[0][0]; m[0] = 1; @@ -858,30 +842,19 @@ Projection::operator String() const { } real_t Projection::get_aspect() const { - // NOTE: This assumes a rectangular projection plane, i.e. that : - // - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) - // - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) return columns[1][1] / columns[0][0]; } int Projection::get_pixels_per_meter(int p_for_pixel_width) const { - // NOTE: This assumes a rectangular projection plane, i.e. that : - // - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) - // - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) real_t width = 2 * (-get_z_near() * columns[2][3] + columns[3][3]) / columns[0][0]; return p_for_pixel_width / width; // Note : return type should be real_t (kept as int for compatibility for now). } bool Projection::is_orthogonal() const { - // NOTE: This assumes that the matrix is a projection across z-axis - // i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0 return columns[2][3] == 0.0; } real_t Projection::get_fov() const { - // NOTE: This assumes a rectangular projection plane, i.e. that : - // - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) - // - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) if (columns[2][0] == 0) { return Math::rad_to_deg(2 * Math::atan2(1, columns[0][0])); } else { @@ -893,9 +866,6 @@ real_t Projection::get_fov() const { } real_t Projection::get_lod_multiplier() const { - // NOTE: This assumes a rectangular projection plane, i.e. that : - // - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) - // - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) return 2 / columns[0][0]; } diff --git a/core/math/projection.h b/core/math/projection.h index 6424fe3e0cb..0491f038642 100644 --- a/core/math/projection.h +++ b/core/math/projection.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file projection.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/vector3.h" @@ -106,18 +112,48 @@ struct [[nodiscard]] Projection { return Math::rad_to_deg(Math::atan(p_aspect * Math::tan(Math::deg_to_rad(p_fovx) * 0.5)) * 2.0); } + /// @note This assumes z-facing near and far planes, i.e. that : + /// - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) + /// - near and far planes are z-facing (i.e. columns[0][2] and [1][2] == 0) real_t get_z_far() const; + /// @note This assumes z-facing near and far planes, i.e. that : + /// - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) + /// - near and far planes are z-facing (i.e. columns[0][2] and [1][2] == 0) real_t get_z_near() const; + /// @note This assumes a rectangular projection plane, i.e. that : + /// - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) + /// - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) real_t get_aspect() const; + /// @note This assumes a rectangular projection plane, i.e. that : + /// - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) + /// - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) real_t get_fov() const; + /// @note This assumes that the matrix is a projection across z-axis + /// i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0 bool is_orthogonal() const; + /** + * Fast Plane Extraction from combined modelview/projection matrices. + * References: + * https://web.archive.org/web/20011221205252/https://www.markmorley.com/opengl/frustumculling.html + * https://web.archive.org/web/20061020020112/https://www2.ravensoft.com/users/ggribb/plane%20extraction.pdf + */ Vector get_projection_planes(const Transform3D &p_transform) const; bool get_endpoints(const Transform3D &p_transform, Vector3 *p_8points) const; + /// @note This assumes a symmetrical frustum, i.e. that : + /// - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) + /// - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) + /// - there is no offset / skew (i.e. columns[2][0] == columns[2][1] == 0) Vector2 get_viewport_half_extents() const; + /// @note This assumes a symmetrical frustum, i.e. that : + /// - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) + /// - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) + /// - there is no offset / skew (i.e. columns[2][0] == columns[2][1] == 0) Vector2 get_far_plane_half_extents() const; + /// Adapted from Mesa's `src/util/u_math.c` `util_invert_mat4x4`. + /// MIT licensed. Copyright 2008 VMware, Inc. Authored by Jacques Leroy. void invert(); Projection inverse() const; @@ -134,6 +170,9 @@ struct [[nodiscard]] Projection { void scale_translate_to_fit(const AABB &p_aabb); void add_jitter_offset(const Vector2 &p_offset); void make_scale(const Vector3 &p_scale); + /// @note This assumes a rectangular projection plane, i.e. that : + /// - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) + /// - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) int get_pixels_per_meter(int p_for_pixel_width) const; operator Transform3D() const; @@ -156,6 +195,9 @@ struct [[nodiscard]] Projection { return !(*this == p_cam); } + /// @note This assumes a rectangular projection plane, i.e. that : + /// - the matrix is a projection across z-axis (i.e. is invertible and columns[0][1], [0][3], [1][0] and [1][3] == 0) + /// - the projection plane is rectangular (i.e. columns[0][2] and [1][2] == 0 if columns[2][3] != 0) real_t get_lod_multiplier() const; Projection() = default; diff --git a/core/math/quaternion.cpp b/core/math/quaternion.cpp index 7098187af1b..b12ed4e6169 100644 --- a/core/math/quaternion.cpp +++ b/core/math/quaternion.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file quaternion.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "quaternion.h" #include "core/math/basis.h" @@ -303,10 +309,6 @@ Quaternion::Quaternion(const Vector3 &p_axis, real_t p_angle) { } } -// Euler constructor expects a vector containing the Euler angles in the format -// (ax, ay, az), where ax is the angle of rotation around x axis, -// and similar for other axes. -// This implementation uses YXZ convention (Z is the first rotation). Quaternion Quaternion::from_euler(const Vector3 &p_euler) { real_t half_a1 = p_euler.y * 0.5f; real_t half_a2 = p_euler.x * 0.5f; diff --git a/core/math/quaternion.h b/core/math/quaternion.h index 717e8ff0a21..d76ec67d17c 100644 --- a/core/math/quaternion.h +++ b/core/math/quaternion.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file quaternion.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/math_funcs.h" @@ -70,6 +76,11 @@ struct [[nodiscard]] Quaternion { real_t angle_to(const Quaternion &p_to) const; Vector3 get_euler(EulerOrder p_order = EulerOrder::YXZ) const; + + /// Euler constructor expects a vector containing the Euler angles in the format + /// (ax, ay, az), where ax is the angle of rotation around x axis, + /// and similar for other axes. + /// This implementation uses YXZ convention (Z is the first rotation). static Quaternion from_euler(const Vector3 &p_euler); Quaternion slerp(const Quaternion &p_to, real_t p_weight) const; diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index f9bf96d1098..d2c7de60143 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file quick_hull.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "quick_hull.h" #include "core/templates/hash_map.h" diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h index 5f2dce576a7..01029926d27 100644 --- a/core/math/quick_hull.h +++ b/core/math/quick_hull.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file quick_hull.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/geometry_3d.h" diff --git a/core/math/random_number_generator.cpp b/core/math/random_number_generator.cpp index 43ca07e761a..7f96c788e0a 100644 --- a/core/math/random_number_generator.cpp +++ b/core/math/random_number_generator.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file random_number_generator.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "random_number_generator.h" void RandomNumberGenerator::_bind_methods() { @@ -49,7 +55,9 @@ void RandomNumberGenerator::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed"); ADD_PROPERTY(PropertyInfo(Variant::INT, "state"), "set_state", "get_state"); - // Default values are non-deterministic, override for doc generation purposes. + /// @name Default values are non-deterministic, override for doc generation purposes. + /// @{ ADD_PROPERTY_DEFAULT("seed", 0); ADD_PROPERTY_DEFAULT("state", 0); + /// @} } diff --git a/core/math/random_number_generator.h b/core/math/random_number_generator.h index b03534631db..6515b02b640 100644 --- a/core/math/random_number_generator.h +++ b/core/math/random_number_generator.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file random_number_generator.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/random_pcg.h" diff --git a/core/math/random_pcg.cpp b/core/math/random_pcg.cpp index c15ea7888a6..4ce3873db6a 100644 --- a/core/math/random_pcg.cpp +++ b/core/math/random_pcg.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file random_pcg.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "random_pcg.h" #include "core/os/os.h" diff --git a/core/math/random_pcg.h b/core/math/random_pcg.h index 5c6e87e3dcc..c6b132ccddd 100644 --- a/core/math/random_pcg.h +++ b/core/math/random_pcg.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file random_pcg.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/math_funcs.h" @@ -53,7 +59,7 @@ class Vector; class RandomPCG { pcg32_random_t pcg; - uint64_t current_seed = 0; // The seed the current generator state started from. + uint64_t current_seed = 0; ///< The seed the current generator state started from. uint64_t current_inc = 0; public: @@ -81,18 +87,20 @@ class RandomPCG { int64_t rand_weighted(const Vector &p_weights); - // Obtaining floating point numbers in [0, 1] range with "good enough" uniformity. - // These functions sample the output of rand() as the fraction part of an infinite binary number, - // with some tricks applied to reduce ops and branching: - // 1. Instead of shifting to the first 1 and connecting random bits, we simply set the MSB and LSB to 1. - // Provided that the RNG is actually uniform bit by bit, this should have the exact same effect. - // 2. In order to compensate for exponent info loss, we count zeros from another random number, - // and just add that to the initial offset. - // This has the same probability as counting and shifting an actual bit stream: 2^-n for n zeroes. - // For all numbers above 2^-96 (2^-64 for floats), the functions should be uniform. - // However, all numbers below that threshold are floored to 0. - // The thresholds are chosen to minimize rand() calls while keeping the numbers within a totally subjective quality standard. - // If clz or ldexp isn't available, fall back to bit truncation for performance, sacrificing uniformity. + /** + * Obtaining floating point numbers in [0, 1] range with "good enough" uniformity. + * These functions sample the output of rand() as the fraction part of an infinite binary number, + * with some tricks applied to reduce ops and branching: + * 1. Instead of shifting to the first 1 and connecting random bits, we simply set the MSB and LSB to 1. + * Provided that the RNG is actually uniform bit by bit, this should have the exact same effect. + * 2. In order to compensate for exponent info loss, we count zeros from another random number, + * and just add that to the initial offset. + * This has the same probability as counting and shifting an actual bit stream: 2^-n for n zeroes. + * For all numbers above 2^-96 (2^-64 for floats), the functions should be uniform. + * However, all numbers below that threshold are floored to 0. + * The thresholds are chosen to minimize rand() calls while keeping the numbers within a totally subjective quality standard. + * If clz or ldexp isn't available, fall back to bit truncation for performance, sacrificing uniformity. + */ _FORCE_INLINE_ double randd() { #if defined(CLZ32) uint32_t proto_exp_offset = rand(); @@ -122,14 +130,14 @@ class RandomPCG { _FORCE_INLINE_ double randfn(double p_mean, double p_deviation) { double temp = randd(); if (temp < CMP_EPSILON) { - temp += CMP_EPSILON; // To prevent generating of INF value in log function, resulting to return NaN value from this function. + temp += CMP_EPSILON; ///< To prevent generating of INF value in log function, resulting to return NaN value from this function. } return p_mean + p_deviation * (std::cos(Math::TAU * randd()) * std::sqrt(-2.0 * std::log(temp))); // Box-Muller transform. } _FORCE_INLINE_ float randfn(float p_mean, float p_deviation) { float temp = randf(); if (temp < CMP_EPSILON) { - temp += CMP_EPSILON; // To prevent generating of INF value in log function, resulting to return NaN value from this function. + temp += CMP_EPSILON; ///< To prevent generating of INF value in log function, resulting to return NaN value from this function. } return p_mean + p_deviation * (std::cos((float)Math::TAU * randf()) * std::sqrt(-2.0 * std::log(temp))); // Box-Muller transform. } diff --git a/core/math/rect2.cpp b/core/math/rect2.cpp index d77fef87a13..52d94080487 100644 --- a/core/math/rect2.cpp +++ b/core/math/rect2.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file rect2.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "rect2.h" #include "core/math/rect2i.h" diff --git a/core/math/rect2.h b/core/math/rect2.h index a13ef7f2f62..0c438fbaedf 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file rect2.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/error/error_macros.h" @@ -145,7 +151,7 @@ struct [[nodiscard]] Rect2 { return size.x > 0.0f && size.y > 0.0f; } - // Returns the intersection between two Rect2s or an empty Rect2 if there is no intersection. + /// @return The intersection between two Rect2s or an empty Rect2 if there is no intersection. inline Rect2 intersection(const Rect2 &p_rect) const { Rect2 new_rect = p_rect; @@ -163,7 +169,7 @@ struct [[nodiscard]] Rect2 { return new_rect; } - inline Rect2 merge(const Rect2 &p_rect) const { ///< return a merged rect + inline Rect2 merge(const Rect2 &p_rect) const { ///< @return A merged rect #ifdef MATH_CHECKS if (unlikely(size.x < 0 || size.y < 0 || p_rect.size.x < 0 || p_rect.size.y < 0)) { ERR_PRINT("Rect2 size is negative, this is not supported. Use Rect2.abs() to get a Rect2 with a positive size."); @@ -252,7 +258,7 @@ struct [[nodiscard]] Rect2 { return r; } - inline void expand_to(const Vector2 &p_vector) { // In place function for speed. + inline void expand_to(const Vector2 &p_vector) { ///< In place function for speed. #ifdef MATH_CHECKS if (unlikely(size.x < 0 || size.y < 0)) { ERR_PRINT("Rect2 size is negative, this is not supported. Use Rect2.abs() to get a Rect2 with a positive size."); diff --git a/core/math/rect2i.cpp b/core/math/rect2i.cpp index 2e8699a8e69..4c0f95ffb0e 100644 --- a/core/math/rect2i.cpp +++ b/core/math/rect2i.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file rect2i.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "rect2i.h" #include "core/math/rect2.h" diff --git a/core/math/rect2i.h b/core/math/rect2i.h index 87025f6361d..83bfcbe4e0f 100644 --- a/core/math/rect2i.h +++ b/core/math/rect2i.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file rect2i.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/error/error_macros.h" @@ -88,7 +94,7 @@ struct [[nodiscard]] Rect2i { return size.x > 0 && size.y > 0; } - // Returns the intersection between two Rect2is or an empty Rect2i if there is no intersection. + /// @return The intersection between two Rect2is or an empty Rect2i if there is no intersection. inline Rect2i intersection(const Rect2i &p_rect) const { Rect2i new_rect = p_rect; diff --git a/core/math/static_raycaster.cpp b/core/math/static_raycaster.cpp index 1265ad34f21..6a45ae46d92 100644 --- a/core/math/static_raycaster.cpp +++ b/core/math/static_raycaster.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file static_raycaster.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "static_raycaster.h" StaticRaycaster *(*StaticRaycaster::create_function)() = nullptr; diff --git a/core/math/static_raycaster.h b/core/math/static_raycaster.h index 436fddce39a..395db0a208e 100644 --- a/core/math/static_raycaster.h +++ b/core/math/static_raycaster.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file static_raycaster.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/ref_counted.h" @@ -40,9 +46,9 @@ class StaticRaycaster : public RefCounted { static StaticRaycaster *(*create_function)(); public: - // Compatible with embree4 rays. + /// Compatible with embree4 rays. struct alignas(16) Ray { - const static unsigned int INVALID_GEOMETRY_ID = ((unsigned int)-1); // from rtcore_common.h + const static unsigned int INVALID_GEOMETRY_ID = ((unsigned int)-1); ///< From rtcore_common.h /*! Default construction does nothing. */ _FORCE_INLINE_ Ray() : diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp index e84d38a32da..8151c191e9d 100644 --- a/core/math/transform_2d.cpp +++ b/core/math/transform_2d.cpp @@ -30,13 +30,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file transform_2d.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "transform_2d.h" #include "core/string/ustring.h" void Transform2D::invert() { - // FIXME: this function assumes the basis is a rotation matrix, with no scaling. - // Transform2D::affine_inverse can handle matrices with scaling, so GDScript should eventually use that. SWAP(columns[0][1], columns[1][0]); columns[2] = basis_xform(-columns[2]); } @@ -148,8 +152,6 @@ void Transform2D::translate_local(const Vector2 &p_translation) { } void Transform2D::orthonormalize() { - // Gram-Schmidt Process - Vector2 x = columns[0]; Vector2 y = columns[1]; @@ -221,14 +223,12 @@ Transform2D Transform2D::operator*(const Transform2D &p_transform) const { } Transform2D Transform2D::scaled(const Size2 &p_scale) const { - // Equivalent to left multiplication Transform2D copy = *this; copy.scale(p_scale); return copy; } Transform2D Transform2D::scaled_local(const Size2 &p_scale) const { - // Equivalent to right multiplication return Transform2D(columns[0] * p_scale.x, columns[1] * p_scale.y, columns[2]); } @@ -239,22 +239,18 @@ Transform2D Transform2D::untranslated() const { } Transform2D Transform2D::translated(const Vector2 &p_offset) const { - // Equivalent to left multiplication return Transform2D(columns[0], columns[1], columns[2] + p_offset); } Transform2D Transform2D::translated_local(const Vector2 &p_offset) const { - // Equivalent to right multiplication return Transform2D(columns[0], columns[1], columns[2] + basis_xform(p_offset)); } Transform2D Transform2D::rotated(real_t p_angle) const { - // Equivalent to left multiplication return Transform2D(p_angle, Vector2()) * (*this); } Transform2D Transform2D::rotated_local(real_t p_angle) const { - // Equivalent to right multiplication return (*this) * Transform2D(p_angle, Vector2()); // Could be optimized, because origin transform can be skipped. } diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h index 790705a7e6f..e92cd7fadee 100644 --- a/core/math/transform_2d.h +++ b/core/math/transform_2d.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file transform_2d.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/math_funcs.h" @@ -39,21 +45,22 @@ class String; +/** + * @warning The basis of Transform2D is stored differently from Basis. + * In terms of columns array, the basis matrix looks like "on paper": + * M = (columns[0][0] columns[1][0]) + * (columns[0][1] columns[1][1]) + * This is such that the columns, which can be interpreted as basis vectors + * of the coordinate system "painted" on the object, can be accessed as columns[i]. + * @note This is the opposite of the indices in mathematical texts, + * meaning: $M_{12}$ in a math book corresponds to columns[1][0] here. + * This requires additional care when working with explicit indices. + * See https://en.wikipedia.org/wiki/Row-_and_column-major_order for further reading. + * + * @warning Be aware that unlike 3D code, 2D code uses a left-handed coordinate system: + * Y-axis points down, and angle is measure from +X to +Y in a clockwise-fashion. + */ struct [[nodiscard]] Transform2D { - // WARNING: The basis of Transform2D is stored differently from Basis. - // In terms of columns array, the basis matrix looks like "on paper": - // M = (columns[0][0] columns[1][0]) - // (columns[0][1] columns[1][1]) - // This is such that the columns, which can be interpreted as basis vectors - // of the coordinate system "painted" on the object, can be accessed as columns[i]. - // NOTE: This is the opposite of the indices in mathematical texts, - // meaning: $M_{12}$ in a math book corresponds to columns[1][0] here. - // This requires additional care when working with explicit indices. - // See https://en.wikipedia.org/wiki/Row-_and_column-major_order for further reading. - - // WARNING: Be aware that unlike 3D code, 2D code uses a left-handed coordinate system: - // Y-axis points down, and angle is measure from +X to +Y in a clockwise-fashion. - Vector2 columns[3] = { { 1, 0 }, { 0, 1 }, @@ -66,6 +73,8 @@ struct [[nodiscard]] Transform2D { constexpr const Vector2 &operator[](int p_idx) const { return columns[p_idx]; } constexpr Vector2 &operator[](int p_idx) { return columns[p_idx]; } + /// @todo FIXME: This function assumes the basis is a rotation matrix, with no scaling. + /// Transform2D::affine_inverse can handle matrices with scaling, so GDScript should eventually use that. void invert(); Transform2D inverse() const; @@ -93,16 +102,22 @@ struct [[nodiscard]] Transform2D { _FORCE_INLINE_ const Vector2 &get_origin() const { return columns[2]; } _FORCE_INLINE_ void set_origin(const Vector2 &p_origin) { columns[2] = p_origin; } + /// Equivalent to left multiplication Transform2D scaled(const Size2 &p_scale) const; + /// Equivalent to right multiplication Transform2D scaled_local(const Size2 &p_scale) const; + /// Equivalent to left multiplication Transform2D translated(const Vector2 &p_offset) const; + /// Equivalent to right multiplication Transform2D translated_local(const Vector2 &p_offset) const; + /// Equivalent to left multiplication Transform2D rotated(real_t p_angle) const; + /// Equivalent to right multiplication Transform2D rotated_local(real_t p_angle) const; Transform2D untranslated() const; - void orthonormalize(); + void orthonormalize(); ///< Gram-Schmidt Process Transform2D orthonormalized() const; bool is_conformal() const; bool is_equal_approx(const Transform2D &p_transform) const; diff --git a/core/math/transform_3d.cpp b/core/math/transform_3d.cpp index dac4bc7912b..3677a5f7cdf 100644 --- a/core/math/transform_3d.cpp +++ b/core/math/transform_3d.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file transform_3d.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "transform_3d.h" #include "core/string/ustring.h" @@ -51,8 +57,6 @@ void Transform3D::invert() { } Transform3D Transform3D::inverse() const { - // FIXME: this function assumes the basis is a rotation matrix, with no scaling. - // Transform3D::affine_inverse can handle matrices with scaling, so GDScript should eventually use that. Transform3D ret = *this; ret.invert(); return ret; @@ -63,13 +67,11 @@ void Transform3D::rotate(const Vector3 &p_axis, real_t p_angle) { } Transform3D Transform3D::rotated(const Vector3 &p_axis, real_t p_angle) const { - // Equivalent to left multiplication Basis p_basis(p_axis, p_angle); return Transform3D(p_basis * basis, p_basis.xform(origin)); } Transform3D Transform3D::rotated_local(const Vector3 &p_axis, real_t p_angle) const { - // Equivalent to right multiplication Basis p_basis(p_axis, p_angle); return Transform3D(basis * p_basis, origin); } @@ -118,12 +120,10 @@ void Transform3D::scale(const Vector3 &p_scale) { } Transform3D Transform3D::scaled(const Vector3 &p_scale) const { - // Equivalent to left multiplication return Transform3D(basis.scaled(p_scale), origin * p_scale); } Transform3D Transform3D::scaled_local(const Vector3 &p_scale) const { - // Equivalent to right multiplication return Transform3D(basis.scaled_local(p_scale), origin); } @@ -142,12 +142,10 @@ void Transform3D::translate_local(const Vector3 &p_translation) { } Transform3D Transform3D::translated(const Vector3 &p_translation) const { - // Equivalent to left multiplication return Transform3D(basis, origin + p_translation); } Transform3D Transform3D::translated_local(const Vector3 &p_translation) const { - // Equivalent to right multiplication return Transform3D(basis, origin + basis.xform(p_translation)); } diff --git a/core/math/transform_3d.h b/core/math/transform_3d.h index b29b4ffe376..ba5ab953fc1 100644 --- a/core/math/transform_3d.h +++ b/core/math/transform_3d.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file transform_3d.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/aabb.h" @@ -42,12 +48,16 @@ struct [[nodiscard]] Transform3D { Vector3 origin; void invert(); + /// @todo FIXME: this function assumes the basis is a rotation matrix, with no scaling. + /// Transform3D::affine_inverse can handle matrices with scaling, so GDScript should eventually use that. Transform3D inverse() const; void affine_invert(); Transform3D affine_inverse() const; + /// Equivalent to left multiplication Transform3D rotated(const Vector3 &p_axis, real_t p_angle) const; + /// Equivalent to right multiplication Transform3D rotated_local(const Vector3 &p_axis, real_t p_angle) const; void rotate(const Vector3 &p_axis, real_t p_angle); @@ -57,12 +67,16 @@ struct [[nodiscard]] Transform3D { Transform3D looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0), bool p_use_model_front = false) const; void scale(const Vector3 &p_scale); + /// Equivalent to left multiplication Transform3D scaled(const Vector3 &p_scale) const; + /// Equivalent to right multiplication Transform3D scaled_local(const Vector3 &p_scale) const; void scale_basis(const Vector3 &p_scale); void translate_local(real_t p_tx, real_t p_ty, real_t p_tz); void translate_local(const Vector3 &p_translation); + /// Equivalent to left multiplication Transform3D translated(const Vector3 &p_translation) const; + /// Equivalent to right multiplication Transform3D translated_local(const Vector3 &p_translation) const; const Basis &get_basis() const { return basis; } @@ -86,21 +100,26 @@ struct [[nodiscard]] Transform3D { _FORCE_INLINE_ AABB xform(const AABB &p_aabb) const; _FORCE_INLINE_ Vector xform(const Vector &p_array) const; - // NOTE: These are UNSAFE with non-uniform scaling, and will produce incorrect results. - // They use the transpose. - // For safe inverse transforms, xform by the affine_inverse. + /// @name These are UNSAFE with non-uniform scaling, and will produce incorrect results. + /// @details They use the transpose. For safe inverse transforms, xform by the affine_inverse. + /// @{ _FORCE_INLINE_ Vector3 xform_inv(const Vector3 &p_vector) const; _FORCE_INLINE_ AABB xform_inv(const AABB &p_aabb) const; _FORCE_INLINE_ Vector xform_inv(const Vector &p_array) const; + /// @} - // Safe with non-uniform scaling (uses affine_inverse). + /// @name Safe with non-uniform scaling (uses affine_inverse). + /// @{ _FORCE_INLINE_ Plane xform(const Plane &p_plane) const; _FORCE_INLINE_ Plane xform_inv(const Plane &p_plane) const; + /// @} - // These fast versions use precomputed affine inverse, and should be used in bottleneck areas where - // multiple planes are to be transformed. + /// @name These fast versions use precomputed affine inverse + /// @details Should be used in bottleneck areas where multiple planes are to be transformed. + /// @{ _FORCE_INLINE_ Plane xform_fast(const Plane &p_plane, const Basis &p_basis_inverse_transpose) const; static _FORCE_INLINE_ Plane xform_inv_fast(const Plane &p_plane, const Transform3D &p_inverse, const Basis &p_basis_transpose); + /// @} void operator*=(const Transform3D &p_transform); Transform3D operator*(const Transform3D &p_transform) const; @@ -184,10 +203,11 @@ _FORCE_INLINE_ Vector3 Transform3D::xform_inv(const Vector3 &p_vector) const { (basis.rows[0][2] * v.x) + (basis.rows[1][2] * v.y) + (basis.rows[2][2] * v.z)); } -// Neither the plane regular xform or xform_inv are particularly efficient, -// as they do a basis inverse. For xforming a large number -// of planes it is better to pre-calculate the inverse transpose basis once -// and reuse it for each plane, by using the 'fast' version of the functions. +/// @name Neither the plane regular xform or xform_inv are particularly efficient, +/// @details They do a basis inverse. For xforming a large number +/// of planes it is better to pre-calculate the inverse transpose basis once +/// and reuse it for each plane, by using the 'fast' version of the functions. +/// @{ _FORCE_INLINE_ Plane Transform3D::xform(const Plane &p_plane) const { Basis b = basis.inverse(); b.transpose(); @@ -199,9 +219,10 @@ _FORCE_INLINE_ Plane Transform3D::xform_inv(const Plane &p_plane) const { Basis basis_transpose = basis.transposed(); return xform_inv_fast(p_plane, inv, basis_transpose); } +/// @} +/// https://dev.theomader.com/transform-bounding-boxes/ _FORCE_INLINE_ AABB Transform3D::xform(const AABB &p_aabb) const { - /* https://dev.theomader.com/transform-bounding-boxes/ */ Vector3 min = p_aabb.position; Vector3 max = p_aabb.position + p_aabb.size; Vector3 tmin, tmax; diff --git a/core/math/transform_interpolator.cpp b/core/math/transform_interpolator.cpp index c47caaef9b6..5564962741a 100644 --- a/core/math/transform_interpolator.cpp +++ b/core/math/transform_interpolator.cpp @@ -30,14 +30,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file transform_interpolator.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "transform_interpolator.h" #include "core/math/transform_2d.h" #include "core/math/transform_3d.h" void TransformInterpolator::interpolate_transform_2d(const Transform2D &p_prev, const Transform2D &p_curr, Transform2D &r_result, real_t p_fraction) { - // Special case for physics interpolation, if flipping, don't interpolate basis. - // If the determinant polarity changes, the handedness of the coordinate system changes. if (_sign(p_prev.determinant()) != _sign(p_curr.determinant())) { r_result.columns[0] = p_curr.columns[0]; r_result.columns[1] = p_curr.columns[1]; @@ -184,10 +188,10 @@ void TransformInterpolator::interpolate_basis_linear(const Basis &p_prev, const // Interpolate basis. r_result = p_prev.lerp(p_curr, p_fraction); - // It turns out we need to guard against zero scale basis. - // This is kind of silly, as we should probably fix the bugs elsewhere in Redot that can't deal with - // zero scale, but until that time... - // TODO: Rewrite this ^ + /// It turns out we need to guard against zero scale basis. + /// This is kind of silly, as we should probably fix the bugs elsewhere in Redot that can't deal with + /// zero scale, but until that time... + /// @todo Rewrite this ^ for (int n = 0; n < 3; n++) { Vector3 &axis = r_result[n]; @@ -204,7 +208,6 @@ void TransformInterpolator::interpolate_basis_linear(const Basis &p_prev, const } } -// Returns length. real_t TransformInterpolator::_vec3_normalize(Vector3 &p_vec) { real_t lengthsq = p_vec.length_squared(); if (lengthsq == 0.0f) { @@ -218,10 +221,7 @@ real_t TransformInterpolator::_vec3_normalize(Vector3 &p_vec) { return length; } -// Returns lengths. Vector3 TransformInterpolator::_basis_orthonormalize(Basis &r_basis) { - // Gram-Schmidt Process. - Vector3 x = r_basis.get_column(0); Vector3 y = r_basis.get_column(1); Vector3 z = r_basis.get_column(2); @@ -300,7 +300,7 @@ TransformInterpolator::Method TransformInterpolator::_test_basis(Basis p_basis, return INTERP_LERP; } - // TODO: This could possibly be less stringent too, check this. + /// @todo This could possibly be less stringent too, check this. r_quat = _basis_to_quat_unchecked(p_basis); if (!r_quat.is_normalized()) { return INTERP_LERP; @@ -309,7 +309,6 @@ TransformInterpolator::Method TransformInterpolator::_test_basis(Basis p_basis, return r_needed_normalize ? INTERP_SCALED_SLERP : INTERP_SLERP; } -// This check doesn't seem to be needed but is preserved in case of bugs. bool TransformInterpolator::_basis_is_orthogonal_any_scale(const Basis &p_basis) { Vector3 cross = p_basis.get_column(0).cross(p_basis.get_column(1)); real_t l = _vec3_normalize(cross); @@ -352,7 +351,6 @@ bool TransformInterpolator::_basis_is_orthogonal(const Basis &p_basis, real_t p_ } real_t TransformInterpolator::checksum_transform_3d(const Transform3D &p_transform) { - // just a really basic checksum, this can probably be improved real_t sum = _vec3_sum(p_transform.origin); sum -= _vec3_sum(p_transform.basis.rows[0]); sum += _vec3_sum(p_transform.basis.rows[1]); diff --git a/core/math/transform_interpolator.h b/core/math/transform_interpolator.h index 38eb41848d5..8b96547d38f 100644 --- a/core/math/transform_interpolator.h +++ b/core/math/transform_interpolator.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file transform_interpolator.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/math_defs.h" @@ -61,34 +67,37 @@ class TransformInterpolator { private: _FORCE_INLINE_ static bool _sign(real_t p_val) { return p_val >= 0; } static real_t _vec3_sum(const Vector3 &p_pt) { return p_pt.x + p_pt.y + p_pt.z; } - static real_t _vec3_normalize(Vector3 &p_vec); + static real_t _vec3_normalize(Vector3 &p_vec); ///< @return length. _FORCE_INLINE_ static bool _vec3_is_equal_approx(const Vector3 &p_a, const Vector3 &p_b, real_t p_tolerance) { return Math::is_equal_approx(p_a.x, p_b.x, p_tolerance) && Math::is_equal_approx(p_a.y, p_b.y, p_tolerance) && Math::is_equal_approx(p_a.z, p_b.z, p_tolerance); } - static Vector3 _basis_orthonormalize(Basis &r_basis); + static Vector3 _basis_orthonormalize(Basis &r_basis); ///< Gram-Schmidt Process. @return lengths static Method _test_basis(Basis p_basis, bool r_needed_normalize, Quaternion &r_quat); static Basis _basis_slerp_unchecked(Basis p_from, Basis p_to, real_t p_fraction); static Quaternion _quat_slerp_unchecked(const Quaternion &p_from, const Quaternion &p_to, real_t p_fraction); static Quaternion _basis_to_quat_unchecked(const Basis &p_basis); static bool _basis_is_orthogonal(const Basis &p_basis, real_t p_epsilon = 0.01f); + /// This check doesn't seem to be needed but is preserved in case of bugs. static bool _basis_is_orthogonal_any_scale(const Basis &p_basis); static void interpolate_basis_linear(const Basis &p_prev, const Basis &p_curr, Basis &r_result, real_t p_fraction); static void interpolate_basis_scaled_slerp(Basis p_prev, Basis p_curr, Basis &r_result, real_t p_fraction); public: + /// Special case for physics interpolation, if flipping, don't interpolate basis. + /// If the determinant polarity changes, the handedness of the coordinate system changes. static void interpolate_transform_2d(const Transform2D &p_prev, const Transform2D &p_curr, Transform2D &r_result, real_t p_fraction); - // Generic functions, use when you don't know what method should be used, e.g. from GDScript. - // These will be slower. + /// Generic functions, use when you don't know what method should be used, e.g. from GDScript. + /// These will be slower. static void interpolate_transform_3d(const Transform3D &p_prev, const Transform3D &p_curr, Transform3D &r_result, real_t p_fraction); static void interpolate_basis(const Basis &p_prev, const Basis &p_curr, Basis &r_result, real_t p_fraction); - // Optimized function when you know ahead of time the method. + /// Optimized function when you know ahead of time the method. static void interpolate_transform_3d_via_method(const Transform3D &p_prev, const Transform3D &p_curr, Transform3D &r_result, real_t p_fraction, Method p_method); static void interpolate_basis_via_method(const Basis &p_prev, const Basis &p_curr, Basis &r_result, real_t p_fraction, Method p_method); - static real_t checksum_transform_3d(const Transform3D &p_transform); + static real_t checksum_transform_3d(const Transform3D &p_transform); /// Just a really basic checksum. @todo This can probably be improved static Method find_method(const Basis &p_a, const Basis &p_b); }; diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index 36ae8294aaa..8854941054d 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file triangle_mesh.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "triangle_mesh.h" #include "core/templates/sort_array.h" @@ -116,7 +122,7 @@ void TriangleMesh::create(const Vector &p_faces, const Vector fc /= 3; triangles.resize(fc); - bvh.resize(fc * 3); //will never be larger than this (todo make better) + bvh.resize(fc * 3); ///< (@todo Make better) Will never be larger than this BVH *bw = bvh.ptrw(); { diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h index 4b1506a3fbb..4656f6f38fe 100644 --- a/core/math/triangle_mesh.h +++ b/core/math/triangle_mesh.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file triangle_mesh.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/math/face3.h" @@ -54,7 +60,7 @@ class TriangleMesh : public RefCounted { struct BVH { AABB aabb; - Vector3 center; //used for sorting + Vector3 center; ///< Used for sorting int left = -1; int right = -1; @@ -97,12 +103,13 @@ class TriangleMesh : public RefCounted { void create(const Vector &p_faces, const Vector &p_surface_indices = Vector()); - // Wrapped functions for compatibility with method bindings - // and user exposed script api that can't use more native types. + /// @name Wrapped functions for compatibility with method bindings and user exposed script api that can't use more native types. + /// @{ bool create_from_faces(const Vector &p_faces); Dictionary intersect_segment_scriptwrap(const Vector3 &p_begin, const Vector3 &p_end) const; Dictionary intersect_ray_scriptwrap(const Vector3 &p_begin, const Vector3 &p_dir) const; Vector get_faces_scriptwrap() const; + /// @} TriangleMesh(); }; diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp index 2f8b41de992..4734d26d0f5 100644 --- a/core/math/triangulate.cpp +++ b/core/math/triangulate.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file triangulate.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "triangulate.h" real_t Triangulate::get_area(const Vector &contour) { @@ -44,8 +50,6 @@ real_t Triangulate::get_area(const Vector &contour) { return A * 0.5f; } -/* `is_inside_triangle` decides if a point P is inside the triangle - * defined by A, B, C. */ bool Triangulate::is_inside_triangle(real_t Ax, real_t Ay, real_t Bx, real_t By, real_t Cx, real_t Cy, diff --git a/core/math/triangulate.h b/core/math/triangulate.h index 775c2e0537a..e4f176a2129 100644 --- a/core/math/triangulate.h +++ b/core/math/triangulate.h @@ -30,26 +30,28 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file triangulate.h + * + * https://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml + */ + #pragma once #include "core/math/vector2.h" #include "core/templates/vector.h" -/* -https://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml -*/ - class Triangulate { public: - // triangulate a contour/polygon, places results in STL vector - // as series of triangles. + /// Triangulate a contour/polygon, places results in STL vector + /// as series of triangles. static bool triangulate(const Vector &contour, Vector &result); - // compute area of a contour/polygon + /// compute area of a contour/polygon static real_t get_area(const Vector &contour); - // decide if point Px/Py is inside triangle defined by - // (Ax,Ay) (Bx,By) (Cx,Cy) + /// Decides if point, P (Px/Py), is inside triangle defined by + /// A, B, C - (Ax,Ay) (Bx,By) (Cx,Cy) static bool is_inside_triangle(real_t Ax, real_t Ay, real_t Bx, real_t By, real_t Cx, real_t Cy, diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp index 76e2254666b..30fe2bc003b 100644 --- a/core/math/vector2.cpp +++ b/core/math/vector2.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector2.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "vector2.h" #include "core/math/vector2i.h" @@ -173,7 +179,6 @@ Vector2 Vector2::move_toward(const Vector2 &p_to, real_t p_delta) const { return len <= p_delta || len < (real_t)CMP_EPSILON ? p_to : v + vd / len * p_delta; } -// slide returns the component of the vector along the given plane, specified by its normal vector. Vector2 Vector2::slide(const Vector2 &p_normal) const { #ifdef MATH_CHECKS ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector2(), "The normal Vector2 " + p_normal.operator String() + "must be normalized."); diff --git a/core/math/vector2.h b/core/math/vector2.h index 1f6dfec2224..729c1c4769b 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector2.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/error/error_macros.h" @@ -126,6 +132,7 @@ struct [[nodiscard]] Vector2 { Vector2 move_toward(const Vector2 &p_to, real_t p_delta) const; + /// @return The component of the vector along the given plane, specified by its normal vector. Vector2 slide(const Vector2 &p_normal) const; Vector2 bounce(const Vector2 &p_normal) const; Vector2 reflect(const Vector2 &p_normal) const; @@ -309,9 +316,10 @@ Vector2 Vector2::direction_to(const Vector2 &p_to) const { return ret; } -// Multiplication operators required to workaround issues with LLVM using implicit conversion -// to Vector2i instead for integers where it should not. - +/// @name Multiplication operators +/// @details Required to workaround issues with LLVM using implicit conversion +/// to Vector2i instead for integers where it should not. +/// @{ constexpr Vector2 operator*(float p_scalar, const Vector2 &p_vec) { return p_vec * p_scalar; } @@ -327,6 +335,7 @@ constexpr Vector2 operator*(int32_t p_scalar, const Vector2 &p_vec) { constexpr Vector2 operator*(int64_t p_scalar, const Vector2 &p_vec) { return p_vec * p_scalar; } +/// @} typedef Vector2 Size2; typedef Vector2 Point2; diff --git a/core/math/vector2i.cpp b/core/math/vector2i.cpp index bc6cdae8153..62ee24cc634 100644 --- a/core/math/vector2i.cpp +++ b/core/math/vector2i.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector2i.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "vector2i.h" #include "core/math/vector2.h" diff --git a/core/math/vector2i.h b/core/math/vector2i.h index 193648d4611..85dfb197466 100644 --- a/core/math/vector2i.h +++ b/core/math/vector2i.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector2i.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/error/error_macros.h" @@ -221,8 +227,8 @@ constexpr bool Vector2i::operator!=(const Vector2i &p_vec2) const { return x != p_vec2.x || y != p_vec2.y; } -// Multiplication operators required to workaround issues with LLVM using implicit conversion. - +/// @name Multiplication operators required to workaround issues with LLVM using implicit conversion. +/// @{ constexpr Vector2i operator*(int32_t p_scalar, const Vector2i &p_vector) { return p_vector * p_scalar; } @@ -238,6 +244,7 @@ constexpr Vector2i operator*(float p_scalar, const Vector2i &p_vector) { constexpr Vector2i operator*(double p_scalar, const Vector2i &p_vector) { return p_vector * p_scalar; } +/// @} typedef Vector2i Size2i; typedef Vector2i Point2i; diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index 82b9db6d32e..9c7d645b099 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector3.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "vector3.h" #include "core/math/basis.h" diff --git a/core/math/vector3.h b/core/math/vector3.h index c78f0024aa1..3aed358fda5 100644 --- a/core/math/vector3.h +++ b/core/math/vector3.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector3.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/error/error_macros.h" @@ -114,14 +120,15 @@ struct [[nodiscard]] Vector3 { void rotate(const Vector3 &p_axis, real_t p_angle); Vector3 rotated(const Vector3 &p_axis, real_t p_angle) const; - /* Static Methods between 2 vector3s */ - + /// @name Static Methods between 2 vector3s + /// @{ _FORCE_INLINE_ Vector3 lerp(const Vector3 &p_to, real_t p_weight) const; _FORCE_INLINE_ Vector3 slerp(const Vector3 &p_to, real_t p_weight) const; _FORCE_INLINE_ Vector3 cubic_interpolate(const Vector3 &p_b, const Vector3 &p_pre_a, const Vector3 &p_post_b, real_t p_weight) const; _FORCE_INLINE_ Vector3 cubic_interpolate_in_time(const Vector3 &p_b, const Vector3 &p_pre_a, const Vector3 &p_post_b, real_t p_weight, real_t p_b_t, real_t p_pre_a_t, real_t p_post_b_t) const; _FORCE_INLINE_ Vector3 bezier_interpolate(const Vector3 &p_control_1, const Vector3 &p_control_2, const Vector3 &p_end, real_t p_t) const; _FORCE_INLINE_ Vector3 bezier_derivative(const Vector3 &p_control_1, const Vector3 &p_control_2, const Vector3 &p_end, real_t p_t) const; + /// @} Vector3 move_toward(const Vector3 &p_to, real_t p_delta) const; @@ -163,7 +170,8 @@ struct [[nodiscard]] Vector3 { bool is_zero_approx() const; bool is_finite() const; - /* Operators */ + /// @name Operators + /// @{ constexpr Vector3 &operator+=(const Vector3 &p_v); constexpr Vector3 operator+(const Vector3 &p_v) const; @@ -190,6 +198,7 @@ struct [[nodiscard]] Vector3 { explicit operator String() const; operator Vector3i() const; + /// @} constexpr Vector3() : x(0), y(0), z(0) {} @@ -238,9 +247,9 @@ Vector3 Vector3::lerp(const Vector3 &p_to, real_t p_weight) const { return res; } +/// This method seems more complicated than it really is, since we write out +/// the internals of some methods for efficiency (mainly, checking length). Vector3 Vector3::slerp(const Vector3 &p_to, real_t p_weight) const { - // This method seems more complicated than it really is, since we write out - // the internals of some methods for efficiency (mainly, checking length). real_t start_length_sq = length_squared(); real_t end_length_sq = p_to.length_squared(); if (unlikely(start_length_sq == 0.0f || end_length_sq == 0.0f)) { @@ -329,17 +338,20 @@ Vector3 Vector3::direction_to(const Vector3 &p_to) const { return ret; } +/** + * @return Any perpendicular vector by cross product with the Vector3.RIGHT or Vector3.UP, + * whichever has the greater angle to the current vector with the sign of each element positive. + * The only essence is "to avoid being parallel to the current vector", and there is no mathematical basis for using Vector3.RIGHT and Vector3.UP, + * since it could be a different vector depending on the prior branching code Math::abs(x) <= Math::abs(y) && Math::abs(x) <= Math::abs(z). + * However, it would be reasonable to use any of the axes of the basis, as it is simpler to calculate. + * */ Vector3 Vector3::get_any_perpendicular() const { - // Return the any perpendicular vector by cross product with the Vector3.RIGHT or Vector3.UP, - // whichever has the greater angle to the current vector with the sign of each element positive. - // The only essence is "to avoid being parallel to the current vector", and there is no mathematical basis for using Vector3.RIGHT and Vector3.UP, - // since it could be a different vector depending on the prior branching code Math::abs(x) <= Math::abs(y) && Math::abs(x) <= Math::abs(z). - // However, it would be reasonable to use any of the axes of the basis, as it is simpler to calculate. ERR_FAIL_COND_V_MSG(is_zero_approx(), Vector3(0, 0, 0), "The Vector3 must not be zero."); return cross((Math::abs(x) <= Math::abs(y) && Math::abs(x) <= Math::abs(z)) ? Vector3(1, 0, 0) : Vector3(0, 1, 0)).normalized(); } -/* Operators */ +/// @name Operators +/// @{ constexpr Vector3 &Vector3::operator+=(const Vector3 &p_v) { x += p_v.x; @@ -392,9 +404,9 @@ constexpr Vector3 &Vector3::operator*=(real_t p_scalar) { return *this; } -// Multiplication operators required to workaround issues with LLVM using implicit conversion -// to Vector3i instead for integers where it should not. - +/// @} +/// @name Multiplication operators required to workaround issues with LLVM using implicit conversion to Vector3i instead for integers where it should not. +/// @{ constexpr Vector3 operator*(float p_scalar, const Vector3 &p_vec) { return p_vec * p_scalar; } @@ -414,6 +426,7 @@ constexpr Vector3 operator*(int64_t p_scalar, const Vector3 &p_vec) { constexpr Vector3 Vector3::operator*(real_t p_scalar) const { return Vector3(x * p_scalar, y * p_scalar, z * p_scalar); } +/// @} constexpr Vector3 &Vector3::operator/=(real_t p_scalar) { x /= p_scalar; @@ -533,7 +546,7 @@ void Vector3::zero() { x = y = z = 0; } -// slide returns the component of the vector along the given plane, specified by its normal vector. +/// @return The component of the vector along the given plane, specified by its normal vector. Vector3 Vector3::slide(const Vector3 &p_normal) const { #ifdef MATH_CHECKS ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector3(), "The normal Vector3 " + p_normal.operator String() + " must be normalized."); diff --git a/core/math/vector3i.cpp b/core/math/vector3i.cpp index 0264a76155d..d190279509c 100644 --- a/core/math/vector3i.cpp +++ b/core/math/vector3i.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector3i.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "vector3i.h" #include "core/math/vector3.h" diff --git a/core/math/vector3i.h b/core/math/vector3i.h index 3de15dc07b0..6234ad2efe8 100644 --- a/core/math/vector3i.h +++ b/core/math/vector3i.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector3i.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/error/error_macros.h" @@ -103,7 +109,8 @@ struct [[nodiscard]] Vector3i { _FORCE_INLINE_ double distance_to(const Vector3i &p_to) const; _FORCE_INLINE_ int64_t distance_squared_to(const Vector3i &p_to) const; - /* Operators */ + /// @name Operators + /// @{ constexpr Vector3i &operator+=(const Vector3i &p_v); constexpr Vector3i operator+(const Vector3i &p_v) const; @@ -134,6 +141,7 @@ struct [[nodiscard]] Vector3i { explicit operator String() const; operator Vector3() const; + /// @} constexpr Vector3i() : x(0), y(0), z(0) {} @@ -165,8 +173,8 @@ int64_t Vector3i::distance_squared_to(const Vector3i &p_to) const { return (p_to - *this).length_squared(); } -/* Operators */ - +/// @name Operators +/// @{ constexpr Vector3i &Vector3i::operator+=(const Vector3i &p_v) { x += p_v.x; y += p_v.y; @@ -232,8 +240,9 @@ constexpr Vector3i &Vector3i::operator*=(int32_t p_scalar) { constexpr Vector3i Vector3i::operator*(int32_t p_scalar) const { return Vector3i(x * p_scalar, y * p_scalar, z * p_scalar); } - -// Multiplication operators required to workaround issues with LLVM using implicit conversion. +/// @} +/// @nameMultiplication operators required to workaround issues with LLVM using implicit conversion. +/// @{ constexpr Vector3i operator*(int32_t p_scalar, const Vector3i &p_vector) { return p_vector * p_scalar; @@ -250,6 +259,7 @@ constexpr Vector3i operator*(float p_scalar, const Vector3i &p_vector) { constexpr Vector3i operator*(double p_scalar, const Vector3i &p_vector) { return p_vector * p_scalar; } +/// @} constexpr Vector3i &Vector3i::operator/=(int32_t p_scalar) { x /= p_scalar; diff --git a/core/math/vector4.cpp b/core/math/vector4.cpp index db7947bc1b2..692161de973 100644 --- a/core/math/vector4.cpp +++ b/core/math/vector4.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector4.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "vector4.h" #include "core/math/math_funcs.h" diff --git a/core/math/vector4.h b/core/math/vector4.h index 032b32b3f5e..ff83324a37c 100644 --- a/core/math/vector4.h +++ b/core/math/vector4.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector4.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/error/error_macros.h" diff --git a/core/math/vector4i.cpp b/core/math/vector4i.cpp index 1ce83061832..6fb21955a47 100644 --- a/core/math/vector4i.cpp +++ b/core/math/vector4i.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector4i.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "vector4i.h" #include "core/math/vector4.h" diff --git a/core/math/vector4i.h b/core/math/vector4i.h index ce802301f0b..af53d98334d 100644 --- a/core/math/vector4i.h +++ b/core/math/vector4i.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file vector4i.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/error/error_macros.h" @@ -168,7 +174,8 @@ Vector4i Vector4i::sign() const { return Vector4i(SIGN(x), SIGN(y), SIGN(z), SIGN(w)); } -/* Operators */ +/// @name Operators +/// @{ constexpr Vector4i &Vector4i::operator+=(const Vector4i &p_v) { x += p_v.x; @@ -241,8 +248,9 @@ constexpr Vector4i &Vector4i::operator*=(int32_t p_scalar) { constexpr Vector4i Vector4i::operator*(int32_t p_scalar) const { return Vector4i(x * p_scalar, y * p_scalar, z * p_scalar, w * p_scalar); } - -// Multiplication operators required to workaround issues with LLVM using implicit conversion. +/// @} +/// @name Multiplication operators required to workaround issues with LLVM using implicit conversion. +/// @{ constexpr Vector4i operator*(int32_t p_scalar, const Vector4i &p_vector) { return p_vector * p_scalar; @@ -259,6 +267,7 @@ constexpr Vector4i operator*(float p_scalar, const Vector4i &p_vector) { constexpr Vector4i operator*(double p_scalar, const Vector4i &p_vector) { return p_vector * p_scalar; } +/// @} constexpr Vector4i &Vector4i::operator/=(int32_t p_scalar) { x /= p_scalar; diff --git a/core/object/callable_method_pointer.cpp b/core/object/callable_method_pointer.cpp index 234cb804b18..e9d4e02ae4f 100644 --- a/core/object/callable_method_pointer.cpp +++ b/core/object/callable_method_pointer.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file callable_method_pointer.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "callable_method_pointer.h" bool CallableCustomMethodPointerBase::compare_equal(const CallableCustom *p_a, const CallableCustom *p_b) { diff --git a/core/object/callable_method_pointer.h b/core/object/callable_method_pointer.h index 773129fa648..4625867107a 100644 --- a/core/object/callable_method_pointer.h +++ b/core/object/callable_method_pointer.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file callable_method_pointer.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/object.h" @@ -145,7 +151,8 @@ Callable create_custom_callable_function_pointer(T *p_instance, return Callable(ccmp); } -// CONST VERSION +/// @name CONST VERSION +/// @{ template class CallableCustomMethodPointerC : public CallableCustomMethodPointerBase { @@ -220,7 +227,9 @@ Callable create_custom_callable_function_pointer(T *p_instance, #define callable_mp(I, M) create_custom_callable_function_pointer(I, M) #endif // DEBUG_ENABLED -// STATIC VERSIONS +/// @} +/// @name STATIC VERSIONS +/// @{ template class CallableCustomStaticMethodPointer : public CallableCustomMethodPointerBase { @@ -284,6 +293,7 @@ Callable create_custom_callable_static_function_pointer( #endif // DEBUG_ENABLED return Callable(ccmp); } +/// @} #ifdef DEBUG_ENABLED #define callable_mp_static(M) create_custom_callable_static_function_pointer(#M, M) diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index e2cc7e235ef..081de067496 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file class_db.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "class_db.h" #include "core/config/engine.h" @@ -1480,7 +1486,6 @@ void ClassDB::add_property_array(const StringName &p_class, const StringName &p_ type->property_list.push_back(PropertyInfo(Variant::NIL, p_path, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_ARRAY, p_array_element_prefix)); } -// NOTE: For implementation simplicity reasons, this method doesn't allow setters to have optional arguments at the end. void ClassDB::add_property(const StringName &p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index) { Locker::Lock lock(Locker::STATE_WRITE); @@ -1945,7 +1950,7 @@ MethodBind *ClassDB::_bind_vararg_method(MethodBind *p_bind, const StringName &p } type->method_map[p_name] = bind; #ifdef DEBUG_ENABLED - // FIXME: set_return_type is no longer in MethodBind, so I guess it should be moved to vararg method bind + /// @todo FIXME: set_return_type is no longer in MethodBind, so I guess it should be moved to vararg method bind //bind->set_return_type("Variant"); type->method_order.push_back(p_name); #endif // DEBUG_ENABLED @@ -2314,7 +2319,7 @@ void ClassDB::register_extension_class(ObjectGDExtension *p_extension) { ClassInfo *parent = classes.getptr(p_extension->parent_class_name); #ifdef TOOLS_ENABLED - // @todo This is a limitation of the current implementation, but it should be possible to remove. + /// @todo This is a limitation of the current implementation, but it should be possible to remove. ERR_FAIL_COND_MSG(p_extension->is_runtime && parent->gdextension && !parent->is_runtime, vformat("Extension runtime class '%s' cannot descend from '%s' which isn't also a runtime class.", String(p_extension->class_name), parent->name)); #endif @@ -2424,7 +2429,6 @@ void ClassDB::cleanup() { native_structs.clear(); } -// Array to use in optional parameters on methods and the DEFVAL_ARRAY macro. Array ClassDB::default_array_arg = Array::create_read_only(); bool ClassDB::is_default_array_arg(const Array &p_array) { diff --git a/core/object/class_db.h b/core/object/class_db.h index 47659fbf6f7..7054b5f8c6e 100644 --- a/core/object/class_db.h +++ b/core/object/class_db.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file class_db.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/method_bind.h" @@ -73,8 +79,8 @@ MethodDefinition D_METHOD(const char *p_name, const VarArgs... p_args) { #else -// When DEBUG_ENABLED is set this will let the engine know -// the argument names for easier debugging. +/// When DEBUG_ENABLED is set this will let the engine know +/// the argument names for easier debugging. #define D_METHOD(m_c, ...) m_c #endif // DEBUG_ENABLED @@ -162,8 +168,8 @@ class ClassDB { return ret; } - // We need a recursive r/w lock because there are various code paths - // that may in turn invoke other entry points with require locking. + /// We need a recursive r/w lock because there are various code paths + /// that may in turn invoke other entry points with require locking. class Locker { public: enum State { @@ -208,18 +214,18 @@ class ClassDB { static HashMap> default_values; static HashSet default_values_cached; - // Native structs, used by binder + /// Native structs, used by binder struct NativeStruct { - String ccode; // C code to create the native struct, fields separated by ; Arrays accepted (even containing other structs), also function pointers. All types must be Redot types. - uint64_t struct_size; // local size of struct, for comparison + String ccode; ///< C code to create the native struct, fields separated by ; Arrays accepted (even containing other structs), also function pointers. All types must be Redot types. + uint64_t struct_size; ///< local size of struct, for comparison }; static HashMap native_structs; - static Array default_array_arg; + static Array default_array_arg; ///< Array to use in optional parameters on methods and the DEFVAL_ARRAY macro. static bool is_default_array_arg(const Array &p_array); private: - // Non-locking variants of get_parent_class and is_parent_class. + /// Non-locking variants of get_parent_class and is_parent_class. static StringName _get_parent_class(const StringName &p_class); static bool _is_parent_class(const StringName &p_class, const StringName &p_inherits); static void _bind_compatibility(ClassInfo *type, MethodBind *p_method); @@ -454,6 +460,7 @@ class ClassDB { static void add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix = "", int p_indent_depth = 0); static void add_property_array_count(const StringName &p_class, const String &p_label, const StringName &p_count_property, const StringName &p_count_setter, const StringName &p_count_getter, const String &p_array_element_prefix, uint32_t p_count_usage = PROPERTY_USAGE_DEFAULT); static void add_property_array(const StringName &p_class, const StringName &p_path, const String &p_array_element_prefix); + /// @note For implementation simplicity reasons, this method doesn't allow setters to have optional arguments at the end. static void add_property(const StringName &p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1); static void set_property_default_value(const StringName &p_class, const StringName &p_name, const Variant &p_default); static void add_linked_property(const StringName &p_class, const String &p_property, const String &p_linked_property); diff --git a/core/object/message_queue.cpp b/core/object/message_queue.cpp index 195725dafd5..dce5435499e 100644 --- a/core/object/message_queue.cpp +++ b/core/object/message_queue.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file message_queue.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "message_queue.h" #include "core/config/project_settings.h" @@ -39,8 +45,8 @@ #include #ifdef DEV_ENABLED -// Includes safety checks to ensure that a queue set as a thread singleton override -// is only ever called from the thread it was set for. +/// Includes safety checks to ensure that a queue set as a thread singleton override +/// is only ever called from the thread it was set for. #define LOCK_MUTEX \ if (this != MessageQueue::thread_singleton) { \ DEV_ASSERT(!is_current_thread_override); \ diff --git a/core/object/message_queue.h b/core/object/message_queue.h index f26faf504e9..20c1fd16626 100644 --- a/core/object/message_queue.h +++ b/core/object/message_queue.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file message_queue.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/object_id.h" @@ -52,8 +58,8 @@ class CallQueue { uint8_t data[PAGE_SIZE_BYTES]; }; - // Needs to be public to be able to define it outside the class. - // Needs to lock because there can be multiple of these allocators in several threads. + /// Needs to be public to be able to define it outside the class. + /// Needs to lock because there can be multiple of these allocators in several threads. typedef PagedAllocator Allocator; private: @@ -61,7 +67,7 @@ class CallQueue { TYPE_CALL, TYPE_NOTIFICATION, TYPE_SET, - TYPE_END, // End marker. + TYPE_END, ///< End marker. FLAG_NULL_IS_OK = 1 << 13, FLAG_SHOW_ERROR = 1 << 14, FLAG_MASK = FLAG_NULL_IS_OK - 1, diff --git a/core/object/method_bind.cpp b/core/object/method_bind.cpp index 71e3c05d365..dbc2736c662 100644 --- a/core/object/method_bind.cpp +++ b/core/object/method_bind.cpp @@ -30,8 +30,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -// object.h needs to be the first include *before* method_bind.h -// FIXME: Find out why and fix potential cyclical dependencies. +/** + * @file method_bind.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + +/// object.h needs to be the first include *before* method_bind.h +/// @todo FIXME: Find out why and fix potential cyclical dependencies. #include "core/object/object.h" #include "method_bind.h" diff --git a/core/object/method_bind.h b/core/object/method_bind.h index 45bc96a1b1d..088e3029f50 100644 --- a/core/object/method_bind.h +++ b/core/object/method_bind.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file method_bind.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/variant/binder_common.h" @@ -99,7 +105,7 @@ class MethodBind { PropertyInfo get_return_info() const; #ifdef DEBUG_ENABLED - void set_argument_names(const Vector &p_names); // Set by ClassDB, can't be inferred otherwise. + void set_argument_names(const Vector &p_names); ///< Set by ClassDB, can't be inferred otherwise. Vector get_argument_names() const; virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const = 0; @@ -140,7 +146,7 @@ class MethodBind { virtual ~MethodBind(); }; -// MethodBindVarArg base CRTP +/// MethodBindVarArg base CRTP template class MethodBindVarArgBase : public MethodBind { protected: @@ -218,7 +224,7 @@ class MethodBindVarArgBase : public MethodBind { } }; -// variadic, no return +/// variadic, no return template class MethodBindVarArgT : public MethodBindVarArgBase, T, void, false> { friend class MethodBindVarArgBase, T, void, false>; @@ -252,7 +258,7 @@ MethodBind *create_vararg_method_bind(void (T::*p_method)(const Variant **, int, return a; } -// variadic, return +/// variadic, return template class MethodBindVarArgTR : public MethodBindVarArgBase, T, R, true> { friend class MethodBindVarArgBase, T, R, true>; @@ -298,7 +304,7 @@ class __UnexistingClass; #define MB_T T #endif -// no return, not const +/// no return, not const #ifdef TYPED_METHOD_BIND template #else diff --git a/core/object/object.cpp b/core/object/object.cpp index 42c54cb0791..7cd08b46422 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file object.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "object.h" #include "core/extension/gdextension_manager.h" @@ -928,8 +934,6 @@ Variant Object::call_const(const StringName &p_method, const Variant **p_args, i } void Object::_notification_forward(int p_notification) { - // Notify classes starting with Object and ending with most derived subclass. - // e.g. Object -> Node -> Node3D _notification_forwardv(p_notification); if (_extension) { @@ -962,8 +966,6 @@ void Object::_notification_backward(int p_notification) { } } - // Notify classes starting with most derived subclass and ending in Object. - // e.g. Node3D -> Node -> Object _notification_backwardv(p_notification); } @@ -1025,7 +1027,7 @@ void Object::set_script(const Variant &p_script) { } } - notify_property_list_changed(); //scripts may add variables, so refresh is desired + notify_property_list_changed(); emit_signal(CoreStringName(script_changed)); } @@ -1338,10 +1340,6 @@ Error Object::emit_signalp(const StringName &p_name, const Variant **p_args, int } void Object::_add_user_signal(const String &p_name, const Array &p_args) { - // this version of add_user_signal is meant to be used from scripts or external apis - // without access to ADD_SIGNAL in bind_methods - // added events are per instance, as opposed to the other ones, which are global - OBJ_SIGNAL_LOCK MethodInfo mi; @@ -1499,9 +1497,9 @@ Error Object::connect(const StringName &p_signal, const Callable &p_callable, ui OBJ_SIGNAL_LOCK if (p_callable.is_standard()) { - // FIXME: This branch should probably removed in favor of the `is_valid()` branch, but there exist some classes - // that call `connect()` before they are fully registered with ClassDB. Until all such classes can be found - // and registered soon enough this branch is needed to allow `connect()` to succeed. + /// @todo FIXME: This branch should probably removed in favor of the `is_valid()` branch, but there exist some classes + /// that call `connect()` before they are fully registered with ClassDB. Until all such classes can be found + /// and registered soon enough this branch is needed to allow `connect()` to succeed. ERR_FAIL_NULL_V_MSG(p_callable.get_object(), ERR_INVALID_PARAMETER, vformat("Cannot connect to '%s' to callable '%s': the callable object is null.", p_signal, p_callable)); } else { ERR_FAIL_COND_V_MSG(!p_callable.is_valid(), ERR_INVALID_PARAMETER, vformat("Cannot connect to '%s': the provided callable is not valid: '%s'.", p_signal, p_callable)); @@ -2294,7 +2292,7 @@ Object::~Object() { #endif if (_emitting) { - //@todo this may need to actually reach the debugger prioritarily somehow because it may crash before + /// @todo This may need to actually reach the debugger prioritarily somehow because it may crash before ERR_PRINT(vformat("Object '%s' was freed or unreferenced while a signal is being emitted from it. Try connecting to the signal using 'CONNECT_DEFERRED' flag, or use queue_free() to free the object (if this object is a Node) to avoid this error and potential crashes.", to_string())); } diff --git a/core/object/object.h b/core/object/object.h index 83c98ca04f4..6604aa36dc7 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file object.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/disabled_classes.gen.h" @@ -58,7 +64,7 @@ enum PropertyHint { PROPERTY_HINT_RANGE, ///< hint_text = "min,max[,step][,or_greater][,or_less][,hide_slider][,radians_as_degrees][,degrees][,exp][,suffix:] range. PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc" PROPERTY_HINT_ENUM_SUGGESTION, ///< hint_text= "val1,val2,val3,etc" - PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease) use "attenuation" hint string to revert (flip h), "positive_only" to exclude in-out and out-in. (ie: "attenuation,positive_only") + PROPERTY_HINT_EXP_EASING, ///< exponential easing function (Math::ease) use "attenuation" hint string to revert (flip h), "positive_only" to exclude in-out and out-in. (ie: "attenuation,positive_only") PROPERTY_HINT_LINK, PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags) PROPERTY_HINT_LAYERS_2D_RENDER, @@ -83,19 +89,19 @@ enum PropertyHint { PROPERTY_HINT_NODE_PATH_VALID_TYPES, PROPERTY_HINT_SAVE_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,". This opens a save dialog PROPERTY_HINT_GLOBAL_SAVE_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,". This opens a save dialog - PROPERTY_HINT_INT_IS_OBJECTID, // Deprecated. + PROPERTY_HINT_INT_IS_OBJECTID, ///< Deprecated. PROPERTY_HINT_INT_IS_POINTER, PROPERTY_HINT_ARRAY_TYPE, PROPERTY_HINT_LOCALE_ID, PROPERTY_HINT_LOCALIZABLE_STRING, PROPERTY_HINT_NODE_TYPE, ///< a node object type - PROPERTY_HINT_HIDE_QUATERNION_EDIT, /// Only Node3D::transform should hide the quaternion editor. + PROPERTY_HINT_HIDE_QUATERNION_EDIT, ///< Only Node3D::transform should hide the quaternion editor. PROPERTY_HINT_PASSWORD, PROPERTY_HINT_LAYERS_AVOIDANCE, PROPERTY_HINT_DICTIONARY_TYPE, PROPERTY_HINT_TOOL_BUTTON, PROPERTY_HINT_ONESHOT, ///< the property will be changed by self after setting, such as AudioStreamPlayer.playing, Particles.emitting. - PROPERTY_HINT_NO_NODEPATH, /// < this property will not contain a NodePath, regardless of type (Array, Dictionary, List, etc.). Needed for SceneTreeDock. + PROPERTY_HINT_NO_NODEPATH, ///< this property will not contain a NodePath, regardless of type (Array, Dictionary, List, etc.). Needed for SceneTreeDock. PROPERTY_HINT_GROUP_ENABLE, ///< used to make the property's group checkable. Only use for boolean types. PROPERTY_HINT_INPUT_NAME, PROPERTY_HINT_FILE_PATH, @@ -107,9 +113,9 @@ enum PropertyUsageFlags { PROPERTY_USAGE_STORAGE = 1 << 1, PROPERTY_USAGE_EDITOR = 1 << 2, PROPERTY_USAGE_INTERNAL = 1 << 3, - PROPERTY_USAGE_CHECKABLE = 1 << 4, // Used for editing global variables. - PROPERTY_USAGE_CHECKED = 1 << 5, // Used for editing global variables. - PROPERTY_USAGE_GROUP = 1 << 6, // Used for grouping props in the editor. + PROPERTY_USAGE_CHECKABLE = 1 << 4, ///< Used for editing global variables. + PROPERTY_USAGE_CHECKED = 1 << 5, ///< Used for editing global variables. + PROPERTY_USAGE_GROUP = 1 << 6, ///< Used for grouping props in the editor. PROPERTY_USAGE_CATEGORY = 1 << 7, PROPERTY_USAGE_SUBGROUP = 1 << 8, PROPERTY_USAGE_CLASS_IS_BITFIELD = 1 << 9, @@ -118,27 +124,27 @@ enum PropertyUsageFlags { PROPERTY_USAGE_SCRIPT_VARIABLE = 1 << 12, PROPERTY_USAGE_STORE_IF_NULL = 1 << 13, PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 1 << 14, - PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE = 1 << 15, // Deprecated. + PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE = 1 << 15, ///< Deprecated. PROPERTY_USAGE_CLASS_IS_ENUM = 1 << 16, PROPERTY_USAGE_NIL_IS_VARIANT = 1 << 17, - PROPERTY_USAGE_ARRAY = 1 << 18, // Used in the inspector to group properties as elements of an array. - PROPERTY_USAGE_ALWAYS_DUPLICATE = 1 << 19, // When duplicating a resource, always duplicate, even with subresource duplication disabled. - PROPERTY_USAGE_NEVER_DUPLICATE = 1 << 20, // When duplicating a resource, never duplicate, even with subresource duplication enabled. + PROPERTY_USAGE_ARRAY = 1 << 18, ///< Used in the inspector to group properties as elements of an array. + PROPERTY_USAGE_ALWAYS_DUPLICATE = 1 << 19, ///< When duplicating a resource, always duplicate, even with subresource duplication disabled. + PROPERTY_USAGE_NEVER_DUPLICATE = 1 << 20, ///< When duplicating a resource, never duplicate, even with subresource duplication enabled. PROPERTY_USAGE_HIGH_END_GFX = 1 << 21, PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT = 1 << 22, PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT = 1 << 23, - PROPERTY_USAGE_KEYING_INCREMENTS = 1 << 24, // Used in inspector to increment property when keyed in animation player. - PROPERTY_USAGE_DEFERRED_SET_RESOURCE = 1 << 25, // Deprecated. - PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT = 1 << 26, // For Object properties, instantiate them when creating in editor. - PROPERTY_USAGE_EDITOR_BASIC_SETTING = 1 << 27, //for project or editor settings, show when basic settings are selected. - PROPERTY_USAGE_READ_ONLY = 1 << 28, // Mark a property as read-only in the inspector. - PROPERTY_USAGE_SECRET = 1 << 29, // Export preset credentials that should be stored separately from the rest of the export config. + PROPERTY_USAGE_KEYING_INCREMENTS = 1 << 24, ///< Used in inspector to increment property when keyed in animation player. + PROPERTY_USAGE_DEFERRED_SET_RESOURCE = 1 << 25, ///< Deprecated. + PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT = 1 << 26, ///< For Object properties, instantiate them when creating in editor. + PROPERTY_USAGE_EDITOR_BASIC_SETTING = 1 << 27, ///< For project or editor settings, show when basic settings are selected. + PROPERTY_USAGE_READ_ONLY = 1 << 28, ///< Mark a property as read-only in the inspector. + PROPERTY_USAGE_SECRET = 1 << 29, ///< Export preset credentials that should be stored separately from the rest of the export config. PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR, PROPERTY_USAGE_NO_EDITOR = PROPERTY_USAGE_STORAGE, }; -// Respective values are defined by disabled_classes.gen.h +/// Respective values are defined by disabled_classes.gen.h #define GD_IS_CLASS_ENABLED(m_class) m_class::_class_is_enabled #define ADD_SIGNAL(m_signal) ::ClassDB::add_signal(get_class_static(), m_signal) @@ -161,8 +167,8 @@ enum PropertyUsageFlags { #define ADD_ARRAY_COUNT_WITH_USAGE_FLAGS(m_label, m_count_property, m_count_property_setter, m_count_property_getter, m_prefix, m_property_usage_flags) ClassDB::add_property_array_count(get_class_static(), m_label, m_count_property, StringName(m_count_property_setter), StringName(m_count_property_getter), m_prefix, m_property_usage_flags) #define ADD_ARRAY(m_array_path, m_prefix) ClassDB::add_property_array(get_class_static(), m_array_path, m_prefix) -// Helper macro to use with PROPERTY_HINT_ARRAY_TYPE for arrays of specific resources: -// PropertyInfo(Variant::ARRAY, "fallbacks", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("Font") +/// Helper macro to use with PROPERTY_HINT_ARRAY_TYPE for arrays of specific resources: +/// PropertyInfo(Variant::ARRAY, "fallbacks", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("Font") #define MAKE_RESOURCE_TYPE_HINT(m_type) vformat("%s/%s:%s", Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, m_type) struct PropertyInfo { @@ -402,8 +408,8 @@ struct ObjectGDExtension { #define GDVIRTUAL_IS_OVERRIDDEN(m_name) _gdvirtual_##m_name##_overridden() #define GDVIRTUAL_IS_OVERRIDDEN_PTR(m_obj, m_name) m_obj->_gdvirtual_##m_name##_overridden() -/* - * The following is an incomprehensible blob of hacks and workarounds to +/** + * @todo The following is an incomprehensible blob of hacks and workarounds to * compensate for many of the fallacies in C++. As a plus, this macro pretty * much alone defines the object model. */ @@ -586,11 +592,11 @@ class Object { enum ConnectFlags { CONNECT_DEFERRED = 1, - CONNECT_PERSIST = 2, // Hint for scene to save this connection. + CONNECT_PERSIST = 2, ///< Hint for scene to save this connection. CONNECT_ONE_SHOT = 4, CONNECT_REFERENCE_COUNTED = 8, CONNECT_APPEND_SOURCE_OBJECT = 16, - CONNECT_INHERITED = 32, // Used in editor builds. + CONNECT_INHERITED = 32, ///< Used in editor builds. }; struct Connection { @@ -648,11 +654,14 @@ class Object { HashSet editor_section_folding; #endif ScriptInstance *script_instance = nullptr; - Variant script; // Reference does not exist yet, store it in a Variant. + Variant script; ///< Reference does not exist yet, store it in a Variant. HashMap metadata; HashMap metadata_properties; mutable const StringName *_class_name_ptr = nullptr; + /// This version of add_user_signal is meant to be used from scripts or external apis + /// without access to ADD_SIGNAL in bind_methods + /// added events are per instance, as opposed to the other ones, which are global void _add_user_signal(const String &p_name, const Array &p_args = Array()); bool _has_user_signal(const StringName &p_name) const; void _remove_user_signal(const StringName &p_name); @@ -712,7 +721,11 @@ class Object { virtual bool _property_can_revertv(const StringName &p_name) const { return false; } virtual bool _property_get_revertv(const StringName &p_name, Variant &r_property) const { return false; } + /// Notify classes starting with Object and ending with most derived subclass. + /// e.g. Object -> Node -> Node3D void _notification_forward(int p_notification); + /// Notify classes starting with most derived subclass and ending in Object. + /// e.g. Node3D -> Node -> Object void _notification_backward(int p_notification); virtual void _notification_forwardv(int p_notification) {} virtual void _notification_backwardv(int p_notification) {} @@ -787,14 +800,14 @@ class Object { mutable VirtualMethodTracker *virtual_method_list = nullptr; #endif -public: // Should be protected, but bug in clang++. +public: // @todo Should be protected, but bug in clang++. static void initialize_class(); _FORCE_INLINE_ static void register_custom_data_to_otdb() {} public: static constexpr bool _class_is_enabled = true; - void notify_property_list_changed(); + void notify_property_list_changed(); ///< Scripts may add variables, so refresh is desired static void *get_class_ptr_static() { static int ptr; @@ -806,8 +819,8 @@ class Object { template static T *cast_to(Object *p_object) { - // This is like dynamic_cast, but faster. - // The reason is that we can assume no virtual and multiple inheritance. + /// This is like dynamic_cast, but faster. + /// The reason is that we can assume no virtual and multiple inheritance. static_assert(std::is_base_of_v, "T must be derived from Object"); static_assert(std::is_same_v, typename T::self_type>, "T must use GDCLASS or GDSOFTCLASS"); return p_object && p_object->is_class_ptr(T::get_class_ptr_static()) ? static_cast(p_object) : nullptr; @@ -824,11 +837,11 @@ class Object { NOTIFICATION_POSTINITIALIZE = 0, NOTIFICATION_PREDELETE = 1, NOTIFICATION_EXTENSION_RELOADED = 2, - // Internal notification to send after NOTIFICATION_PREDELETE, not bound to scripting. - NOTIFICATION_PREDELETE_CLEANUP = 3, + NOTIFICATION_PREDELETE_CLEANUP = 3, ///< Internal notification to send after NOTIFICATION_PREDELETE, not bound to scripting. }; - /* TYPE API */ + /// @name TYPE API + /// @{ static void assign_class_name_static(const Span &p_name, StringName &r_target); static const StringName &get_class_static() { @@ -841,7 +854,7 @@ class Object { _FORCE_INLINE_ String get_class() const { return get_class_name(); } - virtual String get_save_class() const { return get_class(); } //class stored when saving + virtual String get_save_class() const { return get_class(); } ///< Class stored when saving virtual bool is_class(const String &p_class) const { if (_extension && _extension->is_class(p_class)) { @@ -855,7 +868,9 @@ class Object { StringName get_class_name_for_extension(const GDExtension *p_library) const; - /* IAPI */ + /// @} + /// @name IAPI + /// @{ void set(const StringName &p_name, const Variant &p_value, bool *r_valid = nullptr); Variant get(const StringName &p_name, bool *r_valid = nullptr) const; @@ -886,9 +901,9 @@ class Object { return (cerr.error == Callable::CallError::CALL_OK) ? ret : Variant(); } - // Depending on the boolean, we call either the virtual function _notification_backward or _notification_forward. - // - Forward calls subclasses in descending order (e.g. Object -> Node -> Node3D -> extension -> script). - // Backward calls subclasses in descending order (e.g. script -> extension -> Node3D -> Node -> Object). + /// Depending on the boolean, we call either the virtual function _notification_backward or _notification_forward. + /// - Forward calls subclasses in descending order (e.g. Object -> Node -> Node3D -> extension -> script). + /// Backward calls subclasses in descending order (e.g. script -> extension -> Node3D -> Node -> Object). _FORCE_INLINE_ void notification(int p_notification, bool p_reversed = false) { if (p_reversed) { _notification_backward(p_notification); @@ -899,11 +914,12 @@ class Object { virtual String to_string(); - // Used mainly by script, get and set all INCLUDING string. + /// Used mainly by script, get and set all INCLUDING string. virtual Variant getvar(const Variant &p_key, bool *r_valid = nullptr) const; virtual void setvar(const Variant &p_key, const Variant &p_value, bool *r_valid = nullptr); - /* SCRIPT */ + /// @} + /// SCRIPT // When in debug, some non-virtual functions can be overridden for multithreaded guards. #ifdef DEBUG_ENABLED @@ -925,14 +941,14 @@ class Object { #ifdef TOOLS_ENABLED void set_edited(bool p_edited); bool is_edited() const; - // This function is used to check when something changed beyond a point, it's used mainly for generating previews. + /// This function is used to check when something changed beyond a point, it's used mainly for generating previews. uint32_t get_edited_version() const; #endif void set_script_instance(ScriptInstance *p_instance); _FORCE_INLINE_ ScriptInstance *get_script_instance() const { return script_instance; } - // Some script languages can't control instance creation, so this function eases the process. + /// Some script languages can't control instance creation, so this function eases the process. void set_script_and_instance(const Variant &p_script, ScriptInstance *p_instance); void add_user_signal(const MethodInfo &p_signal); @@ -973,11 +989,11 @@ class Object { Variant::Type get_static_property_type(const StringName &p_property, bool *r_valid = nullptr) const; Variant::Type get_static_property_type_indexed(const Vector &p_path, bool *r_valid = nullptr) const; - // Translate message (internationalization). + /// Translate message (internationalization). String tr(const StringName &p_message, const StringName &p_context = "") const; String tr_n(const StringName &p_message, const StringName &p_message_plural, int p_n, const StringName &p_context = "") const; - bool _is_queued_for_deletion = false; // Set to true by SceneTree::queue_delete(). + bool _is_queued_for_deletion = false; ///< Set to true by SceneTree::queue_delete(). bool is_queued_for_deletion() const; _FORCE_INLINE_ void set_message_translation(bool p_enable) { _can_translate = p_enable; } @@ -994,9 +1010,9 @@ class Object { void editor_clear_section_folding() { editor_section_folding.clear(); } #endif - // Used by script languages to store binding data. + /// Used by script languages to store binding data. void *get_instance_binding(void *p_token, const GDExtensionInstanceBindingCallbacks *p_callbacks); - // Used on creation by binding only. + /// Used on creation by binding only. void set_instance_binding(void *p_token, void *p_binding, const GDExtensionInstanceBindingCallbacks *p_callbacks); bool has_instance_binding(void *p_token); void free_instance_binding(void *p_token); @@ -1021,7 +1037,7 @@ bool predelete_handler(Object *p_object); void postinitialize_handler(Object *p_object); class ObjectDB { -// This needs to add up to 63, 1 bit is for reference. +/// This needs to add up to 63, 1 bit is for reference. #define OBJECTDB_VALIDATOR_BITS 32 #define OBJECTDB_VALIDATOR_MASK ((uint64_t(1) << OBJECTDB_VALIDATOR_BITS) - 1) #define OBJECTDB_SLOT_MAX_BLOCKS_COUNT_BITS 5 @@ -1078,7 +1094,7 @@ class ObjectDB { } template - _ALWAYS_INLINE_ static Ref get_ref(ObjectID p_instance_id); // Defined in ref_counted.h + _ALWAYS_INLINE_ static Ref get_ref(ObjectID p_instance_id); ///< Defined in ref_counted.h static void debug_objects(DebugFunc p_func); static int get_object_count(); diff --git a/core/object/object_id.h b/core/object/object_id.h index 9b8989e8163..9816979f54a 100644 --- a/core/object/object_id.h +++ b/core/object/object_id.h @@ -30,15 +30,19 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file object_id.h + * + * Class to store an object ID (int64) + * needs to be compatile with int64 because this is what Variant uses + * Also, need to be explicitly only castable to 64 bits integer types + * to avoid bugs due to loss of precision + */ + #pragma once #include "core/typedefs.h" -// Class to store an object ID (int64) -// needs to be compatile with int64 because this is what Variant uses -// Also, need to be explicitly only castable to 64 bits integer types -// to avoid bugs due to loss of precision - class ObjectID { uint64_t id = 0; diff --git a/core/object/ref_counted.cpp b/core/object/ref_counted.cpp index d98e7ddec7b..32e1c5bfc61 100644 --- a/core/object/ref_counted.cpp +++ b/core/object/ref_counted.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file ref_counted.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "ref_counted.h" #include "core/object/script_language.h" diff --git a/core/object/ref_counted.h b/core/object/ref_counted.h index 5027680275a..4494d4fc4af 100644 --- a/core/object/ref_counted.h +++ b/core/object/ref_counted.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file ref_counted.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/class_db.h" @@ -46,7 +52,7 @@ class RefCounted : public Object { public: _FORCE_INLINE_ bool is_referenced() const { return refcount_init.get() != 1; } bool init_ref(); - bool reference(); // returns false if refcount is at zero and didn't get increased + bool reference(); ///< @return `false` if refcount is at zero and didn't get increased bool unreference(); int get_reference_count() const; @@ -196,14 +202,14 @@ class Ref { inline bool is_null() const { return reference == nullptr; } void unref() { - // TODO: this should be moved to mutexes, since this engine does not really - // do a lot of referencing on references and stuff - // mutexes will avoid more crashes? + /// @todo This should be moved to mutexes, since this engine does not really + /// do a lot of referencing on references and stuff + /// mutexes will avoid more crashes? if (reference) { - // NOTE: `reinterpret_cast` is "safe" here because we know `T` has simple linear - // inheritance to `RefCounted`. This guarantees that `T * == `RefCounted *`, which - // allows us to declare `Ref` with forward declared `T` types. + /// @note `reinterpret_cast` is "safe" here because we know `T` has simple linear + /// inheritance to `RefCounted`. This guarantees that `T * == `RefCounted *`, which + /// allows us to declare `Ref` with forward declared `T` types. if (reinterpret_cast(reference)->unreference()) { memdelete(reinterpret_cast(reference)); } @@ -273,7 +279,7 @@ struct VariantInternalAccessor> { static _FORCE_INLINE_ void set(Variant *v, const Ref &p_ref) { VariantInternal::object_assign(v, p_ref); } }; -// Zero-constructing Ref initializes reference to nullptr (and thus empty). +/// Zero-constructing Ref initializes reference to nullptr (and thus empty). template struct is_zero_constructible> : std::true_type {}; diff --git a/core/object/script_backtrace.cpp b/core/object/script_backtrace.cpp index aa098d2fcdc..68d9a25bc86 100644 --- a/core/object/script_backtrace.cpp +++ b/core/object/script_backtrace.cpp @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file script_backtrace.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "script_backtrace.h" #include "core/object/script_language.h" diff --git a/core/object/script_backtrace.h b/core/object/script_backtrace.h index bf85e8b560e..6157a63a608 100644 --- a/core/object/script_backtrace.h +++ b/core/object/script_backtrace.h @@ -30,6 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file script_backtrace.h + * + * [Add any documentation that applies to the entire file here!] + */ + #pragma once #include "core/object/ref_counted.h" diff --git a/core/object/script_instance.cpp b/core/object/script_instance.cpp index 10a4c1b2ff5..7a1a4be6e2d 100644 --- a/core/object/script_instance.cpp +++ b/core/object/script_instance.cpp @@ -30,12 +30,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/** + * @file script_instance.cpp + * + * [Add any documentation that applies to the entire file here!] + */ + #include "script_instance.h" #include "core/object/script_language.h" int ScriptInstance::get_method_argument_count(const StringName &p_method, bool *r_is_valid) const { - // Default implementation simply traverses hierarchy. Ref