diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index fd6622bad65..c4b995b048d 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -297,6 +297,7 @@ private: }; HashMap bone_list; + MenuButton *skeleton_menu = nullptr; struct PoseClipboard { Vector2 pos; @@ -329,7 +330,6 @@ private: Button *group_button = nullptr; Button *ungroup_button = nullptr; - MenuButton *skeleton_menu = nullptr; Button *override_camera_button = nullptr; MenuButton *view_menu = nullptr; PopupMenu *grid_menu = nullptr; diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index fc361ab2648..e4e66b38e92 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -2317,15 +2317,15 @@ void SpriteFramesEditorPlugin::edit(Object *p_object) { } bool SpriteFramesEditorPlugin::handles(Object *p_object) const { - AnimatedSprite2D *animated_sprite = Object::cast_to(p_object); - AnimatedSprite3D *animated_sprite_3d = Object::cast_to(p_object); - if (animated_sprite && *animated_sprite->get_sprite_frames()) { + AnimatedSprite2D *animated_sprite_2d = Object::cast_to(p_object); + if (animated_sprite_2d && *animated_sprite_2d->get_sprite_frames()) { return true; - } else if (animated_sprite_3d && *animated_sprite_3d->get_sprite_frames()) { - return true; - } else { - return p_object->is_class("SpriteFrames"); } + AnimatedSprite3D *animated_sprite_3d = Object::cast_to(p_object); + if (animated_sprite_3d && *animated_sprite_3d->get_sprite_frames()) { + return true; + } + return p_object->is_class("SpriteFrames"); } void SpriteFramesEditorPlugin::make_visible(bool p_visible) { diff --git a/main/main.cpp b/main/main.cpp index 357033b6d8b..abe15a99844 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -69,16 +69,18 @@ #include "servers/display_server.h" #include "servers/movie_writer/movie_writer.h" #include "servers/movie_writer/movie_writer_mjpeg.h" -#include "servers/navigation_server_2d.h" -#include "servers/navigation_server_2d_dummy.h" #include "servers/navigation_server_3d.h" #include "servers/navigation_server_3d_dummy.h" -#include "servers/physics_server_2d.h" #include "servers/register_server_types.h" #include "servers/rendering/rendering_server_default.h" #include "servers/text/text_server_dummy.h" #include "servers/text_server.h" +// 2D +#include "servers/navigation_server_2d.h" +#include "servers/navigation_server_2d_dummy.h" +#include "servers/physics_server_2d.h" + #ifndef _3D_DISABLED #include "servers/physics_server_3d.h" #include "servers/xr_server.h" @@ -143,15 +145,15 @@ static MessageQueue *message_queue = nullptr; // Initialized in setup2() static AudioServer *audio_server = nullptr; +static CameraServer *camera_server = nullptr; static DisplayServer *display_server = nullptr; static RenderingServer *rendering_server = nullptr; -static CameraServer *camera_server = nullptr; static TextServerManager *tsman = nullptr; +static ThemeDB *theme_db = nullptr; +static NavigationServer2D *navigation_server_2d = nullptr; static PhysicsServer2DManager *physics_server_2d_manager = nullptr; static PhysicsServer2D *physics_server_2d = nullptr; static NavigationServer3D *navigation_server_3d = nullptr; -static NavigationServer2D *navigation_server_2d = nullptr; -static ThemeDB *theme_db = nullptr; #ifndef _3D_DISABLED static PhysicsServer3DManager *physics_server_3d_manager = nullptr; static PhysicsServer3D *physics_server_3d = nullptr; diff --git a/main/performance.cpp b/main/performance.cpp index e8d519bb46b..9d4e2ae9d5f 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -36,9 +36,11 @@ #include "scene/main/scene_tree.h" #include "servers/audio_server.h" #include "servers/navigation_server_3d.h" -#include "servers/physics_server_2d.h" #include "servers/rendering_server.h" +// 2D +#include "servers/physics_server_2d.h" + #ifndef _3D_DISABLED #include "servers/physics_server_3d.h" #endif // _3D_DISABLED diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 752cfe2288e..0e3f309ca2b 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -33,53 +33,6 @@ #include "core/config/project_settings.h" #include "core/object/class_db.h" #include "core/os/os.h" -#include "scene/2d/animated_sprite_2d.h" -#include "scene/2d/audio_listener_2d.h" -#include "scene/2d/audio_stream_player_2d.h" -#include "scene/2d/back_buffer_copy.h" -#include "scene/2d/camera_2d.h" -#include "scene/2d/canvas_group.h" -#include "scene/2d/canvas_modulate.h" -#include "scene/2d/cpu_particles_2d.h" -#include "scene/2d/gpu_particles_2d.h" -#include "scene/2d/light_2d.h" -#include "scene/2d/light_occluder_2d.h" -#include "scene/2d/line_2d.h" -#include "scene/2d/marker_2d.h" -#include "scene/2d/mesh_instance_2d.h" -#include "scene/2d/multimesh_instance_2d.h" -#include "scene/2d/navigation_agent_2d.h" -#include "scene/2d/navigation_link_2d.h" -#include "scene/2d/navigation_obstacle_2d.h" -#include "scene/2d/navigation_region_2d.h" -#include "scene/2d/parallax_2d.h" -#include "scene/2d/parallax_background.h" -#include "scene/2d/parallax_layer.h" -#include "scene/2d/path_2d.h" -#include "scene/2d/physics/animatable_body_2d.h" -#include "scene/2d/physics/area_2d.h" -#include "scene/2d/physics/character_body_2d.h" -#include "scene/2d/physics/collision_polygon_2d.h" -#include "scene/2d/physics/collision_shape_2d.h" -#include "scene/2d/physics/joints/damped_spring_joint_2d.h" -#include "scene/2d/physics/joints/groove_joint_2d.h" -#include "scene/2d/physics/joints/joint_2d.h" -#include "scene/2d/physics/joints/pin_joint_2d.h" -#include "scene/2d/physics/kinematic_collision_2d.h" -#include "scene/2d/physics/physical_bone_2d.h" -#include "scene/2d/physics/physics_body_2d.h" -#include "scene/2d/physics/ray_cast_2d.h" -#include "scene/2d/physics/rigid_body_2d.h" -#include "scene/2d/physics/shape_cast_2d.h" -#include "scene/2d/physics/static_body_2d.h" -#include "scene/2d/polygon_2d.h" -#include "scene/2d/remote_transform_2d.h" -#include "scene/2d/skeleton_2d.h" -#include "scene/2d/sprite_2d.h" -#include "scene/2d/tile_map.h" -#include "scene/2d/tile_map_layer.h" -#include "scene/2d/touch_screen_button.h" -#include "scene/2d/visible_on_screen_notifier_2d.h" #include "scene/animation/animation_blend_space_1d.h" #include "scene/animation/animation_blend_space_2d.h" #include "scene/animation/animation_blend_tree.h" @@ -146,29 +99,11 @@ #include "scene/main/multiplayer_api.h" #include "scene/main/resource_preloader.h" #include "scene/main/scene_tree.h" +#include "scene/main/shader_globals_override.h" #include "scene/main/status_indicator.h" #include "scene/main/timer.h" #include "scene/main/viewport.h" #include "scene/main/window.h" -#include "scene/resources/2d/capsule_shape_2d.h" -#include "scene/resources/2d/circle_shape_2d.h" -#include "scene/resources/2d/concave_polygon_shape_2d.h" -#include "scene/resources/2d/convex_polygon_shape_2d.h" -#include "scene/resources/2d/polygon_path_finder.h" -#include "scene/resources/2d/rectangle_shape_2d.h" -#include "scene/resources/2d/segment_shape_2d.h" -#include "scene/resources/2d/separation_ray_shape_2d.h" -#include "scene/resources/2d/skeleton/skeleton_modification_2d.h" -#include "scene/resources/2d/skeleton/skeleton_modification_2d_ccdik.h" -#include "scene/resources/2d/skeleton/skeleton_modification_2d_fabrik.h" -#include "scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.h" -#include "scene/resources/2d/skeleton/skeleton_modification_2d_lookat.h" -#include "scene/resources/2d/skeleton/skeleton_modification_2d_physicalbones.h" -#include "scene/resources/2d/skeleton/skeleton_modification_2d_stackholder.h" -#include "scene/resources/2d/skeleton/skeleton_modification_2d_twoboneik.h" -#include "scene/resources/2d/skeleton/skeleton_modification_stack_2d.h" -#include "scene/resources/2d/tile_set.h" -#include "scene/resources/2d/world_boundary_shape_2d.h" #include "scene/resources/animated_texture.h" #include "scene/resources/animation_library.h" #include "scene/resources/atlas_texture.h" @@ -226,7 +161,73 @@ #include "scene/scene_string_names.h" #include "scene/theme/theme_db.h" -#include "scene/main/shader_globals_override.h" +// 2D +#include "scene/2d/animated_sprite_2d.h" +#include "scene/2d/audio_listener_2d.h" +#include "scene/2d/audio_stream_player_2d.h" +#include "scene/2d/back_buffer_copy.h" +#include "scene/2d/camera_2d.h" +#include "scene/2d/canvas_group.h" +#include "scene/2d/canvas_modulate.h" +#include "scene/2d/cpu_particles_2d.h" +#include "scene/2d/gpu_particles_2d.h" +#include "scene/2d/light_2d.h" +#include "scene/2d/light_occluder_2d.h" +#include "scene/2d/line_2d.h" +#include "scene/2d/marker_2d.h" +#include "scene/2d/mesh_instance_2d.h" +#include "scene/2d/multimesh_instance_2d.h" +#include "scene/2d/navigation_agent_2d.h" +#include "scene/2d/navigation_link_2d.h" +#include "scene/2d/navigation_obstacle_2d.h" +#include "scene/2d/navigation_region_2d.h" +#include "scene/2d/parallax_2d.h" +#include "scene/2d/parallax_background.h" +#include "scene/2d/parallax_layer.h" +#include "scene/2d/path_2d.h" +#include "scene/2d/physics/animatable_body_2d.h" +#include "scene/2d/physics/area_2d.h" +#include "scene/2d/physics/character_body_2d.h" +#include "scene/2d/physics/collision_polygon_2d.h" +#include "scene/2d/physics/collision_shape_2d.h" +#include "scene/2d/physics/joints/damped_spring_joint_2d.h" +#include "scene/2d/physics/joints/groove_joint_2d.h" +#include "scene/2d/physics/joints/joint_2d.h" +#include "scene/2d/physics/joints/pin_joint_2d.h" +#include "scene/2d/physics/kinematic_collision_2d.h" +#include "scene/2d/physics/physical_bone_2d.h" +#include "scene/2d/physics/physics_body_2d.h" +#include "scene/2d/physics/ray_cast_2d.h" +#include "scene/2d/physics/rigid_body_2d.h" +#include "scene/2d/physics/shape_cast_2d.h" +#include "scene/2d/physics/static_body_2d.h" +#include "scene/2d/polygon_2d.h" +#include "scene/2d/remote_transform_2d.h" +#include "scene/2d/skeleton_2d.h" +#include "scene/2d/sprite_2d.h" +#include "scene/2d/tile_map.h" +#include "scene/2d/tile_map_layer.h" +#include "scene/2d/touch_screen_button.h" +#include "scene/2d/visible_on_screen_notifier_2d.h" +#include "scene/resources/2d/capsule_shape_2d.h" +#include "scene/resources/2d/circle_shape_2d.h" +#include "scene/resources/2d/concave_polygon_shape_2d.h" +#include "scene/resources/2d/convex_polygon_shape_2d.h" +#include "scene/resources/2d/polygon_path_finder.h" +#include "scene/resources/2d/rectangle_shape_2d.h" +#include "scene/resources/2d/segment_shape_2d.h" +#include "scene/resources/2d/separation_ray_shape_2d.h" +#include "scene/resources/2d/skeleton/skeleton_modification_2d.h" +#include "scene/resources/2d/skeleton/skeleton_modification_2d_ccdik.h" +#include "scene/resources/2d/skeleton/skeleton_modification_2d_fabrik.h" +#include "scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.h" +#include "scene/resources/2d/skeleton/skeleton_modification_2d_lookat.h" +#include "scene/resources/2d/skeleton/skeleton_modification_2d_physicalbones.h" +#include "scene/resources/2d/skeleton/skeleton_modification_2d_stackholder.h" +#include "scene/resources/2d/skeleton/skeleton_modification_2d_twoboneik.h" +#include "scene/resources/2d/skeleton/skeleton_modification_stack_2d.h" +#include "scene/resources/2d/tile_set.h" +#include "scene/resources/2d/world_boundary_shape_2d.h" #ifndef _3D_DISABLED #include "scene/3d/audio_listener_3d.h" @@ -858,6 +859,7 @@ void register_scene_types() { GDREGISTER_CLASS(MeshDataTool); #ifndef _3D_DISABLED + GDREGISTER_CLASS(AudioStreamPlayer3D); GDREGISTER_VIRTUAL_CLASS(PrimitiveMesh); GDREGISTER_CLASS(BoxMesh); GDREGISTER_CLASS(CapsuleMesh); @@ -969,7 +971,6 @@ void register_scene_types() { GDREGISTER_CLASS(StyleBoxLine); GDREGISTER_CLASS(Theme); - GDREGISTER_CLASS(PolygonPathFinder); GDREGISTER_CLASS(BitMap); GDREGISTER_CLASS(Gradient); @@ -980,16 +981,13 @@ void register_scene_types() { OS::get_singleton()->yield(); // may take time to init GDREGISTER_CLASS(AudioStreamPlayer); - GDREGISTER_CLASS(AudioStreamPlayer2D); -#ifndef _3D_DISABLED - GDREGISTER_CLASS(AudioStreamPlayer3D); -#endif GDREGISTER_CLASS(AudioStreamWAV); GDREGISTER_CLASS(AudioStreamPolyphonic); GDREGISTER_ABSTRACT_CLASS(AudioStreamPlaybackPolyphonic); OS::get_singleton()->yield(); // may take time to init + GDREGISTER_CLASS(AudioStreamPlayer2D); GDREGISTER_ABSTRACT_CLASS(Shape2D); GDREGISTER_CLASS(WorldBoundaryShape2D); GDREGISTER_CLASS(SegmentShape2D); @@ -1002,6 +1000,7 @@ void register_scene_types() { GDREGISTER_CLASS(Curve2D); GDREGISTER_CLASS(Path2D); GDREGISTER_CLASS(PathFollow2D); + GDREGISTER_CLASS(PolygonPathFinder); GDREGISTER_CLASS(NavigationMesh); GDREGISTER_CLASS(NavigationMeshSourceGeometryData2D); diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index e52e5d47bb1..ec2c8ddb7b2 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -66,6 +66,10 @@ RID World2D::get_navigation_map() const { return navigation_map; } +PhysicsDirectSpaceState2D *World2D::get_direct_space_state() { + return PhysicsServer2D::get_singleton()->space_get_direct_state(get_space()); +} + void World2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_canvas"), &World2D::get_canvas); ClassDB::bind_method(D_METHOD("get_space"), &World2D::get_space); @@ -79,10 +83,6 @@ void World2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState2D", PROPERTY_USAGE_NONE), "", "get_direct_space_state"); } -PhysicsDirectSpaceState2D *World2D::get_direct_space_state() { - return PhysicsServer2D::get_singleton()->space_get_direct_state(get_space()); -} - void World2D::register_viewport(Viewport *p_viewport) { viewports.insert(p_viewport); }