Merge pull request #68107 from alfredbaudisch/drag-lower-case
Cast dragged file name extension to lowercase
This commit is contained in:
commit
50f742e1ca
|
@ -4083,7 +4083,7 @@ void EditorNode::_quick_opened() {
|
||||||
List<String> scene_extensions;
|
List<String> scene_extensions;
|
||||||
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &scene_extensions);
|
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &scene_extensions);
|
||||||
|
|
||||||
if (open_scene_dialog || scene_extensions.find(files[i].get_extension())) {
|
if (open_scene_dialog || scene_extensions.find(files[i].get_extension().to_lower())) {
|
||||||
open_request(res_path);
|
open_request(res_path);
|
||||||
} else {
|
} else {
|
||||||
load_resource(res_path);
|
load_resource(res_path);
|
||||||
|
|
|
@ -5751,8 +5751,10 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Varian
|
||||||
ResourceLoader::get_recognized_extensions_for_type("Texture2D", &texture_extensions);
|
ResourceLoader::get_recognized_extensions_for_type("Texture2D", &texture_extensions);
|
||||||
|
|
||||||
for (int i = 0; i < files.size(); i++) {
|
for (int i = 0; i < files.size(); i++) {
|
||||||
|
String extension = files[i].get_extension().to_lower();
|
||||||
|
|
||||||
// Check if dragged files with texture or scene extension can be created at least once.
|
// Check if dragged files with texture or scene extension can be created at least once.
|
||||||
if (texture_extensions.find(files[i].get_extension()) || scene_extensions.find(files[i].get_extension())) {
|
if (texture_extensions.find(extension) || scene_extensions.find(extension)) {
|
||||||
Ref<Resource> res = ResourceLoader::load(files[i]);
|
Ref<Resource> res = ResourceLoader::load(files[i]);
|
||||||
if (res.is_null()) {
|
if (res.is_null()) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -4150,11 +4150,13 @@ bool Node3DEditorViewport::can_drop_data_fw(const Point2 &p_point, const Variant
|
||||||
ResourceLoader::get_recognized_extensions_for_type("Texture", &texture_extensions);
|
ResourceLoader::get_recognized_extensions_for_type("Texture", &texture_extensions);
|
||||||
|
|
||||||
for (int i = 0; i < files.size(); i++) {
|
for (int i = 0; i < files.size(); i++) {
|
||||||
|
String extension = files[i].get_extension().to_lower();
|
||||||
|
|
||||||
// Check if dragged files with mesh or scene extension can be created at least once.
|
// Check if dragged files with mesh or scene extension can be created at least once.
|
||||||
if (mesh_extensions.find(files[i].get_extension()) ||
|
if (mesh_extensions.find(extension) ||
|
||||||
scene_extensions.find(files[i].get_extension()) ||
|
scene_extensions.find(extension) ||
|
||||||
material_extensions.find(files[i].get_extension()) ||
|
material_extensions.find(extension) ||
|
||||||
texture_extensions.find(files[i].get_extension())) {
|
texture_extensions.find(extension)) {
|
||||||
Ref<Resource> res = ResourceLoader::load(files[i]);
|
Ref<Resource> res = ResourceLoader::load(files[i]);
|
||||||
if (res.is_null()) {
|
if (res.is_null()) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue