You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Disable navmesh, lightmap, and VoxelGI generation on foreign data
This commit is contained in:
committed by
K. S. Ernest (iFire) Lee
parent
b14f7aa9f9
commit
f5edeb8f58
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user