summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/Animation.xml108
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--scene/2d/cpu_particles_2d.cpp141
-rw-r--r--scene/2d/cpu_particles_2d.h1
-rw-r--r--scene/2d/touch_screen_button.cpp8
-rw-r--r--scene/3d/cpu_particles.cpp168
-rw-r--r--scene/3d/cpu_particles.h1
-rw-r--r--scene/gui/text_edit.cpp33
-rw-r--r--scene/resources/animation.cpp108
9 files changed, 311 insertions, 259 deletions
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index bc64cfbb19..97da8c9980 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -34,7 +34,7 @@
<method name="animation_track_get_key_animation" qualifiers="const">
<return type="String">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -44,7 +44,7 @@
<method name="animation_track_insert_key">
<return type="int">
</return>
- <argument index="0" name="track" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time" type="float">
</argument>
@@ -56,7 +56,7 @@
<method name="animation_track_set_key_animation">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -68,7 +68,7 @@
<method name="audio_track_get_key_end_offset" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -78,7 +78,7 @@
<method name="audio_track_get_key_start_offset" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -88,7 +88,7 @@
<method name="audio_track_get_key_stream" qualifiers="const">
<return type="Resource">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -98,7 +98,7 @@
<method name="audio_track_insert_key">
<return type="int">
</return>
- <argument index="0" name="track" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time" type="float">
</argument>
@@ -114,7 +114,7 @@
<method name="audio_track_set_key_end_offset">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -126,7 +126,7 @@
<method name="audio_track_set_key_start_offset">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -138,7 +138,7 @@
<method name="audio_track_set_key_stream">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -150,7 +150,7 @@
<method name="bezier_track_get_key_in_handle" qualifiers="const">
<return type="Vector2">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -160,7 +160,7 @@
<method name="bezier_track_get_key_out_handle" qualifiers="const">
<return type="Vector2">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -170,7 +170,7 @@
<method name="bezier_track_get_key_value" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -180,7 +180,7 @@
<method name="bezier_track_insert_key">
<return type="int">
</return>
- <argument index="0" name="track" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time" type="float">
</argument>
@@ -196,7 +196,7 @@
<method name="bezier_track_interpolate" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="track" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time" type="float">
</argument>
@@ -206,7 +206,7 @@
<method name="bezier_track_set_key_in_handle">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -218,7 +218,7 @@
<method name="bezier_track_set_key_out_handle">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -230,7 +230,7 @@
<method name="bezier_track_set_key_value">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -249,7 +249,7 @@
<method name="copy_track">
<return type="void">
</return>
- <argument index="0" name="track" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="to_animation" type="Animation">
</argument>
@@ -276,7 +276,7 @@
<method name="method_track_get_key_indices" qualifiers="const">
<return type="PoolIntArray">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time_sec" type="float">
</argument>
@@ -289,7 +289,7 @@
<method name="method_track_get_name" qualifiers="const">
<return type="String">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -300,7 +300,7 @@
<method name="method_track_get_params" qualifiers="const">
<return type="Array">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -311,7 +311,7 @@
<method name="remove_track">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Removes a track by specifying the track index.
@@ -320,7 +320,7 @@
<method name="track_find_key" qualifiers="const">
<return type="int">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time" type="float">
</argument>
@@ -333,7 +333,7 @@
<method name="track_get_interpolation_loop_wrap" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Returns [code]true[/code] if the track at [code]idx[/code] wraps the interpolation loop. New tracks wrap the interpolation loop by default.
@@ -342,7 +342,7 @@
<method name="track_get_interpolation_type" qualifiers="const">
<return type="int" enum="Animation.InterpolationType">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Returns the interpolation type of a given track.
@@ -351,7 +351,7 @@
<method name="track_get_key_count" qualifiers="const">
<return type="int">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Returns the amount of keys in a given track.
@@ -360,7 +360,7 @@
<method name="track_get_key_time" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -371,7 +371,7 @@
<method name="track_get_key_transition" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -382,7 +382,7 @@
<method name="track_get_key_value" qualifiers="const">
<return type="Variant">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -393,7 +393,7 @@
<method name="track_get_path" qualifiers="const">
<return type="NodePath">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Gets the path of a track. For more information on the path format, see [method track_set_path].
@@ -402,7 +402,7 @@
<method name="track_get_type" qualifiers="const">
<return type="int" enum="Animation.TrackType">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Gets the type of a track.
@@ -411,7 +411,7 @@
<method name="track_insert_key">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time" type="float">
</argument>
@@ -426,7 +426,7 @@
<method name="track_is_enabled" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Returns [code]true[/code] if the track at index [code]idx[/code] is enabled.
@@ -435,7 +435,7 @@
<method name="track_is_imported" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Returns [code]true[/code] if the given track is imported. Else, return [code]false[/code].
@@ -444,7 +444,7 @@
<method name="track_move_down">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Moves a track down.
@@ -453,7 +453,7 @@
<method name="track_move_to">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="to_idx" type="int">
</argument>
@@ -464,7 +464,7 @@
<method name="track_move_up">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Moves a track up.
@@ -473,7 +473,7 @@
<method name="track_remove_key">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -484,7 +484,7 @@
<method name="track_remove_key_at_position">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="position" type="float">
</argument>
@@ -495,7 +495,7 @@
<method name="track_set_enabled">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="enabled" type="bool">
</argument>
@@ -506,7 +506,7 @@
<method name="track_set_imported">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="imported" type="bool">
</argument>
@@ -517,7 +517,7 @@
<method name="track_set_interpolation_loop_wrap">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="interpolation" type="bool">
</argument>
@@ -528,7 +528,7 @@
<method name="track_set_interpolation_type">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="interpolation" type="int" enum="Animation.InterpolationType">
</argument>
@@ -539,7 +539,7 @@
<method name="track_set_key_time">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -552,7 +552,7 @@
<method name="track_set_key_transition">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key_idx" type="int">
</argument>
@@ -565,7 +565,7 @@
<method name="track_set_key_value">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="key" type="int">
</argument>
@@ -578,7 +578,7 @@
<method name="track_set_path">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="path" type="NodePath">
</argument>
@@ -590,7 +590,7 @@
<method name="track_swap">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="with_idx" type="int">
</argument>
@@ -601,7 +601,7 @@
<method name="transform_track_insert_key">
<return type="int">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time" type="float">
</argument>
@@ -618,7 +618,7 @@
<method name="transform_track_interpolate" qualifiers="const">
<return type="Array">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time_sec" type="float">
</argument>
@@ -629,7 +629,7 @@
<method name="value_track_get_key_indices" qualifiers="const">
<return type="PoolIntArray">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time_sec" type="float">
</argument>
@@ -642,7 +642,7 @@
<method name="value_track_get_update_mode" qualifiers="const">
<return type="int" enum="Animation.UpdateMode">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<description>
Returns the update mode of a value track.
@@ -651,7 +651,7 @@
<method name="value_track_set_update_mode">
<return type="void">
</return>
- <argument index="0" name="idx" type="int">
+ <argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="mode" type="int" enum="Animation.UpdateMode">
</argument>
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 2c3a84857a..6e2a4810cd 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -56,6 +56,7 @@
#include "editor/editor_help.h"
#include "editor/editor_properties.h"
#include "editor/editor_settings.h"
+#include "editor/editor_spin_slider.h"
#include "editor/editor_themes.h"
#include "editor/import/editor_import_collada.h"
#include "editor/import/editor_scene_importer_gltf.h"
@@ -3558,6 +3559,7 @@ void EditorNode::register_editor_types() {
ClassDB::register_class<AnimationTrackEditPlugin>();
ClassDB::register_class<ScriptCreateDialog>();
ClassDB::register_class<EditorFeatureProfile>();
+ ClassDB::register_class<EditorSpinSlider>();
// FIXME: Is this stuff obsolete, or should it be ported to new APIs?
ClassDB::register_class<EditorScenePostImport>();
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 85c423964b..9da41914d7 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -37,6 +37,9 @@
void CPUParticles2D::set_emitting(bool p_emitting) {
+ if (emitting == p_emitting)
+ return;
+
emitting = p_emitting;
if (emitting)
set_process_internal(true);
@@ -535,6 +538,74 @@ static float rand_from_seed(uint32_t &seed) {
return float(seed % uint32_t(65536)) / 65535.0;
}
+void CPUParticles2D::_update_internal() {
+
+ if (particles.size() == 0 || !is_visible_in_tree()) {
+ _set_redraw(false);
+ return;
+ }
+
+ float delta = get_process_delta_time();
+ if (emitting) {
+ inactive_time = 0;
+ } else {
+ inactive_time += delta;
+ if (inactive_time > lifetime * 1.2) {
+ set_process_internal(false);
+ _set_redraw(false);
+
+ //reset variables
+ time = 0;
+ inactive_time = 0;
+ frame_remainder = 0;
+ cycle = 0;
+ return;
+ }
+ }
+ _set_redraw(true);
+
+ if (time == 0 && pre_process_time > 0.0) {
+
+ float frame_time;
+ if (fixed_fps > 0)
+ frame_time = 1.0 / fixed_fps;
+ else
+ frame_time = 1.0 / 30.0;
+
+ float todo = pre_process_time;
+
+ while (todo >= 0) {
+ _particles_process(frame_time);
+ todo -= frame_time;
+ }
+ }
+
+ if (fixed_fps > 0) {
+ float frame_time = 1.0 / fixed_fps;
+ float decr = frame_time;
+
+ float ldelta = delta;
+ if (ldelta > 0.1) { //avoid recursive stalls if fps goes below 10
+ ldelta = 0.1;
+ } else if (ldelta <= 0.0) { //unlikely but..
+ ldelta = 0.001;
+ }
+ float todo = frame_remainder + ldelta;
+
+ while (todo >= frame_time) {
+ _particles_process(frame_time);
+ todo -= decr;
+ }
+
+ frame_remainder = todo;
+
+ } else {
+ _particles_process(delta);
+ }
+
+ _update_particle_data_buffer();
+}
+
void CPUParticles2D::_particles_process(float p_delta) {
p_delta *= speed_scale;
@@ -1000,6 +1071,10 @@ void CPUParticles2D::_notification(int p_what) {
}
if (p_what == NOTIFICATION_DRAW) {
+ // first update before rendering to avoid one frame delay after emitting starts
+ if (emitting && (time == 0))
+ _update_internal();
+
if (!redraw)
return; // don't add to render list
@@ -1017,71 +1092,7 @@ void CPUParticles2D::_notification(int p_what) {
}
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
-
- if (particles.size() == 0 || !is_visible_in_tree()) {
- _set_redraw(false);
- return;
- }
-
- float delta = get_process_delta_time();
- if (emitting) {
- inactive_time = 0;
- } else {
- inactive_time += delta;
- if (inactive_time > lifetime * 1.2) {
- set_process_internal(false);
- _set_redraw(false);
-
- //reset variables
- time = 0;
- inactive_time = 0;
- frame_remainder = 0;
- cycle = 0;
- return;
- }
- }
- _set_redraw(true);
-
- if (time == 0 && pre_process_time > 0.0) {
-
- float frame_time;
- if (fixed_fps > 0)
- frame_time = 1.0 / fixed_fps;
- else
- frame_time = 1.0 / 30.0;
-
- float todo = pre_process_time;
-
- while (todo >= 0) {
- _particles_process(frame_time);
- todo -= frame_time;
- }
- }
-
- if (fixed_fps > 0) {
- float frame_time = 1.0 / fixed_fps;
- float decr = frame_time;
-
- float ldelta = delta;
- if (ldelta > 0.1) { //avoid recursive stalls if fps goes below 10
- ldelta = 0.1;
- } else if (ldelta <= 0.0) { //unlikely but..
- ldelta = 0.001;
- }
- float todo = frame_remainder + ldelta;
-
- while (todo >= frame_time) {
- _particles_process(frame_time);
- todo -= decr;
- }
-
- frame_remainder = todo;
-
- } else {
- _particles_process(delta);
- }
-
- _update_particle_data_buffer();
+ _update_internal();
}
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h
index da668664b9..47b4568dd4 100644
--- a/scene/2d/cpu_particles_2d.h
+++ b/scene/2d/cpu_particles_2d.h
@@ -174,6 +174,7 @@ private:
Vector2 gravity;
+ void _update_internal();
void _particles_process(float p_delta);
void _update_particle_data_buffer();
diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp
index 9a1a759e72..cf68528388 100644
--- a/scene/2d/touch_screen_button.cpp
+++ b/scene/2d/touch_screen_button.cpp
@@ -325,8 +325,12 @@ void TouchScreenButton::_release(bool p_exiting_tree) {
}
Rect2 TouchScreenButton::_edit_get_rect() const {
- if (texture.is_null())
- return CanvasItem::_edit_get_rect();
+ if (texture.is_null()) {
+ if (shape.is_valid())
+ return shape->get_rect();
+ else
+ return CanvasItem::_edit_get_rect();
+ }
return Rect2(Size2(), texture->get_size());
}
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index 93ff60bc4e..5c895ecf22 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -46,9 +46,17 @@ PoolVector<Face3> CPUParticles::get_faces(uint32_t p_usage_flags) const {
void CPUParticles::set_emitting(bool p_emitting) {
+ if (emitting == p_emitting)
+ return;
+
emitting = p_emitting;
- if (emitting)
+ if (emitting) {
set_process_internal(true);
+
+ // first update before rendering to avoid one frame delay after emitting starts
+ if (time == 0)
+ _update_internal();
+ }
}
void CPUParticles::set_amount(int p_amount) {
@@ -508,6 +516,81 @@ static float rand_from_seed(uint32_t &seed) {
return float(seed % uint32_t(65536)) / 65535.0;
}
+void CPUParticles::_update_internal() {
+
+ if (particles.size() == 0 || !is_visible_in_tree()) {
+ _set_redraw(false);
+ return;
+ }
+
+ float delta = get_process_delta_time();
+ if (emitting) {
+ inactive_time = 0;
+ } else {
+ inactive_time += delta;
+ if (inactive_time > lifetime * 1.2) {
+ set_process_internal(false);
+ _set_redraw(false);
+
+ //reset variables
+ time = 0;
+ inactive_time = 0;
+ frame_remainder = 0;
+ cycle = 0;
+ return;
+ }
+ }
+ _set_redraw(true);
+
+ bool processed = false;
+
+ if (time == 0 && pre_process_time > 0.0) {
+
+ float frame_time;
+ if (fixed_fps > 0)
+ frame_time = 1.0 / fixed_fps;
+ else
+ frame_time = 1.0 / 30.0;
+
+ float todo = pre_process_time;
+
+ while (todo >= 0) {
+ _particles_process(frame_time);
+ processed = true;
+ todo -= frame_time;
+ }
+ }
+
+ if (fixed_fps > 0) {
+ float frame_time = 1.0 / fixed_fps;
+ float decr = frame_time;
+
+ float ldelta = delta;
+ if (ldelta > 0.1) { //avoid recursive stalls if fps goes below 10
+ ldelta = 0.1;
+ } else if (ldelta <= 0.0) { //unlikely but..
+ ldelta = 0.001;
+ }
+ float todo = frame_remainder + ldelta;
+
+ while (todo >= frame_time) {
+ _particles_process(frame_time);
+ processed = true;
+ todo -= decr;
+ }
+
+ frame_remainder = todo;
+
+ } else {
+ _particles_process(delta);
+ processed = true;
+ }
+
+ if (processed) {
+ _update_particle_data_buffer();
+ }
+}
+
void CPUParticles::_particles_process(float p_delta) {
p_delta *= speed_scale;
@@ -1068,85 +1151,24 @@ void CPUParticles::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
set_process_internal(emitting);
+
+ // first update before rendering to avoid one frame delay after emitting starts
+ if (emitting && (time == 0))
+ _update_internal();
}
if (p_what == NOTIFICATION_EXIT_TREE) {
_set_redraw(false);
}
- if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
-
- if (particles.size() == 0 || !is_visible_in_tree()) {
- _set_redraw(false);
- return;
- }
-
- float delta = get_process_delta_time();
- if (emitting) {
- inactive_time = 0;
- } else {
- inactive_time += delta;
- if (inactive_time > lifetime * 1.2) {
- set_process_internal(false);
- _set_redraw(false);
-
- //reset variables
- time = 0;
- inactive_time = 0;
- frame_remainder = 0;
- cycle = 0;
- return;
- }
- }
- _set_redraw(true);
-
- bool processed = false;
-
- if (time == 0 && pre_process_time > 0.0) {
-
- float frame_time;
- if (fixed_fps > 0)
- frame_time = 1.0 / fixed_fps;
- else
- frame_time = 1.0 / 30.0;
-
- float todo = pre_process_time;
-
- while (todo >= 0) {
- _particles_process(frame_time);
- processed = true;
- todo -= frame_time;
- }
- }
-
- if (fixed_fps > 0) {
- float frame_time = 1.0 / fixed_fps;
- float decr = frame_time;
-
- float ldelta = delta;
- if (ldelta > 0.1) { //avoid recursive stalls if fps goes below 10
- ldelta = 0.1;
- } else if (ldelta <= 0.0) { //unlikely but..
- ldelta = 0.001;
- }
- float todo = frame_remainder + ldelta;
-
- while (todo >= frame_time) {
- _particles_process(frame_time);
- processed = true;
- todo -= decr;
- }
-
- frame_remainder = todo;
-
- } else {
- _particles_process(delta);
- processed = true;
- }
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+ // first update before rendering to avoid one frame delay after emitting starts
+ if (emitting && (time == 0))
+ _update_internal();
+ }
- if (processed) {
- _update_particle_data_buffer();
- }
+ if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
+ _update_internal();
}
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
diff --git a/scene/3d/cpu_particles.h b/scene/3d/cpu_particles.h
index 66b37f359a..635265be7f 100644
--- a/scene/3d/cpu_particles.h
+++ b/scene/3d/cpu_particles.h
@@ -173,6 +173,7 @@ private:
Vector3 gravity;
+ void _update_internal();
void _particles_process(float p_delta);
void _update_particle_data_buffer();
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 69d076c41b..e35d858635 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2843,19 +2843,30 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
// No need to indent if we are going upwards.
if (auto_indent && !(k->get_command() && k->get_shift())) {
- // Indent once again if previous line will end with ':' or '{' and the line is not a comment
+ // Indent once again if previous line will end with ':','{','[','(' and the line is not a comment
// (i.e. colon/brace precedes current cursor position).
- if (cursor.column > 0 && (text[cursor.line][cursor.column - 1] == ':' || text[cursor.line][cursor.column - 1] == '{') && !is_line_comment(cursor.line)) {
- if (indent_using_spaces) {
- ins += space_indent;
- } else {
- ins += "\t";
- }
+ if (cursor.column > 0) {
+ char prev_char = text[cursor.line][cursor.column - 1];
+ switch (prev_char) {
+ case ':':
+ case '{':
+ case '[':
+ case '(': {
+ if (!is_line_comment(cursor.line)) {
+ if (indent_using_spaces) {
+ ins += space_indent;
+ } else {
+ ins += "\t";
+ }
- // No need to move the brace below if we are not taking the text with us.
- if (text[cursor.line][cursor.column] == '}' && !k->get_command()) {
- brace_indent = true;
- ins += "\n" + ins.substr(1, ins.length() - 2);
+ // No need to move the brace below if we are not taking the text with us.
+ char closing_char = _get_right_pair_symbol(prev_char);
+ if ((closing_char != 0) && (closing_char == text[cursor.line][cursor.column]) && !k->get_command()) {
+ brace_indent = true;
+ ins += "\n" + ins.substr(1, ins.length() - 2);
+ }
+ }
+ } break;
}
}
}
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 985b38f913..d932545da4 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -2741,77 +2741,77 @@ void Animation::copy_track(int p_track, Ref<Animation> p_to_animation) {
void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_track", "type", "at_position"), &Animation::add_track, DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("remove_track", "idx"), &Animation::remove_track);
+ ClassDB::bind_method(D_METHOD("remove_track", "track_idx"), &Animation::remove_track);
ClassDB::bind_method(D_METHOD("get_track_count"), &Animation::get_track_count);
- ClassDB::bind_method(D_METHOD("track_get_type", "idx"), &Animation::track_get_type);
- ClassDB::bind_method(D_METHOD("track_get_path", "idx"), &Animation::track_get_path);
- ClassDB::bind_method(D_METHOD("track_set_path", "idx", "path"), &Animation::track_set_path);
+ ClassDB::bind_method(D_METHOD("track_get_type", "track_idx"), &Animation::track_get_type);
+ ClassDB::bind_method(D_METHOD("track_get_path", "track_idx"), &Animation::track_get_path);
+ ClassDB::bind_method(D_METHOD("track_set_path", "track_idx", "path"), &Animation::track_set_path);
ClassDB::bind_method(D_METHOD("find_track", "path"), &Animation::find_track);
- ClassDB::bind_method(D_METHOD("track_move_up", "idx"), &Animation::track_move_up);
- ClassDB::bind_method(D_METHOD("track_move_down", "idx"), &Animation::track_move_down);
- ClassDB::bind_method(D_METHOD("track_move_to", "idx", "to_idx"), &Animation::track_move_to);
- ClassDB::bind_method(D_METHOD("track_swap", "idx", "with_idx"), &Animation::track_swap);
+ ClassDB::bind_method(D_METHOD("track_move_up", "track_idx"), &Animation::track_move_up);
+ ClassDB::bind_method(D_METHOD("track_move_down", "track_idx"), &Animation::track_move_down);
+ ClassDB::bind_method(D_METHOD("track_move_to", "track_idx", "to_idx"), &Animation::track_move_to);
+ ClassDB::bind_method(D_METHOD("track_swap", "track_idx", "with_idx"), &Animation::track_swap);
- ClassDB::bind_method(D_METHOD("track_set_imported", "idx", "imported"), &Animation::track_set_imported);
- ClassDB::bind_method(D_METHOD("track_is_imported", "idx"), &Animation::track_is_imported);
+ ClassDB::bind_method(D_METHOD("track_set_imported", "track_idx", "imported"), &Animation::track_set_imported);
+ ClassDB::bind_method(D_METHOD("track_is_imported", "track_idx"), &Animation::track_is_imported);
- ClassDB::bind_method(D_METHOD("track_set_enabled", "idx", "enabled"), &Animation::track_set_enabled);
- ClassDB::bind_method(D_METHOD("track_is_enabled", "idx"), &Animation::track_is_enabled);
+ ClassDB::bind_method(D_METHOD("track_set_enabled", "track_idx", "enabled"), &Animation::track_set_enabled);
+ ClassDB::bind_method(D_METHOD("track_is_enabled", "track_idx"), &Animation::track_is_enabled);
- ClassDB::bind_method(D_METHOD("transform_track_insert_key", "idx", "time", "location", "rotation", "scale"), &Animation::transform_track_insert_key);
- ClassDB::bind_method(D_METHOD("track_insert_key", "idx", "time", "key", "transition"), &Animation::track_insert_key, DEFVAL(1));
- ClassDB::bind_method(D_METHOD("track_remove_key", "idx", "key_idx"), &Animation::track_remove_key);
- ClassDB::bind_method(D_METHOD("track_remove_key_at_position", "idx", "position"), &Animation::track_remove_key_at_position);
- ClassDB::bind_method(D_METHOD("track_set_key_value", "idx", "key", "value"), &Animation::track_set_key_value);
- ClassDB::bind_method(D_METHOD("track_set_key_transition", "idx", "key_idx", "transition"), &Animation::track_set_key_transition);
- ClassDB::bind_method(D_METHOD("track_set_key_time", "idx", "key_idx", "time"), &Animation::track_set_key_time);
- ClassDB::bind_method(D_METHOD("track_get_key_transition", "idx", "key_idx"), &Animation::track_get_key_transition);
+ ClassDB::bind_method(D_METHOD("transform_track_insert_key", "track_idx", "time", "location", "rotation", "scale"), &Animation::transform_track_insert_key);
+ ClassDB::bind_method(D_METHOD("track_insert_key", "track_idx", "time", "key", "transition"), &Animation::track_insert_key, DEFVAL(1));
+ ClassDB::bind_method(D_METHOD("track_remove_key", "track_idx", "key_idx"), &Animation::track_remove_key);
+ ClassDB::bind_method(D_METHOD("track_remove_key_at_position", "track_idx", "position"), &Animation::track_remove_key_at_position);
+ ClassDB::bind_method(D_METHOD("track_set_key_value", "track_idx", "key", "value"), &Animation::track_set_key_value);
+ ClassDB::bind_method(D_METHOD("track_set_key_transition", "track_idx", "key_idx", "transition"), &Animation::track_set_key_transition);
+ ClassDB::bind_method(D_METHOD("track_set_key_time", "track_idx", "key_idx", "time"), &Animation::track_set_key_time);
+ ClassDB::bind_method(D_METHOD("track_get_key_transition", "track_idx", "key_idx"), &Animation::track_get_key_transition);
- ClassDB::bind_method(D_METHOD("track_get_key_count", "idx"), &Animation::track_get_key_count);
- ClassDB::bind_method(D_METHOD("track_get_key_value", "idx", "key_idx"), &Animation::track_get_key_value);
- ClassDB::bind_method(D_METHOD("track_get_key_time", "idx", "key_idx"), &Animation::track_get_key_time);
- ClassDB::bind_method(D_METHOD("track_find_key", "idx", "time", "exact"), &Animation::track_find_key, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("track_get_key_count", "track_idx"), &Animation::track_get_key_count);
+ ClassDB::bind_method(D_METHOD("track_get_key_value", "track_idx", "key_idx"), &Animation::track_get_key_value);
+ ClassDB::bind_method(D_METHOD("track_get_key_time", "track_idx", "key_idx"), &Animation::track_get_key_time);
+ ClassDB::bind_method(D_METHOD("track_find_key", "track_idx", "time", "exact"), &Animation::track_find_key, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("track_set_interpolation_type", "idx", "interpolation"), &Animation::track_set_interpolation_type);
- ClassDB::bind_method(D_METHOD("track_get_interpolation_type", "idx"), &Animation::track_get_interpolation_type);
+ ClassDB::bind_method(D_METHOD("track_set_interpolation_type", "track_idx", "interpolation"), &Animation::track_set_interpolation_type);
+ ClassDB::bind_method(D_METHOD("track_get_interpolation_type", "track_idx"), &Animation::track_get_interpolation_type);
- ClassDB::bind_method(D_METHOD("track_set_interpolation_loop_wrap", "idx", "interpolation"), &Animation::track_set_interpolation_loop_wrap);
- ClassDB::bind_method(D_METHOD("track_get_interpolation_loop_wrap", "idx"), &Animation::track_get_interpolation_loop_wrap);
+ ClassDB::bind_method(D_METHOD("track_set_interpolation_loop_wrap", "track_idx", "interpolation"), &Animation::track_set_interpolation_loop_wrap);
+ ClassDB::bind_method(D_METHOD("track_get_interpolation_loop_wrap", "track_idx"), &Animation::track_get_interpolation_loop_wrap);
- ClassDB::bind_method(D_METHOD("transform_track_interpolate", "idx", "time_sec"), &Animation::_transform_track_interpolate);
- ClassDB::bind_method(D_METHOD("value_track_set_update_mode", "idx", "mode"), &Animation::value_track_set_update_mode);
- ClassDB::bind_method(D_METHOD("value_track_get_update_mode", "idx"), &Animation::value_track_get_update_mode);
+ ClassDB::bind_method(D_METHOD("transform_track_interpolate", "track_idx", "time_sec"), &Animation::_transform_track_interpolate);
+ ClassDB::bind_method(D_METHOD("value_track_set_update_mode", "track_idx", "mode"), &Animation::value_track_set_update_mode);
+ ClassDB::bind_method(D_METHOD("value_track_get_update_mode", "track_idx"), &Animation::value_track_get_update_mode);
- ClassDB::bind_method(D_METHOD("value_track_get_key_indices", "idx", "time_sec", "delta"), &Animation::_value_track_get_key_indices);
+ ClassDB::bind_method(D_METHOD("value_track_get_key_indices", "track_idx", "time_sec", "delta"), &Animation::_value_track_get_key_indices);
- ClassDB::bind_method(D_METHOD("method_track_get_key_indices", "idx", "time_sec", "delta"), &Animation::_method_track_get_key_indices);
- ClassDB::bind_method(D_METHOD("method_track_get_name", "idx", "key_idx"), &Animation::method_track_get_name);
- ClassDB::bind_method(D_METHOD("method_track_get_params", "idx", "key_idx"), &Animation::method_track_get_params);
+ ClassDB::bind_method(D_METHOD("method_track_get_key_indices", "track_idx", "time_sec", "delta"), &Animation::_method_track_get_key_indices);
+ ClassDB::bind_method(D_METHOD("method_track_get_name", "track_idx", "key_idx"), &Animation::method_track_get_name);
+ ClassDB::bind_method(D_METHOD("method_track_get_params", "track_idx", "key_idx"), &Animation::method_track_get_params);
- ClassDB::bind_method(D_METHOD("bezier_track_insert_key", "track", "time", "value", "in_handle", "out_handle"), &Animation::bezier_track_insert_key, DEFVAL(Vector2()), DEFVAL(Vector2()));
+ ClassDB::bind_method(D_METHOD("bezier_track_insert_key", "track_idx", "time", "value", "in_handle", "out_handle"), &Animation::bezier_track_insert_key, DEFVAL(Vector2()), DEFVAL(Vector2()));
- ClassDB::bind_method(D_METHOD("bezier_track_set_key_value", "idx", "key_idx", "value"), &Animation::bezier_track_set_key_value);
- ClassDB::bind_method(D_METHOD("bezier_track_set_key_in_handle", "idx", "key_idx", "in_handle"), &Animation::bezier_track_set_key_in_handle);
- ClassDB::bind_method(D_METHOD("bezier_track_set_key_out_handle", "idx", "key_idx", "out_handle"), &Animation::bezier_track_set_key_out_handle);
+ ClassDB::bind_method(D_METHOD("bezier_track_set_key_value", "track_idx", "key_idx", "value"), &Animation::bezier_track_set_key_value);
+ ClassDB::bind_method(D_METHOD("bezier_track_set_key_in_handle", "track_idx", "key_idx", "in_handle"), &Animation::bezier_track_set_key_in_handle);
+ ClassDB::bind_method(D_METHOD("bezier_track_set_key_out_handle", "track_idx", "key_idx", "out_handle"), &Animation::bezier_track_set_key_out_handle);
- ClassDB::bind_method(D_METHOD("bezier_track_get_key_value", "idx", "key_idx"), &Animation::bezier_track_get_key_value);
- ClassDB::bind_method(D_METHOD("bezier_track_get_key_in_handle", "idx", "key_idx"), &Animation::bezier_track_get_key_in_handle);
- ClassDB::bind_method(D_METHOD("bezier_track_get_key_out_handle", "idx", "key_idx"), &Animation::bezier_track_get_key_out_handle);
+ ClassDB::bind_method(D_METHOD("bezier_track_get_key_value", "track_idx", "key_idx"), &Animation::bezier_track_get_key_value);
+ ClassDB::bind_method(D_METHOD("bezier_track_get_key_in_handle", "track_idx", "key_idx"), &Animation::bezier_track_get_key_in_handle);
+ ClassDB::bind_method(D_METHOD("bezier_track_get_key_out_handle", "track_idx", "key_idx"), &Animation::bezier_track_get_key_out_handle);
- ClassDB::bind_method(D_METHOD("bezier_track_interpolate", "track", "time"), &Animation::bezier_track_interpolate);
+ ClassDB::bind_method(D_METHOD("bezier_track_interpolate", "track_idx", "time"), &Animation::bezier_track_interpolate);
- ClassDB::bind_method(D_METHOD("audio_track_insert_key", "track", "time", "stream", "start_offset", "end_offset"), &Animation::audio_track_insert_key, DEFVAL(0), DEFVAL(0));
- ClassDB::bind_method(D_METHOD("audio_track_set_key_stream", "idx", "key_idx", "stream"), &Animation::audio_track_set_key_stream);
- ClassDB::bind_method(D_METHOD("audio_track_set_key_start_offset", "idx", "key_idx", "offset"), &Animation::audio_track_set_key_start_offset);
- ClassDB::bind_method(D_METHOD("audio_track_set_key_end_offset", "idx", "key_idx", "offset"), &Animation::audio_track_set_key_end_offset);
- ClassDB::bind_method(D_METHOD("audio_track_get_key_stream", "idx", "key_idx"), &Animation::audio_track_get_key_stream);
- ClassDB::bind_method(D_METHOD("audio_track_get_key_start_offset", "idx", "key_idx"), &Animation::audio_track_get_key_start_offset);
- ClassDB::bind_method(D_METHOD("audio_track_get_key_end_offset", "idx", "key_idx"), &Animation::audio_track_get_key_end_offset);
+ ClassDB::bind_method(D_METHOD("audio_track_insert_key", "track_idx", "time", "stream", "start_offset", "end_offset"), &Animation::audio_track_insert_key, DEFVAL(0), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("audio_track_set_key_stream", "track_idx", "key_idx", "stream"), &Animation::audio_track_set_key_stream);
+ ClassDB::bind_method(D_METHOD("audio_track_set_key_start_offset", "track_idx", "key_idx", "offset"), &Animation::audio_track_set_key_start_offset);
+ ClassDB::bind_method(D_METHOD("audio_track_set_key_end_offset", "track_idx", "key_idx", "offset"), &Animation::audio_track_set_key_end_offset);
+ ClassDB::bind_method(D_METHOD("audio_track_get_key_stream", "track_idx", "key_idx"), &Animation::audio_track_get_key_stream);
+ ClassDB::bind_method(D_METHOD("audio_track_get_key_start_offset", "track_idx", "key_idx"), &Animation::audio_track_get_key_start_offset);
+ ClassDB::bind_method(D_METHOD("audio_track_get_key_end_offset", "track_idx", "key_idx"), &Animation::audio_track_get_key_end_offset);
- ClassDB::bind_method(D_METHOD("animation_track_insert_key", "track", "time", "animation"), &Animation::animation_track_insert_key);
- ClassDB::bind_method(D_METHOD("animation_track_set_key_animation", "idx", "key_idx", "animation"), &Animation::animation_track_set_key_animation);
- ClassDB::bind_method(D_METHOD("animation_track_get_key_animation", "idx", "key_idx"), &Animation::animation_track_get_key_animation);
+ ClassDB::bind_method(D_METHOD("animation_track_insert_key", "track_idx", "time", "animation"), &Animation::animation_track_insert_key);
+ ClassDB::bind_method(D_METHOD("animation_track_set_key_animation", "track_idx", "key_idx", "animation"), &Animation::animation_track_set_key_animation);
+ ClassDB::bind_method(D_METHOD("animation_track_get_key_animation", "track_idx", "key_idx"), &Animation::animation_track_get_key_animation);
ClassDB::bind_method(D_METHOD("set_length", "time_sec"), &Animation::set_length);
ClassDB::bind_method(D_METHOD("get_length"), &Animation::get_length);
@@ -2823,7 +2823,7 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_step"), &Animation::get_step);
ClassDB::bind_method(D_METHOD("clear"), &Animation::clear);
- ClassDB::bind_method(D_METHOD("copy_track", "track", "to_animation"), &Animation::copy_track);
+ ClassDB::bind_method(D_METHOD("copy_track", "track_idx", "to_animation"), &Animation::copy_track);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0.001,99999,0.001"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop");