summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/animated_sprite_2d.cpp18
-rw-r--r--scene/2d/camera_2d.cpp14
-rw-r--r--scene/2d/canvas_group.cpp4
-rw-r--r--scene/2d/collision_polygon_2d.cpp8
-rw-r--r--scene/2d/collision_shape_2d.cpp8
-rw-r--r--scene/2d/cpu_particles_2d.cpp58
-rw-r--r--scene/2d/cpu_particles_2d.h4
-rw-r--r--scene/2d/gpu_particles_2d.cpp52
-rw-r--r--scene/2d/gpu_particles_2d.h2
-rw-r--r--scene/2d/joint_2d.cpp14
-rw-r--r--scene/2d/light_occluder_2d.cpp4
-rw-r--r--scene/2d/line_2d.cpp38
-rw-r--r--scene/2d/line_builder.cpp10
-rw-r--r--scene/2d/marker_2d.cpp4
-rw-r--r--scene/2d/mesh_instance_2d.cpp6
-rw-r--r--scene/2d/multimesh_instance_2d.cpp6
-rw-r--r--scene/2d/navigation_region_2d.cpp6
-rw-r--r--scene/2d/path_2d.cpp14
-rw-r--r--scene/2d/polygon_2d.cpp34
-rw-r--r--scene/2d/ray_cast_2d.cpp6
-rw-r--r--scene/2d/shape_cast_2d.cpp10
-rw-r--r--scene/2d/skeleton_2d.cpp12
-rw-r--r--scene/2d/sprite_2d.cpp20
-rw-r--r--scene/2d/touch_screen_button.cpp22
-rw-r--r--scene/2d/visible_on_screen_notifier_2d.cpp2
25 files changed, 202 insertions, 174 deletions
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp
index 4565462247..b1b1cb23ed 100644
--- a/scene/2d/animated_sprite_2d.cpp
+++ b/scene/2d/animated_sprite_2d.cpp
@@ -205,7 +205,7 @@ void AnimatedSprite2D::_notification(int p_what) {
}
}
- update();
+ queue_redraw();
emit_signal(SceneStringNames::get_singleton()->frame_changed);
}
@@ -274,7 +274,7 @@ void AnimatedSprite2D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) {
notify_property_list_changed();
_reset_timeout();
- update();
+ queue_redraw();
update_configuration_warnings();
}
@@ -304,7 +304,7 @@ void AnimatedSprite2D::set_frame(int p_frame) {
frame = p_frame;
_reset_timeout();
- update();
+ queue_redraw();
emit_signal(SceneStringNames::get_singleton()->frame_changed);
}
@@ -329,7 +329,7 @@ double AnimatedSprite2D::get_speed_scale() const {
void AnimatedSprite2D::set_centered(bool p_center) {
centered = p_center;
- update();
+ queue_redraw();
item_rect_changed();
}
@@ -339,7 +339,7 @@ bool AnimatedSprite2D::is_centered() const {
void AnimatedSprite2D::set_offset(const Point2 &p_offset) {
offset = p_offset;
- update();
+ queue_redraw();
item_rect_changed();
}
@@ -349,7 +349,7 @@ Point2 AnimatedSprite2D::get_offset() const {
void AnimatedSprite2D::set_flip_h(bool p_flip) {
hflip = p_flip;
- update();
+ queue_redraw();
}
bool AnimatedSprite2D::is_flipped_h() const {
@@ -358,7 +358,7 @@ bool AnimatedSprite2D::is_flipped_h() const {
void AnimatedSprite2D::set_flip_v(bool p_flip) {
vflip = p_flip;
- update();
+ queue_redraw();
}
bool AnimatedSprite2D::is_flipped_v() const {
@@ -368,7 +368,7 @@ bool AnimatedSprite2D::is_flipped_v() const {
void AnimatedSprite2D::_res_changed() {
set_frame(frame);
- update();
+ queue_redraw();
}
void AnimatedSprite2D::set_playing(bool p_playing) {
@@ -433,7 +433,7 @@ void AnimatedSprite2D::set_animation(const StringName &p_animation) {
_reset_timeout();
set_frame(0);
notify_property_list_changed();
- update();
+ queue_redraw();
}
StringName AnimatedSprite2D::get_animation() const {
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 88f9c2a4a6..ce77c6ba8d 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -39,7 +39,7 @@ void Camera2D::_update_scroll() {
}
if (Engine::get_singleton()->is_editor_hint()) {
- update(); //will just be drawn
+ queue_redraw(); //will just be drawn
return;
}
@@ -392,7 +392,7 @@ void Camera2D::_make_current(Object *p_which) {
current = true;
if (is_inside_tree()) {
get_viewport()->_camera_2d_set(this);
- update();
+ queue_redraw();
}
} else {
current = false;
@@ -400,7 +400,7 @@ void Camera2D::_make_current(Object *p_which) {
if (get_viewport()->get_camera_2d() == this) {
get_viewport()->_camera_2d_set(nullptr);
}
- update();
+ queue_redraw();
}
}
}
@@ -461,7 +461,7 @@ bool Camera2D::is_limit_smoothing_enabled() const {
void Camera2D::set_drag_margin(Side p_side, real_t p_drag_margin) {
ERR_FAIL_INDEX((int)p_side, 4);
drag_margin[p_side] = p_drag_margin;
- update();
+ queue_redraw();
}
real_t Camera2D::get_drag_margin(Side p_side) const {
@@ -625,7 +625,7 @@ Node *Camera2D::get_custom_viewport() const {
void Camera2D::set_screen_drawing_enabled(bool enable) {
screen_drawing_enabled = enable;
#ifdef TOOLS_ENABLED
- update();
+ queue_redraw();
#endif
}
@@ -636,7 +636,7 @@ bool Camera2D::is_screen_drawing_enabled() const {
void Camera2D::set_limit_drawing_enabled(bool enable) {
limit_drawing_enabled = enable;
#ifdef TOOLS_ENABLED
- update();
+ queue_redraw();
#endif
}
@@ -647,7 +647,7 @@ bool Camera2D::is_limit_drawing_enabled() const {
void Camera2D::set_margin_drawing_enabled(bool enable) {
margin_drawing_enabled = enable;
#ifdef TOOLS_ENABLED
- update();
+ queue_redraw();
#endif
}
diff --git a/scene/2d/canvas_group.cpp b/scene/2d/canvas_group.cpp
index bbf3fff0ad..d4182f85a7 100644
--- a/scene/2d/canvas_group.cpp
+++ b/scene/2d/canvas_group.cpp
@@ -36,7 +36,7 @@ void CanvasGroup::set_fit_margin(real_t p_fit_margin) {
fit_margin = p_fit_margin;
RS::get_singleton()->canvas_item_set_canvas_group_mode(get_canvas_item(), RS::CANVAS_GROUP_MODE_TRANSPARENT, clear_margin, true, fit_margin, use_mipmaps);
- update();
+ queue_redraw();
}
real_t CanvasGroup::get_fit_margin() const {
@@ -49,7 +49,7 @@ void CanvasGroup::set_clear_margin(real_t p_clear_margin) {
clear_margin = p_clear_margin;
RS::get_singleton()->canvas_item_set_canvas_group_mode(get_canvas_item(), RS::CANVAS_GROUP_MODE_TRANSPARENT, clear_margin, true, clear_margin, use_mipmaps);
- update();
+ queue_redraw();
}
real_t CanvasGroup::get_clear_margin() const {
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index 04cd999982..b69b19d30d 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -198,7 +198,7 @@ void CollisionPolygon2D::set_polygon(const Vector<Point2> &p_polygon) {
_build_polygon();
_update_in_shape_owner();
}
- update();
+ queue_redraw();
update_configuration_warnings();
}
@@ -213,7 +213,7 @@ void CollisionPolygon2D::set_build_mode(BuildMode p_mode) {
_build_polygon();
_update_in_shape_owner();
}
- update();
+ queue_redraw();
update_configuration_warnings();
}
@@ -264,7 +264,7 @@ TypedArray<String> CollisionPolygon2D::get_configuration_warnings() const {
void CollisionPolygon2D::set_disabled(bool p_disabled) {
disabled = p_disabled;
- update();
+ queue_redraw();
if (parent) {
parent->shape_owner_set_disabled(owner_id, p_disabled);
}
@@ -276,7 +276,7 @@ bool CollisionPolygon2D::is_disabled() const {
void CollisionPolygon2D::set_one_way_collision(bool p_enable) {
one_way_collision = p_enable;
- update();
+ queue_redraw();
if (parent) {
parent->shape_owner_set_one_way_collision(owner_id, p_enable);
}
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index cbecf28877..039bfee451 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -36,7 +36,7 @@
#include "scene/resources/convex_polygon_shape_2d.h"
void CollisionShape2D::_shape_changed() {
- update();
+ queue_redraw();
}
void CollisionShape2D::_update_in_shape_owner(bool p_xform_only) {
@@ -140,7 +140,7 @@ void CollisionShape2D::set_shape(const Ref<Shape2D> &p_shape) {
shape->disconnect("changed", callable_mp(this, &CollisionShape2D::_shape_changed));
}
shape = p_shape;
- update();
+ queue_redraw();
if (parent) {
parent->shape_owner_clear_shapes(owner_id);
if (shape.is_valid()) {
@@ -192,7 +192,7 @@ TypedArray<String> CollisionShape2D::get_configuration_warnings() const {
void CollisionShape2D::set_disabled(bool p_disabled) {
disabled = p_disabled;
- update();
+ queue_redraw();
if (parent) {
parent->shape_owner_set_disabled(owner_id, p_disabled);
}
@@ -204,7 +204,7 @@ bool CollisionShape2D::is_disabled() const {
void CollisionShape2D::set_one_way_collision(bool p_enable) {
one_way_collision = p_enable;
- update();
+ queue_redraw();
if (parent) {
parent->shape_owner_set_one_way_collision(owner_id, p_enable);
}
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 1929475c8f..58e357ab5f 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -211,13 +211,13 @@ void CPUParticles2D::set_texture(const Ref<Texture2D> &p_texture) {
texture->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CPUParticles2D::_texture_changed));
}
- update();
+ queue_redraw();
_update_mesh_texture();
}
void CPUParticles2D::_texture_changed() {
if (texture.is_valid()) {
- update();
+ queue_redraw();
_update_mesh_texture();
}
}
@@ -556,7 +556,7 @@ static real_t rand_from_seed(uint32_t &seed) {
void CPUParticles2D::_update_internal() {
if (particles.size() == 0 || !is_visible_in_tree()) {
- _set_redraw(false);
+ _set_do_redraw(false);
return;
}
@@ -567,7 +567,7 @@ void CPUParticles2D::_update_internal() {
inactive_time += delta;
if (inactive_time > lifetime * 1.2) {
set_process_internal(false);
- _set_redraw(false);
+ _set_do_redraw(false);
//reset variables
time = 0;
@@ -577,7 +577,7 @@ void CPUParticles2D::_update_internal() {
return;
}
}
- _set_redraw(true);
+ _set_do_redraw(true);
if (time == 0 && pre_process_time > 0.0) {
double frame_time;
@@ -719,17 +719,17 @@ void CPUParticles2D::_particles_process(double p_delta) {
/*real_t tex_linear_velocity = 0;
if (curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid()) {
- tex_linear_velocity = curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY]->interpolate(0);
+ tex_linear_velocity = curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY]->sample(0);
}*/
real_t tex_angle = 0.0;
if (curve_parameters[PARAM_ANGLE].is_valid()) {
- tex_angle = curve_parameters[PARAM_ANGLE]->interpolate(tv);
+ tex_angle = curve_parameters[PARAM_ANGLE]->sample(tv);
}
real_t tex_anim_offset = 0.0;
if (curve_parameters[PARAM_ANGLE].is_valid()) {
- tex_anim_offset = curve_parameters[PARAM_ANGLE]->interpolate(tv);
+ tex_anim_offset = curve_parameters[PARAM_ANGLE]->sample(tv);
}
p.seed = Math::rand();
@@ -825,51 +825,51 @@ void CPUParticles2D::_particles_process(double p_delta) {
real_t tex_linear_velocity = 1.0;
if (curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid()) {
- tex_linear_velocity = curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY]->interpolate(tv);
+ tex_linear_velocity = curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY]->sample(tv);
}
real_t tex_orbit_velocity = 1.0;
if (curve_parameters[PARAM_ORBIT_VELOCITY].is_valid()) {
- tex_orbit_velocity = curve_parameters[PARAM_ORBIT_VELOCITY]->interpolate(tv);
+ tex_orbit_velocity = curve_parameters[PARAM_ORBIT_VELOCITY]->sample(tv);
}
real_t tex_angular_velocity = 1.0;
if (curve_parameters[PARAM_ANGULAR_VELOCITY].is_valid()) {
- tex_angular_velocity = curve_parameters[PARAM_ANGULAR_VELOCITY]->interpolate(tv);
+ tex_angular_velocity = curve_parameters[PARAM_ANGULAR_VELOCITY]->sample(tv);
}
real_t tex_linear_accel = 1.0;
if (curve_parameters[PARAM_LINEAR_ACCEL].is_valid()) {
- tex_linear_accel = curve_parameters[PARAM_LINEAR_ACCEL]->interpolate(tv);
+ tex_linear_accel = curve_parameters[PARAM_LINEAR_ACCEL]->sample(tv);
}
real_t tex_tangential_accel = 1.0;
if (curve_parameters[PARAM_TANGENTIAL_ACCEL].is_valid()) {
- tex_tangential_accel = curve_parameters[PARAM_TANGENTIAL_ACCEL]->interpolate(tv);
+ tex_tangential_accel = curve_parameters[PARAM_TANGENTIAL_ACCEL]->sample(tv);
}
real_t tex_radial_accel = 1.0;
if (curve_parameters[PARAM_RADIAL_ACCEL].is_valid()) {
- tex_radial_accel = curve_parameters[PARAM_RADIAL_ACCEL]->interpolate(tv);
+ tex_radial_accel = curve_parameters[PARAM_RADIAL_ACCEL]->sample(tv);
}
real_t tex_damping = 1.0;
if (curve_parameters[PARAM_DAMPING].is_valid()) {
- tex_damping = curve_parameters[PARAM_DAMPING]->interpolate(tv);
+ tex_damping = curve_parameters[PARAM_DAMPING]->sample(tv);
}
real_t tex_angle = 1.0;
if (curve_parameters[PARAM_ANGLE].is_valid()) {
- tex_angle = curve_parameters[PARAM_ANGLE]->interpolate(tv);
+ tex_angle = curve_parameters[PARAM_ANGLE]->sample(tv);
}
real_t tex_anim_speed = 1.0;
if (curve_parameters[PARAM_ANIM_SPEED].is_valid()) {
- tex_anim_speed = curve_parameters[PARAM_ANIM_SPEED]->interpolate(tv);
+ tex_anim_speed = curve_parameters[PARAM_ANIM_SPEED]->sample(tv);
}
real_t tex_anim_offset = 1.0;
if (curve_parameters[PARAM_ANIM_OFFSET].is_valid()) {
- tex_anim_offset = curve_parameters[PARAM_ANIM_OFFSET]->interpolate(tv);
+ tex_anim_offset = curve_parameters[PARAM_ANIM_OFFSET]->sample(tv);
}
Vector2 force = gravity;
@@ -921,18 +921,18 @@ void CPUParticles2D::_particles_process(double p_delta) {
Vector2 tex_scale = Vector2(1.0, 1.0);
if (split_scale) {
if (scale_curve_x.is_valid()) {
- tex_scale.x = scale_curve_x->interpolate(tv);
+ tex_scale.x = scale_curve_x->sample(tv);
} else {
tex_scale.x = 1.0;
}
if (scale_curve_y.is_valid()) {
- tex_scale.y = scale_curve_y->interpolate(tv);
+ tex_scale.y = scale_curve_y->sample(tv);
} else {
tex_scale.y = 1.0;
}
} else {
if (curve_parameters[PARAM_SCALE].is_valid()) {
- real_t tmp_scale = curve_parameters[PARAM_SCALE]->interpolate(tv);
+ real_t tmp_scale = curve_parameters[PARAM_SCALE]->sample(tv);
tex_scale.x = tmp_scale;
tex_scale.y = tmp_scale;
}
@@ -940,7 +940,7 @@ void CPUParticles2D::_particles_process(double p_delta) {
real_t tex_hue_variation = 0.0;
if (curve_parameters[PARAM_HUE_VARIATION].is_valid()) {
- tex_hue_variation = curve_parameters[PARAM_HUE_VARIATION]->interpolate(tv);
+ tex_hue_variation = curve_parameters[PARAM_HUE_VARIATION]->sample(tv);
}
real_t hue_rot_angle = (tex_hue_variation)*Math_TAU * Math::lerp(parameters_min[PARAM_HUE_VARIATION], parameters_max[PARAM_HUE_VARIATION], p.hue_rot_rand);
@@ -1062,16 +1062,16 @@ void CPUParticles2D::_update_particle_data_buffer() {
}
}
-void CPUParticles2D::_set_redraw(bool p_redraw) {
- if (redraw == p_redraw) {
+void CPUParticles2D::_set_do_redraw(bool p_do_redraw) {
+ if (do_redraw == p_do_redraw) {
return;
}
- redraw = p_redraw;
+ do_redraw = p_do_redraw;
{
MutexLock lock(update_mutex);
- if (redraw) {
+ if (do_redraw) {
RS::get_singleton()->connect("frame_pre_draw", callable_mp(this, &CPUParticles2D::_update_render_thread));
RS::get_singleton()->canvas_item_set_update_when_visible(get_canvas_item(), true);
@@ -1086,7 +1086,7 @@ void CPUParticles2D::_set_redraw(bool p_redraw) {
}
}
- update(); // redraw to update render list
+ queue_redraw(); // redraw to update render list
}
void CPUParticles2D::_update_render_thread() {
@@ -1102,7 +1102,7 @@ void CPUParticles2D::_notification(int p_what) {
} break;
case NOTIFICATION_EXIT_TREE: {
- _set_redraw(false);
+ _set_do_redraw(false);
} break;
case NOTIFICATION_DRAW: {
@@ -1111,7 +1111,7 @@ void CPUParticles2D::_notification(int p_what) {
_update_internal();
}
- if (!redraw) {
+ if (!do_redraw) {
return; // don't add to render list
}
diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h
index 8f1671d280..3fd1c7fd0f 100644
--- a/scene/2d/cpu_particles_2d.h
+++ b/scene/2d/cpu_particles_2d.h
@@ -102,7 +102,7 @@ private:
double inactive_time = 0.0;
double frame_remainder = 0.0;
int cycle = 0;
- bool redraw = false;
+ bool do_redraw = false;
RID mesh;
RID multimesh;
@@ -186,7 +186,7 @@ private:
void _update_mesh_texture();
- void _set_redraw(bool p_redraw);
+ void _set_do_redraw(bool p_do_redraw);
void _texture_changed();
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp
index 65ead7afbc..bed68b4ee0 100644
--- a/scene/2d/gpu_particles_2d.cpp
+++ b/scene/2d/gpu_particles_2d.cpp
@@ -30,6 +30,7 @@
#include "gpu_particles_2d.h"
+#include "core/core_string_names.h"
#include "scene/resources/particle_process_material.h"
#ifdef TOOLS_ENABLED
@@ -99,7 +100,7 @@ void GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
RS::get_singleton()->particles_set_custom_aabb(particles, aabb);
- update();
+ queue_redraw();
}
void GPUParticles2D::set_use_local_coordinates(bool p_enable) {
@@ -141,7 +142,7 @@ void GPUParticles2D::set_process_material(const Ref<Material> &p_material) {
void GPUParticles2D::set_trail_enabled(bool p_enabled) {
trail_enabled = p_enabled;
RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_length);
- update();
+ queue_redraw();
RS::get_singleton()->particles_set_transform_align(particles, p_enabled ? RS::PARTICLES_TRANSFORM_ALIGN_Y_TO_VELOCITY : RS::PARTICLES_TRANSFORM_ALIGN_DISABLED);
}
@@ -150,7 +151,7 @@ void GPUParticles2D::set_trail_length(double p_seconds) {
ERR_FAIL_COND(p_seconds < 0.001);
trail_length = p_seconds;
RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_length);
- update();
+ queue_redraw();
}
void GPUParticles2D::set_trail_sections(int p_sections) {
@@ -158,7 +159,7 @@ void GPUParticles2D::set_trail_sections(int p_sections) {
ERR_FAIL_COND(p_sections > 128);
trail_sections = p_sections;
- update();
+ queue_redraw();
}
void GPUParticles2D::set_trail_section_subdivisions(int p_subdivisions) {
@@ -166,13 +167,13 @@ void GPUParticles2D::set_trail_section_subdivisions(int p_subdivisions) {
ERR_FAIL_COND(p_subdivisions > 1024);
trail_section_subdivisions = p_subdivisions;
- update();
+ queue_redraw();
}
#ifdef TOOLS_ENABLED
void GPUParticles2D::set_show_visibility_rect(bool p_show_visibility_rect) {
show_visibility_rect = p_show_visibility_rect;
- update();
+ queue_redraw();
}
#endif
@@ -331,9 +332,17 @@ Rect2 GPUParticles2D::capture_rect() const {
}
void GPUParticles2D::set_texture(const Ref<Texture2D> &p_texture) {
+ if (texture.is_valid()) {
+ texture->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &GPUParticles2D::_texture_changed));
+ }
+
texture = p_texture;
+
+ if (texture.is_valid()) {
+ texture->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &GPUParticles2D::_texture_changed));
+ }
_update_collision_size();
- update();
+ queue_redraw();
}
Ref<Texture2D> GPUParticles2D::get_texture() const {
@@ -363,6 +372,14 @@ void GPUParticles2D::_attach_sub_emitter() {
}
}
+void GPUParticles2D::_texture_changed() {
+ // Changes to the texture need to trigger an update to make
+ // the editor redraw the sprite with the updated texture.
+ if (texture.is_valid()) {
+ queue_redraw();
+ }
+}
+
void GPUParticles2D::set_sub_emitter(const NodePath &p_path) {
if (is_inside_tree()) {
RS::get_singleton()->particles_set_subemitter(particles, RID());
@@ -480,12 +497,21 @@ void GPUParticles2D::_notification(int p_what) {
Vector2(-size.x / 2.0, size.y / 2.0)
};
- Vector<Vector2> uvs = {
- Vector2(0, 0),
- Vector2(1, 0),
- Vector2(1, 1),
- Vector2(0, 1)
- };
+ Vector<Vector2> uvs;
+ AtlasTexture *atlas_texure = Object::cast_to<AtlasTexture>(*texture);
+ if (atlas_texure && atlas_texure->get_atlas().is_valid()) {
+ Rect2 region_rect = atlas_texure->get_region();
+ Size2 atlas_size = atlas_texure->get_atlas()->get_size();
+ uvs.push_back(Vector2(region_rect.position.x / atlas_size.x, region_rect.position.y / atlas_size.y));
+ uvs.push_back(Vector2((region_rect.position.x + region_rect.size.x) / atlas_size.x, region_rect.position.y / atlas_size.y));
+ uvs.push_back(Vector2((region_rect.position.x + region_rect.size.x) / atlas_size.x, (region_rect.position.y + region_rect.size.y) / atlas_size.y));
+ uvs.push_back(Vector2(region_rect.position.x / atlas_size.x, (region_rect.position.y + region_rect.size.y) / atlas_size.y));
+ } else {
+ uvs.push_back(Vector2(0, 0));
+ uvs.push_back(Vector2(1, 0));
+ uvs.push_back(Vector2(1, 1));
+ uvs.push_back(Vector2(0, 1));
+ }
Vector<int> indices = { 0, 1, 2, 0, 2, 3 };
diff --git a/scene/2d/gpu_particles_2d.h b/scene/2d/gpu_particles_2d.h
index 7eece32898..10ae91775f 100644
--- a/scene/2d/gpu_particles_2d.h
+++ b/scene/2d/gpu_particles_2d.h
@@ -82,6 +82,8 @@ private:
void _attach_sub_emitter();
+ void _texture_changed();
+
protected:
static void _bind_methods();
void _validate_property(PropertyInfo &p_property) const;
diff --git a/scene/2d/joint_2d.cpp b/scene/2d/joint_2d.cpp
index 7b9f7e14ca..89b6f3f9da 100644
--- a/scene/2d/joint_2d.cpp
+++ b/scene/2d/joint_2d.cpp
@@ -267,7 +267,7 @@ void PinJoint2D::_configure_joint(RID p_joint, PhysicsBody2D *body_a, PhysicsBod
void PinJoint2D::set_softness(real_t p_softness) {
softness = p_softness;
- update();
+ queue_redraw();
if (is_configured()) {
PhysicsServer2D::get_singleton()->pin_joint_set_param(get_joint(), PhysicsServer2D::PIN_JOINT_SOFTNESS, p_softness);
}
@@ -321,7 +321,7 @@ void GrooveJoint2D::_configure_joint(RID p_joint, PhysicsBody2D *body_a, Physics
void GrooveJoint2D::set_length(real_t p_length) {
length = p_length;
- update();
+ queue_redraw();
}
real_t GrooveJoint2D::get_length() const {
@@ -330,7 +330,7 @@ real_t GrooveJoint2D::get_length() const {
void GrooveJoint2D::set_initial_offset(real_t p_initial_offset) {
initial_offset = p_initial_offset;
- update();
+ queue_redraw();
}
real_t GrooveJoint2D::get_initial_offset() const {
@@ -387,7 +387,7 @@ void DampedSpringJoint2D::_configure_joint(RID p_joint, PhysicsBody2D *body_a, P
void DampedSpringJoint2D::set_length(real_t p_length) {
length = p_length;
- update();
+ queue_redraw();
}
real_t DampedSpringJoint2D::get_length() const {
@@ -396,7 +396,7 @@ real_t DampedSpringJoint2D::get_length() const {
void DampedSpringJoint2D::set_rest_length(real_t p_rest_length) {
rest_length = p_rest_length;
- update();
+ queue_redraw();
if (is_configured()) {
PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_SPRING_REST_LENGTH, p_rest_length ? p_rest_length : length);
}
@@ -408,7 +408,7 @@ real_t DampedSpringJoint2D::get_rest_length() const {
void DampedSpringJoint2D::set_stiffness(real_t p_stiffness) {
stiffness = p_stiffness;
- update();
+ queue_redraw();
if (is_configured()) {
PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_SPRING_STIFFNESS, p_stiffness);
}
@@ -420,7 +420,7 @@ real_t DampedSpringJoint2D::get_stiffness() const {
void DampedSpringJoint2D::set_damping(real_t p_damping) {
damping = p_damping;
- update();
+ queue_redraw();
if (is_configured()) {
PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_SPRING_DAMPING, p_damping);
}
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index 14188d7120..6c171383ca 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -153,7 +153,7 @@ OccluderPolygon2D::~OccluderPolygon2D() {
void LightOccluder2D::_poly_changed() {
#ifdef DEBUG_ENABLED
- update();
+ queue_redraw();
#endif
}
@@ -229,7 +229,7 @@ void LightOccluder2D::set_occluder_polygon(const Ref<OccluderPolygon2D> &p_polyg
if (occluder_polygon.is_valid()) {
occluder_polygon->connect("changed", callable_mp(this, &LightOccluder2D::_poly_changed));
}
- update();
+ queue_redraw();
#endif
}
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index 837f3061f1..6a72280f3d 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -76,7 +76,7 @@ bool Line2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc
void Line2D::set_points(const Vector<Vector2> &p_points) {
_points = p_points;
- update();
+ queue_redraw();
}
void Line2D::set_width(float p_width) {
@@ -84,7 +84,7 @@ void Line2D::set_width(float p_width) {
p_width = 0.0;
}
_width = p_width;
- update();
+ queue_redraw();
}
float Line2D::get_width() const {
@@ -104,7 +104,7 @@ void Line2D::set_curve(const Ref<Curve> &p_curve) {
_curve->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Line2D::_curve_changed));
}
- update();
+ queue_redraw();
}
Ref<Curve> Line2D::get_curve() const {
@@ -118,7 +118,7 @@ Vector<Vector2> Line2D::get_points() const {
void Line2D::set_point_position(int i, Vector2 p_pos) {
ERR_FAIL_INDEX(i, _points.size());
_points.set(i, p_pos);
- update();
+ queue_redraw();
}
Vector2 Line2D::get_point_position(int i) const {
@@ -134,7 +134,7 @@ void Line2D::clear_points() {
int count = _points.size();
if (count > 0) {
_points.clear();
- update();
+ queue_redraw();
}
}
@@ -144,17 +144,17 @@ void Line2D::add_point(Vector2 p_pos, int p_atpos) {
} else {
_points.insert(p_atpos, p_pos);
}
- update();
+ queue_redraw();
}
void Line2D::remove_point(int i) {
_points.remove_at(i);
- update();
+ queue_redraw();
}
void Line2D::set_default_color(Color p_color) {
_default_color = p_color;
- update();
+ queue_redraw();
}
Color Line2D::get_default_color() const {
@@ -174,7 +174,7 @@ void Line2D::set_gradient(const Ref<Gradient> &p_gradient) {
_gradient->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Line2D::_gradient_changed));
}
- update();
+ queue_redraw();
}
Ref<Gradient> Line2D::get_gradient() const {
@@ -183,7 +183,7 @@ Ref<Gradient> Line2D::get_gradient() const {
void Line2D::set_texture(const Ref<Texture2D> &p_texture) {
_texture = p_texture;
- update();
+ queue_redraw();
}
Ref<Texture2D> Line2D::get_texture() const {
@@ -192,7 +192,7 @@ Ref<Texture2D> Line2D::get_texture() const {
void Line2D::set_texture_mode(const LineTextureMode p_mode) {
_texture_mode = p_mode;
- update();
+ queue_redraw();
}
Line2D::LineTextureMode Line2D::get_texture_mode() const {
@@ -201,7 +201,7 @@ Line2D::LineTextureMode Line2D::get_texture_mode() const {
void Line2D::set_joint_mode(LineJointMode p_mode) {
_joint_mode = p_mode;
- update();
+ queue_redraw();
}
Line2D::LineJointMode Line2D::get_joint_mode() const {
@@ -210,7 +210,7 @@ Line2D::LineJointMode Line2D::get_joint_mode() const {
void Line2D::set_begin_cap_mode(LineCapMode p_mode) {
_begin_cap_mode = p_mode;
- update();
+ queue_redraw();
}
Line2D::LineCapMode Line2D::get_begin_cap_mode() const {
@@ -219,7 +219,7 @@ Line2D::LineCapMode Line2D::get_begin_cap_mode() const {
void Line2D::set_end_cap_mode(LineCapMode p_mode) {
_end_cap_mode = p_mode;
- update();
+ queue_redraw();
}
Line2D::LineCapMode Line2D::get_end_cap_mode() const {
@@ -239,7 +239,7 @@ void Line2D::set_sharp_limit(float p_limit) {
p_limit = 0.f;
}
_sharp_limit = p_limit;
- update();
+ queue_redraw();
}
float Line2D::get_sharp_limit() const {
@@ -248,7 +248,7 @@ float Line2D::get_sharp_limit() const {
void Line2D::set_round_precision(int p_precision) {
_round_precision = MAX(1, p_precision);
- update();
+ queue_redraw();
}
int Line2D::get_round_precision() const {
@@ -257,7 +257,7 @@ int Line2D::get_round_precision() const {
void Line2D::set_antialiased(bool p_antialiased) {
_antialiased = p_antialiased;
- update();
+ queue_redraw();
}
bool Line2D::get_antialiased() const {
@@ -334,11 +334,11 @@ void Line2D::_draw() {
}
void Line2D::_gradient_changed() {
- update();
+ queue_redraw();
}
void Line2D::_curve_changed() {
- update();
+ queue_redraw();
}
// static
diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp
index 25eb9b9851..2bbe88b0e0 100644
--- a/scene/2d/line_builder.cpp
+++ b/scene/2d/line_builder.cpp
@@ -137,14 +137,14 @@ void LineBuilder::build() {
// The line's outer length will be a little higher due to begin and end caps
if (begin_cap_mode == Line2D::LINE_CAP_BOX || begin_cap_mode == Line2D::LINE_CAP_ROUND) {
if (retrieve_curve) {
- total_distance += width * curve->interpolate_baked(0.f) * 0.5f;
+ total_distance += width * curve->sample_baked(0.f) * 0.5f;
} else {
total_distance += width * 0.5f;
}
}
if (end_cap_mode == Line2D::LINE_CAP_BOX || end_cap_mode == Line2D::LINE_CAP_ROUND) {
if (retrieve_curve) {
- total_distance += width * curve->interpolate_baked(1.f) * 0.5f;
+ total_distance += width * curve->sample_baked(1.f) * 0.5f;
} else {
total_distance += width * 0.5f;
}
@@ -160,7 +160,7 @@ void LineBuilder::build() {
float uvx1 = 0.f;
if (retrieve_curve) {
- width_factor = curve->interpolate_baked(0.f);
+ width_factor = curve->sample_baked(0.f);
}
pos_up0 += u0 * hw * width_factor;
@@ -219,7 +219,7 @@ void LineBuilder::build() {
color1 = gradient->get_color_at_offset(current_distance1 / total_distance);
}
if (retrieve_curve) {
- width_factor = curve->interpolate_baked(current_distance1 / total_distance);
+ width_factor = curve->sample_baked(current_distance1 / total_distance);
}
Vector2 inner_normal0, inner_normal1;
@@ -383,7 +383,7 @@ void LineBuilder::build() {
color1 = gradient->get_color(gradient->get_points_count() - 1);
}
if (retrieve_curve) {
- width_factor = curve->interpolate_baked(1.f);
+ width_factor = curve->sample_baked(1.f);
}
Vector2 pos_up1 = pos1 + u0 * hw * width_factor;
diff --git a/scene/2d/marker_2d.cpp b/scene/2d/marker_2d.cpp
index ba1d2ffbfd..d203c58ffd 100644
--- a/scene/2d/marker_2d.cpp
+++ b/scene/2d/marker_2d.cpp
@@ -86,7 +86,7 @@ bool Marker2D::_edit_use_rect() const {
void Marker2D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
- update();
+ queue_redraw();
} break;
case NOTIFICATION_DRAW: {
@@ -102,7 +102,7 @@ void Marker2D::_notification(int p_what) {
void Marker2D::set_gizmo_extents(real_t p_extents) {
gizmo_extents = p_extents;
- update();
+ queue_redraw();
}
real_t Marker2D::get_gizmo_extents() const {
diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp
index 178addd62d..56099205d4 100644
--- a/scene/2d/mesh_instance_2d.cpp
+++ b/scene/2d/mesh_instance_2d.cpp
@@ -61,7 +61,7 @@ void MeshInstance2D::_bind_methods() {
void MeshInstance2D::set_mesh(const Ref<Mesh> &p_mesh) {
mesh = p_mesh;
- update();
+ queue_redraw();
}
Ref<Mesh> MeshInstance2D::get_mesh() const {
@@ -73,13 +73,13 @@ void MeshInstance2D::set_texture(const Ref<Texture2D> &p_texture) {
return;
}
texture = p_texture;
- update();
+ queue_redraw();
emit_signal(SceneStringNames::get_singleton()->texture_changed);
}
void MeshInstance2D::set_normal_map(const Ref<Texture2D> &p_texture) {
normal_map = p_texture;
- update();
+ queue_redraw();
}
Ref<Texture2D> MeshInstance2D::get_normal_map() const {
diff --git a/scene/2d/multimesh_instance_2d.cpp b/scene/2d/multimesh_instance_2d.cpp
index 8f72ff1757..68d529fd32 100644
--- a/scene/2d/multimesh_instance_2d.cpp
+++ b/scene/2d/multimesh_instance_2d.cpp
@@ -61,7 +61,7 @@ void MultiMeshInstance2D::_bind_methods() {
void MultiMeshInstance2D::set_multimesh(const Ref<MultiMesh> &p_multimesh) {
multimesh = p_multimesh;
- update();
+ queue_redraw();
}
Ref<MultiMesh> MultiMeshInstance2D::get_multimesh() const {
@@ -73,7 +73,7 @@ void MultiMeshInstance2D::set_texture(const Ref<Texture2D> &p_texture) {
return;
}
texture = p_texture;
- update();
+ queue_redraw();
emit_signal(SceneStringNames::get_singleton()->texture_changed);
}
@@ -83,7 +83,7 @@ Ref<Texture2D> MultiMeshInstance2D::get_texture() const {
void MultiMeshInstance2D::set_normal_map(const Ref<Texture2D> &p_texture) {
normal_map = p_texture;
- update();
+ queue_redraw();
}
Ref<Texture2D> MultiMeshInstance2D::get_normal_map() const {
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index 00aa4b0b59..ffccb95a22 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -374,7 +374,7 @@ void NavigationRegion2D::set_enabled(bool p_enabled) {
#ifdef DEBUG_ENABLED
if (Engine::get_singleton()->is_editor_hint() || NavigationServer3D::get_singleton()->get_debug_enabled()) {
- update();
+ queue_redraw();
}
#endif // DEBUG_ENABLED
}
@@ -551,7 +551,7 @@ Ref<NavigationPolygon> NavigationRegion2D::get_navigation_polygon() const {
void NavigationRegion2D::_navpoly_changed() {
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) {
- update();
+ queue_redraw();
}
if (navpoly.is_valid()) {
NavigationServer2D::get_singleton()->region_set_navpoly(region, navpoly);
@@ -561,7 +561,7 @@ void NavigationRegion2D::_navpoly_changed() {
void NavigationRegion2D::_map_changed(RID p_map) {
#ifdef DEBUG_ENABLED
if (is_inside_tree() && get_world_2d()->get_navigation_map() == p_map) {
- update();
+ queue_redraw();
}
#endif // DEBUG_ENABLED
}
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index bbc326a4b4..be17299f07 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -47,7 +47,7 @@ Rect2 Path2D::_edit_get_rect() const {
for (int i = 0; i < curve->get_point_count(); i++) {
for (int j = 0; j <= 8; j++) {
real_t frac = j / 8.0;
- Vector2 p = curve->interpolate(i, frac);
+ Vector2 p = curve->sample(i, frac);
aabb.expand_to(p);
}
}
@@ -70,7 +70,7 @@ bool Path2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc
for (int j = 1; j <= 8; j++) {
real_t frac = j / 8.0;
- s[1] = curve->interpolate(i, frac);
+ s[1] = curve->sample(i, frac);
Vector2 p = Geometry2D::get_closest_point_to_segment(p_point, s);
if (p.distance_to(p_point) <= p_tolerance) {
@@ -112,7 +112,7 @@ void Path2D::_notification(int p_what) {
for (int i = 0; i < curve->get_point_count(); i++) {
for (int j = 0; j < 8; j++) {
real_t frac = j * (1.0 / 8.0);
- Vector2 p = curve->interpolate(i, frac);
+ Vector2 p = curve->sample(i, frac);
_cached_draw_pts.set(count++, p);
}
}
@@ -131,7 +131,7 @@ void Path2D::_curve_changed() {
return;
}
- update();
+ queue_redraw();
}
void Path2D::set_curve(const Ref<Curve2D> &p_curve) {
@@ -175,7 +175,7 @@ void PathFollow2D::_update_transform() {
if (path_length == 0) {
return;
}
- Vector2 pos = c->interpolate_baked(progress, cubic);
+ Vector2 pos = c->sample_baked(progress, cubic);
if (rotates) {
real_t ahead = progress + lookahead;
@@ -195,14 +195,14 @@ void PathFollow2D::_update_transform() {
}
}
- Vector2 ahead_pos = c->interpolate_baked(ahead, cubic);
+ Vector2 ahead_pos = c->sample_baked(ahead, cubic);
Vector2 tangent_to_curve;
if (ahead_pos == pos) {
// This will happen at the end of non-looping or non-closed paths.
// We'll try a look behind instead, in order to get a meaningful angle.
tangent_to_curve =
- (pos - c->interpolate_baked(progress - lookahead, cubic)).normalized();
+ (pos - c->sample_baked(progress - lookahead, cubic)).normalized();
} else {
tangent_to_curve = (ahead_pos - pos).normalized();
}
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 8161fb5bd9..111a0df89a 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -97,7 +97,7 @@ void Polygon2D::_validate_property(PropertyInfo &p_property) const {
}
void Polygon2D::_skeleton_bone_setup_changed() {
- update();
+ queue_redraw();
}
void Polygon2D::_notification(int p_what) {
@@ -375,7 +375,7 @@ void Polygon2D::_notification(int p_what) {
void Polygon2D::set_polygon(const Vector<Vector2> &p_polygon) {
polygon = p_polygon;
rect_cache_dirty = true;
- update();
+ queue_redraw();
}
Vector<Vector2> Polygon2D::get_polygon() const {
@@ -392,7 +392,7 @@ int Polygon2D::get_internal_vertex_count() const {
void Polygon2D::set_uv(const Vector<Vector2> &p_uv) {
uv = p_uv;
- update();
+ queue_redraw();
}
Vector<Vector2> Polygon2D::get_uv() const {
@@ -401,7 +401,7 @@ Vector<Vector2> Polygon2D::get_uv() const {
void Polygon2D::set_polygons(const Array &p_polygons) {
polygons = p_polygons;
- update();
+ queue_redraw();
}
Array Polygon2D::get_polygons() const {
@@ -410,7 +410,7 @@ Array Polygon2D::get_polygons() const {
void Polygon2D::set_color(const Color &p_color) {
color = p_color;
- update();
+ queue_redraw();
}
Color Polygon2D::get_color() const {
@@ -419,7 +419,7 @@ Color Polygon2D::get_color() const {
void Polygon2D::set_vertex_colors(const Vector<Color> &p_colors) {
vertex_colors = p_colors;
- update();
+ queue_redraw();
}
Vector<Color> Polygon2D::get_vertex_colors() const {
@@ -428,7 +428,7 @@ Vector<Color> Polygon2D::get_vertex_colors() const {
void Polygon2D::set_texture(const Ref<Texture2D> &p_texture) {
texture = p_texture;
- update();
+ queue_redraw();
}
Ref<Texture2D> Polygon2D::get_texture() const {
@@ -437,7 +437,7 @@ Ref<Texture2D> Polygon2D::get_texture() const {
void Polygon2D::set_texture_offset(const Vector2 &p_offset) {
tex_ofs = p_offset;
- update();
+ queue_redraw();
}
Vector2 Polygon2D::get_texture_offset() const {
@@ -446,7 +446,7 @@ Vector2 Polygon2D::get_texture_offset() const {
void Polygon2D::set_texture_rotation(real_t p_rot) {
tex_rot = p_rot;
- update();
+ queue_redraw();
}
real_t Polygon2D::get_texture_rotation() const {
@@ -455,7 +455,7 @@ real_t Polygon2D::get_texture_rotation() const {
void Polygon2D::set_texture_scale(const Size2 &p_scale) {
tex_scale = p_scale;
- update();
+ queue_redraw();
}
Size2 Polygon2D::get_texture_scale() const {
@@ -464,7 +464,7 @@ Size2 Polygon2D::get_texture_scale() const {
void Polygon2D::set_invert(bool p_invert) {
invert = p_invert;
- update();
+ queue_redraw();
notify_property_list_changed();
}
@@ -474,7 +474,7 @@ bool Polygon2D::get_invert() const {
void Polygon2D::set_antialiased(bool p_antialiased) {
antialiased = p_antialiased;
- update();
+ queue_redraw();
}
bool Polygon2D::get_antialiased() const {
@@ -483,7 +483,7 @@ bool Polygon2D::get_antialiased() const {
void Polygon2D::set_invert_border(real_t p_invert_border) {
invert_border = p_invert_border;
- update();
+ queue_redraw();
}
real_t Polygon2D::get_invert_border() const {
@@ -493,7 +493,7 @@ real_t Polygon2D::get_invert_border() const {
void Polygon2D::set_offset(const Vector2 &p_offset) {
offset = p_offset;
rect_cache_dirty = true;
- update();
+ queue_redraw();
}
Vector2 Polygon2D::get_offset() const {
@@ -533,13 +533,13 @@ void Polygon2D::clear_bones() {
void Polygon2D::set_bone_weights(int p_index, const Vector<float> &p_weights) {
ERR_FAIL_INDEX(p_index, bone_weights.size());
bone_weights.write[p_index].weights = p_weights;
- update();
+ queue_redraw();
}
void Polygon2D::set_bone_path(int p_index, const NodePath &p_path) {
ERR_FAIL_INDEX(p_index, bone_weights.size());
bone_weights.write[p_index].path = p_path;
- update();
+ queue_redraw();
}
Array Polygon2D::_get_bones() const {
@@ -567,7 +567,7 @@ void Polygon2D::set_skeleton(const NodePath &p_skeleton) {
return;
}
skeleton = p_skeleton;
- update();
+ queue_redraw();
}
NodePath Polygon2D::get_skeleton() const {
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index c4036faa79..2c8a2e715a 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -36,7 +36,7 @@
void RayCast2D::set_target_position(const Vector2 &p_point) {
target_position = p_point;
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) {
- update();
+ queue_redraw();
}
}
@@ -100,7 +100,7 @@ Vector2 RayCast2D::get_collision_normal() const {
void RayCast2D::set_enabled(bool p_enabled) {
enabled = p_enabled;
- update();
+ queue_redraw();
if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
set_physics_process_internal(p_enabled);
}
@@ -219,7 +219,7 @@ void RayCast2D::_update_raycast_state() {
}
if (prev_collision_state != collided) {
- update();
+ queue_redraw();
}
}
diff --git a/scene/2d/shape_cast_2d.cpp b/scene/2d/shape_cast_2d.cpp
index 316988d298..a25d5934ee 100644
--- a/scene/2d/shape_cast_2d.cpp
+++ b/scene/2d/shape_cast_2d.cpp
@@ -40,7 +40,7 @@
void ShapeCast2D::set_target_position(const Vector2 &p_point) {
target_position = p_point;
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) {
- update();
+ queue_redraw();
}
}
@@ -132,7 +132,7 @@ real_t ShapeCast2D::get_closest_collision_unsafe_fraction() const {
void ShapeCast2D::set_enabled(bool p_enabled) {
enabled = p_enabled;
- update();
+ queue_redraw();
if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
set_physics_process_internal(p_enabled);
}
@@ -152,7 +152,7 @@ void ShapeCast2D::set_shape(const Ref<Shape2D> &p_shape) {
shape_rid = shape->get_rid();
}
update_configuration_warnings();
- update();
+ queue_redraw();
}
Ref<Shape2D> ShapeCast2D::get_shape() const {
@@ -182,7 +182,7 @@ bool ShapeCast2D::get_exclude_parent_body() const {
}
void ShapeCast2D::_redraw_shape() {
- update();
+ queue_redraw();
}
void ShapeCast2D::_notification(int p_what) {
@@ -325,7 +325,7 @@ void ShapeCast2D::_update_shapecast_state() {
collided = !result.is_empty();
if (prev_collision_state != collided) {
- update();
+ queue_redraw();
}
}
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp
index 13a32fbfd4..8f0bf22617 100644
--- a/scene/2d/skeleton_2d.cpp
+++ b/scene/2d/skeleton_2d.cpp
@@ -126,7 +126,7 @@ void Bone2D::_notification(int p_what) {
return;
}
- update();
+ queue_redraw();
#endif // TOOLS_ENABLED
} break;
@@ -143,12 +143,12 @@ void Bone2D::_notification(int p_what) {
return;
}
- update();
+ queue_redraw();
if (get_parent()) {
Bone2D *parent_bone = Object::cast_to<Bone2D>(get_parent());
if (parent_bone) {
- parent_bone->update();
+ parent_bone->queue_redraw();
}
}
#endif // TOOLS_ENABLED
@@ -365,7 +365,7 @@ bool Bone2D::_editor_get_bone_shape(Vector<Vector2> *p_shape, Vector<Vector2> *p
void Bone2D::_editor_set_show_bone_gizmo(bool p_show_gizmo) {
_editor_show_bone_gizmo = p_show_gizmo;
- update();
+ queue_redraw();
}
bool Bone2D::_editor_get_show_bone_gizmo() const {
@@ -493,7 +493,7 @@ void Bone2D::set_length(real_t p_length) {
length = p_length;
#ifdef TOOLS_ENABLED
- update();
+ queue_redraw();
#endif // TOOLS_ENABLED
}
@@ -505,7 +505,7 @@ void Bone2D::set_bone_angle(real_t p_angle) {
bone_angle = p_angle;
#ifdef TOOLS_ENABLED
- update();
+ queue_redraw();
#endif // TOOLS_ENABLED
}
diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp
index e1983f9cb9..0ecf8333a0 100644
--- a/scene/2d/sprite_2d.cpp
+++ b/scene/2d/sprite_2d.cpp
@@ -146,7 +146,7 @@ void Sprite2D::set_texture(const Ref<Texture2D> &p_texture) {
texture->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Sprite2D::_texture_changed));
}
- update();
+ queue_redraw();
emit_signal(SceneStringNames::get_singleton()->texture_changed);
item_rect_changed();
}
@@ -157,7 +157,7 @@ Ref<Texture2D> Sprite2D::get_texture() const {
void Sprite2D::set_centered(bool p_center) {
centered = p_center;
- update();
+ queue_redraw();
item_rect_changed();
}
@@ -167,7 +167,7 @@ bool Sprite2D::is_centered() const {
void Sprite2D::set_offset(const Point2 &p_offset) {
offset = p_offset;
- update();
+ queue_redraw();
item_rect_changed();
}
@@ -177,7 +177,7 @@ Point2 Sprite2D::get_offset() const {
void Sprite2D::set_flip_h(bool p_flip) {
hflip = p_flip;
- update();
+ queue_redraw();
}
bool Sprite2D::is_flipped_h() const {
@@ -186,7 +186,7 @@ bool Sprite2D::is_flipped_h() const {
void Sprite2D::set_flip_v(bool p_flip) {
vflip = p_flip;
- update();
+ queue_redraw();
}
bool Sprite2D::is_flipped_v() const {
@@ -199,7 +199,7 @@ void Sprite2D::set_region_enabled(bool p_region_enabled) {
}
region_enabled = p_region_enabled;
- update();
+ queue_redraw();
notify_property_list_changed();
}
@@ -225,7 +225,7 @@ Rect2 Sprite2D::get_region_rect() const {
void Sprite2D::set_region_filter_clip_enabled(bool p_region_filter_clip_enabled) {
region_filter_clip_enabled = p_region_filter_clip_enabled;
- update();
+ queue_redraw();
}
bool Sprite2D::is_region_filter_clip_enabled() const {
@@ -262,7 +262,7 @@ Vector2i Sprite2D::get_frame_coords() const {
void Sprite2D::set_vframes(int p_amount) {
ERR_FAIL_COND_MSG(p_amount < 1, "Amount of vframes cannot be smaller than 1.");
vframes = p_amount;
- update();
+ queue_redraw();
item_rect_changed();
notify_property_list_changed();
}
@@ -274,7 +274,7 @@ int Sprite2D::get_vframes() const {
void Sprite2D::set_hframes(int p_amount) {
ERR_FAIL_COND_MSG(p_amount < 1, "Amount of hframes cannot be smaller than 1.");
hframes = p_amount;
- update();
+ queue_redraw();
item_rect_changed();
notify_property_list_changed();
}
@@ -388,7 +388,7 @@ void Sprite2D::_texture_changed() {
// Changes to the texture need to trigger an update to make
// the editor redraw the sprite with the updated texture.
if (texture.is_valid()) {
- update();
+ queue_redraw();
}
}
diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp
index 9dea69cd64..b620f58ed7 100644
--- a/scene/2d/touch_screen_button.cpp
+++ b/scene/2d/touch_screen_button.cpp
@@ -34,7 +34,7 @@
void TouchScreenButton::set_texture_normal(const Ref<Texture2D> &p_texture) {
texture_normal = p_texture;
- update();
+ queue_redraw();
}
Ref<Texture2D> TouchScreenButton::get_texture_normal() const {
@@ -43,7 +43,7 @@ Ref<Texture2D> TouchScreenButton::get_texture_normal() const {
void TouchScreenButton::set_texture_pressed(const Ref<Texture2D> &p_texture_pressed) {
texture_pressed = p_texture_pressed;
- update();
+ queue_redraw();
}
Ref<Texture2D> TouchScreenButton::get_texture_pressed() const {
@@ -60,16 +60,16 @@ Ref<BitMap> TouchScreenButton::get_bitmask() const {
void TouchScreenButton::set_shape(const Ref<Shape2D> &p_shape) {
if (shape.is_valid()) {
- shape->disconnect("changed", callable_mp((CanvasItem *)this, &CanvasItem::update));
+ shape->disconnect("changed", callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
}
shape = p_shape;
if (shape.is_valid()) {
- shape->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::update));
+ shape->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
}
- update();
+ queue_redraw();
}
Ref<Shape2D> TouchScreenButton::get_shape() const {
@@ -78,7 +78,7 @@ Ref<Shape2D> TouchScreenButton::get_shape() const {
void TouchScreenButton::set_shape_centered(bool p_shape_centered) {
shape_centered = p_shape_centered;
- update();
+ queue_redraw();
}
bool TouchScreenButton::is_shape_visible() const {
@@ -87,7 +87,7 @@ bool TouchScreenButton::is_shape_visible() const {
void TouchScreenButton::set_shape_visible(bool p_shape_visible) {
shape_visible = p_shape_visible;
- update();
+ queue_redraw();
}
bool TouchScreenButton::is_shape_centered() const {
@@ -140,7 +140,7 @@ void TouchScreenButton::_notification(int p_what) {
if (!Engine::get_singleton()->is_editor_hint() && !!DisplayServer::get_singleton()->screen_is_touchscreen(DisplayServer::get_singleton()->window_get_current_screen(get_viewport()->get_window_id())) && visibility == VISIBILITY_TOUCHSCREEN_ONLY) {
return;
}
- update();
+ queue_redraw();
if (!Engine::get_singleton()->is_editor_hint()) {
set_process_input(is_visible_in_tree());
@@ -292,7 +292,7 @@ void TouchScreenButton::_press(int p_finger_pressed) {
}
emit_signal(SNAME("pressed"));
- update();
+ queue_redraw();
}
void TouchScreenButton::_release(bool p_exiting_tree) {
@@ -311,7 +311,7 @@ void TouchScreenButton::_release(bool p_exiting_tree) {
if (!p_exiting_tree) {
emit_signal(SNAME("released"));
- update();
+ queue_redraw();
}
}
@@ -339,7 +339,7 @@ Rect2 TouchScreenButton::get_anchorable_rect() const {
void TouchScreenButton::set_visibility_mode(VisibilityMode p_mode) {
visibility = p_mode;
- update();
+ queue_redraw();
}
TouchScreenButton::VisibilityMode TouchScreenButton::get_visibility_mode() const {
diff --git a/scene/2d/visible_on_screen_notifier_2d.cpp b/scene/2d/visible_on_screen_notifier_2d.cpp
index 1971dc1240..263c3a12a2 100644
--- a/scene/2d/visible_on_screen_notifier_2d.cpp
+++ b/scene/2d/visible_on_screen_notifier_2d.cpp
@@ -66,7 +66,7 @@ void VisibleOnScreenNotifier2D::set_rect(const Rect2 &p_rect) {
if (is_inside_tree()) {
RS::get_singleton()->canvas_item_set_visibility_notifier(get_canvas_item(), true, rect, callable_mp(this, &VisibleOnScreenNotifier2D::_visibility_enter), callable_mp(this, &VisibleOnScreenNotifier2D::_visibility_exit));
}
- update();
+ queue_redraw();
}
Rect2 VisibleOnScreenNotifier2D::get_rect() const {