diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-08-15 16:27:15 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-08-15 16:28:34 -0300 |
commit | a4f9c95169579d650d6189d5034fb417bcc518af (patch) | |
tree | 19dfaabefb23dd94be75c515659b1fddb060d399 | |
parent | aaedde41228d0afab0ac994032ceb5eb25c13871 (diff) |
Small fix for problem of nodes losing type, this is not good enough to solve a core reimport problem, but so far fixes #8116
-rw-r--r-- | editor/editor_file_system.cpp | 6 | ||||
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | editor/property_editor.cpp | 8 |
3 files changed, 15 insertions, 1 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index eeb2f5ae8a..d873a55f69 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -598,6 +598,10 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess fi->type = fc->type; fi->modified_time = fc->modification_time; fi->import_modified_time = fc->import_modification_time; + if (fc->type == String()) { + fi->type = ResourceLoader::get_resource_type(path); + //there is also the chance that file type changed due to reimport, must probably check this somehow here (or kind of note it for next time in another file?) + } } else { @@ -615,6 +619,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess } fi->type = ResourceFormatImporter::get_singleton()->get_resource_type(path); + print_line("import extension tried resource type for " + path + " and its " + fi->type); fi->modified_time = 0; fi->import_modified_time = 0; @@ -633,6 +638,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess fi->import_modified_time = 0; } else { fi->type = ResourceLoader::get_resource_type(path); + print_line("regular import tried resource type for " + path + " and its " + fi->type); fi->modified_time = mt; fi->import_modified_time = 0; } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 2dca98d027..73000a0116 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1246,7 +1246,7 @@ void EditorNode::_dialog_action(String p_file) { } } else { - ml.instance(); + ml = Ref<TileSet>(memnew(TileSet)); } TileSetEditor::update_library_file(editor_data.get_edited_scene_root(), ml, true); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 53d94cdb18..dc2c9a2085 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -2474,11 +2474,14 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction String allowed_type = d["hint_text"]; + print_line("allowed type " + allowed_type); + Dictionary drag_data = p_drag_data; if (drag_data.has("type") && String(drag_data["type"]) == "resource") { Ref<Resource> res = drag_data["resource"]; for (int i = 0; i < allowed_type.get_slice_count(","); i++) { String at = allowed_type.get_slice(",", i).strip_edges(); + print_line("RES vs " + at); if (res.is_valid() && ClassDB::is_parent_class(res->get_class(), at)) { return true; } @@ -2489,13 +2492,18 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction Vector<String> files = drag_data["files"]; + print_line("fileS: " + String(Variant(files))); if (files.size() == 1) { String file = files[0]; String ftype = EditorFileSystem::get_singleton()->get_file_type(file); + + print_line("file: " + file); + print_line("type: " + ftype); if (ftype != "") { for (int i = 0; i < allowed_type.get_slice_count(","); i++) { String at = allowed_type.get_slice(",", i).strip_edges(); + print_line("FILE vs " + at); if (ClassDB::is_parent_class(ftype, at)) { return true; } |