From 0d6485d919e0d4685bcbcf8ec117ea698538f785 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Sat, 25 Feb 2017 16:06:00 +0200 Subject: Add emission_finished signal to Particles2D (Also remove some Particles2D::testee method, which was unused) Resolves #3963 --- scene/2d/particles_2d.cpp | 13 ++++--------- scene/2d/particles_2d.h | 1 - scene/scene_string_names.cpp | 1 + scene/scene_string_names.h | 1 + 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index da49f1b420..055bec2ca9 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -27,6 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "particles_2d.h" +#include "scene/scene_string_names.h" @@ -451,6 +452,7 @@ void Particles2D::_process_particles(float p_delta) { time=Math::fmod( time+frame_time, lifetime ); if (!emitting && active_count==0) { + emit_signal(SceneStringNames::get_singleton()->emission_finished); set_process(false); } @@ -918,15 +920,6 @@ Vector2 Particles2D::get_emission_half_extents() const { return extents; } -void Particles2D::testee(int a, int b, int c, int d, int e) { - - print_line(itos(a)); - print_line(itos(b)); - print_line(itos(c)); - print_line(itos(d)); - print_line(itos(e)); -} - void Particles2D::set_initial_velocity(const Vector2& p_velocity) { @@ -1092,6 +1085,8 @@ void Particles2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_emission_points","points"),&Particles2D::set_emission_points); ClassDB::bind_method(D_METHOD("get_emission_points"),&Particles2D::get_emission_points); + ADD_SIGNAL(MethodInfo("emission_finished")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"config/amount",PROPERTY_HINT_EXP_RANGE,"1,1024"),"set_amount","get_amount") ; ADD_PROPERTY(PropertyInfo(Variant::REAL,"config/lifetime",PROPERTY_HINT_EXP_RANGE,"0.1,3600,0.1"),"set_lifetime","get_lifetime") ; ADD_PROPERTYNO(PropertyInfo(Variant::REAL,"config/time_scale",PROPERTY_HINT_EXP_RANGE,"0.01,128,0.01"),"set_time_scale","get_time_scale") ; diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index 91f42c5222..4a2d57d6b9 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -162,7 +162,6 @@ private: Color default_color; Ref color_ramp; - void testee(int a, int b, int c, int d, int e); void _process_particles(float p_delta); friend class ParticleAttractor2D; diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index ffa35a93d8..28a8c610e2 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -51,6 +51,7 @@ SceneStringNames::SceneStringNames() { sleeping_state_changed=StaticCString::create("sleeping_state_changed"); finished=StaticCString::create("finished"); + emission_finished=StaticCString::create("emission_finished"); animation_finished=StaticCString::create("animation_finished"); animation_changed=StaticCString::create("animation_changed"); animation_started=StaticCString::create("animation_started"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index 125d391294..624a9147d5 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -80,6 +80,7 @@ public: StringName sort_children; StringName finished; + StringName emission_finished; StringName animation_finished; StringName animation_changed; StringName animation_started; -- cgit v1.2.3