Skip to content

Commit

Permalink
Allow disabling (Physics, Navigation, and Visual Shader)
Browse files Browse the repository at this point in the history
  • Loading branch information
WhalesState committed Dec 18, 2024
1 parent 982cae7 commit 68bd952
Showing 239 changed files with 921 additions and 431 deletions.
29 changes: 29 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -255,6 +255,9 @@ 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_navigation", "Disable 2D and 3D navigation for a smaller executable", False))
opts.Add(BoolVariable("disable_physics", "Disable 2D and 3D physics for a smaller executable", False))
opts.Add(BoolVariable("disable_visual_shader", "Disable visual shader for a smaller executable", False))
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))
@@ -1013,6 +1016,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(
@@ -1022,6 +1050,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"]:
2 changes: 1 addition & 1 deletion editor/import/3d/resource_importer_scene.cpp
Original file line number Diff line number Diff line change
@@ -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"
8 changes: 4 additions & 4 deletions editor/import/3d/resource_importer_scene.h
Original file line number Diff line number Diff line change
@@ -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"

2 changes: 1 addition & 1 deletion editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 8 additions & 8 deletions editor/plugins/collision_shape_2d_editor_plugin.cpp
Original file line number Diff line number Diff line change
@@ -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");
12 changes: 6 additions & 6 deletions editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp
Original file line number Diff line number Diff line change
@@ -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() {
2 changes: 1 addition & 1 deletion editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp
Original file line number Diff line number Diff line change
@@ -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() {
Original file line number Diff line number Diff line change
@@ -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() {
2 changes: 1 addition & 1 deletion editor/plugins/gizmos/spring_arm_3d_gizmo_plugin.cpp
Original file line number Diff line number Diff line change
@@ -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<SpringArm3D>(p_gizmo->get_node_3d());
6 changes: 3 additions & 3 deletions editor/plugins/mesh_instance_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
@@ -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) {
2 changes: 1 addition & 1 deletion editor/plugins/mesh_library_editor_plugin.cpp
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion editor/plugins/navigation_link_2d_editor_plugin.h
Original file line number Diff line number Diff line change
@@ -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;

2 changes: 1 addition & 1 deletion editor/plugins/navigation_obstacle_2d_editor_plugin.h
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion editor/plugins/navigation_obstacle_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion editor/plugins/navigation_polygon_editor_plugin.cpp
Original file line number Diff line number Diff line change
@@ -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<NavigationPolygon> NavigationPolygonEditor::_ensure_navpoly() const {
2 changes: 1 addition & 1 deletion editor/plugins/skeleton_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
@@ -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"

Loading

0 comments on commit 68bd952

Please sign in to comment.