Browse Source

Particles: Fix missing configuration warning updates

Fixes #33488.
Rémi Verschelde 3 years ago
parent
commit
5d9e56ecec

+ 5 - 1
scene/2d/cpu_particles_2d.cpp

@@ -243,7 +243,7 @@ bool CPUParticles2D::get_fractional_delta() const {
 }
 }
 
 
 TypedArray<String> CPUParticles2D::get_configuration_warnings() const {
 TypedArray<String> CPUParticles2D::get_configuration_warnings() const {
-	TypedArray<String> warnings = Node::get_configuration_warnings();
+	TypedArray<String> warnings = Node2D::get_configuration_warnings();
 
 
 	CanvasItemMaterial *mat = Object::cast_to<CanvasItemMaterial>(get_material().ptr());
 	CanvasItemMaterial *mat = Object::cast_to<CanvasItemMaterial>(get_material().ptr());
 
 
@@ -314,6 +314,8 @@ void CPUParticles2D::set_param_max(Parameter p_param, real_t p_value) {
 	if (parameters_min[p_param] > parameters_max[p_param]) {
 	if (parameters_min[p_param] > parameters_max[p_param]) {
 		set_param_min(p_param, p_value);
 		set_param_min(p_param, p_value);
 	}
 	}
+
+	update_configuration_warnings();
 }
 }
 
 
 real_t CPUParticles2D::get_param_max(Parameter p_param) const {
 real_t CPUParticles2D::get_param_max(Parameter p_param) const {
@@ -374,6 +376,8 @@ void CPUParticles2D::set_param_curve(Parameter p_param, const Ref<Curve> &p_curv
 		default: {
 		default: {
 		}
 		}
 	}
 	}
+
+	update_configuration_warnings();
 }
 }
 
 
 Ref<Curve> CPUParticles2D::get_param_curve(Parameter p_param) const {
 Ref<Curve> CPUParticles2D::get_param_curve(Parameter p_param) const {

+ 1 - 2
scene/2d/gpu_particles_2d.cpp

@@ -141,7 +141,6 @@ void GPUParticles2D::set_process_material(const Ref<Material> &p_material) {
 void GPUParticles2D::set_trail_enabled(bool p_enabled) {
 void GPUParticles2D::set_trail_enabled(bool p_enabled) {
 	trail_enabled = p_enabled;
 	trail_enabled = p_enabled;
 	RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_length);
 	RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_length);
-	update_configuration_warnings();
 	update();
 	update();
 
 
 	RS::get_singleton()->particles_set_transform_align(particles, p_enabled ? RS::PARTICLES_TRANSFORM_ALIGN_Y_TO_VELOCITY : RS::PARTICLES_TRANSFORM_ALIGN_DISABLED);
 	RS::get_singleton()->particles_set_transform_align(particles, p_enabled ? RS::PARTICLES_TRANSFORM_ALIGN_Y_TO_VELOCITY : RS::PARTICLES_TRANSFORM_ALIGN_DISABLED);
@@ -297,7 +296,7 @@ bool GPUParticles2D::get_interpolate() const {
 }
 }
 
 
 TypedArray<String> GPUParticles2D::get_configuration_warnings() const {
 TypedArray<String> GPUParticles2D::get_configuration_warnings() const {
-	TypedArray<String> warnings = Node::get_configuration_warnings();
+	TypedArray<String> warnings = Node2D::get_configuration_warnings();
 
 
 	if (RenderingServer::get_singleton()->is_low_end()) {
 	if (RenderingServer::get_singleton()->is_low_end()) {
 		warnings.push_back(RTR("GPU-based particles are not supported by the OpenGL video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles2D\" option for this purpose."));
 		warnings.push_back(RTR("GPU-based particles are not supported by the OpenGL video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles2D\" option for this purpose."));

+ 10 - 1
scene/3d/cpu_particles_3d.cpp

@@ -164,6 +164,8 @@ void CPUParticles3D::set_mesh(const Ref<Mesh> &p_mesh) {
 	} else {
 	} else {
 		RS::get_singleton()->multimesh_set_mesh(multimesh, RID());
 		RS::get_singleton()->multimesh_set_mesh(multimesh, RID());
 	}
 	}
+
+	update_configuration_warnings();
 }
 }
 
 
 Ref<Mesh> CPUParticles3D::get_mesh() const {
 Ref<Mesh> CPUParticles3D::get_mesh() const {
@@ -187,7 +189,7 @@ bool CPUParticles3D::get_fractional_delta() const {
 }
 }
 
 
 TypedArray<String> CPUParticles3D::get_configuration_warnings() const {
 TypedArray<String> CPUParticles3D::get_configuration_warnings() const {
-	TypedArray<String> warnings = Node::get_configuration_warnings();
+	TypedArray<String> warnings = GeometryInstance3D::get_configuration_warnings();
 
 
 	bool mesh_found = false;
 	bool mesh_found = false;
 	bool anim_material_found = false;
 	bool anim_material_found = false;
@@ -266,6 +268,8 @@ void CPUParticles3D::set_param_min(Parameter p_param, real_t p_value) {
 	if (parameters_min[p_param] > parameters_max[p_param]) {
 	if (parameters_min[p_param] > parameters_max[p_param]) {
 		set_param_max(p_param, p_value);
 		set_param_max(p_param, p_value);
 	}
 	}
+
+	update_configuration_warnings();
 }
 }
 
 
 real_t CPUParticles3D::get_param_min(Parameter p_param) const {
 real_t CPUParticles3D::get_param_min(Parameter p_param) const {
@@ -276,10 +280,13 @@ real_t CPUParticles3D::get_param_min(Parameter p_param) const {
 
 
 void CPUParticles3D::set_param_max(Parameter p_param, real_t p_value) {
 void CPUParticles3D::set_param_max(Parameter p_param, real_t p_value) {
 	ERR_FAIL_INDEX(p_param, PARAM_MAX);
 	ERR_FAIL_INDEX(p_param, PARAM_MAX);
+
 	parameters_max[p_param] = p_value;
 	parameters_max[p_param] = p_value;
 	if (parameters_min[p_param] > parameters_max[p_param]) {
 	if (parameters_min[p_param] > parameters_max[p_param]) {
 		set_param_min(p_param, p_value);
 		set_param_min(p_param, p_value);
 	}
 	}
+
+	update_configuration_warnings();
 }
 }
 
 
 real_t CPUParticles3D::get_param_max(Parameter p_param) const {
 real_t CPUParticles3D::get_param_max(Parameter p_param) const {
@@ -340,6 +347,8 @@ void CPUParticles3D::set_param_curve(Parameter p_param, const Ref<Curve> &p_curv
 		default: {
 		default: {
 		}
 		}
 	}
 	}
+
+	update_configuration_warnings();
 }
 }
 
 
 Ref<Curve> CPUParticles3D::get_param_curve(Parameter p_param) const {
 Ref<Curve> CPUParticles3D::get_param_curve(Parameter p_param) const {

+ 1 - 1
scene/3d/gpu_particles_3d.cpp

@@ -270,7 +270,7 @@ bool GPUParticles3D::get_interpolate() const {
 }
 }
 
 
 TypedArray<String> GPUParticles3D::get_configuration_warnings() const {
 TypedArray<String> GPUParticles3D::get_configuration_warnings() const {
-	TypedArray<String> warnings = Node::get_configuration_warnings();
+	TypedArray<String> warnings = GeometryInstance3D::get_configuration_warnings();
 
 
 	if (RenderingServer::get_singleton()->is_low_end()) {
 	if (RenderingServer::get_singleton()->is_low_end()) {
 		warnings.push_back(RTR("GPU-based particles are not supported by the OpenGL video driver.\nUse the CPUParticles3D node instead. You can use the \"Convert to CPUParticles3D\" option for this purpose."));
 		warnings.push_back(RTR("GPU-based particles are not supported by the OpenGL video driver.\nUse the CPUParticles3D node instead. You can use the \"Convert to CPUParticles3D\" option for this purpose."));