diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-07-03 13:15:15 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-07-03 13:16:10 -0300 |
commit | 6442dfb73bf17d69768b5ff42d2fd269a6aa2f51 (patch) | |
tree | 3fc82ac494207f51c096f2d1e8e4ec15870ceb1f /tools/editor/scenes_dock.cpp | |
parent | a28bf56ef9b9d5d93031fb8ce4209370f075f69b (diff) |
Added proper resource preview cache invalidation, fixes #5342
Diffstat (limited to 'tools/editor/scenes_dock.cpp')
-rw-r--r-- | tools/editor/scenes_dock.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp index 0df4dfacc1..fa7c898f91 100644 --- a/tools/editor/scenes_dock.cpp +++ b/tools/editor/scenes_dock.cpp @@ -189,6 +189,7 @@ void ScenesDock::_notification(int p_what) { initialized=true; EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"_fs_changed"); + EditorResourcePreview::get_singleton()->connect("preview_invalidated",this,"_preview_invalidated"); button_reload->set_icon( get_icon("Reload","EditorIcons")); button_favorite->set_icon( get_icon("Favorites","EditorIcons")); @@ -663,6 +664,27 @@ void ScenesDock::_go_to_dir(const String& p_dir){ } + +void ScenesDock::_preview_invalidated(const String& p_path) { + + if (p_path.get_base_dir()==path && search_box->get_text()==String() && file_list_vb->is_visible()) { + + + for(int i=0;i<files->get_item_count();i++) { + + if (files->get_item_metadata(i)==p_path) { + //re-request preview + Array udata; + udata.resize(2); + udata[0]=i; + udata[1]=files->get_item_text(i); + EditorResourcePreview::get_singleton()->queue_resource_preview(p_path,this,"_thumbnail_done",udata); + break; + } + } + } +} + void ScenesDock::_fs_changed() { button_hist_prev->set_disabled(history_pos==0); @@ -1620,6 +1642,9 @@ void ScenesDock::_bind_methods() { ObjectTypeDB::bind_method(_MD("drop_data_fw"), &ScenesDock::drop_data_fw); ObjectTypeDB::bind_method(_MD("_files_list_rmb_select"),&ScenesDock::_files_list_rmb_select); + ObjectTypeDB::bind_method(_MD("_preview_invalidated"),&ScenesDock::_preview_invalidated); + + ADD_SIGNAL(MethodInfo("instance")); ADD_SIGNAL(MethodInfo("open")); |