summaryrefslogtreecommitdiffstats
path: root/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
diff options
context:
space:
mode:
authormegalobyte <megalobyte@protonmail.com>2022-02-15 21:44:22 -0500
committermegalobyte <megalobyte@protonmail.com>2022-02-16 08:44:37 -0500
commit8824b6c5e9dc6a24a17452ded0c800ec267f812f (patch)
tree9902ce6e7a98f5deb6639b25c7e8d16354629889 /editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
parent98b97d34df7f3ab2cafc3847358c231c3d357b40 (diff)
downloadredot-engine-8824b6c5e9dc6a24a17452ded0c800ec267f812f.tar.gz
Update if == NOTIFICATION_* to switch statements to match coding style
Diffstat (limited to 'editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp')
-rw-r--r--editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp58
1 files changed, 30 insertions, 28 deletions
diff --git a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
index f63a31e869..affe10a01d 100644
--- a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
@@ -66,41 +66,43 @@ bool GPUParticlesCollisionSDF3DEditorPlugin::handles(Object *p_object) const {
}
void GPUParticlesCollisionSDF3DEditorPlugin::_notification(int p_what) {
- if (p_what == NOTIFICATION_PROCESS) {
- if (!col_sdf) {
- return;
- }
+ switch (p_what) {
+ case NOTIFICATION_PROCESS: {
+ if (!col_sdf) {
+ return;
+ }
- // Set information tooltip on the Bake button. This information is useful
- // to optimize performance (video RAM size) and reduce collision tunneling (individual cell size).
+ // Set information tooltip on the Bake button. This information is useful
+ // to optimize performance (video RAM size) and reduce collision tunneling (individual cell size).
- const Vector3i size = col_sdf->get_estimated_cell_size();
+ const Vector3i size = col_sdf->get_estimated_cell_size();
- const Vector3 extents = col_sdf->get_extents();
+ const Vector3 extents = col_sdf->get_extents();
- int data_size = 2;
- const double size_mb = size.x * size.y * size.z * data_size / (1024.0 * 1024.0);
- // Add a qualitative measurement to help the user assess whether a GPUParticlesCollisionSDF3D node is using a lot of VRAM.
- String size_quality;
- if (size_mb < 8.0) {
- size_quality = TTR("Low");
- } else if (size_mb < 32.0) {
- size_quality = TTR("Moderate");
- } else {
- size_quality = TTR("High");
- }
+ int data_size = 2;
+ const double size_mb = size.x * size.y * size.z * data_size / (1024.0 * 1024.0);
+ // Add a qualitative measurement to help the user assess whether a GPUParticlesCollisionSDF3D node is using a lot of VRAM.
+ String size_quality;
+ if (size_mb < 8.0) {
+ size_quality = TTR("Low");
+ } else if (size_mb < 32.0) {
+ size_quality = TTR("Moderate");
+ } else {
+ size_quality = TTR("High");
+ }
- String text;
- text += vformat(TTR("Subdivisions: %s"), vformat(String::utf8("%d × %d × %d"), size.x, size.y, size.z)) + "\n";
- text += vformat(TTR("Cell size: %s"), vformat(String::utf8("%.3f × %.3f × %.3f"), extents.x / size.x, extents.y / size.y, extents.z / size.z)) + "\n";
- text += vformat(TTR("Video RAM size: %s MB (%s)"), String::num(size_mb, 2), size_quality);
+ String text;
+ text += vformat(TTR("Subdivisions: %s"), vformat(String::utf8("%d × %d × %d"), size.x, size.y, size.z)) + "\n";
+ text += vformat(TTR("Cell size: %s"), vformat(String::utf8("%.3f × %.3f × %.3f"), extents.x / size.x, extents.y / size.y, extents.z / size.z)) + "\n";
+ text += vformat(TTR("Video RAM size: %s MB (%s)"), String::num(size_mb, 2), size_quality);
- // Only update the tooltip when needed to avoid constant redrawing.
- if (bake->get_tooltip(Point2()) == text) {
- return;
- }
+ // Only update the tooltip when needed to avoid constant redrawing.
+ if (bake->get_tooltip(Point2()) == text) {
+ return;
+ }
- bake->set_tooltip(text);
+ bake->set_tooltip(text);
+ } break;
}
}