summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-16 11:34:20 +0100
committerGitHub <noreply@github.com>2020-01-16 11:34:20 +0100
commita2c90fe2f366bea6974cf4b14373b15e1b83568b (patch)
tree30ef344f179a4beb7b571d71791e4e9b39d7ae5f /scene/2d
parent3af0400a32a2f81aad0b56940af0d6a92b6ffc92 (diff)
parent1de633205f232bf5f4f4b17e6087d8e4b8e4ebee (diff)
Merge pull request #35190 from akien-mga/im-in-love-with-the-shape-of-ueicbksjdhd
Validate input in (CPU)Particles set_emission_shape()
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/cpu_particles_2d.cpp6
-rw-r--r--scene/2d/cpu_particles_2d.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 8296f35739..c325de00b8 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -422,7 +422,7 @@ bool CPUParticles2D::get_particle_flag(Flags p_flag) const {
}
void CPUParticles2D::set_emission_shape(EmissionShape p_shape) {
-
+ ERR_FAIL_INDEX(p_shape, EMISSION_SHAPE_MAX);
emission_shape = p_shape;
_change_notify();
}
@@ -772,6 +772,9 @@ void CPUParticles2D::_particles_process(float p_delta) {
p.base_color = emission_colors.get(random_idx);
}
} break;
+ case EMISSION_SHAPE_MAX: { // Max value for validity check.
+ break;
+ }
}
if (!local_coords) {
@@ -1416,6 +1419,7 @@ void CPUParticles2D::_bind_methods() {
BIND_ENUM_CONSTANT(EMISSION_SHAPE_RECTANGLE);
BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINTS);
BIND_ENUM_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS);
+ BIND_ENUM_CONSTANT(EMISSION_SHAPE_MAX);
}
CPUParticles2D::CPUParticles2D() {
diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h
index 6ffa1f0e97..cbaff70c2a 100644
--- a/scene/2d/cpu_particles_2d.h
+++ b/scene/2d/cpu_particles_2d.h
@@ -75,6 +75,7 @@ public:
EMISSION_SHAPE_RECTANGLE,
EMISSION_SHAPE_POINTS,
EMISSION_SHAPE_DIRECTED_POINTS,
+ EMISSION_SHAPE_MAX
};
private: