summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/audio_stream_player_2d.cpp35
-rw-r--r--scene/2d/audio_stream_player_2d.h5
-rw-r--r--scene/2d/cpu_particles_2d.cpp2
-rw-r--r--scene/2d/physics_body_2d.cpp22
-rw-r--r--scene/2d/polygon_2d.cpp28
-rw-r--r--scene/2d/polygon_2d.h3
-rw-r--r--scene/2d/skeleton_2d.cpp3
-rw-r--r--scene/3d/audio_stream_player_3d.cpp35
-rw-r--r--scene/3d/audio_stream_player_3d.h5
-rw-r--r--scene/3d/cpu_particles.cpp2
-rw-r--r--scene/3d/particles.cpp2
-rw-r--r--scene/3d/physics_body.cpp23
-rw-r--r--scene/animation/animation_player.cpp18
-rw-r--r--scene/animation/animation_player.h2
-rw-r--r--scene/audio/audio_stream_player.cpp23
-rw-r--r--scene/audio/audio_stream_player.h3
-rw-r--r--scene/gui/text_edit.cpp5
-rw-r--r--scene/gui/texture_progress.cpp12
-rw-r--r--scene/main/viewport.cpp3
-rw-r--r--scene/resources/animation.cpp15
-rw-r--r--scene/resources/dynamic_font.h5
-rw-r--r--scene/resources/mesh.cpp6
-rw-r--r--scene/scene_string_names.cpp2
-rw-r--r--scene/scene_string_names.h2
24 files changed, 170 insertions, 91 deletions
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index 961d2b00ef..7b28ad2c12 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -37,7 +37,7 @@
void AudioStreamPlayer2D::_mix_audio() {
if (!stream_playback.is_valid() || !active ||
- (stream_paused && !stream_paused_fade_out)) {
+ (stream_paused && !stream_fade_out)) {
return;
}
@@ -50,7 +50,7 @@ void AudioStreamPlayer2D::_mix_audio() {
AudioFrame *buffer = mix_buffer.ptrw();
int buffer_size = mix_buffer.size();
- if (stream_paused_fade_out) {
+ if (stream_fade_out) {
// Short fadeout ramp
buffer_size = MIN(buffer_size, 128);
}
@@ -84,10 +84,10 @@ void AudioStreamPlayer2D::_mix_audio() {
}
//mix!
- AudioFrame target_volume = stream_paused_fade_out ? AudioFrame(0.f, 0.f) : current.vol;
- AudioFrame vol_prev = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol;
+ AudioFrame target_volume = stream_fade_out ? AudioFrame(0.f, 0.f) : current.vol;
+ AudioFrame vol_prev = stream_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol;
AudioFrame vol_inc = (target_volume - vol_prev) / float(buffer_size);
- AudioFrame vol = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : current.vol;
+ AudioFrame vol = stream_fade_in ? AudioFrame(0.f, 0.f) : current.vol;
int cc = AudioServer::get_singleton()->get_channel_count();
@@ -139,9 +139,15 @@ void AudioStreamPlayer2D::_mix_audio() {
active = false;
}
+ if (stream_stop) {
+ active = false;
+ set_physics_process_internal(false);
+ setplay = -1;
+ }
+
output_ready = false;
- stream_paused_fade_in = false;
- stream_paused_fade_out = false;
+ stream_fade_in = false;
+ stream_fade_out = false;
}
void AudioStreamPlayer2D::_notification(int p_what) {
@@ -323,6 +329,7 @@ void AudioStreamPlayer2D::play(float p_from_pos) {
}
if (stream_playback.is_valid()) {
+ stream_stop = false;
active = true;
setplay = p_from_pos;
output_ready = false;
@@ -340,9 +347,8 @@ void AudioStreamPlayer2D::seek(float p_seconds) {
void AudioStreamPlayer2D::stop() {
if (stream_playback.is_valid()) {
- active = false;
- set_physics_process_internal(false);
- setplay = -1;
+ stream_stop = true;
+ stream_fade_out = true;
}
}
@@ -457,8 +463,8 @@ void AudioStreamPlayer2D::set_stream_paused(bool p_pause) {
if (p_pause != stream_paused) {
stream_paused = p_pause;
- stream_paused_fade_in = p_pause ? false : true;
- stream_paused_fade_out = p_pause ? true : false;
+ stream_fade_in = p_pause ? false : true;
+ stream_fade_out = p_pause ? true : false;
}
}
@@ -537,8 +543,9 @@ AudioStreamPlayer2D::AudioStreamPlayer2D() {
output_ready = false;
area_mask = 1;
stream_paused = false;
- stream_paused_fade_in = false;
- stream_paused_fade_out = false;
+ stream_fade_in = false;
+ stream_fade_out = false;
+ stream_stop = false;
AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
}
diff --git a/scene/2d/audio_stream_player_2d.h b/scene/2d/audio_stream_player_2d.h
index cc00b59010..caf5c6ee49 100644
--- a/scene/2d/audio_stream_player_2d.h
+++ b/scene/2d/audio_stream_player_2d.h
@@ -73,8 +73,9 @@ private:
float pitch_scale;
bool autoplay;
bool stream_paused;
- bool stream_paused_fade_in;
- bool stream_paused_fade_out;
+ bool stream_fade_in;
+ bool stream_fade_out;
+ bool stream_stop;
StringName bus;
void _mix_audio();
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index eaed1da0ba..c50a8d4a1a 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -1189,7 +1189,7 @@ void CPUParticles2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting");
ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_EXP_RANGE, "1,1000000,1"), "set_amount", "get_amount");
ADD_GROUP("Time", "");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01,or_greater"), "set_lifetime", "get_lifetime");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_EXP_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_speed_scale", "get_speed_scale");
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index f4bc8ad6b9..44b81dc0cc 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -1290,7 +1290,7 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const
floor_velocity = collision.collider_vel;
if (p_stop_on_slope) {
- if (Vector2() == lv_n + p_floor_direction && collision.travel.length() < 1) {
+ if ((lv_n + p_floor_direction).length() < 0.01 && collision.travel.length() < 1) {
Transform2D gt = get_global_transform();
gt.elements[2] -= collision.travel.project(p_floor_direction.tangent());
set_global_transform(gt);
@@ -1338,13 +1338,21 @@ Vector2 KinematicBody2D::move_and_slide_with_snap(const Vector2 &p_linear_veloci
Transform2D gt = get_global_transform();
if (move_and_collide(p_snap, p_infinite_inertia, col, false, true)) {
- gt.elements[2] += col.travel;
- if (p_floor_direction != Vector2() && Math::acos(p_floor_direction.normalized().dot(col.normal)) < p_floor_max_angle) {
- on_floor = true;
- on_floor_body = col.collider_rid;
- floor_velocity = col.collider_vel;
+ bool apply = true;
+ if (p_floor_direction != Vector2()) {
+ if (Math::acos(p_floor_direction.normalized().dot(col.normal)) < p_floor_max_angle) {
+ on_floor = true;
+ on_floor_body = col.collider_rid;
+ floor_velocity = col.collider_vel;
+ } else {
+ apply = false;
+ }
+ }
+
+ if (apply) {
+ gt.elements[2] += col.travel;
+ set_global_transform(gt);
}
- set_global_transform(gt);
}
return ret;
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 54b304f851..1c58073f1d 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -88,6 +88,10 @@ bool Polygon2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toler
return Geometry::is_point_in_polygon(p_point - get_offset(), polygon2d);
}
+void Polygon2D::_skeleton_bone_setup_changed() {
+ update();
+}
+
void Polygon2D::_notification(int p_what) {
switch (p_what) {
@@ -102,10 +106,27 @@ void Polygon2D::_notification(int p_what) {
skeleton_node = Object::cast_to<Skeleton2D>(get_node(skeleton));
}
- if (skeleton_node)
+ ObjectID new_skeleton_id = 0;
+
+ if (skeleton_node) {
VS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), skeleton_node->get_skeleton());
- else
+ new_skeleton_id = skeleton_node->get_instance_id();
+ } else {
VS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), RID());
+ }
+
+ if (new_skeleton_id != current_skeleton_id) {
+ Object *old_skeleton = ObjectDB::get_instance(current_skeleton_id);
+ if (old_skeleton) {
+ old_skeleton->disconnect("bone_setup_changed", this, "_skeleton_bone_setup_changed");
+ }
+
+ if (skeleton_node) {
+ skeleton_node->connect("bone_setup_changed", this, "_skeleton_bone_setup_changed");
+ }
+
+ current_skeleton_id = new_skeleton_id;
+ }
Vector<Vector2> points;
Vector<Vector2> uvs;
@@ -809,6 +830,8 @@ void Polygon2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_bones", "bones"), &Polygon2D::_set_bones);
ClassDB::bind_method(D_METHOD("_get_bones"), &Polygon2D::_get_bones);
+ ClassDB::bind_method(D_METHOD("_skeleton_bone_setup_changed"), &Polygon2D::_skeleton_bone_setup_changed);
+
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "antialiased"), "set_antialiased", "get_antialiased");
@@ -846,4 +869,5 @@ Polygon2D::Polygon2D() {
color = Color(1, 1, 1);
rect_cache_dirty = true;
internal_vertices = 0;
+ current_skeleton_id = 0;
}
diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h
index c1d6ebe46e..f25b3885b0 100644
--- a/scene/2d/polygon_2d.h
+++ b/scene/2d/polygon_2d.h
@@ -65,10 +65,13 @@ class Polygon2D : public Node2D {
mutable Rect2 item_rect;
NodePath skeleton;
+ ObjectID current_skeleton_id;
Array _get_bones() const;
void _set_bones(const Array &p_bones);
+ void _skeleton_bone_setup_changed();
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp
index 2a674e64e6..aa15255384 100644
--- a/scene/2d/skeleton_2d.cpp
+++ b/scene/2d/skeleton_2d.cpp
@@ -203,6 +203,7 @@ void Skeleton2D::_update_bone_setup() {
transform_dirty = true;
_update_transform();
+ emit_signal("bone_setup_changed");
}
void Skeleton2D::_make_transform_dirty() {
@@ -291,6 +292,8 @@ void Skeleton2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_bone", "idx"), &Skeleton2D::get_bone);
ClassDB::bind_method(D_METHOD("get_skeleton"), &Skeleton2D::get_skeleton);
+
+ ADD_SIGNAL(MethodInfo("bone_setup_changed"));
}
Skeleton2D::Skeleton2D() {
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index e18bcf9035..b4bb03ff43 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -38,7 +38,7 @@
void AudioStreamPlayer3D::_mix_audio() {
if (!stream_playback.is_valid() || !active ||
- (stream_paused && !stream_paused_fade_out)) {
+ (stream_paused && !stream_fade_out)) {
return;
}
@@ -53,7 +53,7 @@ void AudioStreamPlayer3D::_mix_audio() {
AudioFrame *buffer = mix_buffer.ptrw();
int buffer_size = mix_buffer.size();
- if (stream_paused_fade_out) {
+ if (stream_fade_out) {
// Short fadeout ramp
buffer_size = MIN(buffer_size, 128);
}
@@ -109,10 +109,10 @@ void AudioStreamPlayer3D::_mix_audio() {
int buffers = AudioServer::get_singleton()->get_channel_count();
for (int k = 0; k < buffers; k++) {
- AudioFrame target_volume = stream_paused_fade_out ? AudioFrame(0.f, 0.f) : current.vol[k];
- AudioFrame vol_prev = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol[k];
+ AudioFrame target_volume = stream_fade_out ? AudioFrame(0.f, 0.f) : current.vol[k];
+ AudioFrame vol_prev = stream_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol[k];
AudioFrame vol_inc = (target_volume - vol_prev) / float(buffer_size);
- AudioFrame vol = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : current.vol[k];
+ AudioFrame vol = stream_fade_in ? AudioFrame(0.f, 0.f) : current.vol[k];
if (!AudioServer::get_singleton()->thread_has_channel_mix_buffer(current.bus_index, k))
continue; //may have been deleted, will be updated on process
@@ -198,9 +198,15 @@ void AudioStreamPlayer3D::_mix_audio() {
active = false;
}
+ if (stream_stop) {
+ active = false;
+ set_physics_process_internal(false);
+ setplay = -1;
+ }
+
output_ready = false;
- stream_paused_fade_in = false;
- stream_paused_fade_out = false;
+ stream_fade_in = false;
+ stream_fade_out = false;
}
float AudioStreamPlayer3D::_get_attenuation_db(float p_distance) const {
@@ -656,6 +662,7 @@ float AudioStreamPlayer3D::get_pitch_scale() const {
void AudioStreamPlayer3D::play(float p_from_pos) {
if (stream_playback.is_valid()) {
+ stream_stop = false;
active = true;
setplay = p_from_pos;
output_ready = false;
@@ -673,9 +680,8 @@ void AudioStreamPlayer3D::seek(float p_seconds) {
void AudioStreamPlayer3D::stop() {
if (stream_playback.is_valid()) {
- active = false;
- set_physics_process_internal(false);
- setplay = -1;
+ stream_stop = true;
+ stream_fade_out = true;
}
}
@@ -869,8 +875,8 @@ void AudioStreamPlayer3D::set_stream_paused(bool p_pause) {
if (p_pause != stream_paused) {
stream_paused = p_pause;
- stream_paused_fade_in = stream_paused ? false : true;
- stream_paused_fade_out = stream_paused ? true : false;
+ stream_fade_in = stream_paused ? false : true;
+ stream_fade_out = stream_paused ? true : false;
}
}
@@ -1008,8 +1014,9 @@ AudioStreamPlayer3D::AudioStreamPlayer3D() {
out_of_range_mode = OUT_OF_RANGE_MIX;
doppler_tracking = DOPPLER_TRACKING_DISABLED;
stream_paused = false;
- stream_paused_fade_in = false;
- stream_paused_fade_out = false;
+ stream_fade_in = false;
+ stream_fade_out = false;
+ stream_stop = false;
velocity_tracker.instance();
AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h
index 881652da64..e467c170fb 100644
--- a/scene/3d/audio_stream_player_3d.h
+++ b/scene/3d/audio_stream_player_3d.h
@@ -109,8 +109,9 @@ private:
float pitch_scale;
bool autoplay;
bool stream_paused;
- bool stream_paused_fade_in;
- bool stream_paused_fade_out;
+ bool stream_fade_in;
+ bool stream_fade_out;
+ bool stream_stop;
StringName bus;
void _mix_audio();
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index 29610cb0bf..11dfbdb1f9 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -1238,7 +1238,7 @@ void CPUParticles::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting");
ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_EXP_RANGE, "1,1000000,1"), "set_amount", "get_amount");
ADD_GROUP("Time", "");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01,or_greater"), "set_lifetime", "get_lifetime");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_EXP_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_speed_scale", "get_speed_scale");
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 78b2958400..57ab01f7be 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -354,7 +354,7 @@ void Particles::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting");
ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_EXP_RANGE, "1,1000000,1"), "set_amount", "get_amount");
ADD_GROUP("Time", "");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01,or_greater"), "set_lifetime", "get_lifetime");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_EXP_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_speed_scale", "get_speed_scale");
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 50abbd483a..f85b51af08 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -1222,7 +1222,7 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve
floor_velocity = collision.collider_vel;
if (p_stop_on_slope) {
- if (Vector3() == lv_n + p_floor_direction) {
+ if ((lv_n + p_floor_direction).length() < 0.01) {
Transform gt = get_global_transform();
gt.origin -= collision.travel;
set_global_transform(gt);
@@ -1243,6 +1243,7 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve
motion = motion.slide(p_floor_direction);
lv = lv.slide(p_floor_direction);
} else {
+
Vector3 n = collision.normal;
motion = motion.slide(n);
lv = lv.slide(n);
@@ -1280,13 +1281,21 @@ Vector3 KinematicBody::move_and_slide_with_snap(const Vector3 &p_linear_velocity
Transform gt = get_global_transform();
if (move_and_collide(p_snap, p_infinite_inertia, col, true)) {
- gt.origin += col.travel;
- if (p_floor_direction != Vector3() && Math::acos(p_floor_direction.normalized().dot(col.normal)) < p_floor_max_angle) {
- on_floor = true;
- on_floor_body = col.collider_rid;
- floor_velocity = col.collider_vel;
+
+ bool apply = true;
+ if (p_floor_direction != Vector3()) {
+ if (Math::acos(p_floor_direction.normalized().dot(col.normal)) < p_floor_max_angle) {
+ on_floor = true;
+ on_floor_body = col.collider_rid;
+ floor_velocity = col.collider_vel;
+ } else {
+ apply = false; //snapped with floor direction, but did not snap to a floor, do not snap.
+ }
+ }
+ if (apply) {
+ gt.origin += col.travel;
+ set_global_transform(gt);
}
- set_global_transform(gt);
}
return ret;
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 54be2aa159..992eb365ed 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -938,6 +938,7 @@ void AnimationPlayer::_animation_process(float p_delta) {
} else {
//stop();
playing = false;
+ playback.current.pos = 0;
_set_process(false);
if (end_notify)
emit_signal(SceneStringNames::get_singleton()->animation_finished, playback.assigned);
@@ -991,25 +992,12 @@ void AnimationPlayer::remove_animation(const StringName &p_name) {
void AnimationPlayer::_ref_anim(const Ref<Animation> &p_anim) {
- if (used_anims.has(p_anim))
- used_anims[p_anim]++;
- else {
- used_anims[p_anim] = 1;
- Ref<Animation>(p_anim)->connect("changed", this, "_animation_changed");
- }
+ Ref<Animation>(p_anim)->connect(SceneStringNames::get_singleton()->tracks_changed, this, "_animation_changed", varray(), CONNECT_REFERENCE_COUNTED);
}
void AnimationPlayer::_unref_anim(const Ref<Animation> &p_anim) {
- ERR_FAIL_COND(!used_anims.has(p_anim));
-
- int &n = used_anims[p_anim];
- n--;
- if (n == 0) {
-
- Ref<Animation>(p_anim)->disconnect("changed", this, "_animation_changed");
- used_anims.erase(p_anim);
- }
+ Ref<Animation>(p_anim)->disconnect(SceneStringNames::get_singleton()->tracks_changed, this, "_animation_changed");
}
void AnimationPlayer::rename_animation(const StringName &p_name, const StringName &p_new_name) {
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index 9bba848298..fea4819821 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -181,8 +181,6 @@ private:
int cache_update_bezier_size;
Set<TrackNodeCache *> playing_caches;
- Map<Ref<Animation>, int> used_anims;
-
uint64_t accum_pass;
float speed_scale;
float default_blend_time;
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp
index e6864e2117..5c95cf4279 100644
--- a/scene/audio/audio_stream_player.cpp
+++ b/scene/audio/audio_stream_player.cpp
@@ -94,10 +94,14 @@ void AudioStreamPlayer::_mix_audio() {
if (!stream_playback.is_valid() || !active)
return;
- if (stream_paused) {
- if (stream_paused_fade) {
- _mix_internal(true);
- stream_paused_fade = false;
+ if (stream_fade) {
+ _mix_internal(true);
+ stream_fade = false;
+
+ if (stream_stop) {
+ stream_playback->stop();
+ active = false;
+ set_process_internal(false);
}
return;
}
@@ -203,6 +207,7 @@ void AudioStreamPlayer::play(float p_from_pos) {
if (stream_playback.is_valid()) {
//mix_volume_db = volume_db; do not reset volume ramp here, can cause clicks
+ stream_stop = false;
setseek = p_from_pos;
active = true;
set_process_internal(true);
@@ -219,9 +224,8 @@ void AudioStreamPlayer::seek(float p_seconds) {
void AudioStreamPlayer::stop() {
if (stream_playback.is_valid()) {
- stream_playback->stop();
- active = false;
- set_process_internal(false);
+ stream_stop = true;
+ stream_fade = true;
}
}
@@ -295,7 +299,7 @@ void AudioStreamPlayer::set_stream_paused(bool p_pause) {
if (p_pause != stream_paused) {
stream_paused = p_pause;
- stream_paused_fade = p_pause ? true : false;
+ stream_fade = p_pause ? true : false;
}
}
@@ -385,7 +389,8 @@ AudioStreamPlayer::AudioStreamPlayer() {
setseek = -1;
active = false;
stream_paused = false;
- stream_paused_fade = false;
+ stream_fade = false;
+ stream_stop = false;
mix_target = MIX_TARGET_STEREO;
AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
diff --git a/scene/audio/audio_stream_player.h b/scene/audio/audio_stream_player.h
index 0f7713bf33..fba8ce7dd3 100644
--- a/scene/audio/audio_stream_player.h
+++ b/scene/audio/audio_stream_player.h
@@ -58,7 +58,8 @@ private:
float volume_db;
bool autoplay;
bool stream_paused;
- bool stream_paused_fade;
+ bool stream_fade;
+ bool stream_stop;
StringName bus;
MixTarget mix_target;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 4abde6cc0f..d2c56dba06 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2202,10 +2202,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
bool had_selection = selection.active;
// stuff to do when selection is active..
- if (selection.active) {
-
- if (readonly)
- return;
+ if (!readonly && selection.active) {
bool clear = false;
bool unselect = false;
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index 778d86d546..bf6a5d30bf 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -160,23 +160,27 @@ Point2 TextureProgress::unit_val_to_uv(float val) {
if (edge == 0) {
if (dir.x > 0)
continue;
- cp = -dir.x;
cq = -(edgeLeft - p.x);
+ dir.x *= 2.0 * cq;
+ cp = -dir.x;
} else if (edge == 1) {
if (dir.x < 0)
continue;
- cp = dir.x;
cq = (edgeRight - p.x);
+ dir.x *= 2.0 * cq;
+ cp = dir.x;
} else if (edge == 2) {
if (dir.y > 0)
continue;
- cp = -dir.y;
cq = -(edgeBottom - p.y);
+ dir.y *= 2.0 * cq;
+ cp = -dir.y;
} else if (edge == 3) {
if (dir.y < 0)
continue;
- cp = dir.y;
cq = (edgeTop - p.y);
+ dir.y *= 2.0 * cq;
+ cp = dir.y;
}
cr = cq / cp;
if (cr >= 0 && cr < t1)
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index cad29f13bf..f7df29fd19 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2496,6 +2496,9 @@ void Viewport::_gui_remove_control(Control *p_control) {
gui.mouse_focus = NULL;
gui.mouse_focus_mask = 0;
}
+ if (gui.last_mouse_focus == p_control) {
+ gui.last_mouse_focus = NULL;
+ }
if (gui.key_focus == p_control)
gui.key_focus = NULL;
if (gui.mouse_over == p_control)
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 3156e12c50..a7544cc031 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "animation.h"
+#include "scene/scene_string_names.h"
#include "core/math/geometry.h"
@@ -668,6 +669,7 @@ int Animation::add_track(TrackType p_type, int p_at_pos) {
}
}
emit_changed();
+ emit_signal(SceneStringNames::get_singleton()->tracks_changed);
return p_at_pos;
}
@@ -719,6 +721,7 @@ void Animation::remove_track(int p_track) {
memdelete(t);
tracks.remove(p_track);
emit_changed();
+ emit_signal(SceneStringNames::get_singleton()->tracks_changed);
}
int Animation::get_track_count() const {
@@ -737,6 +740,7 @@ void Animation::track_set_path(int p_track, const NodePath &p_path) {
ERR_FAIL_INDEX(p_track, tracks.size());
tracks[p_track]->path = p_path;
emit_changed();
+ emit_signal(SceneStringNames::get_singleton()->tracks_changed);
}
NodePath Animation::track_get_path(int p_track) const {
@@ -1410,6 +1414,8 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
} break;
}
+
+ emit_changed();
}
void Animation::track_set_key_transition(int p_track, int p_key_idx, float p_transition) {
@@ -1445,6 +1451,8 @@ void Animation::track_set_key_transition(int p_track, int p_key_idx, float p_tra
// they don't use transition
} break;
}
+
+ emit_changed();
}
template <class K>
@@ -2554,6 +2562,7 @@ void Animation::track_move_up(int p_track) {
}
emit_changed();
+ emit_signal(SceneStringNames::get_singleton()->tracks_changed);
}
void Animation::track_set_imported(int p_track, bool p_imported) {
@@ -2588,6 +2597,7 @@ void Animation::track_move_down(int p_track) {
SWAP(tracks.write[p_track], tracks.write[p_track - 1]);
}
emit_changed();
+ emit_signal(SceneStringNames::get_singleton()->tracks_changed);
}
void Animation::track_swap(int p_track, int p_with_track) {
@@ -2598,6 +2608,7 @@ void Animation::track_swap(int p_track, int p_with_track) {
return;
SWAP(tracks.write[p_track], tracks.write[p_with_track]);
emit_changed();
+ emit_signal(SceneStringNames::get_singleton()->tracks_changed);
}
void Animation::set_step(float p_step) {
@@ -2716,6 +2727,8 @@ void Animation::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "step", PROPERTY_HINT_RANGE, "0,4096,0.001"), "set_step", "get_step");
+ ADD_SIGNAL(MethodInfo("tracks_changed"));
+
BIND_ENUM_CONSTANT(TYPE_VALUE);
BIND_ENUM_CONSTANT(TYPE_TRANSFORM);
BIND_ENUM_CONSTANT(TYPE_METHOD);
@@ -2740,6 +2753,8 @@ void Animation::clear() {
tracks.clear();
loop = false;
length = 1;
+ emit_changed();
+ emit_signal(SceneStringNames::get_singleton()->tracks_changed);
}
bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, float p_alowed_linear_err, float p_alowed_angular_err, float p_max_optimizable_angle, const Vector3 &p_norm) {
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index 39e81ca43d..887c7b42c8 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -54,8 +54,9 @@ public:
struct {
uint32_t size : 16;
uint32_t outline_size : 8;
- bool mipmaps : 1;
- bool filter : 1;
+ uint32_t mipmaps : 1;
+ uint32_t filter : 1;
+ uint32_t unused : 6;
};
uint32_t key;
};
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 805d30245a..a9878ef5c1 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -787,7 +787,6 @@ void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array &
Surface s;
VisualServer::get_singleton()->mesh_add_surface_from_arrays(mesh, (VisualServer::PrimitiveType)p_primitive, p_arrays, p_blend_shapes, p_flags);
- surfaces.push_back(s);
/* make aABB? */ {
@@ -808,8 +807,9 @@ void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array &
aabb.expand_to(vtx[i]);
}
- surfaces.write[surfaces.size() - 1].aabb = aabb;
- surfaces.write[surfaces.size() - 1].is_2d = arr.get_type() == Variant::POOL_VECTOR2_ARRAY;
+ s.aabb = aabb;
+ s.is_2d = arr.get_type() == Variant::POOL_VECTOR2_ARRAY;
+ surfaces.push_back(s);
_recompute_aabb();
}
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index 305e4fc735..634f4d7160 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -203,4 +203,6 @@ SceneStringNames::SceneStringNames() {
_mesh_changed = StaticCString::create("_mesh_changed");
parameters_base_path = "parameters/";
+
+ tracks_changed = "tracks_changed";
}
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 4d1a7f255c..bc75165b8c 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -205,6 +205,8 @@ public:
StringName parameters_base_path;
+ StringName tracks_changed;
+
enum {
MAX_MATERIALS = 32
};