diff options
author | SaracenOne <SaracenOne@gmail.com> | 2022-04-29 07:06:48 +0100 |
---|---|---|
committer | K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com> | 2023-01-06 08:39:27 -0800 |
commit | f5edeb8f58562b120c3dc41f879cd586ee692539 (patch) | |
tree | a8718cafc1d64997ee2dd56a3deb00bb5a7ded39 /editor/plugins/voxel_gi_editor_plugin.cpp | |
parent | b14f7aa9f92ff44135c283a9c88dab5ef9136d64 (diff) | |
download | redot-engine-f5edeb8f58562b120c3dc41f879cd586ee692539.tar.gz |
Disable navmesh, lightmap, and VoxelGI generation on foreign data
Diffstat (limited to 'editor/plugins/voxel_gi_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/voxel_gi_editor_plugin.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/editor/plugins/voxel_gi_editor_plugin.cpp b/editor/plugins/voxel_gi_editor_plugin.cpp index a3ccf392e6..f9f72fee77 100644 --- a/editor/plugins/voxel_gi_editor_plugin.cpp +++ b/editor/plugins/voxel_gi_editor_plugin.cpp @@ -35,7 +35,9 @@ void VoxelGIEditorPlugin::_bake() { if (voxel_gi) { - if (voxel_gi->get_probe_data().is_null()) { + Ref<VoxelGIData> voxel_gi_data = voxel_gi->get_probe_data(); + + if (voxel_gi_data.is_null()) { String path = get_tree()->get_edited_scene_root()->get_scene_file_path(); if (path.is_empty()) { path = "res://" + voxel_gi->get_name() + "_data.res"; @@ -46,7 +48,32 @@ void VoxelGIEditorPlugin::_bake() { probe_file->set_current_path(path); probe_file->popup_file_dialog(); return; + } else { + String path = voxel_gi_data->get_path(); + if (!path.is_resource_file()) { + int srpos = path.find("::"); + if (srpos != -1) { + String base = path.substr(0, srpos); + if (ResourceLoader::get_resource_type(base) == "PackedScene") { + if (!get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->get_scene_file_path() != base) { + EditorNode::get_singleton()->show_warning(TTR("Voxel GI data is not local to the scene.")); + return; + } + } else { + if (FileAccess::exists(base + ".import")) { + EditorNode::get_singleton()->show_warning(TTR("Voxel GI data is part of an imported resource.")); + return; + } + } + } + } else { + if (FileAccess::exists(path + ".import")) { + EditorNode::get_singleton()->show_warning(TTR("Voxel GI data is an imported resource.")); + return; + } + } } + voxel_gi->bake(); } } |