Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add emission_finished signal to Particles2D #7887

Merged
merged 1 commit into from
Feb 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions scene/2d/particles_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "particles_2d.h"
#include "scene/scene_string_names.h"



Expand Down Expand Up @@ -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);

}
Expand Down Expand Up @@ -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) {


Expand Down Expand Up @@ -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") ;
Expand Down
1 change: 0 additions & 1 deletion scene/2d/particles_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ class Particles2D : public Node2D {
Color default_color;
Ref<ColorRamp> color_ramp;

void testee(int a, int b, int c, int d, int e);
void _process_particles(float p_delta);
friend class ParticleAttractor2D;

Expand Down
1 change: 1 addition & 0 deletions scene/scene_string_names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions scene/scene_string_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ friend void unregister_scene_types();
StringName sort_children;

StringName finished;
StringName emission_finished;
StringName animation_finished;
StringName animation_changed;
StringName animation_started;
Expand Down