summaryrefslogtreecommitdiff
path: root/scene/3d/gpu_particles_3d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/gpu_particles_3d.cpp')
-rw-r--r--scene/3d/gpu_particles_3d.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp
index a87b57bd4d..c4480e3ed2 100644
--- a/scene/3d/gpu_particles_3d.cpp
+++ b/scene/3d/gpu_particles_3d.cpp
@@ -71,12 +71,14 @@ void GPUParticles3D::set_one_shot(bool p_one_shot) {
if (is_emitting()) {
set_process_internal(true);
- if (!one_shot)
+ if (!one_shot) {
RenderingServer::get_singleton()->particles_restart(particles);
+ }
}
- if (!one_shot)
+ if (!one_shot) {
set_process_internal(false);
+ }
}
void GPUParticles3D::set_pre_process_time(float p_time) {
@@ -109,8 +111,9 @@ void GPUParticles3D::set_use_local_coordinates(bool p_enable) {
void GPUParticles3D::set_process_material(const Ref<Material> &p_material) {
process_material = p_material;
RID material_rid;
- if (process_material.is_valid())
+ if (process_material.is_valid()) {
material_rid = process_material->get_rid();
+ }
RS::get_singleton()->particles_set_process_material(particles, material_rid);
update_configuration_warning();
@@ -191,8 +194,9 @@ void GPUParticles3D::set_draw_pass_mesh(int p_pass, const Ref<Mesh> &p_mesh) {
draw_passes.write[p_pass] = p_mesh;
RID mesh_rid;
- if (p_mesh.is_valid())
+ if (p_mesh.is_valid()) {
mesh_rid = p_mesh->get_rid();
+ }
RS::get_singleton()->particles_set_draw_pass_mesh(particles, p_pass, mesh_rid);
@@ -241,8 +245,9 @@ String GPUParticles3D::get_configuration_warning() const {
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(draw_passes[i]->surface_get_material(j).ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
}
- if (anim_material_found)
+ if (anim_material_found) {
break;
+ }
}
}
@@ -251,22 +256,25 @@ String GPUParticles3D::get_configuration_warning() const {
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
if (!meshes_found) {
- if (warnings != String())
+ if (warnings != String()) {
warnings += "\n";
+ }
warnings += "- " + TTR("Nothing is visible because meshes have not been assigned to draw passes.");
}
if (process_material.is_null()) {
- if (warnings != String())
+ if (warnings != String()) {
warnings += "\n";
+ }
warnings += "- " + TTR("A material to process the particles is not assigned, so no behavior is imprinted.");
} else {
const ParticlesMaterial *process = Object::cast_to<ParticlesMaterial>(process_material.ptr());
if (!anim_material_found && process &&
(process->get_param(ParticlesMaterial::PARAM_ANIM_SPEED) != 0.0 || process->get_param(ParticlesMaterial::PARAM_ANIM_OFFSET) != 0.0 ||
process->get_param_texture(ParticlesMaterial::PARAM_ANIM_SPEED).is_valid() || process->get_param_texture(ParticlesMaterial::PARAM_ANIM_OFFSET).is_valid())) {
- if (warnings != String())
+ if (warnings != String()) {
warnings += "\n";
+ }
warnings += "- " + TTR("Particles animation requires the usage of a StandardMaterial3D whose Billboard Mode is set to \"Particle Billboard\".");
}
}