From aec8778d106a9553778e85d7825905ed3fa70121 Mon Sep 17 00:00:00 2001 From: Mounir Tohami <53877170+WhalesState@users.noreply.github.com> Date: Mon, 16 Dec 2024 05:30:12 +0200 Subject: [PATCH] Test Pixel Engine Build --- .github/workflows/linux_builds.yml | 190 ++++++------------ .github/workflows/macos_builds.yml | 46 ++--- .github/workflows/runner.yml | 38 ++-- .github/workflows/windows_builds.yml | 59 ++---- .pre-commit-config.yaml | 3 +- AUTHORS.md | 4 + SConstruct | 58 +++++- core/SCsub | 3 + core/config/engine.cpp | 3 + core/config/project_settings.cpp | 56 ++++-- core/config/project_settings.h | 2 + core/version.h | 1 + .../pulseaudio/audio_driver_pulseaudio.cpp | 4 + drivers/unix/os_unix.cpp | 5 +- .../rendering_context_driver_vulkan.cpp | 7 +- editor/import/3d/resource_importer_scene.cpp | 2 +- editor/import/3d/resource_importer_scene.h | 8 +- editor/plugins/canvas_item_editor_plugin.cpp | 2 +- .../collision_shape_2d_editor_plugin.cpp | 16 +- .../collision_shape_3d_gizmo_plugin.cpp | 12 +- .../navigation_link_3d_gizmo_plugin.cpp | 2 +- .../navigation_region_3d_gizmo_plugin.cpp | 2 +- .../gizmos/spring_arm_3d_gizmo_plugin.cpp | 2 +- .../mesh_instance_3d_editor_plugin.cpp | 6 +- editor/plugins/mesh_library_editor_plugin.cpp | 2 +- .../navigation_link_2d_editor_plugin.h | 2 +- .../navigation_obstacle_2d_editor_plugin.h | 2 +- .../navigation_obstacle_3d_editor_plugin.cpp | 2 +- .../navigation_polygon_editor_plugin.cpp | 2 +- editor/plugins/skeleton_3d_editor_plugin.cpp | 2 +- main/main.cpp | 144 ++++++++++--- main/performance.cpp | 43 +++- methods.py | 11 +- modules/csg/config.py | 2 +- modules/csg/csg_shape.h | 2 +- .../extensions/physics/gltf_physics_shape.cpp | 12 +- modules/godot_physics_2d/config.py | 2 +- modules/godot_physics_3d/config.py | 2 +- modules/gridmap/config.py | 2 +- modules/gridmap/grid_map.cpp | 2 +- modules/mono/utils/path_utils.cpp | 4 + .../navigation/2d/nav_mesh_generator_2d.cpp | 16 +- .../navigation/3d/nav_mesh_generator_3d.cpp | 20 +- .../3d/navigation_mesh_generator.cpp | 2 +- .../navigation/3d/navigation_mesh_generator.h | 4 +- modules/navigation/config.py | 2 +- .../editor/navigation_mesh_editor_plugin.cpp | 2 +- modules/navigation/nav_region.h | 2 +- modules/openxr/openxr_api.cpp | 13 +- pixel/SCsub | 12 ++ pixel/main_tree.cpp | 71 +++++++ pixel/main_tree.h | 46 +++++ pixel/pixel_engine.cpp | 42 ++++ pixel/pixel_engine.h | 48 +++++ platform/linuxbsd/SCsub | 4 +- platform/linuxbsd/freedesktop_screensaver.cpp | 8 +- platform/linuxbsd/tts_linux.cpp | 5 + .../wayland/display_server_wayland.cpp | 4 + platform/linuxbsd/x11/display_server_x11.cpp | 4 + platform/macos/SCsub | 5 +- platform/macos/display_server_macos.mm | 4 + platform/web/SCsub | 9 +- platform/web/os_web.cpp | 4 + platform/windows/SCsub | 6 +- platform/windows/display_server_windows.cpp | 32 ++- .../windows/gl_manager_windows_native.cpp | 4 + platform/windows/os_windows.cpp | 4 + platform_methods.py | 4 +- scene/2d/SCsub | 9 +- scene/2d/navigation/SCsub | 6 + .../{ => navigation}/navigation_agent_2d.cpp | 4 +- .../2d/{ => navigation}/navigation_agent_2d.h | 0 .../{ => navigation}/navigation_link_2d.cpp | 2 +- .../2d/{ => navigation}/navigation_link_2d.h | 0 .../navigation_obstacle_2d.cpp | 2 +- .../{ => navigation}/navigation_obstacle_2d.h | 0 .../{ => navigation}/navigation_region_2d.cpp | 2 +- .../{ => navigation}/navigation_region_2d.h | 2 +- .../audio_stream_player_2d.compat.inc | 0 .../{ => physics}/audio_stream_player_2d.cpp | 2 +- .../2d/{ => physics}/audio_stream_player_2d.h | 0 scene/2d/physics/collision_object_2d.cpp | 2 +- scene/2d/physics/collision_object_2d.h | 2 +- scene/2d/physics/collision_polygon_2d.cpp | 4 +- scene/2d/physics/collision_shape_2d.cpp | 4 +- scene/2d/physics/collision_shape_2d.h | 2 +- scene/2d/physics/physics_body_2d.h | 2 +- scene/2d/physics/ray_cast_2d.cpp | 2 +- scene/2d/physics/shape_cast_2d.cpp | 2 +- scene/2d/physics/shape_cast_2d.h | 4 +- .../2d/{ => physics}/touch_screen_button.cpp | 0 scene/2d/{ => physics}/touch_screen_button.h | 2 +- scene/2d/tile_map.cpp | 62 +++--- scene/2d/tile_map.h | 17 +- scene/2d/tile_map_layer.cpp | 38 +++- scene/2d/tile_map_layer.h | 24 ++- scene/3d/SCsub | 10 +- scene/3d/mesh_instance_3d.cpp | 4 +- scene/3d/navigation/SCsub | 6 + .../{ => navigation}/navigation_agent_3d.cpp | 2 +- .../3d/{ => navigation}/navigation_agent_3d.h | 0 .../{ => navigation}/navigation_link_3d.cpp | 0 .../3d/{ => navigation}/navigation_link_3d.h | 0 .../navigation_obstacle_3d.cpp | 0 .../{ => navigation}/navigation_obstacle_3d.h | 0 .../{ => navigation}/navigation_region_3d.cpp | 2 +- .../{ => navigation}/navigation_region_3d.h | 2 +- scene/3d/physics/collision_object_3d.cpp | 2 +- scene/3d/physics/collision_polygon_3d.cpp | 2 +- scene/3d/physics/collision_polygon_3d.h | 2 +- scene/3d/physics/collision_shape_3d.cpp | 4 +- scene/3d/physics/collision_shape_3d.h | 2 +- .../physical_bone_simulator_3d.cpp | 0 .../physical_bone_simulator_3d.h | 0 scene/3d/physics/physics_body_3d.h | 2 +- scene/3d/physics/shape_cast_3d.cpp | 2 +- scene/3d/physics/shape_cast_3d.h | 2 +- .../3d/{ => physics}/soft_body_3d.compat.inc | 0 scene/3d/{ => physics}/soft_body_3d.cpp | 0 scene/3d/{ => physics}/soft_body_3d.h | 0 scene/3d/physics/spring_arm_3d.cpp | 2 +- scene/animation/animation_mixer.cpp | 2 + scene/debugger/scene_debugger.cpp | 4 + scene/gui/base_button.cpp | 3 +- scene/gui/base_button.h | 1 + scene/gui/check_box.cpp | 1 - scene/gui/check_button.cpp | 1 - scene/gui/code_edit.cpp | 1 + scene/gui/color_picker.cpp | 1 - scene/gui/control.cpp | 10 + scene/gui/control.h | 1 - scene/gui/dialogs.cpp | 7 +- scene/gui/dialogs.h | 10 +- scene/gui/file_dialog.cpp | 6 +- scene/gui/file_dialog.h | 9 +- scene/gui/graph_edit.cpp | 2 + scene/gui/graph_edit.h | 8 +- scene/gui/graph_edit_arranger.cpp | 1 + scene/gui/graph_element.cpp | 1 - scene/gui/graph_frame.cpp | 1 - scene/gui/graph_node.cpp | 1 - scene/gui/item_list.cpp | 1 + scene/gui/item_list.h | 3 +- scene/gui/label.cpp | 3 - scene/gui/line_edit.cpp | 3 +- scene/gui/line_edit.h | 3 +- scene/gui/link_button.cpp | 1 - scene/gui/menu_bar.cpp | 1 - scene/gui/menu_bar.h | 1 - scene/gui/menu_button.cpp | 2 +- scene/gui/menu_button.h | 3 +- scene/gui/option_button.cpp | 3 +- scene/gui/option_button.h | 3 +- scene/gui/popup.cpp | 2 - scene/gui/popup_menu.cpp | 5 +- scene/gui/popup_menu.h | 5 +- scene/gui/rich_text_label.cpp | 3 +- scene/gui/rich_text_label.h | 5 +- scene/gui/scroll_bar.cpp | 3 - scene/gui/scroll_container.cpp | 1 + scene/gui/scroll_container.h | 5 +- scene/gui/separator.h | 1 + scene/gui/slider.cpp | 1 - scene/gui/spin_box.cpp | 2 + scene/gui/spin_box.h | 5 +- scene/gui/split_container.cpp | 4 +- scene/gui/tab_bar.cpp | 1 - scene/gui/tab_container.cpp | 1 + scene/gui/tab_container.h | 3 +- scene/gui/text_edit.cpp | 3 + scene/gui/text_edit.h | 8 +- scene/gui/texture_button.h | 1 + scene/gui/texture_progress_bar.cpp | 2 - scene/gui/texture_rect.cpp | 2 - scene/gui/tree.cpp | 5 + scene/gui/tree.h | 11 +- scene/gui/video_stream_player.h | 1 - scene/main/canvas_item.cpp | 2 +- scene/main/canvas_layer.cpp | 2 +- scene/main/scene_tree.cpp | 27 ++- scene/main/viewport.cpp | 44 +++- scene/main/viewport.h | 8 + scene/main/window.cpp | 12 +- scene/register_scene_types.cpp | 158 +++++++++------ scene/resources/2d/SCsub | 5 + ...avigation_mesh_source_geometry_data_2d.cpp | 0 .../navigation_mesh_source_geometry_data_2d.h | 2 +- .../{ => navigation}/navigation_polygon.cpp | 0 .../2d/{ => navigation}/navigation_polygon.h | 2 +- .../2d/{ => physics}/capsule_shape_2d.cpp | 0 .../2d/{ => physics}/capsule_shape_2d.h | 2 +- .../2d/{ => physics}/circle_shape_2d.cpp | 0 .../2d/{ => physics}/circle_shape_2d.h | 2 +- .../concave_polygon_shape_2d.cpp | 0 .../{ => physics}/concave_polygon_shape_2d.h | 2 +- .../{ => physics}/convex_polygon_shape_2d.cpp | 0 .../{ => physics}/convex_polygon_shape_2d.h | 2 +- .../2d/{ => physics}/rectangle_shape_2d.cpp | 0 .../2d/{ => physics}/rectangle_shape_2d.h | 2 +- .../2d/{ => physics}/segment_shape_2d.cpp | 0 .../2d/{ => physics}/segment_shape_2d.h | 2 +- .../{ => physics}/separation_ray_shape_2d.cpp | 0 .../{ => physics}/separation_ray_shape_2d.h | 2 +- scene/resources/2d/{ => physics}/shape_2d.cpp | 0 scene/resources/2d/{ => physics}/shape_2d.h | 0 .../{ => physics}/world_boundary_shape_2d.cpp | 0 .../{ => physics}/world_boundary_shape_2d.h | 2 +- .../skeleton_modification_2d_jiggle.cpp | 2 +- .../skeleton_modification_2d_jiggle.h | 0 ...skeleton_modification_2d_physicalbones.cpp | 0 .../skeleton_modification_2d_physicalbones.h | 0 scene/resources/2d/tile_set.cpp | 97 +++++++-- scene/resources/2d/tile_set.h | 53 +++-- scene/resources/{ => 2d}/world_2d.cpp | 33 ++- scene/resources/{ => 2d}/world_2d.h | 4 +- scene/resources/3d/SCsub | 4 + scene/resources/3d/importer_mesh.cpp | 2 + scene/resources/3d/importer_mesh.h | 10 +- .../{ => 3d/navigation}/navigation_mesh.cpp | 0 .../{ => 3d/navigation}/navigation_mesh.h | 0 ...avigation_mesh_source_geometry_data_3d.cpp | 0 .../navigation_mesh_source_geometry_data_3d.h | 0 .../3d/{ => physics}/box_shape_3d.cpp | 0 .../resources/3d/{ => physics}/box_shape_3d.h | 2 +- .../3d/{ => physics}/capsule_shape_3d.cpp | 0 .../3d/{ => physics}/capsule_shape_3d.h | 2 +- .../concave_polygon_shape_3d.cpp | 0 .../{ => physics}/concave_polygon_shape_3d.h | 2 +- .../{ => physics}/convex_polygon_shape_3d.cpp | 0 .../{ => physics}/convex_polygon_shape_3d.h | 2 +- .../3d/{ => physics}/cylinder_shape_3d.cpp | 0 .../3d/{ => physics}/cylinder_shape_3d.h | 2 +- .../3d/{ => physics}/height_map_shape_3d.cpp | 0 .../3d/{ => physics}/height_map_shape_3d.h | 2 +- .../3d/{ => physics}/mesh_library.cpp | 0 .../resources/3d/{ => physics}/mesh_library.h | 2 +- .../{ => 3d/physics}/physics_material.cpp | 0 .../{ => 3d/physics}/physics_material.h | 0 .../{ => physics}/separation_ray_shape_3d.cpp | 0 .../{ => physics}/separation_ray_shape_3d.h | 2 +- scene/resources/3d/{ => physics}/shape_3d.cpp | 0 scene/resources/3d/{ => physics}/shape_3d.h | 0 .../resources/3d/{ => physics}/sky_material.h | 0 .../3d/{ => physics}/sphere_shape_3d.cpp | 0 .../3d/{ => physics}/sphere_shape_3d.h | 2 +- .../{ => physics}/world_boundary_shape_3d.cpp | 0 .../{ => physics}/world_boundary_shape_3d.h | 2 +- scene/resources/3d/world_3d.cpp | 21 +- scene/resources/3d/world_3d.h | 6 +- scene/resources/SCsub | 2 + scene/resources/mesh.cpp | 8 +- scene/resources/mesh.h | 6 +- scene/resources/visual_shader/SCsub | 6 + .../{ => visual_shader}/visual_shader.cpp | 0 .../{ => visual_shader}/visual_shader.h | 0 .../visual_shader_nodes.compat.inc | 0 .../visual_shader_nodes.cpp | 0 .../{ => visual_shader}/visual_shader_nodes.h | 0 .../visual_shader_particle_nodes.cpp | 0 .../visual_shader_particle_nodes.h | 0 .../visual_shader_sdf_nodes.cpp | 0 .../visual_shader_sdf_nodes.h | 0 servers/SCsub | 27 ++- servers/audio_server.cpp | 2 + servers/extensions/SCsub | 7 +- servers/movie_writer/movie_writer.cpp | 4 + servers/navigation_server_2d.h | 4 +- servers/navigation_server_3d.h | 4 +- servers/register_server_types.cpp | 30 ++- tests/scene/test_navigation_agent_2d.h | 4 +- tests/scene/test_navigation_agent_3d.h | 2 +- tests/scene/test_navigation_obstacle_2d.h | 2 +- tests/scene/test_navigation_obstacle_3d.h | 2 +- tests/scene/test_navigation_region_2d.h | 2 +- tests/scene/test_navigation_region_3d.h | 2 +- tests/scene/test_physics_material.h | 2 +- tests/scene/test_viewport.h | 2 +- tests/test_main.cpp | 7 +- version.py | 7 +- 279 files changed, 1524 insertions(+), 704 deletions(-) create mode 100644 pixel/SCsub create mode 100644 pixel/main_tree.cpp create mode 100644 pixel/main_tree.h create mode 100644 pixel/pixel_engine.cpp create mode 100644 pixel/pixel_engine.h create mode 100644 scene/2d/navigation/SCsub rename scene/2d/{ => navigation}/navigation_agent_2d.cpp (99%) rename scene/2d/{ => navigation}/navigation_agent_2d.h (100%) rename scene/2d/{ => navigation}/navigation_link_2d.cpp (99%) rename scene/2d/{ => navigation}/navigation_link_2d.h (100%) rename scene/2d/{ => navigation}/navigation_obstacle_2d.cpp (99%) rename scene/2d/{ => navigation}/navigation_obstacle_2d.h (100%) rename scene/2d/{ => navigation}/navigation_region_2d.cpp (99%) rename scene/2d/{ => navigation}/navigation_region_2d.h (98%) rename scene/2d/{ => physics}/audio_stream_player_2d.compat.inc (100%) rename scene/2d/{ => physics}/audio_stream_player_2d.cpp (99%) rename scene/2d/{ => physics}/audio_stream_player_2d.h (100%) rename scene/2d/{ => physics}/touch_screen_button.cpp (100%) rename scene/2d/{ => physics}/touch_screen_button.h (98%) create mode 100644 scene/3d/navigation/SCsub rename scene/3d/{ => navigation}/navigation_agent_3d.cpp (99%) rename scene/3d/{ => navigation}/navigation_agent_3d.h (100%) rename scene/3d/{ => navigation}/navigation_link_3d.cpp (100%) rename scene/3d/{ => navigation}/navigation_link_3d.h (100%) rename scene/3d/{ => navigation}/navigation_obstacle_3d.cpp (100%) rename scene/3d/{ => navigation}/navigation_obstacle_3d.h (100%) rename scene/3d/{ => navigation}/navigation_region_3d.cpp (99%) rename scene/3d/{ => navigation}/navigation_region_3d.h (98%) rename scene/3d/{ => physics}/physical_bone_simulator_3d.cpp (100%) rename scene/3d/{ => physics}/physical_bone_simulator_3d.h (100%) rename scene/3d/{ => physics}/soft_body_3d.compat.inc (100%) rename scene/3d/{ => physics}/soft_body_3d.cpp (100%) rename scene/3d/{ => physics}/soft_body_3d.h (100%) rename scene/resources/2d/{ => navigation}/navigation_mesh_source_geometry_data_2d.cpp (100%) rename scene/resources/2d/{ => navigation}/navigation_mesh_source_geometry_data_2d.h (98%) rename scene/resources/2d/{ => navigation}/navigation_polygon.cpp (100%) rename scene/resources/2d/{ => navigation}/navigation_polygon.h (99%) rename scene/resources/2d/{ => physics}/capsule_shape_2d.cpp (100%) rename scene/resources/2d/{ => physics}/capsule_shape_2d.h (98%) rename scene/resources/2d/{ => physics}/circle_shape_2d.cpp (100%) rename scene/resources/2d/{ => physics}/circle_shape_2d.h (98%) rename scene/resources/2d/{ => physics}/concave_polygon_shape_2d.cpp (100%) rename scene/resources/2d/{ => physics}/concave_polygon_shape_2d.h (98%) rename scene/resources/2d/{ => physics}/convex_polygon_shape_2d.cpp (100%) rename scene/resources/2d/{ => physics}/convex_polygon_shape_2d.h (98%) rename scene/resources/2d/{ => physics}/rectangle_shape_2d.cpp (100%) rename scene/resources/2d/{ => physics}/rectangle_shape_2d.h (98%) rename scene/resources/2d/{ => physics}/segment_shape_2d.cpp (100%) rename scene/resources/2d/{ => physics}/segment_shape_2d.h (98%) rename scene/resources/2d/{ => physics}/separation_ray_shape_2d.cpp (100%) rename scene/resources/2d/{ => physics}/separation_ray_shape_2d.h (98%) rename scene/resources/2d/{ => physics}/shape_2d.cpp (100%) rename scene/resources/2d/{ => physics}/shape_2d.h (100%) rename scene/resources/2d/{ => physics}/world_boundary_shape_2d.cpp (100%) rename scene/resources/2d/{ => physics}/world_boundary_shape_2d.h (98%) rename scene/resources/2d/skeleton/{ => physics}/skeleton_modification_2d_jiggle.cpp (99%) rename scene/resources/2d/skeleton/{ => physics}/skeleton_modification_2d_jiggle.h (100%) rename scene/resources/2d/skeleton/{ => physics}/skeleton_modification_2d_physicalbones.cpp (100%) rename scene/resources/2d/skeleton/{ => physics}/skeleton_modification_2d_physicalbones.h (100%) rename scene/resources/{ => 2d}/world_2d.cpp (91%) rename scene/resources/{ => 2d}/world_2d.h (98%) rename scene/resources/{ => 3d/navigation}/navigation_mesh.cpp (100%) rename scene/resources/{ => 3d/navigation}/navigation_mesh.h (100%) rename scene/resources/3d/{ => navigation}/navigation_mesh_source_geometry_data_3d.cpp (100%) rename scene/resources/3d/{ => navigation}/navigation_mesh_source_geometry_data_3d.h (100%) rename scene/resources/3d/{ => physics}/box_shape_3d.cpp (100%) rename scene/resources/3d/{ => physics}/box_shape_3d.h (98%) rename scene/resources/3d/{ => physics}/capsule_shape_3d.cpp (100%) rename scene/resources/3d/{ => physics}/capsule_shape_3d.h (98%) rename scene/resources/3d/{ => physics}/concave_polygon_shape_3d.cpp (100%) rename scene/resources/3d/{ => physics}/concave_polygon_shape_3d.h (98%) rename scene/resources/3d/{ => physics}/convex_polygon_shape_3d.cpp (100%) rename scene/resources/3d/{ => physics}/convex_polygon_shape_3d.h (98%) rename scene/resources/3d/{ => physics}/cylinder_shape_3d.cpp (100%) rename scene/resources/3d/{ => physics}/cylinder_shape_3d.h (98%) rename scene/resources/3d/{ => physics}/height_map_shape_3d.cpp (100%) rename scene/resources/3d/{ => physics}/height_map_shape_3d.h (98%) rename scene/resources/3d/{ => physics}/mesh_library.cpp (100%) rename scene/resources/3d/{ => physics}/mesh_library.h (98%) rename scene/resources/{ => 3d/physics}/physics_material.cpp (100%) rename scene/resources/{ => 3d/physics}/physics_material.h (100%) rename scene/resources/3d/{ => physics}/separation_ray_shape_3d.cpp (100%) rename scene/resources/3d/{ => physics}/separation_ray_shape_3d.h (98%) rename scene/resources/3d/{ => physics}/shape_3d.cpp (100%) rename scene/resources/3d/{ => physics}/shape_3d.h (100%) rename scene/resources/3d/{ => physics}/sky_material.h (100%) rename scene/resources/3d/{ => physics}/sphere_shape_3d.cpp (100%) rename scene/resources/3d/{ => physics}/sphere_shape_3d.h (98%) rename scene/resources/3d/{ => physics}/world_boundary_shape_3d.cpp (100%) rename scene/resources/3d/{ => physics}/world_boundary_shape_3d.h (98%) create mode 100644 scene/resources/visual_shader/SCsub rename scene/resources/{ => visual_shader}/visual_shader.cpp (100%) rename scene/resources/{ => visual_shader}/visual_shader.h (100%) rename scene/resources/{ => visual_shader}/visual_shader_nodes.compat.inc (100%) rename scene/resources/{ => visual_shader}/visual_shader_nodes.cpp (100%) rename scene/resources/{ => visual_shader}/visual_shader_nodes.h (100%) rename scene/resources/{ => visual_shader}/visual_shader_particle_nodes.cpp (100%) rename scene/resources/{ => visual_shader}/visual_shader_particle_nodes.h (100%) rename scene/resources/{ => visual_shader}/visual_shader_sdf_nodes.cpp (100%) rename scene/resources/{ => visual_shader}/visual_shader_sdf_nodes.h (100%) diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index 5a9fb57755f4..e0801ff26919 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -6,7 +6,7 @@ on: env: # Used for the cache key. Add version suffix to force clean build. GODOT_BASE_BRANCH: master - SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes strict_checks=yes + SCONSFLAGS: verbose=yes warnings=extra werror=yes strict_checks=yes DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true TSAN_OPTIONS: suppressions=misc/error_suppressions/tsan.txt @@ -24,76 +24,20 @@ jobs: fail-fast: false matrix: include: - - name: Editor w/ Mono (target=editor) - cache-name: linux-editor-mono - target: editor - sconsflags: module_mono_enabled=yes - bin: ./bin/godot.linuxbsd.editor.x86_64.mono - build-mono: true - tests: false # Disabled due freeze caused by mix Mono build and CI - doc-test: true - proj-conv: true - api-compat: true + - name: Pixel Debug + cache-name: linux_pixel_engine_debug + target: pixel_debug + bin: ./bin/pixel.linuxbsd.pixel_debug.x86_64 artifact: true cache-limit: 1 - - name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, scu_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=gold) - cache-name: linux-editor-double-sanitizers - target: editor - # Debug symbols disabled as they're huge on this build and we hit the 14 GB limit for runners. - sconsflags: dev_build=yes scu_build=yes debug_symbols=no precision=double use_asan=yes use_ubsan=yes linker=gold - bin: ./bin/godot.linuxbsd.editor.dev.double.x86_64.san - build-mono: false - tests: true - proj-test: true - # Generate an API dump for godot-cpp tests. - api-dump: true - # Skip 2GiB artifact speeding up action. - artifact: false - cache-limit: 7 - - - name: Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld) - cache-name: linux-editor-llvm-sanitizers - target: editor - sconsflags: dev_build=yes use_asan=yes use_ubsan=yes use_llvm=yes linker=lld - bin: ./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san - build-mono: false - tests: true - # Skip 2GiB artifact speeding up action. - artifact: false - # Test our oldest supported SCons/Python versions on one arbitrary editor build. - legacy-scons: true - cache-limit: 7 - - - name: Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld) - cache-name: linux-editor-thread-sanitizer - target: editor - tests: true - sconsflags: dev_build=yes use_tsan=yes use_llvm=yes linker=lld - bin: ./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san - build-mono: false - # Skip 2GiB artifact speeding up action. - artifact: false - cache-limit: 5 - - - name: Template w/ Mono (target=template_release, tests=yes) - cache-name: linux-template-mono - target: template_release - sconsflags: module_mono_enabled=yes - bin: ./bin/godot.linuxbsd.template_release.x86_64.mono - build-mono: false - tests: true + - name: Pixel Release + cache-name: linux_pixel_engine_release + target: pixel_debug + bin: ./bin/pixel.linuxbsd.pixel_release.x86_64 artifact: true cache-limit: 1 - - name: Minimal template (target=template_release, tests=yes, everything disabled) - cache-name: linux-template-minimal - target: template_release - sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no - bin: ./bin/godot.linuxbsd.template_release.x86_64 - tests: true - artifact: true - cache-limit: 1 steps: - name: Checkout @@ -142,10 +86,10 @@ jobs: - name: Compilation uses: ./.github/actions/godot-build with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} + sconsflags: ${{ env.SCONSFLAGS }} platform: linuxbsd target: ${{ matrix.target }} - tests: ${{ matrix.tests }} + # tests: ${{ matrix.tests }} scons-cache-limit: ${{ matrix.cache-limit }} - name: Save Godot build cache @@ -154,21 +98,21 @@ jobs: cache-name: ${{ matrix.cache-name }} continue-on-error: true - - name: Generate C# glue - if: matrix.build-mono - run: | - ${{ matrix.bin }} --headless --generate-mono-glue ./modules/mono/glue + # - name: Generate C# glue + # if: matrix.build-mono + # run: | + # ${{ matrix.bin }} --headless --generate-mono-glue ./modules/mono/glue - - name: Build .NET solutions - if: matrix.build-mono - run: | - ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd + # - name: Build .NET solutions + # if: matrix.build-mono + # run: | + # ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd - name: Prepare artifact if: matrix.artifact run: | - strip bin/godot.* - chmod +x bin/godot.* + strip bin/pixel.* + chmod +x bin/pixel.* - name: Upload artifact uses: ./.github/actions/upload-artifact @@ -176,49 +120,49 @@ jobs: with: name: ${{ matrix.cache-name }} - - name: Dump Godot API - uses: ./.github/actions/godot-api-dump - if: matrix.api-dump - with: - bin: ${{ matrix.bin }} - - - name: Unit tests - if: matrix.tests - run: | - ${{ matrix.bin }} --version - ${{ matrix.bin }} --help - ${{ matrix.bin }} --headless --test --force-colors - - - name: .NET source generators tests - if: matrix.build-mono - run: | - dotnet test modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests - - # Check class reference - - name: Check for class reference updates - if: matrix.doc-test - run: | - echo "Running --doctool to see if this changes the public API without updating the documentation." - echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n" - ${{ matrix.bin }} --doctool --headless 2>&1 > /dev/null || true - git diff --color --exit-code && ! git ls-files --others --exclude-standard | sed -e 's/^/New doc file missing in PR: /' | grep 'xml$' - - # Check API backwards compatibility - - name: Check for GDExtension compatibility - if: matrix.api-compat - run: | - ./misc/scripts/validate_extension_api.sh "${{ matrix.bin }}" - - # Download and run the test project - - name: Test Godot project - uses: ./.github/actions/godot-project-test - if: matrix.proj-test - with: - bin: ${{ matrix.bin }} - - # Test the project converter - - name: Test project converter - uses: ./.github/actions/godot-converter-test - if: matrix.proj-conv - with: - bin: ${{ matrix.bin }} + # - name: Dump Godot API + # uses: ./.github/actions/godot-api-dump + # if: matrix.api-dump + # with: + # bin: ${{ matrix.bin }} + + # - name: Unit tests + # if: matrix.tests + # run: | + # ${{ matrix.bin }} --version + # ${{ matrix.bin }} --help + # ${{ matrix.bin }} --headless --test --force-colors + + # - name: .NET source generators tests + # if: matrix.build-mono + # run: | + # dotnet test modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests + + # # Check class reference + # - name: Check for class reference updates + # if: matrix.doc-test + # run: | + # echo "Running --doctool to see if this changes the public API without updating the documentation." + # echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n" + # ${{ matrix.bin }} --doctool --headless 2>&1 > /dev/null || true + # git diff --color --exit-code && ! git ls-files --others --exclude-standard | sed -e 's/^/New doc file missing in PR: /' | grep 'xml$' + + # # Check API backwards compatibility + # - name: Check for GDExtension compatibility + # if: matrix.api-compat + # run: | + # ./misc/scripts/validate_extension_api.sh "${{ matrix.bin }}" + + # # Download and run the test project + # - name: Test Godot project + # uses: ./.github/actions/godot-project-test + # if: matrix.proj-test + # with: + # bin: ${{ matrix.bin }} + + # # Test the project converter + # - name: Test project converter + # uses: ./.github/actions/godot-converter-test + # if: matrix.proj-conv + # with: + # bin: ${{ matrix.bin }} diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml index 3fedc2a5c9a9..dda4b7e7a0d0 100644 --- a/.github/workflows/macos_builds.yml +++ b/.github/workflows/macos_builds.yml @@ -6,7 +6,7 @@ on: env: # Used for the cache key. Add version suffix to force clean build. GODOT_BASE_BRANCH: master - SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes strict_checks=yes + SCONSFLAGS: verbose=yes warnings=extra werror=yes strict_checks=yes concurrency: group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-macos @@ -20,19 +20,17 @@ jobs: fail-fast: false matrix: include: - - name: Editor (target=editor, tests=yes) - cache-name: macos-editor - target: editor - tests: true - bin: ./bin/godot.macos.editor.universal + - name: Pixel Debug + cache-name: macos_pixel_engine_debug + target: pixel_debug + bin: ./bin/pixel.macos.pixel_debug.universal cache-limit: 1 - - name: Template (target=template_release, tests=yes) - cache-name: macos-template - target: template_release - tests: true + - name: Pixel Release + cache-name: macos_pixel_engine_release + target: pixel_release sconsflags: debug_symbols=no - bin: ./bin/godot.macos.template_release.universal + bin: ./bin/pixel.macos.pixel_release.universal cache-limit: 1 steps: @@ -60,8 +58,7 @@ jobs: sconsflags: ${{ env.SCONSFLAGS }} arch=x86_64 platform: macos target: ${{ matrix.target }} - tests: ${{ matrix.tests }} - scons-cache-limit: 0 # Only cap on second run to avoid purging unnecessarily + # tests: ${{ matrix.tests }} - name: Compilation (arm64) uses: ./.github/actions/godot-build @@ -69,8 +66,7 @@ jobs: sconsflags: ${{ env.SCONSFLAGS }} arch=arm64 platform: macos target: ${{ matrix.target }} - tests: ${{ matrix.tests }} - scons-cache-limit: ${{ matrix.cache-limit }} + # tests: ${{ matrix.tests }} - name: Save Godot build cache uses: ./.github/actions/godot-cache-save @@ -80,19 +76,19 @@ jobs: - name: Prepare artifact run: | - lipo -create ./bin/godot.macos.${{ matrix.target }}.x86_64 ./bin/godot.macos.${{ matrix.target }}.arm64 -output ./bin/godot.macos.${{ matrix.target }}.universal - rm ./bin/godot.macos.${{ matrix.target }}.x86_64 ./bin/godot.macos.${{ matrix.target }}.arm64 - strip bin/godot.* - chmod +x bin/godot.* + lipo -create ./bin/pixel.macos.${{ matrix.target }}.x86_64 ./bin/pixel.macos.${{ matrix.target }}.arm64 -output ./bin/pixel.macos.${{ matrix.target }}.universal + rm ./bin/pixel.macos.${{ matrix.target }}.x86_64 ./bin/pixel.macos.${{ matrix.target }}.arm64 + strip bin/pixel.* + chmod +x bin/pixel.* - name: Upload artifact uses: ./.github/actions/upload-artifact with: name: ${{ matrix.cache-name }} - - name: Unit tests - if: matrix.tests - run: | - ${{ matrix.bin }} --version - ${{ matrix.bin }} --help - ${{ matrix.bin }} --test --force-colors + # - name: Unit tests + # if: matrix.tests + # run: | + # ${{ matrix.bin }} --version + # ${{ matrix.bin }} --help + # ${{ matrix.bin }} --test --force-colors diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index fd5e74b914ad..c6cbccad1c6b 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -15,15 +15,15 @@ jobs: # Second stage: Run all the builds and some of the tests. - android-build: - name: ๐Ÿค– Android - needs: static-checks - uses: ./.github/workflows/android_builds.yml + # android-build: + # name: ๐Ÿค– Android + # needs: static-checks + # uses: ./.github/workflows/android_builds.yml - ios-build: - name: ๐Ÿ iOS - needs: static-checks - uses: ./.github/workflows/ios_builds.yml + # ios-build: + # name: ๐Ÿ iOS + # needs: static-checks + # uses: ./.github/workflows/ios_builds.yml linux-build: name: ๐Ÿง Linux @@ -40,19 +40,19 @@ jobs: needs: static-checks uses: ./.github/workflows/windows_builds.yml - web-build: - name: ๐ŸŒ Web - needs: static-checks - uses: ./.github/workflows/web_builds.yml + # web-build: + # name: ๐ŸŒ Web + # needs: static-checks + # uses: ./.github/workflows/web_builds.yml # Third stage: Run auxiliary tests using build artifacts from previous jobs. # Can be turned off for PRs that intentionally break compat with godot-cpp, # until both the upstream PR and the matching godot-cpp changes are merged. - godot-cpp-test: - name: ๐Ÿชฒ Godot CPP - # This can be changed to depend on another platform, if we decide to use it for - # godot-cpp instead. Make sure to move the .github/actions/godot-api-dump step - # appropriately. - needs: linux-build - uses: ./.github/workflows/godot_cpp_test.yml + # godot-cpp-test: + # name: ๐Ÿชฒ Godot CPP + # # This can be changed to depend on another platform, if we decide to use it for + # # godot-cpp instead. Make sure to move the .github/actions/godot-api-dump step + # # appropriately. + # needs: linux-build + # uses: ./.github/workflows/godot_cpp_test.yml diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index c407ae12d099..6994f944f329 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -7,7 +7,7 @@ on: env: # Used for the cache key. Add version suffix to force clean build. GODOT_BASE_BRANCH: master - SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes d3d12=yes strict_checks=yes "angle_libs=${{ github.workspace }}/" + SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no strict_checks=yes d3d12=yes "angle_libs=${{ github.workspace }}/" SCONS_CACHE_MSVC_CONFIG: true concurrency: @@ -23,44 +23,20 @@ jobs: fail-fast: false matrix: include: - - name: Editor (target=editor, tests=yes) - cache-name: windows-editor - target: editor - tests: true - # Skip debug symbols, they're way too big with MSVC. - sconsflags: debug_symbols=no vsproj=yes vsproj_gen_only=no windows_subsystem=console - bin: ./bin/godot.windows.editor.x86_64.exe + - name: Pixel Debug + cache-name: windows_pixel_engine_debug + target: pixel_debug + bin: ./bin/pixel.windows.pixel_debug.x86_64.console.exe compiler: msvc cache-limit: 2 - - name: Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes) - cache-name: windows-editor-clang - target: editor - tests: true - sconsflags: debug_symbols=no windows_subsystem=console use_llvm=yes - bin: ./bin/godot.windows.editor.x86_64.llvm.exe - compiler: clang - cache-limit: 1 - - - name: Template (target=template_release, tests=yes) - cache-name: windows-template - target: template_release - tests: true - sconsflags: debug_symbols=no - bin: ./bin/godot.windows.template_release.x86_64.console.exe + - name: Pixel Release + cache-name: windows_pixel_engine_release + target: pixel_release + bin: ./bin/pixel.windows.pixel_release.x86_64.console.exe compiler: msvc cache-limit: 2 - - name: Template w/ GCC (target=template_release, tests=yes, use_mingw=yes) - cache-name: windows-template-gcc - # MinGW takes MUCH longer to compile; save time by only targeting Template. - target: template_release - tests: true - sconsflags: debug_symbols=no use_mingw=yes - bin: ./bin/godot.windows.template_release.x86_64.console.exe - compiler: gcc - cache-limit: 1 - steps: - name: Checkout uses: actions/checkout@v4 @@ -93,11 +69,10 @@ jobs: - name: Compilation uses: ./.github/actions/godot-build with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} + sconsflags: ${{ env.SCONSFLAGS }} platform: windows target: ${{ matrix.target }} - tests: ${{ matrix.tests }} - scons-cache-limit: ${{ matrix.cache-limit }} + # tests: ${{ matrix.tests }} - name: Save Godot build cache uses: ./.github/actions/godot-cache-save @@ -116,9 +91,9 @@ jobs: with: name: ${{ matrix.cache-name }} - - name: Unit tests - if: matrix.tests - run: | - ${{ matrix.bin }} --version - ${{ matrix.bin }} --help - ${{ matrix.bin }} --test --force-colors + # - name: Unit tests + # if: matrix.tests + # run: | + # ${{ matrix.bin }} --version + # ${{ matrix.bin }} --help + # ${{ matrix.bin }} --test --force-colors diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 77418d45b03c..c5a11c757225 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -162,7 +162,8 @@ repos: platform/android/java/lib/src/com/.*| platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView\.java$| platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper\.java$| - platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix\.java$ + platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix\.java$| + pixel/.* ) - id: header-guards diff --git a/AUTHORS.md b/AUTHORS.md index b21270b3f700..d03dcd74eb35 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -339,3 +339,7 @@ name is available. ๅฟ˜ๅฟงใฎ (Daylily-Zeleen) ่ฐขๅคฉ (jsjtxietian) ้ฃŽ้’ๅฑฑ (Rindbee) + +## Pixel Engine Contributers + + Mounir Tohami (WhalesState) diff --git a/SConstruct b/SConstruct index f49ef9596c6f..94ee82ac8890 100644 --- a/SConstruct +++ b/SConstruct @@ -194,7 +194,7 @@ if env.scons_version >= (4, 3): else: opts.Add("platform", "Target platform (%s)" % "|".join(platform_list), "") opts.Add("p", "Alias for 'platform'", "") -opts.Add(EnumVariable("target", "Compilation target", "editor", ("editor", "template_release", "template_debug"))) +opts.Add(EnumVariable("target", "Compilation target", "pixel_debug", ("pixel_debug", "pixel_release", "editor", "template_release", "template_debug"))) opts.Add(EnumVariable("arch", "CPU architecture", "auto", ["auto"] + architectures, architecture_aliases)) opts.Add(BoolVariable("dev_build", "Developer build with dev-only debugging code (DEV_ENABLED)", False)) opts.Add( @@ -213,7 +213,7 @@ opts.Add(BoolVariable("production", "Set defaults to build Godot for use in prod opts.Add(BoolVariable("threads", "Enable threading support", True)) # Components -opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", True)) +opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", False)) opts.Add(EnumVariable("precision", "Set the floating-point precision level", "single", ("single", "double"))) opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True)) opts.Add(BoolVariable("brotli", "Enable Brotli for decompresson and WOFF2 fonts support", True)) @@ -254,7 +254,10 @@ opts.Add("object_prefix", "Custom prefix added to the base filename of all gener opts.Add(BoolVariable("vsproj", "Generate a Visual Studio solution", False)) opts.Add("vsproj_name", "Name of the Visual Studio solution", "godot") opts.Add("import_env_vars", "A comma-separated list of environment variables to copy from the outer environment.", "") -opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", False)) +opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", True)) +opts.Add(BoolVariable("disable_navigation", "Disable 2D and 3D navigation for a smaller executable", True)) +opts.Add(BoolVariable("disable_physics", "Disable 2D and 3D physics for a smaller executable", True)) +opts.Add(BoolVariable("disable_visual_shader", "Disable visual shader for a smaller executable", True)) opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False)) opts.Add("build_profile", "Path to a file containing a feature build profile", "") opts.Add(BoolVariable("modules_enabled_by_default", "If no, disable all modules except ones explicitly enabled", True)) @@ -470,9 +473,10 @@ env.platform_apis = platform_apis # - Optimization level # - Debug symbols for crash traces / debuggers -env.editor_build = env["target"] == "editor" -env.dev_build = env["dev_build"] -env.debug_features = env["target"] in ["editor", "template_debug"] +env.pixel_engine = env["target"] in ["pixel_debug", "pixel_release"] +env.editor_build = not env.pixel_engine and env["target"] +env.debug_features = env["target"] in ["editor", "template_debug", "pixel_debug"] +env.dev_build = env["target"] == "pixel_debug" or env["dev_build"] if env["optimize"] == "auto": if env.dev_build: @@ -487,13 +491,19 @@ env["debug_symbols"] = methods.get_cmdline_bool("debug_symbols", env.dev_build) if env.editor_build: env.Append(CPPDEFINES=["TOOLS_ENABLED"]) - -if env.debug_features: +elif env["target"] == "pixel_debug": + env.Append(CPPDEFINES=["PIXEL_ENGINE"]) + env.Append(CPPDEFINES=["PIXEL_DEBUG"]) +elif env["target"] == "pixel_release": + env.Append(CPPDEFINES=["PIXEL_ENGINE"]) + env.Append(CPPDEFINES=["PIXEL_RELEASE"]) + +if env.debug_features or env["target"] == "pixel_debug": # DEBUG_ENABLED enables debugging *features* and debug-only code, which is intended # to give *users* extra debugging information for their game development. env.Append(CPPDEFINES=["DEBUG_ENABLED"]) -if env.dev_build: +if env.dev_build or env["target"] == "pixel_debug": # DEV_ENABLED enables *engine developer* code which should only be compiled for those # working on the engine itself. env.Append(CPPDEFINES=["DEV_ENABLED"]) @@ -914,7 +924,7 @@ else: suffix = "." + env["platform"] suffix += "." + env["target"] -if env.dev_build: +if env.dev_build and not env.pixel_engine: suffix += ".dev" if env["precision"] == "double": @@ -1007,6 +1017,31 @@ if env["disable_3d"]: Exit(255) else: env.Append(CPPDEFINES=["_3D_DISABLED"]) + +if env["disable_physics"]: + if env.editor_build: + print_error("Build option `disable_physics=yes` cannot be used for editor builds, only for export template builds.") + Exit(255) + else: + env.Append(CPPDEFINES=["_PHYSICS_DISABLED"]) + +if env["disable_navigation"]: + if env.editor_build: + print_error("Build option `disable_navigation=yes` cannot be used for editor builds, only for export template builds.") + Exit(255) + else: + env.Append(CPPDEFINES=["_NAVIGATION_DISABLED"]) + +if env["disable_visual_shader"]: + if env.editor_build: + print_error( + "Build option `disable_visual_shader=yes` cannot be used for editor builds, " + "only for export template builds." + ) + Exit(255) + else: + env.Append(CPPDEFINES=["_VISUAL_SHADER_DISABLED"]) + if env["disable_advanced_gui"]: if env.editor_build: print_error( @@ -1016,6 +1051,7 @@ if env["disable_advanced_gui"]: Exit(255) else: env.Append(CPPDEFINES=["ADVANCED_GUI_DISABLED"]) + if env["minizip"]: env.Append(CPPDEFINES=["MINIZIP_ENABLED"]) if env["brotli"]: @@ -1069,6 +1105,8 @@ SConscript("servers/SCsub") SConscript("scene/SCsub") if env.editor_build: SConscript("editor/SCsub") +if env.pixel_engine: + SConscript("pixel/SCsub") SConscript("drivers/SCsub") SConscript("platform/SCsub") diff --git a/core/SCsub b/core/SCsub index 8bda230b870c..7ea3a3174e7d 100644 --- a/core/SCsub +++ b/core/SCsub @@ -185,6 +185,9 @@ def version_info_builder(target, source, env): #define VERSION_MAJOR {major} #define VERSION_MINOR {minor} #define VERSION_PATCH {patch} +#define PIXEL_MAJOR {pixel_major} +#define PIXEL_MINOR {pixel_minor} +#define PIXEL_PATCH {pixel_patch} #define VERSION_STATUS "{status}" #define VERSION_BUILD "{build}" #define VERSION_MODULE_CONFIG "{module_config}" diff --git a/core/config/engine.cpp b/core/config/engine.cpp index 250f39b08a32..d8d13433dff6 100644 --- a/core/config/engine.cpp +++ b/core/config/engine.cpp @@ -128,6 +128,9 @@ Dictionary Engine::get_version_info() const { dict["major"] = VERSION_MAJOR; dict["minor"] = VERSION_MINOR; dict["patch"] = VERSION_PATCH; + dict["pixel_major"] = PIXEL_MAJOR; + dict["pixel_minor"] = PIXEL_MINOR; + dict["pixel_patch"] = PIXEL_PATCH; dict["hex"] = VERSION_HEX; dict["status"] = VERSION_STATUS; dict["build"] = VERSION_BUILD; diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 8e5525d0767b..241780eab39c 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -55,12 +55,15 @@ #include "core/variant/typed_array.h" #include "core/variant/variant_parser.h" #include "core/version.h" +#include "core/version_generated.gen.h" #ifdef TOOLS_ENABLED #include "modules/modules_enabled.gen.h" // For mono. #endif // TOOLS_ENABLED +#ifndef PIXEL_ENGINE const String ProjectSettings::PROJECT_DATA_DIR_NAME_SUFFIX = "godot"; +#endif // !PIXEL_ENGINE ProjectSettings *ProjectSettings::singleton = nullptr; @@ -73,7 +76,11 @@ String ProjectSettings::get_project_data_dir_name() const { } String ProjectSettings::get_project_data_path() const { +#ifndef PIXEL_ENGINE return "res://" + get_project_data_dir_name(); +#else + return "user://" + get_project_data_dir_name(); +#endif // !PIXEL_ENGINE } String ProjectSettings::get_resource_path() const { @@ -708,6 +715,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bool p_upwards, bool p_ignore_override) { Error err = _setup(p_path, p_main_pack, p_upwards, p_ignore_override); +#ifndef PIXEL_ENGINE if (err == OK && !p_ignore_override) { String custom_settings = GLOBAL_GET("application/config/project_settings_override"); if (!custom_settings.is_empty()) { @@ -718,6 +726,9 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bo // Updating the default value after the project settings have loaded. bool use_hidden_directory = GLOBAL_GET("application/config/use_hidden_project_data_directory"); project_data_dir_name = (use_hidden_directory ? "." : "") + PROJECT_DATA_DIR_NAME_SUFFIX; +#else + project_data_dir_name = "." + String(VERSION_SHORT_NAME); +#endif // !PIXEL_ENGINE // Using GLOBAL_GET on every block for compressing can be slow, so assigning here. Compression::zstd_long_distance_matching = GLOBAL_GET("compression/formats/zstd/long_distance_matching"); @@ -886,9 +897,14 @@ void ProjectSettings::clear(const String &p_name) { } Error ProjectSettings::save() { - Error error = save_custom(get_resource_path().path_join("project.godot")); +#ifndef PIXEL_ENGINE + const String path = get_resource_path().path_join("project.godot"); +#else + const String path = OS::get_singleton()->get_user_data_dir().path_join("settings.pixel"); +#endif // !PIXEL_ENGINE + Error error = save_custom(path); if (error == OK) { - last_save_time = FileAccess::get_modified_time(get_resource_path().path_join("project.godot")); + last_save_time = FileAccess::get_modified_time(path); } return error; } @@ -1136,7 +1152,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust save_features += f; } - if (p_path.ends_with(".godot") || p_path.ends_with("override.cfg")) { + if (p_path.ends_with(".godot") || p_path.ends_with("override.cfg") || p_path.ends_with(".pixel")) { return _save_settings_text(p_path, save_props, p_custom, save_features); } else if (p_path.ends_with(".binary")) { return _save_settings_binary(p_path, save_props, p_custom, save_features); @@ -1253,10 +1269,10 @@ TypedArray ProjectSettings::get_global_class_list() { if (cf->load(get_global_class_list_path()) == OK) { global_class_list = cf->get_value("", "list", Array()); } else { -#ifndef TOOLS_ENABLED +#if !defined(TOOLS_ENABLED) && !defined(PIXEL_ENGINE) // Script classes can't be recreated in exported project, so print an error. ERR_PRINT("Could not load global script cache."); -#endif +#endif // !defined(TOOLS_ENABLED) && !defined(PIXEL_ENGINE) } // File read succeeded or failed. If it failed, assume everything is still okay. @@ -1459,25 +1475,25 @@ ProjectSettings::ProjectSettings() { } } #endif - +#ifndef PIXEL_ENGINE GLOBAL_DEF_BASIC("application/config/name", ""); GLOBAL_DEF_BASIC(PropertyInfo(Variant::DICTIONARY, "application/config/name_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary()); GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/config/description", PROPERTY_HINT_MULTILINE_TEXT), ""); GLOBAL_DEF_BASIC("application/config/version", ""); GLOBAL_DEF_INTERNAL(PropertyInfo(Variant::STRING, "application/config/tags"), PackedStringArray()); GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/run/main_scene", PROPERTY_HINT_FILE, "*.tscn,*.scn,*.res"), ""); - GLOBAL_DEF("application/run/disable_stdout", false); - GLOBAL_DEF("application/run/disable_stderr", false); - GLOBAL_DEF("application/run/print_header", true); - GLOBAL_DEF("application/run/enable_alt_space_menu", false); GLOBAL_DEF_RST("application/config/use_hidden_project_data_directory", true); GLOBAL_DEF("application/config/use_custom_user_dir", false); GLOBAL_DEF("application/config/custom_user_dir_name", ""); - GLOBAL_DEF("application/config/project_settings_override", ""); - GLOBAL_DEF("application/run/main_loop_type", "SceneTree"); GLOBAL_DEF("application/config/auto_accept_quit", true); GLOBAL_DEF("application/config/quit_on_go_back", true); + GLOBAL_DEF("application/config/project_settings_override", ""); +#endif // !PIXEL_ENGINE + GLOBAL_DEF("application/run/disable_stdout", false); + GLOBAL_DEF("application/run/disable_stderr", false); + GLOBAL_DEF("application/run/print_header", true); + GLOBAL_DEF("application/run/enable_alt_space_menu", false); // The default window size is tuned to: // - Have a 16:9 aspect ratio, @@ -1504,16 +1520,24 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF(PropertyInfo(Variant::INT, "display/window/size/window_width_override", PROPERTY_HINT_RANGE, "0,7680,1,or_greater"), 0); // 8K resolution GLOBAL_DEF(PropertyInfo(Variant::INT, "display/window/size/window_height_override", PROPERTY_HINT_RANGE, "0,4320,1,or_greater"), 0); // 8K resolution +#ifndef PIXEL_ENGINE GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true); +#else + GLOBAL_DEF("display/window/energy_saving/keep_screen_on", false); +#endif // !PIXEL_ENGINE GLOBAL_DEF("animation/warnings/check_invalid_track_paths", true); GLOBAL_DEF("animation/warnings/check_angle_interpolation_type_conflicting", true); +#ifndef PIXEL_ENGINE GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "audio/buses/default_bus_layout", PROPERTY_HINT_FILE, "*.tres"), "res://default_bus_layout.tres"); +#endif // !PIXEL_ENGINE GLOBAL_DEF(PropertyInfo(Variant::INT, "audio/general/default_playback_type", PROPERTY_HINT_ENUM, "Stream,Sample"), 0); GLOBAL_DEF(PropertyInfo(Variant::INT, "audio/general/default_playback_type.web", PROPERTY_HINT_ENUM, "Stream,Sample"), 1); GLOBAL_DEF_RST("audio/general/text_to_speech", false); +#ifndef PIXEL_ENGINE GLOBAL_DEF_RST(PropertyInfo(Variant::FLOAT, "audio/general/2d_panning_strength", PROPERTY_HINT_RANGE, "0,2,0.01"), 0.5f); GLOBAL_DEF_RST(PropertyInfo(Variant::FLOAT, "audio/general/3d_panning_strength", PROPERTY_HINT_RANGE, "0,2,0.01"), 0.5f); +#endif // !PIXEL_ENGINE GLOBAL_DEF(PropertyInfo(Variant::INT, "audio/general/ios/session_category", PROPERTY_HINT_ENUM, "Ambient,Multi Route,Play and Record,Playback,Record,Solo Ambient"), 0); GLOBAL_DEF("audio/general/ios/mix_with_others", false); @@ -1522,7 +1546,9 @@ ProjectSettings::ProjectSettings() { // Keep the enum values in sync with the `DisplayServer::ScreenOrientation` enum. custom_prop_info["display/window/handheld/orientation"] = PropertyInfo(Variant::INT, "display/window/handheld/orientation", PROPERTY_HINT_ENUM, "Landscape,Portrait,Reverse Landscape,Reverse Portrait,Sensor Landscape,Sensor Portrait,Sensor"); +#ifndef PIXEL_ENGINE GLOBAL_DEF("display/window/subwindows/embed_subwindows", true); +#endif // !PIXEL_ENGINE // Keep the enum values in sync with the `DisplayServer::VSyncMode` enum. custom_prop_info["display/window/vsync/vsync_mode"] = PropertyInfo(Variant::INT, "display/window/vsync/vsync_mode", PROPERTY_HINT_ENUM, "Disabled,Enabled,Adaptive,Mailbox"); @@ -1533,9 +1559,11 @@ ProjectSettings::ProjectSettings() { custom_prop_info["rendering/driver/threads/thread_model"] = PropertyInfo(Variant::INT, "rendering/driver/threads/thread_model", PROPERTY_HINT_ENUM, "Safe:1,Separate"); #else custom_prop_info["rendering/driver/threads/thread_model"] = PropertyInfo(Variant::INT, "rendering/driver/threads/thread_model", PROPERTY_HINT_ENUM, "Unsafe (deprecated),Safe,Separate"); -#endif +#endif // DISABLE_DEPRECATED +#ifndef PIXEL_ENGINE GLOBAL_DEF("physics/2d/run_on_separate_thread", false); GLOBAL_DEF("physics/3d/run_on_separate_thread", false); +#endif // !PIXEL_ENGINE GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,canvas_items,viewport"), "disabled"); GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height,expand"), "keep"); @@ -1558,9 +1586,11 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/occlusion_culling/bvh_build_quality", PROPERTY_HINT_ENUM, "Low,Medium,High"), 2); GLOBAL_DEF_RST("rendering/occlusion_culling/jitter_projection", true); +#ifndef PIXEL_ENGINE GLOBAL_DEF_RST("internationalization/rendering/force_right_to_left_layout_direction", false); GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "internationalization/rendering/root_node_layout_direction", PROPERTY_HINT_ENUM, "Based on Application Locale,Left-to-Right,Right-to-Left,Based on System Locale"), 0); GLOBAL_DEF_BASIC("internationalization/rendering/root_node_auto_translate", true); +#endif // !PIXEL_ENGINE GLOBAL_DEF(PropertyInfo(Variant::INT, "gui/timers/incremental_search_max_interval_msec", PROPERTY_HINT_RANGE, "0,10000,1,or_greater"), 2000); GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater"), 0.5); diff --git a/core/config/project_settings.h b/core/config/project_settings.h index 922c88c15132..7594ec1c574b 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -45,7 +45,9 @@ class ProjectSettings : public Object { public: typedef HashMap CustomMap; +#ifndef PIXEL_ENGINE static const String PROJECT_DATA_DIR_NAME_SUFFIX; +#endif // !PIXEL_ENGINE enum { // Properties that are not for built in values begin from this value, so builtin ones are displayed first. diff --git a/core/version.h b/core/version.h index 18a97cadf0de..00a77734f8c8 100644 --- a/core/version.h +++ b/core/version.h @@ -48,6 +48,7 @@ // Defines the main "branch" version. Patch versions in this branch should be // forward-compatible. // Example: "3.1" +#define PIXEL_VERSION _MKSTR(PIXEL_MAJOR) "." _MKSTR(PIXEL_MINOR) "." _MKSTR(PIXEL_PATCH) #define VERSION_BRANCH _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) #if VERSION_PATCH // Example: "3.1.4" diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 669e6c2aa951..27fa8de4eeee 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -314,7 +314,11 @@ Error AudioDriverPulseAudio::init() { if (Engine::get_singleton()->is_editor_hint()) { context_name = VERSION_NAME " Editor"; } else { +#ifndef PIXEL_ENGINE context_name = GLOBAL_GET("application/config/name"); +#else + context_name = "Pixel Engine"; +#endif // !PIXEL_ENGINE if (context_name.is_empty()) { context_name = VERSION_NAME " Project"; } diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 1fc7816774cd..8ec927d4ee56 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -960,6 +960,7 @@ void OS_Unix::unset_environment(const String &p_var) const { } String OS_Unix::get_user_data_dir() const { +#ifndef PIXEL_ENGINE String appname = get_safe_dir_name(GLOBAL_GET("application/config/name")); if (!appname.is_empty()) { bool use_custom_dir = GLOBAL_GET("application/config/use_custom_user_dir"); @@ -973,8 +974,10 @@ String OS_Unix::get_user_data_dir() const { return get_data_path().path_join(get_godot_dir_name()).path_join("app_userdata").path_join(appname); } } - return get_data_path().path_join(get_godot_dir_name()).path_join("app_userdata").path_join("[unnamed project]"); +#else + return get_data_path().path_join(get_godot_dir_name()); +#endif // !PIXEL_ENGINE } String OS_Unix::get_executable_path() const { diff --git a/drivers/vulkan/rendering_context_driver_vulkan.cpp b/drivers/vulkan/rendering_context_driver_vulkan.cpp index df9bd986240d..9b1324120eb8 100644 --- a/drivers/vulkan/rendering_context_driver_vulkan.cpp +++ b/drivers/vulkan/rendering_context_driver_vulkan.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +#include "core/string/ustring.h" #ifdef VULKAN_ENABLED #include "rendering_context_driver_vulkan.h" @@ -682,12 +683,16 @@ Error RenderingContextDriverVulkan::_initialize_instance() { // to anything but 1.0. Note that this value is only used by validation layers to warn us about version issues. uint32_t application_api_version = instance_api_version == VK_API_VERSION_1_0 ? VK_API_VERSION_1_0 : VK_API_VERSION_1_2; +#ifndef PIXEL_ENGINE CharString cs = GLOBAL_GET("application/config/name").operator String().utf8(); +#else + CharString cs = String("Pixel Engine").utf8(); +#endif // !PIXEL_ENGINE VkApplicationInfo app_info = {}; app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; app_info.pApplicationName = cs.get_data(); app_info.pEngineName = VERSION_NAME; - app_info.engineVersion = VK_MAKE_VERSION(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); + app_info.engineVersion = VK_MAKE_VERSION(PIXEL_MAJOR, PIXEL_MINOR, PIXEL_PATCH); app_info.apiVersion = application_api_version; TightLocalVector enabled_layer_names; diff --git a/editor/import/3d/resource_importer_scene.cpp b/editor/import/3d/resource_importer_scene.cpp index 9ab97abd56ca..cb48e6d21b7b 100644 --- a/editor/import/3d/resource_importer_scene.cpp +++ b/editor/import/3d/resource_importer_scene.cpp @@ -40,7 +40,7 @@ #include "editor/import/3d/scene_import_settings.h" #include "scene/3d/importer_mesh_instance_3d.h" #include "scene/3d/mesh_instance_3d.h" -#include "scene/3d/navigation_region_3d.h" +#include "scene/3d/navigation/navigation_region_3d.h" #include "scene/3d/occluder_instance_3d.h" #include "scene/3d/physics/area_3d.h" #include "scene/3d/physics/collision_shape_3d.h" diff --git a/editor/import/3d/resource_importer_scene.h b/editor/import/3d/resource_importer_scene.h index 6868baf023ba..ea2de51bef0b 100644 --- a/editor/import/3d/resource_importer_scene.h +++ b/editor/import/3d/resource_importer_scene.h @@ -35,12 +35,12 @@ #include "core/io/resource_importer.h" #include "core/variant/dictionary.h" #include "scene/3d/importer_mesh_instance_3d.h" -#include "scene/resources/3d/box_shape_3d.h" -#include "scene/resources/3d/capsule_shape_3d.h" -#include "scene/resources/3d/cylinder_shape_3d.h" +#include "scene/resources/3d/physics/box_shape_3d.h" +#include "scene/resources/3d/physics/capsule_shape_3d.h" +#include "scene/resources/3d/physics/cylinder_shape_3d.h" +#include "scene/resources/3d/physics/sphere_shape_3d.h" #include "scene/resources/3d/importer_mesh.h" #include "scene/resources/3d/skin.h" -#include "scene/resources/3d/sphere_shape_3d.h" #include "scene/resources/animation.h" #include "scene/resources/mesh.h" diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 5ef205a967e3..f2d48de0f31d 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -62,7 +62,7 @@ #include "scene/2d/polygon_2d.h" #include "scene/2d/skeleton_2d.h" #include "scene/2d/sprite_2d.h" -#include "scene/2d/touch_screen_button.h" +#include "scene/2d/physics/touch_screen_button.h" #include "scene/gui/base_button.h" #include "scene/gui/flow_container.h" #include "scene/gui/grid_container.h" diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index d45223812fab..490918102f77 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -36,14 +36,14 @@ #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "scene/main/viewport.h" -#include "scene/resources/2d/capsule_shape_2d.h" -#include "scene/resources/2d/circle_shape_2d.h" -#include "scene/resources/2d/concave_polygon_shape_2d.h" -#include "scene/resources/2d/convex_polygon_shape_2d.h" -#include "scene/resources/2d/rectangle_shape_2d.h" -#include "scene/resources/2d/segment_shape_2d.h" -#include "scene/resources/2d/separation_ray_shape_2d.h" -#include "scene/resources/2d/world_boundary_shape_2d.h" +#include "scene/resources/2d/physics/capsule_shape_2d.h" +#include "scene/resources/2d/physics/circle_shape_2d.h" +#include "scene/resources/2d/physics/concave_polygon_shape_2d.h" +#include "scene/resources/2d/physics/convex_polygon_shape_2d.h" +#include "scene/resources/2d/physics/rectangle_shape_2d.h" +#include "scene/resources/2d/physics/segment_shape_2d.h" +#include "scene/resources/2d/physics/separation_ray_shape_2d.h" +#include "scene/resources/2d/physics/world_boundary_shape_2d.h" CollisionShape2DEditor::CollisionShape2DEditor() { grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius"); diff --git a/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp index b92abbcf79c0..4de42b4351c7 100644 --- a/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp @@ -37,14 +37,14 @@ #include "editor/plugins/gizmos/gizmo_3d_helper.h" #include "editor/plugins/node_3d_editor_plugin.h" #include "scene/3d/physics/collision_shape_3d.h" -#include "scene/resources/3d/box_shape_3d.h" -#include "scene/resources/3d/capsule_shape_3d.h" -#include "scene/resources/3d/concave_polygon_shape_3d.h" -#include "scene/resources/3d/convex_polygon_shape_3d.h" -#include "scene/resources/3d/cylinder_shape_3d.h" +#include "scene/resources/3d/physics/box_shape_3d.h" +#include "scene/resources/3d/physics/capsule_shape_3d.h" +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/convex_polygon_shape_3d.h" +#include "scene/resources/3d/physics/cylinder_shape_3d.h" #include "scene/resources/3d/height_map_shape_3d.h" #include "scene/resources/3d/separation_ray_shape_3d.h" -#include "scene/resources/3d/sphere_shape_3d.h" +#include "scene/resources/3d/physics/sphere_shape_3d.h" #include "scene/resources/3d/world_boundary_shape_3d.h" CollisionShape3DGizmoPlugin::CollisionShape3DGizmoPlugin() { diff --git a/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp index 51d15a0a70f7..b0f6646dcfe2 100644 --- a/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp @@ -32,7 +32,7 @@ #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/node_3d_editor_plugin.h" -#include "scene/3d/navigation_link_3d.h" +#include "scene/3d/navigation/navigation_link_3d.h" #include "servers/navigation_server_3d.h" NavigationLink3DGizmoPlugin::NavigationLink3DGizmoPlugin() { diff --git a/editor/plugins/gizmos/navigation_region_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/navigation_region_3d_gizmo_plugin.cpp index 14105f0b3bf6..172b1f027b9f 100644 --- a/editor/plugins/gizmos/navigation_region_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/navigation_region_3d_gizmo_plugin.cpp @@ -31,7 +31,7 @@ #include "navigation_region_3d_gizmo_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h" -#include "scene/3d/navigation_region_3d.h" +#include "scene/3d/navigation/navigation_region_3d.h" #include "servers/navigation_server_3d.h" NavigationRegion3DGizmoPlugin::NavigationRegion3DGizmoPlugin() { diff --git a/editor/plugins/gizmos/spring_arm_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/spring_arm_3d_gizmo_plugin.cpp index 74c55bf3dddc..58f716b3fb3a 100644 --- a/editor/plugins/gizmos/spring_arm_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/spring_arm_3d_gizmo_plugin.cpp @@ -33,7 +33,7 @@ #include "editor/editor_settings.h" #include "editor/plugins/node_3d_editor_plugin.h" #include "scene/3d/physics/spring_arm_3d.h" -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" void SpringArm3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { SpringArm3D *spring_arm = Object::cast_to(p_gizmo->get_node_3d()); diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index 515e6b44529f..00ca1497e077 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -36,7 +36,7 @@ #include "editor/multi_node_edit.h" #include "editor/plugins/node_3d_editor_plugin.h" #include "editor/themes/editor_scale.h" -#include "scene/3d/navigation_region_3d.h" +#include "scene/3d/navigation/navigation_region_3d.h" #include "scene/3d/physics/collision_shape_3d.h" #include "scene/3d/physics/physics_body_3d.h" #include "scene/3d/physics/static_body_3d.h" @@ -45,8 +45,8 @@ #include "scene/gui/dialogs.h" #include "scene/gui/menu_button.h" #include "scene/gui/spin_box.h" -#include "scene/resources/3d/concave_polygon_shape_3d.h" -#include "scene/resources/3d/convex_polygon_shape_3d.h" +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/convex_polygon_shape_3d.h" #include "scene/resources/3d/primitive_meshes.h" void MeshInstance3DEditor::_node_removed(Node *p_node) { diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 39401e27388e..9a1bb0a42bcf 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -39,7 +39,7 @@ #include "editor/plugins/node_3d_editor_plugin.h" #include "main/main.h" #include "scene/3d/mesh_instance_3d.h" -#include "scene/3d/navigation_region_3d.h" +#include "scene/3d/navigation/navigation_region_3d.h" #include "scene/3d/physics/physics_body_3d.h" #include "scene/3d/physics/static_body_3d.h" #include "scene/gui/menu_button.h" diff --git a/editor/plugins/navigation_link_2d_editor_plugin.h b/editor/plugins/navigation_link_2d_editor_plugin.h index 7a4be18c3167..3fb01c3078d5 100644 --- a/editor/plugins/navigation_link_2d_editor_plugin.h +++ b/editor/plugins/navigation_link_2d_editor_plugin.h @@ -32,7 +32,7 @@ #define NAVIGATION_LINK_2D_EDITOR_PLUGIN_H #include "editor/plugins/editor_plugin.h" -#include "scene/2d/navigation_link_2d.h" +#include "scene/2d/navigation/navigation_link_2d.h" class CanvasItemEditor; diff --git a/editor/plugins/navigation_obstacle_2d_editor_plugin.h b/editor/plugins/navigation_obstacle_2d_editor_plugin.h index ae5b3a056aee..a30278a3689d 100644 --- a/editor/plugins/navigation_obstacle_2d_editor_plugin.h +++ b/editor/plugins/navigation_obstacle_2d_editor_plugin.h @@ -32,7 +32,7 @@ #define NAVIGATION_OBSTACLE_2D_EDITOR_PLUGIN_H #include "editor/plugins/abstract_polygon_2d_editor.h" -#include "scene/2d/navigation_obstacle_2d.h" +#include "scene/2d/navigation/navigation_obstacle_2d.h" class NavigationObstacle2DEditor : public AbstractPolygon2DEditor { GDCLASS(NavigationObstacle2DEditor, AbstractPolygon2DEditor); diff --git a/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp b/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp index ee385b6dceac..9aaec7fcfd37 100644 --- a/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp +++ b/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp @@ -37,7 +37,7 @@ #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/node_3d_editor_plugin.h" -#include "scene/3d/navigation_obstacle_3d.h" +#include "scene/3d/navigation/navigation_obstacle_3d.h" #include "scene/gui/button.h" #include "scene/gui/dialogs.h" #include "servers/navigation_server_3d.h" diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp index c11a7cf20e2f..0ca7cf37f24f 100644 --- a/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -33,7 +33,7 @@ #include "editor/editor_node.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" -#include "scene/2d/navigation_region_2d.h" +#include "scene/2d/navigation/navigation_region_2d.h" #include "scene/gui/dialogs.h" Ref NavigationPolygonEditor::_ensure_navpoly() const { diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index c4abc5b20cf2..01404f91c7d6 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -48,7 +48,7 @@ #include "scene/gui/separator.h" #include "scene/gui/texture_rect.h" #include "scene/property_utils.h" -#include "scene/resources/3d/capsule_shape_3d.h" +#include "scene/resources/3d/physics/capsule_shape_3d.h" #include "scene/resources/skeleton_profile.h" #include "scene/resources/surface_tool.h" diff --git a/main/main.cpp b/main/main.cpp index b3b6d960e7a1..bd4c640f2ea2 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -28,6 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +/**************************************************************************/ +/* PIXEL ENGINE */ +/* Copyright (c) 2024-present Pixel Engine contributors (see AUTHORS.md). */ +/**************************************************************************/ +/* NOTICE: */ +/* This file contains modifications and additions specific to the Pixel */ +/* Engine project. While these changes are licensed under the MIT license */ +/* for compatibility, we request proper attribution if reused in any */ +/* derivative works, including meta-forks. */ +/**************************************************************************/ + #include "main.h" #include "core/config/project_settings.h" @@ -58,6 +69,7 @@ #include "main/performance.h" #include "main/splash.gen.h" #include "modules/register_module_types.h" +#include "pixel/main_tree.h" #include "platform/register_platform_apis.h" #include "scene/main/scene_tree.h" #include "scene/main/window.h" @@ -70,16 +82,19 @@ #include "servers/display_server.h" #include "servers/movie_writer/movie_writer.h" #include "servers/movie_writer/movie_writer_mjpeg.h" +#ifndef _NAVIGATION_DISABLED +#include "servers/navigation_server_2d.h" +#include "servers/navigation_server_2d_dummy.h" #include "servers/navigation_server_3d.h" #include "servers/navigation_server_3d_dummy.h" +#endif // !_NAVIGATION_DISABLED #include "servers/register_server_types.h" #include "servers/rendering/rendering_server_default.h" #include "servers/text/text_server_dummy.h" #include "servers/text_server.h" // 2D -#include "servers/navigation_server_2d.h" -#include "servers/navigation_server_2d_dummy.h" +#ifndef _PHYSICS_DISABLED #include "servers/physics_server_2d.h" #include "servers/physics_server_2d_dummy.h" @@ -88,6 +103,7 @@ #include "servers/physics_server_3d_dummy.h" #include "servers/xr_server.h" #endif // _3D_DISABLED +#endif // !_PHYSICS_DISABLED #ifdef TESTS_ENABLED #include "tests/test_main.h" @@ -162,15 +178,19 @@ static DisplayServer *display_server = nullptr; static RenderingServer *rendering_server = nullptr; static TextServerManager *tsman = nullptr; static ThemeDB *theme_db = nullptr; +#ifndef _NAVIGATION_DISABLED static NavigationServer2D *navigation_server_2d = nullptr; +static NavigationServer3D *navigation_server_3d = nullptr; +#endif // !_NAVIGATION_DISABLED +#ifndef _PHYSICS_DISABLED static PhysicsServer2DManager *physics_server_2d_manager = nullptr; static PhysicsServer2D *physics_server_2d = nullptr; -static NavigationServer3D *navigation_server_3d = nullptr; #ifndef _3D_DISABLED static PhysicsServer3DManager *physics_server_3d_manager = nullptr; static PhysicsServer3D *physics_server_3d = nullptr; static XRServer *xr_server = nullptr; -#endif // _3D_DISABLED +#endif // !_3D_DISABLED +#endif // !_PHYSICS_DISABLED // We error out if setup2() doesn't turn this true static bool _start_success = false; @@ -189,6 +209,7 @@ static int audio_driver_idx = -1; static bool single_window = false; static bool editor = false; static bool project_manager = false; +static bool pixel_engine = false; static bool cmdline_tool = false; static String locale; static String log_file; @@ -314,6 +335,7 @@ static Vector get_files_with_extension(const String &p_root, const Strin } #endif +#ifndef _PHYSICS_DISABLED // FIXME: Could maybe be moved to have less code in main.cpp. void initialize_physics() { #ifndef _3D_DISABLED @@ -334,7 +356,7 @@ void initialize_physics() { // Should be impossible, but make sure it's not null. ERR_FAIL_NULL_MSG(physics_server_3d, "Failed to initialize PhysicsServer3D."); physics_server_3d->init(); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED // 2D Physics server physics_server_2d = PhysicsServer2DManager::get_singleton()->new_server( @@ -359,11 +381,12 @@ void finalize_physics() { #ifndef _3D_DISABLED physics_server_3d->finish(); memdelete(physics_server_3d); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED physics_server_2d->finish(); memdelete(physics_server_2d); } +#endif // !_PHYSICS_DISABLED void finalize_display() { rendering_server->finish(); @@ -372,6 +395,7 @@ void finalize_display() { memdelete(display_server); } +#ifndef _NAVIGATION_DISABLED void initialize_navigation_server() { ERR_FAIL_COND(navigation_server_3d != nullptr); ERR_FAIL_COND(navigation_server_2d != nullptr); @@ -409,6 +433,7 @@ void finalize_navigation_server() { memdelete(navigation_server_2d); navigation_server_2d = nullptr; } +#endif // !_NAVIGATION_DISABLED void initialize_theme_db() { theme_db = memnew(ThemeDB); @@ -731,11 +756,12 @@ Error Main::test_setup() { tsman->add_interface(ts); } +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED physics_server_3d_manager = memnew(PhysicsServer3DManager); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED physics_server_2d_manager = memnew(PhysicsServer2DManager); - +#endif // !_PHYSICS_DISABLED // From `Main::setup2()`. register_early_core_singletons(); initialize_modules(MODULE_INITIALIZATION_LEVEL_CORE); @@ -786,7 +812,9 @@ Error Main::test_setup() { // Theme needs modules to be initialized so that sub-resources can be loaded. theme_db->initialize_theme_noproject(); +#ifndef _NAVIGATION_DISABLED initialize_navigation_server(); +#endif // !_NAVIGATION_DISABLED ERR_FAIL_COND_V(TextServerManager::get_singleton()->get_interface_count() == 0, ERR_CANT_CREATE); @@ -848,7 +876,9 @@ void Main::test_cleanup() { finalize_theme_db(); +#ifndef _NAVIGATION_DISABLED finalize_navigation_server(); +#endif // !_NAVIGATION_DISABLED GDExtensionManager::get_singleton()->deinitialize_extensions(GDExtension::INITIALIZATION_LEVEL_SERVERS); uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS); @@ -866,14 +896,16 @@ void Main::test_cleanup() { if (tsman) { memdelete(tsman); } +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED if (physics_server_3d_manager) { memdelete(physics_server_3d_manager); } -#endif // _3D_DISABLED +#endif // !_3D_DISABLED if (physics_server_2d_manager) { memdelete(physics_server_2d_manager); } +#endif // !_PHYSICS_DISABLED if (globals) { memdelete(globals); } @@ -1851,7 +1883,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #ifdef TOOLS_ENABLED found_project = true; #endif - } else { + } +#ifndef PIXEL_ENGINE + else { #ifdef TOOLS_ENABLED editor = false; #else @@ -1862,11 +1896,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph goto error; #endif } +#else + pixel_engine = true; +#endif // Initialize WorkerThreadPool. { #ifdef THREADS_ENABLED - if (editor || project_manager) { + if (editor || project_manager || pixel_engine) { WorkerThreadPool::get_singleton()->init(-1, 0.75); } else { int worker_threads = GLOBAL_GET("threading/worker_pool/max_threads"); @@ -1988,21 +2025,23 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->add_logger(memnew(RotatedFileLogger(base_path, max_files))); } - if (main_args.size() == 0 && String(GLOBAL_GET("application/run/main_scene")) == "") { +#ifndef PIXEL_ENGINE + if (!pixel_engine && main_args.size() == 0 && String(GLOBAL_GET("application/run/main_scene")) == "") { #ifdef TOOLS_ENABLED if (!editor && !project_manager) { -#endif +#endif // TOOLS_ENABLED const String error_msg = "Error: Can't run project: no main scene defined in the project.\n"; OS::get_singleton()->print("%s", error_msg.utf8().get_data()); OS::get_singleton()->alert(error_msg); goto error; #ifdef TOOLS_ENABLED } -#endif +#endif // TOOLS_ENABLED } +#endif // !PIXEL_ENGINE - if (editor || project_manager) { - Engine::get_singleton()->set_editor_hint(true); + if (editor || project_manager || pixel_engine) { + Engine::get_singleton()->set_editor_hint(!pixel_engine); use_custom_res = false; input_map->load_default(); //keys for editor } else { @@ -2896,11 +2935,12 @@ Error Main::setup2(bool p_show_boot_logo) { ts.instantiate(); tsman->add_interface(ts); } - +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED physics_server_3d_manager = memnew(PhysicsServer3DManager); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED physics_server_2d_manager = memnew(PhysicsServer2DManager); +#endif // !_PHYSICS_DISABLED register_server_types(); { @@ -3014,15 +3054,16 @@ Error Main::setup2(bool p_show_boot_logo) { if (tsman) { memdelete(tsman); } +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED if (physics_server_3d_manager) { memdelete(physics_server_3d_manager); } -#endif // _3D_DISABLED +#endif // !_3D_DISABLED if (physics_server_2d_manager) { memdelete(physics_server_2d_manager); } - +#endif // !_PHYSICS_DISABLED return err; } @@ -3359,7 +3400,9 @@ Error Main::setup2(bool p_show_boot_logo) { extensions.push_back("cs"); } extensions.push_back("gdshader"); +#ifdef TOOLS_ENABLED GLOBAL_DEF_NOVAL(PropertyInfo(Variant::PACKED_STRING_ARRAY, "editor/script/search_in_file_extensions"), extensions); // Note: should be defined after Scene level modules init to see .NET. +#endif // TOOLS_ENABLED OS::get_singleton()->benchmark_end_measure("Startup", "Scene"); @@ -3407,11 +3450,15 @@ Error Main::setup2(bool p_show_boot_logo) { MAIN_PRINT("Main: Load Physics"); +#ifndef _PHYSICS_DISABLED initialize_physics(); +#endif // !_PHYSICS_DISABLED MAIN_PRINT("Main: Load Navigation"); +#ifndef _NAVIGATION_DISABLED initialize_navigation_server(); +#endif // !_NAVIGATION_DISABLED register_server_singletons(); @@ -3569,8 +3616,9 @@ int Main::start() { #endif // TOOLS_ENABLED main_timer_sync.init(OS::get_singleton()->get_ticks_usec()); - List args = OS::get_singleton()->get_cmdline_args(); +#ifndef PIXEL_ENGINE + List args = OS::get_singleton()->get_cmdline_args(); for (List::Element *E = args.front(); E; E = E->next()) { // First check parameters that do not have an argument to the right. @@ -3675,6 +3723,7 @@ int Main::start() { } #endif } +#endif // !PIXEL_ENGINE uint64_t minimum_time_msec = GLOBAL_DEF(PropertyInfo(Variant::INT, "application/boot_splash/minimum_display_time", PROPERTY_HINT_RANGE, "0,100,1,or_greater,suffix:ms"), 0); if (Engine::get_singleton()->is_editor_hint()) { @@ -3817,9 +3866,11 @@ int Main::start() { #endif // TOOLS_ENABLED +#ifndef PIXEL_ENGINE if (script.is_empty() && game_path.is_empty() && String(GLOBAL_GET("application/run/main_scene")) != "") { game_path = GLOBAL_GET("application/run/main_scene"); } +#endif // !PIXEL_ENGINE #ifdef TOOLS_ENABLED if (!editor && !project_manager && !cmdline_tool && script.is_empty() && game_path.is_empty()) { @@ -3832,9 +3883,15 @@ int Main::start() { } #endif +#ifdef PIXEL_ENGINE + pixel_engine = true; +#endif + MainLoop *main_loop = nullptr; if (editor) { main_loop = memnew(SceneTree); + } else if (pixel_engine) { + main_loop = memnew(MainTree); } if (main_loop_type.is_empty()) { main_loop_type = GLOBAL_GET("application/run/main_loop_type"); @@ -3913,12 +3970,15 @@ int Main::start() { SceneTree *sml = Object::cast_to(main_loop); if (sml) { #ifdef DEBUG_ENABLED +#ifndef _PHYSICS_DISABLED if (debug_collisions) { sml->set_debug_collisions_hint(true); } +#endif // !_PHYSICS_DISABLED if (debug_paths) { sml->set_debug_paths_hint(true); } +#ifndef _NAVIGATION_DISABLED if (debug_navigation) { sml->set_debug_navigation_hint(true); NavigationServer3D::get_singleton()->set_debug_navigation_enabled(true); @@ -3930,6 +3990,7 @@ int Main::start() { NavigationServer3D::get_singleton()->set_active(true); NavigationServer3D::get_singleton()->set_debug_enabled(true); } +#endif // !_NAVIGATION_DISABLED if (debug_canvas_item_redraw) { RenderingServer::get_singleton()->canvas_item_set_debug_redraw(true); } @@ -3939,7 +4000,11 @@ int Main::start() { sml->set_disable_node_threading(true); } +#ifndef PIXEL_ENGINE bool embed_subwindows = GLOBAL_GET("display/window/subwindows/embed_subwindows"); +#else + bool embed_subwindows = false; +#endif // !PIXEL_ENGINE if (single_window || (!project_manager && !editor && embed_subwindows) || !DisplayServer::get_singleton()->has_feature(DisplayServer::Feature::FEATURE_SUBWINDOWS)) { sml->get_root()->set_embedding_subwindows(true); @@ -3948,7 +4013,7 @@ int Main::start() { ResourceLoader::add_custom_loaders(); ResourceSaver::add_custom_savers(); - if (!project_manager && !editor) { // game + if (!project_manager && !editor && !pixel_engine) { // game if (!game_path.is_empty() || !script.is_empty()) { //autoload OS::get_singleton()->benchmark_begin_measure("Startup", "Load Autoloads"); @@ -4071,8 +4136,10 @@ int Main::start() { OS::get_singleton()->benchmark_end_measure("Startup", "Editor"); } #endif +#ifndef PIXEL_ENGINE sml->set_auto_accept_quit(GLOBAL_GET("application/config/auto_accept_quit")); sml->set_quit_on_go_back(GLOBAL_GET("application/config/quit_on_go_back")); +#endif // !PIXEL_ENGINE if (!editor && !project_manager) { //standard helpers that can be changed from main config @@ -4113,9 +4180,13 @@ int Main::start() { sml->get_root()->set_content_scale_size(stretch_size); sml->get_root()->set_content_scale_factor(stretch_scale); +#ifndef PIXEL_ENGINE sml->set_auto_accept_quit(GLOBAL_GET("application/config/auto_accept_quit")); sml->set_quit_on_go_back(GLOBAL_GET("application/config/quit_on_go_back")); String appname = GLOBAL_GET("application/config/name"); +#else + String appname = "Pixel Engine"; +#endif // !PIXEL_ENGINE appname = TranslationServer::get_singleton()->translate(appname); #ifdef DEBUG_ENABLED // Append a suffix to the window title to denote that the project is running @@ -4200,7 +4271,7 @@ int Main::start() { } #endif } - +#ifndef PIXEL_ENGINE if (!project_manager && !editor) { // game OS::get_singleton()->benchmark_begin_measure("Startup", "Load Game"); @@ -4247,6 +4318,7 @@ int Main::start() { OS::get_singleton()->benchmark_end_measure("Startup", "Load Game"); } +#endif // !PIXEL_ENGINE #ifdef TOOLS_ENABLED if (project_manager) { @@ -4349,10 +4421,11 @@ bool Main::iteration() { uint64_t physics_process_ticks = 0; uint64_t process_ticks = 0; +#ifndef _NAVIGATION_DISABLED uint64_t navigation_process_ticks = 0; +#endif // !_NAVIGATION_DISABLED frame += ticks_elapsed; - last_ticks = ticks; const int max_physics_steps = Engine::get_singleton()->get_max_physics_steps_per_frame(); @@ -4368,8 +4441,10 @@ bool Main::iteration() { XRServer::get_singleton()->_process(); #endif // _3D_DISABLED +#ifndef _NAVIGATION_DISABLED NavigationServer2D::get_singleton()->sync(); NavigationServer3D::get_singleton()->sync(); +#endif // !_NAVIGATION_DISABLED for (int iters = 0; iters < advance.physics_steps; ++iters) { if (Input::get_singleton()->is_agile_input_event_flushing()) { @@ -4385,11 +4460,11 @@ bool Main::iteration() { // by the physics server, otherwise the current and previous transforms // may be the same, and no interpolation takes place. OS::get_singleton()->get_main_loop()->iteration_prepare(); - +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED PhysicsServer3D::get_singleton()->sync(); PhysicsServer3D::get_singleton()->flush_queries(); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED PhysicsServer2D::get_singleton()->sync(); PhysicsServer2D::get_singleton()->flush_queries(); @@ -4397,30 +4472,35 @@ bool Main::iteration() { if (OS::get_singleton()->get_main_loop()->physics_process(physics_step * time_scale)) { #ifndef _3D_DISABLED PhysicsServer3D::get_singleton()->end_sync(); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED PhysicsServer2D::get_singleton()->end_sync(); Engine::get_singleton()->_in_physics = false; exit = true; break; } +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED uint64_t navigation_begin = OS::get_singleton()->get_ticks_usec(); NavigationServer3D::get_singleton()->process(physics_step * time_scale); navigation_process_ticks = MAX(navigation_process_ticks, OS::get_singleton()->get_ticks_usec() - navigation_begin); // keep the largest one for reference navigation_process_max = MAX(OS::get_singleton()->get_ticks_usec() - navigation_begin, navigation_process_max); +#endif // !_NAVIGATION_DISABLED message_queue->flush(); +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED PhysicsServer3D::get_singleton()->end_sync(); PhysicsServer3D::get_singleton()->step(physics_step * time_scale); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED PhysicsServer2D::get_singleton()->end_sync(); PhysicsServer2D::get_singleton()->step(physics_step * time_scale); +#endif // !_PHYSICS_DISABLED message_queue->flush(); @@ -4647,8 +4727,12 @@ void Main::cleanup(bool p_force) { finalize_theme_db(); // Before deinitializing server extensions, finalize servers which may be loaded as extensions. +#ifndef _NAVIGATION_DISABLED finalize_navigation_server(); +#endif // !_NAVIGATION_DISABLED +#ifndef _PHYSICS_DISABLED finalize_physics(); +#endif // !_PHYSICS_DISABLED GDExtensionManager::get_singleton()->deinitialize_extensions(GDExtension::INITIALIZATION_LEVEL_SERVERS); uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS); @@ -4694,14 +4778,16 @@ void Main::cleanup(bool p_force) { if (tsman) { memdelete(tsman); } +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED if (physics_server_3d_manager) { memdelete(physics_server_3d_manager); } -#endif // _3D_DISABLED +#endif // !_3D_DISABLED if (physics_server_2d_manager) { memdelete(physics_server_2d_manager); } +#endif // !_PHYSICS_DISABLED if (globals) { memdelete(globals); } diff --git a/main/performance.cpp b/main/performance.cpp index 398511995b01..b56b7e2729fc 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -35,15 +35,17 @@ #include "scene/main/node.h" #include "scene/main/scene_tree.h" #include "servers/audio_server.h" -#include "servers/navigation_server_3d.h" #include "servers/rendering_server.h" -// 2D +#ifndef _NAVIGATION_DISABLED +#include "servers/navigation_server_3d.h" +#endif // !_NAVIGATION_DISABLED +#ifndef _PHYSICS_DISABLED #include "servers/physics_server_2d.h" - #ifndef _3D_DISABLED #include "servers/physics_server_3d.h" -#endif // _3D_DISABLED +#endif // !_3D_DISABLED +#endif // !_PHYSICS_DISABLED Performance *Performance::singleton = nullptr; @@ -73,6 +75,7 @@ void Performance::_bind_methods() { BIND_ENUM_CONSTANT(RENDER_VIDEO_MEM_USED); BIND_ENUM_CONSTANT(RENDER_TEXTURE_MEM_USED); BIND_ENUM_CONSTANT(RENDER_BUFFER_MEM_USED); +#ifndef _PHYSICS_DISABLED BIND_ENUM_CONSTANT(PHYSICS_2D_ACTIVE_OBJECTS); BIND_ENUM_CONSTANT(PHYSICS_2D_COLLISION_PAIRS); BIND_ENUM_CONSTANT(PHYSICS_2D_ISLAND_COUNT); @@ -81,7 +84,9 @@ void Performance::_bind_methods() { BIND_ENUM_CONSTANT(PHYSICS_3D_COLLISION_PAIRS); BIND_ENUM_CONSTANT(PHYSICS_3D_ISLAND_COUNT); #endif // _3D_DISABLED +#endif // !_PHYSICS_DISABLED BIND_ENUM_CONSTANT(AUDIO_OUTPUT_LATENCY); +#ifndef _NAVIGATION_DISABLED BIND_ENUM_CONSTANT(NAVIGATION_ACTIVE_MAPS); BIND_ENUM_CONSTANT(NAVIGATION_REGION_COUNT); BIND_ENUM_CONSTANT(NAVIGATION_AGENT_COUNT); @@ -92,6 +97,7 @@ void Performance::_bind_methods() { BIND_ENUM_CONSTANT(NAVIGATION_EDGE_CONNECTION_COUNT); BIND_ENUM_CONSTANT(NAVIGATION_EDGE_FREE_COUNT); BIND_ENUM_CONSTANT(NAVIGATION_OBSTACLE_COUNT); +#endif // !_NAVIGATION_DISABLED BIND_ENUM_CONSTANT(PIPELINE_COMPILATIONS_CANVAS); BIND_ENUM_CONSTANT(PIPELINE_COMPILATIONS_MESH); BIND_ENUM_CONSTANT(PIPELINE_COMPILATIONS_SURFACE); @@ -202,6 +208,8 @@ double Performance::get_monitor(Monitor p_monitor) const { return RS::get_singleton()->get_rendering_info(RS::RENDERING_INFO_PIPELINE_COMPILATIONS_DRAW); case PIPELINE_COMPILATIONS_SPECIALIZATION: return RS::get_singleton()->get_rendering_info(RS::RENDERING_INFO_PIPELINE_COMPILATIONS_SPECIALIZATION); + +#ifndef _PHYSICS_DISABLED case PHYSICS_2D_ACTIVE_OBJECTS: return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_ACTIVE_OBJECTS); case PHYSICS_2D_COLLISION_PAIRS: @@ -210,9 +218,7 @@ double Performance::get_monitor(Monitor p_monitor) const { return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_ISLAND_COUNT); #ifdef _3D_DISABLED case PHYSICS_3D_ACTIVE_OBJECTS: - return 0; case PHYSICS_3D_COLLISION_PAIRS: - return 0; case PHYSICS_3D_ISLAND_COUNT: return 0; #else @@ -222,10 +228,20 @@ double Performance::get_monitor(Monitor p_monitor) const { return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_COLLISION_PAIRS); case PHYSICS_3D_ISLAND_COUNT: return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_ISLAND_COUNT); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED +#else + case PHYSICS_2D_ACTIVE_OBJECTS: + case PHYSICS_2D_COLLISION_PAIRS: + case PHYSICS_2D_ISLAND_COUNT: + case PHYSICS_3D_ACTIVE_OBJECTS: + case PHYSICS_3D_COLLISION_PAIRS: + case PHYSICS_3D_ISLAND_COUNT: + return 0; +#endif // !_PHYSICS_DISABLED case AUDIO_OUTPUT_LATENCY: return AudioServer::get_singleton()->get_output_latency(); +#ifndef _NAVIGATION_DISABLED case NAVIGATION_ACTIVE_MAPS: return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_ACTIVE_MAPS); case NAVIGATION_REGION_COUNT: @@ -246,6 +262,19 @@ double Performance::get_monitor(Monitor p_monitor) const { return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_FREE_COUNT); case NAVIGATION_OBSTACLE_COUNT: return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_OBSTACLE_COUNT); +#else + case NAVIGATION_ACTIVE_MAPS: + case NAVIGATION_REGION_COUNT: + case NAVIGATION_AGENT_COUNT: + case NAVIGATION_LINK_COUNT: + case NAVIGATION_POLYGON_COUNT: + case NAVIGATION_EDGE_COUNT: + case NAVIGATION_EDGE_MERGE_COUNT: + case NAVIGATION_EDGE_CONNECTION_COUNT: + case NAVIGATION_EDGE_FREE_COUNT: + case NAVIGATION_OBSTACLE_COUNT: + return 0; +#endif // !_NAVIGATION_DISABLED default: { } diff --git a/methods.py b/methods.py index 6db6b9580c5e..95038c48bc71 100644 --- a/methods.py +++ b/methods.py @@ -174,6 +174,9 @@ def get_version_info(module_version_string="", silent=False): "major": int(version.major), "minor": int(version.minor), "patch": int(version.patch), + "pixel_major": int(version.pixel_major), + "pixel_minor": int(version.pixel_minor), + "pixel_patch": int(version.pixel_patch), "status": str(version.status), "build": str(build_name), "module_config": str(version.module_config) + module_version_string, @@ -285,8 +288,7 @@ def is_engine(path): version_path = os.path.join(path, "version.py") if os.path.exists(version_path): with open(version_path, "r", encoding="utf-8") as f: - if 'short_name = "godot"' in f.read(): - return True + return 'short_name = "pixel"' in f.read() return False def get_files(path): @@ -1193,8 +1195,9 @@ def get_dependencies(file, env, exts, headers, sources, others): sources_active = [] others_active = [] + exec_name = "pixel_engine" if env.pixel_engine else "godot" get_dependencies( - env.File(f"#bin/godot{env['PROGSUFFIX']}"), env, extensions, headers_active, sources_active, others_active + env.File(f"#bin/{exec_name}{env['PROGSUFFIX']}"), env, extensions, headers_active, sources_active, others_active ) all_items = [] @@ -1255,7 +1258,7 @@ def get_dependencies(file, env, exts, headers, sources, others): properties.append( ";%s;" % (x, ";".join(itemlist[x]), x) ) - output = f'bin\\godot{env["PROGSUFFIX"]}' + output = f'bin\\{exec_name}{env["PROGSUFFIX"]}' with open("misc/msvs/props.template", "r", encoding="utf-8") as file: props_template = file.read() diff --git a/modules/csg/config.py b/modules/csg/config.py index 3991b846f96f..a9460d66127c 100644 --- a/modules/csg/config.py +++ b/modules/csg/config.py @@ -1,5 +1,5 @@ def can_build(env, platform): - return not env["disable_3d"] + return not (env["disable_3d"] or env["disable_physics"]) def configure(env): diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index 9aa612885aa8..f333dafba30d 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -35,7 +35,7 @@ #include "scene/3d/path_3d.h" #include "scene/3d/visual_instance_3d.h" -#include "scene/resources/3d/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" #include "thirdparty/misc/mikktspace.h" diff --git a/modules/gltf/extensions/physics/gltf_physics_shape.cpp b/modules/gltf/extensions/physics/gltf_physics_shape.cpp index 0f2246ce1888..3d69ebcbe3f2 100644 --- a/modules/gltf/extensions/physics/gltf_physics_shape.cpp +++ b/modules/gltf/extensions/physics/gltf_physics_shape.cpp @@ -34,13 +34,13 @@ #include "core/math/convex_hull.h" #include "scene/3d/physics/area_3d.h" -#include "scene/resources/3d/box_shape_3d.h" -#include "scene/resources/3d/capsule_shape_3d.h" -#include "scene/resources/3d/concave_polygon_shape_3d.h" -#include "scene/resources/3d/convex_polygon_shape_3d.h" -#include "scene/resources/3d/cylinder_shape_3d.h" +#include "scene/resources/3d/physics/box_shape_3d.h" +#include "scene/resources/3d/physics/capsule_shape_3d.h" +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/convex_polygon_shape_3d.h" +#include "scene/resources/3d/physics/cylinder_shape_3d.h" #include "scene/resources/3d/importer_mesh.h" -#include "scene/resources/3d/sphere_shape_3d.h" +#include "scene/resources/3d/physics/sphere_shape_3d.h" void GLTFPhysicsShape::_bind_methods() { ClassDB::bind_static_method("GLTFPhysicsShape", D_METHOD("from_node", "shape_node"), &GLTFPhysicsShape::from_node); diff --git a/modules/godot_physics_2d/config.py b/modules/godot_physics_2d/config.py index d22f9454ed25..8f46fc06a201 100644 --- a/modules/godot_physics_2d/config.py +++ b/modules/godot_physics_2d/config.py @@ -1,5 +1,5 @@ def can_build(env, platform): - return True + return not env["disable_physics"] def configure(env): diff --git a/modules/godot_physics_3d/config.py b/modules/godot_physics_3d/config.py index a42f27fbe122..1246d93acb92 100644 --- a/modules/godot_physics_3d/config.py +++ b/modules/godot_physics_3d/config.py @@ -1,5 +1,5 @@ def can_build(env, platform): - return not env["disable_3d"] + return not (env["disable_3d"] or env["disable_physics"]) def configure(env): diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py index 720401b92d8c..941af24f7be0 100644 --- a/modules/gridmap/config.py +++ b/modules/gridmap/config.py @@ -1,5 +1,5 @@ def can_build(env, platform): - return not env["disable_3d"] + return not (env["disable_3d"] or env["disable_physics"]) def configure(env): diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 29634a0a7502..da8bc5197e08 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -34,7 +34,7 @@ #include "scene/3d/light_3d.h" #include "scene/resources/3d/mesh_library.h" #include "scene/resources/3d/primitive_meshes.h" -#include "scene/resources/physics_material.h" +#include "scene/resources/3d/physics/physics_material.h" #include "scene/resources/surface_tool.h" #include "servers/navigation_server_3d.h" #include "servers/rendering_server.h" diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp index 068ac8b4e11b..2b4bf939b5f5 100644 --- a/modules/mono/utils/path_utils.cpp +++ b/modules/mono/utils/path_utils.cpp @@ -237,7 +237,11 @@ const Vector reserved_assembly_names = { "GodotSharp", "GodotSharpEditor String get_csharp_project_name() { String name = GLOBAL_GET("dotnet/project/assembly_name"); if (name.is_empty()) { +#ifndef PIXEL_ENGINE name = GLOBAL_GET("application/config/name"); +#else + name = "Pixel Engine"; +#endif // !PIXEL_ENGINE Vector invalid_chars = Vector({ // // Windows reserved filename chars. ":", "*", "?", "\"", "<", ">", "|", diff --git a/modules/navigation/2d/nav_mesh_generator_2d.cpp b/modules/navigation/2d/nav_mesh_generator_2d.cpp index a8eb07147cc8..3a7ae322dea9 100644 --- a/modules/navigation/2d/nav_mesh_generator_2d.cpp +++ b/modules/navigation/2d/nav_mesh_generator_2d.cpp @@ -35,17 +35,17 @@ #include "core/config/project_settings.h" #include "scene/2d/mesh_instance_2d.h" #include "scene/2d/multimesh_instance_2d.h" -#include "scene/2d/navigation_obstacle_2d.h" +#include "scene/2d/navigation/navigation_obstacle_2d.h" #include "scene/2d/physics/static_body_2d.h" #include "scene/2d/polygon_2d.h" #include "scene/2d/tile_map.h" -#include "scene/resources/2d/capsule_shape_2d.h" -#include "scene/resources/2d/circle_shape_2d.h" -#include "scene/resources/2d/concave_polygon_shape_2d.h" -#include "scene/resources/2d/convex_polygon_shape_2d.h" -#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h" -#include "scene/resources/2d/navigation_polygon.h" -#include "scene/resources/2d/rectangle_shape_2d.h" +#include "scene/resources/2d/physics/capsule_shape_2d.h" +#include "scene/resources/2d/physics/circle_shape_2d.h" +#include "scene/resources/2d/physics/concave_polygon_shape_2d.h" +#include "scene/resources/2d/physics/convex_polygon_shape_2d.h" +#include "scene/resources/2d/navigation/navigation_mesh_source_geometry_data_2d.h" +#include "scene/resources/2d/navigation/navigation_polygon.h" +#include "scene/resources/2d/physics/rectangle_shape_2d.h" #include "thirdparty/clipper2/include/clipper2/clipper.h" #include "thirdparty/misc/polypartition.h" diff --git a/modules/navigation/3d/nav_mesh_generator_3d.cpp b/modules/navigation/3d/nav_mesh_generator_3d.cpp index 3d0697a7cf9a..8527fece77a7 100644 --- a/modules/navigation/3d/nav_mesh_generator_3d.cpp +++ b/modules/navigation/3d/nav_mesh_generator_3d.cpp @@ -37,20 +37,20 @@ #include "core/os/thread.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/multimesh_instance_3d.h" -#include "scene/3d/navigation_obstacle_3d.h" +#include "scene/3d/navigation/navigation_obstacle_3d.h" #include "scene/3d/physics/static_body_3d.h" -#include "scene/resources/3d/box_shape_3d.h" -#include "scene/resources/3d/capsule_shape_3d.h" -#include "scene/resources/3d/concave_polygon_shape_3d.h" -#include "scene/resources/3d/convex_polygon_shape_3d.h" -#include "scene/resources/3d/cylinder_shape_3d.h" +#include "scene/resources/3d/physics/box_shape_3d.h" +#include "scene/resources/3d/physics/capsule_shape_3d.h" +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/convex_polygon_shape_3d.h" +#include "scene/resources/3d/physics/cylinder_shape_3d.h" #include "scene/resources/3d/height_map_shape_3d.h" -#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" +#include "scene/resources/3d/navigation/navigation_mesh_source_geometry_data_3d.h" #include "scene/resources/3d/primitive_meshes.h" -#include "scene/resources/3d/shape_3d.h" -#include "scene/resources/3d/sphere_shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" +#include "scene/resources/3d/physics/sphere_shape_3d.h" #include "scene/resources/3d/world_boundary_shape_3d.h" -#include "scene/resources/navigation_mesh.h" +#include "scene/resources/3d/navigation/navigation_mesh.h" #include "modules/modules_enabled.gen.h" // For csg, gridmap. diff --git a/modules/navigation/3d/navigation_mesh_generator.cpp b/modules/navigation/3d/navigation_mesh_generator.cpp index 54df42e2661f..6eba5784217b 100644 --- a/modules/navigation/3d/navigation_mesh_generator.cpp +++ b/modules/navigation/3d/navigation_mesh_generator.cpp @@ -32,7 +32,7 @@ #include "navigation_mesh_generator.h" -#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" +#include "scene/resources/3d/navigation/navigation_mesh_source_geometry_data_3d.h" #include "servers/navigation_server_3d.h" NavigationMeshGenerator *NavigationMeshGenerator::singleton = nullptr; diff --git a/modules/navigation/3d/navigation_mesh_generator.h b/modules/navigation/3d/navigation_mesh_generator.h index 08fe9f91425a..3ac3c81956ce 100644 --- a/modules/navigation/3d/navigation_mesh_generator.h +++ b/modules/navigation/3d/navigation_mesh_generator.h @@ -33,8 +33,8 @@ #ifndef _3D_DISABLED -#include "scene/3d/navigation_region_3d.h" -#include "scene/resources/navigation_mesh.h" +#include "scene/3d/navigation/navigation_region_3d.h" +#include "scene/resources/3d/navigation/navigation_mesh.h" class NavigationMeshSourceGeometryData3D; diff --git a/modules/navigation/config.py b/modules/navigation/config.py index a42f27fbe122..1246d93acb92 100644 --- a/modules/navigation/config.py +++ b/modules/navigation/config.py @@ -1,5 +1,5 @@ def can_build(env, platform): - return not env["disable_3d"] + return not (env["disable_3d"] or env["disable_physics"]) def configure(env): diff --git a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp index b78093b5902a..1783d462e78d 100644 --- a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp +++ b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp @@ -37,7 +37,7 @@ #include "editor/editor_node.h" #include "editor/editor_string_names.h" #include "scene/3d/mesh_instance_3d.h" -#include "scene/3d/navigation_region_3d.h" +#include "scene/3d/navigation/navigation_region_3d.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/dialogs.h" diff --git a/modules/navigation/nav_region.h b/modules/navigation/nav_region.h index 16e8bb1d8464..69b39b511544 100644 --- a/modules/navigation/nav_region.h +++ b/modules/navigation/nav_region.h @@ -35,7 +35,7 @@ #include "nav_utils.h" #include "core/os/rw_lock.h" -#include "scene/resources/navigation_mesh.h" +#include "scene/resources/3d/navigation/navigation_mesh.h" class NavRegion : public NavBase { RWLock region_rwlock; diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index b024e150d5fb..935af9df4c64 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -582,15 +582,22 @@ bool OpenXRAPI::create_instance() { extension_ptrs.push_back(enabled_extensions[i].get_data()); } - // Create our OpenXR instance XrApplicationInfo application_info{ + // Create our OpenXR instance +#ifndef PIXEL_ENGINE "Godot Engine", // applicationName, if we're running a game we'll update this down below. 1, // applicationVersion, we don't currently have this "Godot Engine", // engineName VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH, // engineVersion 4.0 -> 40000, 4.0.1 -> 40001, 4.1 -> 40100, etc. +#else + "Pixel Engine", + 1, + PIXEL_MAJOR * 10000 + PIXEL_MINOR * 100 + PIXEL_PATCH, +#endif // !PIXEL_ENGINE XR_API_VERSION_1_0 // apiVersion }; + void *next_pointer = nullptr; for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) { void *np = wrapper->set_instance_create_info_and_get_next_pointer(next_pointer); @@ -611,10 +618,14 @@ bool OpenXRAPI::create_instance() { }; // Get our project name +#ifndef PIXEL_ENGINE String project_name = GLOBAL_GET("application/config/name"); if (!project_name.is_empty()) { copy_string_to_char_buffer(project_name, instance_create_info.applicationInfo.applicationName, XR_MAX_APPLICATION_NAME_SIZE); } +#else + copy_string_to_char_buffer("Pixel Engine", instance_create_info.applicationInfo.applicationName, XR_MAX_APPLICATION_NAME_SIZE); +#endif // !PIXEL_ENGINE XrResult result = xrCreateInstance(&instance_create_info, &instance); ERR_FAIL_COND_V_MSG(XR_FAILED(result), false, "Failed to create XR instance."); diff --git a/pixel/SCsub b/pixel/SCsub new file mode 100644 index 000000000000..1f8529048023 --- /dev/null +++ b/pixel/SCsub @@ -0,0 +1,12 @@ +from misc.utility.scons_hints import * + +Import("env") + +env.pixel_sources = [] + +env.add_source_files(env.pixel_sources, "*.cpp") + + +lib = env.add_library("pixel", env.pixel_sources) + +env.Prepend(LIBS=[lib]) diff --git a/pixel/main_tree.cpp b/pixel/main_tree.cpp new file mode 100644 index 000000000000..cd65a778f757 --- /dev/null +++ b/pixel/main_tree.cpp @@ -0,0 +1,71 @@ +/**************************************************************************/ +/* main_tree.cpp */ +/**************************************************************************/ +/* PIXEL ENGINE */ +/**************************************************************************/ +/* Copyright (c) 2024-present Pixel Engine contributors (see AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* 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 OR COPYRIGHT HOLDERS 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. */ +/**************************************************************************/ + +#include "main_tree.h" + +#include "core/config/project_settings.h" +#include "pixel/pixel_engine.h" +#include "scene/main/window.h" + +MainTree *MainTree::singleton = nullptr; + +void MainTree::initialize() { + SceneTree::initialize(); + + ProjectSettings::get_singleton()->save(); + + set_auto_accept_quit(true); + set_quit_on_go_back(false); + + ProjectSettings::get_singleton()->set("debug/settings/stdout/print_fps", true); + OS::get_singleton()->set_low_processor_usage_mode(false); + DisplayServer::get_singleton()->window_set_vsync_mode(DisplayServer::VSyncMode::VSYNC_DISABLED); + + List plist; + ProjectSettings::get_singleton()->get_property_list(&plist); + + for (const PropertyInfo &E : plist) { + print_line(E.name); + } + + OS::get_singleton()->shell_show_in_file_manager(OS::get_singleton()->get_user_data_dir(), true); + // print_line(PixelEngine::get_singleton()->get_name()); + // print_line(Engine::get_singleton()->get_version_info()); + // print_line(OS::get_singleton()->get_current_rendering_driver_name()); + // print_line(OS::get_singleton()->get_current_rendering_method()); +} + +MainTree::MainTree() { + ERR_FAIL_NULL_MSG(get_root(), "MainTree root is null"); + singleton = this; + + root = get_root(); + root->set_title("Pixel Engine"); + root->set_name("Root"); + root->set_auto_translate_mode(Node::AUTO_TRANSLATE_MODE_DISABLED); + root->add_child(memnew(PixelEngine)); +} diff --git a/pixel/main_tree.h b/pixel/main_tree.h new file mode 100644 index 000000000000..e35a8c9123c6 --- /dev/null +++ b/pixel/main_tree.h @@ -0,0 +1,46 @@ +/**************************************************************************/ +/* main_tree.h */ +/**************************************************************************/ +/* PIXEL ENGINE */ +/**************************************************************************/ +/* Copyright (c) 2024-present Pixel Engine contributors (see AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* 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 OR COPYRIGHT HOLDERS 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. */ +/**************************************************************************/ + +#ifndef MAIN_TREE_H +#define MAIN_TREE_H + +#include "scene/main/scene_tree.h" + +class MainTree : public SceneTree { + GDCLASS(MainTree, SceneTree); + + Window *root = nullptr; + static MainTree *singleton; + +public: + static MainTree *get_singleton() { return singleton; } + virtual void initialize() override; + + MainTree(); +}; + +#endif // MAIN_TREE_H diff --git a/pixel/pixel_engine.cpp b/pixel/pixel_engine.cpp new file mode 100644 index 000000000000..9c2b8abdc49c --- /dev/null +++ b/pixel/pixel_engine.cpp @@ -0,0 +1,42 @@ +/**************************************************************************/ +/* pixel_engine.cpp */ +/**************************************************************************/ +/* PIXEL ENGINE */ +/**************************************************************************/ +/* Copyright (c) 2024-present Pixel Engine contributors (see AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* 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 OR COPYRIGHT HOLDERS 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. */ +/**************************************************************************/ + +#include "pixel_engine.h" +#include "scene/main/window.h" + +PixelEngine *PixelEngine::singleton = nullptr; + +void PixelEngine::_notification(int p_what) { + if (p_what == NOTIFICATION_READY) { + print_line(get_tree()->get_root()->get_name()); + } +} + +PixelEngine::PixelEngine() { + set_name("PixelEngine"); + singleton = this; +} diff --git a/pixel/pixel_engine.h b/pixel/pixel_engine.h new file mode 100644 index 000000000000..324e2d5078c4 --- /dev/null +++ b/pixel/pixel_engine.h @@ -0,0 +1,48 @@ +/**************************************************************************/ +/* pixel_engine.h */ +/**************************************************************************/ +/* PIXEL ENGINE */ +/**************************************************************************/ +/* Copyright (c) 2024-present Pixel Engine contributors (see AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* 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 OR COPYRIGHT HOLDERS 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. */ +/**************************************************************************/ + +#ifndef PIXEL_ENGINE_H +#define PIXEL_ENGINE_H + +#include "scene/main/node.h" + +class PixelEngine : public Node { + GDCLASS(PixelEngine, Node); + + static PixelEngine *singleton; + +protected: + void _notification(int p_what); + +public: + static PixelEngine *get_singleton() { return singleton; } + + PixelEngine(); + ~PixelEngine() {} +}; + +#endif // PIXEL_ENGINE_H diff --git a/platform/linuxbsd/SCsub b/platform/linuxbsd/SCsub index 4def765e9c50..35cbb0d06241 100644 --- a/platform/linuxbsd/SCsub +++ b/platform/linuxbsd/SCsub @@ -39,7 +39,9 @@ if env["dbus"]: if env["use_sowrap"]: common_linuxbsd.append("dbus-so_wrap.c") -prog = env.add_program("#bin/godot", ["godot_linuxbsd.cpp"] + common_linuxbsd) +exec_name = "pixel" if env.pixel_engine else "godot" + +prog = env.add_program(f"#bin/{exec_name}", ["godot_linuxbsd.cpp"] + common_linuxbsd) if env["debug_symbols"] and env["separate_debug_symbols"]: env.AddPostAction(prog, env.Run(platform_linuxbsd_builders.make_debug_linuxbsd)) diff --git a/platform/linuxbsd/freedesktop_screensaver.cpp b/platform/linuxbsd/freedesktop_screensaver.cpp index cf179b573519..af79dfacfe18 100644 --- a/platform/linuxbsd/freedesktop_screensaver.cpp +++ b/platform/linuxbsd/freedesktop_screensaver.cpp @@ -59,11 +59,17 @@ void FreeDesktopScreenSaver::inhibit() { return; } +#ifndef PIXEL_ENGINE String app_name_string = GLOBAL_GET("application/config/name"); CharString app_name_utf8 = app_name_string.utf8(); const char *app_name = app_name_string.is_empty() ? "Godot Engine" : app_name_utf8.get_data(); - const char *reason = "Running Godot Engine project"; +#else + String app_name_string = "Pixel Engine"; + CharString app_name_utf8 = app_name_string.utf8(); + const char *app_name = app_name_utf8.get_data(); + const char *reason = "Running Pixel Engine"; +#endif // !PIXEL_ENGINE DBusMessage *message = dbus_message_new_method_call( BUS_OBJECT_NAME, BUS_OBJECT_PATH, BUS_INTERFACE, diff --git a/platform/linuxbsd/tts_linux.cpp b/platform/linuxbsd/tts_linux.cpp index 95cae58fb3f0..a2f94cd6c817 100644 --- a/platform/linuxbsd/tts_linux.cpp +++ b/platform/linuxbsd/tts_linux.cpp @@ -56,6 +56,7 @@ void TTS_Linux::speech_init_thread_func(void *p_userdata) { #else { #endif +#ifndef PIXEL_ENGINE CharString class_str; String config_name = GLOBAL_GET("application/config/name"); if (config_name.length() == 0) { @@ -64,6 +65,10 @@ void TTS_Linux::speech_init_thread_func(void *p_userdata) { class_str = config_name.utf8(); } tts->synth = spd_open(class_str, "Godot_Engine_Speech_API", "Godot_Engine", SPD_MODE_THREADED); +#else + CharString class_str = "Pixel_Engine"; + tts->synth = spd_open(class_str, "Pixel_Engine_Speech_API", "Pixel_Engine", SPD_MODE_THREADED); +#endif // !PIXEL_ENGINE if (tts->synth) { tts->synth->callback_end = &speech_event_callback; tts->synth->callback_cancel = &speech_event_callback; diff --git a/platform/linuxbsd/wayland/display_server_wayland.cpp b/platform/linuxbsd/wayland/display_server_wayland.cpp index e321e4d4b94e..000c9f6ea481 100644 --- a/platform/linuxbsd/wayland/display_server_wayland.cpp +++ b/platform/linuxbsd/wayland/display_server_wayland.cpp @@ -64,12 +64,16 @@ String DisplayServerWayland::_get_app_id_from_context(Context p_context) { case CONTEXT_ENGINE: default: { +#ifndef PIXEL_ENGINE String config_name = GLOBAL_GET("application/config/name"); if (config_name.length() != 0) { app_id = config_name; } else { app_id = "org.godotengine.Godot"; } +#else + app_id = "Pixel Engine"; +#endif // !PIXEL_ENGINE } } diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 90bd3d57d4b7..04d61ef8d0ba 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -5255,6 +5255,7 @@ void DisplayServerX11::_update_context(WindowData &wd) { break; } +#ifndef PIXEL_ENGINE CharString class_str; if (context == CONTEXT_ENGINE) { String config_name = GLOBAL_GET("application/config/name"); @@ -5266,6 +5267,9 @@ void DisplayServerX11::_update_context(WindowData &wd) { } else { class_str = "Godot"; } +#else + CharString class_str = "Pixel_Engine"; +#endif // !PIXEL_ENGINE classHint->res_class = class_str.ptrw(); classHint->res_name = name_str.ptrw(); diff --git a/platform/macos/SCsub b/platform/macos/SCsub index 598444ae24be..e98c2bb8226a 100644 --- a/platform/macos/SCsub +++ b/platform/macos/SCsub @@ -11,13 +11,14 @@ import platform_macos_builders from platform_methods import get_build_version, lipo +exec_name = "pixel" if env.pixel_engine else "godot" def generate_bundle(target, source, env): bin_dir = Dir("#bin").abspath if env.editor_build: # Editor bundle. - prefix = "godot." + env["platform"] + "." + env["target"] + prefix = f"{exec_name}." + env["platform"] + "." + env["target"] if env.dev_build: prefix += ".dev" if env["precision"] == "double": @@ -129,7 +130,7 @@ files = [ "gl_manager_macos_legacy.mm", ] -prog = env.add_program("#bin/godot", files) +prog = env.add_program(f"#bin/{exec_name}", files) if env["debug_symbols"] and env["separate_debug_symbols"]: env.AddPostAction(prog, env.Run(platform_macos_builders.make_debug_macos)) diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index ee9692f5d74a..f06aa4f7c3c4 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -1789,7 +1789,11 @@ } if (p_enable) { +#ifndef PIXEL_ENGINE String app_name_string = GLOBAL_GET("application/config/name"); +#else + String app_name_string = "Pixel Engine"; +#endif // !PIXEL_ENGINE NSString *name = [NSString stringWithUTF8String:(app_name_string.is_empty() ? "Godot Engine" : app_name_string.utf8().get_data())]; NSString *reason = @"Godot Engine running with display/window/energy_saving/keep_screen_on = true"; IOPMAssertionCreateWithDescription(kIOPMAssertPreventUserIdleDisplaySleep, (__bridge CFStringRef)name, (__bridge CFStringRef)reason, (__bridge CFStringRef)reason, nullptr, 0, nullptr, &screen_keep_on_assertion); diff --git a/platform/web/SCsub b/platform/web/SCsub index 9a2eea9e07b3..48a31f07081b 100644 --- a/platform/web/SCsub +++ b/platform/web/SCsub @@ -61,7 +61,8 @@ for ext in sys_env["JS_EXTERNS"]: sys_env["ENV"]["EMCC_CLOSURE_ARGS"] += " --externs " + ext.abspath build = [] -build_targets = ["#bin/godot${PROGSUFFIX}.js", "#bin/godot${PROGSUFFIX}.wasm"] +exec_name = "pixel" if env.pixel_engine else "godot" +build_targets = ["#bin/${exec_name}${PROGSUFFIX}.js", "#bin/${exec_name}${PROGSUFFIX}.wasm"] if env["dlink_enabled"]: # Reset libraries. The main runtime will only link emscripten libraries, not godot ones. sys_env["LIBS"] = [] @@ -81,7 +82,7 @@ if env["dlink_enabled"]: sys = sys_env.Program(build_targets, ["web_runtime.cpp"]) # The side library, containing all Godot code. - wasm = env.add_program("#bin/godot.side${PROGSUFFIX}.wasm", web_files) + wasm = env.add_program("#bin/${exec_name}.side{PROGSUFFIX}.wasm", web_files) build = sys + [wasm[0]] else: # We use IDBFS. Since Emscripten 1.39.1 it needs to be linked explicitly. @@ -99,14 +100,14 @@ engine = [ "js/engine/engine.js", ] externs = [env.File("#platform/web/js/engine/engine.externs.js")] -js_engine = env.CreateEngineFile("#bin/godot${PROGSUFFIX}.engine.js", engine, externs, env["threads"]) +js_engine = env.CreateEngineFile("#bin/${exec_name}${PROGSUFFIX}.engine.js", engine, externs, env["threads"]) env.Depends(js_engine, externs) wrap_list = [ build[0], js_engine, ] -js_wrapped = env.Textfile("#bin/godot", [env.File(f) for f in wrap_list], TEXTFILESUFFIX="${PROGSUFFIX}.wrapped.js") +js_wrapped = env.Textfile("#bin/${exec_name}", [env.File(f) for f in wrap_list], TEXTFILESUFFIX="${PROGSUFFIX}.wrapped.js") # 0 - unwrapped js file (use wrapped one instead) # 1 - wasm file diff --git a/platform/web/os_web.cpp b/platform/web/os_web.cpp index c7ca613f4e6b..61088914f555 100644 --- a/platform/web/os_web.cpp +++ b/platform/web/os_web.cpp @@ -180,6 +180,7 @@ void OS_Web::vibrate_handheld(int p_duration_ms, float p_amplitude) { String OS_Web::get_user_data_dir() const { String userfs = "/userfs"; +#ifndef PIXEL_ENGINE String appname = get_safe_dir_name(GLOBAL_GET("application/config/name")); if (!appname.is_empty()) { bool use_custom_dir = GLOBAL_GET("application/config/use_custom_user_dir"); @@ -195,6 +196,9 @@ String OS_Web::get_user_data_dir() const { } return userfs.path_join(get_godot_dir_name()).path_join("app_userdata").path_join("[unnamed project]"); +#else + return userfs.path_join(get_godot_dir_name()); +#endif // !PIXEL_ENGINE } String OS_Web::get_cache_path() const { diff --git a/platform/windows/SCsub b/platform/windows/SCsub index 1ddefb9c331f..3b29d047908d 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -57,7 +57,9 @@ env.Depends(res_obj, "#core/version_generated.gen.h") env.add_source_files(sources, common_win) sources += res_obj -prog = env.add_program("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"]) +exec_name = "pixel" if env.pixel_engine else "godot" + +prog = env.add_program("#bin/${exec_name}", sources, PROGSUFFIX=env["PROGSUFFIX"]) arrange_program_clean(prog) if env.msvc: @@ -78,7 +80,7 @@ if env["windows_subsystem"] == "gui": env_wrap.Append(LINKFLAGS=["-Wl,--subsystem,console"]) env_wrap.Append(LIBS=["version"]) - prog_wrap = env_wrap.add_program("#bin/godot", common_win_wrap + res_wrap_obj, PROGSUFFIX=env["PROGSUFFIX_WRAP"]) + prog_wrap = env_wrap.add_program("#bin/${exec_name}", common_win_wrap + res_wrap_obj, PROGSUFFIX=env["PROGSUFFIX_WRAP"]) arrange_program_clean(prog_wrap) env_wrap.Depends(prog_wrap, prog) sources += common_win_wrap + res_wrap_obj diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index a0d10549338d..6d42da12aa75 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -707,6 +707,7 @@ Error DisplayServerWindows::_file_dialog_with_options_show(const String &p_title if (!windows.has(window_id)) { window_id = MAIN_WINDOW_ID; } +#ifndef PIXEL_ENGINE String appname; if (Engine::get_singleton()->is_editor_hint()) { appname = "Godot.GodotEditor." + String(VERSION_BRANCH); @@ -725,6 +726,9 @@ Error DisplayServerWindows::_file_dialog_with_options_show(const String &p_title clean_app_name = clean_app_name.substr(0, 120 - version.length()).trim_suffix("."); appname = "Godot." + clean_app_name + "." + version; } +#else + String appname = "PixelEngineV" + String(PIXEL_VERSION); +#endif // !PIXEL_ENGINE FileDialogData *fd = memnew(FileDialogData); if (window_id != INVALID_WINDOW_ID) { @@ -5939,6 +5943,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, HRESULT hr = SHGetPropertyStoreForWindow(wd.hWnd, IID_IPropertyStore, (void **)&prop_store); if (hr == S_OK) { PROPVARIANT val; +#ifndef PIXEL_ENGINE String appname; if (Engine::get_singleton()->is_editor_hint()) { appname = "Godot.GodotEditor." + String(VERSION_FULL_CONFIG); @@ -5957,6 +5962,9 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, clean_app_name = clean_app_name.substr(0, 120 - version.length()).trim_suffix("."); appname = "Godot." + clean_app_name + "." + version; } +#else + String appname = "PixelEngineV" + String(PIXEL_VERSION); +#endif // !PIXEL_ENGINE InitPropVariantFromString((PCWSTR)appname.utf16().get_data(), &val); prop_store->SetValue(PKEY_AppUserModel_ID, val); prop_store->Release(); @@ -6507,9 +6515,11 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win } #endif String appname; + String name; if (Engine::get_singleton()->is_editor_hint()) { appname = "Godot.GodotEditor." + String(VERSION_FULL_CONFIG); } else { +#ifndef PIXEL_ENGINE String name = GLOBAL_GET("application/config/name"); String version = GLOBAL_GET("application/config/version"); if (version.is_empty()) { @@ -6523,18 +6533,22 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win } clean_app_name = clean_app_name.substr(0, 120 - version.length()).trim_suffix("."); appname = "Godot." + clean_app_name + "." + version; +#else + appname = "PixelEngineV" + String(PIXEL_VERSION); + name = "Pixel Engine"; +#endif // !PIXEL_ENGINE + } #ifndef TOOLS_ENABLED - // Set for exported projects only. - HKEY key; - if (RegOpenKeyW(HKEY_CURRENT_USER_LOCAL_SETTINGS, L"Software\\Microsoft\\Windows\\Shell\\MuiCache", &key) == ERROR_SUCCESS) { - Char16String cs_name = name.utf16(); - String value_name = OS::get_singleton()->get_executable_path().replace("/", "\\") + ".FriendlyAppName"; - RegSetValueExW(key, (LPCWSTR)value_name.utf16().get_data(), 0, REG_SZ, (const BYTE *)cs_name.get_data(), cs_name.size() * sizeof(WCHAR)); - RegCloseKey(key); - } -#endif + // Set for exported projects only. + HKEY key; + if (RegOpenKeyW(HKEY_CURRENT_USER_LOCAL_SETTINGS, L"Software\\Microsoft\\Windows\\Shell\\MuiCache", &key) == ERROR_SUCCESS) { + Char16String cs_name = name.utf16(); + String value_name = OS::get_singleton()->get_executable_path().replace("/", "\\") + ".FriendlyAppName"; + RegSetValueExW(key, (LPCWSTR)value_name.utf16().get_data(), 0, REG_SZ, (const BYTE *)cs_name.get_data(), cs_name.size() * sizeof(WCHAR)); + RegCloseKey(key); } +#endif // !TOOLS_ENABLED SetCurrentProcessExplicitAppUserModelID((PCWSTR)appname.utf16().get_data()); mouse_monitor = SetWindowsHookEx(WH_MOUSE, ::MouseProc, nullptr, GetCurrentThreadId()); diff --git a/platform/windows/gl_manager_windows_native.cpp b/platform/windows/gl_manager_windows_native.cpp index af703f4dfa93..d291821a9d00 100644 --- a/platform/windows/gl_manager_windows_native.cpp +++ b/platform/windows/gl_manager_windows_native.cpp @@ -171,7 +171,11 @@ void GLManagerNative_Windows::_nvapi_setup_profile() { } String app_executable_name = OS::get_singleton()->get_executable_path().get_file(); +#ifndef PIXEL_ENGINE String app_profile_name = GLOBAL_GET("application/config/name"); +#else + String app_profile_name = "Pixel Engine"; +#endif // !PIXEL_ENGINE // We need a name anyways, so let's use the engine name if an application name is not available // (this is used mostly by the Project Manager) if (app_profile_name.is_empty()) { diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 714f86dedf6b..6197005a03fc 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2152,6 +2152,7 @@ String OS_Windows::get_system_dir(SystemDir p_dir, bool p_shared_storage) const } String OS_Windows::get_user_data_dir() const { +#ifndef PIXEL_ENGINE String appname = get_safe_dir_name(GLOBAL_GET("application/config/name")); if (!appname.is_empty()) { bool use_custom_dir = GLOBAL_GET("application/config/use_custom_user_dir"); @@ -2167,6 +2168,9 @@ String OS_Windows::get_user_data_dir() const { } return get_data_path().path_join(get_godot_dir_name()).path_join("app_userdata").path_join("[unnamed project]"); +#else + return get_data_path().path_join(get_godot_dir_name()); +#endif // !PIXEL_ENGINE } String OS_Windows::get_unique_id() const { diff --git a/platform_methods.py b/platform_methods.py index c8646a402267..96cc588def75 100644 --- a/platform_methods.py +++ b/platform_methods.py @@ -64,9 +64,9 @@ def get_build_version(short): name = "custom_build" if os.getenv("BUILD_NAME") is not None: name = os.getenv("BUILD_NAME") - v = "%d.%d" % (version.major, version.minor) + v = "%d.%d" % (version.pixel_minor, version.pixel_major) if version.patch > 0: - v += ".%d" % version.patch + v += ".%d" % version.pixel_patch status = version.status if not short: if os.getenv("GODOT_VERSION_STATUS") is not None: diff --git a/scene/2d/SCsub b/scene/2d/SCsub index 6f6bf9818cc7..417e617a4604 100644 --- a/scene/2d/SCsub +++ b/scene/2d/SCsub @@ -5,5 +5,10 @@ Import("env") env.add_source_files(env.scene_sources, "*.cpp") -# Chain load SCsubs -SConscript("physics/SCsub") +if not env["disable_physics"]: + # Chain load SCsubs + SConscript("physics/SCsub") + +if not env["disable_physics"]: + # Chain load SCsubs + SConscript("navigation/SCsub") \ No newline at end of file diff --git a/scene/2d/navigation/SCsub b/scene/2d/navigation/SCsub new file mode 100644 index 000000000000..374dc2119dcd --- /dev/null +++ b/scene/2d/navigation/SCsub @@ -0,0 +1,6 @@ +#!/usr/bin/env python +from misc.utility.scons_hints import * + +Import("env") + +env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation/navigation_agent_2d.cpp similarity index 99% rename from scene/2d/navigation_agent_2d.cpp rename to scene/2d/navigation/navigation_agent_2d.cpp index 786598f01a3a..18d15fde8e42 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation/navigation_agent_2d.cpp @@ -31,8 +31,8 @@ #include "navigation_agent_2d.h" #include "core/math/geometry_2d.h" -#include "scene/2d/navigation_link_2d.h" -#include "scene/resources/world_2d.h" +#include "scene/2d/navigation/navigation_link_2d.h" +#include "scene/resources/2d/world_2d.h" #include "servers/navigation_server_2d.h" void NavigationAgent2D::_bind_methods() { diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation/navigation_agent_2d.h similarity index 100% rename from scene/2d/navigation_agent_2d.h rename to scene/2d/navigation/navigation_agent_2d.h diff --git a/scene/2d/navigation_link_2d.cpp b/scene/2d/navigation/navigation_link_2d.cpp similarity index 99% rename from scene/2d/navigation_link_2d.cpp rename to scene/2d/navigation/navigation_link_2d.cpp index d90793a4c563..128b51a08a1a 100644 --- a/scene/2d/navigation_link_2d.cpp +++ b/scene/2d/navigation/navigation_link_2d.cpp @@ -31,7 +31,7 @@ #include "navigation_link_2d.h" #include "core/math/geometry_2d.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" #include "servers/navigation_server_2d.h" #include "servers/navigation_server_3d.h" diff --git a/scene/2d/navigation_link_2d.h b/scene/2d/navigation/navigation_link_2d.h similarity index 100% rename from scene/2d/navigation_link_2d.h rename to scene/2d/navigation/navigation_link_2d.h diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation/navigation_obstacle_2d.cpp similarity index 99% rename from scene/2d/navigation_obstacle_2d.cpp rename to scene/2d/navigation/navigation_obstacle_2d.cpp index 46bcda9c6ddc..0392c185ea55 100644 --- a/scene/2d/navigation_obstacle_2d.cpp +++ b/scene/2d/navigation/navigation_obstacle_2d.cpp @@ -31,7 +31,7 @@ #include "navigation_obstacle_2d.h" #include "core/math/geometry_2d.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" #include "servers/navigation_server_2d.h" #include "servers/navigation_server_3d.h" diff --git a/scene/2d/navigation_obstacle_2d.h b/scene/2d/navigation/navigation_obstacle_2d.h similarity index 100% rename from scene/2d/navigation_obstacle_2d.h rename to scene/2d/navigation/navigation_obstacle_2d.h diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation/navigation_region_2d.cpp similarity index 99% rename from scene/2d/navigation_region_2d.cpp rename to scene/2d/navigation/navigation_region_2d.cpp index 94e479a0d944..bb5cd3d0aef8 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation/navigation_region_2d.cpp @@ -31,7 +31,7 @@ #include "navigation_region_2d.h" #include "core/math/geometry_2d.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" #include "servers/navigation_server_2d.h" RID NavigationRegion2D::get_rid() const { diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation/navigation_region_2d.h similarity index 98% rename from scene/2d/navigation_region_2d.h rename to scene/2d/navigation/navigation_region_2d.h index 1ab1c6a80ad3..25319237544b 100644 --- a/scene/2d/navigation_region_2d.h +++ b/scene/2d/navigation/navigation_region_2d.h @@ -31,7 +31,7 @@ #ifndef NAVIGATION_REGION_2D_H #define NAVIGATION_REGION_2D_H -#include "scene/resources/2d/navigation_polygon.h" +#include "scene/resources/2d/navigation/navigation_polygon.h" class NavigationRegion2D : public Node2D { GDCLASS(NavigationRegion2D, Node2D); diff --git a/scene/2d/audio_stream_player_2d.compat.inc b/scene/2d/physics/audio_stream_player_2d.compat.inc similarity index 100% rename from scene/2d/audio_stream_player_2d.compat.inc rename to scene/2d/physics/audio_stream_player_2d.compat.inc diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/physics/audio_stream_player_2d.cpp similarity index 99% rename from scene/2d/audio_stream_player_2d.cpp rename to scene/2d/physics/audio_stream_player_2d.cpp index c1a40a817d94..589018ad54fa 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/physics/audio_stream_player_2d.cpp @@ -36,7 +36,7 @@ #include "scene/2d/physics/area_2d.h" #include "scene/audio/audio_stream_player_internal.h" #include "scene/main/viewport.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" #include "servers/audio/audio_stream.h" #include "servers/audio_server.h" diff --git a/scene/2d/audio_stream_player_2d.h b/scene/2d/physics/audio_stream_player_2d.h similarity index 100% rename from scene/2d/audio_stream_player_2d.h rename to scene/2d/physics/audio_stream_player_2d.h diff --git a/scene/2d/physics/collision_object_2d.cpp b/scene/2d/physics/collision_object_2d.cpp index 27ee6b883c51..b375b4901825 100644 --- a/scene/2d/physics/collision_object_2d.cpp +++ b/scene/2d/physics/collision_object_2d.cpp @@ -30,7 +30,7 @@ #include "collision_object_2d.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" void CollisionObject2D::_notification(int p_what) { switch (p_what) { diff --git a/scene/2d/physics/collision_object_2d.h b/scene/2d/physics/collision_object_2d.h index 2c8534665ca3..373a1cf10577 100644 --- a/scene/2d/physics/collision_object_2d.h +++ b/scene/2d/physics/collision_object_2d.h @@ -33,7 +33,7 @@ #include "scene/2d/node_2d.h" #include "scene/main/viewport.h" -#include "scene/resources/2d/shape_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" #include "servers/physics_server_2d.h" class CollisionObject2D : public Node2D { diff --git a/scene/2d/physics/collision_polygon_2d.cpp b/scene/2d/physics/collision_polygon_2d.cpp index a3e9fcce7e88..d2277e3f0647 100644 --- a/scene/2d/physics/collision_polygon_2d.cpp +++ b/scene/2d/physics/collision_polygon_2d.cpp @@ -33,8 +33,8 @@ #include "core/math/geometry_2d.h" #include "scene/2d/physics/area_2d.h" #include "scene/2d/physics/collision_object_2d.h" -#include "scene/resources/2d/concave_polygon_shape_2d.h" -#include "scene/resources/2d/convex_polygon_shape_2d.h" +#include "scene/resources/2d/physics/concave_polygon_shape_2d.h" +#include "scene/resources/2d/physics/convex_polygon_shape_2d.h" #include "thirdparty/misc/polypartition.h" diff --git a/scene/2d/physics/collision_shape_2d.cpp b/scene/2d/physics/collision_shape_2d.cpp index a6ddff4563ae..9bb5840b5728 100644 --- a/scene/2d/physics/collision_shape_2d.cpp +++ b/scene/2d/physics/collision_shape_2d.cpp @@ -32,8 +32,8 @@ #include "scene/2d/physics/area_2d.h" #include "scene/2d/physics/collision_object_2d.h" -#include "scene/resources/2d/concave_polygon_shape_2d.h" -#include "scene/resources/2d/convex_polygon_shape_2d.h" +#include "scene/resources/2d/physics/concave_polygon_shape_2d.h" +#include "scene/resources/2d/physics/convex_polygon_shape_2d.h" void CollisionShape2D::_shape_changed() { queue_redraw(); diff --git a/scene/2d/physics/collision_shape_2d.h b/scene/2d/physics/collision_shape_2d.h index e4f04e77e408..f07fef97ee55 100644 --- a/scene/2d/physics/collision_shape_2d.h +++ b/scene/2d/physics/collision_shape_2d.h @@ -32,7 +32,7 @@ #define COLLISION_SHAPE_2D_H #include "scene/2d/node_2d.h" -#include "scene/resources/2d/shape_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" class CollisionObject2D; diff --git a/scene/2d/physics/physics_body_2d.h b/scene/2d/physics/physics_body_2d.h index d44eebabee93..f92e8c6f978a 100644 --- a/scene/2d/physics/physics_body_2d.h +++ b/scene/2d/physics/physics_body_2d.h @@ -34,7 +34,7 @@ #include "core/templates/vset.h" #include "scene/2d/physics/collision_object_2d.h" #include "scene/2d/physics/kinematic_collision_2d.h" -#include "scene/resources/physics_material.h" +#include "scene/resources/3d/physics/physics_material.h" #include "servers/physics_server_2d.h" class PhysicsBody2D : public CollisionObject2D { diff --git a/scene/2d/physics/ray_cast_2d.cpp b/scene/2d/physics/ray_cast_2d.cpp index cb9497c14ed3..d1a32b8df1ac 100644 --- a/scene/2d/physics/ray_cast_2d.cpp +++ b/scene/2d/physics/ray_cast_2d.cpp @@ -31,7 +31,7 @@ #include "ray_cast_2d.h" #include "scene/2d/physics/collision_object_2d.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" void RayCast2D::set_target_position(const Vector2 &p_point) { target_position = p_point; diff --git a/scene/2d/physics/shape_cast_2d.cpp b/scene/2d/physics/shape_cast_2d.cpp index dd9d58916570..3d33376e6817 100644 --- a/scene/2d/physics/shape_cast_2d.cpp +++ b/scene/2d/physics/shape_cast_2d.cpp @@ -33,7 +33,7 @@ #include "core/config/engine.h" #include "scene/2d/physics/collision_object_2d.h" #include "scene/2d/physics/physics_body_2d.h" -#include "scene/resources/2d/circle_shape_2d.h" +#include "scene/resources/2d/physics/circle_shape_2d.h" #include "servers/physics_server_2d.h" void ShapeCast2D::set_target_position(const Vector2 &p_point) { diff --git a/scene/2d/physics/shape_cast_2d.h b/scene/2d/physics/shape_cast_2d.h index d866dd4edb85..8d8538ddbfca 100644 --- a/scene/2d/physics/shape_cast_2d.h +++ b/scene/2d/physics/shape_cast_2d.h @@ -32,8 +32,8 @@ #define SHAPE_CAST_2D_H #include "scene/2d/node_2d.h" -#include "scene/resources/2d/shape_2d.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" +#include "scene/resources/2d/world_2d.h" class CollisionObject2D; diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/physics/touch_screen_button.cpp similarity index 100% rename from scene/2d/touch_screen_button.cpp rename to scene/2d/physics/touch_screen_button.cpp diff --git a/scene/2d/touch_screen_button.h b/scene/2d/physics/touch_screen_button.h similarity index 98% rename from scene/2d/touch_screen_button.h rename to scene/2d/physics/touch_screen_button.h index da75fabfa024..5e49e0eab02d 100644 --- a/scene/2d/touch_screen_button.h +++ b/scene/2d/physics/touch_screen_button.h @@ -32,7 +32,7 @@ #define TOUCH_SCREEN_BUTTON_H #include "scene/2d/node_2d.h" -#include "scene/resources/2d/rectangle_shape_2d.h" +#include "scene/resources/2d/physics/rectangle_shape_2d.h" #include "scene/resources/bit_map.h" #include "scene/resources/texture.h" diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 8e9500cdbe1e..c65222b9847c 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -166,6 +166,7 @@ void TileMap::_set_layer_tile_data(int p_layer, const PackedInt32Array &p_data) } void TileMap::_notification(int p_what) { +#ifndef _PHYSICS_DISABLED switch (p_what) { case TileMap::NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { // This is only executed when collision_animatable is enabled. @@ -185,7 +186,6 @@ void TileMap::_notification(int p_what) { case TileMap::NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { // This is only executed when collision_animatable is enabled. - bool in_editor = false; #ifdef TOOLS_ENABLED in_editor = Engine::get_singleton()->is_editor_hint(); @@ -202,6 +202,7 @@ void TileMap::_notification(int p_what) { } } break; } +#endif // !_PHYSICS_DISABLED } #ifndef DISABLE_DEPRECATED @@ -372,22 +373,7 @@ int TileMap::get_layer_z_index(int p_layer) const { TILEMAP_CALL_FOR_LAYER_V(p_layer, 0, get_z_index); } -void TileMap::set_layer_navigation_enabled(int p_layer, bool p_enabled) { - TILEMAP_CALL_FOR_LAYER(p_layer, set_navigation_enabled, p_enabled); -} - -bool TileMap::is_layer_navigation_enabled(int p_layer) const { - TILEMAP_CALL_FOR_LAYER_V(p_layer, false, is_navigation_enabled); -} - -void TileMap::set_layer_navigation_map(int p_layer, RID p_map) { - TILEMAP_CALL_FOR_LAYER(p_layer, set_navigation_map, p_map); -} - -RID TileMap::get_layer_navigation_map(int p_layer) const { - TILEMAP_CALL_FOR_LAYER_V(p_layer, RID(), get_navigation_map); -} - +#ifndef _PHYSICS_DISABLED void TileMap::set_collision_animatable(bool p_collision_animatable) { if (collision_animatable == p_collision_animatable) { return; @@ -418,6 +404,24 @@ void TileMap::set_collision_visibility_mode(TileMap::VisibilityMode p_show_colli TileMap::VisibilityMode TileMap::get_collision_visibility_mode() const { return collision_visibility_mode; } +#endif // !_PHYSICS_DISABLED + +#ifndef _NAVIGATION_DISABLED +void TileMap::set_layer_navigation_enabled(int p_layer, bool p_enabled) { + TILEMAP_CALL_FOR_LAYER(p_layer, set_navigation_enabled, p_enabled); +} + +bool TileMap::is_layer_navigation_enabled(int p_layer) const { + TILEMAP_CALL_FOR_LAYER_V(p_layer, false, is_navigation_enabled); +} + +void TileMap::set_layer_navigation_map(int p_layer, RID p_map) { + TILEMAP_CALL_FOR_LAYER(p_layer, set_navigation_map, p_map); +} + +RID TileMap::get_layer_navigation_map(int p_layer) const { + TILEMAP_CALL_FOR_LAYER_V(p_layer, RID(), get_navigation_map); +} void TileMap::set_navigation_visibility_mode(TileMap::VisibilityMode p_show_navigation) { if (navigation_visibility_mode == p_show_navigation) { @@ -433,6 +437,7 @@ void TileMap::set_navigation_visibility_mode(TileMap::VisibilityMode p_show_navi TileMap::VisibilityMode TileMap::get_navigation_visibility_mode() const { return navigation_visibility_mode; } +#endif // !_NAVIGATION_DISABLED void TileMap::set_y_sort_enabled(bool p_enable) { if (is_y_sort_enabled() == p_enable) { @@ -593,6 +598,7 @@ TileMapCell TileMap::get_cell(int p_layer, const Vector2i &p_coords, bool p_use_ TILEMAP_CALL_FOR_LAYER_V(p_layer, TileMapCell(), get_cell, p_coords); } +#ifndef _PHYSICS_DISABLED Vector2i TileMap::get_coords_for_body_rid(RID p_physics_body) { for (const TileMapLayer *layer : layers) { if (layer->has_body_rid(p_physics_body)) { @@ -610,6 +616,7 @@ int TileMap::get_layer_for_body_rid(RID p_physics_body) { } ERR_FAIL_V_MSG(-1, vformat("No tiles for the given body RID %d.", p_physics_body.get_id())); } +#endif // !_PHYSICS_DISABLED void TileMap::fix_invalid_tiles() { for (TileMapLayer *layer : layers) { @@ -919,18 +926,24 @@ void TileMap::_bind_methods() { ClassDB::bind_method(D_METHOD("get_layer_y_sort_origin", "layer"), &TileMap::get_layer_y_sort_origin); ClassDB::bind_method(D_METHOD("set_layer_z_index", "layer", "z_index"), &TileMap::set_layer_z_index); ClassDB::bind_method(D_METHOD("get_layer_z_index", "layer"), &TileMap::get_layer_z_index); + +#ifndef _NAVIGATION_DISABLED ClassDB::bind_method(D_METHOD("set_layer_navigation_enabled", "layer", "enabled"), &TileMap::set_layer_navigation_enabled); ClassDB::bind_method(D_METHOD("is_layer_navigation_enabled", "layer"), &TileMap::is_layer_navigation_enabled); ClassDB::bind_method(D_METHOD("set_layer_navigation_map", "layer", "map"), &TileMap::set_layer_navigation_map); ClassDB::bind_method(D_METHOD("get_layer_navigation_map", "layer"), &TileMap::get_layer_navigation_map); + ClassDB::bind_method(D_METHOD("set_navigation_visibility_mode", "navigation_visibility_mode"), &TileMap::set_navigation_visibility_mode); + ClassDB::bind_method(D_METHOD("get_navigation_visibility_mode"), &TileMap::get_navigation_visibility_mode); +#endif // !_NAVIGATION_DISABLED +#ifndef _PHYSICS_DISABLED ClassDB::bind_method(D_METHOD("set_collision_animatable", "enabled"), &TileMap::set_collision_animatable); ClassDB::bind_method(D_METHOD("is_collision_animatable"), &TileMap::is_collision_animatable); ClassDB::bind_method(D_METHOD("set_collision_visibility_mode", "collision_visibility_mode"), &TileMap::set_collision_visibility_mode); ClassDB::bind_method(D_METHOD("get_collision_visibility_mode"), &TileMap::get_collision_visibility_mode); - - ClassDB::bind_method(D_METHOD("set_navigation_visibility_mode", "navigation_visibility_mode"), &TileMap::set_navigation_visibility_mode); - ClassDB::bind_method(D_METHOD("get_navigation_visibility_mode"), &TileMap::get_navigation_visibility_mode); + ClassDB::bind_method(D_METHOD("get_coords_for_body_rid", "body"), &TileMap::get_coords_for_body_rid); + ClassDB::bind_method(D_METHOD("get_layer_for_body_rid", "body"), &TileMap::get_layer_for_body_rid); +#endif // !_PHYSICS_DISABLED ClassDB::bind_method(D_METHOD("set_cell", "layer", "coords", "source_id", "atlas_coords", "alternative_tile"), &TileMap::set_cell, DEFVAL(TileSet::INVALID_SOURCE), DEFVAL(TileSetSource::INVALID_ATLAS_COORDS), DEFVAL(0)); ClassDB::bind_method(D_METHOD("erase_cell", "layer", "coords"), &TileMap::erase_cell); @@ -943,9 +956,6 @@ void TileMap::_bind_methods() { ClassDB::bind_method(D_METHOD("is_cell_flipped_v", "layer", "coords", "use_proxies"), &TileMap::is_cell_flipped_v, DEFVAL(false)); ClassDB::bind_method(D_METHOD("is_cell_transposed", "layer", "coords", "use_proxies"), &TileMap::is_cell_transposed, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("get_coords_for_body_rid", "body"), &TileMap::get_coords_for_body_rid); - ClassDB::bind_method(D_METHOD("get_layer_for_body_rid", "body"), &TileMap::get_layer_for_body_rid); - ClassDB::bind_method(D_METHOD("get_pattern", "layer", "coords_array"), &TileMap::get_pattern); ClassDB::bind_method(D_METHOD("map_pattern", "position_in_tilemap", "coords_in_pattern", "pattern"), &TileMap::map_pattern); ClassDB::bind_method(D_METHOD("set_pattern", "layer", "position", "pattern"), &TileMap::set_pattern); @@ -976,9 +986,13 @@ void TileMap::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tile_set", PROPERTY_HINT_RESOURCE_TYPE, "TileSet"), "set_tileset", "get_tileset"); ADD_PROPERTY(PropertyInfo(Variant::INT, "rendering_quadrant_size", PROPERTY_HINT_RANGE, "1,128,1"), "set_rendering_quadrant_size", "get_rendering_quadrant_size"); +#ifndef _PHYSICS_DISABLED ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collision_animatable"), "set_collision_animatable", "is_collision_animatable"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_visibility_mode", PROPERTY_HINT_ENUM, "Default,Force Show,Force Hide"), "set_collision_visibility_mode", "get_collision_visibility_mode"); +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_visibility_mode", PROPERTY_HINT_ENUM, "Default,Force Show,Force Hide"), "set_navigation_visibility_mode", "get_navigation_visibility_mode"); +#endif // !_NAVIGATION_DISABLED ADD_ARRAY("layers", "layer_"); @@ -1013,7 +1027,9 @@ TileMap::TileMap() { base_property_helper.register_property(PropertyInfo(Variant::BOOL, "y_sort_enabled"), defaults->is_y_sort_enabled(), &TileMap::set_layer_y_sort_enabled, &TileMap::is_layer_y_sort_enabled); base_property_helper.register_property(PropertyInfo(Variant::INT, "y_sort_origin", PROPERTY_HINT_NONE, "suffix:px"), defaults->get_y_sort_origin(), &TileMap::set_layer_y_sort_origin, &TileMap::get_layer_y_sort_origin); base_property_helper.register_property(PropertyInfo(Variant::INT, "z_index"), defaults->get_z_index(), &TileMap::set_layer_z_index, &TileMap::get_layer_z_index); +#ifndef _NAVIGATION_DISABLED base_property_helper.register_property(PropertyInfo(Variant::BOOL, "navigation_enabled"), defaults->is_navigation_enabled(), &TileMap::set_layer_navigation_enabled, &TileMap::is_layer_navigation_enabled); +#endif // !_NAVIGATION_DISABLED base_property_helper.register_property(PropertyInfo(Variant::PACKED_INT32_ARRAY, "tile_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), Vector(), &TileMap::_set_layer_tile_data, &TileMap::_get_tile_map_data_using_compatibility_format); PropertyListHelper::register_base_helper(&base_property_helper); diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 47f5c8d99619..49b0b4c4f1de 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -66,9 +66,13 @@ class TileMap : public Node2D { // Properties. Ref tile_set; int rendering_quadrant_size = 16; +#ifndef _PHYSICS_DISABLED bool collision_animatable = false; VisibilityMode collision_visibility_mode = VISIBILITY_MODE_DEFAULT; +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED VisibilityMode navigation_visibility_mode = VISIBILITY_MODE_DEFAULT; +#endif // !_NAVIGATION_DISABLED // Layers. LocalVector layers; @@ -143,20 +147,23 @@ class TileMap : public Node2D { int get_layer_y_sort_origin(int p_layer) const; void set_layer_z_index(int p_layer, int p_z_index); int get_layer_z_index(int p_layer) const; + +#ifndef _NAVIGATION_DISABLED void set_layer_navigation_enabled(int p_layer, bool p_enabled); bool is_layer_navigation_enabled(int p_layer) const; void set_layer_navigation_map(int p_layer, RID p_map); RID get_layer_navigation_map(int p_layer) const; + void set_navigation_visibility_mode(VisibilityMode p_show_navigation); + VisibilityMode get_navigation_visibility_mode() const; +#endif // !_NAVIGATION_DISABLED +#ifndef _PHYSICS_DISABLED void set_collision_animatable(bool p_collision_animatable); bool is_collision_animatable() const; - // Debug visibility modes. void set_collision_visibility_mode(VisibilityMode p_show_collision); VisibilityMode get_collision_visibility_mode() const; - - void set_navigation_visibility_mode(VisibilityMode p_show_navigation); - VisibilityMode get_navigation_visibility_mode() const; +#endif // !_PHYSICS_DISABLED // Cells accessors. void set_cell(int p_layer, const Vector2i &p_coords, int p_source_id = TileSet::INVALID_SOURCE, const Vector2i p_atlas_coords = TileSetSource::INVALID_ATLAS_COORDS, int p_alternative_tile = 0); @@ -207,10 +214,12 @@ class TileMap : public Node2D { virtual void set_texture_filter(CanvasItem::TextureFilter p_texture_filter) override; virtual void set_texture_repeat(CanvasItem::TextureRepeat p_texture_repeat) override; +#ifndef _PHYSICS_DISABLED // For finding tiles from collision. Vector2i get_coords_for_body_rid(RID p_physics_body); // For getting their layers as well. int get_layer_for_body_rid(RID p_physics_body); +#endif // !_PHYSICS_DISABLED // Fixing and clearing methods. void fix_invalid_tiles(); diff --git a/scene/2d/tile_map_layer.cpp b/scene/2d/tile_map_layer.cpp index c4a2f35d3183..8f5c2c2edeea 100644 --- a/scene/2d/tile_map_layer.cpp +++ b/scene/2d/tile_map_layer.cpp @@ -33,12 +33,14 @@ #include "core/io/marshalls.h" #include "scene/2d/tile_map.h" #include "scene/gui/control.h" -#include "scene/resources/world_2d.h" -#include "servers/navigation_server_2d.h" +#include "scene/resources/2d/world_2d.h" +#ifndef _NAVIGATION_DISABLED +#include "servers/navigation_server_2d.h" #ifdef DEBUG_ENABLED #include "servers/navigation_server_3d.h" #endif // DEBUG_ENABLED +#endif // !_NAVIGATION_DISABLED #ifdef DEBUG_ENABLED /////////////////////////////// Debug ////////////////////////////////////////// @@ -134,8 +136,12 @@ void TileMapLayer::_debug_update(bool p_force_cleanup) { CellData &cell_data = *cell_data_list_element->self(); if (cell_data.cell.source_id != TileSet::INVALID_SOURCE) { _rendering_draw_cell_debug(ci, quadrant_pos, cell_data); +#ifndef _PHYSICS_DISABLED _physics_draw_cell_debug(ci, quadrant_pos, cell_data); +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED _navigation_draw_cell_debug(ci, quadrant_pos, cell_data); +#endif // !_NAVIGATION_DISABLED _scenes_draw_cell_debug(ci, quadrant_pos, cell_data); } } @@ -700,7 +706,7 @@ void TileMapLayer::_rendering_draw_cell_debug(const RID &p_canvas_item, const Ve #endif // DEBUG_ENABLED /////////////////////////////// Physics ////////////////////////////////////// - +#ifndef _PHYSICS_DISABLED void TileMapLayer::_physics_update(bool p_force_cleanup) { // Check if we should cleanup everything. bool forced_cleanup = p_force_cleanup || !enabled || !collision_enabled || !is_inside_tree() || tile_set.is_null(); @@ -950,9 +956,10 @@ void TileMapLayer::_physics_draw_cell_debug(const RID &p_canvas_item, const Vect } } #endif // DEBUG_ENABLED +#endif // !_PHYSICS_DISABLED /////////////////////////////// Navigation ////////////////////////////////////// - +#ifndef _NAVIGATION_DISABLED void TileMapLayer::_navigation_update(bool p_force_cleanup) { ERR_FAIL_NULL(NavigationServer2D::get_singleton()); NavigationServer2D *ns = NavigationServer2D::get_singleton(); @@ -1223,6 +1230,7 @@ void TileMapLayer::_navigation_draw_cell_debug(const RID &p_canvas_item, const V } } #endif // DEBUG_ENABLED +#endif // !_NAVIGATION_DISABLED /////////////////////////////// Scenes ////////////////////////////////////// @@ -1697,8 +1705,12 @@ void TileMapLayer::_internal_update(bool p_force_cleanup) { // Update all subsystems. _rendering_update(p_force_cleanup); +#ifndef _PHYSICS_DISABLED _physics_update(p_force_cleanup); +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED _navigation_update(p_force_cleanup); +#endif // !_NAVIGATION_DISABLED _scenes_update(p_force_cleanup); #ifdef DEBUG_ENABLED _debug_update(p_force_cleanup); @@ -1799,8 +1811,12 @@ void TileMapLayer::_notification(int p_what) { } _rendering_notification(p_what); +#ifndef _PHYSICS_DISABLED _physics_notification(p_what); +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED _navigation_notification(p_what); +#endif // !_NAVIGATION_DISABLED } void TileMapLayer::_bind_methods() { @@ -1832,9 +1848,11 @@ void TileMapLayer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_cells_terrain_connect", "cells", "terrain_set", "terrain", "ignore_empty_terrains"), &TileMapLayer::set_cells_terrain_connect, DEFVAL(true)); ClassDB::bind_method(D_METHOD("set_cells_terrain_path", "path", "terrain_set", "terrain", "ignore_empty_terrains"), &TileMapLayer::set_cells_terrain_path, DEFVAL(true)); +#ifndef _PHYSICS_DISABLED // --- Physics helpers --- ClassDB::bind_method(D_METHOD("has_body_rid", "body"), &TileMapLayer::has_body_rid); ClassDB::bind_method(D_METHOD("get_coords_for_body_rid", "body"), &TileMapLayer::get_coords_for_body_rid); +#endif // !_PHYSICS_DISABLED // --- Runtime --- ClassDB::bind_method(D_METHOD("update_internals"), &TileMapLayer::update_internals); @@ -1874,12 +1892,14 @@ void TileMapLayer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_occlusion_enabled", "enabled"), &TileMapLayer::set_occlusion_enabled); ClassDB::bind_method(D_METHOD("is_occlusion_enabled"), &TileMapLayer::is_occlusion_enabled); +#ifndef _NAVIGATION_DISABLED ClassDB::bind_method(D_METHOD("set_navigation_enabled", "enabled"), &TileMapLayer::set_navigation_enabled); ClassDB::bind_method(D_METHOD("is_navigation_enabled"), &TileMapLayer::is_navigation_enabled); ClassDB::bind_method(D_METHOD("set_navigation_map", "map"), &TileMapLayer::set_navigation_map); ClassDB::bind_method(D_METHOD("get_navigation_map"), &TileMapLayer::get_navigation_map); ClassDB::bind_method(D_METHOD("set_navigation_visibility_mode", "show_navigation"), &TileMapLayer::set_navigation_visibility_mode); ClassDB::bind_method(D_METHOD("get_navigation_visibility_mode"), &TileMapLayer::get_navigation_visibility_mode); +#endif // !_NAVIGATION_DISABLED GDVIRTUAL_BIND(_use_tile_data_runtime_update, "coords"); GDVIRTUAL_BIND(_tile_data_runtime_update, "coords", "tile_data"); @@ -1894,13 +1914,19 @@ void TileMapLayer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "y_sort_origin"), "set_y_sort_origin", "get_y_sort_origin"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "x_draw_order_reversed"), "set_x_draw_order_reversed", "is_x_draw_order_reversed"); ADD_PROPERTY(PropertyInfo(Variant::INT, "rendering_quadrant_size"), "set_rendering_quadrant_size", "get_rendering_quadrant_size"); + +#ifndef _PHYSICS_DISABLED ADD_GROUP("Physics", ""); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collision_enabled"), "set_collision_enabled", "is_collision_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_kinematic_bodies"), "set_use_kinematic_bodies", "is_using_kinematic_bodies"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_visibility_mode", PROPERTY_HINT_ENUM, "Default,Force Show,Force Hide"), "set_collision_visibility_mode", "get_collision_visibility_mode"); +#endif // !_PHYSICS_DISABLED + +#ifndef _NAVIGATION_DISABLED ADD_GROUP("Navigation", ""); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "navigation_enabled"), "set_navigation_enabled", "is_navigation_enabled"); ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_visibility_mode", PROPERTY_HINT_ENUM, "Default,Force Show,Force Hide"), "set_navigation_visibility_mode", "get_navigation_visibility_mode"); +#endif // !_NAVIGATION_DISABLED ADD_SIGNAL(MethodInfo(CoreStringName(changed))); @@ -2697,6 +2723,7 @@ void TileMapLayer::set_cells_terrain_path(TypedArray p_path, int p_ter } } +#ifndef _PHYSICS_DISABLED bool TileMapLayer::has_body_rid(RID p_physics_body) const { return bodies_coords.has(p_physics_body); } @@ -2706,6 +2733,7 @@ Vector2i TileMapLayer::get_coords_for_body_rid(RID p_physics_body) const { ERR_FAIL_NULL_V(found, Vector2i()); return *found; } +#endif // !_PHYSICS_DISABLED void TileMapLayer::update_internals() { _internal_update(false); @@ -3022,6 +3050,7 @@ bool TileMapLayer::is_occlusion_enabled() const { return occlusion_enabled; } +#ifndef _NAVIGATION_DISABLED void TileMapLayer::set_navigation_enabled(bool p_enabled) { if (navigation_enabled == p_enabled) { return; @@ -3068,6 +3097,7 @@ void TileMapLayer::set_navigation_visibility_mode(TileMapLayer::DebugVisibilityM TileMapLayer::DebugVisibilityMode TileMapLayer::get_navigation_visibility_mode() const { return navigation_visibility_mode; } +#endif // !_NAVIGATION_DISABLED TileMapLayer::TileMapLayer() { set_notify_transform(true); diff --git a/scene/2d/tile_map_layer.h b/scene/2d/tile_map_layer.h index 912fa2be155c..b3954a54ece4 100644 --- a/scene/2d/tile_map_layer.h +++ b/scene/2d/tile_map_layer.h @@ -110,11 +110,15 @@ struct CellData { SelfList rendering_quadrant_list_element; LocalVector> occluders; +#ifndef _PHYSICS_DISABLED // Physics. LocalVector bodies; +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED // Navigation. LocalVector navigation_regions; +#endif // !_NAVIGATION_DISABLED // Scenes. String scene; @@ -134,8 +138,12 @@ struct CellData { coords = p_other.coords; cell = p_other.cell; occluders = p_other.occluders; +#ifndef _PHYSICS_DISABLED bodies = p_other.bodies; +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED navigation_regions = p_other.navigation_regions; +#endif // !_NAVIGATION_DISABLED scene = p_other.scene; runtime_tile_data_cache = p_other.runtime_tile_data_cache; } @@ -147,8 +155,12 @@ struct CellData { coords = p_other.coords; cell = p_other.cell; occluders = p_other.occluders; +#ifndef _PHYSICS_DISABLED bodies = p_other.bodies; +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED navigation_regions = p_other.navigation_regions; +#endif // !_NAVIGATION_DISABLED scene = p_other.scene; runtime_tile_data_cache = p_other.runtime_tile_data_cache; } @@ -291,9 +303,11 @@ class TileMapLayer : public Node2D { bool occlusion_enabled = true; +#ifndef _NAVIGATION_DISABLED bool navigation_enabled = true; RID navigation_map_override; DebugVisibilityMode navigation_visibility_mode = DEBUG_VISIBILITY_MODE_DEFAULT; +#endif // !_NAVIGATION_DISABLED // Internal. bool pending_update = false; @@ -342,7 +356,7 @@ class TileMapLayer : public Node2D { #ifdef DEBUG_ENABLED void _rendering_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data); #endif // DEBUG_ENABLED - +#ifndef _PHYSICS_DISABLED HashMap bodies_coords; // Mapping for RID to coords. bool _physics_was_cleaned_up = false; void _physics_update(bool p_force_cleanup); @@ -352,7 +366,9 @@ class TileMapLayer : public Node2D { #ifdef DEBUG_ENABLED void _physics_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data); #endif // DEBUG_ENABLED +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED bool _navigation_was_cleaned_up = false; void _navigation_update(bool p_force_cleanup); void _navigation_notification(int p_what); @@ -361,6 +377,7 @@ class TileMapLayer : public Node2D { #ifdef DEBUG_ENABLED void _navigation_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data); #endif // DEBUG_ENABLED +#endif // !_NAVIGATION_DISABLED bool _scenes_was_cleaned_up = false; void _scenes_update(bool p_force_cleanup); @@ -453,10 +470,11 @@ class TileMapLayer : public Node2D { // Terrains. void set_cells_terrain_connect(TypedArray p_cells, int p_terrain_set, int p_terrain, bool p_ignore_empty_terrains = true); void set_cells_terrain_path(TypedArray p_path, int p_terrain_set, int p_terrain, bool p_ignore_empty_terrains = true); - +#ifndef _PHYSICS_DISABLED // --- Physics helpers --- bool has_body_rid(RID p_physics_body) const; Vector2i get_coords_for_body_rid(RID p_physics_body) const; // For finding tiles from collision. +#endif // !_PHYSICS_DISABLED // --- Runtime --- void update_internals(); @@ -505,12 +523,14 @@ class TileMapLayer : public Node2D { void set_occlusion_enabled(bool p_enabled); bool is_occlusion_enabled() const; +#ifndef _NAVIGATION_DISABLED void set_navigation_enabled(bool p_enabled); bool is_navigation_enabled() const; void set_navigation_map(RID p_map); RID get_navigation_map() const; void set_navigation_visibility_mode(DebugVisibilityMode p_show_navigation); DebugVisibilityMode get_navigation_visibility_mode() const; +#endif // !_NAVIGATION_DISABLED TileMapLayer(); ~TileMapLayer(); diff --git a/scene/3d/SCsub b/scene/3d/SCsub index 6f6bf9818cc7..375434daee1a 100644 --- a/scene/3d/SCsub +++ b/scene/3d/SCsub @@ -3,7 +3,11 @@ from misc.utility.scons_hints import * Import("env") -env.add_source_files(env.scene_sources, "*.cpp") +if not env["disable_3d"]: + env.add_source_files(env.scene_sources, "*.cpp") -# Chain load SCsubs -SConscript("physics/SCsub") + if not env["disable_physics"]: + SConscript("physics/SCsub") + + if not env["disable_navigation"]: + SConscript("navigation/SCsub") diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index 14bc22a2170a..9cfa524e6503 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -33,8 +33,8 @@ #include "scene/3d/physics/collision_shape_3d.h" #include "scene/3d/physics/static_body_3d.h" #include "scene/3d/skeleton_3d.h" -#include "scene/resources/3d/concave_polygon_shape_3d.h" -#include "scene/resources/3d/convex_polygon_shape_3d.h" +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/convex_polygon_shape_3d.h" bool MeshInstance3D::_set(const StringName &p_name, const Variant &p_value) { //this is not _too_ bad performance wise, really. it only arrives here if the property was not set anywhere else. diff --git a/scene/3d/navigation/SCsub b/scene/3d/navigation/SCsub new file mode 100644 index 000000000000..374dc2119dcd --- /dev/null +++ b/scene/3d/navigation/SCsub @@ -0,0 +1,6 @@ +#!/usr/bin/env python +from misc.utility.scons_hints import * + +Import("env") + +env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation/navigation_agent_3d.cpp similarity index 99% rename from scene/3d/navigation_agent_3d.cpp rename to scene/3d/navigation/navigation_agent_3d.cpp index d5e162d41691..1413fe010481 100644 --- a/scene/3d/navigation_agent_3d.cpp +++ b/scene/3d/navigation/navigation_agent_3d.cpp @@ -30,7 +30,7 @@ #include "navigation_agent_3d.h" -#include "scene/3d/navigation_link_3d.h" +#include "scene/3d/navigation/navigation_link_3d.h" #include "servers/navigation_server_3d.h" void NavigationAgent3D::_bind_methods() { diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation/navigation_agent_3d.h similarity index 100% rename from scene/3d/navigation_agent_3d.h rename to scene/3d/navigation/navigation_agent_3d.h diff --git a/scene/3d/navigation_link_3d.cpp b/scene/3d/navigation/navigation_link_3d.cpp similarity index 100% rename from scene/3d/navigation_link_3d.cpp rename to scene/3d/navigation/navigation_link_3d.cpp diff --git a/scene/3d/navigation_link_3d.h b/scene/3d/navigation/navigation_link_3d.h similarity index 100% rename from scene/3d/navigation_link_3d.h rename to scene/3d/navigation/navigation_link_3d.h diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation/navigation_obstacle_3d.cpp similarity index 100% rename from scene/3d/navigation_obstacle_3d.cpp rename to scene/3d/navigation/navigation_obstacle_3d.cpp diff --git a/scene/3d/navigation_obstacle_3d.h b/scene/3d/navigation/navigation_obstacle_3d.h similarity index 100% rename from scene/3d/navigation_obstacle_3d.h rename to scene/3d/navigation/navigation_obstacle_3d.h diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation/navigation_region_3d.cpp similarity index 99% rename from scene/3d/navigation_region_3d.cpp rename to scene/3d/navigation/navigation_region_3d.cpp index 2d67e4334e6e..2b118b75a8e3 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation/navigation_region_3d.cpp @@ -30,7 +30,7 @@ #include "navigation_region_3d.h" -#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" +#include "scene/resources/3d/navigation/navigation_mesh_source_geometry_data_3d.h" #include "servers/navigation_server_3d.h" RID NavigationRegion3D::get_rid() const { diff --git a/scene/3d/navigation_region_3d.h b/scene/3d/navigation/navigation_region_3d.h similarity index 98% rename from scene/3d/navigation_region_3d.h rename to scene/3d/navigation/navigation_region_3d.h index 82468627deb0..af4f628dc815 100644 --- a/scene/3d/navigation_region_3d.h +++ b/scene/3d/navigation/navigation_region_3d.h @@ -32,7 +32,7 @@ #define NAVIGATION_REGION_3D_H #include "scene/3d/node_3d.h" -#include "scene/resources/navigation_mesh.h" +#include "scene/resources/3d/navigation/navigation_mesh.h" class NavigationRegion3D : public Node3D { GDCLASS(NavigationRegion3D, Node3D); diff --git a/scene/3d/physics/collision_object_3d.cpp b/scene/3d/physics/collision_object_3d.cpp index f0a5013ca288..f817770c72ff 100644 --- a/scene/3d/physics/collision_object_3d.cpp +++ b/scene/3d/physics/collision_object_3d.cpp @@ -30,7 +30,7 @@ #include "collision_object_3d.h" -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" void CollisionObject3D::_notification(int p_what) { switch (p_what) { diff --git a/scene/3d/physics/collision_polygon_3d.cpp b/scene/3d/physics/collision_polygon_3d.cpp index bf8dec7b5463..91b6d6df4d35 100644 --- a/scene/3d/physics/collision_polygon_3d.cpp +++ b/scene/3d/physics/collision_polygon_3d.cpp @@ -32,7 +32,7 @@ #include "core/math/geometry_2d.h" #include "scene/3d/physics/collision_object_3d.h" -#include "scene/resources/3d/convex_polygon_shape_3d.h" +#include "scene/resources/3d/physics/convex_polygon_shape_3d.h" void CollisionPolygon3D::_build_polygon() { if (!collision_object) { diff --git a/scene/3d/physics/collision_polygon_3d.h b/scene/3d/physics/collision_polygon_3d.h index fe4cf40ee310..3fb0ef186ca7 100644 --- a/scene/3d/physics/collision_polygon_3d.h +++ b/scene/3d/physics/collision_polygon_3d.h @@ -32,7 +32,7 @@ #define COLLISION_POLYGON_3D_H #include "scene/3d/node_3d.h" -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class CollisionObject3D; class CollisionPolygon3D : public Node3D { diff --git a/scene/3d/physics/collision_shape_3d.cpp b/scene/3d/physics/collision_shape_3d.cpp index 362c61026be1..e904a755af28 100644 --- a/scene/3d/physics/collision_shape_3d.cpp +++ b/scene/3d/physics/collision_shape_3d.cpp @@ -34,8 +34,8 @@ #include "scene/3d/physics/character_body_3d.h" #include "scene/3d/physics/physics_body_3d.h" #include "scene/3d/physics/vehicle_body_3d.h" -#include "scene/resources/3d/concave_polygon_shape_3d.h" -#include "scene/resources/3d/convex_polygon_shape_3d.h" +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/convex_polygon_shape_3d.h" #include "scene/resources/3d/world_boundary_shape_3d.h" void CollisionShape3D::make_convex_from_siblings() { diff --git a/scene/3d/physics/collision_shape_3d.h b/scene/3d/physics/collision_shape_3d.h index 0eaecb9f6163..4965464e151e 100644 --- a/scene/3d/physics/collision_shape_3d.h +++ b/scene/3d/physics/collision_shape_3d.h @@ -32,7 +32,7 @@ #define COLLISION_SHAPE_3D_H #include "scene/3d/node_3d.h" -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class CollisionObject3D; class CollisionShape3D : public Node3D { diff --git a/scene/3d/physical_bone_simulator_3d.cpp b/scene/3d/physics/physical_bone_simulator_3d.cpp similarity index 100% rename from scene/3d/physical_bone_simulator_3d.cpp rename to scene/3d/physics/physical_bone_simulator_3d.cpp diff --git a/scene/3d/physical_bone_simulator_3d.h b/scene/3d/physics/physical_bone_simulator_3d.h similarity index 100% rename from scene/3d/physical_bone_simulator_3d.h rename to scene/3d/physics/physical_bone_simulator_3d.h diff --git a/scene/3d/physics/physics_body_3d.h b/scene/3d/physics/physics_body_3d.h index 71253be0b800..8e606db9077f 100644 --- a/scene/3d/physics/physics_body_3d.h +++ b/scene/3d/physics/physics_body_3d.h @@ -34,7 +34,7 @@ #include "core/templates/vset.h" #include "scene/3d/physics/collision_object_3d.h" #include "scene/3d/physics/kinematic_collision_3d.h" -#include "scene/resources/physics_material.h" +#include "scene/resources/3d/physics/physics_material.h" #include "servers/physics_server_3d.h" class PhysicsBody3D : public CollisionObject3D { diff --git a/scene/3d/physics/shape_cast_3d.cpp b/scene/3d/physics/shape_cast_3d.cpp index 19c74bc92549..774d045b450d 100644 --- a/scene/3d/physics/shape_cast_3d.cpp +++ b/scene/3d/physics/shape_cast_3d.cpp @@ -32,7 +32,7 @@ #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/physics/collision_object_3d.h" -#include "scene/resources/3d/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" void ShapeCast3D::_notification(int p_what) { switch (p_what) { diff --git a/scene/3d/physics/shape_cast_3d.h b/scene/3d/physics/shape_cast_3d.h index 9fc5e7167000..c4d67fe91d58 100644 --- a/scene/3d/physics/shape_cast_3d.h +++ b/scene/3d/physics/shape_cast_3d.h @@ -32,7 +32,7 @@ #define SHAPE_CAST_3D_H #include "scene/3d/node_3d.h" -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class CollisionObject3D; diff --git a/scene/3d/soft_body_3d.compat.inc b/scene/3d/physics/soft_body_3d.compat.inc similarity index 100% rename from scene/3d/soft_body_3d.compat.inc rename to scene/3d/physics/soft_body_3d.compat.inc diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/physics/soft_body_3d.cpp similarity index 100% rename from scene/3d/soft_body_3d.cpp rename to scene/3d/physics/soft_body_3d.cpp diff --git a/scene/3d/soft_body_3d.h b/scene/3d/physics/soft_body_3d.h similarity index 100% rename from scene/3d/soft_body_3d.h rename to scene/3d/physics/soft_body_3d.h diff --git a/scene/3d/physics/spring_arm_3d.cpp b/scene/3d/physics/spring_arm_3d.cpp index 8d2f10310c77..2d3591be47e9 100644 --- a/scene/3d/physics/spring_arm_3d.cpp +++ b/scene/3d/physics/spring_arm_3d.cpp @@ -31,7 +31,7 @@ #include "spring_arm_3d.h" #include "scene/3d/camera_3d.h" -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" void SpringArm3D::_notification(int p_what) { switch (p_what) { diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp index 0a798670062b..bbc8b8984f95 100644 --- a/scene/animation/animation_mixer.cpp +++ b/scene/animation/animation_mixer.cpp @@ -35,7 +35,9 @@ #include "core/config/project_settings.h" #include "core/string/print_string.h" #include "core/string/string_name.h" +#ifndef _PHYSICS_DISABLED #include "scene/2d/audio_stream_player_2d.h" +#endif // !_PHYSICS_DISABLED #include "scene/animation/animation_player.h" #include "scene/audio/audio_stream_player.h" #include "scene/resources/animation.h" diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index f369aec569ec..b8e1a70bbabd 100644 --- a/scene/debugger/scene_debugger.cpp +++ b/scene/debugger/scene_debugger.cpp @@ -1607,6 +1607,7 @@ void RuntimeNodeSelect::_update_selection() { if (ci->_edit_use_rect()) { rect = ci->_edit_get_rect(); +#ifndef _PHYSICS_DISABLED } else { CollisionShape2D *collision_shape = Object::cast_to(ci); if (collision_shape) { @@ -1615,6 +1616,7 @@ void RuntimeNodeSelect::_update_selection() { rect = shape->get_rect(); } } +#endif // !_PHYSICS_DISABLED } RS::get_singleton()->canvas_item_set_visible(sbox_2d_ci, selection_visible); @@ -1801,6 +1803,7 @@ void RuntimeNodeSelect::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_n res.order = ci->get_effective_z_index() + ci->get_canvas_layer(); r_items.push_back(res); +#ifndef _PHYSICS_DISABLED // If it's a shape, get the collision object it's from. // FIXME: If the collision object has multiple shapes, only the topmost will be above it in the list. if (Object::cast_to(ci) || Object::cast_to(ci)) { @@ -1812,6 +1815,7 @@ void RuntimeNodeSelect::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_n r_items.push_back(res_col); } } +#endif // !_PHYSICS_DISABLED } } } diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 1d709a13f3ef..9781b783904d 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -42,8 +42,9 @@ #include "base_button.h" #include "core/config/project_settings.h" -#include "core/os/keyboard.h" + #include "scene/gui/label.h" +#include "scene/main/timer.h" #include "scene/main/window.h" void BaseButton::_unpress_group() { diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h index 17988f991254..2ebadc1d2789 100644 --- a/scene/gui/base_button.h +++ b/scene/gui/base_button.h @@ -46,6 +46,7 @@ #include "scene/gui/control.h" class ButtonGroup; +class Timer; class BaseButton : public Control { GDCLASS(BaseButton, Control); diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp index 5f1ea9b32ca3..14880297ed0d 100644 --- a/scene/gui/check_box.cpp +++ b/scene/gui/check_box.cpp @@ -42,7 +42,6 @@ #include "check_box.h" #include "scene/theme/theme_db.h" -#include "servers/rendering_server.h" Size2 CheckBox::get_icon_size() const { Size2 tex_size = Size2(0, 0); diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp index 0393c928b539..16c9b4b26f36 100644 --- a/scene/gui/check_button.cpp +++ b/scene/gui/check_button.cpp @@ -42,7 +42,6 @@ #include "check_button.h" #include "scene/theme/theme_db.h" -#include "servers/rendering_server.h" Size2 CheckButton::get_icon_size() const { Ref on_tex; diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index cbd51ca69456..3a27176eb089 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -34,6 +34,7 @@ #include "core/os/keyboard.h" #include "core/string/string_builder.h" #include "core/string/ustring.h" +#include "scene/resources/text_line.h" #include "scene/theme/theme_db.h" void CodeEdit::_notification(int p_what) { diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 373411e668f5..eb4cdeb02650 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -39,7 +39,6 @@ #include "scene/gui/line_edit.h" #include "scene/gui/margin_container.h" #include "scene/gui/menu_button.h" -#include "scene/gui/option_button.h" #include "scene/gui/panel.h" #include "scene/gui/popup_menu.h" #include "scene/gui/slider.h" diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 515c33a45477..5ea3829476eb 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -3061,6 +3061,7 @@ bool Control::is_layout_rtl() const { if (data.is_rtl_dirty) { data.is_rtl_dirty = false; if (data.layout_dir == LAYOUT_DIRECTION_INHERITED) { +#ifndef PIXEL_ENGINE #ifdef TOOLS_ENABLED if (is_part_of_edited_scene() && GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) { data.is_rtl = true; @@ -3090,6 +3091,7 @@ bool Control::is_layout_rtl() const { return data.is_rtl; } #endif // TOOLS_ENABLED +#endif // !PIXEL_ENGINE Node *parent_node = get_parent(); while (parent_node) { Control *parent_control = Object::cast_to(parent_node); @@ -3118,19 +3120,27 @@ bool Control::is_layout_rtl() const { data.is_rtl = TS->is_locale_right_to_left(locale); } } else if (data.layout_dir == LAYOUT_DIRECTION_APPLICATION_LOCALE) { +#ifndef PIXEL_ENGINE if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) { data.is_rtl = true; } else { +#endif // !PIXEL_ENGINE String locale = TranslationServer::get_singleton()->get_tool_locale(); data.is_rtl = TS->is_locale_right_to_left(locale); +#ifndef PIXEL_ENGINE } +#endif // !PIXEL_ENGINE } else if (data.layout_dir == LAYOUT_DIRECTION_SYSTEM_LOCALE) { +#ifndef PIXEL_ENGINE if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) { const_cast(this)->data.is_rtl = true; } else { +#endif // !PIXEL_ENGINE String locale = OS::get_singleton()->get_locale(); const_cast(this)->data.is_rtl = TS->is_locale_right_to_left(locale); +#ifndef PIXEL_ENGINE } +#endif // !PIXEL_ENGINE } else { data.is_rtl = (data.layout_dir == LAYOUT_DIRECTION_RTL); } diff --git a/scene/gui/control.h b/scene/gui/control.h index 23190381f3f4..5dfacab8b84c 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -34,7 +34,6 @@ #include "core/math/transform_2d.h" #include "core/object/gdvirtual.gen.inc" #include "scene/main/canvas_item.h" -#include "scene/main/timer.h" #include "scene/resources/theme.h" class Viewport; diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index de9d5fbfc8a7..d90eeeac7ad7 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -31,10 +31,11 @@ #include "dialogs.h" #include "dialogs.compat.inc" -#include "core/os/keyboard.h" -#include "core/string/print_string.h" -#include "core/string/translation.h" +#include "scene/gui/box_container.h" +#include "scene/gui/button.h" +#include "scene/gui/label.h" #include "scene/gui/line_edit.h" +#include "scene/gui/panel.h" #include "scene/theme/theme_db.h" // AcceptDialog diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h index 404237bfd855..53b50f1c96ac 100644 --- a/scene/gui/dialogs.h +++ b/scene/gui/dialogs.h @@ -31,15 +31,13 @@ #ifndef DIALOGS_H #define DIALOGS_H -#include "box_container.h" -#include "scene/gui/button.h" -#include "scene/gui/label.h" -#include "scene/gui/panel.h" -#include "scene/gui/popup.h" -#include "scene/gui/texture_button.h" #include "scene/main/window.h" +class Button; +class HBoxContainer; +class Label; class LineEdit; +class Panel; class AcceptDialog : public Window { GDCLASS(AcceptDialog, Window); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 5512e74c0435..e2eb5120f1aa 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -32,11 +32,15 @@ #include "core/config/project_settings.h" #include "core/os/keyboard.h" -#include "core/string/print_string.h" +#include "scene/gui/box_container.h" #include "scene/gui/check_box.h" #include "scene/gui/grid_container.h" #include "scene/gui/label.h" +#include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" +#include "scene/gui/popup_menu.h" +#include "scene/gui/scroll_bar.h" +#include "scene/gui/tree.h" #include "scene/theme/theme_db.h" FileDialog::GetIconFunc FileDialog::get_icon_func = nullptr; diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index af8e8950ae95..07ea680d2710 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -31,16 +31,17 @@ #ifndef FILE_DIALOG_H #define FILE_DIALOG_H -#include "box_container.h" #include "core/io/dir_access.h" #include "scene/gui/dialogs.h" -#include "scene/gui/line_edit.h" -#include "scene/gui/option_button.h" -#include "scene/gui/tree.h" #include "scene/property_list_helper.h" class GridContainer; +class HBoxContainer; +class LineEdit; +class OptionButton; class PopupMenu; +class Tree; +class VBoxContainer; class FileDialog : public ConfirmationDialog { GDCLASS(FileDialog, ConfirmationDialog); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index bcf0f5bdc89f..c5ee074ea196 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -39,6 +39,8 @@ #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/graph_edit_arranger.h" +#include "scene/gui/graph_frame.h" +#include "scene/gui/graph_node.h" #include "scene/gui/label.h" #include "scene/gui/panel_container.h" #include "scene/gui/scroll_bar.h" diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index e39bbac13a10..86640f405a6b 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -31,13 +31,15 @@ #ifndef GRAPH_EDIT_H #define GRAPH_EDIT_H -#include "scene/gui/box_container.h" -#include "scene/gui/graph_frame.h" -#include "scene/gui/graph_node.h" +#include "scene/gui/control.h" class Button; class GraphEdit; class GraphEditArranger; +class GraphElement; +class GraphFrame; +class GraphNode; +class HBoxContainer; class HScrollBar; class Label; class Line2D; diff --git a/scene/gui/graph_edit_arranger.cpp b/scene/gui/graph_edit_arranger.cpp index fa1059c66760..b91f63257f54 100644 --- a/scene/gui/graph_edit_arranger.cpp +++ b/scene/gui/graph_edit_arranger.cpp @@ -31,6 +31,7 @@ #include "graph_edit_arranger.h" #include "scene/gui/graph_edit.h" +#include "scene/gui/graph_node.h" void GraphEditArranger::arrange_nodes() { ERR_FAIL_NULL(graph_edit); diff --git a/scene/gui/graph_element.cpp b/scene/gui/graph_element.cpp index b63ed8d1adac..878a1313687c 100644 --- a/scene/gui/graph_element.cpp +++ b/scene/gui/graph_element.cpp @@ -30,7 +30,6 @@ #include "graph_element.h" -#include "core/string/translation.h" #include "scene/gui/graph_edit.h" #include "scene/theme/theme_db.h" diff --git a/scene/gui/graph_frame.cpp b/scene/gui/graph_frame.cpp index e85d00726227..42f1065f6532 100644 --- a/scene/gui/graph_frame.cpp +++ b/scene/gui/graph_frame.cpp @@ -30,7 +30,6 @@ #include "graph_frame.h" -#include "core/string/translation.h" #include "scene/gui/box_container.h" #include "scene/gui/label.h" #include "scene/resources/style_box_flat.h" diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index 8f5023104a6a..4e9743daeb0d 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -30,7 +30,6 @@ #include "graph_node.h" -#include "core/string/translation.h" #include "scene/gui/box_container.h" #include "scene/gui/label.h" #include "scene/theme/theme_db.h" diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 1ba5ef309b0f..98592a417574 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -32,6 +32,7 @@ #include "core/config/project_settings.h" #include "core/os/os.h" +#include "scene/gui/scroll_bar.h" #include "scene/theme/theme_db.h" void ItemList::_shape_text(int p_idx) { diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index 0836ea33d52b..ac3c6b6b60ef 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -32,10 +32,11 @@ #define ITEM_LIST_H #include "scene/gui/control.h" -#include "scene/gui/scroll_bar.h" #include "scene/property_list_helper.h" #include "scene/resources/text_paragraph.h" +class VScrollBar; + class ItemList : public Control { GDCLASS(ItemList, Control); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index e79a7f03a727..b5acbcc6f220 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -30,9 +30,6 @@ #include "label.h" -#include "core/config/project_settings.h" -#include "core/string/print_string.h" -#include "core/string/translation.h" #include "scene/gui/container.h" #include "scene/theme/theme_db.h" #include "servers/text_server.h" diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index b92cdf2b3537..18c160b20f21 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -33,9 +33,8 @@ #include "core/input/input_map.h" #include "core/os/keyboard.h" #include "core/os/os.h" -#include "core/string/print_string.h" -#include "core/string/translation.h" #include "scene/gui/label.h" +#include "scene/gui/popup_menu.h" #include "scene/main/window.h" #include "scene/theme/theme_db.h" #include "servers/display_server.h" diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index f7d017ab0332..0d642adeb318 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -32,7 +32,8 @@ #define LINE_EDIT_H #include "scene/gui/control.h" -#include "scene/gui/popup_menu.h" + +class PopupMenu; class LineEdit : public Control { GDCLASS(LineEdit, Control); diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp index ee96d659b0a9..f8bbb8c945ea 100644 --- a/scene/gui/link_button.cpp +++ b/scene/gui/link_button.cpp @@ -41,7 +41,6 @@ #include "link_button.h" -#include "core/string/translation.h" #include "scene/theme/theme_db.h" void LinkButton::_shape() { diff --git a/scene/gui/menu_bar.cpp b/scene/gui/menu_bar.cpp index 9853d699d40b..0a8f879c5a4b 100644 --- a/scene/gui/menu_bar.cpp +++ b/scene/gui/menu_bar.cpp @@ -30,7 +30,6 @@ #include "menu_bar.h" -#include "core/os/keyboard.h" #include "scene/main/window.h" #include "scene/theme/theme_db.h" diff --git a/scene/gui/menu_bar.h b/scene/gui/menu_bar.h index 04f6afc2fa7d..36177738cbe8 100644 --- a/scene/gui/menu_bar.h +++ b/scene/gui/menu_bar.h @@ -31,7 +31,6 @@ #ifndef MENU_BAR_H #define MENU_BAR_H -#include "scene/gui/button.h" #include "scene/gui/popup_menu.h" class MenuBar : public Control { diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 1069a752c4d2..8df9dd6b01db 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -30,7 +30,7 @@ #include "menu_button.h" -#include "core/os/keyboard.h" +#include "scene/gui/popup_menu.h" #include "scene/main/window.h" void MenuButton::shortcut_input(const Ref &p_event) { diff --git a/scene/gui/menu_button.h b/scene/gui/menu_button.h index 5a74d61091c7..71d40a72abf3 100644 --- a/scene/gui/menu_button.h +++ b/scene/gui/menu_button.h @@ -32,9 +32,10 @@ #define MENU_BUTTON_H #include "scene/gui/button.h" -#include "scene/gui/popup_menu.h" #include "scene/property_list_helper.h" +class PopupMenu; + class MenuButton : public Button { GDCLASS(MenuButton, Button); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 586efbfc61ad..edd79f646b43 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -41,8 +41,7 @@ #include "option_button.h" -#include "core/os/keyboard.h" -#include "core/string/print_string.h" +#include "scene/gui/popup_menu.h" #include "scene/theme/theme_db.h" static const int NONE_SELECTED = -1; diff --git a/scene/gui/option_button.h b/scene/gui/option_button.h index 351df9a74977..63c3ab89c14c 100644 --- a/scene/gui/option_button.h +++ b/scene/gui/option_button.h @@ -32,9 +32,10 @@ #define OPTION_BUTTON_H #include "scene/gui/button.h" -#include "scene/gui/popup_menu.h" #include "scene/property_list_helper.h" +class PopupMenu; + class OptionButton : public Button { GDCLASS(OptionButton, Button); diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 10fadeeba1e5..a9baf03168ab 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -30,8 +30,6 @@ #include "popup.h" -#include "core/config/engine.h" -#include "core/os/keyboard.h" #include "scene/gui/panel.h" #include "scene/theme/theme_db.h" diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 13cfa3d2304a..e93c7652e4c8 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -35,9 +35,10 @@ #include "core/input/input.h" #include "core/os/keyboard.h" #include "core/os/os.h" -#include "core/string/print_string.h" -#include "core/string/translation.h" #include "scene/gui/menu_bar.h" +#include "scene/gui/scroll_bar.h" +#include "scene/gui/scroll_container.h" +#include "scene/main/timer.h" #include "scene/theme/theme_db.h" HashMap PopupMenu::system_menus; diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index 442ffa2ebc94..6e81537d7adb 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -32,11 +32,14 @@ #define POPUP_MENU_H #include "core/input/shortcut.h" +#include "scene/gui/control.h" #include "scene/gui/popup.h" -#include "scene/gui/scroll_container.h" #include "scene/property_list_helper.h" #include "scene/resources/text_line.h" +class ScrollContainer; +class Timer; + class PopupMenu : public Popup { GDCLASS(PopupMenu, Popup); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index be54ef7c94ed..e23e0149507f 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -35,9 +35,10 @@ #include "core/math/math_defs.h" #include "core/os/keyboard.h" #include "core/os/os.h" -#include "core/string/translation.h" #include "scene/gui/label.h" +#include "scene/gui/popup_menu.h" #include "scene/gui/rich_text_effect.h" +#include "scene/gui/scroll_bar.h" #include "scene/resources/atlas_texture.h" #include "scene/theme/theme_db.h" #include "servers/display_server.h" diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index d9aac546ca07..5b5f554e6bad 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -33,12 +33,13 @@ #include "core/object/worker_thread_pool.h" #include "core/templates/rid_owner.h" -#include "scene/gui/popup_menu.h" -#include "scene/gui/scroll_bar.h" +#include "scene/gui/control.h" #include "scene/resources/text_paragraph.h" class CharFXTransform; class RichTextEffect; +class PopupMenu; +class VScrollBar; class RichTextLabel : public Control { GDCLASS(RichTextLabel, Control); diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 38a4bb427a9e..b81927f1e00f 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -30,9 +30,6 @@ #include "scroll_bar.h" -#include "core/os/keyboard.h" -#include "core/os/os.h" -#include "core/string/print_string.h" #include "scene/main/window.h" #include "scene/theme/theme_db.h" diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index f5f4cccb165e..5b498170190e 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -42,6 +42,7 @@ #include "scroll_container.h" #include "core/config/project_settings.h" +#include "scene/gui/scroll_bar.h" #include "scene/main/window.h" #include "scene/theme/theme_db.h" diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h index 43cbb1b6bf9e..6d4bd128c8f6 100644 --- a/scene/gui/scroll_container.h +++ b/scene/gui/scroll_container.h @@ -42,9 +42,10 @@ #ifndef SCROLL_CONTAINER_H #define SCROLL_CONTAINER_H -#include "container.h" +#include "scene/gui/container.h" -#include "scroll_bar.h" +class VScrollBar; +class HScrollBar; class ScrollContainer : public Container { GDCLASS(ScrollContainer, Container); diff --git a/scene/gui/separator.h b/scene/gui/separator.h index 7c973604ac5d..aec60b5a869f 100644 --- a/scene/gui/separator.h +++ b/scene/gui/separator.h @@ -32,6 +32,7 @@ #define SEPARATOR_H #include "scene/gui/control.h" + class Separator : public Control { GDCLASS(Separator, Control); diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index 7099b1892b93..fe6f29a314c3 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -30,7 +30,6 @@ #include "slider.h" -#include "core/os/keyboard.h" #include "scene/theme/theme_db.h" Size2 Slider::get_minimum_size() const { diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 8fe9b05ae322..fefacf524c9e 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -32,6 +32,8 @@ #include "core/input/input.h" #include "core/math/expression.h" +#include "scene/gui/line_edit.h" +#include "scene/main/timer.h" #include "scene/theme/theme_db.h" Size2 SpinBox::get_minimum_size() const { diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h index 564294649c94..c4df2fd7ad5c 100644 --- a/scene/gui/spin_box.h +++ b/scene/gui/spin_box.h @@ -31,9 +31,10 @@ #ifndef SPIN_BOX_H #define SPIN_BOX_H -#include "scene/gui/line_edit.h" #include "scene/gui/range.h" -#include "scene/main/timer.h" + +class LineEdit; +class Timer; class SpinBox : public Range { GDCLASS(SpinBox, Range); diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index be03db526d09..fed66405f65b 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -30,9 +30,7 @@ #include "split_container.h" -#include "scene/gui/label.h" -#include "scene/gui/margin_container.h" -#include "scene/main/window.h" +#include "scene/main/viewport.h" #include "scene/theme/theme_db.h" void SplitContainerDragger::gui_input(const Ref &p_event) { diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp index 6cc7ec3bd5ce..7d47fa84fda1 100644 --- a/scene/gui/tab_bar.cpp +++ b/scene/gui/tab_bar.cpp @@ -30,7 +30,6 @@ #include "tab_bar.h" -#include "core/string/translation.h" #include "scene/gui/box_container.h" #include "scene/gui/label.h" #include "scene/gui/texture_rect.h" diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 33e72428cfb0..6deb771811b4 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -30,6 +30,7 @@ #include "tab_container.h" +#include "scene/gui/popup.h" #include "scene/theme/theme_db.h" int TabContainer::_get_tab_height() const { diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h index e00bc780d47b..8583e506f59f 100644 --- a/scene/gui/tab_container.h +++ b/scene/gui/tab_container.h @@ -32,9 +32,10 @@ #define TAB_CONTAINER_H #include "scene/gui/container.h" -#include "scene/gui/popup.h" #include "scene/gui/tab_bar.h" +class Popup; + class TabContainer : public Container { GDCLASS(TabContainer, Container); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index a33769eaa994..2b135bcdad3a 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -40,6 +40,9 @@ #include "core/string/string_builder.h" #include "core/string/translation_server.h" #include "scene/gui/label.h" +#include "scene/gui/popup_menu.h" +#include "scene/gui/scroll_bar.h" +#include "scene/main/timer.h" #include "scene/main/window.h" #include "scene/theme/theme_db.h" diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 6b137581f2f7..9e585879386e 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -32,12 +32,14 @@ #define TEXT_EDIT_H #include "scene/gui/control.h" -#include "scene/gui/popup_menu.h" -#include "scene/gui/scroll_bar.h" -#include "scene/main/timer.h" #include "scene/resources/syntax_highlighter.h" #include "scene/resources/text_paragraph.h" +class HScrollBar; +class Timer; +class PopupMenu; +class VScrollBar; + class TextEdit : public Control { GDCLASS(TextEdit, Control); diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h index 9d393d3c65b6..26bc16124026 100644 --- a/scene/gui/texture_button.h +++ b/scene/gui/texture_button.h @@ -33,6 +33,7 @@ #include "scene/gui/base_button.h" #include "scene/resources/bit_map.h" + class TextureButton : public BaseButton { GDCLASS(TextureButton, BaseButton); diff --git a/scene/gui/texture_progress_bar.cpp b/scene/gui/texture_progress_bar.cpp index 40311344170c..853bde3f85de 100644 --- a/scene/gui/texture_progress_bar.cpp +++ b/scene/gui/texture_progress_bar.cpp @@ -30,8 +30,6 @@ #include "texture_progress_bar.h" -#include "core/config/engine.h" - void TextureProgressBar::set_under_texture(const Ref &p_texture) { _set_texture(&under, p_texture); } diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index 972a83298547..a06c92e3b7a6 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -30,8 +30,6 @@ #include "texture_rect.h" -#include "servers/rendering_server.h" - void TextureRect::_notification(int p_what) { switch (p_what) { case NOTIFICATION_DRAW: { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index ad15a1763cc7..c72af5bcc5b7 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -36,7 +36,12 @@ #include "core/os/keyboard.h" #include "core/os/os.h" #include "scene/gui/box_container.h" +#include "scene/gui/line_edit.h" +#include "scene/gui/popup_menu.h" +#include "scene/gui/scroll_bar.h" +#include "scene/gui/slider.h" #include "scene/gui/text_edit.h" +#include "scene/main/timer.h" #include "scene/main/window.h" #include "scene/theme/theme_db.h" diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 364f0f245055..835e731e608a 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -32,14 +32,17 @@ #define TREE_H #include "scene/gui/control.h" -#include "scene/gui/line_edit.h" -#include "scene/gui/popup_menu.h" -#include "scene/gui/scroll_bar.h" -#include "scene/gui/slider.h" #include "scene/resources/text_paragraph.h" +class HScrollBar; +class HSlider; +class LineEdit; +class Popup; +class PopupMenu; class TextEdit; +class Timer; class Tree; +class VScrollBar; class TreeItem : public Object { GDCLASS(TreeItem, Object); diff --git a/scene/gui/video_stream_player.h b/scene/gui/video_stream_player.h index c173c8bfa387..2cbe6cac218c 100644 --- a/scene/gui/video_stream_player.h +++ b/scene/gui/video_stream_player.h @@ -34,7 +34,6 @@ #include "scene/gui/control.h" #include "scene/resources/video_stream.h" #include "servers/audio/audio_rb_resampler.h" -#include "servers/audio_server.h" class VideoStreamPlayer : public Control { GDCLASS(VideoStreamPlayer, Control); diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index f87dad1889b2..84d5a49e313a 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -39,7 +39,7 @@ #include "scene/resources/font.h" #include "scene/resources/multimesh.h" #include "scene/resources/style_box.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" #define ERR_DRAW_GUARD \ ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside this node's `_draw()`, functions connected to its `draw` signal, or when it receives NOTIFICATION_DRAW.") diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index 114521e6e3ee..3f94983a62c1 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -32,7 +32,7 @@ #include "scene/main/canvas_item.h" #include "scene/main/viewport.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" void CanvasLayer::set_layer(int p_xform) { layer = p_xform; diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 986c1c64e77b..f2feebe60684 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -48,21 +48,27 @@ #include "scene/gui/control.h" #include "scene/main/multiplayer_api.h" #include "scene/main/viewport.h" +#include "scene/resources/2d/world_2d.h" #include "scene/resources/environment.h" #include "scene/resources/font.h" #include "scene/resources/image_texture.h" #include "scene/resources/material.h" #include "scene/resources/mesh.h" #include "scene/resources/packed_scene.h" -#include "scene/resources/world_2d.h" #include "servers/display_server.h" +#ifndef _NAVIGATION_DISABLED #include "servers/navigation_server_3d.h" +#endif // !_NAVIGATION_DISABLED +#ifndef _PHYSICS_DISABLED #include "servers/physics_server_2d.h" #ifndef _3D_DISABLED +#include "servers/physics_server_3d.h" +#endif // !_3D_DISABLED +#endif // !_PHYSICS_DISABLED +#ifndef _3D_DISABLED #include "scene/3d/node_3d.h" #include "scene/resources/3d/world_3d.h" -#include "servers/physics_server_3d.h" -#endif // _3D_DISABLED +#endif // !_3D_DISABLED #include "window.h" #include #include @@ -975,10 +981,12 @@ void SceneTree::set_pause(bool p_enabled) { paused = p_enabled; +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED PhysicsServer3D::get_singleton()->set_active(!p_enabled); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED PhysicsServer2D::get_singleton()->set_active(!p_enabled); +#endif // !_PHYSICS_DISABLED if (get_root()) { get_root()->_propagate_pause_notification(p_enabled); } @@ -998,11 +1006,12 @@ void SceneTree::set_suspend(bool p_enabled) { suspended = p_enabled; Engine::get_singleton()->set_freeze_time_scale(p_enabled); - +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED PhysicsServer3D::get_singleton()->set_active(!p_enabled && !paused); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED PhysicsServer2D::get_singleton()->set_active(!p_enabled && !paused); +#endif // !_PHYSICS_DISABLED if (get_root()) { get_root()->_propagate_suspend_notification(p_enabled); } @@ -1850,9 +1859,11 @@ SceneTree::SceneTree() { root = memnew(Window); root->set_min_size(Size2i(64, 64)); // Define a very small minimum window size to prevent bugs such as GH-37242. root->set_process_mode(Node::PROCESS_MODE_PAUSABLE); +#ifndef PIXEL_ENGINE root->set_auto_translate_mode(GLOBAL_GET("internationalization/rendering/root_node_auto_translate") ? Node::AUTO_TRANSLATE_MODE_ALWAYS : Node::AUTO_TRANSLATE_MODE_DISABLED); root->set_name("root"); root->set_title(GLOBAL_GET("application/config/name")); +#endif // !PIXEL_ENGINE if (Engine::get_singleton()->is_editor_hint()) { root->set_wrap_controls(true); @@ -1982,9 +1993,11 @@ SceneTree::SceneTree() { } } } -#endif // _3D_DISABLED +#endif // !_3D_DISABLED +#ifndef _PHYSICS_DISABLED root->set_physics_object_picking(GLOBAL_DEF("physics/common/enable_object_picking", true)); +#endif // !_PHYSICS_DISABLED root->connect("close_requested", callable_mp(this, &SceneTree::_main_window_close)); root->connect("go_back_requested", callable_mp(this, &SceneTree::_main_window_go_back)); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index b8a1ecad787b..778a81db84f4 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -37,13 +37,17 @@ #include "core/templates/sort_array.h" #include "scene/2d/audio_listener_2d.h" #include "scene/2d/camera_2d.h" +#ifndef _PHYSICS_DISABLED #include "scene/2d/physics/collision_object_2d.h" #ifndef _3D_DISABLED +#include "scene/3d/physics/collision_object_3d.h" +#endif // !_3D_DISABLED +#endif // !_PHYSICS_DISABLED +#ifndef _3D_DISABLED #include "scene/3d/audio_listener_3d.h" #include "scene/3d/camera_3d.h" -#include "scene/3d/physics/collision_object_3d.h" #include "scene/3d/world_environment.h" -#endif // _3D_DISABLED +#endif // !_3D_DISABLED #include "scene/gui/control.h" #include "scene/gui/label.h" #include "scene/gui/popup.h" @@ -53,7 +57,7 @@ #include "scene/main/window.h" #include "scene/resources/mesh.h" #include "scene/resources/text_line.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" #include "servers/audio_server.h" #include "servers/rendering/rendering_server_globals.h" @@ -531,6 +535,7 @@ void Viewport::_notification(int p_what) { add_to_group("_viewports"); if (get_tree()->is_debugging_collisions_hint()) { +#ifndef _PHYSICS_DISABLED PhysicsServer2D::get_singleton()->space_set_debug_contacts(find_world_2d()->get_space(), get_tree()->get_collision_debug_contact_count()); contact_2d_debug = RenderingServer::get_singleton()->canvas_item_create(); RenderingServer::get_singleton()->canvas_item_set_parent(contact_2d_debug, current_canvas); @@ -544,8 +549,9 @@ void Viewport::_notification(int p_what) { RenderingServer::get_singleton()->instance_set_base(contact_3d_debug_instance, contact_3d_debug_multimesh); RenderingServer::get_singleton()->instance_set_scenario(contact_3d_debug_instance, find_world_3d()->get_scenario()); RenderingServer::get_singleton()->instance_geometry_set_flag(contact_3d_debug_instance, RS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE, true); -#endif // _3D_DISABLED +#endif // !_3D_DISABLED set_physics_process_internal(true); +#endif // !_PHYSICS_DISABLED } } break; @@ -607,7 +613,7 @@ void Viewport::_notification(int p_what) { case NOTIFICATION_PATH_RENAMED: { _update_viewport_path(); } break; - +#ifndef _PHYSICS_DISABLED case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { if (!get_tree()) { return; @@ -638,8 +644,9 @@ void Viewport::_notification(int p_what) { RS::get_singleton()->multimesh_instance_set_transform(contact_3d_debug_multimesh, i, point_transform); } } -#endif // _3D_DISABLED +#endif // !_3D_DISABLED } break; +#endif // !_PHYSICS_DISABLED case NOTIFICATION_VP_MOUSE_ENTER: { gui.mouse_in_viewport = true; @@ -647,7 +654,9 @@ void Viewport::_notification(int p_what) { case NOTIFICATION_VP_MOUSE_EXIT: { gui.mouse_in_viewport = false; +#ifndef _PHYSICS_DISABLED _drop_physics_mouseover(); +#endif // !_PHYSICS_DISABLED // When the mouse exits the viewport, we don't want to end // mouse_focus, because, for example, we want to continue // dragging a scrollbar even if the mouse has left the viewport. @@ -655,7 +664,9 @@ void Viewport::_notification(int p_what) { case NOTIFICATION_WM_WINDOW_FOCUS_OUT: { _gui_cancel_tooltip(); +#ifndef _PHYSICS_DISABLED _drop_physics_mouseover(); +#endif // !_PHYSICS_DISABLED _drop_mouse_focus(); // When the window focus changes, we want to end mouse_focus, but // not the mouse_over. Note: The OS will trigger a separate mouse @@ -672,6 +683,7 @@ void Viewport::_notification(int p_what) { } } +#ifndef _PHYSICS_DISABLED void Viewport::_process_picking() { if (!is_inside_tree()) { return; @@ -965,6 +977,7 @@ void Viewport::_process_picking() { #endif // _3D_DISABLED } } +#endif // !_PHYSICS_DISABLED RID Viewport::get_viewport_rid() const { ERR_READ_THREAD_GUARD_V(RID()); @@ -2501,6 +2514,7 @@ void Viewport::_drop_mouse_focus() { } } +#ifndef _PHYSICS_DISABLED void Viewport::_drop_physics_mouseover(bool p_paused_only) { _cleanup_mouseover_colliders(true, p_paused_only); @@ -2520,6 +2534,7 @@ void Viewport::_drop_physics_mouseover(bool p_paused_only) { } #endif // _3D_DISABLED } +#endif // !_PHYSICS_DISABLED void Viewport::_gui_grab_click_focus(Control *p_control) { gui.mouse_click_grabber = p_control; @@ -2955,8 +2970,10 @@ void Viewport::_update_mouse_over(Vector2 p_pos) { if (swrect_border.has_point(p_pos)) { if (gui.mouse_over) { _drop_mouse_over(); +#ifndef _PHYSICS_DISABLED } else if (!gui.subwindow_over) { _drop_physics_mouseover(); +#endif // !_PHYSICS_DISABLED } if (swrect.has_point(p_pos)) { if (sw != gui.subwindow_over) { @@ -3024,8 +3041,10 @@ void Viewport::_update_mouse_over(Vector2 p_pos) { if (gui.mouse_over || !gui.mouse_over_hierarchy.is_empty()) { // Send Mouse Exit Self and Mouse Exit notifications. _drop_mouse_over(common_ancestor); +#ifndef _PHYSICS_DISABLED } else { _drop_physics_mouseover(); +#endif // !_PHYSICS_DISABLED } if (over) { @@ -3249,7 +3268,7 @@ void Viewport::_push_unhandled_input_internal(const Ref &p_event) { ERR_FAIL_COND(!is_inside_tree()); get_tree()->_call_input_pause(unhandled_input_group, SceneTree::CALL_INPUT_TYPE_UNHANDLED_INPUT, p_event, this); } - +#ifndef _PHYSICS_DISABLED if (physics_object_picking && !is_input_handled()) { if (Input::get_singleton()->get_mouse_mode() != Input::MOUSE_MODE_CAPTURED && (Object::cast_to(*p_event) || @@ -3261,8 +3280,10 @@ void Viewport::_push_unhandled_input_internal(const Ref &p_event) { set_input_as_handled(); } } +#endif // !_PHYSICS_DISABLED } +#ifndef _PHYSICS_DISABLED void Viewport::set_physics_object_picking(bool p_enable) { ERR_MAIN_THREAD_GUARD; physics_object_picking = p_enable; @@ -3298,6 +3319,7 @@ void Viewport::set_physics_object_picking_first_only(bool p_enable) { bool Viewport::get_physics_object_picking_first_only() { return physics_object_picking_first_only; } +#endif // !_PHYSICS_DISABLED Vector2 Viewport::get_camera_coords(const Vector2 &p_viewport_coords) const { ERR_READ_THREAD_GUARD_V(Vector2()); @@ -3934,6 +3956,7 @@ void Viewport::_camera_2d_set(Camera2D *p_camera_2d) { camera_2d = p_camera_2d; } +#ifndef _PHYSICS_DISABLED void Viewport::_cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paused_only, uint64_t p_frame_reference) { List to_erase; List to_mouse_exit; @@ -4003,6 +4026,7 @@ void Viewport::_cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paus shapes_to_mouse_exit.pop_front(); } } +#endif // !_PHYSICS_DISABLED AudioListener2D *Viewport::get_audio_listener_2d() const { ERR_READ_THREAD_GUARD_V(nullptr); @@ -4682,12 +4706,14 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("get_texture"), &Viewport::get_texture); +#ifndef _PHYSICS_DISABLED ClassDB::bind_method(D_METHOD("set_physics_object_picking", "enable"), &Viewport::set_physics_object_picking); ClassDB::bind_method(D_METHOD("get_physics_object_picking"), &Viewport::get_physics_object_picking); ClassDB::bind_method(D_METHOD("set_physics_object_picking_sort", "enable"), &Viewport::set_physics_object_picking_sort); ClassDB::bind_method(D_METHOD("get_physics_object_picking_sort"), &Viewport::get_physics_object_picking_sort); ClassDB::bind_method(D_METHOD("set_physics_object_picking_first_only", "enable"), &Viewport::set_physics_object_picking_first_only); ClassDB::bind_method(D_METHOD("get_physics_object_picking_first_only"), &Viewport::get_physics_object_picking_first_only); +#endif // !_PHYSICS_DISABLED ClassDB::bind_method(D_METHOD("get_viewport_rid"), &Viewport::get_viewport_rid); ClassDB::bind_method(D_METHOD("push_text_input", "text"), &Viewport::push_text_input); @@ -4763,7 +4789,9 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("set_mesh_lod_threshold", "pixels"), &Viewport::set_mesh_lod_threshold); ClassDB::bind_method(D_METHOD("get_mesh_lod_threshold"), &Viewport::get_mesh_lod_threshold); +#ifndef _PHYSICS_DISABLED ClassDB::bind_method(D_METHOD("_process_picking"), &Viewport::_process_picking); +#endif // !_PHYSICS_DISABLED ClassDB::bind_method(D_METHOD("set_as_audio_listener_2d", "enable"), &Viewport::set_as_audio_listener_2d); ClassDB::bind_method(D_METHOD("is_audio_listener_2d"), &Viewport::is_audio_listener_2d); @@ -4850,10 +4878,12 @@ void Viewport::_bind_methods() { #ifndef _3D_DISABLED ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_listener_enable_3d"), "set_as_audio_listener_3d", "is_audio_listener_3d"); #endif // _3D_DISABLED +#ifndef _PHYSICS_DISABLED ADD_GROUP("Physics", "physics_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "physics_object_picking"), "set_physics_object_picking", "get_physics_object_picking"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "physics_object_picking_sort"), "set_physics_object_picking_sort", "get_physics_object_picking_sort"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "physics_object_picking_first_only"), "set_physics_object_picking_first_only", "get_physics_object_picking_first_only"); +#endif // !_PHYSICS_DISABLED ADD_GROUP("GUI", "gui_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "gui_disable_input"), "set_disable_input", "is_input_disabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "gui_snap_controls_to_pixels"), "set_snap_controls_to_pixels", "is_snap_controls_to_pixels_enabled"); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 4dee21646b8c..d815d1f14190 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -258,6 +258,7 @@ class Viewport : public Node { bool snap_2d_transforms_to_pixel = false; bool snap_2d_vertices_to_pixel = false; +#ifndef _PHYSICS_DISABLED bool physics_object_picking = false; bool physics_object_picking_sort = false; bool physics_object_picking_first_only = false; @@ -267,6 +268,7 @@ class Viewport : public Node { Transform3D physics_last_object_transform; Transform3D physics_last_camera_transform; ObjectID physics_last_id; +#endif // !_PHYSICS_DISABLED bool handle_input_locally = true; bool local_input_handled = false; @@ -484,7 +486,9 @@ class Viewport : public Node { bool _is_size_allocated() const; void _notification(int p_what); +#ifndef _PHYSICS_DISABLED void _process_picking(); +#endif // !_PHYSICS_DISABLED static void _bind_methods(); void _validate_property(PropertyInfo &p_property) const; @@ -588,12 +592,14 @@ class Viewport : public Node { void warp_mouse(const Vector2 &p_position); virtual void update_mouse_cursor_state(); +#ifndef _PHYSICS_DISABLED void set_physics_object_picking(bool p_enable); bool get_physics_object_picking(); void set_physics_object_picking_sort(bool p_enable); bool get_physics_object_picking_sort(); void set_physics_object_picking_first_only(bool p_enable); bool get_physics_object_picking_first_only(); +#endif // !_PHYSICS_DISABLED Variant gui_get_drag_data() const; @@ -698,12 +704,14 @@ class Viewport : public Node { Camera2D *camera_2d = nullptr; void _camera_2d_set(Camera2D *p_camera_2d); +#ifndef _PHYSICS_DISABLED // Collider to frame HashMap physics_2d_mouseover; // Collider & shape to frame HashMap, uint64_t, PairHash> physics_2d_shape_mouseover; // Cleans up colliders corresponding to old frames or all of them. void _cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paused_only, uint64_t p_frame_reference = 0); +#endif // !_PHYSICS_DISABLED public: AudioListener2D *get_audio_listener_2d() const; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 71fac3df9918..3bdc75e04ab7 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -2648,6 +2648,7 @@ Window::LayoutDirection Window::get_layout_direction() const { bool Window::is_layout_rtl() const { ERR_READ_THREAD_GUARD_V(false); if (layout_dir == LAYOUT_DIRECTION_INHERITED) { +#ifndef PIXEL_ENGINE #ifdef TOOLS_ENABLED if (is_part_of_edited_scene() && GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) { return true; @@ -2673,7 +2674,8 @@ bool Window::is_layout_rtl() const { if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) { return true; } -#endif +#endif // TOOLS_ENABLED +#endif // !PIXEL_ENGINE Node *parent_node = get_parent(); while (parent_node) { Control *parent_control = Object::cast_to(parent_node); @@ -2700,19 +2702,27 @@ bool Window::is_layout_rtl() const { return TS->is_locale_right_to_left(locale); } } else if (layout_dir == LAYOUT_DIRECTION_APPLICATION_LOCALE) { +#ifndef PIXEL_ENGINE if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) { return true; } else { +#endif // !PIXEL_ENGINE String locale = TranslationServer::get_singleton()->get_tool_locale(); return TS->is_locale_right_to_left(locale); +#ifndef PIXEL_ENGINE } +#endif // !PIXEL_ENGINE } else if (layout_dir == LAYOUT_DIRECTION_SYSTEM_LOCALE) { +#ifndef PIXEL_ENGINE if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) { return true; } else { +#endif // !PIXEL_ENGINE String locale = OS::get_singleton()->get_locale(); return TS->is_locale_right_to_left(locale); +#ifndef PIXEL_ENGINE } +#endif // !PIXEL_ENGINE } else { return (layout_dir == LAYOUT_DIRECTION_RTL); } diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index dbc2d83525c2..402be267d53f 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -116,6 +116,7 @@ #include "scene/main/timer.h" #include "scene/main/viewport.h" #include "scene/main/window.h" +#include "scene/resources/2d/world_2d.h" #include "scene/resources/animated_texture.h" #include "scene/resources/animation_library.h" #include "scene/resources/atlas_texture.h" @@ -141,10 +142,8 @@ #include "scene/resources/mesh_data_tool.h" #include "scene/resources/mesh_texture.h" #include "scene/resources/multimesh.h" -#include "scene/resources/navigation_mesh.h" #include "scene/resources/packed_scene.h" #include "scene/resources/particle_process_material.h" -#include "scene/resources/physics_material.h" #include "scene/resources/placeholder_textures.h" #include "scene/resources/portable_compressed_texture.h" #include "scene/resources/resource_format_text.h" @@ -164,17 +163,17 @@ #include "scene/resources/texture_rd.h" #include "scene/resources/theme.h" #include "scene/resources/video_stream.h" +#ifndef _VISUAL_SHADER_DISABLED #include "scene/resources/visual_shader.h" #include "scene/resources/visual_shader_nodes.h" #include "scene/resources/visual_shader_particle_nodes.h" #include "scene/resources/visual_shader_sdf_nodes.h" -#include "scene/resources/world_2d.h" +#endif // !_VISUAL_SHADER_DISABLED #include "scene/theme/theme_db.h" // 2D #include "scene/2d/animated_sprite_2d.h" #include "scene/2d/audio_listener_2d.h" -#include "scene/2d/audio_stream_player_2d.h" #include "scene/2d/back_buffer_copy.h" #include "scene/2d/camera_2d.h" #include "scene/2d/canvas_group.h" @@ -187,16 +186,23 @@ #include "scene/2d/marker_2d.h" #include "scene/2d/mesh_instance_2d.h" #include "scene/2d/multimesh_instance_2d.h" -#include "scene/2d/navigation_agent_2d.h" -#include "scene/2d/navigation_link_2d.h" -#include "scene/2d/navigation_obstacle_2d.h" -#include "scene/2d/navigation_region_2d.h" +#ifndef _NAVIGATION_DISABLED +#include "scene/2d/navigation/navigation_agent_2d.h" +#include "scene/2d/navigation/navigation_link_2d.h" +#include "scene/2d/navigation/navigation_obstacle_2d.h" +#include "scene/2d/navigation/navigation_region_2d.h" +#include "scene/resources/2d/navigation/navigation_mesh_source_geometry_data_2d.h" +#include "scene/resources/2d/navigation/navigation_polygon.h" +#endif // !_NAVIGATION_DISABLED #include "scene/2d/parallax_2d.h" #include "scene/2d/parallax_background.h" #include "scene/2d/parallax_layer.h" #include "scene/2d/path_2d.h" + +#ifndef _PHYSICS_DISABLED #include "scene/2d/physics/animatable_body_2d.h" #include "scene/2d/physics/area_2d.h" +#include "scene/2d/physics/audio_stream_player_2d.h" #include "scene/2d/physics/character_body_2d.h" #include "scene/2d/physics/collision_polygon_2d.h" #include "scene/2d/physics/collision_shape_2d.h" @@ -211,62 +217,38 @@ #include "scene/2d/physics/rigid_body_2d.h" #include "scene/2d/physics/shape_cast_2d.h" #include "scene/2d/physics/static_body_2d.h" +#include "scene/2d/physics/touch_screen_button.h" +#include "scene/resources/2d/physics/capsule_shape_2d.h" +#include "scene/resources/2d/physics/circle_shape_2d.h" +#include "scene/resources/2d/physics/concave_polygon_shape_2d.h" +#include "scene/resources/2d/physics/convex_polygon_shape_2d.h" +#include "scene/resources/2d/physics/rectangle_shape_2d.h" +#include "scene/resources/2d/physics/segment_shape_2d.h" +#include "scene/resources/2d/physics/separation_ray_shape_2d.h" +#include "scene/resources/2d/physics/world_boundary_shape_2d.h" +#include "scene/resources/2d/skeleton/physics/skeleton_modification_2d_jiggle.h" +#include "scene/resources/2d/skeleton/physics/skeleton_modification_2d_physicalbones.h" +#endif // !_PHYSICS_DISABLED + #include "scene/2d/polygon_2d.h" #include "scene/2d/remote_transform_2d.h" #include "scene/2d/skeleton_2d.h" #include "scene/2d/sprite_2d.h" #include "scene/2d/tile_map.h" #include "scene/2d/tile_map_layer.h" -#include "scene/2d/touch_screen_button.h" #include "scene/2d/visible_on_screen_notifier_2d.h" -#include "scene/resources/2d/capsule_shape_2d.h" -#include "scene/resources/2d/circle_shape_2d.h" -#include "scene/resources/2d/concave_polygon_shape_2d.h" -#include "scene/resources/2d/convex_polygon_shape_2d.h" -#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h" -#include "scene/resources/2d/navigation_polygon.h" #include "scene/resources/2d/polygon_path_finder.h" -#include "scene/resources/2d/rectangle_shape_2d.h" -#include "scene/resources/2d/segment_shape_2d.h" -#include "scene/resources/2d/separation_ray_shape_2d.h" #include "scene/resources/2d/skeleton/skeleton_modification_2d.h" #include "scene/resources/2d/skeleton/skeleton_modification_2d_ccdik.h" #include "scene/resources/2d/skeleton/skeleton_modification_2d_fabrik.h" -#include "scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.h" #include "scene/resources/2d/skeleton/skeleton_modification_2d_lookat.h" -#include "scene/resources/2d/skeleton/skeleton_modification_2d_physicalbones.h" #include "scene/resources/2d/skeleton/skeleton_modification_2d_stackholder.h" #include "scene/resources/2d/skeleton/skeleton_modification_2d_twoboneik.h" #include "scene/resources/2d/skeleton/skeleton_modification_stack_2d.h" #include "scene/resources/2d/tile_set.h" -#include "scene/resources/2d/world_boundary_shape_2d.h" #ifndef _3D_DISABLED -#include "scene/3d/audio_listener_3d.h" -#include "scene/3d/audio_stream_player_3d.h" -#include "scene/3d/bone_attachment_3d.h" -#include "scene/3d/camera_3d.h" -#include "scene/3d/cpu_particles_3d.h" -#include "scene/3d/decal.h" -#include "scene/3d/fog_volume.h" -#include "scene/3d/gpu_particles_3d.h" -#include "scene/3d/gpu_particles_collision_3d.h" -#include "scene/3d/importer_mesh_instance_3d.h" -#include "scene/3d/label_3d.h" -#include "scene/3d/light_3d.h" -#include "scene/3d/lightmap_gi.h" -#include "scene/3d/lightmap_probe.h" -#include "scene/3d/look_at_modifier_3d.h" -#include "scene/3d/marker_3d.h" -#include "scene/3d/mesh_instance_3d.h" -#include "scene/3d/multimesh_instance_3d.h" -#include "scene/3d/navigation_agent_3d.h" -#include "scene/3d/navigation_link_3d.h" -#include "scene/3d/navigation_obstacle_3d.h" -#include "scene/3d/navigation_region_3d.h" -#include "scene/3d/node_3d.h" -#include "scene/3d/occluder_instance_3d.h" -#include "scene/3d/path_3d.h" +#ifndef _PHYSICS_DISABLED #include "scene/3d/physical_bone_simulator_3d.h" #include "scene/3d/physics/animatable_body_3d.h" #include "scene/3d/physics/area_3d.h" @@ -288,6 +270,43 @@ #include "scene/3d/physics/spring_arm_3d.h" #include "scene/3d/physics/static_body_3d.h" #include "scene/3d/physics/vehicle_body_3d.h" +#include "scene/resources/3d/navigation/navigation_mesh.h" +#include "scene/resources/3d/physics/box_shape_3d.h" +#include "scene/resources/3d/physics/capsule_shape_3d.h" +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/convex_polygon_shape_3d.h" +#include "scene/resources/3d/physics/cylinder_shape_3d.h" +#include "scene/resources/3d/physics/physics_material.h" +#include "scene/resources/3d/physics/sphere_shape_3d.h" +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED +#include "scene/3d/navigation/navigation_agent_3d.h" +#include "scene/3d/navigation/navigation_link_3d.h" +#include "scene/3d/navigation/navigation_obstacle_3d.h" +#include "scene/3d/navigation/navigation_region_3d.h" +#include "scene/resources/3d/navigation/navigation_mesh_source_geometry_data_3d.h" +#endif // !_NAVIGATION_DISABLED +#include "scene/3d/audio_listener_3d.h" +#include "scene/3d/audio_stream_player_3d.h" +#include "scene/3d/bone_attachment_3d.h" +#include "scene/3d/camera_3d.h" +#include "scene/3d/cpu_particles_3d.h" +#include "scene/3d/decal.h" +#include "scene/3d/fog_volume.h" +#include "scene/3d/gpu_particles_3d.h" +#include "scene/3d/gpu_particles_collision_3d.h" +#include "scene/3d/importer_mesh_instance_3d.h" +#include "scene/3d/label_3d.h" +#include "scene/3d/light_3d.h" +#include "scene/3d/lightmap_gi.h" +#include "scene/3d/lightmap_probe.h" +#include "scene/3d/look_at_modifier_3d.h" +#include "scene/3d/marker_3d.h" +#include "scene/3d/mesh_instance_3d.h" +#include "scene/3d/multimesh_instance_3d.h" +#include "scene/3d/node_3d.h" +#include "scene/3d/occluder_instance_3d.h" +#include "scene/3d/path_3d.h" #include "scene/3d/reflection_probe.h" #include "scene/3d/remote_transform_3d.h" #include "scene/3d/retarget_modifier_3d.h" @@ -304,20 +323,13 @@ #include "scene/3d/xr_hand_modifier_3d.h" #include "scene/3d/xr_nodes.h" #include "scene/animation/root_motion_view.h" -#include "scene/resources/3d/box_shape_3d.h" -#include "scene/resources/3d/capsule_shape_3d.h" -#include "scene/resources/3d/concave_polygon_shape_3d.h" -#include "scene/resources/3d/convex_polygon_shape_3d.h" -#include "scene/resources/3d/cylinder_shape_3d.h" #include "scene/resources/3d/fog_material.h" #include "scene/resources/3d/height_map_shape_3d.h" #include "scene/resources/3d/importer_mesh.h" #include "scene/resources/3d/mesh_library.h" -#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "scene/resources/3d/primitive_meshes.h" #include "scene/resources/3d/separation_ray_shape_3d.h" #include "scene/resources/3d/sky_material.h" -#include "scene/resources/3d/sphere_shape_3d.h" #include "scene/resources/3d/world_3d.h" #include "scene/resources/3d/world_boundary_shape_3d.h" #endif // _3D_DISABLED @@ -505,9 +517,11 @@ void register_scene_types() { AcceptDialog::set_swap_cancel_ok(swap_cancel_ok); #endif +#ifndef PIXEL_ENGINE int root_dir = GLOBAL_GET("internationalization/rendering/root_node_layout_direction"); Control::set_root_layout_direction(root_dir); Window::set_root_layout_direction(root_dir); +#endif // PIXEL_ENGINE /* REGISTER ANIMATION */ GDREGISTER_CLASS(Tween); @@ -667,8 +681,8 @@ void register_scene_types() { /* REGISTER SHADER */ GDREGISTER_CLASS(Shader); +#ifndef _VISUAL_SHADER_DISABLED GDREGISTER_CLASS(VisualShader); - GDREGISTER_CLASS(ShaderInclude); GDREGISTER_ABSTRACT_CLASS(VisualShaderNode); GDREGISTER_CLASS(VisualShaderNodeCustom); GDREGISTER_CLASS(VisualShaderNodeInput); @@ -677,10 +691,10 @@ void register_scene_types() { GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeGroupBase); GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeConstant); GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeVectorBase); - GDREGISTER_CLASS(VisualShaderNodeFrame); #ifndef DISABLE_DEPRECATED GDREGISTER_CLASS(VisualShaderNodeComment); // Deprecated, just for compatibility. -#endif +#endif // !DISABLE_DEPRECATED + GDREGISTER_CLASS(VisualShaderNodeFrame); GDREGISTER_CLASS(VisualShaderNodeFloatConstant); GDREGISTER_CLASS(VisualShaderNodeIntConstant); GDREGISTER_CLASS(VisualShaderNodeUIntConstant); @@ -784,6 +798,8 @@ void register_scene_types() { GDREGISTER_CLASS(VisualShaderNodeParticleRandomness); GDREGISTER_CLASS(VisualShaderNodeParticleAccelerator); GDREGISTER_CLASS(VisualShaderNodeParticleEmit); +#endif // !_VISUAL_SHADER_DISABLED + GDREGISTER_CLASS(ShaderInclude); GDREGISTER_VIRTUAL_CLASS(Material); GDREGISTER_CLASS(PlaceholderMaterial); @@ -807,6 +823,7 @@ void register_scene_types() { GDREGISTER_CLASS(Line2D); GDREGISTER_CLASS(MeshInstance2D); GDREGISTER_CLASS(MultiMeshInstance2D); +#ifndef _PHYSICS_DISABLED GDREGISTER_ABSTRACT_CLASS(CollisionObject2D); GDREGISTER_ABSTRACT_CLASS(PhysicsBody2D); GDREGISTER_CLASS(StaticBody2D); @@ -819,6 +836,7 @@ void register_scene_types() { GDREGISTER_CLASS(CollisionPolygon2D); GDREGISTER_CLASS(RayCast2D); GDREGISTER_CLASS(ShapeCast2D); +#endif // !_PHYSICS_DISABLED GDREGISTER_CLASS(VisibleOnScreenNotifier2D); GDREGISTER_CLASS(VisibleOnScreenEnabler2D); GDREGISTER_CLASS(Polygon2D); @@ -835,10 +853,13 @@ void register_scene_types() { GDREGISTER_CLASS(Camera2D); GDREGISTER_CLASS(AudioListener2D); +#ifndef _PHYSICS_DISABLED GDREGISTER_ABSTRACT_CLASS(Joint2D); GDREGISTER_CLASS(PinJoint2D); GDREGISTER_CLASS(GrooveJoint2D); GDREGISTER_CLASS(DampedSpringJoint2D); + GDREGISTER_CLASS(TouchScreenButton); +#endif // !_PHYSICS_DISABLED GDREGISTER_CLASS(TileSet); GDREGISTER_ABSTRACT_CLASS(TileSetSource); GDREGISTER_CLASS(TileSetAtlasSource); @@ -850,7 +871,6 @@ void register_scene_types() { GDREGISTER_CLASS(Parallax2D); GDREGISTER_CLASS(ParallaxBackground); GDREGISTER_CLASS(ParallaxLayer); - GDREGISTER_CLASS(TouchScreenButton); GDREGISTER_CLASS(RemoteTransform2D); GDREGISTER_CLASS(SkeletonModificationStack2D); @@ -858,12 +878,14 @@ void register_scene_types() { GDREGISTER_CLASS(SkeletonModification2DLookAt); GDREGISTER_CLASS(SkeletonModification2DCCDIK); GDREGISTER_CLASS(SkeletonModification2DFABRIK); - GDREGISTER_CLASS(SkeletonModification2DJiggle); GDREGISTER_CLASS(SkeletonModification2DTwoBoneIK); GDREGISTER_CLASS(SkeletonModification2DStackHolder); +#ifndef _PHYSICS_DISABLED GDREGISTER_CLASS(PhysicalBone2D); GDREGISTER_CLASS(SkeletonModification2DPhysicalBones); + GDREGISTER_CLASS(SkeletonModification2DJiggle); +#endif // !_PHYSICS_DISABLED OS::get_singleton()->yield(); // may take time to init @@ -908,7 +930,9 @@ void register_scene_types() { BaseMaterial3D::init_shaders(); GDREGISTER_CLASS(MeshLibrary); +#ifndef _NAVIGATION_DISABLED GDREGISTER_CLASS(NavigationMeshSourceGeometryData3D); +#endif // !_NAVIGATION_DISABLED OS::get_singleton()->yield(); // may take time to init @@ -927,7 +951,9 @@ void register_scene_types() { OS::get_singleton()->yield(); // may take time to init #endif // _3D_DISABLED +#ifndef _PHYSICS_DISABLED GDREGISTER_CLASS(PhysicsMaterial); +#endif // !_PHYSICS_DISABLED GDREGISTER_CLASS(Compositor); GDREGISTER_CLASS(Environment); GDREGISTER_VIRTUAL_CLASS(CameraAttributes); @@ -1015,6 +1041,7 @@ void register_scene_types() { OS::get_singleton()->yield(); // may take time to init +#ifndef _PHYSICS_DISABLED GDREGISTER_CLASS(AudioStreamPlayer2D); GDREGISTER_ABSTRACT_CLASS(Shape2D); GDREGISTER_CLASS(WorldBoundaryShape2D); @@ -1025,11 +1052,13 @@ void register_scene_types() { GDREGISTER_CLASS(CapsuleShape2D); GDREGISTER_CLASS(ConvexPolygonShape2D); GDREGISTER_CLASS(ConcavePolygonShape2D); +#endif // !_PHYSICS_DISABLED GDREGISTER_CLASS(Curve2D); GDREGISTER_CLASS(Path2D); GDREGISTER_CLASS(PathFollow2D); GDREGISTER_CLASS(PolygonPathFinder); +#ifndef _NAVIGATION_DISABLED GDREGISTER_CLASS(NavigationMesh); GDREGISTER_CLASS(NavigationMeshSourceGeometryData2D); GDREGISTER_CLASS(NavigationPolygon); @@ -1037,6 +1066,7 @@ void register_scene_types() { GDREGISTER_CLASS(NavigationAgent2D); GDREGISTER_CLASS(NavigationObstacle2D); GDREGISTER_CLASS(NavigationLink2D); +#endif // !_NAVIGATION_DISABLED OS::get_singleton()->yield(); // may take time to init @@ -1235,19 +1265,29 @@ void register_scene_types() { for (int i = 0; i < 20; i++) { GLOBAL_DEF_BASIC(vformat("%s/layer_%d", PNAME("layer_names/2d_render"), i + 1), ""); +#ifndef PIXEL_ENGINE GLOBAL_DEF_BASIC(vformat("%s/layer_%d", PNAME("layer_names/3d_render"), i + 1), ""); +#endif // !PIXEL_ENGINE } +#if !defined(_PHYSICS_DISABLED) || !defined(_NAVIGATION_DISABLED) for (int i = 0; i < 32; i++) { +#ifndef _PHYSICS_DISABLED GLOBAL_DEF_BASIC(vformat("%s/layer_%d", PNAME("layer_names/2d_physics"), i + 1), ""); - GLOBAL_DEF_BASIC(vformat("%s/layer_%d", PNAME("layer_names/2d_navigation"), i + 1), ""); GLOBAL_DEF_BASIC(vformat("%s/layer_%d", PNAME("layer_names/3d_physics"), i + 1), ""); +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED + GLOBAL_DEF_BASIC(vformat("%s/layer_%d", PNAME("layer_names/2d_navigation"), i + 1), ""); GLOBAL_DEF_BASIC(vformat("%s/layer_%d", PNAME("layer_names/3d_navigation"), i + 1), ""); +#endif // !_NAVIGATION_DISABLED } +#endif // !defined(_PHYSICS_DISABLED) || !defined(_NAVIGATION_DISABLED) +#ifndef _NAVIGATION_DISABLED for (int i = 0; i < 32; i++) { GLOBAL_DEF_BASIC(vformat("%s/layer_%d", PNAME("layer_names/avoidance"), i + 1), ""); } +#endif // !_NAVIGATION_DISABLED if (RenderingServer::get_singleton()) { // RenderingServer needs to exist for this to succeed. diff --git a/scene/resources/2d/SCsub b/scene/resources/2d/SCsub index 408aa3cf7e60..45402f083b94 100644 --- a/scene/resources/2d/SCsub +++ b/scene/resources/2d/SCsub @@ -5,3 +5,8 @@ Import("env") env.add_source_files(env.scene_sources, "*.cpp") env.add_source_files(env.scene_sources, "skeleton/*.cpp") +if not env["disable_physics"]: + env.add_source_files(env.scene_sources, "skeleton/physics/*.cpp") + env.add_source_files(env.scene_sources, "physics/*.cpp") +if not env["disable_navigation"]: + env.add_source_files(env.scene_sources, "navigation/*.cpp") diff --git a/scene/resources/2d/navigation_mesh_source_geometry_data_2d.cpp b/scene/resources/2d/navigation/navigation_mesh_source_geometry_data_2d.cpp similarity index 100% rename from scene/resources/2d/navigation_mesh_source_geometry_data_2d.cpp rename to scene/resources/2d/navigation/navigation_mesh_source_geometry_data_2d.cpp diff --git a/scene/resources/2d/navigation_mesh_source_geometry_data_2d.h b/scene/resources/2d/navigation/navigation_mesh_source_geometry_data_2d.h similarity index 98% rename from scene/resources/2d/navigation_mesh_source_geometry_data_2d.h rename to scene/resources/2d/navigation/navigation_mesh_source_geometry_data_2d.h index 2812925770f6..b0ffd5db5282 100644 --- a/scene/resources/2d/navigation_mesh_source_geometry_data_2d.h +++ b/scene/resources/2d/navigation/navigation_mesh_source_geometry_data_2d.h @@ -33,7 +33,7 @@ #include "core/os/rw_lock.h" #include "scene/2d/node_2d.h" -#include "scene/resources/2d/navigation_polygon.h" +#include "scene/resources/2d/navigation/navigation_polygon.h" class NavigationMeshSourceGeometryData2D : public Resource { friend class NavMeshGenerator2D; diff --git a/scene/resources/2d/navigation_polygon.cpp b/scene/resources/2d/navigation/navigation_polygon.cpp similarity index 100% rename from scene/resources/2d/navigation_polygon.cpp rename to scene/resources/2d/navigation/navigation_polygon.cpp diff --git a/scene/resources/2d/navigation_polygon.h b/scene/resources/2d/navigation/navigation_polygon.h similarity index 99% rename from scene/resources/2d/navigation_polygon.h rename to scene/resources/2d/navigation/navigation_polygon.h index 59e5eeed6847..820b2fd49721 100644 --- a/scene/resources/2d/navigation_polygon.h +++ b/scene/resources/2d/navigation/navigation_polygon.h @@ -32,7 +32,7 @@ #define NAVIGATION_POLYGON_H #include "scene/2d/node_2d.h" -#include "scene/resources/navigation_mesh.h" +#include "scene/resources/3d/navigation/navigation_mesh.h" #include "servers/navigation/navigation_globals.h" class NavigationPolygon : public Resource { diff --git a/scene/resources/2d/capsule_shape_2d.cpp b/scene/resources/2d/physics/capsule_shape_2d.cpp similarity index 100% rename from scene/resources/2d/capsule_shape_2d.cpp rename to scene/resources/2d/physics/capsule_shape_2d.cpp diff --git a/scene/resources/2d/capsule_shape_2d.h b/scene/resources/2d/physics/capsule_shape_2d.h similarity index 98% rename from scene/resources/2d/capsule_shape_2d.h rename to scene/resources/2d/physics/capsule_shape_2d.h index cfd3fc6b2677..2e153bb98e19 100644 --- a/scene/resources/2d/capsule_shape_2d.h +++ b/scene/resources/2d/physics/capsule_shape_2d.h @@ -31,7 +31,7 @@ #ifndef CAPSULE_SHAPE_2D_H #define CAPSULE_SHAPE_2D_H -#include "scene/resources/2d/shape_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" class CapsuleShape2D : public Shape2D { GDCLASS(CapsuleShape2D, Shape2D); diff --git a/scene/resources/2d/circle_shape_2d.cpp b/scene/resources/2d/physics/circle_shape_2d.cpp similarity index 100% rename from scene/resources/2d/circle_shape_2d.cpp rename to scene/resources/2d/physics/circle_shape_2d.cpp diff --git a/scene/resources/2d/circle_shape_2d.h b/scene/resources/2d/physics/circle_shape_2d.h similarity index 98% rename from scene/resources/2d/circle_shape_2d.h rename to scene/resources/2d/physics/circle_shape_2d.h index 203a8240ebba..8553a3d2407e 100644 --- a/scene/resources/2d/circle_shape_2d.h +++ b/scene/resources/2d/physics/circle_shape_2d.h @@ -31,7 +31,7 @@ #ifndef CIRCLE_SHAPE_2D_H #define CIRCLE_SHAPE_2D_H -#include "scene/resources/2d/shape_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" class CircleShape2D : public Shape2D { GDCLASS(CircleShape2D, Shape2D); diff --git a/scene/resources/2d/concave_polygon_shape_2d.cpp b/scene/resources/2d/physics/concave_polygon_shape_2d.cpp similarity index 100% rename from scene/resources/2d/concave_polygon_shape_2d.cpp rename to scene/resources/2d/physics/concave_polygon_shape_2d.cpp diff --git a/scene/resources/2d/concave_polygon_shape_2d.h b/scene/resources/2d/physics/concave_polygon_shape_2d.h similarity index 98% rename from scene/resources/2d/concave_polygon_shape_2d.h rename to scene/resources/2d/physics/concave_polygon_shape_2d.h index 8b0b77acaa2d..3b8935b591c2 100644 --- a/scene/resources/2d/concave_polygon_shape_2d.h +++ b/scene/resources/2d/physics/concave_polygon_shape_2d.h @@ -31,7 +31,7 @@ #ifndef CONCAVE_POLYGON_SHAPE_2D_H #define CONCAVE_POLYGON_SHAPE_2D_H -#include "scene/resources/2d/shape_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" class ConcavePolygonShape2D : public Shape2D { GDCLASS(ConcavePolygonShape2D, Shape2D); diff --git a/scene/resources/2d/convex_polygon_shape_2d.cpp b/scene/resources/2d/physics/convex_polygon_shape_2d.cpp similarity index 100% rename from scene/resources/2d/convex_polygon_shape_2d.cpp rename to scene/resources/2d/physics/convex_polygon_shape_2d.cpp diff --git a/scene/resources/2d/convex_polygon_shape_2d.h b/scene/resources/2d/physics/convex_polygon_shape_2d.h similarity index 98% rename from scene/resources/2d/convex_polygon_shape_2d.h rename to scene/resources/2d/physics/convex_polygon_shape_2d.h index 2e448f113356..874e0697579f 100644 --- a/scene/resources/2d/convex_polygon_shape_2d.h +++ b/scene/resources/2d/physics/convex_polygon_shape_2d.h @@ -31,7 +31,7 @@ #ifndef CONVEX_POLYGON_SHAPE_2D_H #define CONVEX_POLYGON_SHAPE_2D_H -#include "scene/resources/2d/shape_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" class ConvexPolygonShape2D : public Shape2D { GDCLASS(ConvexPolygonShape2D, Shape2D); diff --git a/scene/resources/2d/rectangle_shape_2d.cpp b/scene/resources/2d/physics/rectangle_shape_2d.cpp similarity index 100% rename from scene/resources/2d/rectangle_shape_2d.cpp rename to scene/resources/2d/physics/rectangle_shape_2d.cpp diff --git a/scene/resources/2d/rectangle_shape_2d.h b/scene/resources/2d/physics/rectangle_shape_2d.h similarity index 98% rename from scene/resources/2d/rectangle_shape_2d.h rename to scene/resources/2d/physics/rectangle_shape_2d.h index 80fbc51b5c65..646388cd0ced 100644 --- a/scene/resources/2d/rectangle_shape_2d.h +++ b/scene/resources/2d/physics/rectangle_shape_2d.h @@ -31,7 +31,7 @@ #ifndef RECTANGLE_SHAPE_2D_H #define RECTANGLE_SHAPE_2D_H -#include "scene/resources/2d/shape_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" class RectangleShape2D : public Shape2D { GDCLASS(RectangleShape2D, Shape2D); diff --git a/scene/resources/2d/segment_shape_2d.cpp b/scene/resources/2d/physics/segment_shape_2d.cpp similarity index 100% rename from scene/resources/2d/segment_shape_2d.cpp rename to scene/resources/2d/physics/segment_shape_2d.cpp diff --git a/scene/resources/2d/segment_shape_2d.h b/scene/resources/2d/physics/segment_shape_2d.h similarity index 98% rename from scene/resources/2d/segment_shape_2d.h rename to scene/resources/2d/physics/segment_shape_2d.h index ad2ece883d3e..15770e169739 100644 --- a/scene/resources/2d/segment_shape_2d.h +++ b/scene/resources/2d/physics/segment_shape_2d.h @@ -31,7 +31,7 @@ #ifndef SEGMENT_SHAPE_2D_H #define SEGMENT_SHAPE_2D_H -#include "scene/resources/2d/shape_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" class SegmentShape2D : public Shape2D { GDCLASS(SegmentShape2D, Shape2D); diff --git a/scene/resources/2d/separation_ray_shape_2d.cpp b/scene/resources/2d/physics/separation_ray_shape_2d.cpp similarity index 100% rename from scene/resources/2d/separation_ray_shape_2d.cpp rename to scene/resources/2d/physics/separation_ray_shape_2d.cpp diff --git a/scene/resources/2d/separation_ray_shape_2d.h b/scene/resources/2d/physics/separation_ray_shape_2d.h similarity index 98% rename from scene/resources/2d/separation_ray_shape_2d.h rename to scene/resources/2d/physics/separation_ray_shape_2d.h index 0359b41b6e91..eeb9eff83de0 100644 --- a/scene/resources/2d/separation_ray_shape_2d.h +++ b/scene/resources/2d/physics/separation_ray_shape_2d.h @@ -31,7 +31,7 @@ #ifndef SEPARATION_RAY_SHAPE_2D_H #define SEPARATION_RAY_SHAPE_2D_H -#include "scene/resources/2d/shape_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" class SeparationRayShape2D : public Shape2D { GDCLASS(SeparationRayShape2D, Shape2D); diff --git a/scene/resources/2d/shape_2d.cpp b/scene/resources/2d/physics/shape_2d.cpp similarity index 100% rename from scene/resources/2d/shape_2d.cpp rename to scene/resources/2d/physics/shape_2d.cpp diff --git a/scene/resources/2d/shape_2d.h b/scene/resources/2d/physics/shape_2d.h similarity index 100% rename from scene/resources/2d/shape_2d.h rename to scene/resources/2d/physics/shape_2d.h diff --git a/scene/resources/2d/world_boundary_shape_2d.cpp b/scene/resources/2d/physics/world_boundary_shape_2d.cpp similarity index 100% rename from scene/resources/2d/world_boundary_shape_2d.cpp rename to scene/resources/2d/physics/world_boundary_shape_2d.cpp diff --git a/scene/resources/2d/world_boundary_shape_2d.h b/scene/resources/2d/physics/world_boundary_shape_2d.h similarity index 98% rename from scene/resources/2d/world_boundary_shape_2d.h rename to scene/resources/2d/physics/world_boundary_shape_2d.h index a7f11e39b717..b6374264d8aa 100644 --- a/scene/resources/2d/world_boundary_shape_2d.h +++ b/scene/resources/2d/physics/world_boundary_shape_2d.h @@ -31,7 +31,7 @@ #ifndef WORLD_BOUNDARY_SHAPE_2D_H #define WORLD_BOUNDARY_SHAPE_2D_H -#include "scene/resources/2d/shape_2d.h" +#include "scene/resources/2d/physics/shape_2d.h" class WorldBoundaryShape2D : public Shape2D { GDCLASS(WorldBoundaryShape2D, Shape2D); diff --git a/scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.cpp b/scene/resources/2d/skeleton/physics/skeleton_modification_2d_jiggle.cpp similarity index 99% rename from scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.cpp rename to scene/resources/2d/skeleton/physics/skeleton_modification_2d_jiggle.cpp index b7200b49c4e8..1324b7461000 100644 --- a/scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.cpp +++ b/scene/resources/2d/skeleton/physics/skeleton_modification_2d_jiggle.cpp @@ -31,7 +31,7 @@ #include "skeleton_modification_2d_jiggle.h" #include "scene/2d/skeleton_2d.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" bool SkeletonModification2DJiggle::_set(const StringName &p_path, const Variant &p_value) { String path = p_path; diff --git a/scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.h b/scene/resources/2d/skeleton/physics/skeleton_modification_2d_jiggle.h similarity index 100% rename from scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.h rename to scene/resources/2d/skeleton/physics/skeleton_modification_2d_jiggle.h diff --git a/scene/resources/2d/skeleton/skeleton_modification_2d_physicalbones.cpp b/scene/resources/2d/skeleton/physics/skeleton_modification_2d_physicalbones.cpp similarity index 100% rename from scene/resources/2d/skeleton/skeleton_modification_2d_physicalbones.cpp rename to scene/resources/2d/skeleton/physics/skeleton_modification_2d_physicalbones.cpp diff --git a/scene/resources/2d/skeleton/skeleton_modification_2d_physicalbones.h b/scene/resources/2d/skeleton/physics/skeleton_modification_2d_physicalbones.h similarity index 100% rename from scene/resources/2d/skeleton/skeleton_modification_2d_physicalbones.h rename to scene/resources/2d/skeleton/physics/skeleton_modification_2d_physicalbones.h diff --git a/scene/resources/2d/tile_set.cpp b/scene/resources/2d/tile_set.cpp index 5ecfc32622f7..43a3e464d859 100644 --- a/scene/resources/2d/tile_set.cpp +++ b/scene/resources/2d/tile_set.cpp @@ -37,7 +37,9 @@ #include "core/templates/rb_set.h" #include "scene/gui/control.h" #include "scene/resources/image_texture.h" +#ifndef _NAVIGATION_DISABLED #include "servers/navigation_server_2d.h" +#endif // !_NAVIGATION_DISABLED /////////////////////////////// TileMapPattern ////////////////////////////////////// @@ -635,7 +637,7 @@ bool TileSet::get_occlusion_layer_sdf_collision(int p_layer_index) const { ERR_FAIL_INDEX_V(p_layer_index, occlusion_layers.size(), false); return occlusion_layers[p_layer_index].sdf_collision; } - +#ifndef _PHYSICS_DISABLED int TileSet::get_physics_layers_count() const { return physics_layers.size(); } @@ -719,7 +721,7 @@ Ref TileSet::get_physics_layer_physics_material(int p_layer_ind ERR_FAIL_INDEX_V(p_layer_index, physics_layers.size(), Ref()); return physics_layers[p_layer_index].physics_material; } - +#endif // !_PHYSICS // Terrains int TileSet::get_terrain_sets_count() const { return terrain_sets.size(); @@ -964,6 +966,8 @@ bool TileSet::is_valid_terrain_peering_bit(int p_terrain_set, TileSet::CellNeigh return is_valid_terrain_peering_bit_for_mode(terrain_mode, p_peering_bit); } +#ifndef _NAVIGATION_DISABLED + // Navigation int TileSet::get_navigation_layers_count() const { return navigation_layers.size(); @@ -1038,6 +1042,7 @@ bool TileSet::get_navigation_layer_layer_value(int p_layer_index, int p_layer_nu return get_navigation_layer_layers(p_layer_index) & (1 << (p_layer_number - 1)); } +#endif // !_NAVIGATION_DISABLED // Custom data. int TileSet::get_custom_data_layers_count() const { @@ -3234,9 +3239,10 @@ void TileSet::reset_state() { tile_filled_mesh.instantiate(); tile_meshes_dirty = true; +#ifndef _PHYSICS_DISABLED // Physics physics_layers.clear(); - +#endif // Terrains terrain_sets.clear(); terrain_meshes.clear(); @@ -3244,8 +3250,10 @@ void TileSet::reset_state() { per_terrain_pattern_tiles.clear(); terrains_cache_dirty = true; +#ifndef _NAVIGATION_DISABLED // Navigation navigation_layers.clear(); +#endif // !_NAVIGATION_DISABLED custom_data_layers.clear(); custom_data_layers_by_name.clear(); @@ -3458,6 +3466,7 @@ void TileSet::_compatibility_conversion() { tile_data->add_occluder_polygon(0); tile_data->set_occluder_polygon(0, 0, occluder); } +#ifndef _NAVIGATION_DISABLED if (ctd->navigation.is_valid()) { if (get_navigation_layers_count() < 1) { add_navigation_layer(); @@ -3470,9 +3479,10 @@ void TileSet::_compatibility_conversion() { navigation->set_vertices(vertices); tile_data->set_navigation_polygon(0, navigation); } +#endif // !_NAVIGATION_DISABLED tile_data->set_z_index(ctd->z_index); - +#ifndef _PHYSICS_DISABLED // Add the shapes. if (ctd->shapes.size() > 0) { if (get_physics_layers_count() < 1) { @@ -3496,6 +3506,7 @@ void TileSet::_compatibility_conversion() { } } } +#endif // !_PHYSICS_DISABLED } // Update the size count. if (!compatibility_size_count.has(ctd->region.get_size())) { @@ -3573,6 +3584,7 @@ void TileSet::_compatibility_conversion() { tile_data->add_occluder_polygon(0); tile_data->set_occluder_polygon(0, 0, occluder); } +#ifndef _NAVIGATION_DISABLED if (ctd->autotile_navpoly_map.has(coords)) { if (get_navigation_layers_count() < 1) { add_navigation_layer(); @@ -3585,13 +3597,14 @@ void TileSet::_compatibility_conversion() { navigation->set_vertices(vertices); tile_data->set_navigation_polygon(0, navigation); } +#endif // !_NAVIGATION_DISABLED if (ctd->autotile_priority_map.has(coords)) { tile_data->set_probability(ctd->autotile_priority_map[coords]); } if (ctd->autotile_z_index_map.has(coords)) { tile_data->set_z_index(ctd->autotile_z_index_map[coords]); } - +#ifndef _PHYSICS_DISABLED // Add the shapes. if (ctd->shapes.size() > 0) { if (get_physics_layers_count() < 1) { @@ -3615,7 +3628,7 @@ void TileSet::_compatibility_conversion() { } } } - +#endif // !_PHYSICS_DISABLED // -- TODO: handle -- // Those are offset for the whole atlas, they are likely useless for the atlases, but might make sense for single tiles. // texture offset @@ -3844,6 +3857,7 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { } } else if (what == "occluder") { ctd->occluder = p_value; +#ifndef _NAVIGATION_DISABLED } else if (what == "navigation") { ctd->navigation = p_value; @@ -3861,7 +3875,7 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { } else if (what == "navigation_offset") { } */ - +#endif // !_NAVIGATION_DISABLED } else if (what == "z_index") { ctd->z_index = p_value; @@ -3893,6 +3907,7 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { set_occlusion_layer_sdf_collision(index, p_value); return true; } +#ifndef _PHYSICS_DISABLED } else if (components.size() == 2 && components[0].begins_with("physics_layer_") && components[0].trim_prefix("physics_layer_").is_valid_int()) { // Physics layers. int index = components[0].trim_prefix("physics_layer_").to_int(); @@ -3926,6 +3941,7 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { set_physics_layer_physics_material(index, physics_material); return true; } +#endif // !_PHYSICS_DISABLED } else if (components.size() >= 2 && components[0].begins_with("terrain_set_") && components[0].trim_prefix("terrain_set_").is_valid_int()) { // Terrains. int terrain_set_index = components[0].trim_prefix("terrain_set_").to_int(); @@ -3961,6 +3977,7 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { return true; } } +#ifndef _NAVIGATION_DISABLED } else if (components.size() == 2 && components[0].begins_with("navigation_layer_") && components[0].trim_prefix("navigation_layer_").is_valid_int()) { // Navigation layers. int index = components[0].trim_prefix("navigation_layer_").to_int(); @@ -3973,6 +3990,7 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { set_navigation_layer_layers(index, p_value); return true; } +#endif // !_NAVIGATION_DISABLED } else if (components.size() == 2 && components[0].begins_with("custom_data_layer_") && components[0].trim_prefix("custom_data_layer_").is_valid_int()) { // Custom data layers. int index = components[0].trim_prefix("custom_data_layer_").to_int(); @@ -4057,6 +4075,7 @@ bool TileSet::_get(const StringName &p_name, Variant &r_ret) const { r_ret = get_occlusion_layer_sdf_collision(index); return true; } +#ifndef _PHYSICS_DISABLED } else if (components.size() == 2 && components[0].begins_with("physics_layer_") && components[0].trim_prefix("physics_layer_").is_valid_int()) { // Physics layers. int index = components[0].trim_prefix("physics_layer_").to_int(); @@ -4076,6 +4095,7 @@ bool TileSet::_get(const StringName &p_name, Variant &r_ret) const { r_ret = get_physics_layer_physics_material(index); return true; } +#endif // !_PHYSICS_DISABLED } else if (components.size() >= 2 && components[0].begins_with("terrain_set_") && components[0].trim_prefix("terrain_set_").is_valid_int()) { // Terrains. int terrain_set_index = components[0].trim_prefix("terrain_set_").to_int(); @@ -4098,6 +4118,7 @@ bool TileSet::_get(const StringName &p_name, Variant &r_ret) const { return true; } } +#ifndef _NAVIGATION_DISABLED } else if (components.size() == 2 && components[0].begins_with("navigation_layer_") && components[0].trim_prefix("navigation_layer_").is_valid_int()) { // navigation layers. int index = components[0].trim_prefix("navigation_layer_").to_int(); @@ -4108,6 +4129,7 @@ bool TileSet::_get(const StringName &p_name, Variant &r_ret) const { r_ret = get_navigation_layer_layers(index); return true; } +#endif // !_NAVIGATION_DISABLED } else if (components.size() == 2 && components[0].begins_with("custom_data_layer_") && components[0].trim_prefix("custom_data_layer_").is_valid_int()) { // Custom data layers. int index = components[0].trim_prefix("custom_data_layer_").to_int(); @@ -4185,6 +4207,7 @@ void TileSet::_get_property_list(List *p_list) const { p_list->push_back(property_info); } +#ifndef _PHYSICS_DISABLED // Physics. p_list->push_back(PropertyInfo(Variant::NIL, GNAME("Physics", ""), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP)); for (int i = 0; i < physics_layers.size(); i++) { @@ -4211,6 +4234,7 @@ void TileSet::_get_property_list(List *p_list) const { } p_list->push_back(property_info); } +#endif // !_PHYSICS_DISABLED // Terrains. p_list->push_back(PropertyInfo(Variant::NIL, GNAME("Terrains", ""), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP)); @@ -4223,11 +4247,13 @@ void TileSet::_get_property_list(List *p_list) const { } } +#ifndef _NAVIGATION_DISABLED // Navigation. p_list->push_back(PropertyInfo(Variant::NIL, GNAME("Navigation", ""), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP)); for (int i = 0; i < navigation_layers.size(); i++) { p_list->push_back(PropertyInfo(Variant::INT, vformat("navigation_layer_%d/layers", i), PROPERTY_HINT_LAYERS_2D_NAVIGATION)); } +#endif // !_NAVIGATION_DISABLED // Custom data. String argt = "Any"; @@ -4305,7 +4331,7 @@ void TileSet::_bind_methods() { ClassDB::bind_method(D_METHOD("get_occlusion_layer_light_mask", "layer_index"), &TileSet::get_occlusion_layer_light_mask); ClassDB::bind_method(D_METHOD("set_occlusion_layer_sdf_collision", "layer_index", "sdf_collision"), &TileSet::set_occlusion_layer_sdf_collision); ClassDB::bind_method(D_METHOD("get_occlusion_layer_sdf_collision", "layer_index"), &TileSet::get_occlusion_layer_sdf_collision); - +#ifndef _PHYSICS_DISABLED // Physics ClassDB::bind_method(D_METHOD("get_physics_layers_count"), &TileSet::get_physics_layers_count); ClassDB::bind_method(D_METHOD("add_physics_layer", "to_position"), &TileSet::add_physics_layer, DEFVAL(-1)); @@ -4319,7 +4345,7 @@ void TileSet::_bind_methods() { ClassDB::bind_method(D_METHOD("get_physics_layer_collision_priority", "layer_index"), &TileSet::get_physics_layer_collision_priority); ClassDB::bind_method(D_METHOD("set_physics_layer_physics_material", "layer_index", "physics_material"), &TileSet::set_physics_layer_physics_material); ClassDB::bind_method(D_METHOD("get_physics_layer_physics_material", "layer_index"), &TileSet::get_physics_layer_physics_material); - +#endif // !_PHYSICS_DISABLED // Terrains ClassDB::bind_method(D_METHOD("get_terrain_sets_count"), &TileSet::get_terrain_sets_count); ClassDB::bind_method(D_METHOD("add_terrain_set", "to_position"), &TileSet::add_terrain_set, DEFVAL(-1)); @@ -4337,6 +4363,7 @@ void TileSet::_bind_methods() { ClassDB::bind_method(D_METHOD("set_terrain_color", "terrain_set", "terrain_index", "color"), &TileSet::set_terrain_color); ClassDB::bind_method(D_METHOD("get_terrain_color", "terrain_set", "terrain_index"), &TileSet::get_terrain_color); +#ifndef _NAVIGATION_DISABLED // Navigation ClassDB::bind_method(D_METHOD("get_navigation_layers_count"), &TileSet::get_navigation_layers_count); ClassDB::bind_method(D_METHOD("add_navigation_layer", "to_position"), &TileSet::add_navigation_layer, DEFVAL(-1)); @@ -4346,6 +4373,7 @@ void TileSet::_bind_methods() { ClassDB::bind_method(D_METHOD("get_navigation_layer_layers", "layer_index"), &TileSet::get_navigation_layer_layers); ClassDB::bind_method(D_METHOD("set_navigation_layer_layer_value", "layer_index", "layer_number", "value"), &TileSet::set_navigation_layer_layer_value); ClassDB::bind_method(D_METHOD("get_navigation_layer_layer_value", "layer_index", "layer_number"), &TileSet::get_navigation_layer_layer_value); +#endif // !_NAVIGATION_DISABLED // Custom data ClassDB::bind_method(D_METHOD("get_custom_data_layers_count"), &TileSet::get_custom_data_layers_count); @@ -4390,9 +4418,13 @@ void TileSet::_bind_methods() { ADD_ARRAY("occlusion_layers", "occlusion_layer_"); ADD_GROUP("", ""); +#ifndef _PHYSICS_DISABLED ADD_ARRAY("physics_layers", "physics_layer_"); +#endif // !_PHYSICS_DISABLED ADD_ARRAY("terrain_sets", "terrain_set_"); +#ifndef _NAVIGATION_DISABLED ADD_ARRAY("navigation_layers", "navigation_layer_"); +#endif // !_NAVIGATION_DISABLED ADD_ARRAY("custom_data_layers", "custom_data_layer_"); // -- Enum binding -- @@ -4525,7 +4557,7 @@ void TileSetAtlasSource::remove_occlusion_layer(int p_index) { } } } - +#ifndef _PHYSICS_DISABLED void TileSetAtlasSource::add_physics_layer(int p_to_pos) { for (KeyValue E_tile : tiles) { for (KeyValue E_alternative : E_tile.value.alternatives) { @@ -4549,6 +4581,7 @@ void TileSetAtlasSource::remove_physics_layer(int p_index) { } } } +#endif // !_PHYSICS_DISABLED void TileSetAtlasSource::add_terrain_set(int p_to_pos) { for (KeyValue E_tile : tiles) { @@ -4598,6 +4631,7 @@ void TileSetAtlasSource::remove_terrain(int p_terrain_set, int p_index) { } } +#ifndef _NAVIGATION_DISABLED void TileSetAtlasSource::add_navigation_layer(int p_to_pos) { for (KeyValue E_tile : tiles) { for (KeyValue E_alternative : E_tile.value.alternatives) { @@ -4621,6 +4655,7 @@ void TileSetAtlasSource::remove_navigation_layer(int p_index) { } } } +#endif // !_NAVIGATION_DISABLED void TileSetAtlasSource::add_custom_data_layer(int p_to_pos) { for (KeyValue E_tile : tiles) { @@ -5964,13 +5999,18 @@ void TileData::notify_tile_data_properties_should_change() { } occluders.resize(tile_set->get_occlusion_layers_count()); +#ifndef _PHYSICS_DISABLED physics.resize(tile_set->get_physics_layers_count()); +#endif // !_PHYSICS_DISABLED + for (int bit_index = 0; bit_index < 16; bit_index++) { if (terrain_set < 0 || terrain_peering_bits[bit_index] >= tile_set->get_terrains_count(terrain_set)) { terrain_peering_bits[bit_index] = -1; } } +#ifndef _NAVIGATION_DISABLED navigation.resize(tile_set->get_navigation_layers_count()); +#endif // !_NAVIGATION_DISABLED // Convert custom data to the new type. custom_data.resize(tile_set->get_custom_data_layers_count()); @@ -6011,7 +6051,7 @@ void TileData::remove_occlusion_layer(int p_index) { ERR_FAIL_INDEX(p_index, occluders.size()); occluders.remove_at(p_index); } - +#ifndef _PHYSICS_DISABLED void TileData::add_physics_layer(int p_to_pos) { if (p_to_pos < 0) { p_to_pos = physics.size(); @@ -6031,7 +6071,7 @@ void TileData::remove_physics_layer(int p_index) { ERR_FAIL_INDEX(p_index, physics.size()); physics.remove_at(p_index); } - +#endif // !_PHYSICS_DISABLED void TileData::add_terrain_set(int p_to_pos) { if (p_to_pos >= 0 && p_to_pos <= terrain_set) { terrain_set += 1; @@ -6107,6 +6147,7 @@ void TileData::remove_terrain(int p_terrain_set, int p_index) { } } +#ifndef _NAVIGATION_DISABLED void TileData::add_navigation_layer(int p_to_pos) { if (p_to_pos < 0) { p_to_pos = navigation.size(); @@ -6126,6 +6167,7 @@ void TileData::remove_navigation_layer(int p_index) { ERR_FAIL_INDEX(p_index, navigation.size()); navigation.remove_at(p_index); } +#endif // !_NAVIGATION_DISABLEDh void TileData::add_custom_data_layer(int p_to_pos) { if (p_to_pos < 0) { @@ -6171,13 +6213,17 @@ TileData *TileData::duplicate() { output->z_index = z_index; output->y_sort_origin = y_sort_origin; output->occluders = occluders; +#ifndef _PHYSICS_DISABLED // Physics output->physics = physics; +#endif // !_PHYSICS_DISABLED // Terrain output->terrain_set = -1; memcpy(output->terrain_peering_bits, terrain_peering_bits, 16 * sizeof(int)); +#ifndef _NAVIGATION_DISABLED // Navigation output->navigation = navigation; +#endif // !_NAVIGATION_DISABLED // Misc output->probability = probability; // Custom data @@ -6341,7 +6387,7 @@ Ref TileData::get_occluder_polygon(int p_layer_id, int p_poly return I->value; } } - +#ifndef _PHYSICS_DISABLED // Physics void TileData::set_constant_linear_velocity(int p_layer_id, const Vector2 &p_velocity) { ERR_FAIL_INDEX(p_layer_id, physics.size()); @@ -6490,7 +6536,7 @@ Ref TileData::get_collision_polygon_shape(int p_layer_id, return I->value[shape_index]; } } - +#endif // !_PHYSICS_DISABLED // Terrain void TileData::set_terrain_set(int p_terrain_set) { ERR_FAIL_COND(p_terrain_set < -1); @@ -6563,6 +6609,7 @@ TileSet::TerrainsPattern TileData::get_terrains_pattern() const { return output; } +#ifndef _NAVIGATION_DISABLED // Navigation void TileData::set_navigation_polygon(int p_layer_id, Ref p_navigation_polygon) { ERR_FAIL_INDEX(p_layer_id, navigation.size()); @@ -6610,6 +6657,7 @@ Ref TileData::get_navigation_polygon(int p_layer_id, bool p_f return I->value; } } +#endif // !_NAVIGATION_DISABLED // Misc void TileData::set_probability(float p_probability) { @@ -6733,6 +6781,7 @@ bool TileData::_set(const StringName &p_name, const Variant &p_value) { return true; } } +#ifndef _PHYSICS_DISABLED } else if (components.size() >= 2 && components[0].begins_with("physics_layer_") && components[0].trim_prefix("physics_layer_").is_valid_int()) { // Physics layers. int layer_index = components[0].trim_prefix("physics_layer_").to_int(); @@ -6788,6 +6837,8 @@ bool TileData::_set(const StringName &p_name, const Variant &p_value) { return true; } } +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED } else if (components.size() == 2 && components[0].begins_with("navigation_layer_") && components[0].trim_prefix("navigation_layer_").is_valid_int()) { // Navigation layers. int layer_index = components[0].trim_prefix("navigation_layer_").to_int(); @@ -6805,6 +6856,7 @@ bool TileData::_set(const StringName &p_name, const Variant &p_value) { set_navigation_polygon(layer_index, polygon); return true; } +#endif // !_NAVIGATION_DISABLED } else if (components.size() == 2 && components[0] == "terrains_peering_bit") { // Terrains. for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { @@ -6877,6 +6929,7 @@ bool TileData::_get(const StringName &p_name, Variant &r_ret) const { return true; } } +#ifndef _PHYSICS_DISABLED } else if (components.size() >= 2 && components[0].begins_with("physics_layer_") && components[0].trim_prefix("physics_layer_").is_valid_int()) { // Physics layers. int layer_index = components[0].trim_prefix("physics_layer_").to_int(); @@ -6913,6 +6966,7 @@ bool TileData::_get(const StringName &p_name, Variant &r_ret) const { return true; } } +#endif // !_PHYSICS_DISABLED } else if (components.size() == 2 && components[0] == "terrains_peering_bit") { // Terrains. for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { @@ -6922,6 +6976,7 @@ bool TileData::_get(const StringName &p_name, Variant &r_ret) const { } } return false; +#ifndef _NAVIGATION_DISABLED } else if (components.size() == 2 && components[0].begins_with("navigation_layer_") && components[0].trim_prefix("navigation_layer_").is_valid_int()) { // Occlusion layers. int layer_index = components[0].trim_prefix("navigation_layer_").to_int(); @@ -6933,6 +6988,7 @@ bool TileData::_get(const StringName &p_name, Variant &r_ret) const { r_ret = get_navigation_polygon(layer_index); return true; } +#endif // !_NAVIGATION_DISABLED } else if (components.size() == 1 && components[0].begins_with("custom_data_") && components[0].trim_prefix("custom_data_").is_valid_int()) { // Custom data layers. int layer_index = components[0].trim_prefix("custom_data_").to_int(); @@ -6965,7 +7021,7 @@ void TileData::_get_property_list(List *p_list) const { p_list->push_back(property_info); } } - +#ifndef _PHYSICS_DISABLED // Physics layers. p_list->push_back(PropertyInfo(Variant::NIL, GNAME("Physics", ""), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP)); for (int i = 0; i < physics.size(); i++) { @@ -7008,7 +7064,7 @@ void TileData::_get_property_list(List *p_list) const { p_list->push_back(property_info); } } - +#endif // !_PHYSICS_DISABLED // Terrain data if (terrain_set >= 0) { p_list->push_back(PropertyInfo(Variant::NIL, GNAME("Terrains", ""), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP)); @@ -7024,6 +7080,7 @@ void TileData::_get_property_list(List *p_list) const { } } +#ifndef _NAVIGATION_DISABLED // Navigation layers. p_list->push_back(PropertyInfo(Variant::NIL, GNAME("Navigation", ""), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP)); for (int i = 0; i < navigation.size(); i++) { @@ -7033,6 +7090,7 @@ void TileData::_get_property_list(List *p_list) const { } p_list->push_back(property_info); } +#endif // !_NAVIGATION_DISABLED // Custom data layers. p_list->push_back(PropertyInfo(Variant::NIL, GNAME("Custom Data", "custom_data_"), PROPERTY_HINT_NONE, "custom_data_", PROPERTY_USAGE_GROUP)); @@ -7079,7 +7137,7 @@ void TileData::_bind_methods() { ClassDB::bind_method(D_METHOD("set_occluder", "layer_id", "occluder_polygon"), &TileData::set_occluder); ClassDB::bind_method(D_METHOD("get_occluder", "layer_id", "flip_h", "flip_v", "transpose"), &TileData::get_occluder, DEFVAL(false), DEFVAL(false), DEFVAL(false)); #endif // DISABLE_DEPRECATED - +#ifndef _PHYSICS_DISABLED // Physics. ClassDB::bind_method(D_METHOD("set_constant_linear_velocity", "layer_id", "velocity"), &TileData::set_constant_linear_velocity); ClassDB::bind_method(D_METHOD("get_constant_linear_velocity", "layer_id"), &TileData::get_constant_linear_velocity); @@ -7095,7 +7153,7 @@ void TileData::_bind_methods() { ClassDB::bind_method(D_METHOD("is_collision_polygon_one_way", "layer_id", "polygon_index"), &TileData::is_collision_polygon_one_way); ClassDB::bind_method(D_METHOD("set_collision_polygon_one_way_margin", "layer_id", "polygon_index", "one_way_margin"), &TileData::set_collision_polygon_one_way_margin); ClassDB::bind_method(D_METHOD("get_collision_polygon_one_way_margin", "layer_id", "polygon_index"), &TileData::get_collision_polygon_one_way_margin); - +#endif // !_PHYSICS_DISABLED // Terrain ClassDB::bind_method(D_METHOD("set_terrain_set", "terrain_set"), &TileData::set_terrain_set); ClassDB::bind_method(D_METHOD("get_terrain_set"), &TileData::get_terrain_set); @@ -7105,10 +7163,11 @@ void TileData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_terrain_peering_bit", "peering_bit"), &TileData::get_terrain_peering_bit); ClassDB::bind_method(D_METHOD("is_valid_terrain_peering_bit", "peering_bit"), &TileData::is_valid_terrain_peering_bit); +#ifndef _NAVIGATION_DISABLED // Navigation ClassDB::bind_method(D_METHOD("set_navigation_polygon", "layer_id", "navigation_polygon"), &TileData::set_navigation_polygon); ClassDB::bind_method(D_METHOD("get_navigation_polygon", "layer_id", "flip_h", "flip_v", "transpose"), &TileData::get_navigation_polygon, DEFVAL(false), DEFVAL(false), DEFVAL(false)); - +#endif // !_NAVIGATION_DISABLED // Misc. ClassDB::bind_method(D_METHOD("set_probability", "probability"), &TileData::set_probability); ClassDB::bind_method(D_METHOD("get_probability"), &TileData::get_probability); diff --git a/scene/resources/2d/tile_set.h b/scene/resources/2d/tile_set.h index 6d3ccd1d2d5e..4203710820b8 100644 --- a/scene/resources/2d/tile_set.h +++ b/scene/resources/2d/tile_set.h @@ -37,15 +37,18 @@ #include "core/templates/rb_set.h" #include "scene/2d/light_occluder_2d.h" #include "scene/main/canvas_item.h" -#include "scene/resources/2d/convex_polygon_shape_2d.h" -#include "scene/resources/2d/navigation_polygon.h" #include "scene/resources/image_texture.h" #include "scene/resources/packed_scene.h" -#include "scene/resources/physics_material.h" - +#ifndef _NAVIGATION_DISABLED +#include "scene/resources/2d/navigation/navigation_polygon.h" +#endif // !_NAVIGATION_DISABLED +#ifndef _PHYSICS_DISABLED +#include "scene/resources/2d/physics/convex_polygon_shape_2d.h" +#include "scene/resources/3d/physics/physics_material.h" +#endif // !PHYSIC_DISABLED #ifndef DISABLE_DEPRECATED #include "scene/resources/shader.h" -#endif +#endif // !DISABLE_DEPRECATED class TileMap; class TileSetSource; @@ -55,8 +58,12 @@ class TileData; // Forward-declare the plugins. class TileSetPlugin; class TileSetPluginAtlasRendering; +#ifndef _PHYSICS_DISABLED class TileSetPluginAtlasPhysics; +#endif // !_PHYSICS_DISABLED +#ifndef _NAVIGATION_DISABLED class TileSetPluginAtlasNavigation; +#endif // !_NAVIGATION_DISABLED union TileMapCell { struct { @@ -322,7 +329,7 @@ class TileSet : public Resource { Ref tile_lines_mesh; Ref tile_filled_mesh; mutable bool tile_meshes_dirty = true; - +#ifndef _PHYSICS_DISABLED // Physics struct PhysicsLayer { uint32_t collision_layer = 1; @@ -331,7 +338,7 @@ class TileSet : public Resource { Ref physics_material; }; Vector physics_layers; - +#endif // !_PHYSICS_DISABLED // Terrains struct Terrain { String name; @@ -351,11 +358,13 @@ class TileSet : public Resource { bool terrains_cache_dirty = true; void _update_terrains_cache(); +#ifndef _NAVIGATION_DISABLED // Navigation struct NavigationLayer { uint32_t layers = 1; }; Vector navigation_layers; +#endif // !_NAVIGATION_DISABLED // CustomData struct CustomDataLayer { @@ -439,7 +448,7 @@ class TileSet : public Resource { int get_occlusion_layer_light_mask(int p_layer_index) const; void set_occlusion_layer_sdf_collision(int p_layer_index, bool p_sdf_collision); bool get_occlusion_layer_sdf_collision(int p_layer_index) const; - +#ifndef _PHYSICS_DISABLED // Physics int get_physics_layers_count() const; void add_physics_layer(int p_index = -1); @@ -453,7 +462,7 @@ class TileSet : public Resource { real_t get_physics_layer_collision_priority(int p_layer_index) const; void set_physics_layer_physics_material(int p_layer_index, Ref p_physics_material); Ref get_physics_layer_physics_material(int p_layer_index) const; - +#endif // !_PHYSICS_DISABLED // Terrain sets int get_terrain_sets_count() const; void add_terrain_set(int p_index = -1); @@ -474,6 +483,7 @@ class TileSet : public Resource { bool is_valid_terrain_peering_bit_for_mode(TileSet::TerrainMode p_terrain_mode, TileSet::CellNeighbor p_peering_bit) const; bool is_valid_terrain_peering_bit(int p_terrain_set, TileSet::CellNeighbor p_peering_bit) const; +#ifndef _NAVIGATION_DISABLED // Navigation int get_navigation_layers_count() const; void add_navigation_layer(int p_index = -1); @@ -483,6 +493,7 @@ class TileSet : public Resource { uint32_t get_navigation_layer_layers(int p_layer_index) const; void set_navigation_layer_layer_value(int p_layer_index, int p_layer_number, bool p_value); bool get_navigation_layer_layer_value(int p_layer_index, int p_layer_number) const; +#endif // !_NAVIGATION_DISABLED // Custom data int get_custom_data_layers_count() const; @@ -578,18 +589,22 @@ class TileSetSource : public Resource { virtual void add_occlusion_layer(int p_index) {} virtual void move_occlusion_layer(int p_from_index, int p_to_pos) {} virtual void remove_occlusion_layer(int p_index) {} +#ifndef _PHYSICS_DISABLED virtual void add_physics_layer(int p_index) {} virtual void move_physics_layer(int p_from_index, int p_to_pos) {} virtual void remove_physics_layer(int p_index) {} +#endif // !_PHYSICS_DISABLED virtual void add_terrain_set(int p_index) {} virtual void move_terrain_set(int p_from_index, int p_to_pos) {} virtual void remove_terrain_set(int p_index) {} virtual void add_terrain(int p_terrain_set, int p_index) {} virtual void move_terrain(int p_terrain_set, int p_from_index, int p_to_pos) {} virtual void remove_terrain(int p_terrain_set, int p_index) {} +#ifndef _NAVIGATION_DISABLED virtual void add_navigation_layer(int p_index) {} virtual void move_navigation_layer(int p_from_index, int p_to_pos) {} virtual void remove_navigation_layer(int p_index) {} +#endif // !_NAVIGATION_DISABLED virtual void add_custom_data_layer(int p_index) {} virtual void move_custom_data_layer(int p_from_index, int p_to_pos) {} virtual void remove_custom_data_layer(int p_index) {} @@ -685,18 +700,22 @@ class TileSetAtlasSource : public TileSetSource { virtual void add_occlusion_layer(int p_index) override; virtual void move_occlusion_layer(int p_from_index, int p_to_pos) override; virtual void remove_occlusion_layer(int p_index) override; +#ifndef _PHYSICS_DISABLED virtual void add_physics_layer(int p_index) override; virtual void move_physics_layer(int p_from_index, int p_to_pos) override; virtual void remove_physics_layer(int p_index) override; +#endif // !_PHYSICS_DISABLED virtual void add_terrain_set(int p_index) override; virtual void move_terrain_set(int p_from_index, int p_to_pos) override; virtual void remove_terrain_set(int p_index) override; virtual void add_terrain(int p_terrain_set, int p_index) override; virtual void move_terrain(int p_terrain_set, int p_from_index, int p_to_pos) override; virtual void remove_terrain(int p_terrain_set, int p_index) override; +#ifndef _NAVIGATION_DISABLED virtual void add_navigation_layer(int p_index) override; virtual void move_navigation_layer(int p_from_index, int p_to_pos) override; virtual void remove_navigation_layer(int p_index) override; +#endif // !_NAVIGATION_DISABLED virtual void add_custom_data_layer(int p_index) override; virtual void move_custom_data_layer(int p_from_index, int p_to_pos) override; virtual void remove_custom_data_layer(int p_index) override; @@ -851,7 +870,7 @@ class TileData : public Object { Vector polygons; }; Vector occluders; - +#ifndef _PHYSICS_DISABLED // Physics struct PhysicsLayerTileData { struct PolygonShapeTileData { @@ -868,18 +887,20 @@ class TileData : public Object { }; Vector physics; // TODO add support for areas. - +#endif // !_PHYSICS_DISABLED // Terrain int terrain_set = -1; int terrain = -1; int terrain_peering_bits[16] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; +#ifndef _NAVIGATION_DISABLED // Navigation struct NavigationLayerTileData { Ref navigation_polygon; mutable HashMap> transformed_navigation_polygon; }; Vector navigation; +#endif // !_NAVIGATION_DISABLED // Misc double probability = 1.0; @@ -907,18 +928,22 @@ class TileData : public Object { void add_occlusion_layer(int p_index); void move_occlusion_layer(int p_from_index, int p_to_pos); void remove_occlusion_layer(int p_index); +#ifndef _PHYSICS_DISABLED void add_physics_layer(int p_index); void move_physics_layer(int p_from_index, int p_to_pos); void remove_physics_layer(int p_index); +#endif // !_PHYSICS_DISABLED void add_terrain_set(int p_index); void move_terrain_set(int p_from_index, int p_to_pos); void remove_terrain_set(int p_index); void add_terrain(int p_terrain_set, int p_index); void move_terrain(int p_terrain_set, int p_from_index, int p_to_pos); void remove_terrain(int p_terrain_set, int p_index); +#ifndef _NAVIGATION_DISABLED void add_navigation_layer(int p_index); void move_navigation_layer(int p_from_index, int p_to_pos); void remove_navigation_layer(int p_index); +#endif // !_NAVIGATION_DISABLED void add_custom_data_layer(int p_index); void move_custom_data_layer(int p_from_index, int p_to_pos); void remove_custom_data_layer(int p_index); @@ -958,7 +983,7 @@ class TileData : public Object { void remove_occluder_polygon(int p_layer_id, int p_polygon_index); void set_occluder_polygon(int p_layer_id, int p_polygon_index, const Ref &p_occluder_polygon); Ref get_occluder_polygon(int p_layer_id, int p_polygon_index, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false) const; - +#ifndef _PHYSICS_DISABLED // Physics void set_constant_linear_velocity(int p_layer_id, const Vector2 &p_velocity); Vector2 get_constant_linear_velocity(int p_layer_id) const; @@ -976,7 +1001,7 @@ class TileData : public Object { float get_collision_polygon_one_way_margin(int p_layer_id, int p_polygon_index) const; int get_collision_polygon_shapes_count(int p_layer_id, int p_polygon_index) const; Ref get_collision_polygon_shape(int p_layer_id, int p_polygon_index, int shape_index, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false) const; - +#endif // !_PHYSICS_DISABLED // Terrain void set_terrain_set(int p_terrain_id); int get_terrain_set() const; @@ -988,9 +1013,11 @@ class TileData : public Object { TileSet::TerrainsPattern get_terrains_pattern() const; // Not exposed. +#ifndef _NAVIGATION_DISABLED // Navigation void set_navigation_polygon(int p_layer_id, Ref p_navigation_polygon); Ref get_navigation_polygon(int p_layer_id, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false) const; +#endif // !_NAVIGATION_DISABLED // Misc void set_probability(float p_probability); diff --git a/scene/resources/world_2d.cpp b/scene/resources/2d/world_2d.cpp similarity index 91% rename from scene/resources/world_2d.cpp rename to scene/resources/2d/world_2d.cpp index ec2c8ddb7b2c..7af16d212548 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/2d/world_2d.cpp @@ -34,8 +34,12 @@ #include "scene/2d/camera_2d.h" #include "scene/2d/visible_on_screen_notifier_2d.h" #include "scene/main/window.h" +#ifndef _NAVIGATION_DISABLED #include "servers/navigation_server_2d.h" +#endif // !_NAVIGATION_DISABLED +#ifndef _PHYSICS_DISABLED #include "servers/physics_server_2d.h" +#endif // !_PHYSICS_DISABLED #include "servers/rendering_server.h" RID World2D::get_canvas() const { @@ -43,6 +47,7 @@ RID World2D::get_canvas() const { } RID World2D::get_space() const { +#ifndef _PHYSICS_DISABLED if (space.is_null()) { space = PhysicsServer2D::get_singleton()->space_create(); PhysicsServer2D::get_singleton()->space_set_active(space, true); @@ -52,9 +57,13 @@ RID World2D::get_space() const { PhysicsServer2D::get_singleton()->area_set_param(space, PhysicsServer2D::AREA_PARAM_ANGULAR_DAMP, GLOBAL_GET("physics/2d/default_angular_damp")); } return space; +#else + return RID(); +#endif // !_PHYSICS_DISABLED } RID World2D::get_navigation_map() const { +#ifndef _NAVIGATION_DISABLED if (navigation_map.is_null()) { navigation_map = NavigationServer2D::get_singleton()->map_create(); NavigationServer2D::get_singleton()->map_set_active(navigation_map, true); @@ -64,23 +73,31 @@ RID World2D::get_navigation_map() const { NavigationServer2D::get_singleton()->map_set_link_connection_radius(navigation_map, GLOBAL_GET("navigation/2d/default_link_connection_radius")); } return navigation_map; +#else + return RID(); +#endif // !_NAVIGATION_DISABLED } +#ifndef _PHYSICS_DISABLED PhysicsDirectSpaceState2D *World2D::get_direct_space_state() { return PhysicsServer2D::get_singleton()->space_get_direct_state(get_space()); } +#endif // !_PHYSICS_DISABLED void World2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_canvas"), &World2D::get_canvas); ClassDB::bind_method(D_METHOD("get_space"), &World2D::get_space); ClassDB::bind_method(D_METHOD("get_navigation_map"), &World2D::get_navigation_map); +#ifndef _PHYSICS_DISABLED ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World2D::get_direct_space_state); - +#endif // !_PHYSICS_DISABLED ADD_PROPERTY(PropertyInfo(Variant::RID, "canvas", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_canvas"); ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_space"); ADD_PROPERTY(PropertyInfo(Variant::RID, "navigation_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_navigation_map"); +#ifndef _PHYSICS_DISABLED ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState2D", PROPERTY_USAGE_NONE), "", "get_direct_space_state"); +#endif // !_PHYSICS_DISABLED } void World2D::register_viewport(Viewport *p_viewport) { @@ -97,13 +114,17 @@ World2D::World2D() { World2D::~World2D() { ERR_FAIL_NULL(RenderingServer::get_singleton()); - ERR_FAIL_NULL(PhysicsServer2D::get_singleton()); - ERR_FAIL_NULL(NavigationServer2D::get_singleton()); RenderingServer::get_singleton()->free(canvas); - if (space.is_valid()) { - PhysicsServer2D::get_singleton()->free(space); - } +#ifndef _NAVIGATION_DISABLED + ERR_FAIL_NULL(NavigationServer2D::get_singleton()); if (navigation_map.is_valid()) { NavigationServer2D::get_singleton()->free(navigation_map); } +#endif // !_NAVIGATION_DISABLED +#ifndef _PHYSICS_DISABLED + ERR_FAIL_NULL(PhysicsServer2D::get_singleton()); + if (space.is_valid()) { + PhysicsServer2D::get_singleton()->free(space); + } +#endif // !_PHYSICS_DISABLED } diff --git a/scene/resources/world_2d.h b/scene/resources/2d/world_2d.h similarity index 98% rename from scene/resources/world_2d.h rename to scene/resources/2d/world_2d.h index 04a15b03816c..fe85fe65f58e 100644 --- a/scene/resources/world_2d.h +++ b/scene/resources/2d/world_2d.h @@ -32,7 +32,6 @@ #define WORLD_2D_H #include "core/io/resource.h" -#include "servers/physics_server_2d.h" class VisibleOnScreenNotifier2D; class Viewport; @@ -56,8 +55,9 @@ class World2D : public Resource { RID get_space() const; RID get_navigation_map() const; +#ifndef _PHYSICS_DISABLED PhysicsDirectSpaceState2D *get_direct_space_state(); - +#endif // !_PHYSICS_DISABLED void register_viewport(Viewport *p_viewport); void remove_viewport(Viewport *p_viewport); diff --git a/scene/resources/3d/SCsub b/scene/resources/3d/SCsub index 408aa3cf7e60..6a16c7c57ed3 100644 --- a/scene/resources/3d/SCsub +++ b/scene/resources/3d/SCsub @@ -5,3 +5,7 @@ Import("env") env.add_source_files(env.scene_sources, "*.cpp") env.add_source_files(env.scene_sources, "skeleton/*.cpp") +if not env["disable_physics"]: + env.add_source_files(env.scene_sources, "physics/*.cpp") +if not env["disable_navigation"]: + env.add_source_files(env.scene_sources, "navigation/*.cpp") \ No newline at end of file diff --git a/scene/resources/3d/importer_mesh.cpp b/scene/resources/3d/importer_mesh.cpp index f040f04cd813..2414f9b60cb6 100644 --- a/scene/resources/3d/importer_mesh.cpp +++ b/scene/resources/3d/importer_mesh.cpp @@ -787,6 +787,7 @@ Vector ImporterMesh::get_faces() const { return faces; } +#ifndef _PHYSICS_DISABLED Vector> ImporterMesh::convex_decompose(const Ref &p_settings) const { ERR_FAIL_NULL_V(Mesh::convex_decomposition_function, Vector>()); @@ -892,6 +893,7 @@ Ref ImporterMesh::create_trimesh_shape() const { shape->set_faces(face_points); return shape; } +#endif // !_PHYSICS_DISABLED Ref ImporterMesh::create_navigation_mesh() { Vector faces = get_faces(); diff --git a/scene/resources/3d/importer_mesh.h b/scene/resources/3d/importer_mesh.h index 2bdf759da616..bc3fb5ee717e 100644 --- a/scene/resources/3d/importer_mesh.h +++ b/scene/resources/3d/importer_mesh.h @@ -33,10 +33,12 @@ #include "core/io/resource.h" #include "core/templates/local_vector.h" -#include "scene/resources/3d/concave_polygon_shape_3d.h" -#include "scene/resources/3d/convex_polygon_shape_3d.h" +#ifndef _PHYSICS_DISABLED +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/convex_polygon_shape_3d.h" +#endif // !_PHYSICS_DISABLED #include "scene/resources/mesh.h" -#include "scene/resources/navigation_mesh.h" +#include "scene/resources/3d/navigation/navigation_mesh.h" #include @@ -121,9 +123,11 @@ class ImporterMesh : public Resource { Ref get_shadow_mesh() const; Vector get_faces() const; +#ifndef _PHYSICS_DISABLED Vector> convex_decompose(const Ref &p_settings) const; Ref create_convex_shape(bool p_clean = true, bool p_simplify = false) const; Ref create_trimesh_shape() const; +#endif // !_PHYSICS_DISABLED Ref create_navigation_mesh(); Error lightmap_unwrap_cached(const Transform3D &p_base_transform, float p_texel_size, const Vector &p_src_cache, Vector &r_dst_cache); diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/3d/navigation/navigation_mesh.cpp similarity index 100% rename from scene/resources/navigation_mesh.cpp rename to scene/resources/3d/navigation/navigation_mesh.cpp diff --git a/scene/resources/navigation_mesh.h b/scene/resources/3d/navigation/navigation_mesh.h similarity index 100% rename from scene/resources/navigation_mesh.h rename to scene/resources/3d/navigation/navigation_mesh.h diff --git a/scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp b/scene/resources/3d/navigation/navigation_mesh_source_geometry_data_3d.cpp similarity index 100% rename from scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp rename to scene/resources/3d/navigation/navigation_mesh_source_geometry_data_3d.cpp diff --git a/scene/resources/3d/navigation_mesh_source_geometry_data_3d.h b/scene/resources/3d/navigation/navigation_mesh_source_geometry_data_3d.h similarity index 100% rename from scene/resources/3d/navigation_mesh_source_geometry_data_3d.h rename to scene/resources/3d/navigation/navigation_mesh_source_geometry_data_3d.h diff --git a/scene/resources/3d/box_shape_3d.cpp b/scene/resources/3d/physics/box_shape_3d.cpp similarity index 100% rename from scene/resources/3d/box_shape_3d.cpp rename to scene/resources/3d/physics/box_shape_3d.cpp diff --git a/scene/resources/3d/box_shape_3d.h b/scene/resources/3d/physics/box_shape_3d.h similarity index 98% rename from scene/resources/3d/box_shape_3d.h rename to scene/resources/3d/physics/box_shape_3d.h index a9137fdcafa9..c4a8ef75eb60 100644 --- a/scene/resources/3d/box_shape_3d.h +++ b/scene/resources/3d/physics/box_shape_3d.h @@ -31,7 +31,7 @@ #ifndef BOX_SHAPE_3D_H #define BOX_SHAPE_3D_H -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class BoxShape3D : public Shape3D { GDCLASS(BoxShape3D, Shape3D); diff --git a/scene/resources/3d/capsule_shape_3d.cpp b/scene/resources/3d/physics/capsule_shape_3d.cpp similarity index 100% rename from scene/resources/3d/capsule_shape_3d.cpp rename to scene/resources/3d/physics/capsule_shape_3d.cpp diff --git a/scene/resources/3d/capsule_shape_3d.h b/scene/resources/3d/physics/capsule_shape_3d.h similarity index 98% rename from scene/resources/3d/capsule_shape_3d.h rename to scene/resources/3d/physics/capsule_shape_3d.h index 2ad7fa452ced..f69e6e99c7ed 100644 --- a/scene/resources/3d/capsule_shape_3d.h +++ b/scene/resources/3d/physics/capsule_shape_3d.h @@ -31,7 +31,7 @@ #ifndef CAPSULE_SHAPE_3D_H #define CAPSULE_SHAPE_3D_H -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class ArrayMesh; diff --git a/scene/resources/3d/concave_polygon_shape_3d.cpp b/scene/resources/3d/physics/concave_polygon_shape_3d.cpp similarity index 100% rename from scene/resources/3d/concave_polygon_shape_3d.cpp rename to scene/resources/3d/physics/concave_polygon_shape_3d.cpp diff --git a/scene/resources/3d/concave_polygon_shape_3d.h b/scene/resources/3d/physics/concave_polygon_shape_3d.h similarity index 98% rename from scene/resources/3d/concave_polygon_shape_3d.h rename to scene/resources/3d/physics/concave_polygon_shape_3d.h index d5e5bc394b28..d017cdd1b527 100644 --- a/scene/resources/3d/concave_polygon_shape_3d.h +++ b/scene/resources/3d/physics/concave_polygon_shape_3d.h @@ -31,7 +31,7 @@ #ifndef CONCAVE_POLYGON_SHAPE_3D_H #define CONCAVE_POLYGON_SHAPE_3D_H -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class ArrayMesh; diff --git a/scene/resources/3d/convex_polygon_shape_3d.cpp b/scene/resources/3d/physics/convex_polygon_shape_3d.cpp similarity index 100% rename from scene/resources/3d/convex_polygon_shape_3d.cpp rename to scene/resources/3d/physics/convex_polygon_shape_3d.cpp diff --git a/scene/resources/3d/convex_polygon_shape_3d.h b/scene/resources/3d/physics/convex_polygon_shape_3d.h similarity index 98% rename from scene/resources/3d/convex_polygon_shape_3d.h rename to scene/resources/3d/physics/convex_polygon_shape_3d.h index 2dd4ce66db0e..28342e6c343f 100644 --- a/scene/resources/3d/convex_polygon_shape_3d.h +++ b/scene/resources/3d/physics/convex_polygon_shape_3d.h @@ -31,7 +31,7 @@ #ifndef CONVEX_POLYGON_SHAPE_3D_H #define CONVEX_POLYGON_SHAPE_3D_H -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class ArrayMesh; diff --git a/scene/resources/3d/cylinder_shape_3d.cpp b/scene/resources/3d/physics/cylinder_shape_3d.cpp similarity index 100% rename from scene/resources/3d/cylinder_shape_3d.cpp rename to scene/resources/3d/physics/cylinder_shape_3d.cpp diff --git a/scene/resources/3d/cylinder_shape_3d.h b/scene/resources/3d/physics/cylinder_shape_3d.h similarity index 98% rename from scene/resources/3d/cylinder_shape_3d.h rename to scene/resources/3d/physics/cylinder_shape_3d.h index 9388cab3686a..b95670581edb 100644 --- a/scene/resources/3d/cylinder_shape_3d.h +++ b/scene/resources/3d/physics/cylinder_shape_3d.h @@ -31,7 +31,7 @@ #ifndef CYLINDER_SHAPE_3D_H #define CYLINDER_SHAPE_3D_H -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class ArrayMesh; diff --git a/scene/resources/3d/height_map_shape_3d.cpp b/scene/resources/3d/physics/height_map_shape_3d.cpp similarity index 100% rename from scene/resources/3d/height_map_shape_3d.cpp rename to scene/resources/3d/physics/height_map_shape_3d.cpp diff --git a/scene/resources/3d/height_map_shape_3d.h b/scene/resources/3d/physics/height_map_shape_3d.h similarity index 98% rename from scene/resources/3d/height_map_shape_3d.h rename to scene/resources/3d/physics/height_map_shape_3d.h index b5be53092d24..01a36e2b3bce 100644 --- a/scene/resources/3d/height_map_shape_3d.h +++ b/scene/resources/3d/physics/height_map_shape_3d.h @@ -31,7 +31,7 @@ #ifndef HEIGHT_MAP_SHAPE_3D_H #define HEIGHT_MAP_SHAPE_3D_H -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class ArrayMesh; class Image; diff --git a/scene/resources/3d/mesh_library.cpp b/scene/resources/3d/physics/mesh_library.cpp similarity index 100% rename from scene/resources/3d/mesh_library.cpp rename to scene/resources/3d/physics/mesh_library.cpp diff --git a/scene/resources/3d/mesh_library.h b/scene/resources/3d/physics/mesh_library.h similarity index 98% rename from scene/resources/3d/mesh_library.h rename to scene/resources/3d/physics/mesh_library.h index fc38b848a2d3..6660829f07ca 100644 --- a/scene/resources/3d/mesh_library.h +++ b/scene/resources/3d/physics/mesh_library.h @@ -33,7 +33,7 @@ #include "core/io/resource.h" #include "core/templates/rb_map.h" -#include "scene/3d/navigation_region_3d.h" +#include "scene/3d/navigation/navigation_region_3d.h" #include "scene/resources/mesh.h" #include "servers/rendering_server.h" #include "shape_3d.h" diff --git a/scene/resources/physics_material.cpp b/scene/resources/3d/physics/physics_material.cpp similarity index 100% rename from scene/resources/physics_material.cpp rename to scene/resources/3d/physics/physics_material.cpp diff --git a/scene/resources/physics_material.h b/scene/resources/3d/physics/physics_material.h similarity index 100% rename from scene/resources/physics_material.h rename to scene/resources/3d/physics/physics_material.h diff --git a/scene/resources/3d/separation_ray_shape_3d.cpp b/scene/resources/3d/physics/separation_ray_shape_3d.cpp similarity index 100% rename from scene/resources/3d/separation_ray_shape_3d.cpp rename to scene/resources/3d/physics/separation_ray_shape_3d.cpp diff --git a/scene/resources/3d/separation_ray_shape_3d.h b/scene/resources/3d/physics/separation_ray_shape_3d.h similarity index 98% rename from scene/resources/3d/separation_ray_shape_3d.h rename to scene/resources/3d/physics/separation_ray_shape_3d.h index c1c273c44845..5b705a4fd952 100644 --- a/scene/resources/3d/separation_ray_shape_3d.h +++ b/scene/resources/3d/physics/separation_ray_shape_3d.h @@ -31,7 +31,7 @@ #ifndef SEPARATION_RAY_SHAPE_3D_H #define SEPARATION_RAY_SHAPE_3D_H -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class ArrayMesh; diff --git a/scene/resources/3d/shape_3d.cpp b/scene/resources/3d/physics/shape_3d.cpp similarity index 100% rename from scene/resources/3d/shape_3d.cpp rename to scene/resources/3d/physics/shape_3d.cpp diff --git a/scene/resources/3d/shape_3d.h b/scene/resources/3d/physics/shape_3d.h similarity index 100% rename from scene/resources/3d/shape_3d.h rename to scene/resources/3d/physics/shape_3d.h diff --git a/scene/resources/3d/sky_material.h b/scene/resources/3d/physics/sky_material.h similarity index 100% rename from scene/resources/3d/sky_material.h rename to scene/resources/3d/physics/sky_material.h diff --git a/scene/resources/3d/sphere_shape_3d.cpp b/scene/resources/3d/physics/sphere_shape_3d.cpp similarity index 100% rename from scene/resources/3d/sphere_shape_3d.cpp rename to scene/resources/3d/physics/sphere_shape_3d.cpp diff --git a/scene/resources/3d/sphere_shape_3d.h b/scene/resources/3d/physics/sphere_shape_3d.h similarity index 98% rename from scene/resources/3d/sphere_shape_3d.h rename to scene/resources/3d/physics/sphere_shape_3d.h index cb0685287d96..8f351b47e8d1 100644 --- a/scene/resources/3d/sphere_shape_3d.h +++ b/scene/resources/3d/physics/sphere_shape_3d.h @@ -31,7 +31,7 @@ #ifndef SPHERE_SHAPE_3D_H #define SPHERE_SHAPE_3D_H -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class ArrayMesh; diff --git a/scene/resources/3d/world_boundary_shape_3d.cpp b/scene/resources/3d/physics/world_boundary_shape_3d.cpp similarity index 100% rename from scene/resources/3d/world_boundary_shape_3d.cpp rename to scene/resources/3d/physics/world_boundary_shape_3d.cpp diff --git a/scene/resources/3d/world_boundary_shape_3d.h b/scene/resources/3d/physics/world_boundary_shape_3d.h similarity index 98% rename from scene/resources/3d/world_boundary_shape_3d.h rename to scene/resources/3d/physics/world_boundary_shape_3d.h index 456316df2eba..158294b6209f 100644 --- a/scene/resources/3d/world_boundary_shape_3d.h +++ b/scene/resources/3d/physics/world_boundary_shape_3d.h @@ -31,7 +31,7 @@ #ifndef WORLD_BOUNDARY_SHAPE_3D_H #define WORLD_BOUNDARY_SHAPE_3D_H -#include "scene/resources/3d/shape_3d.h" +#include "scene/resources/3d/physics/shape_3d.h" class ArrayMesh; diff --git a/scene/resources/3d/world_3d.cpp b/scene/resources/3d/world_3d.cpp index b743b242628e..87ebd4381e55 100644 --- a/scene/resources/3d/world_3d.cpp +++ b/scene/resources/3d/world_3d.cpp @@ -46,6 +46,7 @@ void World3D::_remove_camera(Camera3D *p_camera) { } RID World3D::get_space() const { +#ifdef _PHYSICS_DISABLED if (space.is_null()) { space = PhysicsServer3D::get_singleton()->space_create(); PhysicsServer3D::get_singleton()->space_set_active(space, true); @@ -55,6 +56,9 @@ RID World3D::get_space() const { PhysicsServer3D::get_singleton()->area_set_param(space, PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP, GLOBAL_GET("physics/3d/default_angular_damp")); } return space; +#else + return RID(); +#endif // !_PHYSICS_DISABLED } RID World3D::get_navigation_map() const { @@ -140,9 +144,11 @@ Ref World3D::get_compositor() const { return compositor; } +#ifdef _PHYSICS_DISABLED PhysicsDirectSpaceState3D *World3D::get_direct_space_state() { return PhysicsServer3D::get_singleton()->space_get_direct_state(get_space()); } +#endif // !_PHYSICS_DISABLED void World3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_space"), &World3D::get_space); @@ -161,7 +167,9 @@ void World3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_space"); ADD_PROPERTY(PropertyInfo(Variant::RID, "navigation_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_navigation_map"); ADD_PROPERTY(PropertyInfo(Variant::RID, "scenario", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_scenario"); +#ifdef _PHYSICS_DISABLED ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState3D", PROPERTY_USAGE_NONE), "", "get_direct_space_state"); +#endif // !_PHYSICS_DISABLED } World3D::World3D() { @@ -170,14 +178,15 @@ World3D::World3D() { World3D::~World3D() { ERR_FAIL_NULL(RenderingServer::get_singleton()); - ERR_FAIL_NULL(PhysicsServer3D::get_singleton()); - ERR_FAIL_NULL(NavigationServer3D::get_singleton()); - RenderingServer::get_singleton()->free(scenario); - if (space.is_valid()) { - PhysicsServer3D::get_singleton()->free(space); - } + ERR_FAIL_NULL(NavigationServer3D::get_singleton()); if (navigation_map.is_valid()) { NavigationServer3D::get_singleton()->free(navigation_map); } +#ifdef _PHYSICS_DISABLED + ERR_FAIL_NULL(PhysicsServer3D::get_singleton()); + if (space.is_valid()) { + PhysicsServer3D::get_singleton()->free(space); + } +#endif // !_PHYSICS_DISABLED } diff --git a/scene/resources/3d/world_3d.h b/scene/resources/3d/world_3d.h index 06b06aea98d8..90343ed666e3 100644 --- a/scene/resources/3d/world_3d.h +++ b/scene/resources/3d/world_3d.h @@ -34,7 +34,9 @@ #include "core/io/resource.h" #include "scene/resources/compositor.h" #include "scene/resources/environment.h" +#ifdef _PHYSICS_DISABLED #include "servers/physics_server_3d.h" +#endif // !_PHYSICS_DISABLED #include "servers/rendering_server.h" class CameraAttributes; @@ -83,9 +85,9 @@ class World3D : public Resource { Ref get_compositor() const; _FORCE_INLINE_ const HashSet &get_cameras() const { return cameras; } - +#ifdef _PHYSICS_DISABLED PhysicsDirectSpaceState3D *get_direct_space_state(); - +#endif // !_PHYSICS_DISABLED World3D(); ~World3D(); }; diff --git a/scene/resources/SCsub b/scene/resources/SCsub index ae2a9b8c3a79..abfc44162481 100644 --- a/scene/resources/SCsub +++ b/scene/resources/SCsub @@ -33,3 +33,5 @@ env.Depends(scene_obj, thirdparty_obj) SConscript("2d/SCsub") if not env["disable_3d"]: SConscript("3d/SCsub") +if not env["disable_visual_shader"]: + SConscript("visual_shader/SCsub") diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 8c0e08790295..9faa1eb47f6f 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -34,10 +34,10 @@ #include "core/templates/pair.h" #include "scene/resources/surface_tool.h" -#ifndef _3D_DISABLED -#include "scene/resources/3d/concave_polygon_shape_3d.h" -#include "scene/resources/3d/convex_polygon_shape_3d.h" -#endif // _3D_DISABLED +#if !defined(_3D_DISABLED) || !defined(_PHYSICS_DISABLED) +#include "scene/resources/3d/physics/concave_polygon_shape_3d.h" +#include "scene/resources/3d/physics/convex_polygon_shape_3d.h" +#endif // !defined(_3D_DISABLED) || !defined(_PHYSICS_DISABLED) void MeshConvexDecompositionSettings::set_max_concavity(real_t p_max_concavity) { max_concavity = CLAMP(p_max_concavity, 0.001, 1.0); diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index 068bfb6708c4..3e6347453664 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -34,9 +34,9 @@ #include "core/io/resource.h" #include "core/math/face3.h" #include "core/math/triangle_mesh.h" -#ifndef _3D_DISABLED -#include "scene/resources/3d/shape_3d.h" -#endif // _3D_DISABLED +#if !defined(_3D_DISABLED) || !defined(_PHYSICS_DISABLED) +#include "scene/resources/3d/physics/shape_3d.h" +#endif // !defined(_3D_DISABLED) || !defined(_PHYSICS_DISABLED) #include "scene/resources/material.h" #include "servers/rendering_server.h" diff --git a/scene/resources/visual_shader/SCsub b/scene/resources/visual_shader/SCsub new file mode 100644 index 000000000000..374dc2119dcd --- /dev/null +++ b/scene/resources/visual_shader/SCsub @@ -0,0 +1,6 @@ +#!/usr/bin/env python +from misc.utility.scons_hints import * + +Import("env") + +env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader/visual_shader.cpp similarity index 100% rename from scene/resources/visual_shader.cpp rename to scene/resources/visual_shader/visual_shader.cpp diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader/visual_shader.h similarity index 100% rename from scene/resources/visual_shader.h rename to scene/resources/visual_shader/visual_shader.h diff --git a/scene/resources/visual_shader_nodes.compat.inc b/scene/resources/visual_shader/visual_shader_nodes.compat.inc similarity index 100% rename from scene/resources/visual_shader_nodes.compat.inc rename to scene/resources/visual_shader/visual_shader_nodes.compat.inc diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader/visual_shader_nodes.cpp similarity index 100% rename from scene/resources/visual_shader_nodes.cpp rename to scene/resources/visual_shader/visual_shader_nodes.cpp diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader/visual_shader_nodes.h similarity index 100% rename from scene/resources/visual_shader_nodes.h rename to scene/resources/visual_shader/visual_shader_nodes.h diff --git a/scene/resources/visual_shader_particle_nodes.cpp b/scene/resources/visual_shader/visual_shader_particle_nodes.cpp similarity index 100% rename from scene/resources/visual_shader_particle_nodes.cpp rename to scene/resources/visual_shader/visual_shader_particle_nodes.cpp diff --git a/scene/resources/visual_shader_particle_nodes.h b/scene/resources/visual_shader/visual_shader_particle_nodes.h similarity index 100% rename from scene/resources/visual_shader_particle_nodes.h rename to scene/resources/visual_shader/visual_shader_particle_nodes.h diff --git a/scene/resources/visual_shader_sdf_nodes.cpp b/scene/resources/visual_shader/visual_shader_sdf_nodes.cpp similarity index 100% rename from scene/resources/visual_shader_sdf_nodes.cpp rename to scene/resources/visual_shader/visual_shader_sdf_nodes.cpp diff --git a/scene/resources/visual_shader_sdf_nodes.h b/scene/resources/visual_shader/visual_shader_sdf_nodes.h similarity index 100% rename from scene/resources/visual_shader_sdf_nodes.h rename to scene/resources/visual_shader/visual_shader_sdf_nodes.h diff --git a/servers/SCsub b/servers/SCsub index 7abe53b9e171..5d9ba9583ed5 100644 --- a/servers/SCsub +++ b/servers/SCsub @@ -8,29 +8,36 @@ env.servers_sources = [] env.add_source_files(env.servers_sources, "audio_server.cpp") env.add_source_files(env.servers_sources, "camera_server.cpp") env.add_source_files(env.servers_sources, "display_server.cpp") -env.add_source_files(env.servers_sources, "navigation_server_2d.cpp") -env.add_source_files(env.servers_sources, "navigation_server_3d.cpp") -env.add_source_files(env.servers_sources, "physics_server_2d.cpp") -env.add_source_files(env.servers_sources, "physics_server_2d_wrap_mt.cpp") env.add_source_files(env.servers_sources, "register_server_types.cpp") env.add_source_files(env.servers_sources, "rendering_server.cpp") env.add_source_files(env.servers_sources, "text_server.cpp") +if not env["disable_physics"]: + env.add_source_files(env.servers_sources, "physics_server_2d.cpp") + env.add_source_files(env.servers_sources, "physics_server_2d_wrap_mt.cpp") + if not env["disable_3d"]: + env.add_source_files(env.servers_sources, "physics_server_3d.cpp") + env.add_source_files(env.servers_sources, "physics_server_3d_wrap_mt.cpp") + +if not env["disable_navigation"]: + env.add_source_files(env.servers_sources, "navigation_server_2d.cpp") + env.add_source_files(env.servers_sources, "navigation_server_3d.cpp") + +if not env["disable_3d"]: + SConscript("xr/SCsub") + env.add_source_files(env.servers_sources, "xr_server.cpp") + SConscript("audio/SCsub") SConscript("camera/SCsub") SConscript("debugger/SCsub") SConscript("display/SCsub") SConscript("extensions/SCsub") SConscript("movie_writer/SCsub") -SConscript("navigation/SCsub") +if not env["disable_navigation"]: + SConscript("navigation/SCsub") SConscript("rendering/SCsub") SConscript("text/SCsub") -if not env["disable_3d"]: - env.add_source_files(env.servers_sources, "physics_server_3d.cpp") - env.add_source_files(env.servers_sources, "physics_server_3d_wrap_mt.cpp") - SConscript("xr/SCsub") - env.add_source_files(env.servers_sources, "xr_server.cpp") lib = env.add_library("servers", env.servers_sources) diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 63b2f28e7415..9a37607fd355 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -1597,6 +1597,7 @@ void AudioServer::update() { } void AudioServer::load_default_bus_layout() { +#ifndef PIXEL_ENGINE String layout_path = GLOBAL_GET("audio/buses/default_bus_layout"); if (ResourceLoader::exists(layout_path)) { @@ -1605,6 +1606,7 @@ void AudioServer::load_default_bus_layout() { set_bus_layout(default_layout); } } +#endif // !PIXEL_ENGINE } void AudioServer::finish() { diff --git a/servers/extensions/SCsub b/servers/extensions/SCsub index e7bb57e9f3f6..772764227bbd 100644 --- a/servers/extensions/SCsub +++ b/servers/extensions/SCsub @@ -5,7 +5,8 @@ Import("env") env_object = env.Clone() -env_object.add_source_files(env.servers_sources, "physics_server_2d_extension.cpp") +if not env["disable_physics"]: + env_object.add_source_files(env.servers_sources, "physics_server_2d_extension.cpp") -if not env["disable_3d"]: - env_object.add_source_files(env.servers_sources, "physics_server_3d_extension.cpp") + if not env["disable_3d"]: + env_object.add_source_files(env.servers_sources, "physics_server_3d_extension.cpp") diff --git a/servers/movie_writer/movie_writer.cpp b/servers/movie_writer/movie_writer.cpp index 14e920d8cdb3..3aeb5c7205d8 100644 --- a/servers/movie_writer/movie_writer.cpp +++ b/servers/movie_writer/movie_writer.cpp @@ -94,7 +94,11 @@ void MovieWriter::get_supported_extensions(List *r_extensions) const { } void MovieWriter::begin(const Size2i &p_movie_size, uint32_t p_fps, const String &p_base_path) { +#ifndef PIXEL_ENGINE project_name = GLOBAL_GET("application/config/name"); +#else + project_name = "Pixel Engine"; +#endif // !PIXEL_ENGINE print_line(vformat("Movie Maker mode enabled, recording movie at %d FPS...", p_fps)); diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h index e7c7cf065331..f3894eca88c4 100644 --- a/servers/navigation_server_2d.h +++ b/servers/navigation_server_2d.h @@ -34,8 +34,8 @@ #include "core/object/class_db.h" #include "core/templates/rid.h" -#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h" -#include "scene/resources/2d/navigation_polygon.h" +#include "scene/resources/2d/navigation/navigation_mesh_source_geometry_data_2d.h" +#include "scene/resources/2d/navigation/navigation_polygon.h" #include "servers/navigation/navigation_path_query_parameters_2d.h" #include "servers/navigation/navigation_path_query_result_2d.h" diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h index df5f7658bb2a..9d6b1b74769f 100644 --- a/servers/navigation_server_3d.h +++ b/servers/navigation_server_3d.h @@ -34,8 +34,8 @@ #include "core/object/class_db.h" #include "core/templates/rid.h" -#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" -#include "scene/resources/navigation_mesh.h" +#include "scene/resources/3d/navigation/navigation_mesh_source_geometry_data_3d.h" +#include "scene/resources/3d/navigation/navigation_mesh.h" #include "servers/navigation/navigation_path_query_parameters_3d.h" #include "servers/navigation/navigation_path_query_result_3d.h" diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index 3e0caeea6594..148d937b16f1 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -80,15 +80,14 @@ #include "text/text_server_extension.h" #include "text_server.h" +#ifndef _PHYSICS_DISABLED // 2D physics and navigation. -#include "navigation_server_2d.h" #include "physics_server_2d.h" #include "physics_server_2d_dummy.h" #include "physics_server_2d_wrap_mt.h" #include "servers/extensions/physics_server_2d_extension.h" // 3D physics and navigation (3D navigation is needed for 2D). -#include "navigation_server_3d.h" #ifndef _3D_DISABLED #include "physics_server_3d.h" #include "physics_server_3d_dummy.h" @@ -102,10 +101,17 @@ #include "xr/xr_interface_extension.h" #include "xr/xr_positional_tracker.h" #include "xr_server.h" -#endif // _3D_DISABLED +#endif // !_3D_DISABLED +#endif // !_PHYSICS_DISABLED + +#ifndef _NAVIGATION_DISABLED +#include "navigation_server_2d.h" +#include "navigation_server_3d.h" +#endif // !_NAVIGATION_DISABLED ShaderTypes *shader_types = nullptr; +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED static PhysicsServer3D *_create_dummy_physics_server_3d() { return memnew(PhysicsServer3DDummy); @@ -115,6 +121,7 @@ static PhysicsServer3D *_create_dummy_physics_server_3d() { static PhysicsServer2D *_create_dummy_physics_server_2d() { return memnew(PhysicsServer2DDummy); } +#endif // !_PHYSICS_DISABLED static bool has_server_feature_callback(const String &p_feature) { if (RenderingServer::get_singleton()) { @@ -251,6 +258,7 @@ void register_server_types() { ServersDebugger::initialize(); +#ifndef _PHYSICS_DISABLED // Physics 2D GDREGISTER_CLASS(PhysicsServer2DManager); Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2DManager", PhysicsServer2DManager::get_singleton(), "PhysicsServer2DManager")); @@ -277,10 +285,6 @@ void register_server_types() { PhysicsServer2DManager::get_singleton()->register_server("Dummy", callable_mp_static(_create_dummy_physics_server_2d)); - GDREGISTER_ABSTRACT_CLASS(NavigationServer2D); - GDREGISTER_CLASS(NavigationPathQueryParameters2D); - GDREGISTER_CLASS(NavigationPathQueryResult2D); - #ifndef _3D_DISABLED // Physics 3D GDREGISTER_CLASS(PhysicsServer3DManager); @@ -322,10 +326,17 @@ void register_server_types() { GDREGISTER_CLASS(XRServer); GDREGISTER_ABSTRACT_CLASS(XRTracker); #endif // _3D_DISABLED +#endif // !_PHYSICS_DISABLED + +#ifndef _NAVIGATION_DISABLED + GDREGISTER_ABSTRACT_CLASS(NavigationServer2D); + GDREGISTER_CLASS(NavigationPathQueryParameters2D); + GDREGISTER_CLASS(NavigationPathQueryResult2D); GDREGISTER_ABSTRACT_CLASS(NavigationServer3D); GDREGISTER_CLASS(NavigationPathQueryParameters3D); GDREGISTER_CLASS(NavigationPathQueryResult3D); +#endif // !_NAVIGATION_DISABLED writer_mjpeg = memnew(MovieWriterMJPEG); MovieWriter::add_writer(writer_mjpeg); @@ -354,15 +365,18 @@ void register_server_singletons() { Engine::get_singleton()->add_singleton(Engine::Singleton("CameraServer", CameraServer::get_singleton(), "CameraServer")); Engine::get_singleton()->add_singleton(Engine::Singleton("DisplayServer", DisplayServer::get_singleton(), "DisplayServer")); Engine::get_singleton()->add_singleton(Engine::Singleton("NativeMenu", NativeMenu::get_singleton(), "NativeMenu")); +#ifndef _NAVIGATION_DISABLED Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer2D", NavigationServer2D::get_singleton(), "NavigationServer2D")); Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer3D", NavigationServer3D::get_singleton(), "NavigationServer3D")); +#endif // !_NAVIGATION_DISABLED Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingServer", RenderingServer::get_singleton(), "RenderingServer")); - +#ifndef _PHYSICS_DISABLED Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2D", PhysicsServer2D::get_singleton(), "PhysicsServer2D")); #ifndef _3D_DISABLED Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton(), "PhysicsServer3D")); Engine::get_singleton()->add_singleton(Engine::Singleton("XRServer", XRServer::get_singleton(), "XRServer")); #endif // _3D_DISABLED +#endif OS::get_singleton()->benchmark_end_measure("Servers", "Register Singletons"); } diff --git a/tests/scene/test_navigation_agent_2d.h b/tests/scene/test_navigation_agent_2d.h index e20435d401a1..33f52230707f 100644 --- a/tests/scene/test_navigation_agent_2d.h +++ b/tests/scene/test_navigation_agent_2d.h @@ -31,10 +31,10 @@ #ifndef TEST_NAVIGATION_AGENT_2D_H #define TEST_NAVIGATION_AGENT_2D_H -#include "scene/2d/navigation_agent_2d.h" +#include "scene/2d/navigation/navigation_agent_2d.h" #include "scene/2d/node_2d.h" #include "scene/main/window.h" -#include "scene/resources/world_2d.h" +#include "scene/resources/2d/world_2d.h" #include "tests/test_macros.h" diff --git a/tests/scene/test_navigation_agent_3d.h b/tests/scene/test_navigation_agent_3d.h index f240279b9ff8..0e85362842ba 100644 --- a/tests/scene/test_navigation_agent_3d.h +++ b/tests/scene/test_navigation_agent_3d.h @@ -31,7 +31,7 @@ #ifndef TEST_NAVIGATION_AGENT_3D_H #define TEST_NAVIGATION_AGENT_3D_H -#include "scene/3d/navigation_agent_3d.h" +#include "scene/3d/navigation/navigation_agent_3d.h" #include "scene/3d/node_3d.h" #include "scene/main/window.h" diff --git a/tests/scene/test_navigation_obstacle_2d.h b/tests/scene/test_navigation_obstacle_2d.h index 97d28e0a485e..85b4f25ea80a 100644 --- a/tests/scene/test_navigation_obstacle_2d.h +++ b/tests/scene/test_navigation_obstacle_2d.h @@ -31,7 +31,7 @@ #ifndef TEST_NAVIGATION_OBSTACLE_2D_H #define TEST_NAVIGATION_OBSTACLE_2D_H -#include "scene/2d/navigation_obstacle_2d.h" +#include "scene/2d/navigation/navigation_obstacle_2d.h" #include "scene/main/window.h" #include "tests/test_macros.h" diff --git a/tests/scene/test_navigation_obstacle_3d.h b/tests/scene/test_navigation_obstacle_3d.h index 8769f4fb6475..fe55d15e1200 100644 --- a/tests/scene/test_navigation_obstacle_3d.h +++ b/tests/scene/test_navigation_obstacle_3d.h @@ -31,7 +31,7 @@ #ifndef TEST_NAVIGATION_OBSTACLE_3D_H #define TEST_NAVIGATION_OBSTACLE_3D_H -#include "scene/3d/navigation_obstacle_3d.h" +#include "scene/3d/navigation/navigation_obstacle_3d.h" #include "scene/main/window.h" #include "tests/test_macros.h" diff --git a/tests/scene/test_navigation_region_2d.h b/tests/scene/test_navigation_region_2d.h index fcb5aeacbe09..cdac2fd7489a 100644 --- a/tests/scene/test_navigation_region_2d.h +++ b/tests/scene/test_navigation_region_2d.h @@ -31,7 +31,7 @@ #ifndef TEST_NAVIGATION_REGION_2D_H #define TEST_NAVIGATION_REGION_2D_H -#include "scene/2d/navigation_region_2d.h" +#include "scene/2d/navigation/navigation_region_2d.h" #include "scene/main/window.h" #include "tests/test_macros.h" diff --git a/tests/scene/test_navigation_region_3d.h b/tests/scene/test_navigation_region_3d.h index f3d7f2736178..2f1ff28c8f18 100644 --- a/tests/scene/test_navigation_region_3d.h +++ b/tests/scene/test_navigation_region_3d.h @@ -32,7 +32,7 @@ #define TEST_NAVIGATION_REGION_3D_H #include "scene/3d/mesh_instance_3d.h" -#include "scene/3d/navigation_region_3d.h" +#include "scene/3d/navigation/navigation_region_3d.h" #include "scene/main/window.h" #include "scene/resources/3d/primitive_meshes.h" diff --git a/tests/scene/test_physics_material.h b/tests/scene/test_physics_material.h index a078166f424f..a18aee979ed1 100644 --- a/tests/scene/test_physics_material.h +++ b/tests/scene/test_physics_material.h @@ -31,7 +31,7 @@ #ifndef TEST_PHYSICS_MATERIAL_H #define TEST_PHYSICS_MATERIAL_H -#include "scene/resources/physics_material.h" +#include "scene/resources/3d/physics/physics_material.h" #include "tests/test_macros.h" namespace TestPhysics_material { diff --git a/tests/scene/test_viewport.h b/tests/scene/test_viewport.h index dbf348ba9620..9b862185028f 100644 --- a/tests/scene/test_viewport.h +++ b/tests/scene/test_viewport.h @@ -37,7 +37,7 @@ #include "scene/gui/subviewport_container.h" #include "scene/main/canvas_layer.h" #include "scene/main/window.h" -#include "scene/resources/2d/rectangle_shape_2d.h" +#include "scene/resources/2d/physics/rectangle_shape_2d.h" #include "servers/physics_server_2d_dummy.h" #include "tests/test_macros.h" diff --git a/tests/test_main.cpp b/tests/test_main.cpp index ba81218cd269..b14c21d98a0c 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -186,13 +186,15 @@ #ifndef _3D_DISABLED #include "servers/navigation_server_2d.h" #include "servers/navigation_server_3d.h" -#endif // _3D_DISABLED +#endif // !_3D_DISABLED +#ifndef _PHYSICS_DISABLED #include "servers/physics_server_2d.h" #include "servers/physics_server_2d_dummy.h" #ifndef _3D_DISABLED #include "servers/physics_server_3d.h" #include "servers/physics_server_3d_dummy.h" -#endif // _3D_DISABLED +#endif // !_3D_DISABLED +#endif // !PHYSICS_DISABLED #include "servers/rendering/rendering_server_default.h" int test_main(int argc, char *argv[]) { @@ -401,6 +403,7 @@ struct GodotTestCaseListener : public doctest::IReporter { } #endif // _3D_DISABLED +#ifndef _PHYSICS_DISABLED #ifndef _3D_DISABLED if (physics_server_3d) { physics_server_3d->finish(); diff --git a/version.py b/version.py index 22704a08cb7e..1621f0847fa2 100644 --- a/version.py +++ b/version.py @@ -1,8 +1,11 @@ -short_name = "godot" -name = "Godot Engine" +short_name = "pixel" +name = "Pixel Engine" major = 4 minor = 4 patch = 0 +pixel_major = 0 +pixel_minor = 1 +pixel_patch = 0 status = "dev" module_config = "" website = "https://godotengine.org"