You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Added proper resource preview cache invalidation, fixes #5342
This commit is contained in:
@@ -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"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user