summaryrefslogtreecommitdiffstats
path: root/editor/plugins/lightmap_gi_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/lightmap_gi_editor_plugin.cpp')
-rw-r--r--editor/plugins/lightmap_gi_editor_plugin.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/editor/plugins/lightmap_gi_editor_plugin.cpp b/editor/plugins/lightmap_gi_editor_plugin.cpp
index 1c17d99d0d..6e5dfd44d4 100644
--- a/editor/plugins/lightmap_gi_editor_plugin.cpp
+++ b/editor/plugins/lightmap_gi_editor_plugin.cpp
@@ -177,8 +177,25 @@ LightmapGIEditorPlugin::LightmapGIEditorPlugin() {
bake->set_theme_type_variation("FlatButton");
// TODO: Rework this as a dedicated toolbar control so we can hook into theme changes and update it
// when the editor theme updates.
- bake->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Bake"), EditorStringName(EditorIcons)));
+ bake->set_button_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Bake"), EditorStringName(EditorIcons)));
bake->set_text(TTR("Bake Lightmaps"));
+
+#ifdef MODULE_LIGHTMAPPER_RD_ENABLED
+ // Disable lightmap baking if not supported on the current GPU.
+ if (!DisplayServer::get_singleton()->can_create_rendering_device()) {
+ bake->set_disabled(true);
+ bake->set_tooltip_text(vformat(TTR("Lightmap baking is not supported on this GPU (%s)."), RenderingServer::get_singleton()->get_video_adapter_name()));
+ }
+#else
+ // Disable lightmap baking if the module is disabled at compile-time.
+ bake->set_disabled(true);
+#if defined(ANDROID_ENABLED) || defined(IOS_ENABLED)
+ bake->set_tooltip_text(vformat(TTR("Lightmaps cannot be baked on %s."), OS::get_singleton()->get_name()));
+#else
+ bake->set_tooltip_text(TTR("Lightmaps cannot be baked, as the `lightmapper_rd` module was disabled at compile-time."));
+#endif
+#endif // MODULE_LIGHTMAPPER_RD_ENABLED
+
bake->hide();
bake->connect(SceneStringName(pressed), Callable(this, "_bake"));
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake);