diff options
Diffstat (limited to 'scene/2d')
28 files changed, 51 insertions, 111 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index 85e7f8df92..790606a0b2 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "animated_sprite.h" -#include "os/os.h" +#include "core/os/os.h" #include "scene/scene_string_names.h" #define NORMAL_SUFFIX "_normal" @@ -227,65 +227,6 @@ bool SpriteFrames::get_animation_loop(const StringName &p_anim) const { return E->get().loop; } -void SpriteFrames::_set_frames(const Array &p_frames) { - - clear_all(); - Map<StringName, Anim>::Element *E = animations.find(SceneStringNames::get_singleton()->_default); - ERR_FAIL_COND(!E); - - E->get().frames.resize(p_frames.size()); - for (int i = 0; i < E->get().frames.size(); i++) - E->get().frames.write[i] = p_frames[i]; -} -Array SpriteFrames::_get_frames() const { - - return Array(); -} - -Array SpriteFrames::_get_animations() const { - - Array anims; - for (Map<StringName, Anim>::Element *E = animations.front(); E; E = E->next()) { - Dictionary d; - d["name"] = E->key(); - d["speed"] = E->get().speed; - d["loop"] = E->get().loop; - Array frames; - for (int i = 0; i < E->get().frames.size(); i++) { - frames.push_back(E->get().frames[i]); - } - d["frames"] = frames; - anims.push_back(d); - } - - return anims; -} -void SpriteFrames::_set_animations(const Array &p_animations) { - - animations.clear(); - for (int i = 0; i < p_animations.size(); i++) { - - Dictionary d = p_animations[i]; - - ERR_CONTINUE(!d.has("name")); - ERR_CONTINUE(!d.has("speed")); - ERR_CONTINUE(!d.has("loop")); - ERR_CONTINUE(!d.has("frames")); - - Anim anim; - anim.speed = d["speed"]; - anim.loop = d["loop"]; - Array frames = d["frames"]; - for (int i = 0; i < frames.size(); i++) { - - RES res = frames[i]; - anim.frames.push_back(res); - } - - animations[d["name"]] = anim; - } -} - void SpriteFrames::_bind_methods() { ClassDB::bind_method(D_METHOD("add_animation", "anim"), &SpriteFrames::add_animation); @@ -308,16 +249,6 @@ void SpriteFrames::_bind_methods() { ClassDB::bind_method(D_METHOD("remove_frame", "anim", "idx"), &SpriteFrames::remove_frame); ClassDB::bind_method(D_METHOD("clear", "anim"), &SpriteFrames::clear); ClassDB::bind_method(D_METHOD("clear_all"), &SpriteFrames::clear_all); - - ClassDB::bind_method(D_METHOD("_set_frames"), &SpriteFrames::_set_frames); - ClassDB::bind_method(D_METHOD("_get_frames"), &SpriteFrames::_get_frames); - - ADD_PROPERTYNZ(PropertyInfo(Variant::ARRAY, "frames", PROPERTY_HINT_NONE, "", 0), "_set_frames", "_get_frames"); //compatibility - - ClassDB::bind_method(D_METHOD("_set_animations"), &SpriteFrames::_set_animations); - ClassDB::bind_method(D_METHOD("_get_animations"), &SpriteFrames::_get_animations); - - ADD_PROPERTYNZ(PropertyInfo(Variant::ARRAY, "animations", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_animations", "_get_animations"); //compatibility } SpriteFrames::SpriteFrames() { diff --git a/scene/2d/animated_sprite.h b/scene/2d/animated_sprite.h index cc49465403..672c9ef327 100644 --- a/scene/2d/animated_sprite.h +++ b/scene/2d/animated_sprite.h @@ -54,12 +54,6 @@ class SpriteFrames : public Resource { Map<StringName, Anim> animations; - Array _get_frames() const; - void _set_frames(const Array &p_frames); - - Array _get_animations() const; - void _set_animations(const Array &p_animations); - Vector<String> _get_animation_list() const; protected: diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h index 0fda9b867d..cd60b6c1e1 100644 --- a/scene/2d/area_2d.h +++ b/scene/2d/area_2d.h @@ -31,8 +31,8 @@ #ifndef AREA_2D_H #define AREA_2D_H +#include "core/vset.h" #include "scene/2d/collision_object_2d.h" -#include "vset.h" class Area2D : public CollisionObject2D { diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index 559e041dbf..a1ae05d971 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -30,7 +30,7 @@ #include "audio_stream_player_2d.h" -#include "engine.h" +#include "core/engine.h" #include "scene/2d/area_2d.h" #include "scene/main/viewport.h" diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 7f7e3542ed..fab0b7d433 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -29,9 +29,9 @@ /*************************************************************************/ #include "canvas_item.h" +#include "core/message_queue.h" #include "core/method_bind_ext.gen.inc" -#include "message_queue.h" -#include "os/input.h" +#include "core/os/input.h" #include "scene/main/canvas_layer.h" #include "scene/main/viewport.h" #include "scene/resources/font.h" @@ -967,6 +967,17 @@ Vector2 CanvasItem::get_local_mouse_position() const { return get_global_transform().affine_inverse().xform(get_global_mouse_position()); } +void CanvasItem::force_update_transform() { + ERR_FAIL_COND(!is_inside_tree()); + if (!xform_change.in_list()) { + return; + } + + get_tree()->xform_change_list.remove(&xform_change); + + notification(NOTIFICATION_TRANSFORM_CHANGED); +} + void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("_toplevel_raise_self"), &CanvasItem::_toplevel_raise_self); @@ -1061,6 +1072,8 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_notify_transform", "enable"), &CanvasItem::set_notify_transform); ClassDB::bind_method(D_METHOD("is_transform_notification_enabled"), &CanvasItem::is_transform_notification_enabled); + ClassDB::bind_method(D_METHOD("force_update_transform"), &CanvasItem::force_update_transform); + ClassDB::bind_method(D_METHOD("make_canvas_position_local", "screen_point"), &CanvasItem::make_canvas_position_local); ClassDB::bind_method(D_METHOD("make_input_local", "event"), &CanvasItem::make_input_local); diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 1e6a251c9c..6dc2e2e39d 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -346,6 +346,8 @@ public: void set_notify_transform(bool p_enable); bool is_transform_notification_enabled() const; + void force_update_transform(); + // Used by control nodes to retreive the parent's anchorable area virtual Rect2 get_anchorable_rect() const { return Rect2(0, 0, 0, 0); }; diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 9f19f56e75..508ceeaaf9 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -31,7 +31,7 @@ #include "collision_polygon_2d.h" #include "collision_object_2d.h" -#include "engine.h" +#include "core/engine.h" #include "scene/resources/concave_polygon_shape_2d.h" #include "scene/resources/convex_polygon_shape_2d.h" diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index ff5f7062c4..cb9c8ecf95 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -31,7 +31,7 @@ #include "collision_shape_2d.h" #include "collision_object_2d.h" -#include "engine.h" +#include "core/engine.h" #include "scene/resources/capsule_shape_2d.h" #include "scene/resources/circle_shape_2d.h" #include "scene/resources/concave_polygon_shape_2d.h" diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h index dbe9f59748..4f51eb1062 100644 --- a/scene/2d/cpu_particles_2d.h +++ b/scene/2d/cpu_particles_2d.h @@ -31,7 +31,7 @@ #ifndef CPU_PARTICLES_2D_H #define CPU_PARTICLES_2D_H -#include "rid.h" +#include "core/rid.h" #include "scene/2d/node_2d.h" #include "scene/resources/texture.h" diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index 7d5360c0e4..b9a48e1fdc 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -30,7 +30,7 @@ #include "joints_2d.h" -#include "engine.h" +#include "core/engine.h" #include "physics_body_2d.h" #include "servers/physics_2d_server.h" diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index f93c7d1f79..e6a5a0b651 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -30,7 +30,7 @@ #include "light_2d.h" -#include "engine.h" +#include "core/engine.h" #include "servers/visual_server.h" Dictionary Light2D::_edit_get_state() const { @@ -431,7 +431,7 @@ void Light2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "StreamTexture,ImageTexture"), "set_texture", "get_texture"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_texture_offset", "get_texture_offset"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_scale", PROPERTY_HINT_RANGE, "0.01,50,0.01"), "set_texture_scale", "get_texture_scale"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color"); diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index c9e5d0f1bc..ab15b49985 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -30,7 +30,7 @@ #include "light_occluder_2d.h" -#include "engine.h" +#include "core/engine.h" void OccluderPolygon2D::set_polygon(const PoolVector<Vector2> &p_polygon) { diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index ad9775c0b7..e164f0ca75 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -31,7 +31,7 @@ #include "line_2d.h" #include "line_builder.h" -#include "core_string_names.h" +#include "core/core_string_names.h" // Needed so we can bind functions VARIANT_ENUM_CAST(Line2D::LineJointMode) diff --git a/scene/2d/line_builder.h b/scene/2d/line_builder.h index edfdf97c47..f9d26f12af 100644 --- a/scene/2d/line_builder.h +++ b/scene/2d/line_builder.h @@ -31,10 +31,10 @@ #ifndef LINE_BUILDER_H #define LINE_BUILDER_H -#include "color.h" +#include "core/color.h" +#include "core/math/vector2.h" #include "line_2d.h" #include "scene/resources/color_ramp.h" -#include "vector2.h" class LineBuilder { public: diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 84b12b0bfe..b36924e521 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -30,8 +30,8 @@ #include "navigation_polygon.h" -#include "core_string_names.h" -#include "engine.h" +#include "core/core_string_names.h" +#include "core/engine.h" #include "navigation2d.h" #include "thirdparty/misc/triangulator.h" diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 7de72dc41d..29065a89b3 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -30,7 +30,7 @@ #include "node_2d.h" -#include "message_queue.h" +#include "core/message_queue.h" #include "scene/gui/control.h" #include "scene/main/viewport.h" #include "servers/visual_server.h" diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index 2ac6c76032..06de723f27 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -30,7 +30,7 @@ #include "parallax_layer.h" -#include "engine.h" +#include "core/engine.h" #include "parallax_background.h" void ParallaxLayer::set_motion_scale(const Size2 &p_scale) { diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index 816149ba79..af673841b1 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -31,7 +31,7 @@ #ifndef PARTICLES_2D_H #define PARTICLES_2D_H -#include "rid.h" +#include "core/rid.h" #include "scene/2d/node_2d.h" #include "scene/resources/texture.h" diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 658b998d17..cdb208e6cd 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -30,7 +30,7 @@ #include "path_2d.h" -#include "engine.h" +#include "core/engine.h" #include "scene/scene_string_names.h" #ifdef TOOLS_ENABLED diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index dc93414669..d0bebd3354 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -31,9 +31,9 @@ #include "physics_body_2d.h" #include "core/core_string_names.h" +#include "core/engine.h" +#include "core/math/math_funcs.h" #include "core/method_bind_ext.gen.inc" -#include "engine.h" -#include "math_funcs.h" #include "scene/scene_string_names.h" void PhysicsBody2D::_notification(int p_what) { diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index 852963a721..29befb0375 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -31,10 +31,10 @@ #ifndef PHYSICS_BODY_2D_H #define PHYSICS_BODY_2D_H +#include "core/vset.h" #include "scene/2d/collision_object_2d.h" #include "scene/resources/physics_material.h" #include "servers/physics_2d_server.h" -#include "vset.h" class KinematicCollision2D; diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp index 64d23719e7..543314eefa 100644 --- a/scene/2d/position_2d.cpp +++ b/scene/2d/position_2d.cpp @@ -30,7 +30,7 @@ #include "position_2d.h" -#include "engine.h" +#include "core/engine.h" #include "scene/resources/texture.h" void Position2D::_draw_cross() { diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index d9b3cb07fc..f7c18a17df 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -31,7 +31,7 @@ #include "ray_cast_2d.h" #include "collision_object_2d.h" -#include "engine.h" +#include "core/engine.h" #include "physics_body_2d.h" #include "servers/physics_2d_server.h" diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index 45f63fd5bf..44a41328e8 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -29,9 +29,9 @@ /*************************************************************************/ #include "screen_button.h" -#include "input_map.h" -#include "os/input.h" -#include "os/os.h" +#include "core/input_map.h" +#include "core/os/input.h" +#include "core/os/os.h" void TouchScreenButton::set_texture(const Ref<Texture> &p_texture) { diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index bb5990fa79..04e199a21b 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -30,7 +30,7 @@ #include "sprite.h" #include "core/core_string_names.h" -#include "os/os.h" +#include "core/os/os.h" #include "scene/main/viewport.h" #include "scene/scene_string_names.h" diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 8a2fdbacfa..71bd51507e 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -30,9 +30,9 @@ #include "tile_map.h" -#include "io/marshalls.h" -#include "method_bind_ext.gen.inc" -#include "os/os.h" +#include "core/io/marshalls.h" +#include "core/method_bind_ext.gen.inc" +#include "core/os/os.h" #include "servers/physics_2d_server.h" int TileMap::_get_quadrant_size() const { diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 55db33837f..499c79b180 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -31,11 +31,11 @@ #ifndef TILE_MAP_H #define TILE_MAP_H +#include "core/self_list.h" +#include "core/vset.h" #include "scene/2d/navigation2d.h" #include "scene/2d/node_2d.h" #include "scene/resources/tile_set.h" -#include "self_list.h" -#include "vset.h" class TileMap : public Node2D { diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index ddca97e60a..7d7c47619a 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -30,7 +30,7 @@ #include "visibility_notifier_2d.h" -#include "engine.h" +#include "core/engine.h" #include "particles_2d.h" #include "scene/2d/animated_sprite.h" #include "scene/2d/physics_body_2d.h" |