summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/config/project_settings.cpp7
-rw-r--r--core/core_bind.cpp1
-rw-r--r--core/debugger/local_debugger.cpp1
-rw-r--r--core/object/class_db.cpp18
-rw-r--r--core/object/class_db.h4
-rw-r--r--core/object/object.h2
-rw-r--r--core/os/midi_driver.cpp1
-rw-r--r--core/os/os.h1
-rw-r--r--core/os/threaded_array_processor.h1
-rw-r--r--core/variant/typed_array.h2
-rw-r--r--core/variant/variant.cpp7
-rw-r--r--core/variant/variant.h1
-rw-r--r--core/variant/variant_internal.h17
-rw-r--r--doc/classes/ArrayOccluder3D.xml3
-rw-r--r--doc/classes/AudioStreamPlayer2D.xml2
-rw-r--r--doc/classes/AudioStreamPlayer3D.xml2
-rw-r--r--doc/classes/BoxOccluder3D.xml4
-rw-r--r--doc/classes/Container.xml14
-rw-r--r--doc/classes/Control.xml12
-rw-r--r--doc/classes/DisplayServer.xml10
-rw-r--r--doc/classes/Occluder3D.xml5
-rw-r--r--doc/classes/OccluderInstance3D.xml19
-rw-r--r--doc/classes/PolygonOccluder3D.xml5
-rw-r--r--doc/classes/ProjectSettings.xml4
-rw-r--r--doc/classes/QuadOccluder3D.xml4
-rw-r--r--doc/classes/SphereOccluder3D.xml4
-rw-r--r--doc/classes/Theme.xml15
-rw-r--r--doc/classes/Viewport.xml2
-rw-r--r--doc/translations/extract.py12
-rw-r--r--editor/action_map_editor.cpp1
-rw-r--r--editor/action_map_editor.h2
-rw-r--r--editor/animation_bezier_editor.cpp2
-rw-r--r--editor/animation_track_editor.cpp6
-rw-r--r--editor/animation_track_editor.h3
-rw-r--r--editor/animation_track_editor_plugins.cpp4
-rw-r--r--editor/array_property_edit.cpp2
-rw-r--r--editor/code_editor.cpp4
-rw-r--r--editor/connections_dialog.cpp7
-rw-r--r--editor/create_dialog.cpp8
-rw-r--r--editor/create_dialog.h2
-rw-r--r--editor/debugger/editor_debugger_node.cpp1
-rw-r--r--editor/debugger/editor_debugger_tree.cpp2
-rw-r--r--editor/debugger/script_editor_debugger.cpp1
-rw-r--r--editor/debugger/script_editor_debugger.h2
-rw-r--r--editor/dependency_editor.cpp7
-rw-r--r--editor/dependency_editor.h2
-rw-r--r--editor/dictionary_property_edit.cpp2
-rw-r--r--editor/editor_about.cpp2
-rw-r--r--editor/editor_about.h3
-rw-r--r--editor/editor_asset_installer.cpp5
-rw-r--r--editor/editor_audio_buses.cpp6
-rw-r--r--editor/editor_audio_buses.h3
-rw-r--r--editor/editor_autoload_settings.cpp5
-rw-r--r--editor/editor_autoload_settings.h4
-rw-r--r--editor/editor_data.cpp4
-rw-r--r--editor/editor_dir_dialog.cpp2
-rw-r--r--editor/editor_export.cpp4
-rw-r--r--editor/editor_feature_profile.cpp5
-rw-r--r--editor/editor_feature_profile.h3
-rw-r--r--editor/editor_file_dialog.cpp9
-rw-r--r--editor/editor_file_system.cpp6
-rw-r--r--editor/editor_folding.cpp4
-rw-r--r--editor/editor_fonts.cpp4
-rw-r--r--editor/editor_help.cpp6
-rw-r--r--editor/editor_help_search.cpp6
-rw-r--r--editor/editor_inspector.cpp111
-rw-r--r--editor/editor_inspector.h11
-rw-r--r--editor/editor_locale_dialog.cpp1
-rw-r--r--editor/editor_log.cpp4
-rw-r--r--editor/editor_log.h1
-rw-r--r--editor/editor_node.cpp7
-rw-r--r--editor/editor_node.h21
-rw-r--r--editor/editor_path.cpp4
-rw-r--r--editor/editor_path.h2
-rw-r--r--editor/editor_plugin.cpp3
-rw-r--r--editor/editor_plugin_settings.cpp4
-rw-r--r--editor/editor_plugin_settings.h2
-rw-r--r--editor/editor_properties.cpp8
-rw-r--r--editor/editor_properties_array_dict.cpp2
-rw-r--r--editor/editor_resource_picker.cpp10
-rw-r--r--editor/editor_resource_picker.h3
-rw-r--r--editor/editor_resource_preview.cpp6
-rw-r--r--editor/editor_run.cpp2
-rw-r--r--editor/editor_run_native.cpp6
-rw-r--r--editor/editor_run_script.cpp2
-rw-r--r--editor/editor_run_script.h2
-rw-r--r--editor/editor_sectioned_inspector.cpp2
-rw-r--r--editor/editor_settings_dialog.cpp10
-rw-r--r--editor/editor_settings_dialog.h2
-rw-r--r--editor/editor_spin_slider.cpp4
-rw-r--r--editor/editor_themes.cpp21
-rw-r--r--editor/editor_toaster.cpp5
-rw-r--r--editor/editor_toaster.h8
-rw-r--r--editor/export_template_manager.cpp4
-rw-r--r--editor/filesystem_dock.cpp11
-rw-r--r--editor/filesystem_dock.h4
-rw-r--r--editor/find_in_files.cpp5
-rw-r--r--editor/groups_editor.cpp5
-rw-r--r--editor/icons/ControlAlignCenterBottom.svg (renamed from editor/icons/ControlAlignBottomCenter.svg)0
-rw-r--r--editor/icons/ControlAlignCenterLeft.svg (renamed from editor/icons/ControlAlignLeftCenter.svg)0
-rw-r--r--editor/icons/ControlAlignCenterRight.svg (renamed from editor/icons/ControlAlignRightCenter.svg)0
-rw-r--r--editor/icons/ControlAlignCenterTop.svg (renamed from editor/icons/ControlAlignTopCenter.svg)0
-rw-r--r--editor/icons/ControlAlignHCenterWide.svg (renamed from editor/icons/ControlHcenterWide.svg)0
-rw-r--r--editor/icons/ControlAlignVCenterWide.svg (renamed from editor/icons/ControlVcenterWide.svg)0
-rw-r--r--editor/import/dynamicfont_import_settings.cpp4
-rw-r--r--editor/import/dynamicfont_import_settings.h7
-rw-r--r--editor/import/editor_import_plugin.cpp1
-rw-r--r--editor/import/resource_importer_layered_texture.cpp3
-rw-r--r--editor/import/resource_importer_texture.cpp1
-rw-r--r--editor/import/scene_import_settings.cpp5
-rw-r--r--editor/import/scene_import_settings.h4
-rw-r--r--editor/import_defaults_editor.cpp9
-rw-r--r--editor/import_defaults_editor.h11
-rw-r--r--editor/import_dock.cpp8
-rw-r--r--editor/inspector_dock.cpp2
-rw-r--r--editor/inspector_dock.h2
-rw-r--r--editor/localization_editor.cpp10
-rw-r--r--editor/localization_editor.h5
-rw-r--r--editor/multi_node_edit.cpp2
-rw-r--r--editor/node_dock.cpp4
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp1
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.h3
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.h1
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.h1
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.h3
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp3
-rw-r--r--editor/plugins/animation_player_editor_plugin.h4
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp2
-rw-r--r--editor/plugins/animation_state_machine_editor.h3
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_tree_editor_plugin.h3
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp1
-rw-r--r--editor/plugins/audio_stream_editor_plugin.cpp1
-rw-r--r--editor/plugins/audio_stream_editor_plugin.h2
-rw-r--r--editor/plugins/camera_3d_editor_plugin.cpp1
-rw-r--r--editor/plugins/camera_3d_editor_plugin.h3
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp384
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h159
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp9
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.h2
-rw-r--r--editor/plugins/control_editor_plugin.cpp1023
-rw-r--r--editor/plugins/control_editor_plugin.h255
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.h7
-rw-r--r--editor/plugins/cpu_particles_3d_editor_plugin.cpp3
-rw-r--r--editor/plugins/cpu_particles_3d_editor_plugin.h2
-rw-r--r--editor/plugins/curve_editor_plugin.cpp1
-rw-r--r--editor/plugins/curve_editor_plugin.h3
-rw-r--r--editor/plugins/editor_preview_plugins.cpp1
-rw-r--r--editor/plugins/font_editor_plugin.cpp1
-rw-r--r--editor/plugins/font_editor_plugin.h3
-rw-r--r--editor/plugins/gpu_particles_2d_editor_plugin.cpp3
-rw-r--r--editor/plugins/gpu_particles_2d_editor_plugin.h6
-rw-r--r--editor/plugins/gpu_particles_3d_editor_plugin.cpp2
-rw-r--r--editor/plugins/gpu_particles_3d_editor_plugin.h4
-rw-r--r--editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp3
-rw-r--r--editor/plugins/gpu_particles_collision_sdf_editor_plugin.h5
-rw-r--r--editor/plugins/gradient_editor_plugin.cpp1
-rw-r--r--editor/plugins/gradient_editor_plugin.h3
-rw-r--r--editor/plugins/input_event_editor_plugin.cpp2
-rw-r--r--editor/plugins/input_event_editor_plugin.h3
-rw-r--r--editor/plugins/lightmap_gi_editor_plugin.cpp3
-rw-r--r--editor/plugins/lightmap_gi_editor_plugin.h5
-rw-r--r--editor/plugins/material_editor_plugin.cpp1
-rw-r--r--editor/plugins/material_editor_plugin.h2
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp1
-rw-r--r--editor/plugins/mesh_editor_plugin.h3
-rw-r--r--editor/plugins/mesh_instance_3d_editor_plugin.cpp1
-rw-r--r--editor/plugins/mesh_instance_3d_editor_plugin.h3
-rw-r--r--editor/plugins/mesh_library_editor_plugin.cpp1
-rw-r--r--editor/plugins/mesh_library_editor_plugin.h7
-rw-r--r--editor/plugins/multimesh_editor_plugin.cpp2
-rw-r--r--editor/plugins/multimesh_editor_plugin.h5
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp2
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp28
-rw-r--r--editor/plugins/node_3d_editor_plugin.h8
-rw-r--r--editor/plugins/occluder_instance_3d_editor_plugin.cpp3
-rw-r--r--editor/plugins/occluder_instance_3d_editor_plugin.h5
-rw-r--r--editor/plugins/ot_features_plugin.cpp1
-rw-r--r--editor/plugins/ot_features_plugin.h3
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp1
-rw-r--r--editor/plugins/path_2d_editor_plugin.h3
-rw-r--r--editor/plugins/path_3d_editor_plugin.cpp1
-rw-r--r--editor/plugins/path_3d_editor_plugin.h3
-rw-r--r--editor/plugins/physical_bone_3d_editor_plugin.cpp1
-rw-r--r--editor/plugins/physical_bone_3d_editor_plugin.h7
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp3
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.h3
-rw-r--r--editor/plugins/polygon_3d_editor_plugin.cpp1
-rw-r--r--editor/plugins/polygon_3d_editor_plugin.h2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.h6
-rw-r--r--editor/plugins/script_editor_plugin.cpp5
-rw-r--r--editor/plugins/script_editor_plugin.h4
-rw-r--r--editor/plugins/script_text_editor.cpp1
-rw-r--r--editor/plugins/shader_file_editor_plugin.h2
-rw-r--r--editor/plugins/skeleton_2d_editor_plugin.cpp1
-rw-r--r--editor/plugins/skeleton_2d_editor_plugin.h3
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp1
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.h2
-rw-r--r--editor/plugins/skeleton_ik_3d_editor_plugin.cpp1
-rw-r--r--editor/plugins/skeleton_ik_3d_editor_plugin.h2
-rw-r--r--editor/plugins/sprite_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/sprite_2d_editor_plugin.h3
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp3
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h10
-rw-r--r--editor/plugins/style_box_editor_plugin.cpp1
-rw-r--r--editor/plugins/style_box_editor_plugin.h4
-rw-r--r--editor/plugins/sub_viewport_preview_editor_plugin.cpp2
-rw-r--r--editor/plugins/sub_viewport_preview_editor_plugin.h3
-rw-r--r--editor/plugins/text_control_editor_plugin.cpp1
-rw-r--r--editor/plugins/text_control_editor_plugin.h4
-rw-r--r--editor/plugins/texture_3d_editor_plugin.cpp1
-rw-r--r--editor/plugins/texture_3d_editor_plugin.h4
-rw-r--r--editor/plugins/texture_editor_plugin.cpp1
-rw-r--r--editor/plugins/texture_editor_plugin.h3
-rw-r--r--editor/plugins/texture_layered_editor_plugin.cpp1
-rw-r--r--editor/plugins/texture_layered_editor_plugin.h4
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp1
-rw-r--r--editor/plugins/texture_region_editor_plugin.h2
-rw-r--r--editor/plugins/theme_editor_plugin.cpp88
-rw-r--r--editor/plugins/theme_editor_plugin.h19
-rw-r--r--editor/plugins/theme_editor_preview.cpp8
-rw-r--r--editor/plugins/theme_editor_preview.h16
-rw-r--r--editor/plugins/tiles/atlas_merging_dialog.cpp4
-rw-r--r--editor/plugins/tiles/atlas_merging_dialog.h6
-rw-r--r--editor/plugins/tiles/tile_atlas_view.cpp1
-rw-r--r--editor/plugins/tiles/tile_atlas_view.h2
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp13
-rw-r--r--editor/plugins/tiles/tile_data_editors.h14
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp11
-rw-r--r--editor/plugins/tiles/tile_map_editor.h17
-rw-r--r--editor/plugins/tiles/tile_proxies_manager_dialog.cpp3
-rw-r--r--editor/plugins/tiles/tile_proxies_manager_dialog.h5
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp3
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.h4
-rw-r--r--editor/plugins/tiles/tile_set_editor.cpp3
-rw-r--r--editor/plugins/tiles/tile_set_editor.h3
-rw-r--r--editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp4
-rw-r--r--editor/plugins/tiles/tile_set_scenes_collection_source_editor.h9
-rw-r--r--editor/plugins/version_control_editor_plugin.h3
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp1
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h3
-rw-r--r--editor/plugins/voxel_gi_editor_plugin.cpp3
-rw-r--r--editor/plugins/voxel_gi_editor_plugin.h5
-rw-r--r--editor/pot_generator.cpp2
-rw-r--r--editor/progress_dialog.cpp2
-rw-r--r--editor/project_export.cpp8
-rw-r--r--editor/project_export.h2
-rw-r--r--editor/project_manager.cpp8
-rw-r--r--editor/project_settings_editor.h3
-rw-r--r--editor/property_editor.cpp2
-rw-r--r--editor/property_editor.h4
-rw-r--r--editor/property_selector.cpp2
-rw-r--r--editor/property_selector.h2
-rw-r--r--editor/quick_open.h2
-rw-r--r--editor/rename_dialog.cpp8
-rw-r--r--editor/scene_tree_dock.cpp1
-rw-r--r--editor/scene_tree_editor.cpp1
-rw-r--r--editor/scene_tree_editor.h4
-rw-r--r--editor/script_create_dialog.cpp3
-rw-r--r--editor/script_create_dialog.h3
-rw-r--r--editor/shader_create_dialog.cpp3
-rw-r--r--editor/shader_create_dialog.h3
-rw-r--r--editor/shader_globals_editor.cpp4
-rw-r--r--editor/shader_globals_editor.h1
-rw-r--r--misc/dist/html/editor.html2
-rw-r--r--misc/dist/html/manifest.json1
-rw-r--r--modules/csg/csg_gizmos.cpp2
-rw-r--r--modules/fbx/register_types.cpp2
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp5
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.h9
-rw-r--r--modules/gdnative/gdnative_library_singleton_editor.cpp1
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp1
-rw-r--r--modules/gltf/editor_scene_exporter_gltf_plugin.cpp2
-rw-r--r--modules/gltf/editor_scene_exporter_gltf_plugin.h1
-rw-r--r--modules/gltf/gltf_document.cpp27
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp1
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h5
-rw-r--r--modules/mono/editor/bindings_generator.cpp45
-rw-r--r--modules/mono/editor/bindings_generator.h24
-rw-r--r--modules/mono/editor/editor_internal_calls.cpp1
-rw-r--r--modules/navigation/navigation_mesh_editor_plugin.cpp1
-rw-r--r--modules/navigation/navigation_mesh_editor_plugin.h2
-rw-r--r--platform/android/export/export_plugin.cpp2
-rw-r--r--platform/android/export/export_plugin.h1
-rw-r--r--platform/android/export/gradle_export_util.cpp2
-rw-r--r--platform/iphone/export/export_plugin.cpp2
-rw-r--r--platform/iphone/export/export_plugin.h1
-rw-r--r--platform/javascript/export/export_plugin.cpp3
-rw-r--r--platform/javascript/export/export_plugin.h4
-rw-r--r--platform/javascript/js/libs/library_godot_fetch.js1
-rw-r--r--platform/linuxbsd/os_linuxbsd.h2
-rw-r--r--platform/osx/export/export_plugin.cpp1
-rw-r--r--platform/osx/export/export_plugin.h1
-rw-r--r--platform/uwp/export/app_packager.cpp2
-rw-r--r--platform/uwp/export/app_packager.h1
-rw-r--r--platform/windows/display_server_windows.cpp7
-rw-r--r--platform/windows/export/export_plugin.cpp3
-rw-r--r--platform/windows/export/export_plugin.h1
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--scene/2d/audio_stream_player_2d.cpp1
-rw-r--r--scene/2d/camera_2d.cpp1
-rw-r--r--scene/2d/collision_object_2d.cpp1
-rw-r--r--scene/2d/navigation_agent_2d.cpp1
-rw-r--r--scene/2d/navigation_obstacle_2d.cpp1
-rw-r--r--scene/2d/navigation_region_2d.cpp1
-rw-r--r--scene/2d/ray_cast_2d.cpp1
-rw-r--r--scene/2d/shape_cast_2d.h1
-rw-r--r--scene/2d/skeleton_2d.cpp1
-rw-r--r--scene/2d/tile_map.cpp2
-rw-r--r--scene/3d/camera_3d.h2
-rw-r--r--scene/3d/node_3d.h1
-rw-r--r--scene/3d/occluder_instance_3d.cpp2
-rw-r--r--scene/3d/xr_nodes.cpp1
-rw-r--r--scene/gui/aspect_ratio_container.cpp18
-rw-r--r--scene/gui/aspect_ratio_container.h3
-rw-r--r--scene/gui/base_button.h1
-rw-r--r--scene/gui/box_container.cpp24
-rw-r--r--scene/gui/box_container.h3
-rw-r--r--scene/gui/center_container.cpp8
-rw-r--r--scene/gui/center_container.h3
-rw-r--r--scene/gui/container.cpp31
-rw-r--r--scene/gui/container.h6
-rw-r--r--scene/gui/control.cpp419
-rw-r--r--scene/gui/control.h29
-rw-r--r--scene/gui/flow_container.cpp26
-rw-r--r--scene/gui/flow_container.h5
-rw-r--r--scene/gui/graph_edit.h2
-rw-r--r--scene/gui/graph_node.cpp19
-rw-r--r--scene/gui/graph_node.h3
-rw-r--r--scene/gui/label.cpp14
-rw-r--r--scene/gui/link_button.h1
-rw-r--r--scene/gui/margin_container.cpp18
-rw-r--r--scene/gui/margin_container.h3
-rw-r--r--scene/gui/panel_container.cpp18
-rw-r--r--scene/gui/panel_container.h3
-rw-r--r--scene/gui/popup_menu.cpp1
-rw-r--r--scene/gui/rich_text_label.cpp99
-rw-r--r--scene/gui/rich_text_label.h3
-rw-r--r--scene/gui/scroll_container.cpp2
-rw-r--r--scene/gui/split_container.cpp24
-rw-r--r--scene/gui/split_container.h3
-rw-r--r--scene/gui/subviewport_container.cpp8
-rw-r--r--scene/gui/subviewport_container.h3
-rw-r--r--scene/gui/tab_container.cpp8
-rw-r--r--scene/gui/tab_container.h3
-rw-r--r--scene/main/canvas_item.h2
-rw-r--r--scene/main/canvas_layer.cpp6
-rw-r--r--scene/main/node.cpp1
-rw-r--r--scene/main/node.h3
-rw-r--r--scene/main/scene_tree.cpp3
-rw-r--r--scene/main/scene_tree.h3
-rw-r--r--scene/main/shader_globals_override.cpp1
-rw-r--r--scene/main/viewport.cpp1
-rw-r--r--scene/main/window.cpp1
-rw-r--r--scene/resources/environment.h1
-rw-r--r--scene/resources/skeleton_modification_2d_jiggle.cpp2
-rw-r--r--scene/resources/theme.cpp144
-rw-r--r--scene/resources/theme.h10
-rw-r--r--scene/resources/world_2d.h2
-rw-r--r--scene/resources/world_3d.cpp2
-rw-r--r--servers/display_server.h2
-rw-r--r--servers/rendering/rasterizer_dummy.h1
-rw-r--r--servers/rendering/renderer_compositor.h4
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp2
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl6
-rw-r--r--servers/rendering/renderer_scene.h2
-rw-r--r--servers/rendering/renderer_scene_cull.h11
-rw-r--r--servers/rendering/renderer_scene_render.h1
-rw-r--r--tests/test_main.cpp9
374 files changed, 3323 insertions, 1015 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index b5f1015ff5..3a7fc828aa 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -39,7 +39,6 @@
#include "core/io/file_access_pack.h"
#include "core/io/marshalls.h"
#include "core/os/keyboard.h"
-#include "core/os/os.h"
#include "core/variant/variant_parser.h"
#include "core/version.h"
@@ -615,7 +614,11 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bo
bool ProjectSettings::has_setting(String p_var) const {
_THREAD_SAFE_METHOD_
- return props.has(p_var);
+ StringName name = p_var;
+ if (!disable_feature_overrides && feature_overrides.has(name)) {
+ name = feature_overrides[name];
+ }
+ return props.has(name);
}
Error ProjectSettings::_load_settings_binary(const String &p_path) {
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index 195292f7e6..b31cc18b7a 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -39,7 +39,6 @@
#include "core/math/geometry_2d.h"
#include "core/math/geometry_3d.h"
#include "core/os/keyboard.h"
-#include "core/os/os.h"
namespace core_bind {
diff --git a/core/debugger/local_debugger.cpp b/core/debugger/local_debugger.cpp
index 61d75a6a0d..c9f7d81a90 100644
--- a/core/debugger/local_debugger.cpp
+++ b/core/debugger/local_debugger.cpp
@@ -31,7 +31,6 @@
#include "local_debugger.h"
#include "core/debugger/script_debugger.h"
-#include "core/os/os.h"
#include "scene/main/scene_tree.h"
struct LocalDebugger::ScriptsProfiler {
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp
index 3df4db9c5e..c29316c089 100644
--- a/core/object/class_db.cpp
+++ b/core/object/class_db.cpp
@@ -1007,20 +1007,30 @@ bool ClassDB::get_signal(const StringName &p_class, const StringName &p_signal,
return false;
}
-void ClassDB::add_property_group(const StringName &p_class, const String &p_name, const String &p_prefix) {
+void ClassDB::add_property_group(const StringName &p_class, const String &p_name, const String &p_prefix, int p_indent_depth) {
OBJTYPE_WLOCK;
ClassInfo *type = classes.getptr(p_class);
ERR_FAIL_COND(!type);
- type->property_list.push_back(PropertyInfo(Variant::NIL, p_name, PROPERTY_HINT_NONE, p_prefix, PROPERTY_USAGE_GROUP));
+ String prefix = p_prefix;
+ if (p_indent_depth > 0) {
+ prefix = vformat("%s,%d", p_prefix, p_indent_depth);
+ }
+
+ type->property_list.push_back(PropertyInfo(Variant::NIL, p_name, PROPERTY_HINT_NONE, prefix, PROPERTY_USAGE_GROUP));
}
-void ClassDB::add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix) {
+void ClassDB::add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix, int p_indent_depth) {
OBJTYPE_WLOCK;
ClassInfo *type = classes.getptr(p_class);
ERR_FAIL_COND(!type);
- type->property_list.push_back(PropertyInfo(Variant::NIL, p_name, PROPERTY_HINT_NONE, p_prefix, PROPERTY_USAGE_SUBGROUP));
+ String prefix = p_prefix;
+ if (p_indent_depth > 0) {
+ prefix = vformat("%s,%d", p_prefix, p_indent_depth);
+ }
+
+ type->property_list.push_back(PropertyInfo(Variant::NIL, p_name, PROPERTY_HINT_NONE, prefix, PROPERTY_USAGE_SUBGROUP));
}
void ClassDB::add_property_array_count(const StringName &p_class, const String &p_label, const StringName &p_count_property, const StringName &p_count_setter, const StringName &p_count_getter, const String &p_array_element_prefix, uint32_t p_count_usage) {
diff --git a/core/object/class_db.h b/core/object/class_db.h
index 5adf1a59a4..5d258a29bf 100644
--- a/core/object/class_db.h
+++ b/core/object/class_db.h
@@ -328,8 +328,8 @@ public:
static bool get_signal(const StringName &p_class, const StringName &p_signal, MethodInfo *r_signal);
static void get_signal_list(const StringName &p_class, List<MethodInfo> *p_signals, bool p_no_inheritance = false);
- static void add_property_group(const StringName &p_class, const String &p_name, const String &p_prefix = "");
- static void add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix = "");
+ static void add_property_group(const StringName &p_class, const String &p_name, const String &p_prefix = "", int p_indent_depth = 0);
+ static void add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix = "", int p_indent_depth = 0);
static void add_property_array_count(const StringName &p_class, const String &p_label, const StringName &p_count_property, const StringName &p_count_setter, const StringName &p_count_getter, const String &p_array_element_prefix, uint32_t p_count_usage = PROPERTY_USAGE_DEFAULT);
static void add_property_array(const StringName &p_class, const StringName &p_path, const String &p_array_element_prefix);
static void add_property(const StringName &p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1);
diff --git a/core/object/object.h b/core/object/object.h
index 1a0a81581d..be360703bc 100644
--- a/core/object/object.h
+++ b/core/object/object.h
@@ -142,7 +142,9 @@ enum PropertyUsageFlags {
#define ADD_PROPERTYI(m_property, m_setter, m_getter, m_index) ::ClassDB::add_property(get_class_static(), m_property, _scs_create(m_setter), _scs_create(m_getter), m_index)
#define ADD_PROPERTY_DEFAULT(m_property, m_default) ::ClassDB::set_property_default_value(get_class_static(), m_property, m_default)
#define ADD_GROUP(m_name, m_prefix) ::ClassDB::add_property_group(get_class_static(), m_name, m_prefix)
+#define ADD_GROUP_INDENT(m_name, m_prefix, m_depth) ::ClassDB::add_property_group(get_class_static(), m_name, m_prefix, m_depth)
#define ADD_SUBGROUP(m_name, m_prefix) ::ClassDB::add_property_subgroup(get_class_static(), m_name, m_prefix)
+#define ADD_SUBGROUP_INDENT(m_name, m_prefix, m_depth) ::ClassDB::add_property_subgroup(get_class_static(), m_name, m_prefix, m_depth)
#define ADD_LINKED_PROPERTY(m_property, m_linked_property) ::ClassDB::add_linked_property(get_class_static(), m_property, m_linked_property)
#define ADD_ARRAY_COUNT(m_label, m_count_property, m_count_property_setter, m_count_property_getter, m_prefix) ClassDB::add_property_array_count(get_class_static(), m_label, m_count_property, _scs_create(m_count_property_setter), _scs_create(m_count_property_getter), m_prefix)
diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp
index 8431ceacf9..410b62068a 100644
--- a/core/os/midi_driver.cpp
+++ b/core/os/midi_driver.cpp
@@ -31,7 +31,6 @@
#include "midi_driver.h"
#include "core/input/input.h"
-#include "core/os/os.h"
uint8_t MIDIDriver::last_received_message = 0x00;
MIDIDriver *MIDIDriver::singleton = nullptr;
diff --git a/core/os/os.h b/core/os/os.h
index 36d85da70b..d3d2a868fa 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -34,7 +34,6 @@
#include "core/config/engine.h"
#include "core/io/image.h"
#include "core/io/logger.h"
-#include "core/os/main_loop.h"
#include "core/string/ustring.h"
#include "core/templates/list.h"
#include "core/templates/vector.h"
diff --git a/core/os/threaded_array_processor.h b/core/os/threaded_array_processor.h
index 48b86cc1a1..935fc7a360 100644
--- a/core/os/threaded_array_processor.h
+++ b/core/os/threaded_array_processor.h
@@ -31,7 +31,6 @@
#ifndef THREADED_ARRAY_PROCESSOR_H
#define THREADED_ARRAY_PROCESSOR_H
-#include "core/os/mutex.h"
#include "core/os/os.h"
#include "core/os/thread.h"
#include "core/os/thread_safe.h"
diff --git a/core/variant/typed_array.h b/core/variant/typed_array.h
index 50411121bc..aadd6fee89 100644
--- a/core/variant/typed_array.h
+++ b/core/variant/typed_array.h
@@ -31,8 +31,10 @@
#ifndef TYPED_ARRAY_H
#define TYPED_ARRAY_H
+#include "core/object/object.h"
#include "core/variant/array.h"
#include "core/variant/method_ptrcall.h"
+#include "core/variant/type_info.h"
#include "core/variant/variant.h"
template <class T>
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index fcfa530388..3d11ed6303 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -1023,6 +1023,13 @@ bool Variant::is_null() const {
}
}
+bool Variant::initialize_ref(Object *p_object) {
+ RefCounted *ref_counted = const_cast<RefCounted *>(static_cast<const RefCounted *>(p_object));
+ if (!ref_counted->init_ref()) {
+ return false;
+ }
+ return true;
+}
void Variant::reference(const Variant &p_variant) {
switch (type) {
case NIL:
diff --git a/core/variant/variant.h b/core/variant/variant.h
index b75882a87c..836a67d942 100644
--- a/core/variant/variant.h
+++ b/core/variant/variant.h
@@ -216,6 +216,7 @@ private:
} _data alignas(8);
void reference(const Variant &p_variant);
+ static bool initialize_ref(Object *p_object);
void _clear_internal();
diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h
index aaafa2f6b6..3696ffae60 100644
--- a/core/variant/variant_internal.h
+++ b/core/variant/variant_internal.h
@@ -111,6 +111,10 @@ public:
}
}
+ _FORCE_INLINE_ static bool initialize_ref(Object *object) {
+ return Variant::initialize_ref(object);
+ }
+
// Atomic types.
_FORCE_INLINE_ static bool *get_bool(Variant *v) { return &v->_data._bool; }
_FORCE_INLINE_ static const bool *get_bool(const Variant *v) { return &v->_data._bool; }
@@ -1430,10 +1434,15 @@ struct VariantTypeConstructor<Object *> {
_FORCE_INLINE_ static void variant_from_type(void *p_variant, void *p_value) {
Variant *variant = reinterpret_cast<Variant *>(p_variant);
VariantInitializer<Object *>::init(variant);
- Object *value = *(reinterpret_cast<Object **>(p_value));
- if (value) {
- VariantInternalAccessor<Object *>::set(variant, value);
- VariantInternalAccessor<ObjectID>::set(variant, value->get_instance_id());
+ Object *object = *(reinterpret_cast<Object **>(p_value));
+ if (object) {
+ if (object->is_ref_counted()) {
+ if (!VariantInternal::initialize_ref(object)) {
+ return;
+ }
+ }
+ VariantInternalAccessor<Object *>::set(variant, object);
+ VariantInternalAccessor<ObjectID>::set(variant, object->get_instance_id());
}
}
diff --git a/doc/classes/ArrayOccluder3D.xml b/doc/classes/ArrayOccluder3D.xml
index 993393cf50..cb682a7e62 100644
--- a/doc/classes/ArrayOccluder3D.xml
+++ b/doc/classes/ArrayOccluder3D.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ArrayOccluder3D" inherits="Occluder3D" version="4.0">
<brief_description>
+ 3D polygon shape for use with occlusion culling in [OccluderInstance3D].
</brief_description>
<description>
+ [ArrayOccluder3D] stores an arbitrary 3D polygon shape that can be used by the engine's occlusion culling system. This is analogous to [ArrayMesh], but for occluders.
+ See [OccluderInstance3D]'s documentation for instructions on setting up occlusion culling.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/AudioStreamPlayer2D.xml b/doc/classes/AudioStreamPlayer2D.xml
index 0ad161a6fe..30e23820cf 100644
--- a/doc/classes/AudioStreamPlayer2D.xml
+++ b/doc/classes/AudioStreamPlayer2D.xml
@@ -47,7 +47,7 @@
</methods>
<members>
<member name="area_mask" type="int" setter="set_area_mask" getter="get_area_mask" default="1">
- Areas in which this sound plays.
+ Determines which [Area2D] layers affect the sound for reverb and audio bus effects. Areas can be used to redirect [AudioStream]s so that they play in a certain audio bus. An example of how you might use this is making a "water" area so that sounds played in the water are redirected through an audio bus to make them sound like they are being played underwater.
</member>
<member name="attenuation" type="float" setter="set_attenuation" getter="get_attenuation" default="1.0">
Dampens audio over distance with this as an exponent.
diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml
index ce8a6693db..52f9e23d98 100644
--- a/doc/classes/AudioStreamPlayer3D.xml
+++ b/doc/classes/AudioStreamPlayer3D.xml
@@ -48,7 +48,7 @@
</methods>
<members>
<member name="area_mask" type="int" setter="set_area_mask" getter="get_area_mask" default="1">
- Areas in which this sound plays.
+ Determines which [Area3D] layers affect the sound for reverb and audio bus effects. Areas can be used to redirect [AudioStream]s so that they play in a certain audio bus. An example of how you might use this is making a "water" area so that sounds played in the water are redirected through an audio bus to make them sound like they are being played underwater.
</member>
<member name="attenuation_filter_cutoff_hz" type="float" setter="set_attenuation_filter_cutoff_hz" getter="get_attenuation_filter_cutoff_hz" default="5000.0">
Dampens audio using a low-pass filter above this frequency, in Hz. To disable the dampening effect entirely, set this to [code]20500[/code] as this frequency is above the human hearing limit.
diff --git a/doc/classes/BoxOccluder3D.xml b/doc/classes/BoxOccluder3D.xml
index 8c3b597193..d16cf55098 100644
--- a/doc/classes/BoxOccluder3D.xml
+++ b/doc/classes/BoxOccluder3D.xml
@@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="BoxOccluder3D" inherits="Occluder3D" version="4.0">
<brief_description>
+ Cuboid shape for use with occlusion culling in [OccluderInstance3D].
</brief_description>
<description>
+ [BoxOccluder3D] stores a cuboid shape that can be used by the engine's occlusion culling system.
+ See [OccluderInstance3D]'s documentation for instructions on setting up occlusion culling.
</description>
<tutorials>
</tutorials>
<members>
<member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(1, 1, 1)">
+ The box's size in 3D units.
</member>
</members>
</class>
diff --git a/doc/classes/Container.xml b/doc/classes/Container.xml
index 83655425fc..076a800e29 100644
--- a/doc/classes/Container.xml
+++ b/doc/classes/Container.xml
@@ -10,6 +10,20 @@
<tutorials>
</tutorials>
<methods>
+ <method name="_get_allowed_size_flags_horizontal" qualifiers="virtual const">
+ <return type="PackedInt32Array" />
+ <description>
+ Implement to return a list of allowed horizontal [enum Control.SizeFlags] for child nodes. This doesn't technically prevent the usages of any other size flags, if your implementation requires that. This only limits the options available to the user in the inspector dock.
+ [b]Note:[/b] Having no size flags is equal to having [constant Control.SIZE_SHRINK_BEGIN]. As such, this value is always implicitly allowed.
+ </description>
+ </method>
+ <method name="_get_allowed_size_flags_vertical" qualifiers="virtual const">
+ <return type="PackedInt32Array" />
+ <description>
+ Implement to return a list of allowed vertical [enum Control.SizeFlags] for child nodes. This doesn't technically prevent the usages of any other size flags, if your implementation requires that. This only limits the options available to the user in the inspector dock.
+ [b]Note:[/b] Having no size flags is equal to having [constant Control.SIZE_SHRINK_BEGIN]. As such, this value is always implicitly allowed.
+ </description>
+ </method>
<method name="fit_child_in_rect">
<return type="void" />
<argument index="0" name="child" type="Control" />
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index b6c2dac33c..f2d727bb51 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -1278,20 +1278,24 @@
<constant name="PRESET_MODE_KEEP_SIZE" value="3" enum="LayoutPresetMode">
The control's size will not change.
</constant>
+ <constant name="SIZE_SHRINK_BEGIN" value="0" enum="SizeFlags">
+ Tells the parent [Container] to align the node with its start, either the top or the left edge. It is mutually exclusive with [constant SIZE_FILL] and other shrink size flags, but can be used with [constant SIZE_EXPAND] in some containers. Use with [member size_flags_horizontal] and [member size_flags_vertical].
+ [b]Note:[/b] Setting this flag is equal to not having any size flags.
+ </constant>
<constant name="SIZE_FILL" value="1" enum="SizeFlags">
- Tells the parent [Container] to expand the bounds of this node to fill all the available space without pushing any other node. Use with [member size_flags_horizontal] and [member size_flags_vertical].
+ Tells the parent [Container] to expand the bounds of this node to fill all the available space without pushing any other node. It is mutually exclusive with shrink size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="SIZE_EXPAND" value="2" enum="SizeFlags">
Tells the parent [Container] to let this node take all the available space on the axis you flag. If multiple neighboring nodes are set to expand, they'll share the space based on their stretch ratio. See [member size_flags_stretch_ratio]. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="SIZE_EXPAND_FILL" value="3" enum="SizeFlags">
- Sets the node's size flags to both fill and expand. See the 2 constants above for more information.
+ Sets the node's size flags to both fill and expand. See [constant SIZE_FILL] and [constant SIZE_EXPAND] for more information.
</constant>
<constant name="SIZE_SHRINK_CENTER" value="4" enum="SizeFlags">
- Tells the parent [Container] to center the node in itself. It centers the control based on its bounding box, so it doesn't work with the fill or expand size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical].
+ Tells the parent [Container] to center the node in the available space. It is mutually exclusive with [constant SIZE_FILL] and other shrink size flags, but can be used with [constant SIZE_EXPAND] in some containers. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="SIZE_SHRINK_END" value="8" enum="SizeFlags">
- Tells the parent [Container] to align the node with its end, either the bottom or the right edge. It doesn't work with the fill or expand size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical].
+ Tells the parent [Container] to align the node with its end, either the bottom or the right edge. It is mutually exclusive with [constant SIZE_FILL] and other shrink size flags, but can be used with [constant SIZE_EXPAND] in some containers. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="MOUSE_FILTER_STOP" value="0" enum="MouseFilter">
The control will receive mouse button input events through [method _gui_input] if clicked on. And the control will receive the [signal mouse_entered] and [signal mouse_exited] signals. These events are automatically marked as handled, and they will not propagate further to other controls. This also results in blocking signals in other controls.
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index 281c218d0d..d28fd5d817 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -403,8 +403,14 @@
<return type="float" />
<argument index="0" name="screen" type="int" default="-1" />
<description>
- Returns the current refresh rate of the specified screen. If [code]screen[/code] is [code]SCREEN_OF_MAIN_WINDOW[/code] (the default value), a screen with the main window will be used.
- [b]Note:[/b] Returns [code]60.0[/code] if the DisplayServer fails to find the refresh rate for the specified screen. On HTML5, [method screen_get_refresh_rate] will always return [code]60.0[/code] as there is no way to retrieve the refresh rate on that platform.
+ Returns the current refresh rate of the specified screen. If [code]screen[/code] is [constant SCREEN_OF_MAIN_WINDOW] (the default value), a screen with the main window will be used.
+ [b]Note:[/b] Returns [code]-1.0[/code] if the DisplayServer fails to find the refresh rate for the specified screen. On HTML5, [method screen_get_refresh_rate] will always return [code]-1.0[/code] as there is no way to retrieve the refresh rate on that platform.
+ To fallback to a default refresh rate if the method fails, try:
+ [codeblock]
+ var refresh_rate = DisplayServer.screen_get_refresh_rate()
+ if refresh_rate &lt; 0:
+ refresh_rate = 60.0
+ [/codeblock]
</description>
</method>
<method name="screen_get_scale" qualifiers="const">
diff --git a/doc/classes/Occluder3D.xml b/doc/classes/Occluder3D.xml
index 6c6c410bc3..01f009abdb 100644
--- a/doc/classes/Occluder3D.xml
+++ b/doc/classes/Occluder3D.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Occluder3D" inherits="Resource" version="4.0">
<brief_description>
+ Occluder shape resource for use with occlusion culling in [OccluderInstance3D].
</brief_description>
<description>
+ [Occluder3D] stores an occluder shape that can be used by the engine's occlusion culling system.
+ See [OccluderInstance3D]'s documentation for instructions on setting up occlusion culling.
</description>
<tutorials>
</tutorials>
@@ -10,11 +13,13 @@
<method name="get_indices" qualifiers="const">
<return type="PackedInt32Array" />
<description>
+ Returns the occluder shape's vertex indices.
</description>
</method>
<method name="get_vertices" qualifiers="const">
<return type="PackedVector3Array" />
<description>
+ Returns the occluder shape's vertex positions.
</description>
</method>
</methods>
diff --git a/doc/classes/OccluderInstance3D.xml b/doc/classes/OccluderInstance3D.xml
index 32e48f9a70..0b5fc0fd26 100644
--- a/doc/classes/OccluderInstance3D.xml
+++ b/doc/classes/OccluderInstance3D.xml
@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="OccluderInstance3D" inherits="Node3D" version="4.0">
<brief_description>
+ Provides occlusion culling for 3D nodes, which improves performance in closed areas.
</brief_description>
<description>
+ Occlusion culling can improve rendering performance in closed/semi-open areas by hiding geometry that is occluded by other objects.
+ The occlusion culling system is mostly static. [OccluderInstance3D]s can be moved or hidden at run-time, but doing so will trigger a background recomputation that can take several frames. It is recommended to only move [OccluderInstance3D]s sporadically (e.g. for procedural generation purposes), rather than doing so every frame.
+ The occlusion culling system works by rendering the occluders on the CPU in parallel using [url=https://www.embree.org/]Embree[/url], drawing the result to a low-resolution buffer then using this to cull 3D nodes individually. In the 3D editor, you can preview the occlusion culling buffer by choosing [b]Perspective &gt; Debug Advanced... &gt; Occlusion Culling Buffer[/b] in the top-left corner of the 3D viewport. The occlusion culling buffer quality can be adjusted in the Project Settings.
+ [b]Baking:[/b] Select an [OccluderInstance3D] node, then use the [b]Bake Occluders[/b] button at the top of the 3D editor. Only opaque materials will be taken into account; transparent materials (alpha-blended or alpha-tested) will be ignored by the occluder generation.
+ [b]Note:[/b] Occlusion culling is only effective if [member ProjectSettings.rendering/occlusion_culling/use_occlusion_culling] is [code]true[/code]. Enabling occlusion culling has a cost on the CPU. Only enable occlusion culling if you actually plan to use it. Large open scenes with few or no objects blocking the view will generally not benefit much from occlusion culling. Large open scenes generally benefit more from mesh LOD and visibility ranges ([member GeometryInstance3D.visibility_range_begin] and [member GeometryInstance3D.visibility_range_end]) compared to occlusion culling.
</description>
<tutorials>
</tutorials>
@@ -11,7 +17,7 @@
<return type="bool" />
<argument index="0" name="layer_number" type="int" />
<description>
- Returns whether or not the specified layer of the [member bake_mask] is enabled, given a [code]layer_number[/code] between 1 and 20.
+ Returns whether or not the specified layer of the [member bake_mask] is enabled, given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="set_bake_mask_value">
@@ -19,16 +25,25 @@
<argument index="0" name="layer_number" type="int" />
<argument index="1" name="value" type="bool" />
<description>
- Based on [code]value[/code], enables or disables the specified layer in the [member bake_mask], given a [code]layer_number[/code] between 1 and 20.
+ Based on [code]value[/code], enables or disables the specified layer in the [member bake_mask], given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
</methods>
<members>
<member name="bake_mask" type="int" setter="set_bake_mask" getter="get_bake_mask" default="4294967295">
+ The visual layers to account for when baking for occluders. Only [MeshInstance3D]s whose [member VisualInstance3D.layers] match with this [member bake_mask] will be included in the generated occluder mesh. By default, all objects are taken into account for the occluder baking.
+ To improve performance and avoid artifacts, it is recommended to exclude dynamic objects, small objects and fixtures from the baking process by moving them to a separate visual layer and excluding this layer in [member bake_mask].
</member>
<member name="bake_simplification_distance" type="float" setter="set_bake_simplification_distance" getter="get_bake_simplification_distance" default="0.1">
+ The simplification distance to use for simplifying the generated occluder polygon (in 3D units). Higher values result in a less detailed occluder mesh, which improves performance but reduces culling accuracy.
+ The occluder geometry is rendered on the CPU, so it is important to keep its geometry as simple as possible. Since the buffer is rendered at a low resolution, less detailed occluder meshes generally still work well. The default value is fairly aggressive, so you may have to decrase it if you run into false negatives (objects being occluded even though they are visible by the camera). A value of [code]0.01[/code] will act conservatively, and will keep geometry [i]perceptually[/i] unaffected in the occlusion culling buffer. Depending on the scene, a value of [code]0.01[/code] may still simplify the mesh noticeably compared to disabling simplification entirely.
+ Setting this to [code]0.0[/code] disables simplification entirely, but vertices in the exact same position will still be merged. The mesh will also be re-indexed to reduce both the number of vertices and indices.
+ [b]Note:[/b] This uses the [url=https://meshoptimizer.org/]meshoptimizer[/url] library under the hood, similar to LOD generation.
</member>
<member name="occluder" type="Occluder3D" setter="set_occluder" getter="get_occluder">
+ The occluder resource for this [OccluderInstance3D]. You can generate an occluder resource by selecting an [OccluderInstance3D] node then using the [b]Bake Occluders[/b] button at the top of the editor.
+ You can also draw your own 2D occluder polygon by adding a new [PolygonOccluder3D] resource to the [member occluder] property in the inspector.
+ Alternatively, you can select a primitive occluder to use: [QuadOccluder3D], [BoxOccluder3D] or [SphereOccluder3D].
</member>
</members>
</class>
diff --git a/doc/classes/PolygonOccluder3D.xml b/doc/classes/PolygonOccluder3D.xml
index a4d910c983..e4bd84beac 100644
--- a/doc/classes/PolygonOccluder3D.xml
+++ b/doc/classes/PolygonOccluder3D.xml
@@ -1,13 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PolygonOccluder3D" inherits="Occluder3D" version="4.0">
<brief_description>
+ Flat 2D polygon shape for use with occlusion culling in [OccluderInstance3D].
</brief_description>
<description>
+ [PolygonOccluder3D] stores a polygon shape that can be used by the engine's occlusion culling system. When an [OccluderInstance3D] with a [PolygonOccluder3D] is selected in the editor, an editor will appear at the top of the 3D viewport so you can add/remove points. All points must be placed on the same 2D plane, which means it is not possible to create arbitrary 3D shapes with a single [PolygonOccluder3D]. To use arbitrary 3D shapes as occluders, use [ArrayOccluder3D] or [OccluderInstance3D]'s baking feature instead.
+ See [OccluderInstance3D]'s documentation for instructions on setting up occlusion culling.
</description>
<tutorials>
</tutorials>
<members>
<member name="polygon" type="PackedVector2Array" setter="set_polygon" getter="get_polygon" default="PackedVector2Array()">
+ The polygon to use for occlusion culling. The polygon can be convex or concave, but it should have as few points as possible to maximize performance.
+ The polygon must [i]not[/i] have intersecting lines. Otherwise, triangulation will fail (with an error message printed).
</member>
</members>
</class>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index ff25dcee22..4b5f7b2091 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -1746,10 +1746,14 @@
[b]Note:[/b] This property is only read when the project starts. To adjust the automatic LOD threshold at runtime, set [member Viewport.mesh_lod_threshold] on the root [Viewport].
</member>
<member name="rendering/occlusion_culling/bvh_build_quality" type="int" setter="" getter="" default="2">
+ The [url=https://en.wikipedia.org/wiki/Bounding_volume_hierarchy]BVH[/url] quality to use when rendering the occlusion culling buffer. Higher values will result in more accurate occlusion culling, at the cost of higher CPU usage.
</member>
<member name="rendering/occlusion_culling/occlusion_rays_per_thread" type="int" setter="" getter="" default="512">
+ Higher values will result in more accurate occlusion culling, at the cost of higher CPU usage. The occlusion culling buffer's pixel count is roughly equal to [code]occlusion_rays_per_thread * number_of_logical_cpu_cores[/code], so it will depend on the system's CPU. Therefore, CPUs with fewer cores will use a lower resolution to attempt keeping performance costs even across devices.
</member>
<member name="rendering/occlusion_culling/use_occlusion_culling" type="bool" setter="" getter="" default="false">
+ If [code]true[/code], [OccluderInstance3D] nodes will be usable for occlusion culling in 3D in the root viewport. In custom viewports, [member Viewport.use_occlusion_culling] must be set to [code]true[/code] instead.
+ [b]Note:[/b] Enabling occlusion culling has a cost on the CPU. Only enable occlusion culling if you actually plan to use it. Large open scenes with few or no objects blocking the view will generally not benefit much from occlusion culling. Large open scenes generally benefit more from mesh LOD and visibility ranges ([member GeometryInstance3D.visibility_range_begin] and [member GeometryInstance3D.visibility_range_end]) compared to occlusion culling.
</member>
<member name="rendering/reflections/reflection_atlas/reflection_count" type="int" setter="" getter="" default="64">
Number of cubemaps to store in the reflection atlas. The number of [ReflectionProbe]s in a scene will be limited by this amount. A higher number requires more VRAM.
diff --git a/doc/classes/QuadOccluder3D.xml b/doc/classes/QuadOccluder3D.xml
index c1b89149f5..44cbfb88ff 100644
--- a/doc/classes/QuadOccluder3D.xml
+++ b/doc/classes/QuadOccluder3D.xml
@@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="QuadOccluder3D" inherits="Occluder3D" version="4.0">
<brief_description>
+ Flat plane shape for use with occlusion culling in [OccluderInstance3D].
</brief_description>
<description>
+ [QuadOccluder3D] stores a flat plane shape that can be used by the engine's occlusion culling system. See also [PolygonOccluder3D] if you need to customize the quad's shape.
+ See [OccluderInstance3D]'s documentation for instructions on setting up occlusion culling.
</description>
<tutorials>
</tutorials>
<members>
<member name="size" type="Vector2" setter="set_size" getter="get_size" default="Vector2(1, 1)">
+ The quad's size in 3D units.
</member>
</members>
</class>
diff --git a/doc/classes/SphereOccluder3D.xml b/doc/classes/SphereOccluder3D.xml
index 1ffa51e170..da847cc43f 100644
--- a/doc/classes/SphereOccluder3D.xml
+++ b/doc/classes/SphereOccluder3D.xml
@@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="SphereOccluder3D" inherits="Occluder3D" version="4.0">
<brief_description>
+ Spherical shape for use with occlusion culling in [OccluderInstance3D].
</brief_description>
<description>
+ [SphereOccluder3D] stores a sphere shape that can be used by the engine's occlusion culling system.
+ See [OccluderInstance3D]'s documentation for instructions on setting up occlusion culling.
</description>
<tutorials>
</tutorials>
<members>
<member name="radius" type="float" setter="set_radius" getter="get_radius" default="1.0">
+ The sphere's radius in 3D units.
</member>
</members>
</class>
diff --git a/doc/classes/Theme.xml b/doc/classes/Theme.xml
index b1367be263..f2775e60f3 100644
--- a/doc/classes/Theme.xml
+++ b/doc/classes/Theme.xml
@@ -13,6 +13,14 @@
<link title="Using the theme editor">$DOCS_URL/tutorials/ui/gui_using_theme_editor.html</link>
</tutorials>
<methods>
+ <method name="add_type">
+ <return type="void" />
+ <argument index="0" name="theme_type" type="StringName" />
+ <description>
+ Adds an empty theme type for every valid data type.
+ [b]Note:[/b] Empty types are not saved with the theme. This method only exists to perform in-memory changes to the resource. Use available [code]set_*[/code] methods to add theme items.
+ </description>
+ </method>
<method name="clear">
<return type="void" />
<description>
@@ -375,6 +383,13 @@
[b]Note:[/b] This modifies the current theme. If you want to merge two themes together without modifying either one, create a new empty theme and merge the other two into it one after another.
</description>
</method>
+ <method name="remove_type">
+ <return type="void" />
+ <argument index="0" name="theme_type" type="StringName" />
+ <description>
+ Removes the theme type, gracefully discarding defined theme items. If the type is a variation, this information is also erased. If the type is a base for type variations, those variations lose their base.
+ </description>
+ </method>
<method name="rename_color">
<return type="void" />
<argument index="0" name="old_name" type="StringName" />
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index e1dc97240a..93c1e8417b 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -285,6 +285,8 @@
<member name="use_debanding" type="bool" setter="set_use_debanding" getter="is_using_debanding" default="false">
</member>
<member name="use_occlusion_culling" type="bool" setter="set_use_occlusion_culling" getter="is_using_occlusion_culling" default="false">
+ If [code]true[/code], [OccluderInstance3D] nodes will be usable for occlusion culling in 3D for this viewport. For the root viewport, [member ProjectSettings.rendering/occlusion_culling/use_occlusion_culling] must be set to [code]true[/code] instead.
+ [b]Note:[/b] Enabling occlusion culling has a cost on the CPU. Only enable occlusion culling if you actually plan to use it, and think whether your scene can actually benefit from occlusion culling. Large, open scenes with few or no objects blocking the view will generally not benefit much from occlusion culling. Large open scenes generally benefit more from mesh LOD and visibility ranges ([member GeometryInstance3D.visibility_range_begin] and [member GeometryInstance3D.visibility_range_end]) compared to occlusion culling.
</member>
<member name="use_xr" type="bool" setter="set_use_xr" getter="is_using_xr" default="false">
If [code]true[/code], the viewport will use the primary XR interface to render XR output. When applicable this can result in a stereoscopic image and the resulting render being output to a headset.
diff --git a/doc/translations/extract.py b/doc/translations/extract.py
index 1295495392..5708e0072d 100644
--- a/doc/translations/extract.py
+++ b/doc/translations/extract.py
@@ -222,12 +222,14 @@ def _make_translation_catalog(classes):
desc_list = classes[class_name]
for elem in desc_list.doc.iter():
if elem.tag in EXTRACT_TAGS:
- if not elem.text or len(elem.text) == 0:
+ elem_text = elem.text
+ if elem.tag == "link":
+ elem_text = elem.attrib["title"] if "title" in elem.attrib else ""
+ if not elem_text or len(elem_text) == 0:
continue
- if elem.tag == "link" and "$DOCS_URL" in elem.text: # No need to localize.
- continue
- line_no = elem._start_line_number if elem.text[0] != "\n" else elem._start_line_number + 1
- desc_str = elem.text.strip()
+
+ line_no = elem._start_line_number if elem_text[0] != "\n" else elem._start_line_number + 1
+ desc_str = elem_text.strip()
code_block_regions = _make_codeblock_regions(desc_str, desc_list.path)
desc_msg = _strip_and_split_desc(desc_str, code_block_regions)
desc_obj = Desc(line_no, desc_msg, desc_list)
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index 71c76f57cf..2b407ecacf 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -33,6 +33,7 @@
#include "core/os/keyboard.h"
#include "editor/editor_scale.h"
#include "scene/gui/center_container.h"
+#include "scene/gui/separator.h"
/////////////////////////////////////////
diff --git a/editor/action_map_editor.h b/editor/action_map_editor.h
index e61d1a334a..9988cd8db6 100644
--- a/editor/action_map_editor.h
+++ b/editor/action_map_editor.h
@@ -32,7 +32,7 @@
#define ACTION_MAP_EDITOR_H
#include "editor/editor_data.h"
-#include <scene/gui/color_rect.h>
+#include "scene/gui/color_rect.h"
// Confirmation Dialog used when configuring an input event.
// Separate from ActionMapEditor for code cleanliness and separation of responsibilities.
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index 67cdba043a..40b5de2ec7 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -31,7 +31,7 @@
#include "animation_bezier_editor.h"
#include "editor/editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_scale.h"
#include "scene/gui/view_panner.h"
#include "scene/resources/text_line.h"
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index de924e84dc..961eb907bb 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -33,9 +33,9 @@
#include "animation_track_editor_plugins.h"
#include "core/input/input.h"
#include "editor/animation_bezier_editor.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#include "editor/plugins/animation_player_editor_plugin.h"
-#include "editor_node.h"
-#include "editor_scale.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/view_panner.h"
#include "scene/main/window.h"
@@ -4952,7 +4952,7 @@ void AnimationTrackEditor::_add_method_key(const String &p_method) {
EditorNode::get_singleton()->show_warning(TTR("Method not found in object: ") + p_method);
}
-void AnimationTrackEditor::_key_selected(int p_track, int p_key, bool p_single) {
+void AnimationTrackEditor::_key_selected(int p_key, bool p_single, int p_track) {
ERR_FAIL_INDEX(p_track, animation->get_track_count());
ERR_FAIL_INDEX(p_key, animation->track_get_key_count(p_track));
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index edba784310..d0029ff80f 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -37,7 +37,6 @@
#include "editor/property_selector.h"
#include "scene/gui/control.h"
-#include "scene/gui/file_dialog.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/scroll_bar.h"
#include "scene/gui/slider.h"
@@ -406,7 +405,7 @@ class AnimationTrackEditor : public VBoxContainer {
Map<SelectedKey, KeyInfo> selection;
- void _key_selected(int p_track, int p_key, bool p_single);
+ void _key_selected(int p_key, bool p_single, int p_track);
void _key_deselected(int p_key, int p_track);
bool moving_selection;
diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp
index 058e59dea3..e87678a51b 100644
--- a/editor/animation_track_editor_plugins.cpp
+++ b/editor/animation_track_editor_plugins.cpp
@@ -31,8 +31,8 @@
#include "animation_track_editor_plugins.h"
#include "editor/audio_stream_preview.h"
-#include "editor_resource_preview.h"
-#include "editor_scale.h"
+#include "editor/editor_resource_preview.h"
+#include "editor/editor_scale.h"
#include "scene/2d/animated_sprite_2d.h"
#include "scene/2d/sprite_2d.h"
#include "scene/3d/sprite_3d.h"
diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp
index 6be8a7e564..58527ee4d1 100644
--- a/editor/array_property_edit.cpp
+++ b/editor/array_property_edit.cpp
@@ -31,7 +31,7 @@
#include "array_property_edit.h"
#include "core/io/marshalls.h"
-#include "editor_node.h"
+#include "editor/editor_node.h"
#define ITEMS_PER_PAGE 100
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 2627baaea8..3be6d6ea12 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -34,9 +34,9 @@
#include "core/object/message_queue.h"
#include "core/os/keyboard.h"
#include "core/string/string_builder.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
-#include "editor_node.h"
-#include "editor_settings.h"
+#include "editor/editor_settings.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/separator.h"
#include "scene/resources/font.h"
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 8efcd60210..4d0c5feef2 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -32,9 +32,10 @@
#include "core/string/print_string.h"
#include "editor/doc_tools.h"
-#include "editor_node.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
+#include "editor/scene_tree_dock.h"
#include "plugins/script_editor_plugin.h"
#include "scene/gui/label.h"
#include "scene/gui/popup_menu.h"
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 61ec8abacf..c0c7b68686 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -32,10 +32,10 @@
#include "core/object/class_db.h"
#include "core/os/keyboard.h"
-#include "editor_feature_profile.h"
-#include "editor_node.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
+#include "editor/editor_feature_profile.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const String &p_select_type) {
_fill_type_list();
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index a82c4db191..fe7c89c059 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -31,7 +31,7 @@
#ifndef CREATE_DIALOG_H
#define CREATE_DIALOG_H
-#include "editor_help.h"
+#include "editor/editor_help.h"
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/item_list.h"
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 8702e773f8..681bbf09fe 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -36,6 +36,7 @@
#include "editor/editor_node.h"
#include "editor/plugins/editor_debugger_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
+#include "editor/scene_tree_dock.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/tab_container.h"
diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp
index 41f4db541d..c1fffae404 100644
--- a/editor/debugger/editor_debugger_tree.cpp
+++ b/editor/debugger/editor_debugger_tree.cpp
@@ -30,7 +30,9 @@
#include "editor_debugger_tree.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
+#include "editor/scene_tree_dock.h"
#include "scene/debugger/scene_debugger.h"
#include "scene/resources/packed_scene.h"
#include "servers/display_server.h"
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 28e8edb26e..49f4c2382b 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -41,6 +41,7 @@
#include "editor/debugger/editor_performance_profiler.h"
#include "editor/debugger/editor_profiler.h"
#include "editor/debugger/editor_visual_profiler.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h
index c061e7c61e..1fc295b279 100644
--- a/editor/debugger/script_editor_debugger.h
+++ b/editor/debugger/script_editor_debugger.h
@@ -35,7 +35,6 @@
#include "editor/debugger/editor_debugger_inspector.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/debugger/editor_debugger_server.h"
-#include "editor/editor_file_dialog.h"
#include "scene/gui/button.h"
#include "scene/gui/margin_container.h"
@@ -50,6 +49,7 @@ class TreeItem;
class HSplitContainer;
class ItemList;
class EditorProfiler;
+class EditorFileDialog;
class EditorVisualProfiler;
class EditorNetworkProfiler;
class EditorPerformanceProfiler;
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 1fa5df9396..dc97f53924 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -30,10 +30,13 @@
#include "dependency_editor.h"
+#include "core/config/project_settings.h"
#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_file_system.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#include "scene/gui/margin_container.h"
void DependencyEditor::_searched(const String &p_path) {
diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h
index d50b0849b7..1d2e173bc2 100644
--- a/editor/dependency_editor.h
+++ b/editor/dependency_editor.h
@@ -31,8 +31,8 @@
#ifndef DEPENDENCY_EDITOR_H
#define DEPENDENCY_EDITOR_H
-#include "editor_file_dialog.h"
#include "scene/gui/dialogs.h"
+#include "scene/gui/item_list.h"
#include "scene/gui/tab_container.h"
#include "scene/gui/tree.h"
diff --git a/editor/dictionary_property_edit.cpp b/editor/dictionary_property_edit.cpp
index 30082f2e1a..630265e268 100644
--- a/editor/dictionary_property_edit.cpp
+++ b/editor/dictionary_property_edit.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "dictionary_property_edit.h"
-#include "editor_node.h"
+#include "editor/editor_node.h"
void DictionaryPropertyEdit::_notif_change() {
notify_property_list_changed();
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp
index 4309f55a2b..2eae08e741 100644
--- a/editor/editor_about.cpp
+++ b/editor/editor_about.cpp
@@ -34,7 +34,7 @@
#include "core/donors.gen.h"
#include "core/license.gen.h"
#include "core/version.h"
-#include "editor_node.h"
+#include "editor/editor_node.h"
// The metadata key used to store and retrieve the version text to copy to the clipboard.
static const String META_TEXT_TO_COPY = "text_to_copy";
diff --git a/editor/editor_about.h b/editor/editor_about.h
index e57b211ed4..5a3b1e1987 100644
--- a/editor/editor_about.h
+++ b/editor/editor_about.h
@@ -31,7 +31,6 @@
#ifndef EDITOR_ABOUT_H
#define EDITOR_ABOUT_H
-#include "scene/gui/control.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/item_list.h"
#include "scene/gui/link_button.h"
@@ -43,7 +42,7 @@
#include "scene/gui/texture_rect.h"
#include "scene/gui/tree.h"
-#include "editor_scale.h"
+#include "editor/editor_scale.h"
/**
* NOTE: Do not assume the EditorNode singleton to be available in this class' methods.
diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp
index 76c0811166..3835399c99 100644
--- a/editor/editor_asset_installer.cpp
+++ b/editor/editor_asset_installer.cpp
@@ -33,8 +33,9 @@
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
#include "core/io/zip_io.h"
-#include "editor_node.h"
-#include "progress_dialog.h"
+#include "editor/editor_file_system.h"
+#include "editor/editor_node.h"
+#include "editor/progress_dialog.h"
void EditorAssetInstaller::_item_edited() {
if (updating) {
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 5e4e375db4..d091ca5056 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -30,11 +30,13 @@
#include "editor_audio_buses.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/resource_saver.h"
#include "core/os/keyboard.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#include "filesystem_dock.h"
#include "scene/resources/font.h"
#include "servers/audio_server.h"
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index f856556363..a830a2719d 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -31,8 +31,7 @@
#ifndef EDITORAUDIOBUSES_H
#define EDITORAUDIOBUSES_H
-#include "editor/editor_file_dialog.h"
-#include "editor_plugin.h"
+#include "editor/editor_plugin.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 6d31141be7..a1250ef9f4 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -32,8 +32,9 @@
#include "core/config/project_settings.h"
#include "core/core_constants.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#include "project_settings_editor.h"
#include "scene/main/window.h"
#include "scene/resources/packed_scene.h"
diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h
index 20f6bf476f..135ff48a0c 100644
--- a/editor/editor_autoload_settings.h
+++ b/editor/editor_autoload_settings.h
@@ -31,9 +31,11 @@
#ifndef EDITOR_AUTOLOAD_SETTINGS_H
#define EDITOR_AUTOLOAD_SETTINGS_H
+#include "scene/gui/box_container.h"
+#include "scene/gui/button.h"
#include "scene/gui/tree.h"
-#include "editor_file_dialog.h"
+class EditorFileDialog;
class EditorAutoloadSettings : public VBoxContainer {
GDCLASS(EditorAutoloadSettings, VBoxContainer);
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 625330ef37..ff452f8a96 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -34,8 +34,8 @@
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
-#include "editor_node.h"
-#include "editor_settings.h"
+#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
#include "scene/resources/packed_scene.h"
void EditorHistory::cleanup_history() {
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index 39054b7033..5f5e4f37fd 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -33,8 +33,8 @@
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "editor/editor_file_system.h"
+#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
-#include "editor_scale.h"
#include "servers/display_server.h"
void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p_dir, const String &p_select_path) {
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 632d67c061..eee67693e2 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -44,9 +44,9 @@
#include "core/object/script_language.h"
#include "core/version.h"
#include "editor/editor_file_system.h"
+#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
#include "editor/plugins/script_editor_plugin.h"
-#include "editor_node.h"
-#include "editor_settings.h"
#include "scene/resources/resource_format_text.h"
static int _get_pad(int p_alignment, int p_n) {
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index 2fc29c46af..976c9043d2 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -32,9 +32,10 @@
#include "core/io/dir_access.h"
#include "core/io/json.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
-#include "editor_node.h"
-#include "editor_scale.h"
const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = {
TTRC("3D Editor"),
diff --git a/editor/editor_feature_profile.h b/editor/editor_feature_profile.h
index c5f4ad60f4..7ea40502a6 100644
--- a/editor/editor_feature_profile.h
+++ b/editor/editor_feature_profile.h
@@ -33,8 +33,7 @@
#include "core/io/file_access.h"
#include "core/object/ref_counted.h"
-#include "editor/editor_file_dialog.h"
-#include "editor_help.h"
+#include "editor/editor_help.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/option_button.h"
#include "scene/gui/separator.h"
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index b6d8ea5bd6..74e02609f9 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -30,15 +30,16 @@
#include "editor_file_dialog.h"
+#include "core/config/project_settings.h"
#include "core/io/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
#include "dependency_editor.h"
-#include "editor_file_system.h"
-#include "editor_resource_preview.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
+#include "editor/editor_file_system.h"
+#include "editor/editor_resource_preview.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/gui/center_container.h"
#include "scene/gui/label.h"
#include "scene/gui/margin_container.h"
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 5beed352a6..34a21c90fe 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -38,9 +38,9 @@
#include "core/io/resource_saver.h"
#include "core/os/os.h"
#include "core/variant/variant_parser.h"
-#include "editor_node.h"
-#include "editor_resource_preview.h"
-#include "editor_settings.h"
+#include "editor/editor_node.h"
+#include "editor/editor_resource_preview.h"
+#include "editor/editor_settings.h"
EditorFileSystem *EditorFileSystem::singleton = nullptr;
//the name is the version, to keep compatibility with different versions of Godot
diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp
index 266a064807..8d6ebd1154 100644
--- a/editor/editor_folding.cpp
+++ b/editor/editor_folding.cpp
@@ -31,8 +31,8 @@
#include "editor_folding.h"
#include "core/io/file_access.h"
-#include "editor_inspector.h"
-#include "editor_settings.h"
+#include "editor/editor_inspector.h"
+#include "editor/editor_settings.h"
Vector<String> EditorFolding::_get_unfolds(const Object *p_object) {
Vector<String> sections;
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index 0c9a7b2972..dc84b99d04 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -32,8 +32,8 @@
#include "builtin_fonts.gen.h"
#include "core/io/dir_access.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/resources/default_theme/default_theme.h"
#include "scene/resources/font.h"
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index e80e9c43b0..7d88b94a37 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -35,10 +35,10 @@
#include "core/os/keyboard.h"
#include "core/version_generated.gen.h"
#include "doc_data_compressed.gen.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "editor/plugins/script_editor_plugin.h"
-#include "editor_node.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
#define CONTRIBUTE_URL vformat("%s/community/contributing/updating_the_class_reference.html", VERSION_DOCS_URL)
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index 29bf22a478..aa4688452c 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -31,9 +31,9 @@
#include "editor_help_search.h"
#include "core/os/keyboard.h"
-#include "editor_feature_profile.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_feature_profile.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
void EditorHelpSearch::_update_icons() {
search_box->set_right_icon(results_tree->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 6bdd6a8134..73acea43fd 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -34,10 +34,10 @@
#include "core/os/keyboard.h"
#include "dictionary_property_edit.h"
#include "editor/doc_tools.h"
-#include "editor_feature_profile.h"
-#include "editor_node.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
+#include "editor/editor_feature_profile.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "multi_node_edit.h"
#include "scene/property_utils.h"
#include "scene/resources/packed_scene.h"
@@ -1181,6 +1181,15 @@ void EditorInspectorSection::_notification(int p_what) {
header_height += get_theme_constant(SNAME("vseparation"), SNAME("Tree"));
int inspector_margin = get_theme_constant(SNAME("inspector_margin"), SNAME("Editor"));
+ int section_indent_size = get_theme_constant(SNAME("indent_size"), SNAME("EditorInspectorSection"));
+ if (indent_depth > 0 && section_indent_size > 0) {
+ inspector_margin += indent_depth * section_indent_size;
+ }
+ Ref<StyleBoxFlat> section_indent_style = get_theme_stylebox(SNAME("indent_box"), SNAME("EditorInspectorSection"));
+ if (indent_depth > 0 && section_indent_style.is_valid()) {
+ inspector_margin += section_indent_style->get_margin(SIDE_LEFT) + section_indent_style->get_margin(SIDE_RIGHT);
+ }
+
Size2 size = get_size() - Vector2(inspector_margin, 0);
Vector2 offset = Vector2(is_layout_rtl() ? 0 : inspector_margin, header_height);
for (int i = 0; i < get_child_count(); i++) {
@@ -1216,14 +1225,31 @@ void EditorInspectorSection::_notification(int p_what) {
bool rtl = is_layout_rtl();
- // Compute the height of the section header.
+ // Compute the height and width of the section header.
int header_height = font->get_height(font_size);
if (arrow.is_valid()) {
header_height = MAX(header_height, arrow->get_height());
}
header_height += get_theme_constant(SNAME("vseparation"), SNAME("Tree"));
- Rect2 header_rect = Rect2(Vector2(), Vector2(get_size().width, header_height));
+ int section_indent = 0;
+ int section_indent_size = get_theme_constant(SNAME("indent_size"), SNAME("EditorInspectorSection"));
+ if (indent_depth > 0 && section_indent_size > 0) {
+ section_indent = indent_depth * section_indent_size;
+ }
+ Ref<StyleBoxFlat> section_indent_style = get_theme_stylebox(SNAME("indent_box"), SNAME("EditorInspectorSection"));
+ if (indent_depth > 0 && section_indent_style.is_valid()) {
+ section_indent += section_indent_style->get_margin(SIDE_LEFT) + section_indent_style->get_margin(SIDE_RIGHT);
+ }
+
+ int header_width = get_size().width - section_indent;
+ int header_offset_x = 0.0;
+ if (!rtl) {
+ header_offset_x += section_indent;
+ }
+
+ // Draw header area.
+ Rect2 header_rect = Rect2(Vector2(header_offset_x, 0.0), Vector2(header_width, header_height));
Color c = bg_color;
c.a *= 0.4;
if (foldable && header_rect.has_point(get_local_mouse_position())) {
@@ -1231,24 +1257,46 @@ void EditorInspectorSection::_notification(int p_what) {
}
draw_rect(header_rect, c);
+ // Draw header title and folding arrow.
const int arrow_margin = 2;
const int arrow_width = arrow.is_valid() ? arrow->get_width() : 0;
Color color = get_theme_color(SNAME("font_color"));
- float text_width = get_size().width - Math::round(arrow_width + arrow_margin * EDSCALE);
- draw_string(font, Point2(rtl ? 0 : Math::round(arrow_width + arrow_margin * EDSCALE), font->get_ascent(font_size) + (header_height - font->get_height(font_size)) / 2).floor(), label, rtl ? HORIZONTAL_ALIGNMENT_RIGHT : HORIZONTAL_ALIGNMENT_LEFT, text_width, font_size, color);
+ float text_width = get_size().width - Math::round(arrow_width + arrow_margin * EDSCALE) - section_indent;
+ Point2 text_offset = Point2(0, font->get_ascent(font_size) + (header_height - font->get_height(font_size)) / 2);
+ HorizontalAlignment text_align = HORIZONTAL_ALIGNMENT_LEFT;
+ if (rtl) {
+ text_align = HORIZONTAL_ALIGNMENT_RIGHT;
+ } else {
+ text_offset.x = section_indent + Math::round(arrow_width + arrow_margin * EDSCALE);
+ }
+ draw_string(font, text_offset.floor(), label, text_align, text_width, font_size, color);
if (arrow.is_valid()) {
+ Point2 arrow_position = Point2(0, (header_height - arrow->get_height()) / 2);
if (rtl) {
- draw_texture(arrow, Point2(get_size().width - arrow->get_width() - Math::round(arrow_margin * EDSCALE), (header_height - arrow->get_height()) / 2).floor());
+ arrow_position.x = get_size().width - section_indent - arrow->get_width() - Math::round(arrow_margin * EDSCALE);
} else {
- draw_texture(arrow, Point2(Math::round(arrow_margin * EDSCALE), (header_height - arrow->get_height()) / 2).floor());
+ arrow_position.x = section_indent + Math::round(arrow_margin * EDSCALE);
}
+ draw_texture(arrow, arrow_position.floor());
}
+ // Draw dropping highlight.
if (dropping && !vbox->is_visible_in_tree()) {
Color accent_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
draw_rect(Rect2(Point2(), get_size()), accent_color, false);
}
+
+ // Draw section indentation.
+ if (section_indent_style.is_valid() && section_indent > 0) {
+ Rect2 indent_rect = Rect2(Vector2(), Vector2(indent_depth * section_indent_size, get_size().height));
+ if (rtl) {
+ indent_rect.position.x = get_size().width - section_indent + section_indent_style->get_margin(SIDE_RIGHT);
+ } else {
+ indent_rect.position.x = section_indent_style->get_margin(SIDE_LEFT);
+ }
+ draw_style_box(section_indent_style, indent_rect);
+ }
} break;
case NOTIFICATION_DRAG_BEGIN: {
Dictionary dd = get_viewport()->gui_get_drag_data();
@@ -1311,15 +1359,25 @@ Size2 EditorInspectorSection::get_minimum_size() const {
ms.height += font->get_height(font_size) + get_theme_constant(SNAME("vseparation"), SNAME("Tree"));
ms.width += get_theme_constant(SNAME("inspector_margin"), SNAME("Editor"));
+ int section_indent_size = get_theme_constant(SNAME("indent_size"), SNAME("EditorInspectorSection"));
+ if (indent_depth > 0 && section_indent_size > 0) {
+ ms.width += indent_depth * section_indent_size;
+ }
+ Ref<StyleBoxFlat> section_indent_style = get_theme_stylebox(SNAME("indent_box"), SNAME("EditorInspectorSection"));
+ if (indent_depth > 0 && section_indent_style.is_valid()) {
+ ms.width += section_indent_style->get_margin(SIDE_LEFT) + section_indent_style->get_margin(SIDE_RIGHT);
+ }
+
return ms;
}
-void EditorInspectorSection::setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable) {
+void EditorInspectorSection::setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable, int p_indent_depth) {
section = p_section;
label = p_label;
object = p_object;
bg_color = p_bg_color;
foldable = p_foldable;
+ indent_depth = p_indent_depth;
if (!foldable && !vbox_added) {
add_child(vbox);
@@ -1401,12 +1459,8 @@ void EditorInspectorSection::_bind_methods() {
}
EditorInspectorSection::EditorInspectorSection() {
- object = nullptr;
- foldable = false;
vbox = memnew(VBoxContainer);
- vbox_added = false;
- dropping = false;
dropping_unfold_timer = memnew(Timer);
dropping_unfold_timer->set_wait_time(0.6);
dropping_unfold_timer->set_one_shot(true);
@@ -2004,7 +2058,7 @@ void EditorInspectorArray::setup_with_move_element_function(Object *p_object, St
array_element_prefix = p_array_element_prefix;
page = p_page;
- EditorInspectorSection::setup(String(p_array_element_prefix) + "_array", p_label, p_object, p_bg_color, p_foldable);
+ EditorInspectorSection::setup(String(p_array_element_prefix) + "_array", p_label, p_object, p_bg_color, p_foldable, 0);
_setup();
}
@@ -2015,7 +2069,7 @@ void EditorInspectorArray::setup_with_count_property(Object *p_object, String p_
array_element_prefix = p_array_element_prefix;
page = p_page;
- EditorInspectorSection::setup(String(count_property) + "_array", p_label, p_object, p_bg_color, p_foldable);
+ EditorInspectorSection::setup(String(count_property) + "_array", p_label, p_object, p_bg_color, p_foldable, 0);
_setup();
}
@@ -2376,6 +2430,7 @@ void EditorInspector::update_tree() {
String group_base;
String subgroup;
String subgroup_base;
+ int section_depth = 0;
VBoxContainer *category_vbox = nullptr;
List<PropertyInfo> plist;
@@ -2400,14 +2455,29 @@ void EditorInspector::update_tree() {
if (p.usage & PROPERTY_USAGE_SUBGROUP) {
// Setup a property sub-group.
subgroup = p.name;
- subgroup_base = p.hint_string;
+
+ Vector<String> hint_parts = p.hint_string.split(",");
+ subgroup_base = hint_parts[0];
+ if (hint_parts.size() > 1) {
+ section_depth = hint_parts[1].to_int();
+ } else {
+ section_depth = 0;
+ }
continue;
} else if (p.usage & PROPERTY_USAGE_GROUP) {
// Setup a property group.
group = p.name;
- group_base = p.hint_string;
+
+ Vector<String> hint_parts = p.hint_string.split(",");
+ group_base = hint_parts[0];
+ if (hint_parts.size() > 1) {
+ section_depth = hint_parts[1].to_int();
+ } else {
+ section_depth = 0;
+ }
+
subgroup = "";
subgroup_base = "";
@@ -2419,6 +2489,7 @@ void EditorInspector::update_tree() {
group_base = "";
subgroup = "";
subgroup_base = "";
+ section_depth = 0;
if (!show_categories) {
continue;
@@ -2660,7 +2731,7 @@ void EditorInspector::update_tree() {
Color c = sscolor;
c.a /= level;
- section->setup(acc_path, component, object, c, use_folding);
+ section->setup(acc_path, component, object, c, use_folding, section_depth);
// Add editors at the start of a group.
for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 162d45f8b7..43f71740e3 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -261,17 +261,18 @@ class EditorInspectorSection : public Container {
String label;
String section;
- bool vbox_added; // Optimization.
+ bool vbox_added = false; // Optimization.
Color bg_color;
- bool foldable;
+ bool foldable = false;
+ int indent_depth = 0;
Timer *dropping_unfold_timer;
- bool dropping;
+ bool dropping = false;
void _test_unfold();
protected:
- Object *object;
+ Object *object = nullptr;
VBoxContainer *vbox;
void _notification(int p_what);
@@ -281,7 +282,7 @@ protected:
public:
virtual Size2 get_minimum_size() const override;
- void setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable);
+ void setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable, int p_indent_depth = 0);
VBoxContainer *get_vbox();
void unfold();
void fold();
diff --git a/editor/editor_locale_dialog.cpp b/editor/editor_locale_dialog.cpp
index 48a326d6d4..abef0dc353 100644
--- a/editor/editor_locale_dialog.cpp
+++ b/editor/editor_locale_dialog.cpp
@@ -30,6 +30,7 @@
#include "editor_locale_dialog.h"
+#include "core/config/project_settings.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/gui/check_button.h"
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index db4de3bed0..45d7f8d697 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -32,8 +32,8 @@
#include "core/os/keyboard.h"
#include "core/version.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#include "scene/gui/center_container.h"
#include "scene/resources/font.h"
diff --git a/editor/editor_log.h b/editor/editor_log.h
index 69a6a0b449..e66b732ffe 100644
--- a/editor/editor_log.h
+++ b/editor/editor_log.h
@@ -34,7 +34,6 @@
#include "core/os/thread.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
-#include "scene/gui/control.h"
#include "scene/gui/label.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/panel_container.h"
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 4b2f1c5104..28da588a06 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -76,9 +76,12 @@
#include "editor/editor_about.h"
#include "editor/editor_audio_buses.h"
#include "editor/editor_command_palette.h"
+#include "editor/editor_data.h"
#include "editor/editor_export.h"
#include "editor/editor_feature_profile.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_file_system.h"
+#include "editor/editor_folding.h"
#include "editor/editor_help.h"
#include "editor/editor_inspector.h"
#include "editor/editor_layouts_dialog.h"
@@ -88,6 +91,7 @@
#include "editor/editor_properties.h"
#include "editor/editor_resource_picker.h"
#include "editor/editor_resource_preview.h"
+#include "editor/editor_run.h"
#include "editor/editor_run_native.h"
#include "editor/editor_run_script.h"
#include "editor/editor_scale.h"
@@ -132,6 +136,7 @@
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/plugins/collision_polygon_2d_editor_plugin.h"
#include "editor/plugins/collision_shape_2d_editor_plugin.h"
+#include "editor/plugins/control_editor_plugin.h"
#include "editor/plugins/cpu_particles_2d_editor_plugin.h"
#include "editor/plugins/cpu_particles_3d_editor_plugin.h"
#include "editor/plugins/curve_editor_plugin.h"
@@ -192,6 +197,7 @@
#include "editor/project_settings_editor.h"
#include "editor/quick_open.h"
#include "editor/register_exporters.h"
+#include "editor/scene_tree_dock.h"
#include <stdio.h>
#include <stdlib.h>
@@ -7024,6 +7030,7 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(InputEventEditorPlugin(this)));
add_editor_plugin(memnew(SubViewportPreviewEditorPlugin(this)));
add_editor_plugin(memnew(TextControlEditorPlugin(this)));
+ add_editor_plugin(memnew(ControlEditorPlugin(this)));
for (int i = 0; i < EditorPlugins::get_plugin_count(); i++) {
add_editor_plugin(EditorPlugins::create(i, this));
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 8d322a1bfd..c05e6cd281 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -32,16 +32,12 @@
#define EDITOR_NODE_H
#include "core/templates/safe_refcount.h"
-#include "editor/editor_data.h"
#include "editor/editor_export.h"
#include "editor/editor_folding.h"
#include "editor/editor_native_shader_source_visualizer.h"
#include "editor/editor_run.h"
-#include "editor/editor_toaster.h"
#include "editor/inspector_dock.h"
#include "editor/property_editor.h"
-#include "editor/scene_tree_dock.h"
-#include "scene/gui/link_button.h"
typedef void (*EditorNodeInitCallback)();
typedef void (*EditorPluginInitializeCallback)();
@@ -50,16 +46,20 @@ typedef bool (*EditorBuildCallback)();
class AcceptDialog;
class AudioStreamPreviewGenerator;
class BackgroundProgress;
+class Button;
class CenterContainer;
class ConfirmationDialog;
class Control;
class DependencyEditor;
class DependencyErrorDialog;
+class DynamicFontImportSettings;
class EditorAbout;
class EditorCommandPalette;
class EditorExport;
+class EditorExtensionManager;
class EditorFeatureProfileManager;
class EditorFileServer;
+class EditorFolding;
class EditorInspector;
class EditorLayoutsDialog;
class EditorLog;
@@ -67,12 +67,16 @@ class EditorPlugin;
class EditorPluginList;
class EditorQuickOpen;
class EditorResourcePreview;
+class EditorRun;
class EditorRunNative;
class EditorSettingsDialog;
+class EditorToaster;
class ExportTemplateManager;
+class FileDialog;
class FileSystemDock;
class HSplitContainer;
class ImportDock;
+class LinkButton;
class MenuButton;
class NodeDock;
class OrphanResourcesDialog;
@@ -83,17 +87,14 @@ class ProgressDialog;
class ProjectExportDialog;
class ProjectSettingsEditor;
class RunSettingsDialog;
+class SceneImportSettings;
class ScriptCreateDialog;
-class TabContainer;
+class SubViewport;
class TabBar;
+class TabContainer;
class TextureProgressBar;
-class Button;
class VSplitContainer;
class Window;
-class SubViewport;
-class SceneImportSettings;
-class EditorExtensionManager;
-class DynamicFontImportSettings;
class EditorNode : public Node {
GDCLASS(EditorNode, Node);
diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp
index 3dee06fb3e..716f10c679 100644
--- a/editor/editor_path.cpp
+++ b/editor/editor_path.cpp
@@ -30,8 +30,8 @@
#include "editor_path.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
void EditorPath::_add_children_to_popup(Object *p_obj, int p_depth) {
if (p_depth > 8) {
diff --git a/editor/editor_path.h b/editor/editor_path.h
index ad8443534d..04cf3d2ca7 100644
--- a/editor/editor_path.h
+++ b/editor/editor_path.h
@@ -31,7 +31,7 @@
#ifndef EDITOR_PATH_H
#define EDITOR_PATH_H
-#include "editor_data.h"
+#include "editor/editor_data.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/popup_menu.h"
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index fe44486d0d..24ce9e2636 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -34,10 +34,11 @@
#include "editor/editor_export.h"
#include "editor/editor_node.h"
#include "editor/editor_paths.h"
+#include "editor/editor_resource_preview.h"
#include "editor/editor_settings.h"
#include "editor/filesystem_dock.h"
#include "editor/project_settings_editor.h"
-#include "editor_resource_preview.h"
+#include "editor/scene_tree_dock.h"
#include "main/main.h"
#include "plugins/canvas_item_editor_plugin.h"
#include "plugins/node_3d_editor_plugin.h"
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index 80329a36b2..aa59337ac0 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -34,8 +34,8 @@
#include "core/io/config_file.h"
#include "core/io/file_access.h"
#include "core/os/main_loop.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#include "scene/gui/margin_container.h"
void EditorPluginSettings::_notification(int p_what) {
diff --git a/editor/editor_plugin_settings.h b/editor/editor_plugin_settings.h
index 8ff6e4b9e1..4648d105f7 100644
--- a/editor/editor_plugin_settings.h
+++ b/editor/editor_plugin_settings.h
@@ -32,8 +32,8 @@
#define EDITORPLUGINSETTINGS_H
#include "core/object/undo_redo.h"
+#include "editor/editor_data.h"
#include "editor/plugin_config_dialog.h"
-#include "editor_data.h"
#include "property_editor.h"
#include "scene/gui/dialogs.h"
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index ef1ceebabf..65c4ace468 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -30,11 +30,13 @@
#include "editor_properties.h"
+#include "core/config/project_settings.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+#include "editor/editor_properties_array_dict.h"
#include "editor/editor_resource_preview.h"
+#include "editor/editor_scale.h"
#include "editor/filesystem_dock.h"
-#include "editor_node.h"
-#include "editor_properties_array_dict.h"
-#include "editor_scale.h"
#include "scene/2d/gpu_particles_2d.h"
#include "scene/3d/fog_volume.h"
#include "scene/3d/gpu_particles_3d.h"
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index fc0c0e7d7b..162e2192a3 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -33,8 +33,8 @@
#include "core/input/input.h"
#include "core/io/marshalls.h"
#include "editor/editor_node.h"
+#include "editor/editor_properties.h"
#include "editor/editor_scale.h"
-#include "editor_properties.h"
bool EditorPropertyArrayObject::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name;
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index 398a096550..cb6901f130 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -30,11 +30,13 @@
#include "editor_resource_picker.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_resource_preview.h"
-#include "editor_node.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
-#include "filesystem_dock.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
+#include "editor/filesystem_dock.h"
+#include "editor/scene_tree_dock.h"
HashMap<StringName, List<StringName>> EditorResourcePicker::allowed_types_cache;
diff --git a/editor/editor_resource_picker.h b/editor/editor_resource_picker.h
index 8ffa52f14f..192dca50ca 100644
--- a/editor/editor_resource_picker.h
+++ b/editor/editor_resource_picker.h
@@ -31,13 +31,14 @@
#ifndef EDITOR_RESOURCE_PICKER_H
#define EDITOR_RESOURCE_PICKER_H
-#include "editor_file_dialog.h"
#include "quick_open.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/popup_menu.h"
#include "scene/gui/texture_rect.h"
+class EditorFileDialog;
+
class EditorResourcePicker : public HBoxContainer {
GDCLASS(EditorResourcePicker, HBoxContainer);
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 2d1335270c..8a9ca53567 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -35,9 +35,9 @@
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/object/message_queue.h"
-#include "editor_node.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
bool EditorResourcePreviewGenerator::handles(const String &p_type) const {
bool success;
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 574abf85ea..4743294967 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -32,7 +32,7 @@
#include "core/config/project_settings.h"
#include "editor/editor_node.h"
-#include "editor_settings.h"
+#include "editor/editor_settings.h"
#include "servers/display_server.h"
EditorRun::Status EditorRun::get_status() const {
diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp
index adaeaad6ae..98f315f0db 100644
--- a/editor/editor_run_native.cpp
+++ b/editor/editor_run_native.cpp
@@ -30,9 +30,9 @@
#include "editor_run_native.h"
-#include "editor_export.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_export.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
void EditorRunNative::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
diff --git a/editor/editor_run_script.cpp b/editor/editor_run_script.cpp
index 77173d178b..2197bc8eb7 100644
--- a/editor/editor_run_script.cpp
+++ b/editor/editor_run_script.cpp
@@ -30,7 +30,7 @@
#include "editor_run_script.h"
-#include "editor_node.h"
+#include "editor/editor_node.h"
void EditorScript::add_root_node(Node *p_node) {
if (!editor) {
diff --git a/editor/editor_run_script.h b/editor/editor_run_script.h
index 7fb728a00a..1d2d53f299 100644
--- a/editor/editor_run_script.h
+++ b/editor/editor_run_script.h
@@ -32,7 +32,7 @@
#define EDITOR_RUN_SCRIPT_H
#include "core/object/ref_counted.h"
-#include "editor_plugin.h"
+#include "editor/editor_plugin.h"
class EditorNode;
class EditorScript : public RefCounted {
GDCLASS(EditorScript, RefCounted);
diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp
index 1bab56ac4a..19374f826a 100644
--- a/editor/editor_sectioned_inspector.cpp
+++ b/editor/editor_sectioned_inspector.cpp
@@ -30,7 +30,7 @@
#include "editor_sectioned_inspector.h"
-#include "editor_scale.h"
+#include "editor/editor_scale.h"
class SectionedInspectorFilter : public Object {
GDCLASS(SectionedInspectorFilter, Object);
diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp
index fc37590337..e4ad62c470 100644
--- a/editor/editor_settings_dialog.cpp
+++ b/editor/editor_settings_dialog.cpp
@@ -34,11 +34,11 @@
#include "core/input/input_map.h"
#include "core/os/keyboard.h"
#include "editor/debugger/editor_debugger_node.h"
-#include "editor_file_system.h"
-#include "editor_log.h"
-#include "editor_node.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
+#include "editor/editor_file_system.h"
+#include "editor/editor_log.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/gui/margin_container.h"
void EditorSettingsDialog::ok_pressed() {
diff --git a/editor/editor_settings_dialog.h b/editor/editor_settings_dialog.h
index c8858b4fcb..4b90506b4b 100644
--- a/editor/editor_settings_dialog.h
+++ b/editor/editor_settings_dialog.h
@@ -32,8 +32,8 @@
#define EDITOR_SETTINGS_DIALOG_H
#include "editor/action_map_editor.h"
+#include "editor/editor_inspector.h"
#include "editor/editor_sectioned_inspector.h"
-#include "editor_inspector.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/rich_text_label.h"
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index cd28a65c7b..6a2e40387b 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -33,8 +33,8 @@
#include "core/input/input.h"
#include "core/math/expression.h"
#include "core/os/keyboard.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
String EditorSpinSlider::get_tooltip(const Point2 &p_pos) const {
if (grabber->is_visible()) {
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 54b6aa537f..5808bc2b55 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -33,10 +33,10 @@
#include "core/error/error_macros.h"
#include "core/io/resource_loader.h"
#include "core/variant/dictionary.h"
-#include "editor_fonts.h"
-#include "editor_icons.gen.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
+#include "editor/editor_fonts.h"
+#include "editor/editor_icons.gen.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "modules/modules_enabled.gen.h" // For svg.
#ifdef MODULE_SVG_ENABLED
@@ -466,6 +466,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("font_color", "Editor", font_color);
theme->set_color("highlighted_font_color", "Editor", font_hover_color);
theme->set_color("disabled_font_color", "Editor", font_disabled_color);
+ theme->set_color("readonly_font_color", "Editor", font_readonly_color);
theme->set_color("mono_color", "Editor", mono_color);
@@ -875,9 +876,21 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("readonly_color", "EditorProperty", readonly_color);
theme->set_color("readonly_warning_color", "EditorProperty", readonly_warning_color);
+ Ref<StyleBoxFlat> style_property_group_note = style_default->duplicate();
+ Color property_group_note_color = accent_color;
+ property_group_note_color.a = 0.1;
+ style_property_group_note->set_bg_color(property_group_note_color);
+ theme->set_stylebox("bg_group_note", "EditorProperty", style_property_group_note);
+
Color inspector_section_color = font_color.lerp(Color(0.5, 0.5, 0.5), 0.35);
theme->set_color("font_color", "EditorInspectorSection", inspector_section_color);
+ Color inspector_indent_color = accent_color;
+ inspector_indent_color.a = 0.2;
+ Ref<StyleBoxFlat> inspector_indent_style = make_flat_stylebox(inspector_indent_color, 2.0 * EDSCALE, 0, 2.0 * EDSCALE, 0);
+ theme->set_stylebox("indent_box", "EditorInspectorSection", inspector_indent_style);
+ theme->set_constant("indent_size", "EditorInspectorSection", 6.0 * EDSCALE);
+
theme->set_constant("inspector_margin", "Editor", 12 * EDSCALE);
// Tree & ItemList background
diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp
index 24227b3a6b..121d1256dc 100644
--- a/editor/editor_toaster.cpp
+++ b/editor/editor_toaster.cpp
@@ -28,13 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "editor_toaster.h"
+
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "scene/gui/button.h"
#include "scene/gui/label.h"
#include "scene/gui/panel_container.h"
-#include "editor_toaster.h"
-
EditorToaster *EditorToaster::singleton = nullptr;
void EditorToaster::_notification(int p_what) {
diff --git a/editor/editor_toaster.h b/editor/editor_toaster.h
index 5f220e98c4..2ad8752bee 100644
--- a/editor/editor_toaster.h
+++ b/editor/editor_toaster.h
@@ -31,12 +31,12 @@
#ifndef EDITOR_TOASTER_H
#define EDITOR_TOASTER_H
-#include "scene/gui/box_container.h"
-#include "scene/gui/button.h"
-#include "scene/gui/popup.h"
-
#include "core/string/ustring.h"
#include "core/templates/local_vector.h"
+#include "scene/gui/box_container.h"
+
+class Button;
+class PanelContainer;
class EditorToaster : public HBoxContainer {
GDCLASS(EditorToaster, HBoxContainer);
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 8c34609e9c..379bbc343c 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -36,8 +36,8 @@
#include "core/io/zip_io.h"
#include "core/os/keyboard.h"
#include "core/version.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#include "progress_dialog.h"
#include "scene/gui/link_button.h"
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index c91351022f..3625c14740 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -37,11 +37,12 @@
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/templates/list.h"
-#include "editor_feature_profile.h"
-#include "editor_node.h"
-#include "editor_resource_preview.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
+#include "editor/editor_feature_profile.h"
+#include "editor/editor_node.h"
+#include "editor/editor_resource_preview.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
+#include "editor/scene_tree_dock.h"
#include "import_dock.h"
#include "scene/main/window.h"
#include "scene/resources/packed_scene.h"
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 1dc986dcb2..e6a5e62092 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -49,8 +49,8 @@
#include "create_dialog.h"
#include "dependency_editor.h"
-#include "editor_dir_dialog.h"
-#include "editor_file_system.h"
+#include "editor/editor_dir_dialog.h"
+#include "editor/editor_file_system.h"
#include "script_create_dialog.h"
class EditorNode;
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index dd72def6ad..929f8b8d2c 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -30,10 +30,11 @@
#include "find_in_files.h"
+#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
#include "core/os/os.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/check_box.h"
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index 1644bb9dbe..4b3a7a8313 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -30,9 +30,10 @@
#include "groups_editor.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
+#include "editor/scene_tree_dock.h"
#include "editor/scene_tree_editor.h"
-#include "editor_node.h"
-#include "editor_scale.h"
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
#include "scene/resources/packed_scene.h"
diff --git a/editor/icons/ControlAlignBottomCenter.svg b/editor/icons/ControlAlignCenterBottom.svg
index ca7f0c2e01..ca7f0c2e01 100644
--- a/editor/icons/ControlAlignBottomCenter.svg
+++ b/editor/icons/ControlAlignCenterBottom.svg
diff --git a/editor/icons/ControlAlignLeftCenter.svg b/editor/icons/ControlAlignCenterLeft.svg
index 612c36b4d6..612c36b4d6 100644
--- a/editor/icons/ControlAlignLeftCenter.svg
+++ b/editor/icons/ControlAlignCenterLeft.svg
diff --git a/editor/icons/ControlAlignRightCenter.svg b/editor/icons/ControlAlignCenterRight.svg
index 43f8618c80..43f8618c80 100644
--- a/editor/icons/ControlAlignRightCenter.svg
+++ b/editor/icons/ControlAlignCenterRight.svg
diff --git a/editor/icons/ControlAlignTopCenter.svg b/editor/icons/ControlAlignCenterTop.svg
index dca9c84ce6..dca9c84ce6 100644
--- a/editor/icons/ControlAlignTopCenter.svg
+++ b/editor/icons/ControlAlignCenterTop.svg
diff --git a/editor/icons/ControlHcenterWide.svg b/editor/icons/ControlAlignHCenterWide.svg
index af3f9b495b..af3f9b495b 100644
--- a/editor/icons/ControlHcenterWide.svg
+++ b/editor/icons/ControlAlignHCenterWide.svg
diff --git a/editor/icons/ControlVcenterWide.svg b/editor/icons/ControlAlignVCenterWide.svg
index decd1cbd12..decd1cbd12 100644
--- a/editor/icons/ControlVcenterWide.svg
+++ b/editor/icons/ControlAlignVCenterWide.svg
diff --git a/editor/import/dynamicfont_import_settings.cpp b/editor/import/dynamicfont_import_settings.cpp
index 244352fbb2..33c861ba24 100644
--- a/editor/import/dynamicfont_import_settings.cpp
+++ b/editor/import/dynamicfont_import_settings.cpp
@@ -30,6 +30,10 @@
#include "dynamicfont_import_settings.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_file_system.h"
+#include "editor/editor_inspector.h"
+#include "editor/editor_locale_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
diff --git a/editor/import/dynamicfont_import_settings.h b/editor/import/dynamicfont_import_settings.h
index 5d37f58b9b..8892e20ae6 100644
--- a/editor/import/dynamicfont_import_settings.h
+++ b/editor/import/dynamicfont_import_settings.h
@@ -31,10 +31,6 @@
#ifndef FONTDATA_IMPORT_SETTINGS_H
#define FONTDATA_IMPORT_SETTINGS_H
-#include "editor/editor_file_dialog.h"
-#include "editor/editor_inspector.h"
-#include "editor/editor_locale_dialog.h"
-
#include "editor/import/resource_importer_dynamicfont.h"
#include "scene/gui/dialogs.h"
@@ -50,6 +46,9 @@
#include "servers/text_server.h"
class DynamicFontImportSettingsData;
+class EditorFileDialog;
+class EditorInspector;
+class EditorLocaleDialog;
class DynamicFontImportSettings : public ConfirmationDialog {
GDCLASS(DynamicFontImportSettings, ConfirmationDialog)
diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp
index cf3464b168..f7d373ef60 100644
--- a/editor/import/editor_import_plugin.cpp
+++ b/editor/import/editor_import_plugin.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "editor_import_plugin.h"
+
#include "core/object/script_language.h"
EditorImportPlugin::EditorImportPlugin() {
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index 69e3311fe6..7071042818 100644
--- a/editor/import/resource_importer_layered_texture.cpp
+++ b/editor/import/resource_importer_layered_texture.cpp
@@ -30,8 +30,7 @@
#include "resource_importer_layered_texture.h"
-#include "resource_importer_texture.h"
-
+#include "core/config/project_settings.h"
#include "core/error/error_macros.h"
#include "core/io/config_file.h"
#include "core/io/image_loader.h"
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 127cd4511e..6f41855cce 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -30,6 +30,7 @@
#include "resource_importer_texture.h"
+#include "core/config/project_settings.h"
#include "core/io/config_file.h"
#include "core/io/image_loader.h"
#include "core/version.h"
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index eed1888c6a..a3fb753d7f 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -29,9 +29,14 @@
/*************************************************************************/
#include "scene_import_settings.h"
+
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_file_system.h"
+#include "editor/editor_inspector.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/3d/importer_mesh_instance_3d.h"
+#include "scene/animation/animation_player.h"
#include "scene/resources/importer_mesh.h"
#include "scene/resources/surface_tool.h"
diff --git a/editor/import/scene_import_settings.h b/editor/import/scene_import_settings.h
index 4edf05c7bb..b51f342729 100644
--- a/editor/import/scene_import_settings.h
+++ b/editor/import/scene_import_settings.h
@@ -31,8 +31,6 @@
#ifndef SCENEIMPORTSETTINGS_H
#define SCENEIMPORTSETTINGS_H
-#include "editor/editor_file_dialog.h"
-#include "editor/editor_inspector.h"
#include "editor/import/resource_importer_scene.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/light_3d.h"
@@ -47,6 +45,8 @@
#include "scene/gui/tree.h"
#include "scene/resources/primitive_meshes.h"
+class EditorFileDialog;
+class EditorInspector;
class SceneImportSettingsData;
class SceneImportSettings : public ConfirmationDialog {
diff --git a/editor/import_defaults_editor.cpp b/editor/import_defaults_editor.cpp
index 15d3c4b3ee..3ecf084ab1 100644
--- a/editor/import_defaults_editor.cpp
+++ b/editor/import_defaults_editor.cpp
@@ -30,6 +30,15 @@
#include "import_defaults_editor.h"
+#include "core/config/project_settings.h"
+#include "editor/action_map_editor.h"
+#include "editor/editor_autoload_settings.h"
+#include "editor/editor_plugin_settings.h"
+#include "editor/editor_sectioned_inspector.h"
+#include "editor/localization_editor.h"
+#include "editor/shader_globals_editor.h"
+#include "scene/gui/center_container.h"
+
class ImportDefaultsEditorSettings : public Object {
GDCLASS(ImportDefaultsEditorSettings, Object)
friend class ImportDefaultsEditor;
diff --git a/editor/import_defaults_editor.h b/editor/import_defaults_editor.h
index e84e4b6646..8eb6584b1e 100644
--- a/editor/import_defaults_editor.h
+++ b/editor/import_defaults_editor.h
@@ -31,18 +31,11 @@
#ifndef IMPORT_DEFAULTS_EDITOR_H
#define IMPORT_DEFAULTS_EDITOR_H
-#include "core/object/undo_redo.h"
-#include "editor/action_map_editor.h"
-#include "editor/editor_data.h"
-#include "editor/editor_plugin_settings.h"
-#include "editor/editor_sectioned_inspector.h"
-#include "editor/localization_editor.h"
-#include "editor/shader_globals_editor.h"
-#include "editor_autoload_settings.h"
-#include "scene/gui/center_container.h"
+#include "scene/gui/box_container.h"
#include "scene/gui/option_button.h"
class ImportDefaultsEditorSettings;
+class EditorInspector;
class ImportDefaultsEditor : public VBoxContainer {
GDCLASS(ImportDefaultsEditor, VBoxContainer)
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index f809747410..72cc33048c 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -29,9 +29,11 @@
/*************************************************************************/
#include "import_dock.h"
-#include "editor_node.h"
-#include "editor_resource_preview.h"
-#include "editor_scale.h"
+
+#include "core/config/project_settings.h"
+#include "editor/editor_node.h"
+#include "editor/editor_resource_preview.h"
+#include "editor/editor_scale.h"
class ImportDockParameters : public Object {
GDCLASS(ImportDockParameters, Object);
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index e36c86fb10..5b3fbe9b51 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -30,6 +30,8 @@
#include "inspector_dock.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/plugins/animation_player_editor_plugin.h"
diff --git a/editor/inspector_dock.h b/editor/inspector_dock.h
index 9dd3fa2070..81ffc7de6e 100644
--- a/editor/inspector_dock.h
+++ b/editor/inspector_dock.h
@@ -38,9 +38,9 @@
#include "editor/editor_path.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
-#include "scene/gui/control.h"
class EditorNode;
+class EditorFileDialog;
class InspectorDock : public VBoxContainer {
GDCLASS(InspectorDock, VBoxContainer);
diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp
index 1e9e2fc09b..401ba02099 100644
--- a/editor/localization_editor.cpp
+++ b/editor/localization_editor.cpp
@@ -30,11 +30,13 @@
#include "localization_editor.h"
+#include "core/config/project_settings.h"
#include "core/string/translation.h"
-#include "editor_node.h"
-#include "editor_scale.h"
-#include "editor_translation_parser.h"
-#include "pot_generator.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_translation_parser.h"
+#include "editor/pot_generator.h"
#include "scene/gui/control.h"
void LocalizationEditor::_notification(int p_what) {
diff --git a/editor/localization_editor.h b/editor/localization_editor.h
index cad07dd336..bde1b894e2 100644
--- a/editor/localization_editor.h
+++ b/editor/localization_editor.h
@@ -32,10 +32,11 @@
#define LOCALIZATION_EDITOR_H
#include "core/object/undo_redo.h"
-#include "editor_file_dialog.h"
-#include "editor_locale_dialog.h"
+#include "editor/editor_locale_dialog.h"
#include "scene/gui/tree.h"
+class EditorFileDialog;
+
class LocalizationEditor : public VBoxContainer {
GDCLASS(LocalizationEditor, VBoxContainer);
diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp
index c61380684a..432d1ee4cc 100644
--- a/editor/multi_node_edit.cpp
+++ b/editor/multi_node_edit.cpp
@@ -31,7 +31,7 @@
#include "multi_node_edit.h"
#include "core/math/math_fieldwise.h"
-#include "editor_node.h"
+#include "editor/editor_node.h"
bool MultiNodeEdit::_set(const StringName &p_name, const Variant &p_value) {
return _set_impl(p_name, p_value, "");
diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp
index 1246ebe0dd..6c3f9c1973 100644
--- a/editor/node_dock.cpp
+++ b/editor/node_dock.cpp
@@ -31,8 +31,8 @@
#include "node_dock.h"
#include "connections_dialog.h"
-#include "editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
void NodeDock::show_groups() {
groups_button->set_pressed(true);
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index c6bde4c98a..a43411c4ea 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -33,6 +33,7 @@
#include "canvas_item_editor_plugin.h"
#include "core/math/geometry_2d.h"
#include "core/os/keyboard.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
bool AbstractPolygon2DEditor::Vertex::operator==(const AbstractPolygon2DEditor::Vertex &p_vertex) const {
diff --git a/editor/plugins/abstract_polygon_2d_editor.h b/editor/plugins/abstract_polygon_2d_editor.h
index 8db5bf58dd..28553c77eb 100644
--- a/editor/plugins/abstract_polygon_2d_editor.h
+++ b/editor/plugins/abstract_polygon_2d_editor.h
@@ -31,10 +31,11 @@
#ifndef ABSTRACT_POLYGON_2D_EDITOR_H
#define ABSTRACT_POLYGON_2D_EDITOR_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/polygon_2d.h"
+#include "scene/gui/box_container.h"
+class EditorNode;
class CanvasItemEditor;
class AbstractPolygon2DEditor : public HBoxContainer {
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 3dcb769faf..4156c14a7e 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -31,6 +31,8 @@
#include "animation_blend_space_1d_editor.h"
#include "core/os/keyboard.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/animation/animation_blend_tree.h"
diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h
index 7906395c8f..54cded6048 100644
--- a/editor/plugins/animation_blend_space_1d_editor.h
+++ b/editor/plugins/animation_blend_space_1d_editor.h
@@ -31,7 +31,6 @@
#ifndef ANIMATION_BLEND_SPACE_1D_EDITOR_H
#define ANIMATION_BLEND_SPACE_1D_EDITOR_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/property_editor.h"
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index f9df8db419..6d876aba44 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -35,6 +35,8 @@
#include "core/io/resource_loader.h"
#include "core/math/geometry_2d.h"
#include "core/os/keyboard.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
diff --git a/editor/plugins/animation_blend_space_2d_editor.h b/editor/plugins/animation_blend_space_2d_editor.h
index b46efff304..933d2bd96d 100644
--- a/editor/plugins/animation_blend_space_2d_editor.h
+++ b/editor/plugins/animation_blend_space_2d_editor.h
@@ -31,7 +31,6 @@
#ifndef ANIMATION_BLEND_SPACE_2D_EDITOR_H
#define ANIMATION_BLEND_SPACE_2D_EDITOR_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/property_editor.h"
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 40d6bc48e7..14dd782b73 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -34,7 +34,9 @@
#include "core/input/input.h"
#include "core/io/resource_loader.h"
#include "core/os/keyboard.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_inspector.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h
index 1e55cc8598..a52f901e5f 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.h
+++ b/editor/plugins/animation_blend_tree_editor_plugin.h
@@ -31,7 +31,6 @@
#ifndef ANIMATION_BLEND_TREE_EDITOR_PLUGIN_H
#define ANIMATION_BLEND_TREE_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/property_editor.h"
@@ -41,7 +40,9 @@
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
+class EditorNode;
class ProgressBar;
+class EditorFileDialog;
class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
GDCLASS(AnimationNodeBlendTreeEditor, AnimationTreeNodeEditorPlugin);
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 320c47e820..1d9a2422da 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -36,10 +36,13 @@
#include "core/io/resource_saver.h"
#include "core/os/keyboard.h"
#include "editor/animation_track_editor.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/plugins/canvas_item_editor_plugin.h" // For onion skinning.
#include "editor/plugins/node_3d_editor_plugin.h" // For onion skinning.
+#include "editor/scene_tree_dock.h"
#include "scene/main/window.h"
#include "scene/resources/animation.h"
#include "scene/scene_string_names.h"
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index 06dca11aff..cfd18f39fd 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -31,14 +31,16 @@
#ifndef ANIMATION_PLAYER_EDITOR_PLUGIN_H
#define ANIMATION_PLAYER_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/texture_button.h"
+#include "scene/gui/tree.h"
+class EditorNode;
+class EditorFileDialog;
class AnimationTrackEditor;
class AnimationPlayerEditorPlugin;
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index f750c92fb3..5e32c77511 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -35,6 +35,8 @@
#include "core/io/resource_loader.h"
#include "core/math/geometry_2d.h"
#include "core/os/keyboard.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h
index 8970e3e062..208bd27f8e 100644
--- a/editor/plugins/animation_state_machine_editor.h
+++ b/editor/plugins/animation_state_machine_editor.h
@@ -31,7 +31,6 @@
#ifndef ANIMATION_STATE_MACHINE_EDITOR_H
#define ANIMATION_STATE_MACHINE_EDITOR_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/property_editor.h"
@@ -41,6 +40,8 @@
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
+class EditorFileDialog;
+
class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
GDCLASS(AnimationNodeStateMachineEditor, AnimationTreeNodeEditorPlugin);
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index adfea236d3..a63ffe94f5 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -39,6 +39,8 @@
#include "core/io/resource_loader.h"
#include "core/math/delaunay_2d.h"
#include "core/os/keyboard.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
diff --git a/editor/plugins/animation_tree_editor_plugin.h b/editor/plugins/animation_tree_editor_plugin.h
index 14c5658478..6a6ad0acc2 100644
--- a/editor/plugins/animation_tree_editor_plugin.h
+++ b/editor/plugins/animation_tree_editor_plugin.h
@@ -31,7 +31,6 @@
#ifndef ANIMATION_TREE_EDITOR_PLUGIN_H
#define ANIMATION_TREE_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/property_editor.h"
#include "scene/animation/animation_tree.h"
@@ -40,6 +39,8 @@
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
+class EditorNode;
+class EditorFileDialog;
class AnimationTreeNodeEditorPlugin : public VBoxContainer {
GDCLASS(AnimationTreeNodeEditorPlugin, VBoxContainer);
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 7199f69f0b..6fbd2245fa 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -34,6 +34,7 @@
#include "core/io/json.h"
#include "core/os/keyboard.h"
#include "core/version.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp
index 086d5474ba..245eefbc34 100644
--- a/editor/plugins/audio_stream_editor_plugin.cpp
+++ b/editor/plugins/audio_stream_editor_plugin.cpp
@@ -34,6 +34,7 @@
#include "core/io/resource_loader.h"
#include "core/os/keyboard.h"
#include "editor/audio_stream_preview.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
diff --git a/editor/plugins/audio_stream_editor_plugin.h b/editor/plugins/audio_stream_editor_plugin.h
index db0e204616..e72bae3659 100644
--- a/editor/plugins/audio_stream_editor_plugin.h
+++ b/editor/plugins/audio_stream_editor_plugin.h
@@ -31,12 +31,12 @@
#ifndef AUDIO_STREAM_EDITOR_PLUGIN_H
#define AUDIO_STREAM_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/audio/audio_stream_player.h"
#include "scene/gui/color_rect.h"
#include "scene/resources/texture.h"
+class EditorNode;
class AudioStreamEditor : public ColorRect {
GDCLASS(AudioStreamEditor, ColorRect);
diff --git a/editor/plugins/camera_3d_editor_plugin.cpp b/editor/plugins/camera_3d_editor_plugin.cpp
index 7c920fa15e..0854dacc9d 100644
--- a/editor/plugins/camera_3d_editor_plugin.cpp
+++ b/editor/plugins/camera_3d_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "camera_3d_editor_plugin.h"
+#include "editor/editor_node.h"
#include "node_3d_editor_plugin.h"
void Camera3DEditor::_node_removed(Node *p_node) {
diff --git a/editor/plugins/camera_3d_editor_plugin.h b/editor/plugins/camera_3d_editor_plugin.h
index e175a931b0..70e82f810b 100644
--- a/editor/plugins/camera_3d_editor_plugin.h
+++ b/editor/plugins/camera_3d_editor_plugin.h
@@ -31,10 +31,11 @@
#ifndef CAMERA_EDITOR_PLUGIN_H
#define CAMERA_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/camera_3d.h"
+class EditorNode;
+
class Camera3DEditor : public Control {
GDCLASS(Camera3DEditor, Control);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 48c5c0ebc4..1317c384fd 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -39,8 +39,10 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/editor_toaster.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
+#include "editor/scene_tree_dock.h"
#include "scene/2d/cpu_particles_2d.h"
#include "scene/2d/gpu_particles_2d.h"
#include "scene/2d/light_2d.h"
@@ -747,11 +749,11 @@ bool CanvasItemEditor::_select_click_on_item(CanvasItem *item, Point2 p_click_po
return still_selected;
}
-List<CanvasItem *> CanvasItemEditor::_get_edited_canvas_items(bool retreive_locked, bool remove_canvas_item_if_parent_in_selection) {
+List<CanvasItem *> CanvasItemEditor::_get_edited_canvas_items(bool retrieve_locked, bool remove_canvas_item_if_parent_in_selection) {
List<CanvasItem *> selection;
for (const KeyValue<Node *, Object *> &E : editor_selection->get_selection()) {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E.key);
- if (canvas_item && canvas_item->is_visible_in_tree() && canvas_item->get_viewport() == EditorNode::get_singleton()->get_scene_root() && (retreive_locked || !_is_node_locked(canvas_item))) {
+ if (canvas_item && canvas_item->is_visible_in_tree() && canvas_item->get_viewport() == EditorNode::get_singleton()->get_scene_root() && (retrieve_locked || !_is_node_locked(canvas_item))) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (se) {
selection.push_back(canvas_item);
@@ -1831,7 +1833,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
Point2 drag_to_local = simple_xform.xform(drag_to);
Point2 offset = drag_to_local - drag_from_local;
- Size2 scale = canvas_item->call("get_scale");
+ Size2 scale = canvas_item->_edit_get_scale();
Size2 original_scale = scale;
real_t ratio = scale.y / scale.x;
if (drag_type == DRAG_SCALE_BOTH) {
@@ -1869,7 +1871,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
}
}
- canvas_item->call("set_scale", scale);
+ canvas_item->_edit_set_scale(scale);
return true;
}
@@ -3696,8 +3698,6 @@ void CanvasItemEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
EditorNode::get_singleton()->get_scene_root()->set_snap_controls_to_pixels(GLOBAL_GET("gui/common/snap_controls_to_pixels"));
- bool has_container_parents = false;
- int nb_control = 0;
int nb_having_pivot = 0;
// Update the viewport if the canvas_item changes
@@ -3738,11 +3738,6 @@ void CanvasItemEditor::_notification(int p_what) {
se->prev_anchors[SIDE_BOTTOM] = anchors[SIDE_BOTTOM];
viewport->update();
}
- nb_control++;
-
- if (Object::cast_to<Container>(control->get_parent())) {
- has_container_parents = true;
- }
}
if (canvas_item->_edit_use_pivot()) {
@@ -3753,28 +3748,6 @@ void CanvasItemEditor::_notification(int p_what) {
// Activate / Deactivate the pivot tool
pivot_button->set_disabled(nb_having_pivot == 0);
- // Show / Hide the layout and anchors mode buttons
- if (nb_control > 0 && nb_control == selection.size()) {
- presets_menu->set_visible(true);
- anchor_mode_button->set_visible(true);
-
- // Disable if the selected node is child of a container
- if (has_container_parents) {
- presets_menu->set_disabled(true);
- presets_menu->set_tooltip(TTR("Children of containers have their anchors and margins values overridden by their parent."));
- anchor_mode_button->set_disabled(true);
- anchor_mode_button->set_tooltip(TTR("Children of containers have their anchors and margins values overridden by their parent."));
- } else {
- presets_menu->set_disabled(false);
- presets_menu->set_tooltip(TTR("Presets for the anchors and margins values of a Control node."));
- anchor_mode_button->set_disabled(false);
- anchor_mode_button->set_tooltip(TTR("When active, moving Control nodes changes their anchors instead of their margins."));
- }
- } else {
- presets_menu->set_visible(false);
- anchor_mode_button->set_visible(false);
- }
-
// Update the viewport if bones changes
for (KeyValue<BoneKey, BoneList> &E : bone_list) {
Object *b = ObjectDB::get_instance(E.key.from);
@@ -3852,58 +3825,6 @@ void CanvasItemEditor::_notification(int p_what) {
_update_context_menu_stylebox();
- presets_menu->set_icon(get_theme_icon(SNAME("ControlLayout"), SNAME("EditorIcons")));
-
- PopupMenu *p = presets_menu->get_popup();
-
- p->clear();
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignTopLeft"), SNAME("EditorIcons")), TTR("Top Left"), ANCHORS_AND_OFFSETS_PRESET_TOP_LEFT);
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignTopRight"), SNAME("EditorIcons")), TTR("Top Right"), ANCHORS_AND_OFFSETS_PRESET_TOP_RIGHT);
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomRight"), SNAME("EditorIcons")), TTR("Bottom Right"), ANCHORS_AND_OFFSETS_PRESET_BOTTOM_RIGHT);
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomLeft"), SNAME("EditorIcons")), TTR("Bottom Left"), ANCHORS_AND_OFFSETS_PRESET_BOTTOM_LEFT);
- p->add_separator();
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignLeftCenter"), SNAME("EditorIcons")), TTR("Center Left"), ANCHORS_AND_OFFSETS_PRESET_CENTER_LEFT);
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignTopCenter"), SNAME("EditorIcons")), TTR("Center Top"), ANCHORS_AND_OFFSETS_PRESET_CENTER_TOP);
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignRightCenter"), SNAME("EditorIcons")), TTR("Center Right"), ANCHORS_AND_OFFSETS_PRESET_CENTER_RIGHT);
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomCenter"), SNAME("EditorIcons")), TTR("Center Bottom"), ANCHORS_AND_OFFSETS_PRESET_CENTER_BOTTOM);
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenter"), SNAME("EditorIcons")), TTR("Center"), ANCHORS_AND_OFFSETS_PRESET_CENTER);
- p->add_separator();
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignLeftWide"), SNAME("EditorIcons")), TTR("Left Wide"), ANCHORS_AND_OFFSETS_PRESET_LEFT_WIDE);
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignTopWide"), SNAME("EditorIcons")), TTR("Top Wide"), ANCHORS_AND_OFFSETS_PRESET_TOP_WIDE);
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignRightWide"), SNAME("EditorIcons")), TTR("Right Wide"), ANCHORS_AND_OFFSETS_PRESET_RIGHT_WIDE);
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomWide"), SNAME("EditorIcons")), TTR("Bottom Wide"), ANCHORS_AND_OFFSETS_PRESET_BOTTOM_WIDE);
- p->add_icon_item(get_theme_icon(SNAME("ControlVcenterWide"), SNAME("EditorIcons")), TTR("VCenter Wide"), ANCHORS_AND_OFFSETS_PRESET_VCENTER_WIDE);
- p->add_icon_item(get_theme_icon(SNAME("ControlHcenterWide"), SNAME("EditorIcons")), TTR("HCenter Wide"), ANCHORS_AND_OFFSETS_PRESET_HCENTER_WIDE);
- p->add_separator();
- p->add_icon_item(get_theme_icon(SNAME("ControlAlignWide"), SNAME("EditorIcons")), TTR("Full Rect"), ANCHORS_AND_OFFSETS_PRESET_WIDE);
- p->add_icon_item(get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons")), TTR("Keep Ratio"), ANCHORS_AND_OFFSETS_PRESET_KEEP_RATIO);
- p->add_separator();
- p->add_submenu_item(TTR("Anchors only"), "Anchors");
- p->set_item_icon(21, get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons")));
-
- anchors_popup->clear();
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignTopLeft"), SNAME("EditorIcons")), TTR("Top Left"), ANCHORS_PRESET_TOP_LEFT);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignTopRight"), SNAME("EditorIcons")), TTR("Top Right"), ANCHORS_PRESET_TOP_RIGHT);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomRight"), SNAME("EditorIcons")), TTR("Bottom Right"), ANCHORS_PRESET_BOTTOM_RIGHT);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomLeft"), SNAME("EditorIcons")), TTR("Bottom Left"), ANCHORS_PRESET_BOTTOM_LEFT);
- anchors_popup->add_separator();
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignLeftCenter"), SNAME("EditorIcons")), TTR("Center Left"), ANCHORS_PRESET_CENTER_LEFT);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignTopCenter"), SNAME("EditorIcons")), TTR("Center Top"), ANCHORS_PRESET_CENTER_TOP);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignRightCenter"), SNAME("EditorIcons")), TTR("Center Right"), ANCHORS_PRESET_CENTER_RIGHT);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomCenter"), SNAME("EditorIcons")), TTR("Center Bottom"), ANCHORS_PRESET_CENTER_BOTTOM);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignCenter"), SNAME("EditorIcons")), TTR("Center"), ANCHORS_PRESET_CENTER);
- anchors_popup->add_separator();
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignLeftWide"), SNAME("EditorIcons")), TTR("Left Wide"), ANCHORS_PRESET_LEFT_WIDE);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignTopWide"), SNAME("EditorIcons")), TTR("Top Wide"), ANCHORS_PRESET_TOP_WIDE);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignRightWide"), SNAME("EditorIcons")), TTR("Right Wide"), ANCHORS_PRESET_RIGHT_WIDE);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomWide"), SNAME("EditorIcons")), TTR("Bottom Wide"), ANCHORS_PRESET_BOTTOM_WIDE);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlVcenterWide"), SNAME("EditorIcons")), TTR("VCenter Wide"), ANCHORS_PRESET_VCENTER_WIDE);
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlHcenterWide"), SNAME("EditorIcons")), TTR("HCenter Wide"), ANCHORS_PRESET_HCENTER_WIDE);
- anchors_popup->add_separator();
- anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignWide"), SNAME("EditorIcons")), TTR("Full Rect"), ANCHORS_PRESET_WIDE);
-
- anchor_mode_button->set_icon(get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons")));
-
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
pan_speed = int(EditorSettings::get_singleton()->get("editors/panning/2d_editor_pan_speed"));
warped_panning = bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"));
@@ -3920,27 +3841,6 @@ void CanvasItemEditor::_notification(int p_what) {
}
void CanvasItemEditor::_selection_changed() {
- // Update the anchors_mode
- int nbValidControls = 0;
- int nbAnchorsMode = 0;
- List<Node *> selection = editor_selection->get_selected_node_list();
- for (Node *E : selection) {
- Control *control = Object::cast_to<Control>(E);
- if (!control) {
- continue;
- }
- if (Object::cast_to<Container>(control->get_parent())) {
- continue;
- }
-
- nbValidControls++;
- if (control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_")) {
- nbAnchorsMode++;
- }
- }
- anchors_mode = (nbValidControls == nbAnchorsMode);
- anchor_mode_button->set_pressed(anchors_mode);
-
if (!selected_from_canvas) {
drag_type = DRAG_NONE;
}
@@ -4072,90 +3972,6 @@ void CanvasItemEditor::_update_scroll(real_t) {
viewport->update();
}
-void CanvasItemEditor::_set_anchors_and_offsets_preset(Control::LayoutPreset p_preset) {
- List<Node *> selection = editor_selection->get_selected_node_list();
-
- undo_redo->create_action(TTR("Change Anchors and Offsets"));
-
- for (Node *E : selection) {
- Control *control = Object::cast_to<Control>(E);
- if (control) {
- undo_redo->add_do_method(control, "set_anchors_preset", p_preset);
- switch (p_preset) {
- case PRESET_TOP_LEFT:
- case PRESET_TOP_RIGHT:
- case PRESET_BOTTOM_LEFT:
- case PRESET_BOTTOM_RIGHT:
- case PRESET_CENTER_LEFT:
- case PRESET_CENTER_TOP:
- case PRESET_CENTER_RIGHT:
- case PRESET_CENTER_BOTTOM:
- case PRESET_CENTER:
- undo_redo->add_do_method(control, "set_offsets_preset", p_preset, Control::PRESET_MODE_KEEP_SIZE);
- break;
- case PRESET_LEFT_WIDE:
- case PRESET_TOP_WIDE:
- case PRESET_RIGHT_WIDE:
- case PRESET_BOTTOM_WIDE:
- case PRESET_VCENTER_WIDE:
- case PRESET_HCENTER_WIDE:
- case PRESET_WIDE:
- undo_redo->add_do_method(control, "set_offsets_preset", p_preset, Control::PRESET_MODE_MINSIZE);
- break;
- }
- undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
- }
- }
-
- undo_redo->commit_action();
-
- anchors_mode = false;
- anchor_mode_button->set_pressed(anchors_mode);
-}
-
-void CanvasItemEditor::_set_anchors_and_offsets_to_keep_ratio() {
- List<Node *> selection = editor_selection->get_selected_node_list();
-
- undo_redo->create_action(TTR("Change Anchors and Offsets"));
-
- for (Node *E : selection) {
- Control *control = Object::cast_to<Control>(E);
- if (control) {
- Point2 top_left_anchor = _position_to_anchor(control, Point2());
- Point2 bottom_right_anchor = _position_to_anchor(control, control->get_size());
- undo_redo->add_do_method(control, "set_anchor", SIDE_LEFT, top_left_anchor.x, false, true);
- undo_redo->add_do_method(control, "set_anchor", SIDE_RIGHT, bottom_right_anchor.x, false, true);
- undo_redo->add_do_method(control, "set_anchor", SIDE_TOP, top_left_anchor.y, false, true);
- undo_redo->add_do_method(control, "set_anchor", SIDE_BOTTOM, bottom_right_anchor.y, false, true);
- undo_redo->add_do_method(control, "set_meta", "_edit_use_anchors_", true);
-
- bool use_anchors = control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_");
- undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
- undo_redo->add_undo_method(control, "set_meta", "_edit_use_anchors_", use_anchors);
-
- anchors_mode = true;
- anchor_mode_button->set_pressed(anchors_mode);
- }
- }
-
- undo_redo->commit_action();
-}
-
-void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) {
- List<Node *> selection = editor_selection->get_selected_node_list();
-
- undo_redo->create_action(TTR("Change Anchors"));
- for (Node *E : selection) {
- Control *control = Object::cast_to<Control>(E);
- if (control) {
- undo_redo->add_do_method(control, "set_anchors_preset", p_preset);
- undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
- }
- }
-
- undo_redo->commit_action();
-}
-
void CanvasItemEditor::_zoom_on_position(real_t p_zoom, Point2 p_position) {
p_zoom = CLAMP(p_zoom, MIN_ZOOM, MAX_ZOOM);
@@ -4298,21 +4114,6 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation,
}
}
-void CanvasItemEditor::_button_toggle_anchor_mode(bool p_status) {
- List<CanvasItem *> selection = _get_edited_canvas_items(false, false);
- for (CanvasItem *E : selection) {
- Control *control = Object::cast_to<Control>(E);
- if (!control || Object::cast_to<Container>(control->get_parent())) {
- continue;
- }
-
- control->set_meta("_edit_use_anchors_", p_status);
- }
-
- anchors_mode = p_status;
- viewport->update();
-}
-
void CanvasItemEditor::_update_override_camera_button(bool p_game_running) {
if (p_game_running) {
override_camera_button->set_disabled(false);
@@ -4534,106 +4335,6 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_undo_method(viewport, "update", Variant());
undo_redo->commit_action();
} break;
- case ANCHORS_AND_OFFSETS_PRESET_TOP_LEFT: {
- _set_anchors_and_offsets_preset(PRESET_TOP_LEFT);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_TOP_RIGHT: {
- _set_anchors_and_offsets_preset(PRESET_TOP_RIGHT);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_BOTTOM_LEFT: {
- _set_anchors_and_offsets_preset(PRESET_BOTTOM_LEFT);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_BOTTOM_RIGHT: {
- _set_anchors_and_offsets_preset(PRESET_BOTTOM_RIGHT);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_CENTER_LEFT: {
- _set_anchors_and_offsets_preset(PRESET_CENTER_LEFT);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_CENTER_RIGHT: {
- _set_anchors_and_offsets_preset(PRESET_CENTER_RIGHT);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_CENTER_TOP: {
- _set_anchors_and_offsets_preset(PRESET_CENTER_TOP);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_CENTER_BOTTOM: {
- _set_anchors_and_offsets_preset(PRESET_CENTER_BOTTOM);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_CENTER: {
- _set_anchors_and_offsets_preset(PRESET_CENTER);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_TOP_WIDE: {
- _set_anchors_and_offsets_preset(PRESET_TOP_WIDE);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_LEFT_WIDE: {
- _set_anchors_and_offsets_preset(PRESET_LEFT_WIDE);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_RIGHT_WIDE: {
- _set_anchors_and_offsets_preset(PRESET_RIGHT_WIDE);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_BOTTOM_WIDE: {
- _set_anchors_and_offsets_preset(PRESET_BOTTOM_WIDE);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_VCENTER_WIDE: {
- _set_anchors_and_offsets_preset(PRESET_VCENTER_WIDE);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_HCENTER_WIDE: {
- _set_anchors_and_offsets_preset(PRESET_HCENTER_WIDE);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_WIDE: {
- _set_anchors_and_offsets_preset(Control::PRESET_WIDE);
- } break;
- case ANCHORS_AND_OFFSETS_PRESET_KEEP_RATIO: {
- _set_anchors_and_offsets_to_keep_ratio();
- } break;
-
- case ANCHORS_PRESET_TOP_LEFT: {
- _set_anchors_preset(PRESET_TOP_LEFT);
- } break;
- case ANCHORS_PRESET_TOP_RIGHT: {
- _set_anchors_preset(PRESET_TOP_RIGHT);
- } break;
- case ANCHORS_PRESET_BOTTOM_LEFT: {
- _set_anchors_preset(PRESET_BOTTOM_LEFT);
- } break;
- case ANCHORS_PRESET_BOTTOM_RIGHT: {
- _set_anchors_preset(PRESET_BOTTOM_RIGHT);
- } break;
- case ANCHORS_PRESET_CENTER_LEFT: {
- _set_anchors_preset(PRESET_CENTER_LEFT);
- } break;
- case ANCHORS_PRESET_CENTER_RIGHT: {
- _set_anchors_preset(PRESET_CENTER_RIGHT);
- } break;
- case ANCHORS_PRESET_CENTER_TOP: {
- _set_anchors_preset(PRESET_CENTER_TOP);
- } break;
- case ANCHORS_PRESET_CENTER_BOTTOM: {
- _set_anchors_preset(PRESET_CENTER_BOTTOM);
- } break;
- case ANCHORS_PRESET_CENTER: {
- _set_anchors_preset(PRESET_CENTER);
- } break;
- case ANCHORS_PRESET_TOP_WIDE: {
- _set_anchors_preset(PRESET_TOP_WIDE);
- } break;
- case ANCHORS_PRESET_LEFT_WIDE: {
- _set_anchors_preset(PRESET_LEFT_WIDE);
- } break;
- case ANCHORS_PRESET_RIGHT_WIDE: {
- _set_anchors_preset(PRESET_RIGHT_WIDE);
- } break;
- case ANCHORS_PRESET_BOTTOM_WIDE: {
- _set_anchors_preset(PRESET_BOTTOM_WIDE);
- } break;
- case ANCHORS_PRESET_VCENTER_WIDE: {
- _set_anchors_preset(PRESET_VCENTER_WIDE);
- } break;
- case ANCHORS_PRESET_HCENTER_WIDE: {
- _set_anchors_preset(PRESET_HCENTER_WIDE);
- } break;
- case ANCHORS_PRESET_WIDE: {
- _set_anchors_preset(Control::PRESET_WIDE);
- } break;
case ANIM_INSERT_KEY:
case ANIM_INSERT_KEY_EXISTING: {
@@ -5128,63 +4829,21 @@ void CanvasItemEditor::focus_selection() {
}
CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
- key_pos = true;
- key_rot = true;
- key_scale = false;
-
- show_grid = false;
- show_origin = true;
- show_viewport = true;
- show_helpers = false;
- show_rulers = true;
- show_guides = true;
- show_transformation_gizmos = true;
- show_edit_locks = true;
zoom = 1.0 / MAX(1, EDSCALE);
view_offset = Point2(-150 - RULER_WIDTH, -95 - RULER_WIDTH);
previous_update_view_offset = view_offset; // Moves the view a little bit to the left so that (0,0) is visible. The values a relative to a 16/10 screen
+
grid_offset = Point2();
grid_step = Point2(8, 8); // A power-of-two value works better as a default
primary_grid_steps = 8; // A power-of-two value works better as a default
grid_step_multiplier = 0;
+
snap_rotation_offset = 0;
snap_rotation_step = Math::deg2rad(15.0);
snap_scale_step = 0.1f;
- smart_snap_active = false;
- grid_snap_active = false;
- snap_node_parent = true;
- snap_node_anchors = true;
- snap_node_sides = true;
- snap_node_center = true;
- snap_other_nodes = true;
- snap_guides = true;
- snap_rotation = false;
- snap_scale = false;
- snap_relative = false;
- // Enable pixel snapping even if pixel snap rendering is disabled in the Project Settings.
- // This results in crisper visuals by preventing 2D nodes from being placed at subpixel coordinates.
- snap_pixel = true;
snap_target[0] = SNAP_TARGET_NONE;
snap_target[1] = SNAP_TARGET_NONE;
- selected_from_canvas = false;
- anchors_mode = false;
-
- drag_type = DRAG_NONE;
- drag_from = Vector2();
- drag_to = Vector2();
- dragged_guide_pos = Point2();
- dragged_guide_index = -1;
- is_hovering_h_guide = false;
- is_hovering_v_guide = false;
- pan_pressed = false;
-
- ruler_tool_active = false;
- ruler_tool_origin = Point2();
-
- bone_last_frame = 0;
-
- tool = TOOL_SELECT;
undo_redo = p_editor->get_undo_redo();
editor = p_editor;
editor_selection = p_editor->get_editor_selection();
@@ -5261,8 +4920,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
viewport->add_child(controls_vb);
- updating_scroll = false;
-
// Add some margin to the left for better aesthetics.
// This prevents the first button's hover/pressed effect from "touching" the panel's border,
// which looks ugly.
@@ -5492,28 +5149,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
hb->add_child(context_menu_container);
_update_context_menu_stylebox();
- presets_menu = memnew(MenuButton);
- presets_menu->set_shortcut_context(this);
- presets_menu->set_text(TTR("Layout"));
- hbc_context_menu->add_child(presets_menu);
- presets_menu->hide();
- presets_menu->set_switch_on_hover(true);
-
- p = presets_menu->get_popup();
- p->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback));
-
- anchors_popup = memnew(PopupMenu);
- p->add_child(anchors_popup);
- anchors_popup->set_name("Anchors");
- anchors_popup->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback));
-
- anchor_mode_button = memnew(Button);
- anchor_mode_button->set_flat(true);
- hbc_context_menu->add_child(anchor_mode_button);
- anchor_mode_button->set_toggle_mode(true);
- anchor_mode_button->hide();
- anchor_mode_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_anchor_mode));
-
+ // Animation controls.
animation_hb = memnew(HBoxContainer);
hbc_context_menu->add_child(animation_hb);
animation_hb->add_child(memnew(VSeparator));
@@ -5599,6 +5235,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
divide_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/divide_grid_step", TTR("Divide grid step by 2"), Key::KP_DIVIDE);
skeleton_menu->get_popup()->set_item_checked(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES), true);
+
+ // Store the singleton instance.
singleton = this;
// To ensure that scripts can parse the list of shortcuts correctly, we have to define
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 9fa44bfb25..65db3271fb 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -28,10 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef CONTROL_EDITOR_PLUGIN_H
-#define CONTROL_EDITOR_PLUGIN_H
+#ifndef CANVAS_ITEM_EDITOR_PLUGIN_H
+#define CANVAS_ITEM_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/editor_zoom_widget.h"
#include "scene/gui/box_container.h"
@@ -39,8 +38,12 @@
#include "scene/gui/label.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/spin_box.h"
+#include "scene/gui/split_container.h"
+#include "scene/gui/texture_rect.h"
#include "scene/main/canvas_item.h"
+class EditorNode;
+class EditorData;
class CanvasItemEditorViewport;
class ViewPanner;
@@ -128,55 +131,6 @@ private:
UNLOCK_SELECTED,
GROUP_SELECTED,
UNGROUP_SELECTED,
- ANCHORS_AND_OFFSETS_PRESET_TOP_LEFT,
- ANCHORS_AND_OFFSETS_PRESET_TOP_RIGHT,
- ANCHORS_AND_OFFSETS_PRESET_BOTTOM_LEFT,
- ANCHORS_AND_OFFSETS_PRESET_BOTTOM_RIGHT,
- ANCHORS_AND_OFFSETS_PRESET_CENTER_LEFT,
- ANCHORS_AND_OFFSETS_PRESET_CENTER_RIGHT,
- ANCHORS_AND_OFFSETS_PRESET_CENTER_TOP,
- ANCHORS_AND_OFFSETS_PRESET_CENTER_BOTTOM,
- ANCHORS_AND_OFFSETS_PRESET_CENTER,
- ANCHORS_AND_OFFSETS_PRESET_TOP_WIDE,
- ANCHORS_AND_OFFSETS_PRESET_LEFT_WIDE,
- ANCHORS_AND_OFFSETS_PRESET_RIGHT_WIDE,
- ANCHORS_AND_OFFSETS_PRESET_BOTTOM_WIDE,
- ANCHORS_AND_OFFSETS_PRESET_VCENTER_WIDE,
- ANCHORS_AND_OFFSETS_PRESET_HCENTER_WIDE,
- ANCHORS_AND_OFFSETS_PRESET_WIDE,
- ANCHORS_AND_OFFSETS_PRESET_KEEP_RATIO,
- ANCHORS_PRESET_TOP_LEFT,
- ANCHORS_PRESET_TOP_RIGHT,
- ANCHORS_PRESET_BOTTOM_LEFT,
- ANCHORS_PRESET_BOTTOM_RIGHT,
- ANCHORS_PRESET_CENTER_LEFT,
- ANCHORS_PRESET_CENTER_RIGHT,
- ANCHORS_PRESET_CENTER_TOP,
- ANCHORS_PRESET_CENTER_BOTTOM,
- ANCHORS_PRESET_CENTER,
- ANCHORS_PRESET_TOP_WIDE,
- ANCHORS_PRESET_LEFT_WIDE,
- ANCHORS_PRESET_RIGHT_WIDE,
- ANCHORS_PRESET_BOTTOM_WIDE,
- ANCHORS_PRESET_VCENTER_WIDE,
- ANCHORS_PRESET_HCENTER_WIDE,
- ANCHORS_PRESET_WIDE,
- OFFSETS_PRESET_TOP_LEFT,
- OFFSETS_PRESET_TOP_RIGHT,
- OFFSETS_PRESET_BOTTOM_LEFT,
- OFFSETS_PRESET_BOTTOM_RIGHT,
- OFFSETS_PRESET_CENTER_LEFT,
- OFFSETS_PRESET_CENTER_RIGHT,
- OFFSETS_PRESET_CENTER_TOP,
- OFFSETS_PRESET_CENTER_BOTTOM,
- OFFSETS_PRESET_CENTER,
- OFFSETS_PRESET_TOP_WIDE,
- OFFSETS_PRESET_LEFT_WIDE,
- OFFSETS_PRESET_RIGHT_WIDE,
- OFFSETS_PRESET_BOTTOM_WIDE,
- OFFSETS_PRESET_VCENTER_WIDE,
- OFFSETS_PRESET_HCENTER_WIDE,
- OFFSETS_PRESET_WIDE,
ANIM_INSERT_KEY,
ANIM_INSERT_KEY_EXISTING,
ANIM_INSERT_POS,
@@ -226,7 +180,7 @@ private:
bool selection_menu_additive_selection;
- Tool tool;
+ Tool tool = TOOL_SELECT;
Control *viewport;
Control *viewport_scrollable;
@@ -239,21 +193,20 @@ private:
HBoxContainer *hbc_context_menu;
Transform2D transform;
- bool show_grid;
- bool show_rulers;
- bool show_guides;
- bool show_origin;
- bool show_viewport;
- bool show_helpers;
- bool show_edit_locks;
- bool show_transformation_gizmos;
+ bool show_grid = false;
+ bool show_rulers = true;
+ bool show_guides = true;
+ bool show_origin = true;
+ bool show_viewport = true;
+ bool show_helpers = false;
+ bool show_edit_locks = true;
+ bool show_transformation_gizmos = true;
real_t zoom;
Point2 view_offset;
Point2 previous_update_view_offset;
- bool selected_from_canvas;
- bool anchors_mode;
+ bool selected_from_canvas = false;
Point2 grid_offset;
Point2 grid_step;
@@ -263,26 +216,30 @@ private:
real_t snap_rotation_step;
real_t snap_rotation_offset;
real_t snap_scale_step;
- bool smart_snap_active;
- bool grid_snap_active;
-
- bool snap_node_parent;
- bool snap_node_anchors;
- bool snap_node_sides;
- bool snap_node_center;
- bool snap_other_nodes;
- bool snap_guides;
- bool snap_rotation;
- bool snap_scale;
- bool snap_relative;
- bool snap_pixel;
- bool key_pos;
- bool key_rot;
- bool key_scale;
- bool pan_pressed;
-
- bool ruler_tool_active;
- Point2 ruler_tool_origin;
+ bool smart_snap_active = false;
+ bool grid_snap_active = false;
+
+ bool snap_node_parent = true;
+ bool snap_node_anchors = true;
+ bool snap_node_sides = true;
+ bool snap_node_center = true;
+ bool snap_other_nodes = true;
+ bool snap_guides = true;
+ bool snap_rotation = false;
+ bool snap_scale = false;
+ bool snap_relative = false;
+ // Enable pixel snapping even if pixel snap rendering is disabled in the Project Settings.
+ // This results in crisper visuals by preventing 2D nodes from being placed at subpixel coordinates.
+ bool snap_pixel = true;
+
+ bool key_pos = true;
+ bool key_rot = true;
+ bool key_scale = false;
+
+ bool pan_pressed = false;
+
+ bool ruler_tool_active = false;
+ Point2 ruler_tool_origin = Point2();
Point2 node_create_position;
MenuOption last_option;
@@ -310,7 +267,7 @@ private:
uint64_t last_pass = 0;
};
- uint64_t bone_last_frame;
+ uint64_t bone_last_frame = 0;
struct BoneKey {
ObjectID from;
@@ -363,12 +320,6 @@ private:
HBoxContainer *animation_hb;
MenuButton *animation_menu;
- MenuButton *presets_menu;
- PopupMenu *anchors_and_margins_popup;
- PopupMenu *anchors_popup;
-
- Button *anchor_mode_button;
-
Button *key_loc_button;
Button *key_rot_button;
Button *key_scale_button;
@@ -382,15 +333,15 @@ private:
Control *left_ruler;
Point2 drag_start_origin;
- DragType drag_type;
- Point2 drag_from;
- Point2 drag_to;
+ DragType drag_type = DRAG_NONE;
+ Point2 drag_from = Vector2();
+ Point2 drag_to = Vector2();
Point2 drag_rotation_center;
List<CanvasItem *> drag_selection;
- int dragged_guide_index;
- Point2 dragged_guide_pos;
- bool is_hovering_h_guide;
- bool is_hovering_v_guide;
+ int dragged_guide_index = -1;
+ Point2 dragged_guide_pos = Point2();
+ bool is_hovering_h_guide = false;
+ bool is_hovering_v_guide = false;
bool updating_value_dialog;
@@ -432,7 +383,7 @@ private:
Vector2 _position_to_anchor(const Control *p_control, Vector2 position);
void _popup_callback(int p_op);
- bool updating_scroll;
+ bool updating_scroll = false;
void _update_scroll(real_t);
void _update_scrollbars();
void _snap_changed();
@@ -444,7 +395,7 @@ private:
UndoRedo *undo_redo;
- List<CanvasItem *> _get_edited_canvas_items(bool retreive_locked = false, bool remove_canvas_item_if_parent_in_selection = true);
+ List<CanvasItem *> _get_edited_canvas_items(bool retrieve_locked = false, bool remove_canvas_item_if_parent_in_selection = true);
Rect2 _get_encompassing_rect_from_list(List<CanvasItem *> p_list);
void _expand_encompassing_rect_using_children(Rect2 &r_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D(), bool include_locked_nodes = true);
Rect2 _get_encompassing_rect(const Node *p_node);
@@ -518,12 +469,6 @@ private:
const SnapTarget p_snap_target, List<const CanvasItem *> p_exceptions,
const Node *p_current);
- void _set_anchors_preset(Control::LayoutPreset p_preset);
- void _set_anchors_and_offsets_preset(Control::LayoutPreset p_preset);
- void _set_anchors_and_offsets_to_keep_ratio();
-
- void _button_toggle_anchor_mode(bool p_status);
-
VBoxContainer *controls_vb;
EditorZoomWidget *zoom_widget;
void _update_zoom(real_t p_zoom);
@@ -602,8 +547,6 @@ public:
void focus_selection();
- bool is_anchors_mode_enabled() { return anchors_mode; };
-
EditorSelection *editor_selection;
CanvasItemEditor(EditorNode *p_editor);
@@ -683,4 +626,4 @@ public:
~CanvasItemEditorViewport();
};
-#endif
+#endif //CANVAS_ITEM_EDITOR_PLUGIN_H
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index 8a5df6ac50..311acb8629 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -32,6 +32,7 @@
#include "canvas_item_editor_plugin.h"
#include "core/os/keyboard.h"
+#include "editor/editor_node.h"
#include "scene/resources/capsule_shape_2d.h"
#include "scene/resources/circle_shape_2d.h"
#include "scene/resources/concave_polygon_shape_2d.h"
@@ -323,6 +324,10 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
return false;
}
+ if (!node->is_visible_in_tree()) {
+ return false;
+ }
+
if (shape_type == -1) {
return false;
}
@@ -445,6 +450,10 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
return;
}
+ if (!node->is_visible_in_tree()) {
+ return;
+ }
+
_get_current_shape_type();
if (shape_type == -1) {
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.h b/editor/plugins/collision_shape_2d_editor_plugin.h
index 1c01b7019f..048d07ce2b 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.h
+++ b/editor/plugins/collision_shape_2d_editor_plugin.h
@@ -31,11 +31,11 @@
#ifndef COLLISION_SHAPE_2D_EDITOR_PLUGIN_H
#define COLLISION_SHAPE_2D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/collision_shape_2d.h"
+class EditorNode;
class CanvasItemEditor;
class CollisionShape2DEditor : public Control {
diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp
new file mode 100644
index 0000000000..c4ea098e92
--- /dev/null
+++ b/editor/plugins/control_editor_plugin.cpp
@@ -0,0 +1,1023 @@
+/*************************************************************************/
+/* control_editor_plugin.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. 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 "control_editor_plugin.h"
+
+#include "editor/plugins/canvas_item_editor_plugin.h"
+
+void ControlPositioningWarning::_update_warning() {
+ if (!control_node) {
+ title_icon->set_texture(nullptr);
+ title_label->set_text("");
+ hint_label->set_text("");
+ return;
+ }
+
+ Node *parent_node = control_node->get_parent_control();
+ if (!parent_node) {
+ title_icon->set_texture(get_theme_icon(SNAME("SubViewport"), SNAME("EditorIcons")));
+ title_label->set_text(TTR("This node doesn't have a control parent."));
+ hint_label->set_text(TTR("Use the appropriate layout properties depending on where you are going to put it."));
+ } else if (Object::cast_to<Container>(parent_node)) {
+ title_icon->set_texture(get_theme_icon(SNAME("Container"), SNAME("EditorIcons")));
+ title_label->set_text(TTR("This node is a child of a container."));
+ hint_label->set_text(TTR("Use container properties for positioning."));
+ } else {
+ title_icon->set_texture(get_theme_icon(SNAME("ControlLayout"), SNAME("EditorIcons")));
+ title_label->set_text(TTR("This node is a child of a regular control."));
+ hint_label->set_text(TTR("Use anchors and the rectangle for positioning."));
+ }
+
+ bg_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg_group_note"), SNAME("EditorProperty")));
+}
+
+void ControlPositioningWarning::_update_toggler() {
+ Ref<Texture2D> arrow;
+ if (hint_label->is_visible()) {
+ arrow = get_theme_icon(SNAME("arrow"), SNAME("Tree"));
+ set_tooltip(TTR("Collapse positioning hint."));
+ } else {
+ if (is_layout_rtl()) {
+ arrow = get_theme_icon(SNAME("arrow_collapsed"), SNAME("Tree"));
+ } else {
+ arrow = get_theme_icon(SNAME("arrow_collapsed_mirrored"), SNAME("Tree"));
+ }
+ set_tooltip(TTR("Expand positioning hint."));
+ }
+
+ hint_icon->set_texture(arrow);
+}
+
+void ControlPositioningWarning::set_control(Control *p_node) {
+ control_node = p_node;
+ _update_warning();
+}
+
+void ControlPositioningWarning::gui_input(const Ref<InputEvent> &p_event) {
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
+ bool state = !hint_label->is_visible();
+
+ hint_filler_left->set_visible(state);
+ hint_label->set_visible(state);
+ hint_filler_right->set_visible(state);
+
+ _update_toggler();
+ }
+}
+
+void ControlPositioningWarning::_notification(int p_notification) {
+ switch (p_notification) {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED:
+ _update_warning();
+ _update_toggler();
+ break;
+ }
+}
+
+ControlPositioningWarning::ControlPositioningWarning() {
+ set_mouse_filter(MOUSE_FILTER_STOP);
+
+ bg_panel = memnew(PanelContainer);
+ bg_panel->set_mouse_filter(MOUSE_FILTER_IGNORE);
+ add_child(bg_panel);
+
+ grid = memnew(GridContainer);
+ grid->set_columns(3);
+ bg_panel->add_child(grid);
+
+ title_icon = memnew(TextureRect);
+ title_icon->set_stretch_mode(TextureRect::StretchMode::STRETCH_KEEP_CENTERED);
+ grid->add_child(title_icon);
+
+ title_label = memnew(Label);
+ title_label->set_autowrap_mode(Label::AutowrapMode::AUTOWRAP_WORD);
+ title_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ title_label->set_vertical_alignment(VerticalAlignment::VERTICAL_ALIGNMENT_CENTER);
+ grid->add_child(title_label);
+
+ hint_icon = memnew(TextureRect);
+ hint_icon->set_stretch_mode(TextureRect::StretchMode::STRETCH_KEEP_CENTERED);
+ grid->add_child(hint_icon);
+
+ // Filler.
+ hint_filler_left = memnew(Control);
+ hint_filler_left->hide();
+ grid->add_child(hint_filler_left);
+
+ hint_label = memnew(Label);
+ hint_label->set_autowrap_mode(Label::AutowrapMode::AUTOWRAP_WORD);
+ hint_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ hint_label->set_vertical_alignment(VerticalAlignment::VERTICAL_ALIGNMENT_CENTER);
+ hint_label->hide();
+ grid->add_child(hint_label);
+
+ // Filler.
+ hint_filler_right = memnew(Control);
+ hint_filler_right->hide();
+ grid->add_child(hint_filler_right);
+}
+
+void EditorPropertyAnchorsPreset::_set_read_only(bool p_read_only) {
+ options->set_disabled(p_read_only);
+};
+
+void EditorPropertyAnchorsPreset::_option_selected(int p_which) {
+ int64_t val = options->get_item_metadata(p_which);
+ emit_changed(get_edited_property(), val);
+}
+
+void EditorPropertyAnchorsPreset::update_property() {
+ int64_t which = get_edited_object()->get(get_edited_property());
+
+ for (int i = 0; i < options->get_item_count(); i++) {
+ Variant val = options->get_item_metadata(i);
+ if (val != Variant() && which == (int64_t)val) {
+ options->select(i);
+ return;
+ }
+ }
+}
+
+void EditorPropertyAnchorsPreset::setup(const Vector<String> &p_options) {
+ options->clear();
+
+ Vector<String> split_after;
+ split_after.append("Custom");
+ split_after.append("PresetWide");
+ split_after.append("PresetBottomLeft");
+ split_after.append("PresetCenter");
+
+ for (int i = 0, j = 0; i < p_options.size(); i++, j++) {
+ Vector<String> text_split = p_options[i].split(":");
+ int64_t current_val = text_split[1].to_int();
+
+ String humanized_name = text_split[0];
+ if (humanized_name.begins_with("Preset")) {
+ if (humanized_name == "PresetWide") {
+ humanized_name = "Full Rect";
+ } else {
+ humanized_name = humanized_name.trim_prefix("Preset");
+ humanized_name = humanized_name.capitalize();
+ }
+
+ String icon_name = text_split[0].trim_prefix("Preset");
+ icon_name = "ControlAlign" + icon_name;
+ options->add_icon_item(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(icon_name, "EditorIcons"), humanized_name);
+ } else {
+ options->add_item(humanized_name);
+ }
+
+ options->set_item_metadata(j, current_val);
+ if (split_after.has(text_split[0])) {
+ options->add_separator();
+ j++;
+ }
+ }
+}
+
+EditorPropertyAnchorsPreset::EditorPropertyAnchorsPreset() {
+ options = memnew(OptionButton);
+ options->set_clip_text(true);
+ options->set_flat(true);
+ add_child(options);
+ add_focusable(options);
+ options->connect("item_selected", callable_mp(this, &EditorPropertyAnchorsPreset::_option_selected));
+}
+
+void EditorPropertySizeFlags::_set_read_only(bool p_read_only) {
+ for (CheckBox *check : flag_checks) {
+ check->set_disabled(p_read_only);
+ }
+ flag_presets->set_disabled(p_read_only);
+};
+
+void EditorPropertySizeFlags::_preset_selected(int p_which) {
+ int preset = flag_presets->get_item_id(p_which);
+ if (preset == SIZE_FLAGS_PRESET_CUSTOM) {
+ flag_options->set_visible(true);
+ return;
+ }
+ flag_options->set_visible(false);
+
+ uint32_t value = 0;
+ switch (preset) {
+ case SIZE_FLAGS_PRESET_FILL:
+ value = Control::SIZE_FILL;
+ break;
+ case SIZE_FLAGS_PRESET_SHRINK_BEGIN:
+ value = Control::SIZE_SHRINK_BEGIN;
+ break;
+ case SIZE_FLAGS_PRESET_SHRINK_CENTER:
+ value = Control::SIZE_SHRINK_CENTER;
+ break;
+ case SIZE_FLAGS_PRESET_SHRINK_END:
+ value = Control::SIZE_SHRINK_END;
+ break;
+ }
+
+ bool is_expand = flag_expand->is_visible() && flag_expand->is_pressed();
+ if (is_expand) {
+ value |= Control::SIZE_EXPAND;
+ }
+
+ emit_changed(get_edited_property(), value);
+}
+
+void EditorPropertySizeFlags::_expand_toggled() {
+ uint32_t value = get_edited_object()->get(get_edited_property());
+
+ if (flag_expand->is_visible() && flag_expand->is_pressed()) {
+ value |= Control::SIZE_EXPAND;
+ } else {
+ value ^= Control::SIZE_EXPAND;
+ }
+
+ // Keep the custom preset selected as we toggle individual flags.
+ keep_selected_preset = true;
+ emit_changed(get_edited_property(), value);
+}
+
+void EditorPropertySizeFlags::_flag_toggled() {
+ uint32_t value = 0;
+ for (int i = 0; i < flag_checks.size(); i++) {
+ if (flag_checks[i]->is_pressed()) {
+ int flag_value = flag_checks[i]->get_meta("_value");
+ value |= flag_value;
+ }
+ }
+
+ bool is_expand = flag_expand->is_visible() && flag_expand->is_pressed();
+ if (is_expand) {
+ value |= Control::SIZE_EXPAND;
+ }
+
+ // Keep the custom preset selected as we toggle individual flags.
+ keep_selected_preset = true;
+ emit_changed(get_edited_property(), value);
+}
+
+void EditorPropertySizeFlags::update_property() {
+ uint32_t value = get_edited_object()->get(get_edited_property());
+
+ for (int i = 0; i < flag_checks.size(); i++) {
+ int flag_value = flag_checks[i]->get_meta("_value");
+ if (value & flag_value) {
+ flag_checks[i]->set_pressed(true);
+ } else {
+ flag_checks[i]->set_pressed(false);
+ }
+ }
+
+ bool is_expand = value & Control::SIZE_EXPAND;
+ flag_expand->set_pressed(is_expand);
+
+ if (keep_selected_preset) {
+ keep_selected_preset = false;
+ return;
+ }
+
+ FlagPreset preset = SIZE_FLAGS_PRESET_CUSTOM;
+ if (value == Control::SIZE_FILL || value == (Control::SIZE_FILL | Control::SIZE_EXPAND)) {
+ preset = SIZE_FLAGS_PRESET_FILL;
+ } else if (value == Control::SIZE_SHRINK_BEGIN || value == (Control::SIZE_SHRINK_BEGIN | Control::SIZE_EXPAND)) {
+ preset = SIZE_FLAGS_PRESET_SHRINK_BEGIN;
+ } else if (value == Control::SIZE_SHRINK_CENTER || value == (Control::SIZE_SHRINK_CENTER | Control::SIZE_EXPAND)) {
+ preset = SIZE_FLAGS_PRESET_SHRINK_CENTER;
+ } else if (value == Control::SIZE_SHRINK_END || value == (Control::SIZE_SHRINK_END | Control::SIZE_EXPAND)) {
+ preset = SIZE_FLAGS_PRESET_SHRINK_END;
+ }
+
+ int preset_idx = flag_presets->get_item_index(preset);
+ if (preset_idx >= 0) {
+ flag_presets->select(preset_idx);
+ }
+ flag_options->set_visible(preset == SIZE_FLAGS_PRESET_CUSTOM);
+}
+
+void EditorPropertySizeFlags::setup(const Vector<String> &p_options, bool p_vertical) {
+ vertical = p_vertical;
+
+ if (p_options.size() == 0) {
+ flag_presets->clear();
+ flag_presets->add_item(TTR("Container Default"));
+ flag_presets->set_disabled(true);
+ flag_expand->set_visible(false);
+ return;
+ }
+
+ Map<int, String> flags;
+ for (int i = 0, j = 0; i < p_options.size(); i++, j++) {
+ Vector<String> text_split = p_options[i].split(":");
+ int64_t current_val = text_split[1].to_int();
+ flags[current_val] = text_split[0];
+
+ if (current_val == SIZE_EXPAND) {
+ continue;
+ }
+
+ CheckBox *cb = memnew(CheckBox);
+ cb->set_text(text_split[0]);
+ cb->set_clip_text(true);
+ cb->set_meta("_value", current_val);
+ cb->connect("pressed", callable_mp(this, &EditorPropertySizeFlags::_flag_toggled));
+ add_focusable(cb);
+
+ flag_options->add_child(cb);
+ flag_checks.append(cb);
+ }
+
+ Control *gui_base = EditorNode::get_singleton()->get_gui_base();
+ String wide_preset_icon = SNAME("ControlAlignHCenterWide");
+ if (vertical) {
+ wide_preset_icon = SNAME("ControlAlignVCenterWide");
+ }
+
+ flag_presets->clear();
+ if (flags.has(SIZE_FILL)) {
+ flag_presets->add_icon_item(gui_base->get_theme_icon(wide_preset_icon, SNAME("EditorIcons")), TTR("Fill"), SIZE_FLAGS_PRESET_FILL);
+ }
+ // Shrink Begin is the same as no flags at all, as such it cannot be disabled.
+ flag_presets->add_icon_item(gui_base->get_theme_icon(SNAME("ControlAlignCenterLeft"), SNAME("EditorIcons")), TTR("Shrink Begin"), SIZE_FLAGS_PRESET_SHRINK_BEGIN);
+ if (flags.has(SIZE_SHRINK_CENTER)) {
+ flag_presets->add_icon_item(gui_base->get_theme_icon(SNAME("ControlAlignCenter"), SNAME("EditorIcons")), TTR("Shrink Center"), SIZE_FLAGS_PRESET_SHRINK_CENTER);
+ }
+ if (flags.has(SIZE_SHRINK_END)) {
+ flag_presets->add_icon_item(gui_base->get_theme_icon(SNAME("ControlAlignCenterRight"), SNAME("EditorIcons")), TTR("Shrink End"), SIZE_FLAGS_PRESET_SHRINK_END);
+ }
+ flag_presets->add_separator();
+ flag_presets->add_item(TTR("Custom"), SIZE_FLAGS_PRESET_CUSTOM);
+
+ flag_expand->set_visible(flags.has(SIZE_EXPAND));
+}
+
+EditorPropertySizeFlags::EditorPropertySizeFlags() {
+ VBoxContainer *vb = memnew(VBoxContainer);
+ add_child(vb);
+
+ flag_presets = memnew(OptionButton);
+ flag_presets->set_clip_text(true);
+ flag_presets->set_flat(true);
+ vb->add_child(flag_presets);
+ add_focusable(flag_presets);
+ set_label_reference(flag_presets);
+ flag_presets->connect("item_selected", callable_mp(this, &EditorPropertySizeFlags::_preset_selected));
+
+ flag_options = memnew(VBoxContainer);
+ flag_options->hide();
+ vb->add_child(flag_options);
+
+ flag_expand = memnew(CheckBox);
+ flag_expand->set_text(TTR("Expand"));
+ vb->add_child(flag_expand);
+ add_focusable(flag_expand);
+ flag_expand->connect("pressed", callable_mp(this, &EditorPropertySizeFlags::_expand_toggled));
+}
+
+bool EditorInspectorPluginControl::can_handle(Object *p_object) {
+ return Object::cast_to<Control>(p_object) != nullptr;
+}
+
+void EditorInspectorPluginControl::parse_group(Object *p_object, const String &p_group) {
+ Control *control = Object::cast_to<Control>(p_object);
+ if (!control || p_group != "Layout") {
+ return;
+ }
+
+ ControlPositioningWarning *pos_warning = memnew(ControlPositioningWarning);
+ pos_warning->set_control(control);
+ add_custom_control(pos_warning);
+}
+
+bool EditorInspectorPluginControl::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+ Control *control = Object::cast_to<Control>(p_object);
+ if (!control) {
+ return false;
+ }
+
+ if (p_path == "anchors_preset") {
+ EditorPropertyAnchorsPreset *prop_editor = memnew(EditorPropertyAnchorsPreset);
+ Vector<String> options = p_hint_text.split(",");
+ prop_editor->setup(options);
+ add_property_editor(p_path, prop_editor);
+
+ return true;
+ }
+
+ if (p_path == "size_flags_horizontal" || p_path == "size_flags_vertical") {
+ EditorPropertySizeFlags *prop_editor = memnew(EditorPropertySizeFlags);
+ Vector<String> options;
+ if (!p_hint_text.is_empty()) {
+ options = p_hint_text.split(",");
+ }
+ prop_editor->setup(options, p_path == "size_flags_vertical");
+ add_property_editor(p_path, prop_editor);
+
+ return true;
+ }
+
+ return false;
+}
+
+void ControlEditorToolbar::_set_anchors_and_offsets_preset(Control::LayoutPreset p_preset) {
+ List<Node *> selection = editor_selection->get_selected_node_list();
+
+ undo_redo->create_action(TTR("Change Anchors and Offsets"));
+
+ for (Node *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
+ if (control) {
+ undo_redo->add_do_method(control, "set_anchors_preset", p_preset);
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_TOP_RIGHT:
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_LEFT:
+ case PRESET_CENTER_TOP:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_CENTER:
+ undo_redo->add_do_method(control, "set_offsets_preset", p_preset, Control::PRESET_MODE_KEEP_SIZE);
+ break;
+ case PRESET_LEFT_WIDE:
+ case PRESET_TOP_WIDE:
+ case PRESET_RIGHT_WIDE:
+ case PRESET_BOTTOM_WIDE:
+ case PRESET_VCENTER_WIDE:
+ case PRESET_HCENTER_WIDE:
+ case PRESET_WIDE:
+ undo_redo->add_do_method(control, "set_offsets_preset", p_preset, Control::PRESET_MODE_MINSIZE);
+ break;
+ }
+ undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
+ }
+ }
+
+ undo_redo->commit_action();
+
+ anchors_mode = false;
+ anchor_mode_button->set_pressed(anchors_mode);
+}
+
+void ControlEditorToolbar::_set_anchors_and_offsets_to_keep_ratio() {
+ List<Node *> selection = editor_selection->get_selected_node_list();
+
+ undo_redo->create_action(TTR("Change Anchors and Offsets"));
+
+ for (Node *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
+ if (control) {
+ Point2 top_left_anchor = _position_to_anchor(control, Point2());
+ Point2 bottom_right_anchor = _position_to_anchor(control, control->get_size());
+ undo_redo->add_do_method(control, "set_anchor", SIDE_LEFT, top_left_anchor.x, false, true);
+ undo_redo->add_do_method(control, "set_anchor", SIDE_RIGHT, bottom_right_anchor.x, false, true);
+ undo_redo->add_do_method(control, "set_anchor", SIDE_TOP, top_left_anchor.y, false, true);
+ undo_redo->add_do_method(control, "set_anchor", SIDE_BOTTOM, bottom_right_anchor.y, false, true);
+ undo_redo->add_do_method(control, "set_meta", "_edit_use_anchors_", true);
+
+ bool use_anchors = control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_");
+ undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
+ undo_redo->add_undo_method(control, "set_meta", "_edit_use_anchors_", use_anchors);
+
+ anchors_mode = true;
+ anchor_mode_button->set_pressed(anchors_mode);
+ }
+ }
+
+ undo_redo->commit_action();
+}
+
+void ControlEditorToolbar::_set_anchors_preset(Control::LayoutPreset p_preset) {
+ List<Node *> selection = editor_selection->get_selected_node_list();
+
+ undo_redo->create_action(TTR("Change Anchors"));
+ for (Node *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
+ if (control) {
+ undo_redo->add_do_method(control, "set_anchors_preset", p_preset);
+ undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
+ }
+ }
+
+ undo_redo->commit_action();
+}
+
+void ControlEditorToolbar::_set_container_h_preset(Control::SizeFlags p_preset) {
+ List<Node *> selection = editor_selection->get_selected_node_list();
+
+ undo_redo->create_action(TTR("Change Horizontal Size Flags"));
+ for (Node *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
+ if (control) {
+ undo_redo->add_do_method(control, "set_h_size_flags", p_preset);
+ undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
+ }
+ }
+
+ undo_redo->commit_action();
+}
+
+void ControlEditorToolbar::_set_container_v_preset(Control::SizeFlags p_preset) {
+ List<Node *> selection = editor_selection->get_selected_node_list();
+
+ undo_redo->create_action(TTR("Change Horizontal Size Flags"));
+ for (Node *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
+ if (control) {
+ undo_redo->add_do_method(control, "set_v_size_flags", p_preset);
+ undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
+ }
+ }
+
+ undo_redo->commit_action();
+}
+
+Vector2 ControlEditorToolbar::_anchor_to_position(const Control *p_control, Vector2 anchor) {
+ ERR_FAIL_COND_V(!p_control, Vector2());
+
+ Transform2D parent_transform = p_control->get_transform().affine_inverse();
+ Rect2 parent_rect = p_control->get_parent_anchorable_rect();
+
+ if (p_control->is_layout_rtl()) {
+ return parent_transform.xform(parent_rect.position + Vector2(parent_rect.size.x - parent_rect.size.x * anchor.x, parent_rect.size.y * anchor.y));
+ } else {
+ return parent_transform.xform(parent_rect.position + Vector2(parent_rect.size.x * anchor.x, parent_rect.size.y * anchor.y));
+ }
+}
+
+Vector2 ControlEditorToolbar::_position_to_anchor(const Control *p_control, Vector2 position) {
+ ERR_FAIL_COND_V(!p_control, Vector2());
+
+ Rect2 parent_rect = p_control->get_parent_anchorable_rect();
+
+ Vector2 output = Vector2();
+ if (p_control->is_layout_rtl()) {
+ output.x = (parent_rect.size.x == 0) ? 0.0 : (parent_rect.size.x - p_control->get_transform().xform(position).x - parent_rect.position.x) / parent_rect.size.x;
+ } else {
+ output.x = (parent_rect.size.x == 0) ? 0.0 : (p_control->get_transform().xform(position).x - parent_rect.position.x) / parent_rect.size.x;
+ }
+ output.y = (parent_rect.size.y == 0) ? 0.0 : (p_control->get_transform().xform(position).y - parent_rect.position.y) / parent_rect.size.y;
+ return output;
+}
+
+void ControlEditorToolbar::_button_toggle_anchor_mode(bool p_status) {
+ List<Control *> selection = _get_edited_controls(false, false);
+ for (Control *E : selection) {
+ if (Object::cast_to<Container>(E->get_parent())) {
+ continue;
+ }
+
+ E->set_meta("_edit_use_anchors_", p_status);
+ }
+
+ anchors_mode = p_status;
+ CanvasItemEditor::get_singleton()->update_viewport();
+}
+
+bool ControlEditorToolbar::_is_node_locked(const Node *p_node) {
+ return p_node->has_meta("_edit_lock_") && p_node->get_meta("_edit_lock_");
+}
+
+List<Control *> ControlEditorToolbar::_get_edited_controls(bool retrieve_locked, bool remove_controls_if_parent_in_selection) {
+ List<Control *> selection;
+ for (const KeyValue<Node *, Object *> &E : editor_selection->get_selection()) {
+ Control *control = Object::cast_to<Control>(E.key);
+ if (control && control->is_visible_in_tree() && control->get_viewport() == EditorNode::get_singleton()->get_scene_root() && (retrieve_locked || !_is_node_locked(control))) {
+ selection.push_back(control);
+ }
+ }
+
+ if (remove_controls_if_parent_in_selection) {
+ List<Control *> filtered_selection;
+ for (Control *E : selection) {
+ if (!selection.find(E->get_parent())) {
+ filtered_selection.push_back(E);
+ }
+ }
+ return filtered_selection;
+ }
+
+ return selection;
+}
+
+void ControlEditorToolbar::_popup_callback(int p_op) {
+ switch (p_op) {
+ case ANCHORS_AND_OFFSETS_PRESET_TOP_LEFT: {
+ _set_anchors_and_offsets_preset(PRESET_TOP_LEFT);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_TOP_RIGHT: {
+ _set_anchors_and_offsets_preset(PRESET_TOP_RIGHT);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_BOTTOM_LEFT: {
+ _set_anchors_and_offsets_preset(PRESET_BOTTOM_LEFT);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_BOTTOM_RIGHT: {
+ _set_anchors_and_offsets_preset(PRESET_BOTTOM_RIGHT);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_CENTER_LEFT: {
+ _set_anchors_and_offsets_preset(PRESET_CENTER_LEFT);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_CENTER_RIGHT: {
+ _set_anchors_and_offsets_preset(PRESET_CENTER_RIGHT);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_CENTER_TOP: {
+ _set_anchors_and_offsets_preset(PRESET_CENTER_TOP);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_CENTER_BOTTOM: {
+ _set_anchors_and_offsets_preset(PRESET_CENTER_BOTTOM);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_CENTER: {
+ _set_anchors_and_offsets_preset(PRESET_CENTER);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_TOP_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_TOP_WIDE);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_LEFT_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_LEFT_WIDE);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_RIGHT_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_RIGHT_WIDE);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_BOTTOM_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_BOTTOM_WIDE);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_VCENTER_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_VCENTER_WIDE);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_HCENTER_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_HCENTER_WIDE);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_WIDE: {
+ _set_anchors_and_offsets_preset(Control::PRESET_WIDE);
+ } break;
+ case ANCHORS_AND_OFFSETS_PRESET_KEEP_RATIO: {
+ _set_anchors_and_offsets_to_keep_ratio();
+ } break;
+
+ case ANCHORS_PRESET_TOP_LEFT: {
+ _set_anchors_preset(PRESET_TOP_LEFT);
+ } break;
+ case ANCHORS_PRESET_TOP_RIGHT: {
+ _set_anchors_preset(PRESET_TOP_RIGHT);
+ } break;
+ case ANCHORS_PRESET_BOTTOM_LEFT: {
+ _set_anchors_preset(PRESET_BOTTOM_LEFT);
+ } break;
+ case ANCHORS_PRESET_BOTTOM_RIGHT: {
+ _set_anchors_preset(PRESET_BOTTOM_RIGHT);
+ } break;
+ case ANCHORS_PRESET_CENTER_LEFT: {
+ _set_anchors_preset(PRESET_CENTER_LEFT);
+ } break;
+ case ANCHORS_PRESET_CENTER_RIGHT: {
+ _set_anchors_preset(PRESET_CENTER_RIGHT);
+ } break;
+ case ANCHORS_PRESET_CENTER_TOP: {
+ _set_anchors_preset(PRESET_CENTER_TOP);
+ } break;
+ case ANCHORS_PRESET_CENTER_BOTTOM: {
+ _set_anchors_preset(PRESET_CENTER_BOTTOM);
+ } break;
+ case ANCHORS_PRESET_CENTER: {
+ _set_anchors_preset(PRESET_CENTER);
+ } break;
+ case ANCHORS_PRESET_TOP_WIDE: {
+ _set_anchors_preset(PRESET_TOP_WIDE);
+ } break;
+ case ANCHORS_PRESET_LEFT_WIDE: {
+ _set_anchors_preset(PRESET_LEFT_WIDE);
+ } break;
+ case ANCHORS_PRESET_RIGHT_WIDE: {
+ _set_anchors_preset(PRESET_RIGHT_WIDE);
+ } break;
+ case ANCHORS_PRESET_BOTTOM_WIDE: {
+ _set_anchors_preset(PRESET_BOTTOM_WIDE);
+ } break;
+ case ANCHORS_PRESET_VCENTER_WIDE: {
+ _set_anchors_preset(PRESET_VCENTER_WIDE);
+ } break;
+ case ANCHORS_PRESET_HCENTER_WIDE: {
+ _set_anchors_preset(PRESET_HCENTER_WIDE);
+ } break;
+ case ANCHORS_PRESET_WIDE: {
+ _set_anchors_preset(Control::PRESET_WIDE);
+ } break;
+
+ case CONTAINERS_H_PRESET_FILL: {
+ _set_container_h_preset(Control::SIZE_FILL);
+ } break;
+ case CONTAINERS_H_PRESET_FILL_EXPAND: {
+ _set_container_h_preset(Control::SIZE_EXPAND_FILL);
+ } break;
+ case CONTAINERS_H_PRESET_SHRINK_BEGIN: {
+ _set_container_h_preset(Control::SIZE_SHRINK_BEGIN);
+ } break;
+ case CONTAINERS_H_PRESET_SHRINK_CENTER: {
+ _set_container_h_preset(Control::SIZE_SHRINK_CENTER);
+ } break;
+ case CONTAINERS_H_PRESET_SHRINK_END: {
+ _set_container_h_preset(Control::SIZE_SHRINK_END);
+ } break;
+
+ case CONTAINERS_V_PRESET_FILL: {
+ _set_container_v_preset(Control::SIZE_FILL);
+ } break;
+ case CONTAINERS_V_PRESET_FILL_EXPAND: {
+ _set_container_v_preset(Control::SIZE_EXPAND_FILL);
+ } break;
+ case CONTAINERS_V_PRESET_SHRINK_BEGIN: {
+ _set_container_v_preset(Control::SIZE_SHRINK_BEGIN);
+ } break;
+ case CONTAINERS_V_PRESET_SHRINK_CENTER: {
+ _set_container_v_preset(Control::SIZE_SHRINK_CENTER);
+ } break;
+ case CONTAINERS_V_PRESET_SHRINK_END: {
+ _set_container_v_preset(Control::SIZE_SHRINK_END);
+ } break;
+ }
+}
+
+void ControlEditorToolbar::_selection_changed() {
+ // Update the anchors_mode.
+ int nb_controls = 0;
+ int nb_valid_controls = 0;
+ int nb_anchors_mode = 0;
+
+ List<Node *> selection = editor_selection->get_selected_node_list();
+ for (Node *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
+ if (!control) {
+ continue;
+ }
+
+ nb_controls++;
+ if (Object::cast_to<Container>(control->get_parent())) {
+ continue;
+ }
+
+ nb_valid_controls++;
+ if (control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_")) {
+ nb_anchors_mode++;
+ }
+ }
+
+ anchors_mode = (nb_valid_controls == nb_anchors_mode);
+ anchor_mode_button->set_pressed(anchors_mode);
+
+ if (nb_controls > 0) {
+ set_physics_process(true);
+ } else {
+ set_physics_process(false);
+ set_visible(false);
+ }
+}
+
+void ControlEditorToolbar::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE:
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+ anchor_layouts_icon->set_texture(get_theme_icon(SNAME("ControlLayout"), SNAME("EditorIcons")));
+
+ PopupMenu *p = anchor_presets_menu->get_popup();
+ p->clear();
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignTopLeft"), SNAME("EditorIcons")), TTR("Top Left"), ANCHORS_AND_OFFSETS_PRESET_TOP_LEFT);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignTopRight"), SNAME("EditorIcons")), TTR("Top Right"), ANCHORS_AND_OFFSETS_PRESET_TOP_RIGHT);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomRight"), SNAME("EditorIcons")), TTR("Bottom Right"), ANCHORS_AND_OFFSETS_PRESET_BOTTOM_RIGHT);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomLeft"), SNAME("EditorIcons")), TTR("Bottom Left"), ANCHORS_AND_OFFSETS_PRESET_BOTTOM_LEFT);
+ p->add_separator();
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterLeft"), SNAME("EditorIcons")), TTR("Center Left"), ANCHORS_AND_OFFSETS_PRESET_CENTER_LEFT);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterTop"), SNAME("EditorIcons")), TTR("Center Top"), ANCHORS_AND_OFFSETS_PRESET_CENTER_TOP);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterRight"), SNAME("EditorIcons")), TTR("Center Right"), ANCHORS_AND_OFFSETS_PRESET_CENTER_RIGHT);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterBottom"), SNAME("EditorIcons")), TTR("Center Bottom"), ANCHORS_AND_OFFSETS_PRESET_CENTER_BOTTOM);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenter"), SNAME("EditorIcons")), TTR("Center"), ANCHORS_AND_OFFSETS_PRESET_CENTER);
+ p->add_separator();
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignLeftWide"), SNAME("EditorIcons")), TTR("Left Wide"), ANCHORS_AND_OFFSETS_PRESET_LEFT_WIDE);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignTopWide"), SNAME("EditorIcons")), TTR("Top Wide"), ANCHORS_AND_OFFSETS_PRESET_TOP_WIDE);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignRightWide"), SNAME("EditorIcons")), TTR("Right Wide"), ANCHORS_AND_OFFSETS_PRESET_RIGHT_WIDE);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomWide"), SNAME("EditorIcons")), TTR("Bottom Wide"), ANCHORS_AND_OFFSETS_PRESET_BOTTOM_WIDE);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignVCenterWide"), SNAME("EditorIcons")), TTR("VCenter Wide"), ANCHORS_AND_OFFSETS_PRESET_VCENTER_WIDE);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignHCenterWide"), SNAME("EditorIcons")), TTR("HCenter Wide"), ANCHORS_AND_OFFSETS_PRESET_HCENTER_WIDE);
+ p->add_separator();
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignWide"), SNAME("EditorIcons")), TTR("Full Rect"), ANCHORS_AND_OFFSETS_PRESET_WIDE);
+ p->add_icon_item(get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons")), TTR("Keep Current Ratio"), ANCHORS_AND_OFFSETS_PRESET_KEEP_RATIO);
+ p->set_item_tooltip(19, TTR("Adjust anchors and offsets to match the current rect size."));
+
+ p->add_separator();
+ p->add_submenu_item(TTR("Anchors only"), "Anchors");
+ p->set_item_icon(21, get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons")));
+
+ anchors_popup->clear();
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignTopLeft"), SNAME("EditorIcons")), TTR("Top Left"), ANCHORS_PRESET_TOP_LEFT);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignTopRight"), SNAME("EditorIcons")), TTR("Top Right"), ANCHORS_PRESET_TOP_RIGHT);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomRight"), SNAME("EditorIcons")), TTR("Bottom Right"), ANCHORS_PRESET_BOTTOM_RIGHT);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomLeft"), SNAME("EditorIcons")), TTR("Bottom Left"), ANCHORS_PRESET_BOTTOM_LEFT);
+ anchors_popup->add_separator();
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterLeft"), SNAME("EditorIcons")), TTR("Center Left"), ANCHORS_PRESET_CENTER_LEFT);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterTop"), SNAME("EditorIcons")), TTR("Center Top"), ANCHORS_PRESET_CENTER_TOP);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterRight"), SNAME("EditorIcons")), TTR("Center Right"), ANCHORS_PRESET_CENTER_RIGHT);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterBottom"), SNAME("EditorIcons")), TTR("Center Bottom"), ANCHORS_PRESET_CENTER_BOTTOM);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignCenter"), SNAME("EditorIcons")), TTR("Center"), ANCHORS_PRESET_CENTER);
+ anchors_popup->add_separator();
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignLeftWide"), SNAME("EditorIcons")), TTR("Left Wide"), ANCHORS_PRESET_LEFT_WIDE);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignTopWide"), SNAME("EditorIcons")), TTR("Top Wide"), ANCHORS_PRESET_TOP_WIDE);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignRightWide"), SNAME("EditorIcons")), TTR("Right Wide"), ANCHORS_PRESET_RIGHT_WIDE);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignBottomWide"), SNAME("EditorIcons")), TTR("Bottom Wide"), ANCHORS_PRESET_BOTTOM_WIDE);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignVCenterWide"), SNAME("EditorIcons")), TTR("VCenter Wide"), ANCHORS_PRESET_VCENTER_WIDE);
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignHCenterWide"), SNAME("EditorIcons")), TTR("HCenter Wide"), ANCHORS_PRESET_HCENTER_WIDE);
+ anchors_popup->add_separator();
+ anchors_popup->add_icon_item(get_theme_icon(SNAME("ControlAlignWide"), SNAME("EditorIcons")), TTR("Full Rect"), ANCHORS_PRESET_WIDE);
+
+ anchor_mode_button->set_icon(get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons")));
+
+ container_layouts_icon->set_texture(get_theme_icon(SNAME("Container"), SNAME("EditorIcons")));
+
+ p = container_h_presets_menu->get_popup();
+ p->clear();
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignHCenterWide"), SNAME("EditorIcons")), TTR("Fill"), CONTAINERS_H_PRESET_FILL);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignHCenterWide"), SNAME("EditorIcons")), TTR("Fill & Expand"), CONTAINERS_H_PRESET_FILL_EXPAND);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterLeft"), SNAME("EditorIcons")), TTR("Shrink Begin"), CONTAINERS_H_PRESET_SHRINK_BEGIN);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenter"), SNAME("EditorIcons")), TTR("Shrink Center"), CONTAINERS_H_PRESET_SHRINK_CENTER);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterRight"), SNAME("EditorIcons")), TTR("Shrink End"), CONTAINERS_H_PRESET_SHRINK_END);
+
+ p = container_v_presets_menu->get_popup();
+ p->clear();
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignVCenterWide"), SNAME("EditorIcons")), TTR("Fill"), CONTAINERS_V_PRESET_FILL);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignVCenterWide"), SNAME("EditorIcons")), TTR("Fill & Expand"), CONTAINERS_V_PRESET_FILL_EXPAND);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterTop"), SNAME("EditorIcons")), TTR("Shrink Begin"), CONTAINERS_V_PRESET_SHRINK_BEGIN);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenter"), SNAME("EditorIcons")), TTR("Shrink Center"), CONTAINERS_V_PRESET_SHRINK_CENTER);
+ p->add_icon_item(get_theme_icon(SNAME("ControlAlignCenterBottom"), SNAME("EditorIcons")), TTR("Shrink End"), CONTAINERS_V_PRESET_SHRINK_END);
+ } break;
+
+ case NOTIFICATION_PHYSICS_PROCESS: {
+ bool has_control_parents = false;
+ bool has_container_parents = false;
+
+ // Update the viewport if the canvas_item changes
+ List<Control *> selection = _get_edited_controls(true);
+ for (Control *control : selection) {
+ if (Object::cast_to<Control>(control->get_parent())) {
+ has_control_parents = true;
+ }
+ if (Object::cast_to<Container>(control->get_parent())) {
+ has_container_parents = true;
+ }
+ }
+
+ // Show / Hide the control layout buttons.
+ if (selection.size() > 0) {
+ set_visible(true);
+
+ // Toggle anchor and container layout buttons depending on parents of the selected nodes.
+ // - If there are no control parents, enable everything.
+ // - If there are container parents, then enable only container buttons.
+ // - If there are NO container parents, then enable only anchor buttons.
+ bool enable_anchors = false;
+ bool enable_containers = false;
+ if (!has_control_parents) {
+ enable_anchors = true;
+ enable_containers = true;
+ } else if (has_container_parents) {
+ enable_containers = true;
+ } else {
+ enable_anchors = true;
+ }
+
+ if (enable_anchors) {
+ anchor_presets_menu->set_disabled(false);
+ anchor_presets_menu->set_tooltip(TTR("Presets for the anchor and offset values of a Control node."));
+ anchor_mode_button->set_disabled(false);
+ anchor_mode_button->set_tooltip(TTR("When active, moving Control nodes changes their anchors instead of their offsets."));
+ } else {
+ anchor_presets_menu->set_disabled(true);
+ anchor_presets_menu->set_tooltip(TTR("Children of containers have their anchors and offsets values controlled by their parent."));
+ anchor_mode_button->set_disabled(true);
+ anchor_mode_button->set_tooltip(TTR("Children of containers have their anchors and offsets values controlled by their parent."));
+ }
+
+ if (enable_containers) {
+ container_h_presets_menu->set_disabled(false);
+ container_h_presets_menu->set_tooltip(TTR("Horizontal sizing setting for children of a Container node."));
+ container_v_presets_menu->set_disabled(false);
+ container_v_presets_menu->set_tooltip(TTR("Vertical sizing setting for children of a Container node."));
+ } else {
+ container_h_presets_menu->set_disabled(true);
+ container_h_presets_menu->set_tooltip(TTR("Children of regular controls are controlled by their anchors and offsets."));
+ container_v_presets_menu->set_disabled(true);
+ container_v_presets_menu->set_tooltip(TTR("Children of regular controls are controlled by their anchors and offsets."));
+ }
+ } else {
+ set_visible(false);
+ }
+ } break;
+ }
+}
+
+ControlEditorToolbar::ControlEditorToolbar(EditorNode *p_editor) {
+ anchor_layouts_icon = memnew(TextureRect);
+ anchor_layouts_icon->set_stretch_mode(TextureRect::StretchMode::STRETCH_KEEP_CENTERED);
+ add_child(anchor_layouts_icon);
+
+ Label *l = memnew(Label);
+ l->set_text(TTR("Anchors"));
+ l->set_vertical_alignment(VerticalAlignment::VERTICAL_ALIGNMENT_CENTER);
+ add_child(l);
+
+ anchor_presets_menu = memnew(MenuButton);
+ anchor_presets_menu->set_shortcut_context(this);
+ anchor_presets_menu->set_text(TTR("Preset"));
+ add_child(anchor_presets_menu);
+ anchor_presets_menu->set_switch_on_hover(true);
+
+ PopupMenu *p = anchor_presets_menu->get_popup();
+ p->connect("id_pressed", callable_mp(this, &ControlEditorToolbar::_popup_callback));
+
+ anchors_popup = memnew(PopupMenu);
+ p->add_child(anchors_popup);
+ anchors_popup->set_name("Anchors");
+ anchors_popup->connect("id_pressed", callable_mp(this, &ControlEditorToolbar::_popup_callback));
+
+ anchor_mode_button = memnew(Button);
+ anchor_mode_button->set_flat(true);
+ anchor_mode_button->set_toggle_mode(true);
+ add_child(anchor_mode_button);
+ anchor_mode_button->connect("toggled", callable_mp(this, &ControlEditorToolbar::_button_toggle_anchor_mode));
+
+ add_child(memnew(VSeparator));
+
+ container_layouts_icon = memnew(TextureRect);
+ container_layouts_icon->set_stretch_mode(TextureRect::StretchMode::STRETCH_KEEP_CENTERED);
+ add_child(container_layouts_icon);
+
+ l = memnew(Label);
+ l->set_text(TTR("Containers"));
+ l->set_vertical_alignment(VerticalAlignment::VERTICAL_ALIGNMENT_CENTER);
+ add_child(l);
+
+ container_h_presets_menu = memnew(MenuButton);
+ container_h_presets_menu->set_shortcut_context(this);
+ container_h_presets_menu->set_text(TTR("Horizontal"));
+ add_child(container_h_presets_menu);
+ container_h_presets_menu->set_switch_on_hover(true);
+
+ p = container_h_presets_menu->get_popup();
+ p->connect("id_pressed", callable_mp(this, &ControlEditorToolbar::_popup_callback));
+
+ container_v_presets_menu = memnew(MenuButton);
+ container_v_presets_menu->set_shortcut_context(this);
+ container_v_presets_menu->set_text(TTR("Vertical"));
+ add_child(container_v_presets_menu);
+ container_v_presets_menu->set_switch_on_hover(true);
+
+ p = container_v_presets_menu->get_popup();
+ p->connect("id_pressed", callable_mp(this, &ControlEditorToolbar::_popup_callback));
+
+ undo_redo = p_editor->get_undo_redo();
+ editor_selection = p_editor->get_editor_selection();
+ editor_selection->add_editor_plugin(this);
+ editor_selection->connect("selection_changed", callable_mp(this, &ControlEditorToolbar::_selection_changed));
+
+ singleton = this;
+}
+
+ControlEditorToolbar *ControlEditorToolbar::singleton = nullptr;
+
+ControlEditorPlugin::ControlEditorPlugin(EditorNode *p_editor) {
+ editor = p_editor;
+
+ toolbar = memnew(ControlEditorToolbar(editor));
+ toolbar->hide();
+ add_control_to_container(CONTAINER_CANVAS_EDITOR_MENU, toolbar);
+
+ Ref<EditorInspectorPluginControl> plugin;
+ plugin.instantiate();
+ add_inspector_plugin(plugin);
+}
diff --git a/editor/plugins/control_editor_plugin.h b/editor/plugins/control_editor_plugin.h
new file mode 100644
index 0000000000..610846a97b
--- /dev/null
+++ b/editor/plugins/control_editor_plugin.h
@@ -0,0 +1,255 @@
+/*************************************************************************/
+/* control_editor_plugin.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. 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 CONTROL_EDITOR_PLUGIN_H
+#define CONTROL_EDITOR_PLUGIN_H
+
+#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
+
+#include "scene/gui/box_container.h"
+#include "scene/gui/check_box.h"
+#include "scene/gui/control.h"
+#include "scene/gui/label.h"
+#include "scene/gui/margin_container.h"
+#include "scene/gui/option_button.h"
+#include "scene/gui/panel_container.h"
+#include "scene/gui/texture_rect.h"
+
+class ControlPositioningWarning : public MarginContainer {
+ GDCLASS(ControlPositioningWarning, MarginContainer);
+
+ Control *control_node = nullptr;
+
+ PanelContainer *bg_panel = nullptr;
+ GridContainer *grid = nullptr;
+ TextureRect *title_icon = nullptr;
+ TextureRect *hint_icon = nullptr;
+ Label *title_label = nullptr;
+ Label *hint_label = nullptr;
+ Control *hint_filler_left = nullptr;
+ Control *hint_filler_right = nullptr;
+
+ void _update_warning();
+ void _update_toggler();
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
+
+protected:
+ void _notification(int p_notification);
+
+public:
+ void set_control(Control *p_node);
+
+ ControlPositioningWarning();
+};
+
+class EditorPropertyAnchorsPreset : public EditorProperty {
+ GDCLASS(EditorPropertyAnchorsPreset, EditorProperty);
+ OptionButton *options;
+
+ void _option_selected(int p_which);
+
+protected:
+ virtual void _set_read_only(bool p_read_only) override;
+
+public:
+ void setup(const Vector<String> &p_options);
+ virtual void update_property() override;
+ EditorPropertyAnchorsPreset();
+};
+
+class EditorPropertySizeFlags : public EditorProperty {
+ GDCLASS(EditorPropertySizeFlags, EditorProperty);
+
+ enum FlagPreset {
+ SIZE_FLAGS_PRESET_FILL,
+ SIZE_FLAGS_PRESET_SHRINK_BEGIN,
+ SIZE_FLAGS_PRESET_SHRINK_CENTER,
+ SIZE_FLAGS_PRESET_SHRINK_END,
+ SIZE_FLAGS_PRESET_CUSTOM,
+ };
+
+ OptionButton *flag_presets;
+ CheckBox *flag_expand;
+ VBoxContainer *flag_options;
+ Vector<CheckBox *> flag_checks;
+
+ bool vertical = false;
+
+ bool keep_selected_preset = false;
+
+ void _preset_selected(int p_which);
+ void _expand_toggled();
+ void _flag_toggled();
+
+protected:
+ virtual void _set_read_only(bool p_read_only) override;
+
+public:
+ void setup(const Vector<String> &p_options, bool p_vertical);
+ virtual void update_property() override;
+ EditorPropertySizeFlags();
+};
+
+class EditorInspectorPluginControl : public EditorInspectorPlugin {
+ GDCLASS(EditorInspectorPluginControl, EditorInspectorPlugin);
+
+public:
+ virtual bool can_handle(Object *p_object) override;
+ virtual void parse_group(Object *p_object, const String &p_group) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
+};
+
+class ControlEditorToolbar : public HBoxContainer {
+ GDCLASS(ControlEditorToolbar, HBoxContainer);
+
+ UndoRedo *undo_redo;
+ EditorSelection *editor_selection;
+
+ enum MenuOption {
+ ANCHORS_AND_OFFSETS_PRESET_TOP_LEFT,
+ ANCHORS_AND_OFFSETS_PRESET_TOP_RIGHT,
+ ANCHORS_AND_OFFSETS_PRESET_BOTTOM_LEFT,
+ ANCHORS_AND_OFFSETS_PRESET_BOTTOM_RIGHT,
+ ANCHORS_AND_OFFSETS_PRESET_CENTER_LEFT,
+ ANCHORS_AND_OFFSETS_PRESET_CENTER_RIGHT,
+ ANCHORS_AND_OFFSETS_PRESET_CENTER_TOP,
+ ANCHORS_AND_OFFSETS_PRESET_CENTER_BOTTOM,
+ ANCHORS_AND_OFFSETS_PRESET_CENTER,
+ ANCHORS_AND_OFFSETS_PRESET_TOP_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_LEFT_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_RIGHT_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_BOTTOM_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_VCENTER_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_HCENTER_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_WIDE,
+
+ ANCHORS_AND_OFFSETS_PRESET_KEEP_RATIO,
+
+ ANCHORS_PRESET_TOP_LEFT,
+ ANCHORS_PRESET_TOP_RIGHT,
+ ANCHORS_PRESET_BOTTOM_LEFT,
+ ANCHORS_PRESET_BOTTOM_RIGHT,
+ ANCHORS_PRESET_CENTER_LEFT,
+ ANCHORS_PRESET_CENTER_RIGHT,
+ ANCHORS_PRESET_CENTER_TOP,
+ ANCHORS_PRESET_CENTER_BOTTOM,
+ ANCHORS_PRESET_CENTER,
+ ANCHORS_PRESET_TOP_WIDE,
+ ANCHORS_PRESET_LEFT_WIDE,
+ ANCHORS_PRESET_RIGHT_WIDE,
+ ANCHORS_PRESET_BOTTOM_WIDE,
+ ANCHORS_PRESET_VCENTER_WIDE,
+ ANCHORS_PRESET_HCENTER_WIDE,
+ ANCHORS_PRESET_WIDE,
+
+ // Offsets Presets are not currently in use.
+ OFFSETS_PRESET_TOP_LEFT,
+ OFFSETS_PRESET_TOP_RIGHT,
+ OFFSETS_PRESET_BOTTOM_LEFT,
+ OFFSETS_PRESET_BOTTOM_RIGHT,
+ OFFSETS_PRESET_CENTER_LEFT,
+ OFFSETS_PRESET_CENTER_RIGHT,
+ OFFSETS_PRESET_CENTER_TOP,
+ OFFSETS_PRESET_CENTER_BOTTOM,
+ OFFSETS_PRESET_CENTER,
+ OFFSETS_PRESET_TOP_WIDE,
+ OFFSETS_PRESET_LEFT_WIDE,
+ OFFSETS_PRESET_RIGHT_WIDE,
+ OFFSETS_PRESET_BOTTOM_WIDE,
+ OFFSETS_PRESET_VCENTER_WIDE,
+ OFFSETS_PRESET_HCENTER_WIDE,
+ OFFSETS_PRESET_WIDE,
+
+ CONTAINERS_H_PRESET_FILL,
+ CONTAINERS_H_PRESET_FILL_EXPAND,
+ CONTAINERS_H_PRESET_SHRINK_BEGIN,
+ CONTAINERS_H_PRESET_SHRINK_CENTER,
+ CONTAINERS_H_PRESET_SHRINK_END,
+ CONTAINERS_V_PRESET_FILL,
+ CONTAINERS_V_PRESET_FILL_EXPAND,
+ CONTAINERS_V_PRESET_SHRINK_BEGIN,
+ CONTAINERS_V_PRESET_SHRINK_CENTER,
+ CONTAINERS_V_PRESET_SHRINK_END,
+ };
+
+ TextureRect *anchor_layouts_icon;
+ MenuButton *anchor_presets_menu;
+ PopupMenu *anchors_popup;
+ TextureRect *container_layouts_icon;
+ MenuButton *container_h_presets_menu;
+ MenuButton *container_v_presets_menu;
+
+ Button *anchor_mode_button;
+
+ bool anchors_mode = false;
+
+ void _set_anchors_preset(Control::LayoutPreset p_preset);
+ void _set_anchors_and_offsets_preset(Control::LayoutPreset p_preset);
+ void _set_anchors_and_offsets_to_keep_ratio();
+ void _set_container_h_preset(Control::SizeFlags p_preset);
+ void _set_container_v_preset(Control::SizeFlags p_preset);
+
+ Vector2 _anchor_to_position(const Control *p_control, Vector2 anchor);
+ Vector2 _position_to_anchor(const Control *p_control, Vector2 position);
+
+ void _button_toggle_anchor_mode(bool p_status);
+
+ bool _is_node_locked(const Node *p_node);
+ List<Control *> _get_edited_controls(bool retrieve_locked = false, bool remove_controls_if_parent_in_selection = true);
+ void _popup_callback(int p_op);
+ void _selection_changed();
+
+protected:
+ void _notification(int p_notification);
+
+ static ControlEditorToolbar *singleton;
+
+public:
+ bool is_anchors_mode_enabled() { return anchors_mode; };
+
+ static ControlEditorToolbar *get_singleton() { return singleton; }
+
+ ControlEditorToolbar(EditorNode *p_editor);
+};
+
+class ControlEditorPlugin : public EditorPlugin {
+ GDCLASS(ControlEditorPlugin, EditorPlugin);
+
+ EditorNode *editor;
+ ControlEditorToolbar *toolbar;
+
+public:
+ virtual String get_name() const override { return "Control"; }
+
+ ControlEditorPlugin(EditorNode *p_editor);
+};
+
+#endif //CONTROL_EDITOR_PLUGIN_H
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
index e0364dc952..43a89f9cd3 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
@@ -32,6 +32,8 @@
#include "canvas_item_editor_plugin.h"
#include "core/io/image_loader.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "scene/2d/cpu_particles_2d.h"
#include "scene/gui/separator.h"
#include "scene/resources/particles_material.h"
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.h b/editor/plugins/cpu_particles_2d_editor_plugin.h
index e54e1651bd..9922f04049 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.h
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.h
@@ -31,12 +31,15 @@
#ifndef CPU_PARTICLES_2D_EDITOR_PLUGIN_H
#define CPU_PARTICLES_2D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/collision_polygon_2d.h"
#include "scene/2d/cpu_particles_2d.h"
#include "scene/gui/box_container.h"
-#include "scene/gui/file_dialog.h"
+
+class EditorNode;
+class EditorPlugin;
+class SpinBox;
+class EditorFileDialog;
class CPUParticles2DEditorPlugin : public EditorPlugin {
GDCLASS(CPUParticles2DEditorPlugin, EditorPlugin);
diff --git a/editor/plugins/cpu_particles_3d_editor_plugin.cpp b/editor/plugins/cpu_particles_3d_editor_plugin.cpp
index bb10c04e8f..d85d6b13e7 100644
--- a/editor/plugins/cpu_particles_3d_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_3d_editor_plugin.cpp
@@ -30,7 +30,10 @@
#include "cpu_particles_3d_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/plugins/node_3d_editor_plugin.h"
+#include "editor/scene_tree_editor.h"
+#include "scene/gui/menu_button.h"
void CPUParticles3DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
diff --git a/editor/plugins/cpu_particles_3d_editor_plugin.h b/editor/plugins/cpu_particles_3d_editor_plugin.h
index 67cc156680..4b2cd0dd8c 100644
--- a/editor/plugins/cpu_particles_3d_editor_plugin.h
+++ b/editor/plugins/cpu_particles_3d_editor_plugin.h
@@ -34,6 +34,8 @@
#include "editor/plugins/gpu_particles_3d_editor_plugin.h"
#include "scene/3d/cpu_particles_3d.h"
+class EditorNode;
+
class CPUParticles3DEditor : public GPUParticles3DEditorBase {
GDCLASS(CPUParticles3DEditor, GPUParticles3DEditorBase);
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index a9a276fc18..7abf66dac6 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -34,6 +34,7 @@
#include "core/core_string_names.h"
#include "core/input/input.h"
#include "core/os/keyboard.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
CurveEditor::CurveEditor() {
diff --git a/editor/plugins/curve_editor_plugin.h b/editor/plugins/curve_editor_plugin.h
index c7e8dea75a..2a90f6cfc9 100644
--- a/editor/plugins/curve_editor_plugin.h
+++ b/editor/plugins/curve_editor_plugin.h
@@ -31,11 +31,12 @@
#ifndef CURVE_EDITOR_PLUGIN_H
#define CURVE_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/editor_resource_preview.h"
#include "scene/resources/curve.h"
+class EditorNode;
+
// Edits a y(x) curve
class CurveEditor : public Control {
GDCLASS(CurveEditor, Control);
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index d23b52014e..5dd92d3c3f 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -30,6 +30,7 @@
#include "editor_preview_plugins.h"
+#include "core/config/project_settings.h"
#include "core/io/file_access_memory.h"
#include "core/io/resource_loader.h"
#include "core/os/os.h"
diff --git a/editor/plugins/font_editor_plugin.cpp b/editor/plugins/font_editor_plugin.cpp
index 73a6781774..f7015608a1 100644
--- a/editor/plugins/font_editor_plugin.cpp
+++ b/editor/plugins/font_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "font_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
void FontDataPreview::_notification(int p_what) {
diff --git a/editor/plugins/font_editor_plugin.h b/editor/plugins/font_editor_plugin.h
index 736137121a..ef3c8efccf 100644
--- a/editor/plugins/font_editor_plugin.h
+++ b/editor/plugins/font_editor_plugin.h
@@ -31,11 +31,12 @@
#ifndef FONT_EDITOR_PLUGIN_H
#define FONT_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/resources/font.h"
#include "scene/resources/text_line.h"
+class EditorNode;
+
class FontDataPreview : public Control {
GDCLASS(FontDataPreview, Control);
diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
index 06be9d678f..68d665f059 100644
--- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
@@ -32,6 +32,9 @@
#include "canvas_item_editor_plugin.h"
#include "core/io/image_loader.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+#include "editor/scene_tree_dock.h"
#include "scene/2d/cpu_particles_2d.h"
#include "scene/gui/separator.h"
#include "scene/resources/particles_material.h"
diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.h b/editor/plugins/gpu_particles_2d_editor_plugin.h
index 55e455e252..c2f3059542 100644
--- a/editor/plugins/gpu_particles_2d_editor_plugin.h
+++ b/editor/plugins/gpu_particles_2d_editor_plugin.h
@@ -31,12 +31,14 @@
#ifndef PARTICLES_2D_EDITOR_PLUGIN_H
#define PARTICLES_2D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/collision_polygon_2d.h"
#include "scene/2d/gpu_particles_2d.h"
#include "scene/gui/box_container.h"
-#include "scene/gui/file_dialog.h"
+#include "scene/gui/spin_box.h"
+
+class EditorNode;
+class EditorFileDialog;
class GPUParticles2DEditorPlugin : public EditorPlugin {
GDCLASS(GPUParticles2DEditorPlugin, EditorPlugin);
diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.cpp b/editor/plugins/gpu_particles_3d_editor_plugin.cpp
index 087b0a26b7..45ac58eb5a 100644
--- a/editor/plugins/gpu_particles_3d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_3d_editor_plugin.cpp
@@ -31,7 +31,9 @@
#include "gpu_particles_3d_editor_plugin.h"
#include "core/io/resource_loader.h"
+#include "editor/editor_node.h"
#include "editor/plugins/node_3d_editor_plugin.h"
+#include "editor/scene_tree_dock.h"
#include "scene/3d/cpu_particles_3d.h"
#include "scene/resources/particles_material.h"
diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.h b/editor/plugins/gpu_particles_3d_editor_plugin.h
index f7e4244ba4..37d660090a 100644
--- a/editor/plugins/gpu_particles_3d_editor_plugin.h
+++ b/editor/plugins/gpu_particles_3d_editor_plugin.h
@@ -31,11 +31,13 @@
#ifndef PARTICLES_EDITOR_PLUGIN_H
#define PARTICLES_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/gpu_particles_3d.h"
#include "scene/gui/spin_box.h"
+class EditorNode;
+class SceneTreeDialog;
+
class GPUParticles3DEditorBase : public Control {
GDCLASS(GPUParticles3DEditorBase, Control);
diff --git a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
index 1b4c944876..92a074ce60 100644
--- a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
@@ -30,6 +30,9 @@
#include "gpu_particles_collision_sdf_editor_plugin.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+
void GPUParticlesCollisionSDF3DEditorPlugin::_bake() {
if (col_sdf) {
if (col_sdf->get_texture().is_null() || !col_sdf->get_texture()->get_path().is_resource_file()) {
diff --git a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.h b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.h
index d74986f22b..c1d5e3194b 100644
--- a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.h
+++ b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.h
@@ -31,11 +31,14 @@
#ifndef GPU_PARTICLES_COLLISION_SDF_EDITOR_PLUGIN_H
#define GPU_PARTICLES_COLLISION_SDF_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/gpu_particles_collision_3d.h"
#include "scene/resources/material.h"
+class EditorNode;
+struct EditorProgress;
+class EditorFileDialog;
+
class GPUParticlesCollisionSDF3DEditorPlugin : public EditorPlugin {
GDCLASS(GPUParticlesCollisionSDF3DEditorPlugin, EditorPlugin);
diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp
index 5e300d3de9..6165915bdd 100644
--- a/editor/plugins/gradient_editor_plugin.cpp
+++ b/editor/plugins/gradient_editor_plugin.cpp
@@ -31,6 +31,7 @@
#include "gradient_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "node_3d_editor_plugin.h"
diff --git a/editor/plugins/gradient_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h
index 8239711667..f0aca15bfe 100644
--- a/editor/plugins/gradient_editor_plugin.h
+++ b/editor/plugins/gradient_editor_plugin.h
@@ -31,10 +31,11 @@
#ifndef GRADIENT_EDITOR_PLUGIN_H
#define GRADIENT_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/gui/gradient_edit.h"
+class EditorNode;
+
class GradientEditor : public GradientEdit {
GDCLASS(GradientEditor, GradientEdit);
diff --git a/editor/plugins/input_event_editor_plugin.cpp b/editor/plugins/input_event_editor_plugin.cpp
index b0ee88479a..bf31d9a96b 100644
--- a/editor/plugins/input_event_editor_plugin.cpp
+++ b/editor/plugins/input_event_editor_plugin.cpp
@@ -30,6 +30,8 @@
#include "input_event_editor_plugin.h"
+#include "editor/editor_node.h"
+
void InputEventConfigContainer::_bind_methods() {
}
diff --git a/editor/plugins/input_event_editor_plugin.h b/editor/plugins/input_event_editor_plugin.h
index ed26890229..fde2f0a5e8 100644
--- a/editor/plugins/input_event_editor_plugin.h
+++ b/editor/plugins/input_event_editor_plugin.h
@@ -33,7 +33,8 @@
#include "editor/action_map_editor.h"
#include "editor/editor_inspector.h"
-#include "editor/editor_node.h"
+
+class EditorNode;
class InputEventConfigContainer : public HBoxContainer {
GDCLASS(InputEventConfigContainer, HBoxContainer);
diff --git a/editor/plugins/lightmap_gi_editor_plugin.cpp b/editor/plugins/lightmap_gi_editor_plugin.cpp
index 2126ca1bc9..5f5e95bc7d 100644
--- a/editor/plugins/lightmap_gi_editor_plugin.cpp
+++ b/editor/plugins/lightmap_gi_editor_plugin.cpp
@@ -30,6 +30,9 @@
#include "lightmap_gi_editor_plugin.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+
void LightmapGIEditorPlugin::_bake_select_file(const String &p_file) {
if (lightmap) {
LightmapGI::BakeError err;
diff --git a/editor/plugins/lightmap_gi_editor_plugin.h b/editor/plugins/lightmap_gi_editor_plugin.h
index 5eec972228..84c3947e0b 100644
--- a/editor/plugins/lightmap_gi_editor_plugin.h
+++ b/editor/plugins/lightmap_gi_editor_plugin.h
@@ -31,11 +31,14 @@
#ifndef BAKED_LIGHTMAP_EDITOR_PLUGIN_H
#define BAKED_LIGHTMAP_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/lightmap_gi.h"
#include "scene/resources/material.h"
+class EditorNode;
+struct EditorProgress;
+class EditorFileDialog;
+
class LightmapGIEditorPlugin : public EditorPlugin {
GDCLASS(LightmapGIEditorPlugin, EditorPlugin);
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index 9d45c365a8..b3b5abf9c4 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "material_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/gui/subviewport_container.h"
#include "scene/resources/fog_material.h"
diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h
index 53f4513396..f1f60d180f 100644
--- a/editor/plugins/material_editor_plugin.h
+++ b/editor/plugins/material_editor_plugin.h
@@ -34,7 +34,6 @@
#include "editor/property_editor.h"
#include "scene/resources/primitive_meshes.h"
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/light_3d.h"
@@ -42,6 +41,7 @@
#include "scene/gui/color_rect.h"
#include "scene/resources/material.h"
+class EditorNode;
class SubViewportContainer;
class MaterialEditor : public Control {
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp
index daf68f247d..8c9bbf058e 100644
--- a/editor/plugins/mesh_editor_plugin.cpp
+++ b/editor/plugins/mesh_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "mesh_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
void MeshEditor::gui_input(const Ref<InputEvent> &p_event) {
diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h
index 613680e870..83838bc1fe 100644
--- a/editor/plugins/mesh_editor_plugin.h
+++ b/editor/plugins/mesh_editor_plugin.h
@@ -31,7 +31,6 @@
#ifndef MESH_EDITOR_PLUGIN_H
#define MESH_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/light_3d.h"
@@ -39,6 +38,8 @@
#include "scene/gui/subviewport_container.h"
#include "scene/resources/material.h"
+class EditorNode;
+
class MeshEditor : public SubViewportContainer {
GDCLASS(MeshEditor, SubViewportContainer);
diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp
index 75e9cc23a1..4888f29b7b 100644
--- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp
+++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "mesh_instance_3d_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "node_3d_editor_plugin.h"
#include "scene/3d/collision_shape_3d.h"
diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.h b/editor/plugins/mesh_instance_3d_editor_plugin.h
index 1df72d107c..14829a4ef3 100644
--- a/editor/plugins/mesh_instance_3d_editor_plugin.h
+++ b/editor/plugins/mesh_instance_3d_editor_plugin.h
@@ -31,11 +31,12 @@
#ifndef MESH_INSTANCE_EDITOR_PLUGIN_H
#define MESH_INSTANCE_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/spin_box.h"
+class EditorNode;
+
class MeshInstance3DEditor : public Control {
GDCLASS(MeshInstance3DEditor, Control);
diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp
index e47381b8a0..23ba3d4cf4 100644
--- a/editor/plugins/mesh_library_editor_plugin.cpp
+++ b/editor/plugins/mesh_library_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "mesh_library_editor_plugin.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "main/main.h"
diff --git a/editor/plugins/mesh_library_editor_plugin.h b/editor/plugins/mesh_library_editor_plugin.h
index 7144f87ba6..c459478db7 100644
--- a/editor/plugins/mesh_library_editor_plugin.h
+++ b/editor/plugins/mesh_library_editor_plugin.h
@@ -31,9 +31,14 @@
#ifndef MESH_LIBRARY_EDITOR_PLUGIN_H
#define MESH_LIBRARY_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
#include "scene/resources/mesh_library.h"
+class EditorNode;
+class EditorFileDialog;
+class ConfirmationDialog;
+class MenuButton;
+
class MeshLibraryEditor : public Control {
GDCLASS(MeshLibraryEditor, Control);
diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp
index 4ec65ea257..cef34a4909 100644
--- a/editor/plugins/multimesh_editor_plugin.cpp
+++ b/editor/plugins/multimesh_editor_plugin.cpp
@@ -30,6 +30,8 @@
#include "multimesh_editor_plugin.h"
+#include "editor/editor_node.h"
+#include "editor/scene_tree_editor.h"
#include "node_3d_editor_plugin.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/box_container.h"
diff --git a/editor/plugins/multimesh_editor_plugin.h b/editor/plugins/multimesh_editor_plugin.h
index ae18edd90a..03f8921dfb 100644
--- a/editor/plugins/multimesh_editor_plugin.h
+++ b/editor/plugins/multimesh_editor_plugin.h
@@ -31,11 +31,14 @@
#ifndef MULTIMESH_EDITOR_PLUGIN_H
#define MULTIMESH_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/multimesh_instance_3d.h"
+#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
+class EditorNode;
+class SceneTreeDialog;
+
class MultiMeshEditor : public Control {
GDCLASS(MultiMeshEditor, Control);
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index b4b1cf05ac..9f432a1fc7 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -33,6 +33,8 @@
#include "core/math/convex_hull.h"
#include "core/math/geometry_2d.h"
#include "core/math/geometry_3d.h"
+#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/audio_listener_3d.h"
#include "scene/3d/audio_stream_player_3d.h"
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 9884c45916..d62bb3814f 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -42,6 +42,7 @@
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/node_3d_editor_gizmos.h"
#include "editor/plugins/script_editor_plugin.h"
+#include "editor/scene_tree_dock.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/collision_shape_3d.h"
#include "scene/3d/light_3d.h"
@@ -1594,9 +1595,9 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
}
if (after != EditorPlugin::AFTER_GUI_INPUT_DESELECT) {
- clicked = _select_ray(b->get_position());
-
//clicking is always deferred to either move or release
+ clicked = _select_ray(b->get_position());
+ selection_in_progress = true;
if (clicked.is_null()) {
//default to regionselect
@@ -1615,6 +1616,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
}
if (after != EditorPlugin::AFTER_GUI_INPUT_DESELECT) {
+ selection_in_progress = false;
+
if (clicked.is_valid()) {
_select_clicked(false);
}
@@ -1719,17 +1722,14 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
nav_mode = NAVIGATION_ORBIT;
} else {
const bool movement_threshold_passed = _edit.original_mouse_pos.distance_to(_edit.mouse_pos) > 8 * EDSCALE;
- if (clicked.is_valid() && movement_threshold_passed) {
- _compute_edit(_edit.original_mouse_pos);
- clicked = ObjectID();
-
- _edit.mode = TRANSFORM_TRANSLATE;
- }
// enable region-select if nothing has been selected yet or multi-select (shift key) is active
- if (movement_threshold_passed && (get_selected_count() == 0 || clicked_wants_append)) {
- cursor.region_select = true;
- cursor.region_begin = _edit.original_mouse_pos;
+ if (selection_in_progress && movement_threshold_passed) {
+ if (get_selected_count() == 0 || clicked_wants_append) {
+ cursor.region_select = true;
+ cursor.region_begin = _edit.original_mouse_pos;
+ clicked = ObjectID();
+ }
}
if (cursor.region_select) {
@@ -1738,6 +1738,12 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
return;
}
+ if (clicked.is_valid() && movement_threshold_passed) {
+ _compute_edit(_edit.original_mouse_pos);
+ clicked = ObjectID();
+ _edit.mode = TRANSFORM_TRANSLATE;
+ }
+
if (_edit.mode == TRANSFORM_NONE) {
return;
}
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index cb7c5a714b..76915a349e 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -31,19 +31,24 @@
#ifndef NODE_3D_EDITOR_PLUGIN_H
#define NODE_3D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/editor_scale.h"
+#include "editor/editor_spin_slider.h"
#include "editor/plugins/node_3d_editor_gizmos.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/light_3d.h"
#include "scene/3d/visual_instance_3d.h"
#include "scene/3d/world_environment.h"
+#include "scene/gui/color_picker.h"
#include "scene/gui/panel_container.h"
+#include "scene/gui/spin_box.h"
+#include "scene/gui/split_container.h"
#include "scene/resources/environment.h"
#include "scene/resources/fog_material.h"
#include "scene/resources/sky_material.h"
+class EditorNode;
+class EditorData;
class Node3DEditor;
class Node3DEditorViewport;
class SubViewportContainer;
@@ -269,6 +274,7 @@ private:
ObjectID clicked;
Vector<_RayResult> selection_results;
bool clicked_wants_append;
+ bool selection_in_progress = false;
PopupMenu *selection_menu;
diff --git a/editor/plugins/occluder_instance_3d_editor_plugin.cpp b/editor/plugins/occluder_instance_3d_editor_plugin.cpp
index e7fe8da716..16f359a2ae 100644
--- a/editor/plugins/occluder_instance_3d_editor_plugin.cpp
+++ b/editor/plugins/occluder_instance_3d_editor_plugin.cpp
@@ -30,6 +30,9 @@
#include "occluder_instance_3d_editor_plugin.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+
void OccluderInstance3DEditorPlugin::_bake_select_file(const String &p_file) {
if (occluder_instance) {
OccluderInstance3D::BakeError err;
diff --git a/editor/plugins/occluder_instance_3d_editor_plugin.h b/editor/plugins/occluder_instance_3d_editor_plugin.h
index a9aa0b74e3..f1c6b504be 100644
--- a/editor/plugins/occluder_instance_3d_editor_plugin.h
+++ b/editor/plugins/occluder_instance_3d_editor_plugin.h
@@ -31,11 +31,14 @@
#ifndef OCCLUDER_INSTANCE_3D_EDITOR_PLUGIN_H
#define OCCLUDER_INSTANCE_3D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/occluder_instance_3d.h"
#include "scene/resources/material.h"
+class EditorNode;
+struct EditorProgress;
+class EditorFileDialog;
+
class OccluderInstance3DEditorPlugin : public EditorPlugin {
GDCLASS(OccluderInstance3DEditorPlugin, EditorPlugin);
diff --git a/editor/plugins/ot_features_plugin.cpp b/editor/plugins/ot_features_plugin.cpp
index d2daa4fa8d..df6d50e195 100644
--- a/editor/plugins/ot_features_plugin.cpp
+++ b/editor/plugins/ot_features_plugin.cpp
@@ -30,6 +30,7 @@
#include "ot_features_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
void OpenTypeFeaturesEditor::_value_changed(double val) {
diff --git a/editor/plugins/ot_features_plugin.h b/editor/plugins/ot_features_plugin.h
index 073fe53a52..f1d084a6b4 100644
--- a/editor/plugins/ot_features_plugin.h
+++ b/editor/plugins/ot_features_plugin.h
@@ -31,10 +31,11 @@
#ifndef OT_FEATURES_PLUGIN_H
#define OT_FEATURES_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/editor_properties.h"
+class EditorNode;
+
/*************************************************************************/
class OpenTypeFeaturesEditor : public EditorProperty {
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index 702bc4a8ce..3d8543e1bd 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -33,6 +33,7 @@
#include "canvas_item_editor_plugin.h"
#include "core/io/file_access.h"
#include "core/os/keyboard.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
diff --git a/editor/plugins/path_2d_editor_plugin.h b/editor/plugins/path_2d_editor_plugin.h
index 210a5a140d..95f58cd18c 100644
--- a/editor/plugins/path_2d_editor_plugin.h
+++ b/editor/plugins/path_2d_editor_plugin.h
@@ -31,10 +31,11 @@
#ifndef PATH_2D_EDITOR_PLUGIN_H
#define PATH_2D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/path_2d.h"
+#include "scene/gui/separator.h"
+class EditorNode;
class CanvasItemEditor;
class Path2DEditor : public HBoxContainer {
diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp
index 7cc926f06c..3da70fb8a0 100644
--- a/editor/plugins/path_3d_editor_plugin.cpp
+++ b/editor/plugins/path_3d_editor_plugin.cpp
@@ -33,6 +33,7 @@
#include "core/math/geometry_2d.h"
#include "core/math/geometry_3d.h"
#include "core/os/keyboard.h"
+#include "editor/editor_node.h"
#include "node_3d_editor_plugin.h"
#include "scene/resources/curve.h"
diff --git a/editor/plugins/path_3d_editor_plugin.h b/editor/plugins/path_3d_editor_plugin.h
index b877e2ae17..8295101279 100644
--- a/editor/plugins/path_3d_editor_plugin.h
+++ b/editor/plugins/path_3d_editor_plugin.h
@@ -35,6 +35,9 @@
#include "editor/plugins/node_3d_editor_gizmos.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/path_3d.h"
+#include "scene/gui/separator.h"
+
+class EditorNode;
class Path3DGizmo : public EditorNode3DGizmo {
GDCLASS(Path3DGizmo, EditorNode3DGizmo);
diff --git a/editor/plugins/physical_bone_3d_editor_plugin.cpp b/editor/plugins/physical_bone_3d_editor_plugin.cpp
index 9d69bbaa0b..333b4d0f30 100644
--- a/editor/plugins/physical_bone_3d_editor_plugin.cpp
+++ b/editor/plugins/physical_bone_3d_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "physical_bone_3d_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/physics_body_3d.h"
diff --git a/editor/plugins/physical_bone_3d_editor_plugin.h b/editor/plugins/physical_bone_3d_editor_plugin.h
index d30222d7e6..5632be73e7 100644
--- a/editor/plugins/physical_bone_3d_editor_plugin.h
+++ b/editor/plugins/physical_bone_3d_editor_plugin.h
@@ -31,7 +31,12 @@
#ifndef PHYSICAL_BONE_PLUGIN_H
#define PHYSICAL_BONE_PLUGIN_H
-#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
+#include "scene/3d/physics_body_3d.h"
+#include "scene/gui/box_container.h"
+#include "scene/gui/button.h"
+
+class EditorNode;
class PhysicalBone3DEditor : public Object {
GDCLASS(PhysicalBone3DEditor, Object);
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index b116f8ff6d..0ca5967fa6 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -38,7 +38,10 @@
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "scene/2d/skeleton_2d.h"
+#include "scene/gui/menu_button.h"
#include "scene/gui/scroll_container.h"
+#include "scene/gui/separator.h"
+#include "scene/gui/slider.h"
#include "scene/gui/view_panner.h"
Node2D *Polygon2DEditor::_get_node() const {
diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h
index 0f10b6b645..3793a0130c 100644
--- a/editor/plugins/polygon_2d_editor_plugin.h
+++ b/editor/plugins/polygon_2d_editor_plugin.h
@@ -35,6 +35,9 @@
class ViewPanner;
class ScrollContainer;
+class Panel;
+class HSlider;
+class SpinBox;
class Polygon2DEditor : public AbstractPolygon2DEditor {
GDCLASS(Polygon2DEditor, AbstractPolygon2DEditor);
diff --git a/editor/plugins/polygon_3d_editor_plugin.cpp b/editor/plugins/polygon_3d_editor_plugin.cpp
index 4014da2441..140c2cea75 100644
--- a/editor/plugins/polygon_3d_editor_plugin.cpp
+++ b/editor/plugins/polygon_3d_editor_plugin.cpp
@@ -36,6 +36,7 @@
#include "core/io/file_access.h"
#include "core/math/geometry_2d.h"
#include "core/os/keyboard.h"
+#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "node_3d_editor_plugin.h"
#include "scene/3d/camera_3d.h"
diff --git a/editor/plugins/polygon_3d_editor_plugin.h b/editor/plugins/polygon_3d_editor_plugin.h
index 6b0370541e..d987c78670 100644
--- a/editor/plugins/polygon_3d_editor_plugin.h
+++ b/editor/plugins/polygon_3d_editor_plugin.h
@@ -31,12 +31,12 @@
#ifndef POLYGON_3D_EDITOR_PLUGIN_H
#define POLYGON_3D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/collision_polygon_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/resources/immediate_mesh.h"
+class EditorNode;
class CanvasItemEditor;
class Polygon3DEditor : public HBoxContainer {
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 786217a5c2..398e6eb044 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -32,6 +32,8 @@
#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
diff --git a/editor/plugins/resource_preloader_editor_plugin.h b/editor/plugins/resource_preloader_editor_plugin.h
index 838d72df41..561bb60354 100644
--- a/editor/plugins/resource_preloader_editor_plugin.h
+++ b/editor/plugins/resource_preloader_editor_plugin.h
@@ -31,13 +31,15 @@
#ifndef RESOURCE_PRELOADER_EDITOR_PLUGIN_H
#define RESOURCE_PRELOADER_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/gui/dialogs.h"
-#include "scene/gui/file_dialog.h"
#include "scene/gui/tree.h"
#include "scene/main/resource_preloader.h"
+class EditorNode;
+struct EditorProgress;
+class EditorFileDialog;
+
class ResourcePreloaderEditor : public PanelContainer {
GDCLASS(ResourcePreloaderEditor, PanelContainer);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 17de3ba026..bf3ab56a45 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -38,6 +38,7 @@
#include "core/os/os.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/debugger/script_editor_debugger.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_run_script.h"
#include "editor/editor_scale.h"
@@ -2265,7 +2266,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
if (use_external_editor &&
(EditorDebuggerNode::get_singleton()->get_dump_stack_script() != p_resource || EditorDebuggerNode::get_singleton()->get_debug_with_external_editor()) &&
p_resource->get_path().is_resource_file() &&
- !Ref<VisualScript>(p_resource).is_valid()) {
+ !p_resource->is_class("VisualScript")) {
String path = EditorSettings::get_singleton()->get("text_editor/external/exec_path");
String flags = EditorSettings::get_singleton()->get("text_editor/external/exec_flags");
@@ -2364,7 +2365,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
se->set_edited_resource(p_resource);
- if (!Ref<VisualScript>(p_resource).is_valid()) {
+ if (!p_resource->is_class("VisualScript")) {
bool highlighter_set = false;
for (int i = 0; i < syntax_highlighters.size(); i++) {
Ref<EditorSyntaxHighlighter> highlighter = syntax_highlighters[i]->_create();
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index d754f1a378..045e8e8c25 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -47,6 +47,10 @@
#include "scene/main/timer.h"
#include "scene/resources/text_file.h"
+class EditorNode;
+struct EditorProgress;
+class EditorFileDialog;
+
class EditorSyntaxHighlighter : public SyntaxHighlighter {
GDCLASS(EditorSyntaxHighlighter, SyntaxHighlighter)
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index c3d61dfd58..4a47766fc0 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -30,6 +30,7 @@
#include "script_text_editor.h"
+#include "core/config/project_settings.h"
#include "core/math/expression.h"
#include "core/os/keyboard.h"
#include "editor/debugger/editor_debugger_node.h"
diff --git a/editor/plugins/shader_file_editor_plugin.h b/editor/plugins/shader_file_editor_plugin.h
index feec0c206e..f4f370d3f0 100644
--- a/editor/plugins/shader_file_editor_plugin.h
+++ b/editor/plugins/shader_file_editor_plugin.h
@@ -41,6 +41,8 @@
#include "scene/main/timer.h"
#include "servers/rendering/rendering_device_binds.h"
+class ItemList;
+
class ShaderFileEditor : public PanelContainer {
GDCLASS(ShaderFileEditor, PanelContainer);
diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp
index b6d465ea81..733d8ff71f 100644
--- a/editor/plugins/skeleton_2d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_2d_editor_plugin.cpp
@@ -31,6 +31,7 @@
#include "skeleton_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
+#include "editor/editor_node.h"
#include "scene/2d/mesh_instance_2d.h"
#include "scene/gui/box_container.h"
#include "thirdparty/misc/clipper.hpp"
diff --git a/editor/plugins/skeleton_2d_editor_plugin.h b/editor/plugins/skeleton_2d_editor_plugin.h
index 2fa7f02622..8054436339 100644
--- a/editor/plugins/skeleton_2d_editor_plugin.h
+++ b/editor/plugins/skeleton_2d_editor_plugin.h
@@ -31,11 +31,12 @@
#ifndef SKELETON_2D_EDITOR_PLUGIN_H
#define SKELETON_2D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/skeleton_2d.h"
#include "scene/gui/spin_box.h"
+class EditorNode;
+
class Skeleton2DEditor : public Control {
GDCLASS(Skeleton2DEditor, Control);
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index ac77f51812..774868a33a 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -32,6 +32,7 @@
#include "core/io/resource_saver.h"
#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_properties.h"
#include "editor/editor_scale.h"
#include "editor/plugins/animation_player_editor_plugin.h"
diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h
index d0d81d6498..f3c855c338 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.h
+++ b/editor/plugins/skeleton_3d_editor_plugin.h
@@ -31,7 +31,6 @@
#ifndef SKELETON_3D_EDITOR_PLUGIN_H
#define SKELETON_3D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/editor_properties.h"
#include "node_3d_editor_plugin.h"
@@ -40,6 +39,7 @@
#include "scene/3d/skeleton_3d.h"
#include "scene/resources/immediate_mesh.h"
+class EditorNode;
class EditorInspectorPluginSkeleton;
class Joint;
class PhysicalBone3D;
diff --git a/editor/plugins/skeleton_ik_3d_editor_plugin.cpp b/editor/plugins/skeleton_ik_3d_editor_plugin.cpp
index ca8786a385..dbb1be9665 100644
--- a/editor/plugins/skeleton_ik_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_ik_3d_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "skeleton_ik_3d_editor_plugin.h"
+#include "editor/editor_node.h"
#include "scene/3d/skeleton_ik_3d.h"
void SkeletonIK3DEditorPlugin::_play() {
diff --git a/editor/plugins/skeleton_ik_3d_editor_plugin.h b/editor/plugins/skeleton_ik_3d_editor_plugin.h
index edc3f6dda4..95e84c62b3 100644
--- a/editor/plugins/skeleton_ik_3d_editor_plugin.h
+++ b/editor/plugins/skeleton_ik_3d_editor_plugin.h
@@ -31,9 +31,9 @@
#ifndef SKELETON_IK_3D_EDITOR_PLUGIN_H
#define SKELETON_IK_3D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
+class EditorNode;
class SkeletonIK3D;
class SkeletonIK3DEditorPlugin : public EditorPlugin {
diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp
index 85ff20dd23..708ba7c550 100644
--- a/editor/plugins/sprite_2d_editor_plugin.cpp
+++ b/editor/plugins/sprite_2d_editor_plugin.cpp
@@ -32,7 +32,9 @@
#include "canvas_item_editor_plugin.h"
#include "core/math/geometry_2d.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/scene_tree_dock.h"
#include "scene/2d/collision_polygon_2d.h"
#include "scene/2d/light_occluder_2d.h"
#include "scene/2d/mesh_instance_2d.h"
diff --git a/editor/plugins/sprite_2d_editor_plugin.h b/editor/plugins/sprite_2d_editor_plugin.h
index c93ad1610f..46c1d62209 100644
--- a/editor/plugins/sprite_2d_editor_plugin.h
+++ b/editor/plugins/sprite_2d_editor_plugin.h
@@ -31,11 +31,12 @@
#ifndef SPRITE_EDITOR_PLUGIN_H
#define SPRITE_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/sprite_2d.h"
#include "scene/gui/spin_box.h"
+class EditorNode;
+
class Sprite2DEditor : public Control {
GDCLASS(Sprite2DEditor, Control);
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 419076a3f6..5e0a53e354 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -33,8 +33,11 @@
#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
#include "core/os/keyboard.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/scene_tree_dock.h"
#include "scene/3d/sprite_3d.h"
#include "scene/gui/center_container.h"
#include "scene/gui/margin_container.h"
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index 8767e05a94..27ebdfef93 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -31,16 +31,22 @@
#ifndef SPRITE_FRAMES_EDITOR_PLUGIN_H
#define SPRITE_FRAMES_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/animated_sprite_2d.h"
+#include "scene/gui/button.h"
+#include "scene/gui/check_button.h"
#include "scene/gui/dialogs.h"
-#include "scene/gui/file_dialog.h"
+#include "scene/gui/item_list.h"
#include "scene/gui/scroll_container.h"
+#include "scene/gui/spin_box.h"
#include "scene/gui/split_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tree.h"
+class EditorNode;
+struct EditorProgress;
+class EditorFileDialog;
+
class SpriteFramesEditor : public HSplitContainer {
GDCLASS(SpriteFramesEditor, HSplitContainer);
diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp
index 5d38352b22..e2a66f5a3c 100644
--- a/editor/plugins/style_box_editor_plugin.cpp
+++ b/editor/plugins/style_box_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "style_box_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
bool EditorInspectorPluginStyleBox::can_handle(Object *p_object) {
diff --git a/editor/plugins/style_box_editor_plugin.h b/editor/plugins/style_box_editor_plugin.h
index 898628fd7f..d140023a42 100644
--- a/editor/plugins/style_box_editor_plugin.h
+++ b/editor/plugins/style_box_editor_plugin.h
@@ -32,11 +32,13 @@
#define STYLE_BOX_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
-#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
#include "scene/gui/option_button.h"
#include "scene/gui/texture_rect.h"
#include "scene/resources/style_box.h"
+class EditorNode;
+
class StyleBoxPreview : public VBoxContainer {
GDCLASS(StyleBoxPreview, VBoxContainer);
diff --git a/editor/plugins/sub_viewport_preview_editor_plugin.cpp b/editor/plugins/sub_viewport_preview_editor_plugin.cpp
index 4498a1d64d..859a99ce96 100644
--- a/editor/plugins/sub_viewport_preview_editor_plugin.cpp
+++ b/editor/plugins/sub_viewport_preview_editor_plugin.cpp
@@ -30,6 +30,8 @@
#include "sub_viewport_preview_editor_plugin.h"
+#include "editor/editor_node.h"
+
bool EditorInspectorPluginSubViewportPreview::can_handle(Object *p_object) {
return Object::cast_to<SubViewport>(p_object) != nullptr;
}
diff --git a/editor/plugins/sub_viewport_preview_editor_plugin.h b/editor/plugins/sub_viewport_preview_editor_plugin.h
index 7016910ebd..e7e28f3e33 100644
--- a/editor/plugins/sub_viewport_preview_editor_plugin.h
+++ b/editor/plugins/sub_viewport_preview_editor_plugin.h
@@ -31,11 +31,12 @@
#ifndef SUB_VIEWPORT_PREVIEW_EDITOR_PLUGIN_H
#define SUB_VIEWPORT_PREVIEW_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/texture_editor_plugin.h"
#include "scene/main/viewport.h"
+class EditorNode;
+
class EditorInspectorPluginSubViewportPreview : public EditorInspectorPluginTexture {
GDCLASS(EditorInspectorPluginSubViewportPreview, EditorInspectorPluginTexture);
diff --git a/editor/plugins/text_control_editor_plugin.cpp b/editor/plugins/text_control_editor_plugin.cpp
index 4ce94176e5..d05fd7dc9c 100644
--- a/editor/plugins/text_control_editor_plugin.cpp
+++ b/editor/plugins/text_control_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "text_control_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/multi_node_edit.h"
diff --git a/editor/plugins/text_control_editor_plugin.h b/editor/plugins/text_control_editor_plugin.h
index 5941c100ec..0549375a07 100644
--- a/editor/plugins/text_control_editor_plugin.h
+++ b/editor/plugins/text_control_editor_plugin.h
@@ -34,8 +34,8 @@
#include "canvas_item_editor_plugin.h"
#include "editor/editor_file_system.h"
#include "editor/editor_inspector.h"
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
+#include "scene/gui/color_picker.h"
#include "scene/gui/color_rect.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/option_button.h"
@@ -43,6 +43,8 @@
/*************************************************************************/
+class EditorNode;
+
class TextControlEditor : public HBoxContainer {
GDCLASS(TextControlEditor, HBoxContainer);
diff --git a/editor/plugins/texture_3d_editor_plugin.cpp b/editor/plugins/texture_3d_editor_plugin.cpp
index 6080f9df87..c9090f5459 100644
--- a/editor/plugins/texture_3d_editor_plugin.cpp
+++ b/editor/plugins/texture_3d_editor_plugin.cpp
@@ -32,6 +32,7 @@
#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
+#include "editor/editor_node.h"
#include "editor/editor_settings.h"
void Texture3DEditor::_texture_rect_draw() {
diff --git a/editor/plugins/texture_3d_editor_plugin.h b/editor/plugins/texture_3d_editor_plugin.h
index 5a200f6c11..b107d8e984 100644
--- a/editor/plugins/texture_3d_editor_plugin.h
+++ b/editor/plugins/texture_3d_editor_plugin.h
@@ -31,11 +31,13 @@
#ifndef TEXTURE_3D_EDITOR_PLUGIN_H
#define TEXTURE_3D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
+#include "scene/gui/spin_box.h"
#include "scene/resources/shader.h"
#include "scene/resources/texture.h"
+class EditorNode;
+
class Texture3DEditor : public Control {
GDCLASS(Texture3DEditor, Control);
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 84b33f0986..f6b41b4e37 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "texture_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
TextureRect *TexturePreview::get_texture_display() {
diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h
index 5ba077d6fc..97ce4fd59d 100644
--- a/editor/plugins/texture_editor_plugin.h
+++ b/editor/plugins/texture_editor_plugin.h
@@ -31,10 +31,11 @@
#ifndef TEXTURE_EDITOR_PLUGIN_H
#define TEXTURE_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/resources/texture.h"
+class EditorNode;
+
class TexturePreview : public MarginContainer {
GDCLASS(TexturePreview, MarginContainer);
diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp
index a8c37d37fe..bafe2a7c55 100644
--- a/editor/plugins/texture_layered_editor_plugin.cpp
+++ b/editor/plugins/texture_layered_editor_plugin.cpp
@@ -32,6 +32,7 @@
#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
+#include "editor/editor_node.h"
#include "editor/editor_settings.h"
void TextureLayeredEditor::gui_input(const Ref<InputEvent> &p_event) {
diff --git a/editor/plugins/texture_layered_editor_plugin.h b/editor/plugins/texture_layered_editor_plugin.h
index cd8eba1bfe..b55c6a1db5 100644
--- a/editor/plugins/texture_layered_editor_plugin.h
+++ b/editor/plugins/texture_layered_editor_plugin.h
@@ -31,11 +31,13 @@
#ifndef TEXTURE_LAYERED_EDITOR_PLUGIN_H
#define TEXTURE_LAYERED_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
+#include "scene/gui/spin_box.h"
#include "scene/resources/shader.h"
#include "scene/resources/texture.h"
+class EditorNode;
+
class TextureLayeredEditor : public Control {
GDCLASS(TextureLayeredEditor, Control);
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 662c0126ec..c924b78602 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -33,6 +33,7 @@
#include "core/core_string_names.h"
#include "core/input/input.h"
#include "core/os/keyboard.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/gui/check_box.h"
#include "scene/gui/view_panner.h"
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index d78ad3891c..664b9ebce5 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -32,7 +32,6 @@
#define TEXTURE_REGION_EDITOR_PLUGIN_H
#include "canvas_item_editor_plugin.h"
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/sprite_2d.h"
#include "scene/3d/sprite_3d.h"
@@ -40,6 +39,7 @@
#include "scene/resources/style_box.h"
#include "scene/resources/texture.h"
+class EditorNode;
class ViewPanner;
class TextureRegionEditor : public VBoxContainer {
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index aaa09237cf..2cfaaea0a7 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -31,6 +31,8 @@
#include "theme_editor_plugin.h"
#include "core/os/keyboard.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_resource_picker.h"
#include "editor/editor_scale.h"
#include "editor/progress_dialog.h"
@@ -1211,7 +1213,8 @@ void ThemeItemEditorDialog::_update_edit_types() {
bool item_reselected = false;
edit_type_list->clear();
- int e_idx = 0;
+ TreeItem *list_root = edit_type_list->create_item();
+
for (const StringName &E : theme_types) {
Ref<Texture2D> item_icon;
if (E == "") {
@@ -1219,19 +1222,21 @@ void ThemeItemEditorDialog::_update_edit_types() {
} else {
item_icon = EditorNode::get_singleton()->get_class_icon(E, "NodeDisabled");
}
- edit_type_list->add_item(E, item_icon);
+ TreeItem *list_item = edit_type_list->create_item(list_root);
+ list_item->set_text(0, E);
+ list_item->set_icon(0, item_icon);
+ list_item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TYPES_TREE_REMOVE_ITEM, false, TTR("Remove Type"));
if (E == edited_item_type) {
- edit_type_list->select(e_idx);
+ list_item->select(0);
item_reselected = true;
}
- e_idx++;
}
if (!item_reselected) {
edited_item_type = "";
- if (edit_type_list->get_item_count() > 0) {
- edit_type_list->select(0);
+ if (list_root->get_child_count() > 0) {
+ list_root->get_child(0)->select(0);
}
}
@@ -1240,9 +1245,9 @@ void ThemeItemEditorDialog::_update_edit_types() {
default_types.sort_custom<StringName::AlphCompare>();
String selected_type = "";
- Vector<int> selected_ids = edit_type_list->get_selected_items();
- if (selected_ids.size() > 0) {
- selected_type = edit_type_list->get_item_text(selected_ids[0]);
+ TreeItem *selected_item = edit_type_list->get_selected();
+ if (selected_item) {
+ selected_type = selected_item->get_text(0);
edit_items_add_color->set_disabled(false);
edit_items_add_constant->set_disabled(false);
@@ -1276,11 +1281,26 @@ void ThemeItemEditorDialog::_update_edit_types() {
_update_edit_item_tree(selected_type);
}
-void ThemeItemEditorDialog::_edited_type_selected(int p_item_idx) {
- String selected_type = edit_type_list->get_item_text(p_item_idx);
+void ThemeItemEditorDialog::_edited_type_selected() {
+ TreeItem *selected_item = edit_type_list->get_selected();
+ String selected_type = selected_item->get_text(0);
_update_edit_item_tree(selected_type);
}
+void ThemeItemEditorDialog::_edited_type_button_pressed(Object *p_item, int p_column, int p_id) {
+ TreeItem *item = Object::cast_to<TreeItem>(p_item);
+ if (!item) {
+ return;
+ }
+
+ switch (p_id) {
+ case TYPES_TREE_REMOVE_ITEM: {
+ String type_name = item->get_text(0);
+ _remove_theme_type(type_name);
+ } break;
+ }
+}
+
void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
edited_item_type = p_item_type;
@@ -1429,8 +1449,8 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
}
// If some type is selected, but it doesn't seem to have any items, show a guiding message.
- Vector<int> selected_ids = edit_type_list->get_selected_items();
- if (selected_ids.size() > 0) {
+ TreeItem *selected_item = edit_type_list->get_selected();
+ if (selected_item) {
if (!has_any_items) {
edit_items_message->set_text(TTR("This theme type is empty.\nAdd more items to it manually or by importing from another theme."));
edit_items_message->show();
@@ -1477,16 +1497,15 @@ void ThemeItemEditorDialog::_add_theme_type(const String &p_new_text) {
const String new_type = edit_add_type_value->get_text().strip_edges();
edit_add_type_value->clear();
- edited_theme->add_icon_type(new_type);
- edited_theme->add_stylebox_type(new_type);
- edited_theme->add_font_type(new_type);
- edited_theme->add_font_size_type(new_type);
- edited_theme->add_color_type(new_type);
- edited_theme->add_constant_type(new_type);
+ UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ ur->create_action(TTR("Add Theme Type"));
- _update_edit_types();
+ ur->add_do_method(*edited_theme, "add_type", new_type);
+ ur->add_undo_method(*edited_theme, "remove_type", new_type);
+ ur->add_do_method(this, "_update_edit_types");
+ ur->add_undo_method(this, "_update_edit_types");
- edited_theme->emit_changed();
+ ur->commit_action();
}
void ThemeItemEditorDialog::_add_theme_item(Theme::DataType p_data_type, String p_item_name, String p_item_type) {
@@ -1531,6 +1550,27 @@ void ThemeItemEditorDialog::_add_theme_item(Theme::DataType p_data_type, String
ur->commit_action();
}
+void ThemeItemEditorDialog::_remove_theme_type(const String &p_theme_type) {
+ Ref<Theme> old_snapshot = edited_theme->duplicate();
+ Ref<Theme> new_snapshot = edited_theme->duplicate();
+
+ UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ ur->create_action(TTR("Remove Theme Type"));
+
+ new_snapshot->remove_type(p_theme_type);
+
+ ur->add_do_method(*edited_theme, "clear");
+ ur->add_do_method(*edited_theme, "merge_with", new_snapshot);
+ // If the type was empty, it cannot be restored with merge, but thankfully we can fake it.
+ ur->add_undo_method(*edited_theme, "add_type", p_theme_type);
+ ur->add_undo_method(*edited_theme, "merge_with", old_snapshot);
+
+ ur->add_do_method(this, "_update_edit_types");
+ ur->add_undo_method(this, "_update_edit_types");
+
+ ur->commit_action();
+}
+
void ThemeItemEditorDialog::_remove_data_type_items(Theme::DataType p_data_type, String p_item_type) {
List<StringName> names;
@@ -1863,10 +1903,14 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_type_label->set_text(TTR("Types:"));
edit_dialog_side_vb->add_child(edit_type_label);
- edit_type_list = memnew(ItemList);
+ edit_type_list = memnew(Tree);
+ edit_type_list->set_hide_root(true);
+ edit_type_list->set_hide_folding(true);
+ edit_type_list->set_columns(1);
edit_type_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
edit_dialog_side_vb->add_child(edit_type_list);
edit_type_list->connect("item_selected", callable_mp(this, &ThemeItemEditorDialog::_edited_type_selected));
+ edit_type_list->connect("button_pressed", callable_mp(this, &ThemeItemEditorDialog::_edited_type_button_pressed));
Label *edit_add_type_label = memnew(Label);
edit_add_type_label->set_text(TTR("Add Type:"));
diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h
index c00ce3ae65..ee9c20a8f2 100644
--- a/editor/plugins/theme_editor_plugin.h
+++ b/editor/plugins/theme_editor_plugin.h
@@ -31,16 +31,21 @@
#ifndef THEME_EDITOR_PLUGIN_H
#define THEME_EDITOR_PLUGIN_H
+#include "editor/editor_plugin.h"
+#include "editor/plugins/theme_editor_preview.h"
+#include "scene/gui/check_button.h"
#include "scene/gui/dialogs.h"
+#include "scene/gui/item_list.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/option_button.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/tab_bar.h"
#include "scene/gui/texture_rect.h"
+#include "scene/gui/tree.h"
#include "scene/resources/theme.h"
-#include "theme_editor_preview.h"
-#include "editor/editor_node.h"
+class EditorNode;
+class EditorFileDialog;
class ThemeItemImportTree : public VBoxContainer {
GDCLASS(ThemeItemImportTree, VBoxContainer);
@@ -188,7 +193,11 @@ class ThemeItemEditorDialog : public AcceptDialog {
TabContainer *tc;
- ItemList *edit_type_list;
+ enum TypesTreeAction {
+ TYPES_TREE_REMOVE_ITEM,
+ };
+
+ Tree *edit_type_list;
LineEdit *edit_add_type_value;
String edited_item_type;
@@ -240,13 +249,15 @@ class ThemeItemEditorDialog : public AcceptDialog {
void _dialog_about_to_show();
void _update_edit_types();
- void _edited_type_selected(int p_item_idx);
+ void _edited_type_selected();
+ void _edited_type_button_pressed(Object *p_item, int p_column, int p_id);
void _update_edit_item_tree(String p_item_type);
void _item_tree_button_pressed(Object *p_item, int p_column, int p_id);
void _add_theme_type(const String &p_new_text);
void _add_theme_item(Theme::DataType p_data_type, String p_item_name, String p_item_type);
+ void _remove_theme_type(const String &p_theme_type);
void _remove_data_type_items(Theme::DataType p_data_type, String p_item_type);
void _remove_class_items();
void _remove_custom_items();
diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp
index c4ef6e086d..c3e4e66fd4 100644
--- a/editor/plugins/theme_editor_preview.cpp
+++ b/editor/plugins/theme_editor_preview.cpp
@@ -30,11 +30,15 @@
#include "theme_editor_preview.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/math/math_funcs.h"
-#include "scene/resources/packed_scene.h"
-
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "scene/gui/button.h"
+#include "scene/gui/color_picker.h"
+#include "scene/gui/progress_bar.h"
+#include "scene/resources/packed_scene.h"
constexpr double REFRESH_TIMER = 1.5;
diff --git a/editor/plugins/theme_editor_preview.h b/editor/plugins/theme_editor_preview.h
index a509ae3c50..ab93198903 100644
--- a/editor/plugins/theme_editor_preview.h
+++ b/editor/plugins/theme_editor_preview.h
@@ -32,25 +32,13 @@
#define THEME_EDITOR_PREVIEW_H
#include "scene/gui/box_container.h"
-#include "scene/gui/check_box.h"
-#include "scene/gui/check_button.h"
-#include "scene/gui/color_picker.h"
+#include "scene/gui/button.h"
#include "scene/gui/color_rect.h"
-#include "scene/gui/label.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/progress_bar.h"
#include "scene/gui/scroll_container.h"
-#include "scene/gui/separator.h"
-#include "scene/gui/spin_box.h"
-#include "scene/gui/tab_container.h"
-#include "scene/gui/text_edit.h"
-#include "scene/gui/tree.h"
#include "scene/resources/theme.h"
-#include "editor/editor_node.h"
+class EditorNode;
class ThemeEditorPreview : public VBoxContainer {
GDCLASS(ThemeEditorPreview, VBoxContainer);
diff --git a/editor/plugins/tiles/atlas_merging_dialog.cpp b/editor/plugins/tiles/atlas_merging_dialog.cpp
index 677c9759c2..0f8c8c616c 100644
--- a/editor/plugins/tiles/atlas_merging_dialog.cpp
+++ b/editor/plugins/tiles/atlas_merging_dialog.cpp
@@ -30,6 +30,8 @@
#include "atlas_merging_dialog.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/gui/control.h"
@@ -251,6 +253,8 @@ void AtlasMergingDialog::update_tile_set(Ref<TileSet> p_tile_set) {
}
AtlasMergingDialog::AtlasMergingDialog() {
+ undo_redo = EditorNode::get_singleton()->get_undo_redo();
+
// Atlas merging window.
set_title(TTR("Atlas Merging"));
set_hide_on_ok(false);
diff --git a/editor/plugins/tiles/atlas_merging_dialog.h b/editor/plugins/tiles/atlas_merging_dialog.h
index 2ae94cf44a..6fc1a3b7e0 100644
--- a/editor/plugins/tiles/atlas_merging_dialog.h
+++ b/editor/plugins/tiles/atlas_merging_dialog.h
@@ -31,7 +31,6 @@
#ifndef ATLAS_MERGING_DIALOG_H
#define ATLAS_MERGING_DIALOG_H
-#include "editor/editor_node.h"
#include "editor/editor_properties.h"
#include "scene/gui/dialogs.h"
@@ -39,6 +38,9 @@
#include "scene/gui/texture_rect.h"
#include "scene/resources/tile_set.h"
+class EditorNode;
+class EditorFileDialog;
+
class AtlasMergingDialog : public ConfirmationDialog {
GDCLASS(AtlasMergingDialog, ConfirmationDialog);
@@ -49,7 +51,7 @@ private:
LocalVector<Map<Vector2i, Vector2i>> merged_mapping;
Ref<TileSet> tile_set;
- UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *undo_redo;
// Settings.
int next_line_after_column = 30;
diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp
index 35496795e0..44e4faa091 100644
--- a/editor/plugins/tiles/tile_atlas_view.cpp
+++ b/editor/plugins/tiles/tile_atlas_view.cpp
@@ -36,7 +36,6 @@
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
#include "scene/gui/panel.h"
-#include "scene/gui/texture_rect.h"
#include "scene/gui/view_panner.h"
#include "editor/editor_scale.h"
diff --git a/editor/plugins/tiles/tile_atlas_view.h b/editor/plugins/tiles/tile_atlas_view.h
index 37ef7d6a2a..caf3ef9e4b 100644
--- a/editor/plugins/tiles/tile_atlas_view.h
+++ b/editor/plugins/tiles/tile_atlas_view.h
@@ -37,8 +37,6 @@
#include "scene/gui/center_container.h"
#include "scene/gui/label.h"
#include "scene/gui/margin_container.h"
-#include "scene/gui/scroll_container.h"
-#include "scene/gui/texture_rect.h"
#include "scene/resources/tile_set.h"
class ViewPanner;
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index ae921871c3..a4d2dfc9d9 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -35,6 +35,7 @@
#include "core/math/geometry_2d.h"
#include "core/os/keyboard.h"
+#include "editor/editor_node.h"
#include "editor/editor_properties.h"
#include "editor/editor_scale.h"
@@ -743,6 +744,8 @@ void GenericTilePolygonEditor::_bind_methods() {
}
GenericTilePolygonEditor::GenericTilePolygonEditor() {
+ editor_undo_redo = EditorNode::get_undo_redo();
+
toolbar = memnew(HBoxContainer);
add_child(toolbar);
@@ -1168,6 +1171,8 @@ void TileDataDefaultEditor::_notification(int p_what) {
}
TileDataDefaultEditor::TileDataDefaultEditor() {
+ undo_redo = EditorNode::get_undo_redo();
+
label = memnew(Label);
label->set_text(TTR("Painting:"));
add_child(label);
@@ -1319,6 +1324,8 @@ void TileDataOcclusionShapeEditor::_notification(int p_what) {
}
TileDataOcclusionShapeEditor::TileDataOcclusionShapeEditor() {
+ undo_redo = EditorNode::get_undo_redo();
+
polygon_editor = memnew(GenericTilePolygonEditor);
add_child(polygon_editor);
}
@@ -1516,6 +1523,8 @@ void TileDataCollisionEditor::_notification(int p_what) {
}
TileDataCollisionEditor::TileDataCollisionEditor() {
+ undo_redo = EditorNode::get_undo_redo();
+
polygon_editor = memnew(GenericTilePolygonEditor);
polygon_editor->set_multiple_polygon_mode(true);
polygon_editor->connect("polygons_changed", callable_mp(this, &TileDataCollisionEditor::_polygons_changed));
@@ -2487,6 +2496,8 @@ void TileDataTerrainsEditor::_notification(int p_what) {
}
TileDataTerrainsEditor::TileDataTerrainsEditor() {
+ undo_redo = EditorNode::get_undo_redo();
+
label = memnew(Label);
label->set_text("Painting:");
add_child(label);
@@ -2591,6 +2602,8 @@ void TileDataNavigationEditor::_notification(int p_what) {
}
TileDataNavigationEditor::TileDataNavigationEditor() {
+ undo_redo = EditorNode::get_undo_redo();
+
polygon_editor = memnew(GenericTilePolygonEditor);
polygon_editor->set_multiple_polygon_mode(true);
add_child(polygon_editor);
diff --git a/editor/plugins/tiles/tile_data_editors.h b/editor/plugins/tiles/tile_data_editors.h
index e4551d3302..99724760a7 100644
--- a/editor/plugins/tiles/tile_data_editors.h
+++ b/editor/plugins/tiles/tile_data_editors.h
@@ -33,9 +33,7 @@
#include "tile_atlas_view.h"
-#include "editor/editor_node.h"
#include "editor/editor_properties.h"
-
#include "scene/2d/tile_map.h"
#include "scene/gui/box_container.h"
#include "scene/gui/control.h"
@@ -95,7 +93,7 @@ private:
bool multiple_polygon_mode = false;
bool use_undo_redo = true;
- UndoRedo *editor_undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *editor_undo_redo;
// UI
int hovered_polygon_index = -1;
@@ -216,7 +214,7 @@ private:
protected:
DummyObject *dummy_object = memnew(DummyObject);
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
StringName type;
String property;
@@ -281,7 +279,7 @@ private:
virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) override;
protected:
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
virtual void _tile_set_changed() override;
@@ -316,7 +314,7 @@ class TileDataCollisionEditor : public TileDataDefaultEditor {
virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) override;
protected:
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
virtual void _tile_set_changed() override;
@@ -368,7 +366,7 @@ protected:
void _notification(int p_what);
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
public:
virtual Control *get_toolbar() override { return toolbar; };
@@ -401,7 +399,7 @@ private:
virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) override;
protected:
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
virtual void _tile_set_changed() override;
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 6e3724ead9..5e316bc7f0 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -32,6 +32,7 @@
#include "tiles_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_scale.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
@@ -1978,7 +1979,11 @@ void TileMapEditorTilesPlugin::_bind_methods() {
}
TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
- CanvasItemEditor::get_singleton()->get_viewport_control()->connect("mouse_exited", callable_mp(this, &TileMapEditorTilesPlugin::_mouse_exited_viewport));
+ undo_redo = EditorNode::get_undo_redo();
+
+ CanvasItemEditor::get_singleton()
+ ->get_viewport_control()
+ ->connect("mouse_exited", callable_mp(this, &TileMapEditorTilesPlugin::_mouse_exited_viewport));
// --- Shortcuts ---
ED_SHORTCUT("tiles_editor/cut", TTR("Cut"), KeyModifierMask::CMD | Key::X);
@@ -3242,6 +3247,8 @@ void TileMapEditorTerrainsPlugin::edit(ObjectID p_tile_map_id, int p_tile_map_la
}
TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() {
+ undo_redo = EditorNode::get_undo_redo();
+
main_vbox_container = memnew(VBoxContainer);
main_vbox_container->connect("tree_entered", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_theme));
main_vbox_container->connect("theme_changed", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_theme));
@@ -3945,6 +3952,8 @@ void TileMapEditor::edit(TileMap *p_tile_map) {
}
TileMapEditor::TileMapEditor() {
+ undo_redo = EditorNode::get_undo_redo();
+
set_process_internal(true);
// Shortcuts.
diff --git a/editor/plugins/tiles/tile_map_editor.h b/editor/plugins/tiles/tile_map_editor.h
index 6fa0d01612..49e8cacac8 100644
--- a/editor/plugins/tiles/tile_map_editor.h
+++ b/editor/plugins/tiles/tile_map_editor.h
@@ -35,10 +35,19 @@
#include "core/os/thread.h"
#include "core/typedefs.h"
-#include "editor/editor_node.h"
#include "scene/2d/tile_map.h"
#include "scene/gui/box_container.h"
+#include "scene/gui/check_box.h"
+#include "scene/gui/item_list.h"
+#include "scene/gui/menu_button.h"
+#include "scene/gui/separator.h"
+#include "scene/gui/spin_box.h"
+#include "scene/gui/split_container.h"
#include "scene/gui/tab_bar.h"
+#include "scene/gui/tree.h"
+
+class EditorNode;
+class UndoRedo;
class TileMapEditorPlugin : public Object {
public:
@@ -61,7 +70,7 @@ class TileMapEditorTilesPlugin : public TileMapEditorPlugin {
GDCLASS(TileMapEditorTilesPlugin, TileMapEditorPlugin);
private:
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
ObjectID tile_map_id;
int tile_map_layer = -1;
virtual void edit(ObjectID p_tile_map_id, int p_tile_map_layer) override;
@@ -212,7 +221,7 @@ class TileMapEditorTerrainsPlugin : public TileMapEditorPlugin {
GDCLASS(TileMapEditorTerrainsPlugin, TileMapEditorPlugin);
private:
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
ObjectID tile_map_id;
int tile_map_layer = -1;
virtual void edit(ObjectID p_tile_map_id, int p_tile_map_layer) override;
@@ -298,7 +307,7 @@ class TileMapEditor : public VBoxContainer {
GDCLASS(TileMapEditor, VBoxContainer);
private:
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
bool tileset_changed_needs_update = false;
ObjectID tile_map_id;
int tile_map_layer = -1;
diff --git a/editor/plugins/tiles/tile_proxies_manager_dialog.cpp b/editor/plugins/tiles/tile_proxies_manager_dialog.cpp
index ad44da8dc9..62f3bd6356 100644
--- a/editor/plugins/tiles/tile_proxies_manager_dialog.cpp
+++ b/editor/plugins/tiles/tile_proxies_manager_dialog.cpp
@@ -30,6 +30,7 @@
#include "tile_proxies_manager_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
void TileProxiesManagerDialog::_right_clicked(int p_item, Vector2 p_local_mouse_pos, Object *p_item_list) {
@@ -312,6 +313,8 @@ void TileProxiesManagerDialog::update_tile_set(Ref<TileSet> p_tile_set) {
}
TileProxiesManagerDialog::TileProxiesManagerDialog() {
+ undo_redo = EditorNode::get_singleton()->get_undo_redo();
+
// Tile proxy management window.
set_title(TTR("Tile Proxies Management"));
set_process_unhandled_key_input(true);
diff --git a/editor/plugins/tiles/tile_proxies_manager_dialog.h b/editor/plugins/tiles/tile_proxies_manager_dialog.h
index b235d44982..4c8741c660 100644
--- a/editor/plugins/tiles/tile_proxies_manager_dialog.h
+++ b/editor/plugins/tiles/tile_proxies_manager_dialog.h
@@ -31,13 +31,14 @@
#ifndef TILE_PROXIES_MANAGER_DIALOG_H
#define TILE_PROXIES_MANAGER_DIALOG_H
-#include "editor/editor_node.h"
#include "editor/editor_properties.h"
#include "scene/2d/tile_map.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/item_list.h"
+class EditorNode;
+
class TileProxiesManagerDialog : public ConfirmationDialog {
GDCLASS(TileProxiesManagerDialog, ConfirmationDialog);
@@ -45,7 +46,7 @@ private:
int commited_actions_count = 0;
Ref<TileSet> tile_set;
- UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *undo_redo;
TileMapCell from;
TileMapCell to;
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index 1bd1cd0219..9a16e3d682 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -36,6 +36,7 @@
#include "editor/editor_scale.h"
#include "editor/progress_dialog.h"
+#include "editor/editor_node.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"
@@ -2311,6 +2312,8 @@ void TileSetAtlasSourceEditor::_bind_methods() {
}
TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
+ undo_redo = EditorNode::get_undo_redo();
+
set_process_unhandled_key_input(true);
set_process_internal(true);
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.h b/editor/plugins/tiles/tile_set_atlas_source_editor.h
index 51771c59ba..f0c8367d57 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.h
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.h
@@ -34,10 +34,10 @@
#include "tile_atlas_view.h"
#include "tile_data_editors.h"
-#include "editor/editor_node.h"
#include "scene/gui/split_container.h"
#include "scene/resources/tile_set.h"
+class EditorNode;
class TileSet;
class TileSetAtlasSourceEditor : public HBoxContainer {
@@ -115,7 +115,7 @@ private:
TileSetAtlasSource *tile_set_atlas_source = nullptr;
int tile_set_atlas_source_id = TileSet::INVALID_SOURCE;
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
bool tile_set_changed_needs_update = false;
diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp
index ab355d4658..9ca50497af 100644
--- a/editor/plugins/tiles/tile_set_editor.cpp
+++ b/editor/plugins/tiles/tile_set_editor.cpp
@@ -33,6 +33,7 @@
#include "tile_data_editors.h"
#include "tiles_editor_plugin.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/gui/box_container.h"
@@ -657,6 +658,8 @@ void TileSetEditor::edit(Ref<TileSet> p_tile_set) {
TileSetEditor::TileSetEditor() {
singleton = this;
+ undo_redo = EditorNode::get_undo_redo();
+
set_process_internal(true);
// TabBar.
diff --git a/editor/plugins/tiles/tile_set_editor.h b/editor/plugins/tiles/tile_set_editor.h
index a21c951c42..b79b37cf2e 100644
--- a/editor/plugins/tiles/tile_set_editor.h
+++ b/editor/plugins/tiles/tile_set_editor.h
@@ -33,6 +33,7 @@
#include "atlas_merging_dialog.h"
#include "scene/gui/box_container.h"
+#include "scene/gui/tab_bar.h"
#include "scene/resources/tile_set.h"
#include "tile_proxies_manager_dialog.h"
#include "tile_set_atlas_source_editor.h"
@@ -57,7 +58,7 @@ private:
TileSetAtlasSourceEditor *tile_set_atlas_source_editor;
TileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor;
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
void _drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
bool _can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp
index 240c017b84..acb6ffc77b 100644
--- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp
@@ -30,6 +30,8 @@
#include "tile_set_scenes_collection_source_editor.h"
+#include "editor/editor_file_system.h"
+#include "editor/editor_node.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
@@ -452,6 +454,8 @@ void TileSetScenesCollectionSourceEditor::_bind_methods() {
}
TileSetScenesCollectionSourceEditor::TileSetScenesCollectionSourceEditor() {
+ undo_redo = EditorNode::get_undo_redo();
+
// -- Right side --
HSplitContainer *split_container_right_side = memnew(HSplitContainer);
split_container_right_side->set_h_size_flags(SIZE_EXPAND_FILL);
diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h
index 5b48ea4762..bc4e975c8d 100644
--- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h
+++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h
@@ -31,10 +31,15 @@
#ifndef TILE_SET_SCENES_COLLECTION_SOURCE_EDITOR_H
#define TILE_SET_SCENES_COLLECTION_SOURCE_EDITOR_H
-#include "editor/editor_node.h"
+#include "editor/editor_inspector.h"
#include "scene/gui/box_container.h"
+#include "scene/gui/button.h"
+#include "scene/gui/item_list.h"
#include "scene/resources/tile_set.h"
+class EditorNode;
+class UndoRedo;
+
class TileSetScenesCollectionSourceEditor : public HBoxContainer {
GDCLASS(TileSetScenesCollectionSourceEditor, HBoxContainer);
@@ -93,7 +98,7 @@ private:
TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
int tile_set_source_id = -1;
- UndoRedo *undo_redo = EditorNode::get_undo_redo();
+ UndoRedo *undo_redo;
bool tile_set_scenes_collection_source_changed_needs_update = false;
diff --git a/editor/plugins/version_control_editor_plugin.h b/editor/plugins/version_control_editor_plugin.h
index 86f98ad3aa..956c5a334f 100644
--- a/editor/plugins/version_control_editor_plugin.h
+++ b/editor/plugins/version_control_editor_plugin.h
@@ -33,8 +33,9 @@
#include "editor/editor_plugin.h"
#include "editor/editor_vcs_interface.h"
-#include "scene/gui/container.h"
+#include "scene/gui/box_container.h"
#include "scene/gui/rich_text_label.h"
+#include "scene/gui/split_container.h"
#include "scene/gui/text_edit.h"
#include "scene/gui/tree.h"
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index dd19f3d781..c2ee041737 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -37,6 +37,7 @@
#include "core/math/math_defs.h"
#include "core/os/keyboard.h"
#include "editor/editor_log.h"
+#include "editor/editor_node.h"
#include "editor/editor_properties.h"
#include "editor/editor_scale.h"
#include "scene/animation/animation_player.h"
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index c5037853cd..89f0e51d1c 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -31,7 +31,6 @@
#ifndef VISUAL_SHADER_EDITOR_PLUGIN_H
#define VISUAL_SHADER_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/curve_editor_plugin.h"
#include "editor/property_editor.h"
@@ -41,6 +40,8 @@
#include "scene/gui/tree.h"
#include "scene/resources/visual_shader.h"
+class EditorNode;
+
class VisualShaderNodePlugin : public RefCounted {
GDCLASS(VisualShaderNodePlugin, RefCounted);
diff --git a/editor/plugins/voxel_gi_editor_plugin.cpp b/editor/plugins/voxel_gi_editor_plugin.cpp
index cef29032b2..9a2af944a0 100644
--- a/editor/plugins/voxel_gi_editor_plugin.cpp
+++ b/editor/plugins/voxel_gi_editor_plugin.cpp
@@ -30,6 +30,9 @@
#include "voxel_gi_editor_plugin.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+
void VoxelGIEditorPlugin::_bake() {
if (voxel_gi) {
if (voxel_gi->get_probe_data().is_null()) {
diff --git a/editor/plugins/voxel_gi_editor_plugin.h b/editor/plugins/voxel_gi_editor_plugin.h
index 4c7865d868..e7c4526747 100644
--- a/editor/plugins/voxel_gi_editor_plugin.h
+++ b/editor/plugins/voxel_gi_editor_plugin.h
@@ -31,11 +31,14 @@
#ifndef VOXEL_GIEDITORPLUGIN_H
#define VOXEL_GIEDITORPLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/voxel_gi.h"
#include "scene/resources/material.h"
+class EditorNode;
+class EditorFileDialog;
+struct EditorProgress;
+
class VoxelGIEditorPlugin : public EditorPlugin {
GDCLASS(VoxelGIEditorPlugin, EditorPlugin);
diff --git a/editor/pot_generator.cpp b/editor/pot_generator.cpp
index 4d9efefbd3..f6839bae6b 100644
--- a/editor/pot_generator.cpp
+++ b/editor/pot_generator.cpp
@@ -32,7 +32,7 @@
#include "core/config/project_settings.h"
#include "core/error/error_macros.h"
-#include "editor_translation_parser.h"
+#include "editor/editor_translation_parser.h"
#include "plugins/packed_scene_translation_parser_plugin.h"
POTGenerator *POTGenerator::singleton = nullptr;
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index 1644bd7e7f..ed13afc235 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -32,7 +32,7 @@
#include "core/object/message_queue.h"
#include "core/os/os.h"
-#include "editor_scale.h"
+#include "editor/editor_scale.h"
#include "main/main.h"
#include "servers/display_server.h"
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index b8775cd3ed..21163531d8 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -39,10 +39,10 @@
#include "core/os/os.h"
#include "core/string/optimized_translation.h"
#include "core/version_generated.gen.h"
-#include "editor_data.h"
-#include "editor_node.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/gui/box_container.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/scroll_container.h"
diff --git a/editor/project_export.h b/editor/project_export.h
index 09e402c67f..0f0f0ed83c 100644
--- a/editor/project_export.h
+++ b/editor/project_export.h
@@ -34,7 +34,6 @@
#include "core/io/dir_access.h"
#include "core/os/thread.h"
#include "editor/editor_export.h"
-#include "editor/editor_file_dialog.h"
#include "editor/editor_file_system.h"
#include "editor/editor_inspector.h"
#include "editor/editor_properties.h"
@@ -54,6 +53,7 @@
#include "scene/main/timer.h"
class EditorNode;
+class EditorFileDialog;
class ProjectExportDialog : public ConfirmationDialog {
GDCLASS(ProjectExportDialog, ConfirmationDialog);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 57e47a15fd..4dfa310e08 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -30,6 +30,7 @@
#include "project_manager.h"
+#include "core/config/project_settings.h"
#include "core/io/config_file.h"
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
@@ -40,10 +41,10 @@
#include "core/os/os.h"
#include "core/string/translation.h"
#include "core/version.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
+#include "editor/editor_themes.h"
#include "editor/editor_vcs_interface.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
-#include "editor_themes.h"
#include "scene/gui/center_container.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/margin_container.h"
@@ -53,6 +54,7 @@
#include "scene/main/window.h"
#include "servers/display_server.h"
#include "servers/navigation_server_3d.h"
+#include "servers/physics_server_2d.h"
static inline String get_project_key_from_path(const String &dir) {
return dir.replace("/", "::");
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index d48c2b76ca..5dc1ddc0a8 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -31,15 +31,16 @@
#ifndef PROJECT_SETTINGS_EDITOR_H
#define PROJECT_SETTINGS_EDITOR_H
+#include "core/config/project_settings.h"
#include "core/object/undo_redo.h"
#include "editor/action_map_editor.h"
+#include "editor/editor_autoload_settings.h"
#include "editor/editor_data.h"
#include "editor/editor_plugin_settings.h"
#include "editor/editor_sectioned_inspector.h"
#include "editor/import_defaults_editor.h"
#include "editor/localization_editor.h"
#include "editor/shader_globals_editor.h"
-#include "editor_autoload_settings.h"
#include "scene/gui/tab_container.h"
class ProjectSettingsEditor : public AcceptDialog {
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 405e263a62..40f7b86ffc 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -44,6 +44,7 @@
#include "editor/create_dialog.h"
#include "editor/dictionary_property_edit.h"
#include "editor/editor_export.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_file_system.h"
#include "editor/editor_help.h"
#include "editor/editor_node.h"
@@ -52,6 +53,7 @@
#include "editor/filesystem_dock.h"
#include "editor/multi_node_edit.h"
#include "editor/property_selector.h"
+#include "editor/scene_tree_dock.h"
#include "scene/gui/label.h"
#include "scene/main/window.h"
#include "scene/resources/font.h"
diff --git a/editor/property_editor.h b/editor/property_editor.h
index 298acb3c01..c4287dc115 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -31,7 +31,6 @@
#ifndef PROPERTY_EDITOR_H
#define PROPERTY_EDITOR_H
-#include "editor/editor_file_dialog.h"
#include "editor/editor_locale_dialog.h"
#include "editor/scene_tree_editor.h"
#include "scene/gui/button.h"
@@ -47,8 +46,9 @@
#include "scene/gui/texture_rect.h"
#include "scene/gui/tree.h"
-class PropertyValueEvaluator;
class CreateDialog;
+class EditorFileDialog;
+class PropertyValueEvaluator;
class PropertySelector;
class EditorResourceConversionPlugin : public RefCounted {
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 0862efb4ee..825802d852 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -33,7 +33,7 @@
#include "core/os/keyboard.h"
#include "editor/doc_tools.h"
#include "editor/editor_node.h"
-#include "editor_scale.h"
+#include "editor/editor_scale.h"
void PropertySelector::_text_changed(const String &p_newtext) {
_update_search();
diff --git a/editor/property_selector.h b/editor/property_selector.h
index af848b9f18..1e8c6300a0 100644
--- a/editor/property_selector.h
+++ b/editor/property_selector.h
@@ -31,8 +31,8 @@
#ifndef PROPERTYSELECTOR_H
#define PROPERTYSELECTOR_H
+#include "editor/editor_help.h"
#include "editor/property_editor.h"
-#include "editor_help.h"
#include "scene/gui/rich_text_label.h"
class PropertySelector : public ConfirmationDialog {
diff --git a/editor/quick_open.h b/editor/quick_open.h
index 00edf46622..dc485a7c86 100644
--- a/editor/quick_open.h
+++ b/editor/quick_open.h
@@ -32,7 +32,7 @@
#define EDITOR_QUICK_OPEN_H
#include "core/templates/oa_hash_map.h"
-#include "editor_file_system.h"
+#include "editor/editor_file_system.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index c6a4c0d86a..46751058d0 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -34,10 +34,10 @@
#ifdef MODULE_REGEX_ENABLED
#include "core/string/print_string.h"
-#include "editor_node.h"
-#include "editor_scale.h"
-#include "editor_settings.h"
-#include "editor_themes.h"
+#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
+#include "editor/editor_themes.h"
#include "modules/regex/regex.h"
#include "plugins/script_editor_plugin.h"
#include "scene/gui/control.h"
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index a4f9563840..ed1c396059 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -37,6 +37,7 @@
#include "core/os/keyboard.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_feature_profile.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index e9aed53b4e..f5c46f883d 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -32,6 +32,7 @@
#include "core/object/message_queue.h"
#include "core/string/print_string.h"
+#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/node_dock.h"
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index 39fe64b828..f700182681 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -32,8 +32,8 @@
#define SCENE_TREE_EDITOR_H
#include "core/object/undo_redo.h"
-#include "editor_data.h"
-#include "editor_settings.h"
+#include "editor/editor_data.h"
+#include "editor/editor_settings.h"
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index b42d4a1d6d..82305c4073 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -35,9 +35,10 @@
#include "core/io/resource_saver.h"
#include "core/string/string_builder.h"
#include "editor/create_dialog.h"
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
-#include "editor_file_system.h"
void ScriptCreateDialog::_notification(int p_what) {
switch (p_what) {
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index 67d30e21fb..aea9649abc 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -32,8 +32,6 @@
#define SCRIPT_CREATE_DIALOG_H
#include "core/object/script_language.h"
-#include "editor/editor_file_dialog.h"
-#include "editor/editor_settings.h"
#include "scene/gui/check_box.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/grid_container.h"
@@ -42,6 +40,7 @@
#include "scene/gui/panel_container.h"
class CreateDialog;
+class EditorFileDialog;
class ScriptCreateDialog : public ConfirmationDialog {
GDCLASS(ScriptCreateDialog, ConfirmationDialog);
diff --git a/editor/shader_create_dialog.cpp b/editor/shader_create_dialog.cpp
index 95c4c5ff0d..3c807548ab 100644
--- a/editor/shader_create_dialog.cpp
+++ b/editor/shader_create_dialog.cpp
@@ -29,6 +29,9 @@
/*************************************************************************/
#include "shader_create_dialog.h"
+
+#include "core/config/project_settings.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_scale.h"
#include "scene/resources/visual_shader.h"
#include "servers/rendering/shader_types.h"
diff --git a/editor/shader_create_dialog.h b/editor/shader_create_dialog.h
index be0fef211c..6737ce4f10 100644
--- a/editor/shader_create_dialog.h
+++ b/editor/shader_create_dialog.h
@@ -31,7 +31,6 @@
#ifndef SHADER_CREATE_DIALOG_H
#define SHADER_CREATE_DIALOG_H
-#include "editor/editor_file_dialog.h"
#include "editor/editor_settings.h"
#include "scene/gui/check_box.h"
#include "scene/gui/dialogs.h"
@@ -40,6 +39,8 @@
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
+class EditorFileDialog;
+
class ShaderCreateDialog : public ConfirmationDialog {
GDCLASS(ShaderCreateDialog, ConfirmationDialog);
diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp
index 2f3867a58c..034f6d4857 100644
--- a/editor/shader_globals_editor.cpp
+++ b/editor/shader_globals_editor.cpp
@@ -29,7 +29,9 @@
/*************************************************************************/
#include "shader_globals_editor.h"
-#include "editor_node.h"
+
+#include "core/config/project_settings.h"
+#include "editor/editor_node.h"
#include "servers/rendering/shader_language.h"
static const char *global_var_type_names[RS::GLOBAL_VAR_TYPE_MAX] = {
diff --git a/editor/shader_globals_editor.h b/editor/shader_globals_editor.h
index efec9f4219..3b337e07de 100644
--- a/editor/shader_globals_editor.h
+++ b/editor/shader_globals_editor.h
@@ -36,7 +36,6 @@
#include "editor/editor_data.h"
#include "editor/editor_plugin_settings.h"
#include "editor/editor_sectioned_inspector.h"
-#include "scene/gui/dialogs.h"
#include "scene/gui/tab_container.h"
class ShaderGlobalsEditorInterface;
diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html
index 9e03f50c37..8d436038c1 100644
--- a/misc/dist/html/editor.html
+++ b/misc/dist/html/editor.html
@@ -271,7 +271,7 @@
<div id="tab-loader">
<div style="color: #e0e0e0;" id="persistence">
<br />
- <img src="logo.svg" alt="Godot Engine logo" width="1024" height="414" style="width: auto; height: auto; max-width: 85%; max-height: 250px" />
+ <img src="logo.svg" alt="Godot Engine logo" width="1024" height="414" style="width: auto; height: auto; max-width: min(85%, 50vh); max-height: 250px" />
<br />
@GODOT_VERSION@
<br />
diff --git a/misc/dist/html/manifest.json b/misc/dist/html/manifest.json
index adc8106e2a..ccfb793b20 100644
--- a/misc/dist/html/manifest.json
+++ b/misc/dist/html/manifest.json
@@ -5,7 +5,6 @@
"lang": "en",
"start_url": "./godot.tools.html",
"display": "standalone",
- "orientation": "landscape",
"theme_color": "#202531",
"icons": [
{
diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp
index 9a6a33fad3..076978c4fb 100644
--- a/modules/csg/csg_gizmos.cpp
+++ b/modules/csg/csg_gizmos.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "csg_gizmos.h"
+
+#include "editor/editor_settings.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/camera_3d.h"
diff --git a/modules/fbx/register_types.cpp b/modules/fbx/register_types.cpp
index 3eafb4af45..73e15e38b4 100644
--- a/modules/fbx/register_types.cpp
+++ b/modules/fbx/register_types.cpp
@@ -31,7 +31,7 @@
#include "register_types.h"
#include "editor/editor_node.h"
-#include "editor_scene_importer_fbx.h"
+#include "modules/fbx/editor_scene_importer_fbx.h"
#ifdef TOOLS_ENABLED
static void _editor_init() {
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index 33ea078696..868e1b878c 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -30,9 +30,10 @@
#ifdef TOOLS_ENABLED
#include "gdnative_library_editor_plugin.h"
-#include "gdnative.h"
-
+#include "editor/editor_file_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "gdnative.h"
void GDNativeLibraryEditor::edit(Ref<GDNativeLibrary> p_library) {
library = p_library;
diff --git a/modules/gdnative/gdnative_library_editor_plugin.h b/modules/gdnative/gdnative_library_editor_plugin.h
index 27848893fa..8d007d207c 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.h
+++ b/modules/gdnative/gdnative_library_editor_plugin.h
@@ -32,8 +32,15 @@
#define GDNATIVE_LIBRARY_EDITOR_PLUGIN_H
#ifdef TOOLS_ENABLED
-#include "editor/editor_node.h"
+
+#include "editor/editor_plugin.h"
#include "gdnative.h"
+#include "scene/gui/control.h"
+#include "scene/gui/menu_button.h"
+#include "scene/gui/tree.h"
+
+class EditorNode;
+class EditorFileDialog;
class GDNativeLibraryEditor : public Control {
GDCLASS(GDNativeLibraryEditor, Control);
diff --git a/modules/gdnative/gdnative_library_singleton_editor.cpp b/modules/gdnative/gdnative_library_singleton_editor.cpp
index 6eb412eccb..e0079f93ee 100644
--- a/modules/gdnative/gdnative_library_singleton_editor.cpp
+++ b/modules/gdnative/gdnative_library_singleton_editor.cpp
@@ -32,6 +32,7 @@
#include "gdnative_library_singleton_editor.h"
#include "gdnative.h"
+#include "core/config/project_settings.h"
#include "editor/editor_node.h"
Set<String> GDNativeLibrarySingletonEditor::_find_singletons_recursive(EditorFileSystemDirectory *p_dir) {
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index ac6684a29c..e3f0ddfc35 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -31,6 +31,7 @@
#include "gdscript_highlighter.h"
#include "../gdscript.h"
#include "../gdscript_tokenizer.h"
+#include "core/config/project_settings.h"
#include "editor/editor_settings.h"
Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_line) {
diff --git a/modules/gltf/editor_scene_exporter_gltf_plugin.cpp b/modules/gltf/editor_scene_exporter_gltf_plugin.cpp
index fd5741605c..9cae1cd87a 100644
--- a/modules/gltf/editor_scene_exporter_gltf_plugin.cpp
+++ b/modules/gltf/editor_scene_exporter_gltf_plugin.cpp
@@ -30,10 +30,12 @@
#if TOOLS_ENABLED
#include "editor_scene_exporter_gltf_plugin.h"
+
#include "core/config/project_settings.h"
#include "core/error/error_list.h"
#include "core/object/object.h"
#include "core/templates/vector.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_file_system.h"
#include "gltf_document.h"
#include "gltf_state.h"
diff --git a/modules/gltf/editor_scene_exporter_gltf_plugin.h b/modules/gltf/editor_scene_exporter_gltf_plugin.h
index e6b15e73c4..99d8911f46 100644
--- a/modules/gltf/editor_scene_exporter_gltf_plugin.h
+++ b/modules/gltf/editor_scene_exporter_gltf_plugin.h
@@ -33,7 +33,6 @@
#if TOOLS_ENABLED
#include "editor/editor_plugin.h"
-
#include "editor_scene_importer_gltf.h"
class SceneExporterGLTFPlugin : public EditorPlugin {
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index a3dcfddc7f..f555c8912d 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -5322,14 +5322,31 @@ void GLTFDocument::_convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeInd
if (meshes.size() != 2) {
return;
}
- Ref<Material> mat;
- if (csg->get_material_override().is_valid()) {
- mat = csg->get_material_override();
+
+ Ref<ImporterMesh> mesh;
+ mesh.instantiate();
+ {
+ Ref<Mesh> csg_mesh = csg->get_meshes()[1];
+
+ for (int32_t surface_i = 0; surface_i < csg_mesh->get_surface_count(); surface_i++) {
+ Array array = csg_mesh->surface_get_arrays(surface_i);
+ Ref<Material> mat = csg_mesh->surface_get_material(surface_i);
+ String mat_name;
+ if (mat.is_valid()) {
+ mat_name = mat->get_name();
+ } else {
+ // Assign default material when no material is assigned.
+ mat = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
+ }
+ mesh->add_surface(csg_mesh->surface_get_primitive_type(surface_i),
+ array, csg_mesh->surface_get_blend_shape_arrays(surface_i), csg_mesh->surface_get_lods(surface_i), mat,
+ mat_name, csg_mesh->surface_get_format(surface_i));
+ }
}
+
Ref<GLTFMesh> gltf_mesh;
gltf_mesh.instantiate();
- Ref<ImporterMesh> array_mesh = csg->get_meshes()[1];
- gltf_mesh->set_mesh(array_mesh);
+ gltf_mesh->set_mesh(mesh);
GLTFMeshIndex mesh_i = state->meshes.size();
state->meshes.push_back(gltf_mesh);
gltf_node->mesh = mesh_i;
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 84510fc71e..5c0b45865d 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -30,6 +30,7 @@
#include "grid_map_editor_plugin.h"
#include "core/input/input.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/plugins/node_3d_editor_plugin.h"
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 37298a1d80..3b54138e36 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -31,10 +31,13 @@
#ifndef GRID_MAP_EDITOR_PLUGIN_H
#define GRID_MAP_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "grid_map.h"
+#include "scene/gui/item_list.h"
+#include "scene/gui/slider.h"
+#include "scene/gui/spin_box.h"
+class EditorNode;
class Node3DEditorPlugin;
class GridMapEditor : public VBoxContainer {
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 1de41821f9..f345dff333 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -279,8 +279,9 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
xml_output.append("[");
pos = brk_pos + 1;
} else if (tag.begins_with("method ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ")) {
- String link_target = tag.substr(tag.find(" ") + 1, tag.length());
- String link_tag = tag.substr(0, tag.find(" "));
+ const int tag_end = tag.find(" ");
+ const String link_tag = tag.substr(0, tag_end);
+ const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
Vector<String> link_target_parts = link_target.split(".");
@@ -360,12 +361,38 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
}
}
} else if (link_tag == "signal") {
- // We do not declare signals in any way in C#, so there is nothing to reference
- xml_output.append("<c>");
- xml_output.append(link_target);
- xml_output.append("</c>");
+ if (!target_itype || !target_itype->is_object_type) {
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ if (target_itype) {
+ OS::get_singleton()->print("Cannot resolve signal reference for non-Godot.Object type in documentation: %s\n", link_target.utf8().get_data());
+ } else {
+ OS::get_singleton()->print("Cannot resolve type from signal reference in documentation: %s\n", link_target.utf8().get_data());
+ }
+ }
+
+ // TODO Map what we can
+ xml_output.append("<c>");
+ xml_output.append(link_target);
+ xml_output.append("</c>");
+ } else {
+ const SignalInterface *target_isignal = target_itype->find_signal_by_name(target_cname);
+
+ if (target_isignal) {
+ xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".");
+ xml_output.append(target_itype->proxy_name);
+ xml_output.append(".");
+ xml_output.append(target_isignal->proxy_name);
+ xml_output.append("\"/>");
+ } else {
+ ERR_PRINT("Cannot resolve signal reference in documentation: '" + link_target + "'.");
+
+ xml_output.append("<c>");
+ xml_output.append(link_target);
+ xml_output.append("</c>");
+ }
+ }
} else if (link_tag == "enum") {
- StringName search_cname = !target_itype ? target_cname : StringName(target_itype->name + "." + (String)target_cname);
+ const StringName search_cname = !target_itype ? target_cname : StringName(target_itype->name + "." + (String)target_cname);
const Map<StringName, TypeInterface>::Element *enum_match = enum_types.find(search_cname);
@@ -401,7 +428,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
xml_output.append(link_target);
xml_output.append("</c>");
} else if (!target_itype && target_cname == name_cache.type_at_GlobalScope) {
- String target_name = (String)target_cname;
+ const String target_name = (String)target_cname;
// Try to find as a global constant
const ConstantInterface *target_iconst = find_constant_by_name(target_name, global_constants);
@@ -438,7 +465,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
}
}
} else {
- String target_name = (String)target_cname;
+ const String target_name = (String)target_cname;
// Try to find the constant in the current class
const ConstantInterface *target_iconst = find_constant_by_name(target_name, target_itype->constants);
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index 2e6ce3a952..5460f018f0 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -366,6 +366,16 @@ class BindingsGenerator {
return nullptr;
}
+ const MethodInterface *find_method_by_proxy_name(const String &p_proxy_name) const {
+ for (const MethodInterface &E : methods) {
+ if (E.proxy_name == p_proxy_name) {
+ return &E;
+ }
+ }
+
+ return nullptr;
+ }
+
const PropertyInterface *find_property_by_name(const StringName &p_cname) const {
for (const PropertyInterface &E : properties) {
if (E.cname == p_cname) {
@@ -386,8 +396,18 @@ class BindingsGenerator {
return nullptr;
}
- const MethodInterface *find_method_by_proxy_name(const String &p_proxy_name) const {
- for (const MethodInterface &E : methods) {
+ const SignalInterface *find_signal_by_name(const StringName &p_cname) const {
+ for (const SignalInterface &E : signals_) {
+ if (E.cname == p_cname) {
+ return &E;
+ }
+ }
+
+ return nullptr;
+ }
+
+ const SignalInterface *find_signal_by_proxy_name(const String &p_proxy_name) const {
+ for (const SignalInterface &E : signals_) {
if (E.proxy_name == p_proxy_name) {
return &E;
}
diff --git a/modules/mono/editor/editor_internal_calls.cpp b/modules/mono/editor/editor_internal_calls.cpp
index 3c02ea0e8e..f7f710f3f1 100644
--- a/modules/mono/editor/editor_internal_calls.cpp
+++ b/modules/mono/editor/editor_internal_calls.cpp
@@ -34,6 +34,7 @@
#include <unistd.h> // access
#endif
+#include "core/config/project_settings.h"
#include "core/os/os.h"
#include "core/version.h"
#include "editor/debugger/editor_debugger_node.h"
diff --git a/modules/navigation/navigation_mesh_editor_plugin.cpp b/modules/navigation/navigation_mesh_editor_plugin.cpp
index 6db3cbc1a3..af02bff4ca 100644
--- a/modules/navigation/navigation_mesh_editor_plugin.cpp
+++ b/modules/navigation/navigation_mesh_editor_plugin.cpp
@@ -33,6 +33,7 @@
#include "core/io/marshalls.h"
#include "core/io/resource_saver.h"
+#include "editor/editor_node.h"
#include "navigation_mesh_generator.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/box_container.h"
diff --git a/modules/navigation/navigation_mesh_editor_plugin.h b/modules/navigation/navigation_mesh_editor_plugin.h
index 6517a7be5b..49ca28d3cf 100644
--- a/modules/navigation/navigation_mesh_editor_plugin.h
+++ b/modules/navigation/navigation_mesh_editor_plugin.h
@@ -33,9 +33,9 @@
#ifdef TOOLS_ENABLED
-#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
+class EditorNode;
class NavigationRegion3D;
class NavigationMeshEditor : public Control {
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp
index df2d32e152..464488967e 100644
--- a/platform/android/export/export_plugin.cpp
+++ b/platform/android/export/export_plugin.cpp
@@ -30,6 +30,8 @@
#include "export_plugin.h"
+#include "editor/editor_node.h"
+
static const char *android_perms[] = {
"ACCESS_CHECKIN_PROPERTIES",
"ACCESS_COARSE_LOCATION",
diff --git a/platform/android/export/export_plugin.h b/platform/android/export/export_plugin.h
index 9e952ecb8f..c158a273d2 100644
--- a/platform/android/export/export_plugin.h
+++ b/platform/android/export/export_plugin.h
@@ -41,7 +41,6 @@
#include "drivers/png/png_driver_common.h"
#include "editor/editor_export.h"
#include "editor/editor_log.h"
-#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "main/splash.gen.h"
#include "platform/android/logo.gen.h"
diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp
index babd8173d0..9598d2f9fd 100644
--- a/platform/android/export/gradle_export_util.cpp
+++ b/platform/android/export/gradle_export_util.cpp
@@ -30,6 +30,8 @@
#include "gradle_export_util.h"
+#include "core/config/project_settings.h"
+
int _get_android_orientation_value(DisplayServer::ScreenOrientation screen_orientation) {
switch (screen_orientation) {
case DisplayServer::SCREEN_PORTRAIT:
diff --git a/platform/iphone/export/export_plugin.cpp b/platform/iphone/export/export_plugin.cpp
index 122e64d6a1..69c6df8a38 100644
--- a/platform/iphone/export/export_plugin.cpp
+++ b/platform/iphone/export/export_plugin.cpp
@@ -30,6 +30,8 @@
#include "export_plugin.h"
+#include "editor/editor_node.h"
+
void EditorExportPlatformIOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
String driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name");
// Vulkan and OpenGL ES 3.0 both mandate ETC2 support.
diff --git a/platform/iphone/export/export_plugin.h b/platform/iphone/export/export_plugin.h
index 93b23f7ee2..c01983e39f 100644
--- a/platform/iphone/export/export_plugin.h
+++ b/platform/iphone/export/export_plugin.h
@@ -41,7 +41,6 @@
#include "core/templates/safe_refcount.h"
#include "core/version.h"
#include "editor/editor_export.h"
-#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "main/splash.gen.h"
#include "platform/iphone/logo.gen.h"
diff --git a/platform/javascript/export/export_plugin.cpp b/platform/javascript/export/export_plugin.cpp
index d4c198d631..8a1360e421 100644
--- a/platform/javascript/export/export_plugin.cpp
+++ b/platform/javascript/export/export_plugin.cpp
@@ -30,6 +30,9 @@
#include "export_plugin.h"
+#include "core/config/project_settings.h"
+#include "editor/editor_node.h"
+
Error EditorExportPlatformJavaScript::_extract_template(const String &p_template, const String &p_dir, const String &p_name, bool pwa) {
FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
diff --git a/platform/javascript/export/export_plugin.h b/platform/javascript/export/export_plugin.h
index 278e317430..8d4307548c 100644
--- a/platform/javascript/export/export_plugin.h
+++ b/platform/javascript/export/export_plugin.h
@@ -31,18 +31,20 @@
#ifndef JAVASCRIPT_EXPORT_PLUGIN_H
#define JAVASCRIPT_EXPORT_PLUGIN_H
+#include "core/config/project_settings.h"
#include "core/io/image_loader.h"
#include "core/io/stream_peer_ssl.h"
#include "core/io/tcp_server.h"
#include "core/io/zip_io.h"
#include "editor/editor_export.h"
-#include "editor/editor_node.h"
#include "main/splash.gen.h"
#include "platform/javascript/logo.gen.h"
#include "platform/javascript/run_icon.gen.h"
#include "export_server.h"
+class EditorNode;
+
class EditorExportPlatformJavaScript : public EditorExportPlatform {
GDCLASS(EditorExportPlatformJavaScript, EditorExportPlatform);
diff --git a/platform/javascript/js/libs/library_godot_fetch.js b/platform/javascript/js/libs/library_godot_fetch.js
index 285e50a035..007e7b70f5 100644
--- a/platform/javascript/js/libs/library_godot_fetch.js
+++ b/platform/javascript/js/libs/library_godot_fetch.js
@@ -89,6 +89,7 @@ const GodotFetch = {
method: method,
headers: headers,
body: body,
+ credentials: 'include',
};
obj.request = fetch(url, init);
obj.request.then(GodotFetch.onresponse.bind(null, id)).catch(GodotFetch.onerror.bind(null, id));
diff --git a/platform/linuxbsd/os_linuxbsd.h b/platform/linuxbsd/os_linuxbsd.h
index ad6e4cd168..d97a528ece 100644
--- a/platform/linuxbsd/os_linuxbsd.h
+++ b/platform/linuxbsd/os_linuxbsd.h
@@ -39,8 +39,6 @@
#include "drivers/unix/os_unix.h"
#include "joypad_linux.h"
#include "servers/audio_server.h"
-#include "servers/rendering/renderer_compositor.h"
-#include "servers/rendering_server.h"
class OS_LinuxBSD : public OS_Unix {
virtual void delete_main_loop() override;
diff --git a/platform/osx/export/export_plugin.cpp b/platform/osx/export/export_plugin.cpp
index f0b58efb63..4d5c0a827a 100644
--- a/platform/osx/export/export_plugin.cpp
+++ b/platform/osx/export/export_plugin.cpp
@@ -31,6 +31,7 @@
#include "modules/modules_enabled.gen.h" // For regex.
#include "codesign.h"
+#include "editor/editor_node.h"
#include "export_plugin.h"
void EditorExportPlatformOSX::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
diff --git a/platform/osx/export/export_plugin.h b/platform/osx/export/export_plugin.h
index 931ce7e41a..b85e9d662c 100644
--- a/platform/osx/export/export_plugin.h
+++ b/platform/osx/export/export_plugin.h
@@ -40,7 +40,6 @@
#include "core/os/os.h"
#include "core/version.h"
#include "editor/editor_export.h"
-#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "platform/osx/logo.gen.h"
diff --git a/platform/uwp/export/app_packager.cpp b/platform/uwp/export/app_packager.cpp
index 9b586a640e..c7b3bc9854 100644
--- a/platform/uwp/export/app_packager.cpp
+++ b/platform/uwp/export/app_packager.cpp
@@ -30,6 +30,8 @@
#include "app_packager.h"
+#include "editor/editor_node.h"
+
String AppxPackager::hash_block(const uint8_t *p_block_data, size_t p_block_len) {
unsigned char hash[32];
char base64[45];
diff --git a/platform/uwp/export/app_packager.h b/platform/uwp/export/app_packager.h
index a5f5896592..da118449c7 100644
--- a/platform/uwp/export/app_packager.h
+++ b/platform/uwp/export/app_packager.h
@@ -41,7 +41,6 @@
#include "core/object/class_db.h"
#include "core/version.h"
#include "editor/editor_export.h"
-#include "editor/editor_node.h"
#include "thirdparty/minizip/unzip.h"
#include "thirdparty/minizip/zip.h"
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 20268b3f6a..36c87f2683 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -1023,6 +1023,7 @@ void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscre
r_style_ex |= WS_EX_TOPMOST | WS_EX_NOACTIVATE;
}
r_style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
+ r_style_ex |= WS_EX_ACCEPTFILES;
}
void DisplayServerWindows::_update_window_style(WindowID p_window, bool p_repaint) {
@@ -1099,10 +1100,10 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window)
if (p_mode == WINDOW_MODE_EXCLUSIVE_FULLSCREEN) {
wd.multiwindow_fs = false;
- _update_window_style(false);
+ _update_window_style(p_window, false);
} else {
wd.multiwindow_fs = true;
- _update_window_style(false);
+ _update_window_style(p_window, false);
}
if ((p_mode == WINDOW_MODE_FULLSCREEN || p_mode == WINDOW_MODE_EXCLUSIVE_FULLSCREEN) && !wd.fullscreen) {
@@ -1123,7 +1124,7 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window)
wd.maximized = false;
wd.minimized = false;
- _update_window_style(false);
+ _update_window_style(p_window, false);
MoveWindow(wd.hWnd, pos.x, pos.y, size.width, size.height, TRUE);
diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp
index d30d0afc5c..5ebc930735 100644
--- a/platform/windows/export/export_plugin.cpp
+++ b/platform/windows/export/export_plugin.cpp
@@ -30,6 +30,9 @@
#include "export_plugin.h"
+#include "core/config/project_settings.h"
+#include "editor/editor_node.h"
+
Error EditorExportPlatformWindows::sign_shared_object(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path) {
if (p_preset->get("codesign/enable")) {
return _code_sign(p_preset, p_path);
diff --git a/platform/windows/export/export_plugin.h b/platform/windows/export/export_plugin.h
index 89e5b1b635..86e9d49b05 100644
--- a/platform/windows/export/export_plugin.h
+++ b/platform/windows/export/export_plugin.h
@@ -34,7 +34,6 @@
#include "core/io/file_access.h"
#include "core/os/os.h"
#include "editor/editor_export.h"
-#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "platform/windows/logo.gen.h"
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 28baa855b4..0a11416b1b 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -40,8 +40,6 @@
#include "drivers/winmidi/midi_driver_winmidi.h"
#include "key_mapping_windows.h"
#include "servers/audio_server.h"
-#include "servers/rendering/renderer_compositor.h"
-#include "servers/rendering_server.h"
#ifdef XAUDIO2_ENABLED
#include "drivers/xaudio2/audio_driver_xaudio2.h"
#endif
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index a761d0d1ec..f8e30c2462 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -33,6 +33,7 @@
#include "scene/2d/area_2d.h"
#include "scene/2d/audio_listener_2d.h"
#include "scene/main/window.h"
+#include "scene/resources/world_2d.h"
void AudioStreamPlayer2D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index e8dfaf9c2e..548cd5de9a 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -30,6 +30,7 @@
#include "camera_2d.h"
+#include "core/config/project_settings.h"
#include "scene/main/window.h"
void Camera2D::_update_scroll() {
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 70c7e48fd4..fbfe1d7eff 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -30,6 +30,7 @@
#include "collision_object_2d.h"
+#include "scene/resources/world_2d.h"
#include "scene/scene_string_names.h"
void CollisionObject2D::_notification(int p_what) {
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index 9331f2dccb..1bbf7236c5 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -31,6 +31,7 @@
#include "navigation_agent_2d.h"
#include "core/math/geometry_2d.h"
+#include "scene/resources/world_2d.h"
#include "servers/navigation_server_2d.h"
void NavigationAgent2D::_bind_methods() {
diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp
index fad54070a5..90d993f20b 100644
--- a/scene/2d/navigation_obstacle_2d.cpp
+++ b/scene/2d/navigation_obstacle_2d.cpp
@@ -31,6 +31,7 @@
#include "navigation_obstacle_2d.h"
#include "scene/2d/collision_shape_2d.h"
+#include "scene/resources/world_2d.h"
#include "servers/navigation_server_2d.h"
void NavigationObstacle2D::_bind_methods() {
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index e685ad8f67..99d8b0f604 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -33,6 +33,7 @@
#include "core/core_string_names.h"
#include "core/math/geometry_2d.h"
#include "core/os/mutex.h"
+#include "scene/resources/world_2d.h"
#include "servers/navigation_server_2d.h"
#include "thirdparty/misc/polypartition.h"
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index 51b3e676f9..8b69d52c32 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -31,6 +31,7 @@
#include "ray_cast_2d.h"
#include "collision_object_2d.h"
+#include "scene/resources/world_2d.h"
void RayCast2D::set_target_position(const Vector2 &p_point) {
target_position = p_point;
diff --git a/scene/2d/shape_cast_2d.h b/scene/2d/shape_cast_2d.h
index ea36b25068..15436d6e3d 100644
--- a/scene/2d/shape_cast_2d.h
+++ b/scene/2d/shape_cast_2d.h
@@ -33,6 +33,7 @@
#include "scene/2d/node_2d.h"
#include "scene/resources/shape_2d.h"
+#include "scene/resources/world_2d.h"
class CollisionObject2D;
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp
index 2270926ea7..a12147b7fd 100644
--- a/scene/2d/skeleton_2d.cpp
+++ b/scene/2d/skeleton_2d.cpp
@@ -31,6 +31,7 @@
#include "skeleton_2d.h"
#ifdef TOOLS_ENABLED
+#include "editor/editor_data.h"
#include "editor/editor_settings.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#endif //TOOLS_ENABLED
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 02ca1ba2aa..cd39e08682 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -31,7 +31,7 @@
#include "tile_map.h"
#include "core/io/marshalls.h"
-
+#include "scene/resources/world_2d.h"
#include "servers/navigation_server_2d.h"
Map<Vector2i, TileSet::CellNeighbor> TileMap::TerrainConstraint::get_overlapping_coords_and_peering_bits() const {
diff --git a/scene/3d/camera_3d.h b/scene/3d/camera_3d.h
index b5665814c7..9f2f8ceed1 100644
--- a/scene/3d/camera_3d.h
+++ b/scene/3d/camera_3d.h
@@ -33,6 +33,8 @@
#include "scene/3d/node_3d.h"
#include "scene/3d/velocity_tracker_3d.h"
+#include "scene/resources/camera_effects.h"
+#include "scene/resources/environment.h"
class Camera3D : public Node3D {
GDCLASS(Camera3D, Node3D);
diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h
index 4abda66187..65d0e071cf 100644
--- a/scene/3d/node_3d.h
+++ b/scene/3d/node_3d.h
@@ -32,6 +32,7 @@
#define NODE_3D_H
#include "scene/main/node.h"
+#include "scene/resources/world_3d.h"
class Node3DGizmo : public RefCounted {
GDCLASS(Node3DGizmo, RefCounted);
diff --git a/scene/3d/occluder_instance_3d.cpp b/scene/3d/occluder_instance_3d.cpp
index 0277171922..231817526c 100644
--- a/scene/3d/occluder_instance_3d.cpp
+++ b/scene/3d/occluder_instance_3d.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "occluder_instance_3d.h"
+
+#include "core/config/project_settings.h"
#include "core/core_string_names.h"
#include "core/math/geometry_2d.h"
#include "core/math/triangulate.h"
diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp
index 66d1b97056..211c39c949 100644
--- a/scene/3d/xr_nodes.cpp
+++ b/scene/3d/xr_nodes.cpp
@@ -30,6 +30,7 @@
#include "xr_nodes.h"
+#include "core/config/project_settings.h"
#include "scene/main/viewport.h"
#include "servers/xr/xr_interface.h"
diff --git a/scene/gui/aspect_ratio_container.cpp b/scene/gui/aspect_ratio_container.cpp
index 181d1bf33b..b59eda465e 100644
--- a/scene/gui/aspect_ratio_container.cpp
+++ b/scene/gui/aspect_ratio_container.cpp
@@ -70,6 +70,24 @@ void AspectRatioContainer::set_alignment_vertical(AlignmentMode p_alignment_vert
queue_sort();
}
+Vector<int> AspectRatioContainer::get_allowed_size_flags_horizontal() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
+Vector<int> AspectRatioContainer::get_allowed_size_flags_vertical() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
void AspectRatioContainer::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_SORT_CHILDREN: {
diff --git a/scene/gui/aspect_ratio_container.h b/scene/gui/aspect_ratio_container.h
index 4a168bad14..6740e2f329 100644
--- a/scene/gui/aspect_ratio_container.h
+++ b/scene/gui/aspect_ratio_container.h
@@ -72,6 +72,9 @@ public:
void set_alignment_vertical(AlignmentMode p_alignment_vertical);
AlignmentMode get_alignment_vertical() const { return alignment_vertical; }
+
+ virtual Vector<int> get_allowed_size_flags_horizontal() const override;
+ virtual Vector<int> get_allowed_size_flags_vertical() const override;
};
VARIANT_ENUM_CAST(AspectRatioContainer::StretchMode);
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h
index 0bcad4fc0e..6bfffe7575 100644
--- a/scene/gui/base_button.h
+++ b/scene/gui/base_button.h
@@ -31,6 +31,7 @@
#ifndef BASE_BUTTON_H
#define BASE_BUTTON_H
+#include "core/input/shortcut.h"
#include "scene/gui/control.h"
class ButtonGroup;
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index 9827bd0cef..ed54410636 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -331,6 +331,30 @@ Control *BoxContainer::add_spacer(bool p_begin) {
return c;
}
+Vector<int> BoxContainer::get_allowed_size_flags_horizontal() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ if (!vertical) {
+ flags.append(SIZE_EXPAND);
+ }
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
+Vector<int> BoxContainer::get_allowed_size_flags_vertical() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ if (vertical) {
+ flags.append(SIZE_EXPAND);
+ }
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
BoxContainer::BoxContainer(bool p_vertical) {
vertical = p_vertical;
}
diff --git a/scene/gui/box_container.h b/scene/gui/box_container.h
index 68d55e1aaf..3043c3ea45 100644
--- a/scene/gui/box_container.h
+++ b/scene/gui/box_container.h
@@ -62,6 +62,9 @@ public:
virtual Size2 get_minimum_size() const override;
+ virtual Vector<int> get_allowed_size_flags_horizontal() const override;
+ virtual Vector<int> get_allowed_size_flags_vertical() const override;
+
BoxContainer(bool p_vertical = false);
};
diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp
index f3306783f3..f6cd74583b 100644
--- a/scene/gui/center_container.cpp
+++ b/scene/gui/center_container.cpp
@@ -69,6 +69,14 @@ bool CenterContainer::is_using_top_left() const {
return use_top_left;
}
+Vector<int> CenterContainer::get_allowed_size_flags_horizontal() const {
+ return Vector<int>();
+}
+
+Vector<int> CenterContainer::get_allowed_size_flags_vertical() const {
+ return Vector<int>();
+}
+
void CenterContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_SORT_CHILDREN) {
Size2 size = get_size();
diff --git a/scene/gui/center_container.h b/scene/gui/center_container.h
index 16a10c8070..c35e0c4e29 100644
--- a/scene/gui/center_container.h
+++ b/scene/gui/center_container.h
@@ -48,6 +48,9 @@ public:
virtual Size2 get_minimum_size() const override;
+ virtual Vector<int> get_allowed_size_flags_horizontal() const override;
+ virtual Vector<int> get_allowed_size_flags_vertical() const override;
+
CenterContainer();
};
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 7b213ec314..b8a5a06147 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -143,6 +143,34 @@ void Container::queue_sort() {
pending_sort = true;
}
+Vector<int> Container::get_allowed_size_flags_horizontal() const {
+ Vector<int> flags;
+ if (GDVIRTUAL_CALL(_get_allowed_size_flags_horizontal, flags)) {
+ return flags;
+ }
+
+ flags.append(SIZE_FILL);
+ flags.append(SIZE_EXPAND);
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
+Vector<int> Container::get_allowed_size_flags_vertical() const {
+ Vector<int> flags;
+ if (GDVIRTUAL_CALL(_get_allowed_size_flags_vertical, flags)) {
+ return flags;
+ }
+
+ flags.append(SIZE_FILL);
+ flags.append(SIZE_EXPAND);
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
void Container::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
@@ -177,6 +205,9 @@ void Container::_bind_methods() {
ClassDB::bind_method(D_METHOD("queue_sort"), &Container::queue_sort);
ClassDB::bind_method(D_METHOD("fit_child_in_rect", "child", "rect"), &Container::fit_child_in_rect);
+ GDVIRTUAL_BIND(_get_allowed_size_flags_horizontal);
+ GDVIRTUAL_BIND(_get_allowed_size_flags_vertical);
+
BIND_CONSTANT(NOTIFICATION_PRE_SORT_CHILDREN);
BIND_CONSTANT(NOTIFICATION_SORT_CHILDREN);
diff --git a/scene/gui/container.h b/scene/gui/container.h
index 0e986f46ef..9ec4ad3200 100644
--- a/scene/gui/container.h
+++ b/scene/gui/container.h
@@ -46,6 +46,9 @@ protected:
virtual void move_child_notify(Node *p_child) override;
virtual void remove_child_notify(Node *p_child) override;
+ GDVIRTUAL0RC(Vector<int>, _get_allowed_size_flags_horizontal)
+ GDVIRTUAL0RC(Vector<int>, _get_allowed_size_flags_vertical)
+
void _notification(int p_what);
static void _bind_methods();
@@ -57,6 +60,9 @@ public:
void fit_child_in_rect(Control *p_child, const Rect2 &p_rect);
+ virtual Vector<int> get_allowed_size_flags_horizontal() const;
+ virtual Vector<int> get_allowed_size_flags_vertical() const;
+
TypedArray<String> get_configuration_warnings() const override;
Container();
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index fdae8e2f1f..aa59df6337 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -47,7 +47,7 @@
#include "servers/text_server.h"
#ifdef TOOLS_ENABLED
-#include "editor/plugins/canvas_item_editor_plugin.h"
+#include "editor/plugins/control_editor_plugin.h"
#endif
#ifdef TOOLS_ENABLED
@@ -56,51 +56,71 @@ Dictionary Control::_edit_get_state() const {
s["rotation"] = get_rotation();
s["scale"] = get_scale();
s["pivot"] = get_pivot_offset();
+
Array anchors;
anchors.push_back(get_anchor(SIDE_LEFT));
anchors.push_back(get_anchor(SIDE_TOP));
anchors.push_back(get_anchor(SIDE_RIGHT));
anchors.push_back(get_anchor(SIDE_BOTTOM));
s["anchors"] = anchors;
+
Array offsets;
offsets.push_back(get_offset(SIDE_LEFT));
offsets.push_back(get_offset(SIDE_TOP));
offsets.push_back(get_offset(SIDE_RIGHT));
offsets.push_back(get_offset(SIDE_BOTTOM));
s["offsets"] = offsets;
+
+ s["layout_mode"] = _get_layout_mode();
+ s["anchors_layout_preset"] = _get_anchors_layout_preset();
+
return s;
}
void Control::_edit_set_state(const Dictionary &p_state) {
ERR_FAIL_COND((p_state.size() <= 0) ||
!p_state.has("rotation") || !p_state.has("scale") ||
- !p_state.has("pivot") || !p_state.has("anchors") || !p_state.has("offsets"));
+ !p_state.has("pivot") || !p_state.has("anchors") || !p_state.has("offsets") ||
+ !p_state.has("layout_mode") || !p_state.has("anchors_layout_preset"));
Dictionary state = p_state;
set_rotation(state["rotation"]);
set_scale(state["scale"]);
set_pivot_offset(state["pivot"]);
+
Array anchors = state["anchors"];
+
+ // If anchors are not in their default position, force the anchor layout mode in place of position.
+ LayoutMode _layout = (LayoutMode)(int)state["layout_mode"];
+ if (_layout == LayoutMode::LAYOUT_MODE_POSITION) {
+ bool anchors_mode = ((real_t)anchors[0] != 0.0 || (real_t)anchors[1] != 0.0 || (real_t)anchors[2] != 0.0 || (real_t)anchors[3] != 0.0);
+ if (anchors_mode) {
+ _layout = LayoutMode::LAYOUT_MODE_ANCHORS;
+ }
+ }
+
+ _set_layout_mode(_layout);
+ if (_layout == LayoutMode::LAYOUT_MODE_ANCHORS) {
+ _set_anchors_layout_preset((int)state["anchors_layout_preset"]);
+ }
+
data.anchor[SIDE_LEFT] = anchors[0];
data.anchor[SIDE_TOP] = anchors[1];
data.anchor[SIDE_RIGHT] = anchors[2];
data.anchor[SIDE_BOTTOM] = anchors[3];
+
Array offsets = state["offsets"];
data.offset[SIDE_LEFT] = offsets[0];
data.offset[SIDE_TOP] = offsets[1];
data.offset[SIDE_RIGHT] = offsets[2];
data.offset[SIDE_BOTTOM] = offsets[3];
+
_size_changed();
}
void Control::_edit_set_position(const Point2 &p_position) {
-#ifdef TOOLS_ENABLED
ERR_FAIL_COND_MSG(!Engine::get_singleton()->is_editor_hint(), "This function can only be used from editor plugins.");
- set_position(p_position, CanvasItemEditor::get_singleton()->is_anchors_mode_enabled() && Object::cast_to<Control>(data.parent));
-#else
- // Unlikely to happen. TODO: enclose all _edit_ functions into TOOLS_ENABLED
- set_position(p_position);
-#endif
+ set_position(p_position, ControlEditorToolbar::get_singleton()->is_anchors_mode_enabled() && Object::cast_to<Control>(data.parent));
};
Point2 Control::_edit_get_position() const {
@@ -116,15 +136,9 @@ Size2 Control::_edit_get_scale() const {
}
void Control::_edit_set_rect(const Rect2 &p_edit_rect) {
-#ifdef TOOLS_ENABLED
ERR_FAIL_COND_MSG(!Engine::get_singleton()->is_editor_hint(), "This function can only be used from editor plugins.");
- set_position((get_position() + get_transform().basis_xform(p_edit_rect.position)).snapped(Vector2(1, 1)), CanvasItemEditor::get_singleton()->is_anchors_mode_enabled());
- set_size(p_edit_rect.size.snapped(Vector2(1, 1)), CanvasItemEditor::get_singleton()->is_anchors_mode_enabled());
-#else
- // Unlikely to happen. TODO: enclose all _edit_ functions into TOOLS_ENABLED
- set_position((get_position() + get_transform().basis_xform(p_edit_rect.position)).snapped(Vector2(1, 1)));
- set_size(p_edit_rect.size.snapped(Vector2(1, 1)));
-#endif
+ set_position((get_position() + get_transform().basis_xform(p_edit_rect.position)).snapped(Vector2(1, 1)), ControlEditorToolbar::get_singleton()->is_anchors_mode_enabled());
+ set_size(p_edit_rect.size.snapped(Vector2(1, 1)), ControlEditorToolbar::get_singleton()->is_anchors_mode_enabled());
}
Rect2 Control::_edit_get_rect() const {
@@ -177,6 +191,7 @@ String Control::properties_managed_by_container[] = {
"anchor_right",
"anchor_bottom",
"rect_position",
+ "rect_rotation",
"rect_scale",
"rect_size"
};
@@ -430,6 +445,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
}
void Control::_validate_property(PropertyInfo &property) const {
+ // Update theme type variation options.
if (property.name == "theme_type_variation") {
List<StringName> names;
@@ -455,10 +471,99 @@ void Control::_validate_property(PropertyInfo &property) const {
property.hint_string = hint_string;
}
- if (!Object::cast_to<Container>(get_parent())) {
- return;
+
+ // Validate which positioning properties should be displayed depending on the parent and the layout mode.
+ Node *parent_node = get_parent_control();
+ if (!parent_node) {
+ // If there is no parent, display both anchor and container options.
+
+ // Set the layout mode to be disabled with the proper value.
+ if (property.name == "layout_mode") {
+ property.hint_string = "Position,Anchors,Container,Uncontrolled";
+ property.usage |= PROPERTY_USAGE_READ_ONLY;
+ }
+
+ // Use the layout mode to display or hide advanced anchoring properties.
+ bool use_custom_anchors = _get_anchors_layout_preset() == -1; // Custom "preset".
+ if (!use_custom_anchors && (property.name.begins_with("anchor_") || property.name.begins_with("offset_") || property.name.begins_with("grow_"))) {
+ property.usage ^= PROPERTY_USAGE_EDITOR;
+ }
+ } else if (Object::cast_to<Container>(parent_node)) {
+ // If the parent is a container, display only container-related properties.
+ if (property.name.begins_with("anchor_") || property.name.begins_with("offset_") || property.name.begins_with("grow_") || property.name == "anchors_preset" ||
+ (property.name.begins_with("rect_") && property.name != "rect_min_size" && property.name != "rect_clip_content" && property.name != "rect_global_position")) {
+ property.usage ^= PROPERTY_USAGE_EDITOR;
+
+ } else if (property.name == "layout_mode") {
+ // Set the layout mode to be disabled with the proper value.
+ property.hint_string = "Position,Anchors,Container,Uncontrolled";
+ property.usage |= PROPERTY_USAGE_READ_ONLY;
+ } else if (property.name == "size_flags_horizontal" || property.name == "size_flags_vertical") {
+ // Filter allowed size flags based on the parent container configuration.
+ Container *parent_container = Object::cast_to<Container>(parent_node);
+ Vector<int> size_flags;
+ if (property.name == "size_flags_horizontal") {
+ size_flags = parent_container->get_allowed_size_flags_horizontal();
+ } else if (property.name == "size_flags_vertical") {
+ size_flags = parent_container->get_allowed_size_flags_vertical();
+ }
+
+ // Enforce the order of the options, regardless of what the container provided.
+ String hint_string;
+ if (size_flags.has(SIZE_FILL)) {
+ hint_string += "Fill:1";
+ }
+ if (size_flags.has(SIZE_EXPAND)) {
+ if (!hint_string.is_empty()) {
+ hint_string += ",";
+ }
+ hint_string += "Expand:2";
+ }
+ if (size_flags.has(SIZE_SHRINK_CENTER)) {
+ if (!hint_string.is_empty()) {
+ hint_string += ",";
+ }
+ hint_string += "Shrink Center:4";
+ }
+ if (size_flags.has(SIZE_SHRINK_END)) {
+ if (!hint_string.is_empty()) {
+ hint_string += ",";
+ }
+ hint_string += "Shrink End:8";
+ }
+
+ if (hint_string.is_empty()) {
+ property.hint_string = "";
+ property.usage |= PROPERTY_USAGE_READ_ONLY;
+ } else {
+ property.hint_string = hint_string;
+ }
+ }
+ } else {
+ // If the parent is NOT a container or not a control at all, display only anchoring-related properties.
+ if (property.name.begins_with("size_flags_")) {
+ property.usage ^= PROPERTY_USAGE_EDITOR;
+
+ } else if (property.name == "layout_mode") {
+ // Set the layout mode to be enabled with proper options.
+ property.hint_string = "Position,Anchors";
+ }
+
+ // Use the layout mode to display or hide advanced anchoring properties.
+ bool use_anchors = _get_layout_mode() == LayoutMode::LAYOUT_MODE_ANCHORS;
+ if (!use_anchors && property.name == "anchors_preset") {
+ property.usage ^= PROPERTY_USAGE_EDITOR;
+ }
+ bool use_custom_anchors = use_anchors && _get_anchors_layout_preset() == -1; // Custom "preset".
+ if (!use_custom_anchors && (property.name.begins_with("anchor_") || property.name.begins_with("offset_") || property.name.begins_with("grow_"))) {
+ property.usage ^= PROPERTY_USAGE_EDITOR;
+ }
}
+
// Disable the property if it's managed by the parent container.
+ if (!Object::cast_to<Container>(parent_node)) {
+ return;
+ }
bool property_is_managed_by_container = false;
for (unsigned i = 0; i < properties_managed_by_container_count; i++) {
property_is_managed_by_container = properties_managed_by_container[i] == property.name;
@@ -1390,6 +1495,54 @@ void Control::_size_changed() {
}
}
+void Control::_set_layout_mode(LayoutMode p_mode) {
+ bool list_changed = false;
+
+ if (p_mode == LayoutMode::LAYOUT_MODE_POSITION || p_mode == LayoutMode::LAYOUT_MODE_ANCHORS) {
+ if (has_meta("_edit_layout_mode") && (int)get_meta("_edit_layout_mode") != (int)p_mode) {
+ list_changed = true;
+ }
+
+ set_meta("_edit_layout_mode", (int)p_mode);
+
+ if (p_mode == LayoutMode::LAYOUT_MODE_POSITION) {
+ set_meta("_edit_use_custom_anchors", false);
+ set_anchors_and_offsets_preset(LayoutPreset::PRESET_TOP_LEFT, LayoutPresetMode::PRESET_MODE_KEEP_SIZE);
+ set_grow_direction_preset(LayoutPreset::PRESET_TOP_LEFT);
+ }
+ } else {
+ if (has_meta("_edit_layout_mode")) {
+ remove_meta("_edit_layout_mode");
+ list_changed = true;
+ }
+ }
+
+ if (list_changed) {
+ notify_property_list_changed();
+ }
+}
+
+Control::LayoutMode Control::_get_layout_mode() const {
+ Node *parent_node = get_parent_control();
+ // In these modes the property is read-only.
+ if (!parent_node) {
+ return LayoutMode::LAYOUT_MODE_UNCONTROLLED;
+ } else if (Object::cast_to<Container>(parent_node)) {
+ return LayoutMode::LAYOUT_MODE_CONTAINER;
+ }
+
+ // If anchors are not in the top-left position, this is definitely in anchors mode.
+ if (_get_anchors_layout_preset() != (int)LayoutPreset::PRESET_TOP_LEFT) {
+ return LayoutMode::LAYOUT_MODE_ANCHORS;
+ }
+ // Otherwise check what was saved.
+ if (has_meta("_edit_layout_mode")) {
+ return (LayoutMode)(int)get_meta("_edit_layout_mode");
+ }
+ // Or fallback on default.
+ return LayoutMode::LAYOUT_MODE_POSITION;
+}
+
void Control::set_anchor(Side p_side, real_t p_anchor, bool p_keep_offset, bool p_push_opposite_anchor) {
ERR_FAIL_INDEX((int)p_side, 4);
@@ -1431,6 +1584,120 @@ void Control::set_anchor_and_offset(Side p_side, real_t p_anchor, real_t p_pos,
set_offset(p_side, p_pos);
}
+void Control::_set_anchors_layout_preset(int p_preset) {
+ set_meta("_edit_layout_mode", (int)LayoutMode::LAYOUT_MODE_ANCHORS);
+
+ if (p_preset == -1) {
+ set_meta("_edit_use_custom_anchors", true);
+ notify_property_list_changed();
+ return; // Keep settings as is.
+ }
+ set_meta("_edit_use_custom_anchors", false);
+
+ LayoutPreset preset = (LayoutPreset)p_preset;
+ // Set correct anchors.
+ set_anchors_preset(preset);
+
+ // Select correct preset mode.
+ switch (preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_TOP_RIGHT:
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_LEFT:
+ case PRESET_CENTER_TOP:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_CENTER:
+ set_offsets_preset(preset, LayoutPresetMode::PRESET_MODE_KEEP_SIZE);
+ break;
+ case PRESET_LEFT_WIDE:
+ case PRESET_TOP_WIDE:
+ case PRESET_RIGHT_WIDE:
+ case PRESET_BOTTOM_WIDE:
+ case PRESET_VCENTER_WIDE:
+ case PRESET_HCENTER_WIDE:
+ case PRESET_WIDE:
+ set_offsets_preset(preset, LayoutPresetMode::PRESET_MODE_MINSIZE);
+ break;
+ }
+
+ // Select correct grow directions.
+ set_grow_direction_preset(preset);
+
+ notify_property_list_changed();
+}
+
+int Control::_get_anchors_layout_preset() const {
+ // If the custom preset was selected by user, use it.
+ if (has_meta("_edit_use_custom_anchors") && (bool)get_meta("_edit_use_custom_anchors")) {
+ return -1;
+ }
+
+ // Check anchors to determine if the current state matches a preset, or not.
+
+ float left = get_anchor(SIDE_LEFT);
+ float right = get_anchor(SIDE_RIGHT);
+ float top = get_anchor(SIDE_TOP);
+ float bottom = get_anchor(SIDE_BOTTOM);
+
+ if (left == ANCHOR_BEGIN && right == ANCHOR_BEGIN && top == ANCHOR_BEGIN && bottom == ANCHOR_BEGIN) {
+ return (int)LayoutPreset::PRESET_TOP_LEFT;
+ }
+ if (left == ANCHOR_END && right == ANCHOR_END && top == ANCHOR_BEGIN && bottom == ANCHOR_BEGIN) {
+ return (int)LayoutPreset::PRESET_TOP_RIGHT;
+ }
+ if (left == ANCHOR_BEGIN && right == ANCHOR_BEGIN && top == ANCHOR_END && bottom == ANCHOR_END) {
+ return (int)LayoutPreset::PRESET_BOTTOM_LEFT;
+ }
+ if (left == ANCHOR_END && right == ANCHOR_END && top == ANCHOR_END && bottom == ANCHOR_END) {
+ return (int)LayoutPreset::PRESET_BOTTOM_RIGHT;
+ }
+
+ if (left == ANCHOR_BEGIN && right == ANCHOR_BEGIN && top == 0.5 && bottom == 0.5) {
+ return (int)LayoutPreset::PRESET_CENTER_LEFT;
+ }
+ if (left == ANCHOR_END && right == ANCHOR_END && top == 0.5 && bottom == 0.5) {
+ return (int)LayoutPreset::PRESET_CENTER_RIGHT;
+ }
+ if (left == 0.5 && right == 0.5 && top == ANCHOR_BEGIN && bottom == ANCHOR_BEGIN) {
+ return (int)LayoutPreset::PRESET_CENTER_TOP;
+ }
+ if (left == 0.5 && right == 0.5 && top == ANCHOR_END && bottom == ANCHOR_END) {
+ return (int)LayoutPreset::PRESET_CENTER_BOTTOM;
+ }
+ if (left == 0.5 && right == 0.5 && top == 0.5 && bottom == 0.5) {
+ return (int)LayoutPreset::PRESET_CENTER;
+ }
+
+ if (left == ANCHOR_BEGIN && right == ANCHOR_BEGIN && top == ANCHOR_BEGIN && bottom == ANCHOR_END) {
+ return (int)LayoutPreset::PRESET_LEFT_WIDE;
+ }
+ if (left == ANCHOR_END && right == ANCHOR_END && top == ANCHOR_BEGIN && bottom == ANCHOR_END) {
+ return (int)LayoutPreset::PRESET_RIGHT_WIDE;
+ }
+ if (left == ANCHOR_BEGIN && right == ANCHOR_END && top == ANCHOR_BEGIN && bottom == ANCHOR_BEGIN) {
+ return (int)LayoutPreset::PRESET_TOP_WIDE;
+ }
+ if (left == ANCHOR_BEGIN && right == ANCHOR_END && top == ANCHOR_END && bottom == ANCHOR_END) {
+ return (int)LayoutPreset::PRESET_BOTTOM_WIDE;
+ }
+
+ if (left == 0.5 && right == 0.5 && top == ANCHOR_BEGIN && bottom == ANCHOR_END) {
+ return (int)LayoutPreset::PRESET_VCENTER_WIDE;
+ }
+ if (left == ANCHOR_BEGIN && right == ANCHOR_END && top == 0.5 && bottom == 0.5) {
+ return (int)LayoutPreset::PRESET_HCENTER_WIDE;
+ }
+
+ if (left == ANCHOR_BEGIN && right == ANCHOR_END && top == ANCHOR_BEGIN && bottom == ANCHOR_END) {
+ return (int)LayoutPreset::PRESET_WIDE;
+ }
+
+ // Does not match any preset, return "Custom".
+ return -1;
+}
+
void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_offsets) {
ERR_FAIL_INDEX((int)p_preset, 16);
@@ -1687,6 +1954,62 @@ void Control::set_anchors_and_offsets_preset(LayoutPreset p_preset, LayoutPreset
set_offsets_preset(p_preset, p_resize_mode, p_margin);
}
+void Control::set_grow_direction_preset(LayoutPreset p_preset) {
+ // Select correct horizontal grow direction.
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_CENTER_LEFT:
+ case PRESET_LEFT_WIDE:
+ set_h_grow_direction(GrowDirection::GROW_DIRECTION_END);
+ break;
+ case PRESET_TOP_RIGHT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_RIGHT_WIDE:
+ set_h_grow_direction(GrowDirection::GROW_DIRECTION_BEGIN);
+ break;
+ case PRESET_CENTER_TOP:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_CENTER:
+ case PRESET_TOP_WIDE:
+ case PRESET_BOTTOM_WIDE:
+ case PRESET_VCENTER_WIDE:
+ case PRESET_HCENTER_WIDE:
+ case PRESET_WIDE:
+ set_h_grow_direction(GrowDirection::GROW_DIRECTION_BOTH);
+ break;
+ }
+
+ // Select correct vertical grow direction.
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_TOP_RIGHT:
+ case PRESET_CENTER_TOP:
+ case PRESET_TOP_WIDE:
+ set_v_grow_direction(GrowDirection::GROW_DIRECTION_END);
+ break;
+
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_BOTTOM_WIDE:
+ set_v_grow_direction(GrowDirection::GROW_DIRECTION_BEGIN);
+ break;
+
+ case PRESET_CENTER_LEFT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_CENTER:
+ case PRESET_LEFT_WIDE:
+ case PRESET_RIGHT_WIDE:
+ case PRESET_VCENTER_WIDE:
+ case PRESET_HCENTER_WIDE:
+ case PRESET_WIDE:
+ set_v_grow_direction(GrowDirection::GROW_DIRECTION_BOTH);
+ break;
+ }
+}
+
real_t Control::get_anchor(Side p_side) const {
ERR_FAIL_INDEX_V(int(p_side), 4, 0.0);
@@ -2847,14 +3170,22 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("accept_event"), &Control::accept_event);
ClassDB::bind_method(D_METHOD("get_minimum_size"), &Control::get_minimum_size);
ClassDB::bind_method(D_METHOD("get_combined_minimum_size"), &Control::get_combined_minimum_size);
+
+ ClassDB::bind_method(D_METHOD("_set_layout_mode", "mode"), &Control::_set_layout_mode);
+ ClassDB::bind_method(D_METHOD("_get_layout_mode"), &Control::_get_layout_mode);
+ ClassDB::bind_method(D_METHOD("_set_anchors_layout_preset", "preset"), &Control::_set_anchors_layout_preset);
+ ClassDB::bind_method(D_METHOD("_get_anchors_layout_preset"), &Control::_get_anchors_layout_preset);
ClassDB::bind_method(D_METHOD("set_anchors_preset", "preset", "keep_offsets"), &Control::set_anchors_preset, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_offsets_preset", "preset", "resize_mode", "margin"), &Control::set_offsets_preset, DEFVAL(PRESET_MODE_MINSIZE), DEFVAL(0));
ClassDB::bind_method(D_METHOD("set_anchors_and_offsets_preset", "preset", "resize_mode", "margin"), &Control::set_anchors_and_offsets_preset, DEFVAL(PRESET_MODE_MINSIZE), DEFVAL(0));
+
ClassDB::bind_method(D_METHOD("_set_anchor", "side", "anchor"), &Control::_set_anchor);
ClassDB::bind_method(D_METHOD("set_anchor", "side", "anchor", "keep_offset", "push_opposite_anchor"), &Control::set_anchor, DEFVAL(false), DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_anchor", "side"), &Control::get_anchor);
ClassDB::bind_method(D_METHOD("set_offset", "side", "offset"), &Control::set_offset);
+ ClassDB::bind_method(D_METHOD("get_offset", "offset"), &Control::get_offset);
ClassDB::bind_method(D_METHOD("set_anchor_and_offset", "side", "anchor", "offset", "push_opposite_anchor"), &Control::set_anchor_and_offset, DEFVAL(false));
+
ClassDB::bind_method(D_METHOD("set_begin", "position"), &Control::set_begin);
ClassDB::bind_method(D_METHOD("set_end", "position"), &Control::set_end);
ClassDB::bind_method(D_METHOD("set_position", "position", "keep_offsets"), &Control::set_position, DEFVAL(false));
@@ -2868,7 +3199,6 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Control::set_rotation);
ClassDB::bind_method(D_METHOD("set_scale", "scale"), &Control::set_scale);
ClassDB::bind_method(D_METHOD("set_pivot_offset", "pivot_offset"), &Control::set_pivot_offset);
- ClassDB::bind_method(D_METHOD("get_offset", "offset"), &Control::get_offset);
ClassDB::bind_method(D_METHOD("get_begin"), &Control::get_begin);
ClassDB::bind_method(D_METHOD("get_end"), &Control::get_end);
ClassDB::bind_method(D_METHOD("get_position"), &Control::get_position);
@@ -2996,37 +3326,54 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_auto_translate", "enable"), &Control::set_auto_translate);
ClassDB::bind_method(D_METHOD("is_auto_translating"), &Control::is_auto_translating);
- ADD_GROUP("Anchor", "anchor_");
+ ADD_GROUP("Layout", "");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rect_clip_content"), "set_clip_contents", "is_clipping_contents");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_min_size"), "set_custom_minimum_size", "get_custom_minimum_size");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "layout_direction", PROPERTY_HINT_ENUM, "Inherited,Locale,Left-to-Right,Right-to-Left"), "set_layout_direction", "get_layout_direction");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "layout_mode", PROPERTY_HINT_ENUM, "Position,Anchors,Container,Uncontrolled", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_INTERNAL), "_set_layout_mode", "_get_layout_mode");
+ ADD_PROPERTY_DEFAULT("layout_mode", LayoutMode::LAYOUT_MODE_POSITION);
+
+ const String anchors_presets_options = "Custom:-1,PresetWide:15,"
+ "PresetTopLeft:0,PresetTopRight:1,PresetBottomRight:3,PresetBottomLeft:2,"
+ "PresetCenterLeft:4,PresetCenterTop:5,PresetCenterRight:6,PresetCenterBottom:7,PresetCenter:8,"
+ "PresetLeftWide:9,PresetTopWide:10,PresetRightWide:11,PresetBottomWide:12,PresetVCenterWide:13,PresetHCenterWide:14";
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "anchors_preset", PROPERTY_HINT_ENUM, anchors_presets_options, PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_INTERNAL), "_set_anchors_layout_preset", "_get_anchors_layout_preset");
+ ADD_PROPERTY_DEFAULT("anchors_preset", -1);
+
+ ADD_SUBGROUP_INDENT("Anchor Points", "anchor_", 1);
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "anchor_left", PROPERTY_HINT_RANGE, "0,1,0.001,or_lesser,or_greater"), "_set_anchor", "get_anchor", SIDE_LEFT);
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "anchor_top", PROPERTY_HINT_RANGE, "0,1,0.001,or_lesser,or_greater"), "_set_anchor", "get_anchor", SIDE_TOP);
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "anchor_right", PROPERTY_HINT_RANGE, "0,1,0.001,or_lesser,or_greater"), "_set_anchor", "get_anchor", SIDE_RIGHT);
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "anchor_bottom", PROPERTY_HINT_RANGE, "0,1,0.001,or_lesser,or_greater"), "_set_anchor", "get_anchor", SIDE_BOTTOM);
- ADD_GROUP("Offset", "offset_");
+ ADD_SUBGROUP_INDENT("Anchor Offsets", "offset_", 1);
ADD_PROPERTYI(PropertyInfo(Variant::INT, "offset_left", PROPERTY_HINT_RANGE, "-4096,4096"), "set_offset", "get_offset", SIDE_LEFT);
ADD_PROPERTYI(PropertyInfo(Variant::INT, "offset_top", PROPERTY_HINT_RANGE, "-4096,4096"), "set_offset", "get_offset", SIDE_TOP);
ADD_PROPERTYI(PropertyInfo(Variant::INT, "offset_right", PROPERTY_HINT_RANGE, "-4096,4096"), "set_offset", "get_offset", SIDE_RIGHT);
ADD_PROPERTYI(PropertyInfo(Variant::INT, "offset_bottom", PROPERTY_HINT_RANGE, "-4096,4096"), "set_offset", "get_offset", SIDE_BOTTOM);
- ADD_GROUP("Grow Direction", "grow_");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "grow_horizontal", PROPERTY_HINT_ENUM, "Begin,End,Both"), "set_h_grow_direction", "get_h_grow_direction");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "grow_vertical", PROPERTY_HINT_ENUM, "Begin,End,Both"), "set_v_grow_direction", "get_v_grow_direction");
-
- ADD_GROUP("Layout Direction", "layout_");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "layout_direction", PROPERTY_HINT_ENUM, "Inherited,Locale,Left-to-Right,Right-to-Left"), "set_layout_direction", "get_layout_direction");
+ ADD_SUBGROUP_INDENT("Grow Direction", "grow_", 1);
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "grow_horizontal", PROPERTY_HINT_ENUM, "Left,Right,Both"), "set_h_grow_direction", "get_h_grow_direction");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "grow_vertical", PROPERTY_HINT_ENUM, "Top,Bottom,Both"), "set_v_grow_direction", "get_v_grow_direction");
- ADD_GROUP("Auto Translate", "");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_translate"), "set_auto_translate", "is_auto_translating");
-
- ADD_GROUP("Rect", "rect_");
+ ADD_SUBGROUP("Rectangle", "rect_");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_position", "get_position");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_global_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "_set_global_position", "get_global_position");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_size", "get_size");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_min_size"), "set_custom_minimum_size", "get_custom_minimum_size");
+
+ ADD_SUBGROUP("Transform", "rect_");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rect_rotation", PROPERTY_HINT_RANGE, "-360,360,0.1,or_lesser,or_greater,radians"), "set_rotation", "get_rotation");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_scale"), "set_scale", "get_scale");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "rect_pivot_offset"), "set_pivot_offset", "get_pivot_offset");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rect_clip_content"), "set_clip_contents", "is_clipping_contents");
+
+ ADD_SUBGROUP("Container Sizing", "size_flags_");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "size_flags_horizontal", PROPERTY_HINT_FLAGS, "Fill:1,Expand:2,Shrink Center:4,Shrink End:8"), "set_h_size_flags", "get_h_size_flags");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "size_flags_vertical", PROPERTY_HINT_FLAGS, "Fill:1,Expand:2,Shrink Center:4,Shrink End:8"), "set_v_size_flags", "get_v_size_flags");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "size_flags_stretch_ratio", PROPERTY_HINT_RANGE, "0,20,0.01,or_greater"), "set_stretch_ratio", "get_stretch_ratio");
+
+ ADD_GROUP("Auto Translate", "");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_translate"), "set_auto_translate", "is_auto_translating");
ADD_GROUP("Hint", "hint_");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "hint_tooltip", PROPERTY_HINT_MULTILINE_TEXT), "set_tooltip", "_get_tooltip");
@@ -3044,11 +3391,6 @@ void Control::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_filter", PROPERTY_HINT_ENUM, "Stop,Pass,Ignore"), "set_mouse_filter", "get_mouse_filter");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_default_cursor_shape", PROPERTY_HINT_ENUM, "Arrow,I-Beam,Pointing Hand,Cross,Wait,Busy,Drag,Can Drop,Forbidden,Vertical Resize,Horizontal Resize,Secondary Diagonal Resize,Main Diagonal Resize,Move,Vertical Split,Horizontal Split,Help"), "set_default_cursor_shape", "get_default_cursor_shape");
- ADD_GROUP("Size Flags", "size_flags_");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "size_flags_horizontal", PROPERTY_HINT_FLAGS, "Fill,Expand,Shrink Center,Shrink End"), "set_h_size_flags", "get_h_size_flags");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "size_flags_vertical", PROPERTY_HINT_FLAGS, "Fill,Expand,Shrink Center,Shrink End"), "set_v_size_flags", "get_v_size_flags");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "size_flags_stretch_ratio", PROPERTY_HINT_RANGE, "0,20,0.01,or_greater"), "set_stretch_ratio", "get_stretch_ratio");
-
ADD_GROUP("Theme", "theme_");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "theme_type_variation", PROPERTY_HINT_ENUM_SUGGESTION), "set_theme_type_variation", "get_theme_type_variation");
@@ -3107,6 +3449,7 @@ void Control::_bind_methods() {
BIND_ENUM_CONSTANT(PRESET_MODE_KEEP_HEIGHT);
BIND_ENUM_CONSTANT(PRESET_MODE_KEEP_SIZE);
+ BIND_ENUM_CONSTANT(SIZE_SHRINK_BEGIN);
BIND_ENUM_CONSTANT(SIZE_FILL);
BIND_ENUM_CONSTANT(SIZE_EXPAND);
BIND_ENUM_CONSTANT(SIZE_EXPAND_FILL);
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 962135280f..becb50a118 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -31,12 +31,10 @@
#ifndef CONTROL_H
#define CONTROL_H
-#include "core/input/shortcut.h"
#include "core/math/transform_2d.h"
#include "core/object/gdvirtual.gen.inc"
#include "core/templates/rid.h"
#include "scene/main/canvas_item.h"
-#include "scene/main/node.h"
#include "scene/main/timer.h"
#include "scene/resources/theme.h"
@@ -67,12 +65,13 @@ public:
};
enum SizeFlags {
+ SIZE_SHRINK_BEGIN = 0,
SIZE_FILL = 1,
SIZE_EXPAND = 2,
- SIZE_EXPAND_FILL = SIZE_EXPAND | SIZE_FILL,
- SIZE_SHRINK_CENTER = 4, //ignored by expand or fill
- SIZE_SHRINK_END = 8, //ignored by expand or fill
+ SIZE_SHRINK_CENTER = 4,
+ SIZE_SHRINK_END = 8,
+ SIZE_EXPAND_FILL = SIZE_EXPAND | SIZE_FILL,
};
enum MouseFilter {
@@ -128,6 +127,13 @@ public:
PRESET_MODE_KEEP_SIZE
};
+ enum LayoutMode {
+ LAYOUT_MODE_POSITION,
+ LAYOUT_MODE_ANCHORS,
+ LAYOUT_MODE_CONTAINER,
+ LAYOUT_MODE_UNCONTROLLED,
+ };
+
enum LayoutDirection {
LAYOUT_DIRECTION_INHERITED,
LAYOUT_DIRECTION_LOCALE,
@@ -230,7 +236,7 @@ private:
} data;
- static constexpr unsigned properties_managed_by_container_count = 11;
+ static constexpr unsigned properties_managed_by_container_count = 12;
static String properties_managed_by_container[properties_managed_by_container_count];
void _window_find_focus_neighbor(const Vector2 &p_dir, Node *p_at, const Point2 *p_points, real_t p_min, real_t &r_closest_dist, Control **r_closest);
@@ -241,6 +247,12 @@ private:
void _set_global_position(const Point2 &p_point);
void _set_size(const Size2 &p_size);
+ void _set_layout_mode(LayoutMode p_mode);
+ LayoutMode _get_layout_mode() const;
+
+ void _set_anchors_layout_preset(int p_preset);
+ int _get_anchors_layout_preset() const;
+
void _theme_changed();
void _notify_theme_changed();
@@ -285,9 +297,10 @@ protected:
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
+ virtual void _validate_property(PropertyInfo &property) const override;
+
void _notification(int p_notification);
static void _bind_methods();
- virtual void _validate_property(PropertyInfo &property) const override;
//bind helpers
@@ -378,6 +391,7 @@ public:
void set_anchors_preset(LayoutPreset p_preset, bool p_keep_offsets = true);
void set_offsets_preset(LayoutPreset p_preset, LayoutPresetMode p_resize_mode = PRESET_MODE_MINSIZE, int p_margin = 0);
void set_anchors_and_offsets_preset(LayoutPreset p_preset, LayoutPresetMode p_resize_mode = PRESET_MODE_MINSIZE, int p_margin = 0);
+ void set_grow_direction_preset(LayoutPreset p_preset);
void set_anchor(Side p_side, real_t p_anchor, bool p_keep_offset = true, bool p_push_opposite_anchor = true);
real_t get_anchor(Side p_side) const;
@@ -563,6 +577,7 @@ VARIANT_ENUM_CAST(Control::LayoutPresetMode);
VARIANT_ENUM_CAST(Control::MouseFilter);
VARIANT_ENUM_CAST(Control::GrowDirection);
VARIANT_ENUM_CAST(Control::Anchor);
+VARIANT_ENUM_CAST(Control::LayoutMode);
VARIANT_ENUM_CAST(Control::LayoutDirection);
VARIANT_ENUM_CAST(Control::TextDirection);
VARIANT_ENUM_CAST(Control::StructuredTextParser);
diff --git a/scene/gui/flow_container.cpp b/scene/gui/flow_container.cpp
index d1ac60b325..e806a4a8a6 100644
--- a/scene/gui/flow_container.cpp
+++ b/scene/gui/flow_container.cpp
@@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "scene/gui/container.h"
-
#include "flow_container.h"
struct _LineData {
@@ -223,6 +221,30 @@ Size2 FlowContainer::get_minimum_size() const {
return minimum;
}
+Vector<int> FlowContainer::get_allowed_size_flags_horizontal() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ if (!vertical) {
+ flags.append(SIZE_EXPAND);
+ }
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
+Vector<int> FlowContainer::get_allowed_size_flags_vertical() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ if (vertical) {
+ flags.append(SIZE_EXPAND);
+ }
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
void FlowContainer::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_SORT_CHILDREN: {
diff --git a/scene/gui/flow_container.h b/scene/gui/flow_container.h
index e3ed423ae1..a2da43e071 100644
--- a/scene/gui/flow_container.h
+++ b/scene/gui/flow_container.h
@@ -31,7 +31,7 @@
#ifndef FLOW_CONTAINER_H
#define FLOW_CONTAINER_H
-class Container;
+#include "scene/gui/container.h"
class FlowContainer : public Container {
GDCLASS(FlowContainer, Container);
@@ -54,6 +54,9 @@ public:
virtual Size2 get_minimum_size() const override;
+ virtual Vector<int> get_allowed_size_flags_horizontal() const override;
+ virtual Vector<int> get_allowed_size_flags_vertical() const override;
+
FlowContainer(bool p_vertical = false);
};
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index da973b46f0..b0d1944d6e 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -36,9 +36,7 @@
#include "scene/gui/graph_node.h"
#include "scene/gui/label.h"
#include "scene/gui/scroll_bar.h"
-#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
-#include "scene/gui/texture_rect.h"
class GraphEdit;
class ViewPanner;
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 30f6cf4a14..e0c59dd1bf 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -959,6 +959,25 @@ bool GraphNode::is_resizable() const {
return resizable;
}
+Vector<int> GraphNode::get_allowed_size_flags_horizontal() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
+Vector<int> GraphNode::get_allowed_size_flags_vertical() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ flags.append(SIZE_EXPAND);
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
void GraphNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_title", "title"), &GraphNode::set_title);
ClassDB::bind_method(D_METHOD("get_title"), &GraphNode::get_title);
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index b41fc7f5d4..7eb5f27cff 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -182,6 +182,9 @@ public:
virtual Size2 get_minimum_size() const override;
+ virtual Vector<int> get_allowed_size_flags_horizontal() const override;
+ virtual Vector<int> get_allowed_size_flags_vertical() const override;
+
bool is_resizing() const { return resizing; }
GraphNode();
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 852aaaab24..7a24c76ff8 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -924,20 +924,24 @@ void Label::_bind_methods() {
BIND_ENUM_CONSTANT(VC_GLYPHS_RTL);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT_INTL), "set_text", "get_text");
- ADD_GROUP("Locale", "");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "text_direction", PROPERTY_HINT_ENUM, "Auto,Left-to-Right,Right-to-Left,Inherited"), "set_text_direction", "get_text_direction");
- ADD_PROPERTY(PropertyInfo(Variant::STRING, "language", PROPERTY_HINT_LOCALE_ID, ""), "set_language", "get_language");
ADD_PROPERTY(PropertyInfo(Variant::INT, "horizontal_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_horizontal_alignment", "get_horizontal_alignment");
ADD_PROPERTY(PropertyInfo(Variant::INT, "vertical_alignment", PROPERTY_HINT_ENUM, "Top,Center,Bottom,Fill"), "set_vertical_alignment", "get_vertical_alignment");
ADD_PROPERTY(PropertyInfo(Variant::INT, "autowrap_mode", PROPERTY_HINT_ENUM, "Off,Arbitrary,Word,Word (Smart)"), "set_autowrap_mode", "get_autowrap_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_text"), "set_clip_text", "is_clipping_text");
ADD_PROPERTY(PropertyInfo(Variant::INT, "text_overrun_behavior", PROPERTY_HINT_ENUM, "Trim Nothing,Trim Characters,Trim Words,Ellipsis,Word Ellipsis"), "set_text_overrun_behavior", "get_text_overrun_behavior");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "uppercase"), "set_uppercase", "is_uppercase");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "lines_skipped", PROPERTY_HINT_RANGE, "0,999,1"), "set_lines_skipped", "get_lines_skipped");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "max_lines_visible", PROPERTY_HINT_RANGE, "-1,999,1"), "set_max_lines_visible", "get_max_lines_visible");
+
+ // Note: "visible_characters" and "percent_visible" should be set after "text" to be correctly applied.
ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters", PROPERTY_HINT_RANGE, "-1,128000,1"), "set_visible_characters", "get_visible_characters");
ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters_behavior", PROPERTY_HINT_ENUM, "Characters Before Shaping,Characters After Shaping,Glyphs (Layout Direction),Glyphs (Left-to-Right),Glyphs (Right-to-Left)"), "set_visible_characters_behavior", "get_visible_characters_behavior");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "percent_visible", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_percent_visible", "get_percent_visible");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "lines_skipped", PROPERTY_HINT_RANGE, "0,999,1"), "set_lines_skipped", "get_lines_skipped");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "max_lines_visible", PROPERTY_HINT_RANGE, "-1,999,1"), "set_max_lines_visible", "get_max_lines_visible");
+
+ ADD_GROUP("Locale", "");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "text_direction", PROPERTY_HINT_ENUM, "Auto,Left-to-Right,Right-to-Left,Inherited"), "set_text_direction", "get_text_direction");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "language", PROPERTY_HINT_LOCALE_ID, ""), "set_language", "get_language");
+
ADD_GROUP("Structured Text", "structured_text_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "structured_text_bidi_override", PROPERTY_HINT_ENUM, "Default,URI,File,Email,List,None,Custom"), "set_structured_text_bidi_override", "get_structured_text_bidi_override");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "structured_text_bidi_override_options"), "set_structured_text_bidi_override_options", "get_structured_text_bidi_override_options");
diff --git a/scene/gui/link_button.h b/scene/gui/link_button.h
index 7d302e967d..a455e866b1 100644
--- a/scene/gui/link_button.h
+++ b/scene/gui/link_button.h
@@ -32,7 +32,6 @@
#define LINKBUTTON_H
#include "scene/gui/base_button.h"
-#include "scene/resources/bit_map.h"
#include "scene/resources/text_line.h"
class LinkButton : public BaseButton {
diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp
index 7b696ddb84..89008a19c5 100644
--- a/scene/gui/margin_container.cpp
+++ b/scene/gui/margin_container.cpp
@@ -65,6 +65,24 @@ Size2 MarginContainer::get_minimum_size() const {
return max;
}
+Vector<int> MarginContainer::get_allowed_size_flags_horizontal() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
+Vector<int> MarginContainer::get_allowed_size_flags_vertical() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
void MarginContainer::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_SORT_CHILDREN: {
diff --git a/scene/gui/margin_container.h b/scene/gui/margin_container.h
index 3a2f0fa8b3..f8a3c5bb11 100644
--- a/scene/gui/margin_container.h
+++ b/scene/gui/margin_container.h
@@ -42,6 +42,9 @@ protected:
public:
virtual Size2 get_minimum_size() const override;
+ virtual Vector<int> get_allowed_size_flags_horizontal() const override;
+ virtual Vector<int> get_allowed_size_flags_vertical() const override;
+
MarginContainer();
};
diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp
index 463ad3c513..91a343084b 100644
--- a/scene/gui/panel_container.cpp
+++ b/scene/gui/panel_container.cpp
@@ -60,6 +60,24 @@ Size2 PanelContainer::get_minimum_size() const {
return ms;
}
+Vector<int> PanelContainer::get_allowed_size_flags_horizontal() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
+Vector<int> PanelContainer::get_allowed_size_flags_vertical() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
void PanelContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
RID ci = get_canvas_item();
diff --git a/scene/gui/panel_container.h b/scene/gui/panel_container.h
index a5ff74cebb..8f07ce38eb 100644
--- a/scene/gui/panel_container.h
+++ b/scene/gui/panel_container.h
@@ -42,6 +42,9 @@ protected:
public:
virtual Size2 get_minimum_size() const override;
+ virtual Vector<int> get_allowed_size_flags_horizontal() const override;
+ virtual Vector<int> get_allowed_size_flags_vertical() const override;
+
PanelContainer();
};
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 61a5fb999c..5c86e1850e 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -30,6 +30,7 @@
#include "popup_menu.h"
+#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 86e5afcb7c..4d779f51e2 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -33,6 +33,7 @@
#include "core/math/math_defs.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
+#include "label.h"
#include "scene/scene_string_names.h"
#include "servers/display_server.h"
@@ -1590,6 +1591,9 @@ void RichTextLabel::_notification(int p_what) {
update();
}
} break;
+ case NOTIFICATION_DRAG_END: {
+ selection.drag_attempt = false;
+ } break;
}
}
@@ -1650,6 +1654,8 @@ void RichTextLabel::gui_input(const Ref<InputEvent> &p_event) {
int c_index = 0;
bool outside;
+ selection.drag_attempt = false;
+
_find_click(main, b->get_position(), &c_frame, &c_line, &c_item, &c_index, &outside);
if (c_item != nullptr) {
if (selection.enabled) {
@@ -1660,17 +1666,22 @@ void RichTextLabel::gui_input(const Ref<InputEvent> &p_event) {
// Erase previous selection.
if (selection.active) {
- selection.from_frame = nullptr;
- selection.from_line = 0;
- selection.from_item = nullptr;
- selection.from_char = 0;
- selection.to_frame = nullptr;
- selection.to_line = 0;
- selection.to_item = nullptr;
- selection.to_char = 0;
- selection.active = false;
-
- update();
+ if (_is_click_inside_selection()) {
+ selection.drag_attempt = true;
+ selection.click_item = nullptr;
+ } else {
+ selection.from_frame = nullptr;
+ selection.from_line = 0;
+ selection.from_item = nullptr;
+ selection.from_char = 0;
+ selection.to_frame = nullptr;
+ selection.to_line = 0;
+ selection.to_item = nullptr;
+ selection.to_char = 0;
+ selection.active = false;
+
+ update();
+ }
}
}
}
@@ -1683,6 +1694,8 @@ void RichTextLabel::gui_input(const Ref<InputEvent> &p_event) {
int c_index = 0;
bool outside;
+ selection.drag_attempt = false;
+
_find_click(main, b->get_position(), &c_frame, &c_line, &c_item, &c_index, &outside);
if (c_frame) {
@@ -1714,6 +1727,22 @@ void RichTextLabel::gui_input(const Ref<InputEvent> &p_event) {
DisplayServer::get_singleton()->clipboard_set_primary(get_selected_text());
}
selection.click_item = nullptr;
+ if (selection.drag_attempt) {
+ selection.drag_attempt = false;
+ if (_is_click_inside_selection()) {
+ selection.from_frame = nullptr;
+ selection.from_line = 0;
+ selection.from_item = nullptr;
+ selection.from_char = 0;
+ selection.to_frame = nullptr;
+ selection.to_line = 0;
+ selection.to_item = nullptr;
+ selection.to_char = 0;
+ selection.active = false;
+
+ update();
+ }
+ }
if (!b->is_double_click() && !scroll_updated) {
Item *c_item = nullptr;
@@ -3734,6 +3763,29 @@ void RichTextLabel::set_deselect_on_focus_loss_enabled(const bool p_enabled) {
}
}
+Variant RichTextLabel::get_drag_data(const Point2 &p_point) {
+ if (selection.drag_attempt && selection.enabled) {
+ String t = get_selected_text();
+ Label *l = memnew(Label);
+ l->set_text(t);
+ set_drag_preview(l);
+ return t;
+ }
+
+ return Variant();
+}
+
+bool RichTextLabel::_is_click_inside_selection() const {
+ if (selection.active && selection.enabled && selection.click_frame && selection.from_frame && selection.to_frame) {
+ const Line &l_click = selection.click_frame->lines[selection.click_line];
+ const Line &l_from = selection.from_frame->lines[selection.from_line];
+ const Line &l_to = selection.to_frame->lines[selection.to_line];
+ return (l_click.char_offset + selection.click_char >= l_from.char_offset + selection.from_char) && (l_click.char_offset + selection.click_char <= l_to.char_offset + selection.to_char);
+ } else {
+ return false;
+ }
+}
+
bool RichTextLabel::_search_table(ItemTable *p_table, List<Item *>::Element *p_from, const String &p_string, bool p_reverse_search) {
List<Item *>::Element *E = p_from;
while (E != nullptr) {
@@ -3992,7 +4044,7 @@ int RichTextLabel::get_selection_to() const {
void RichTextLabel::set_text(const String &p_bbcode) {
text = p_bbcode;
- if (is_inside_tree() && use_bbcode) {
+ if (use_bbcode) {
parse_bbcode(p_bbcode);
} else { // raw text
clear();
@@ -4295,33 +4347,30 @@ void RichTextLabel::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_effects"), &RichTextLabel::get_effects);
ClassDB::bind_method(D_METHOD("install_effect", "effect"), &RichTextLabel::install_effect);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters", PROPERTY_HINT_RANGE, "-1,128000,1"), "set_visible_characters", "get_visible_characters");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "percent_visible", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_percent_visible", "get_percent_visible");
-
- ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters_behavior", PROPERTY_HINT_ENUM, "Characters Before Shaping,Characters After Shaping,Glyphs (Layout Direction),Glyphs (Left-to-Right),Glyphs (Right-to-Left)"), "set_visible_characters_behavior", "get_visible_characters_behavior");
+ // Note: set "bbcode_enabled" first, to avoid unnecessery "text" resets.
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bbcode_enabled"), "set_use_bbcode", "is_using_bbcode");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "meta_underlined"), "set_meta_underline", "is_meta_underlined");
ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_size", PROPERTY_HINT_RANGE, "0,24,1"), "set_tab_size", "get_tab_size");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT), "set_text", "get_text");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bbcode_enabled"), "set_use_bbcode", "is_using_bbcode");
-
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fit_content_height"), "set_fit_content_height", "is_fit_content_height_enabled");
-
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_active"), "set_scroll_active", "is_scroll_active");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_following"), "set_scroll_follow", "is_scroll_following");
-
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "selection_enabled"), "set_selection_enabled", "is_selection_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "override_selected_font_color"), "set_override_selected_font_color", "is_overriding_selected_font_color");
-
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "deselect_on_focus_loss_enabled"), "set_deselect_on_focus_loss_enabled", "is_deselect_on_focus_loss_enabled");
-
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "custom_effects", PROPERTY_HINT_ARRAY_TYPE, vformat("%s/%s:%s", Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, "RichTextEffect"), (PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE)), "set_effects", "get_effects");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "meta_underlined"), "set_meta_underline", "is_meta_underlined");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "autowrap_mode", PROPERTY_HINT_ENUM, "Off,Arbitrary,Word,Word (Smart)"), "set_autowrap_mode", "get_autowrap_mode");
+ // Note: "visible_characters" and "percent_visible" should be set after "text" to be correctly applied.
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters", PROPERTY_HINT_RANGE, "-1,128000,1"), "set_visible_characters", "get_visible_characters");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters_behavior", PROPERTY_HINT_ENUM, "Characters Before Shaping,Characters After Shaping,Glyphs (Layout Direction),Glyphs (Left-to-Right),Glyphs (Right-to-Left)"), "set_visible_characters_behavior", "get_visible_characters_behavior");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "percent_visible", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_percent_visible", "get_percent_visible");
+
+ ADD_GROUP("Locale", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "text_direction", PROPERTY_HINT_ENUM, "Auto,Left-to-Right,Right-to-Left,Inherited"), "set_text_direction", "get_text_direction");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "language", PROPERTY_HINT_LOCALE_ID, ""), "set_language", "get_language");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "autowrap_mode", PROPERTY_HINT_ENUM, "Off,Arbitrary,Word,Word (Smart)"), "set_autowrap_mode", "get_autowrap_mode");
-
ADD_GROUP("Structured Text", "structured_text_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "structured_text_bidi_override", PROPERTY_HINT_ENUM, "Default,URI,File,Email,List,None,Custom"), "set_structured_text_bidi_override", "get_structured_text_bidi_override");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "structured_text_bidi_override_options"), "set_structured_text_bidi_override_options", "get_structured_text_bidi_override_options");
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index ea3a08d7bd..5ed1031798 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -407,6 +407,7 @@ private:
bool active = false; // anything selected? i.e. from, to, etc. valid?
bool enabled = false; // allow selections?
+ bool drag_attempt = false;
};
Selection selection;
@@ -416,6 +417,7 @@ private:
float percent_visible = 1.0;
VisibleCharactersBehavior visible_chars_behavior = VC_CHARS_BEFORE_SHAPING;
+ bool _is_click_inside_selection() const;
void _find_click(ItemFrame *p_frame, const Point2i &p_click, ItemFrame **r_click_frame = nullptr, int *r_click_line = nullptr, Item **r_click_item = nullptr, int *r_click_char = nullptr, bool *r_outside = nullptr);
String _get_line_text(ItemFrame *p_frame, int p_line, Selection p_sel) const;
@@ -559,6 +561,7 @@ public:
VScrollBar *get_v_scroll_bar() { return vscroll; }
virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override;
+ virtual Variant get_drag_data(const Point2 &p_point) override;
void set_selection_enabled(bool p_enabled);
bool is_selection_enabled() const;
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 5e128d594c..7e69fa09e7 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "scroll_container.h"
+
+#include "core/config/project_settings.h"
#include "core/os/os.h"
#include "scene/main/window.h"
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index 874e5868b6..b56326088d 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -336,6 +336,30 @@ bool SplitContainer::is_collapsed() const {
return collapsed;
}
+Vector<int> SplitContainer::get_allowed_size_flags_horizontal() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ if (!vertical) {
+ flags.append(SIZE_EXPAND);
+ }
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
+Vector<int> SplitContainer::get_allowed_size_flags_vertical() const {
+ Vector<int> flags;
+ flags.append(SIZE_FILL);
+ if (vertical) {
+ flags.append(SIZE_EXPAND);
+ }
+ flags.append(SIZE_SHRINK_BEGIN);
+ flags.append(SIZE_SHRINK_CENTER);
+ flags.append(SIZE_SHRINK_END);
+ return flags;
+}
+
void SplitContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_split_offset", "offset"), &SplitContainer::set_split_offset);
ClassDB::bind_method(D_METHOD("get_split_offset"), &SplitContainer::get_split_offset);
diff --git a/scene/gui/split_container.h b/scene/gui/split_container.h
index ba6fff6f55..a69ffe4de9 100644
--- a/scene/gui/split_container.h
+++ b/scene/gui/split_container.h
@@ -79,6 +79,9 @@ public:
virtual Size2 get_minimum_size() const override;
+ virtual Vector<int> get_allowed_size_flags_horizontal() const override;
+ virtual Vector<int> get_allowed_size_flags_vertical() const override;
+
SplitContainer(bool p_vertical = false);
};
diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp
index 760144591e..b8baefc307 100644
--- a/scene/gui/subviewport_container.cpp
+++ b/scene/gui/subviewport_container.cpp
@@ -91,6 +91,14 @@ int SubViewportContainer::get_stretch_shrink() const {
return shrink;
}
+Vector<int> SubViewportContainer::get_allowed_size_flags_horizontal() const {
+ return Vector<int>();
+}
+
+Vector<int> SubViewportContainer::get_allowed_size_flags_vertical() const {
+ return Vector<int>();
+}
+
void SubViewportContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_RESIZED) {
if (!stretch) {
diff --git a/scene/gui/subviewport_container.h b/scene/gui/subviewport_container.h
index e7520763fb..3138a6144c 100644
--- a/scene/gui/subviewport_container.h
+++ b/scene/gui/subviewport_container.h
@@ -54,6 +54,9 @@ public:
virtual Size2 get_minimum_size() const override;
+ virtual Vector<int> get_allowed_size_flags_horizontal() const override;
+ virtual Vector<int> get_allowed_size_flags_vertical() const override;
+
SubViewportContainer();
};
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 818431a6a0..4bd3686e7c 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -1177,6 +1177,14 @@ bool TabContainer::get_use_hidden_tabs_for_min_size() const {
return use_hidden_tabs_for_min_size;
}
+Vector<int> TabContainer::get_allowed_size_flags_horizontal() const {
+ return Vector<int>();
+}
+
+Vector<int> TabContainer::get_allowed_size_flags_vertical() const {
+ return Vector<int>();
+}
+
void TabContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_tab_count"), &TabContainer::get_tab_count);
ClassDB::bind_method(D_METHOD("set_current_tab", "tab_idx"), &TabContainer::set_current_tab);
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 01e71e9fa8..ee1b3fea51 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -133,6 +133,9 @@ public:
void set_use_hidden_tabs_for_min_size(bool p_use_hidden_tabs);
bool get_use_hidden_tabs_for_min_size() const;
+ virtual Vector<int> get_allowed_size_flags_horizontal() const override;
+ virtual Vector<int> get_allowed_size_flags_vertical() const override;
+
TabContainer();
};
diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h
index a368a10ad0..2a9e7bac3d 100644
--- a/scene/main/canvas_item.h
+++ b/scene/main/canvas_item.h
@@ -32,10 +32,8 @@
#define CANVAS_ITEM_H
#include "scene/main/node.h"
-#include "scene/main/scene_tree.h"
#include "scene/resources/canvas_item_material.h"
#include "scene/resources/font.h"
-#include "servers/text_server.h"
class CanvasLayer;
class MultiMesh;
diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp
index 3f3e72357b..d4418a3cde 100644
--- a/scene/main/canvas_layer.cpp
+++ b/scene/main/canvas_layer.cpp
@@ -29,8 +29,10 @@
/*************************************************************************/
#include "canvas_layer.h"
-#include "canvas_item.h"
-#include "viewport.h"
+
+#include "scene/main/canvas_item.h"
+#include "scene/main/viewport.h"
+#include "scene/resources/world_2d.h"
void CanvasLayer::set_layer(int p_xform) {
layer = p_xform;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index d5bc7d111a..05086541a5 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -30,6 +30,7 @@
#include "node.h"
+#include "core/config/project_settings.h"
#include "core/core_string_names.h"
#include "core/io/resource_loader.h"
#include "core/multiplayer/multiplayer_api.h"
diff --git a/scene/main/node.h b/scene/main/node.h
index 0ac10f4381..f2dcdf4b43 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -31,9 +31,6 @@
#ifndef NODE_H
#define NODE_H
-#include "core/config/project_settings.h"
-#include "core/object/class_db.h"
-#include "core/object/script_language.h"
#include "core/string/node_path.h"
#include "core/templates/map.h"
#include "core/variant/typed_array.h"
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 69d781cbfc..f02032a6c9 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -44,10 +44,13 @@
#include "node.h"
#include "scene/animation/tween.h"
#include "scene/debugger/scene_debugger.h"
+#include "scene/main/viewport.h"
#include "scene/resources/font.h"
#include "scene/resources/material.h"
#include "scene/resources/mesh.h"
#include "scene/resources/packed_scene.h"
+#include "scene/resources/world_2d.h"
+#include "scene/resources/world_3d.h"
#include "scene/scene_string_names.h"
#include "servers/display_server.h"
#include "servers/navigation_server_3d.h"
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index a5cd52b4ca..5f7c1729e8 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -35,8 +35,6 @@
#include "core/os/thread_safe.h"
#include "core/templates/self_list.h"
#include "scene/resources/mesh.h"
-#include "scene/resources/world_2d.h"
-#include "scene/resources/world_3d.h"
#undef Window
@@ -48,6 +46,7 @@ class Mesh;
class MultiplayerAPI;
class SceneDebugger;
class Tween;
+class Viewport;
class SceneTreeTimer : public RefCounted {
GDCLASS(SceneTreeTimer, RefCounted);
diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp
index 240e662efb..09dfc50066 100644
--- a/scene/main/shader_globals_override.cpp
+++ b/scene/main/shader_globals_override.cpp
@@ -221,6 +221,7 @@ void ShaderGlobalsOverride::_get_property_list(List<PropertyInfo> *p_list) const
}
void ShaderGlobalsOverride::_activate() {
+ ERR_FAIL_NULL(get_tree());
List<Node *> nodes;
get_tree()->get_nodes_in_group(SceneStringNames::get_singleton()->shader_overrides_group_active, &nodes);
if (nodes.size() == 0) {
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 522997cdf5..a1ff95ea9a 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -30,6 +30,7 @@
#include "viewport.h"
+#include "core/config/project_settings.h"
#include "core/core_string_names.h"
#include "core/debugger/engine_debugger.h"
#include "core/object/message_queue.h"
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index f2ebe50fa3..b5e0e7b110 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -30,6 +30,7 @@
#include "window.h"
+#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
#include "core/string/translation.h"
#include "scene/gui/control.h"
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index dd1e664ca6..b71fe8904a 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -34,7 +34,6 @@
#include "core/io/resource.h"
#include "scene/resources/sky.h"
#include "scene/resources/texture.h"
-#include "servers/rendering_server.h"
class Environment : public Resource {
GDCLASS(Environment, Resource);
diff --git a/scene/resources/skeleton_modification_2d_jiggle.cpp b/scene/resources/skeleton_modification_2d_jiggle.cpp
index eee6067dae..0921417656 100644
--- a/scene/resources/skeleton_modification_2d_jiggle.cpp
+++ b/scene/resources/skeleton_modification_2d_jiggle.cpp
@@ -29,7 +29,9 @@
/*************************************************************************/
#include "skeleton_modification_2d_jiggle.h"
+
#include "scene/2d/skeleton_2d.h"
+#include "scene/resources/world_2d.h"
bool SkeletonModification2DJiggle::_set(const StringName &p_path, const Variant &p_value) {
String path = p_path;
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index f962e55666..373fbb94ea 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "theme.h"
+
#include "core/string/print_string.h"
// Universal Theme resources used when no other theme has the item.
@@ -401,6 +402,26 @@ void Theme::add_icon_type(const StringName &p_theme_type) {
icon_map[p_theme_type] = HashMap<StringName, Ref<Texture2D>>();
}
+void Theme::remove_icon_type(const StringName &p_theme_type) {
+ if (!icon_map.has(p_theme_type)) {
+ return;
+ }
+
+ _freeze_change_propagation();
+
+ const StringName *L = nullptr;
+ while ((L = icon_map[p_theme_type].next(L))) {
+ Ref<Texture2D> icon = icon_map[p_theme_type][*L];
+ if (icon.is_valid()) {
+ icon->disconnect("changed", callable_mp(this, &Theme::_emit_theme_changed));
+ }
+ }
+
+ icon_map.erase(p_theme_type);
+
+ _unfreeze_and_propagate_changes();
+}
+
void Theme::get_icon_type_list(List<StringName> *p_list) const {
ERR_FAIL_NULL(p_list);
@@ -488,6 +509,26 @@ void Theme::add_stylebox_type(const StringName &p_theme_type) {
style_map[p_theme_type] = HashMap<StringName, Ref<StyleBox>>();
}
+void Theme::remove_stylebox_type(const StringName &p_theme_type) {
+ if (!style_map.has(p_theme_type)) {
+ return;
+ }
+
+ _freeze_change_propagation();
+
+ const StringName *L = nullptr;
+ while ((L = style_map[p_theme_type].next(L))) {
+ Ref<StyleBox> style = style_map[p_theme_type][*L];
+ if (style.is_valid()) {
+ style->disconnect("changed", callable_mp(this, &Theme::_emit_theme_changed));
+ }
+ }
+
+ style_map.erase(p_theme_type);
+
+ _unfreeze_and_propagate_changes();
+}
+
void Theme::get_stylebox_type_list(List<StringName> *p_list) const {
ERR_FAIL_NULL(p_list);
@@ -577,6 +618,26 @@ void Theme::add_font_type(const StringName &p_theme_type) {
font_map[p_theme_type] = HashMap<StringName, Ref<Font>>();
}
+void Theme::remove_font_type(const StringName &p_theme_type) {
+ if (!font_map.has(p_theme_type)) {
+ return;
+ }
+
+ _freeze_change_propagation();
+
+ const StringName *L = nullptr;
+ while ((L = font_map[p_theme_type].next(L))) {
+ Ref<Font> font = font_map[p_theme_type][*L];
+ if (font.is_valid()) {
+ font->disconnect("changed", callable_mp(this, &Theme::_emit_theme_changed));
+ }
+ }
+
+ font_map.erase(p_theme_type);
+
+ _unfreeze_and_propagate_changes();
+}
+
void Theme::get_font_type_list(List<StringName> *p_list) const {
ERR_FAIL_NULL(p_list);
@@ -653,6 +714,14 @@ void Theme::add_font_size_type(const StringName &p_theme_type) {
font_size_map[p_theme_type] = HashMap<StringName, int>();
}
+void Theme::remove_font_size_type(const StringName &p_theme_type) {
+ if (!font_size_map.has(p_theme_type)) {
+ return;
+ }
+
+ font_size_map.erase(p_theme_type);
+}
+
void Theme::get_font_size_type_list(List<StringName> *p_list) const {
ERR_FAIL_NULL(p_list);
@@ -727,6 +796,14 @@ void Theme::add_color_type(const StringName &p_theme_type) {
color_map[p_theme_type] = HashMap<StringName, Color>();
}
+void Theme::remove_color_type(const StringName &p_theme_type) {
+ if (!color_map.has(p_theme_type)) {
+ return;
+ }
+
+ color_map.erase(p_theme_type);
+}
+
void Theme::get_color_type_list(List<StringName> *p_list) const {
ERR_FAIL_NULL(p_list);
@@ -801,6 +878,14 @@ void Theme::add_constant_type(const StringName &p_theme_type) {
constant_map[p_theme_type] = HashMap<StringName, int>();
}
+void Theme::remove_constant_type(const StringName &p_theme_type) {
+ if (!constant_map.has(p_theme_type)) {
+ return;
+ }
+
+ constant_map.erase(p_theme_type);
+}
+
void Theme::get_constant_type_list(List<StringName> *p_list) const {
ERR_FAIL_NULL(p_list);
@@ -1017,6 +1102,31 @@ void Theme::add_theme_item_type(DataType p_data_type, const StringName &p_theme_
}
}
+void Theme::remove_theme_item_type(DataType p_data_type, const StringName &p_theme_type) {
+ switch (p_data_type) {
+ case DATA_TYPE_COLOR:
+ remove_color_type(p_theme_type);
+ break;
+ case DATA_TYPE_CONSTANT:
+ remove_constant_type(p_theme_type);
+ break;
+ case DATA_TYPE_FONT:
+ remove_font_type(p_theme_type);
+ break;
+ case DATA_TYPE_FONT_SIZE:
+ remove_font_size_type(p_theme_type);
+ break;
+ case DATA_TYPE_ICON:
+ remove_icon_type(p_theme_type);
+ break;
+ case DATA_TYPE_STYLEBOX:
+ remove_stylebox_type(p_theme_type);
+ break;
+ case DATA_TYPE_MAX:
+ break; // Can't happen, but silences warning.
+ }
+}
+
void Theme::get_theme_item_type_list(DataType p_data_type, List<StringName> *p_list) const {
switch (p_data_type) {
case DATA_TYPE_COLOR:
@@ -1101,6 +1211,38 @@ void Theme::get_type_variation_list(const StringName &p_base_type, List<StringNa
}
// Theme types.
+void Theme::add_type(const StringName &p_theme_type) {
+ // Add a record to every data type map.
+ for (int i = 0; i < Theme::DATA_TYPE_MAX; i++) {
+ Theme::DataType dt = (Theme::DataType)i;
+ add_theme_item_type(dt, p_theme_type);
+ }
+
+ _emit_theme_changed(true);
+}
+
+void Theme::remove_type(const StringName &p_theme_type) {
+ // Gracefully remove the record from every data type map.
+ for (int i = 0; i < Theme::DATA_TYPE_MAX; i++) {
+ Theme::DataType dt = (Theme::DataType)i;
+ remove_theme_item_type(dt, p_theme_type);
+ }
+
+ // If type is a variation, remove that connection.
+ if (get_type_variation_base(p_theme_type) != StringName()) {
+ clear_type_variation(p_theme_type);
+ }
+
+ // If type is a variation base, remove all those connections.
+ List<StringName> names;
+ get_type_variation_list(p_theme_type, &names);
+ for (const StringName &E : names) {
+ clear_type_variation(E);
+ }
+
+ _emit_theme_changed(true);
+}
+
void Theme::get_type_list(List<StringName> *p_list) const {
ERR_FAIL_NULL(p_list);
@@ -1668,6 +1810,8 @@ void Theme::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_type_variation_base", "theme_type"), &Theme::get_type_variation_base);
ClassDB::bind_method(D_METHOD("get_type_variation_list", "base_type"), &Theme::_get_type_variation_list);
+ ClassDB::bind_method(D_METHOD("add_type", "theme_type"), &Theme::add_type);
+ ClassDB::bind_method(D_METHOD("remove_type", "theme_type"), &Theme::remove_type);
ClassDB::bind_method(D_METHOD("get_type_list"), &Theme::_get_type_list);
ClassDB::bind_method(D_METHOD("merge_with", "other"), &Theme::merge_with);
diff --git a/scene/resources/theme.h b/scene/resources/theme.h
index 822743a1fe..9afe05007d 100644
--- a/scene/resources/theme.h
+++ b/scene/resources/theme.h
@@ -32,7 +32,6 @@
#define THEME_H
#include "core/io/resource.h"
-#include "core/io/resource_loader.h"
#include "scene/resources/font.h"
#include "scene/resources/style_box.h"
#include "scene/resources/texture.h"
@@ -158,6 +157,7 @@ public:
void clear_icon(const StringName &p_name, const StringName &p_theme_type);
void get_icon_list(StringName p_theme_type, List<StringName> *p_list) const;
void add_icon_type(const StringName &p_theme_type);
+ void remove_icon_type(const StringName &p_theme_type);
void get_icon_type_list(List<StringName> *p_list) const;
void set_stylebox(const StringName &p_name, const StringName &p_theme_type, const Ref<StyleBox> &p_style);
@@ -168,6 +168,7 @@ public:
void clear_stylebox(const StringName &p_name, const StringName &p_theme_type);
void get_stylebox_list(StringName p_theme_type, List<StringName> *p_list) const;
void add_stylebox_type(const StringName &p_theme_type);
+ void remove_stylebox_type(const StringName &p_theme_type);
void get_stylebox_type_list(List<StringName> *p_list) const;
void set_font(const StringName &p_name, const StringName &p_theme_type, const Ref<Font> &p_font);
@@ -178,6 +179,7 @@ public:
void clear_font(const StringName &p_name, const StringName &p_theme_type);
void get_font_list(StringName p_theme_type, List<StringName> *p_list) const;
void add_font_type(const StringName &p_theme_type);
+ void remove_font_type(const StringName &p_theme_type);
void get_font_type_list(List<StringName> *p_list) const;
void set_font_size(const StringName &p_name, const StringName &p_theme_type, int p_font_size);
@@ -188,6 +190,7 @@ public:
void clear_font_size(const StringName &p_name, const StringName &p_theme_type);
void get_font_size_list(StringName p_theme_type, List<StringName> *p_list) const;
void add_font_size_type(const StringName &p_theme_type);
+ void remove_font_size_type(const StringName &p_theme_type);
void get_font_size_type_list(List<StringName> *p_list) const;
void set_color(const StringName &p_name, const StringName &p_theme_type, const Color &p_color);
@@ -198,6 +201,7 @@ public:
void clear_color(const StringName &p_name, const StringName &p_theme_type);
void get_color_list(StringName p_theme_type, List<StringName> *p_list) const;
void add_color_type(const StringName &p_theme_type);
+ void remove_color_type(const StringName &p_theme_type);
void get_color_type_list(List<StringName> *p_list) const;
void set_constant(const StringName &p_name, const StringName &p_theme_type, int p_constant);
@@ -208,6 +212,7 @@ public:
void clear_constant(const StringName &p_name, const StringName &p_theme_type);
void get_constant_list(StringName p_theme_type, List<StringName> *p_list) const;
void add_constant_type(const StringName &p_theme_type);
+ void remove_constant_type(const StringName &p_theme_type);
void get_constant_type_list(List<StringName> *p_list) const;
void set_theme_item(DataType p_data_type, const StringName &p_name, const StringName &p_theme_type, const Variant &p_value);
@@ -218,6 +223,7 @@ public:
void clear_theme_item(DataType p_data_type, const StringName &p_name, const StringName &p_theme_type);
void get_theme_item_list(DataType p_data_type, StringName p_theme_type, List<StringName> *p_list) const;
void add_theme_item_type(DataType p_data_type, const StringName &p_theme_type);
+ void remove_theme_item_type(DataType p_data_type, const StringName &p_theme_type);
void get_theme_item_type_list(DataType p_data_type, List<StringName> *p_list) const;
void set_type_variation(const StringName &p_theme_type, const StringName &p_base_type);
@@ -226,6 +232,8 @@ public:
StringName get_type_variation_base(const StringName &p_theme_type) const;
void get_type_variation_list(const StringName &p_base_type, List<StringName> *p_list) const;
+ void add_type(const StringName &p_theme_type);
+ void remove_type(const StringName &p_theme_type);
void get_type_list(List<StringName> *p_list) const;
void get_type_dependencies(const StringName &p_base_type, const StringName &p_type_variant, List<StringName> *p_list);
diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h
index 91f9a026d3..4a277c3d84 100644
--- a/scene/resources/world_2d.h
+++ b/scene/resources/world_2d.h
@@ -31,8 +31,8 @@
#ifndef WORLD_2D_H
#define WORLD_2D_H
-#include "core/config/project_settings.h"
#include "core/io/resource.h"
+#include "scene/resources/world_2d.h"
#include "servers/physics_server_2d.h"
class VisibleOnScreenNotifier2D;
diff --git a/scene/resources/world_3d.cpp b/scene/resources/world_3d.cpp
index c012ab6177..0088236112 100644
--- a/scene/resources/world_3d.cpp
+++ b/scene/resources/world_3d.cpp
@@ -30,7 +30,7 @@
#include "world_3d.h"
-#include "core/math/camera_matrix.h"
+#include "core/config/project_settings.h"
#include "core/math/octree.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/visible_on_screen_notifier_3d.h"
diff --git a/servers/display_server.h b/servers/display_server.h
index 19bb111094..bd38f28f17 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -175,7 +175,7 @@ public:
SCREEN_OF_MAIN_WINDOW = -1
};
- const float SCREEN_REFRESH_RATE_FALLBACK = 60.0; // Returned by screen_get_refresh_rate if the method fails. Most screens are 60hz as of 2022.
+ const float SCREEN_REFRESH_RATE_FALLBACK = -1.0; // Returned by screen_get_refresh_rate if the method fails.
virtual int get_screen_count() const = 0;
virtual Point2i screen_get_position(int p_screen = SCREEN_OF_MAIN_WINDOW) const = 0;
diff --git a/servers/rendering/rasterizer_dummy.h b/servers/rendering/rasterizer_dummy.h
index 7d5a596c50..be374f1a21 100644
--- a/servers/rendering/rasterizer_dummy.h
+++ b/servers/rendering/rasterizer_dummy.h
@@ -31,7 +31,6 @@
#ifndef RASTERIZER_DUMMY_H
#define RASTERIZER_DUMMY_H
-#include "core/math/camera_matrix.h"
#include "core/templates/rid_owner.h"
#include "core/templates/self_list.h"
#include "scene/resources/mesh.h"
diff --git a/servers/rendering/renderer_compositor.h b/servers/rendering/renderer_compositor.h
index f245af9a4a..e58fd7bebc 100644
--- a/servers/rendering/renderer_compositor.h
+++ b/servers/rendering/renderer_compositor.h
@@ -31,13 +31,11 @@
#ifndef RENDERING_SERVER_COMPOSITOR_H
#define RENDERING_SERVER_COMPOSITOR_H
-#include "core/math/camera_matrix.h"
-#include "core/templates/pair.h"
-#include "core/templates/self_list.h"
#include "servers/rendering/renderer_canvas_render.h"
#include "servers/rendering/renderer_scene.h"
#include "servers/rendering/renderer_storage.h"
#include "servers/rendering_server.h"
+
class RendererSceneRender;
struct BlitToScreen {
RID render_target;
diff --git a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
index fb36190c3e..354516ae87 100644
--- a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
@@ -1172,7 +1172,7 @@ void RendererSceneSkyRD::setup(RendererSceneEnvironmentRD *p_env, RID p_render_b
}
}
// Check whether the directional_light_buffer changes
- bool light_data_dirty = true;
+ bool light_data_dirty = false;
// Light buffer is dirty if we have fewer or more lights
// If we have fewer lights, make sure that old lights are disabled
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
index d22f936a35..16f77fb91a 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
@@ -877,17 +877,17 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v
vec4 splane = (spot_lights.data[idx].shadow_matrix * vec4(vertex, 1.0));
splane /= splane.w;
- vec2 proj_uv = normal_to_panorama(splane.xyz) * spot_lights.data[idx].projector_rect.zw;
+ vec2 proj_uv = splane.xy * spot_lights.data[idx].projector_rect.zw;
if (sc_projector_use_mipmaps) {
//ensure we have proper mipmaps
vec4 splane_ddx = (spot_lights.data[idx].shadow_matrix * vec4(vertex + vertex_ddx, 1.0));
splane_ddx /= splane_ddx.w;
- vec2 proj_uv_ddx = normal_to_panorama(splane_ddx.xyz) * spot_lights.data[idx].projector_rect.zw - proj_uv;
+ vec2 proj_uv_ddx = splane_ddx.xy * spot_lights.data[idx].projector_rect.zw - proj_uv;
vec4 splane_ddy = (spot_lights.data[idx].shadow_matrix * vec4(vertex + vertex_ddy, 1.0));
splane_ddy /= splane_ddy.w;
- vec2 proj_uv_ddy = normal_to_panorama(splane_ddy.xyz) * spot_lights.data[idx].projector_rect.zw - proj_uv;
+ vec2 proj_uv_ddy = splane_ddy.xy * spot_lights.data[idx].projector_rect.zw - proj_uv;
vec4 proj = textureGrad(sampler2D(decal_atlas_srgb, light_projector_sampler), proj_uv + spot_lights.data[idx].projector_rect.xy, proj_uv_ddx, proj_uv_ddy);
color *= proj.rgb * proj.a;
diff --git a/servers/rendering/renderer_scene.h b/servers/rendering/renderer_scene.h
index 4c58fce1c9..43d5b07869 100644
--- a/servers/rendering/renderer_scene.h
+++ b/servers/rendering/renderer_scene.h
@@ -31,7 +31,7 @@
#ifndef RENDERINGSERVERSCENE_H
#define RENDERINGSERVERSCENE_H
-#include "servers/rendering/renderer_compositor.h"
+#include "servers/rendering_server.h"
#include "servers/xr/xr_interface.h"
class RendererScene {
diff --git a/servers/rendering/renderer_scene_cull.h b/servers/rendering/renderer_scene_cull.h
index ed0229f0f9..90d290bef9 100644
--- a/servers/rendering/renderer_scene_cull.h
+++ b/servers/rendering/renderer_scene_cull.h
@@ -31,23 +31,18 @@
#ifndef RENDERING_SERVER_SCENE_CULL_H
#define RENDERING_SERVER_SCENE_CULL_H
-#include "core/templates/bin_sorted_array.h"
-#include "core/templates/pass_func.h"
-#include "servers/rendering/renderer_compositor.h"
-
#include "core/math/dynamic_bvh.h"
-#include "core/math/geometry_3d.h"
-#include "core/math/octree.h"
-#include "core/os/semaphore.h"
-#include "core/os/thread.h"
+#include "core/templates/bin_sorted_array.h"
#include "core/templates/local_vector.h"
#include "core/templates/paged_allocator.h"
#include "core/templates/paged_array.h"
+#include "core/templates/pass_func.h"
#include "core/templates/rid_owner.h"
#include "core/templates/self_list.h"
#include "servers/rendering/renderer_scene.h"
#include "servers/rendering/renderer_scene_occlusion_cull.h"
#include "servers/rendering/renderer_scene_render.h"
+#include "servers/rendering/renderer_storage.h"
#include "servers/xr/xr_interface.h"
class RendererSceneCull : public RendererScene {
diff --git a/servers/rendering/renderer_scene_render.h b/servers/rendering/renderer_scene_render.h
index cedf6575fd..5f9c4bb816 100644
--- a/servers/rendering/renderer_scene_render.h
+++ b/servers/rendering/renderer_scene_render.h
@@ -34,7 +34,6 @@
#include "core/math/camera_matrix.h"
#include "core/templates/paged_array.h"
#include "servers/rendering/renderer_scene.h"
-#include "servers/rendering/renderer_storage.h"
class RendererSceneRender {
public:
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 504b83c2b0..34c87d64b7 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -91,6 +91,11 @@
#include "tests/test_macros.h"
#include "scene/resources/default_theme/default_theme.h"
+#include "servers/navigation_server_2d.h"
+#include "servers/navigation_server_3d.h"
+#include "servers/physics_server_2d.h"
+#include "servers/physics_server_3d.h"
+#include "servers/rendering/rendering_server_default.h"
int test_main(int argc, char *argv[]) {
bool run_tests = true;
@@ -156,10 +161,6 @@ int test_main(int argc, char *argv[]) {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#include "servers/navigation_server_2d.h"
-#include "servers/navigation_server_3d.h"
-#include "servers/rendering/rendering_server_default.h"
-
struct GodotTestCaseListener : public doctest::IReporter {
GodotTestCaseListener(const doctest::ContextOptions &p_in) {}