Skip to content

Commit

Permalink
Merge pull request #88523 from KoBeWi/open_text_as_text
Browse files Browse the repository at this point in the history
Add separate program case for Godot Resources
  • Loading branch information
akien-mga committed Feb 20, 2024
2 parents 07254d9 + bb46198 commit b714563
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions editor/filesystem_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2066,26 +2066,26 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
fpath = p_selected[0];
}

String file = ProjectSettings::get_singleton()->globalize_path(fpath);
const String file = ProjectSettings::get_singleton()->globalize_path(fpath);
const String extension = file.get_extension();

String resource_type = ResourceLoader::get_resource_type(fpath);
const String resource_type = ResourceLoader::get_resource_type(fpath);
String external_program;

if (resource_type == "CompressedTexture2D" || resource_type == "Image") {
if (file.get_extension() == "svg" || file.get_extension() == "svgz") {
if (ClassDB::is_parent_class(resource_type, "Script") || extension == "tres" || extension == "tscn") {
external_program = EDITOR_GET("text_editor/external/exec_path");
} else if (extension == "res" || extension == "scn") {
// Binary resources have no meaningful editor outside Godot, so just fallback to something default.
} else if (resource_type == "CompressedTexture2D" || resource_type == "Image") {
if (extension == "svg" || extension == "svgz") {
external_program = EDITOR_GET("filesystem/external_programs/vector_image_editor");
} else {
external_program = EDITOR_GET("filesystem/external_programs/raster_image_editor");
}
} else if (ClassDB::is_parent_class(resource_type, "AudioStream")) {
external_program = EDITOR_GET("filesystem/external_programs/audio_editor");
} else if (resource_type == "PackedScene") {
// Ignore non-model scenes.
if (file.get_extension() != "tscn" && file.get_extension() != "scn" && file.get_extension() != "res") {
external_program = EDITOR_GET("filesystem/external_programs/3d_model_editor");
}
} else if (ClassDB::is_parent_class(resource_type, "Script")) {
external_program = EDITOR_GET("text_editor/external/exec_path");
external_program = EDITOR_GET("filesystem/external_programs/3d_model_editor");
}

if (external_program.is_empty()) {
Expand Down

0 comments on commit b714563

Please sign in to comment.