You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Convert _notification methods to switch - Chunk C
This commit is contained in:
@@ -65,41 +65,43 @@ bool VoxelGIEditorPlugin::handles(Object *p_object) const {
|
||||
}
|
||||
|
||||
void VoxelGIEditorPlugin::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_PROCESS) {
|
||||
if (!voxel_gi) {
|
||||
return;
|
||||
}
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_PROCESS: {
|
||||
if (!voxel_gi) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set information tooltip on the Bake button. This information is useful
|
||||
// to optimize performance (video RAM size) and reduce light leaking (individual cell size).
|
||||
// Set information tooltip on the Bake button. This information is useful
|
||||
// to optimize performance (video RAM size) and reduce light leaking (individual cell size).
|
||||
|
||||
const Vector3i size = voxel_gi->get_estimated_cell_size();
|
||||
const Vector3i size = voxel_gi->get_estimated_cell_size();
|
||||
|
||||
const Vector3 extents = voxel_gi->get_extents();
|
||||
const Vector3 extents = voxel_gi->get_extents();
|
||||
|
||||
const int data_size = 4;
|
||||
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 VoxelGI node is using a lot of VRAM.
|
||||
String size_quality;
|
||||
if (size_mb < 16.0) {
|
||||
size_quality = TTR("Low");
|
||||
} else if (size_mb < 64.0) {
|
||||
size_quality = TTR("Moderate");
|
||||
} else {
|
||||
size_quality = TTR("High");
|
||||
}
|
||||
const int data_size = 4;
|
||||
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 VoxelGI node is using a lot of VRAM.
|
||||
String size_quality;
|
||||
if (size_mb < 16.0) {
|
||||
size_quality = TTR("Low");
|
||||
} else if (size_mb < 64.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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user