mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-16 15:22:43 +00:00
#2042: read the Project panel thumbnail through panels::project::cached_thumbnail
ui_large_project::comp_thumbnail_renders_off_the_ui_thread read the thumbnail cache by its old storage type, (u64, TextureHandle), which the purge change replaced with a private newtype, so it never saw the texture land. It now asks cached_thumbnail.
This commit is contained in:
1 parent
0635f2496d
commit
9046c8d39a
2 files changed
+6
-3
No files matched your search
@@ -127,6 +127,11 @@ struct Thumb(u64, egui::TextureHandle);
|
||||
#[derive(Clone)]
|
||||
struct PendingThumb(u64, Arc<Mutex<Option<Option<(u32, u32, Vec<u8>)>>>>);
|
||||
|
||||
/// The Project panel's thumbnail texture of `item`, once its render has landed.
|
||||
pub fn cached_thumbnail(ctx: &egui::Context, item: ItemId) -> Option<egui::TextureHandle> {
|
||||
ctx.data(|d| d.get_temp::<Thumb>(egui::Id::unique(("proj-thumb", item.0)))).map(|Thumb(_, t)| t)
|
||||
}
|
||||
|
||||
/// Let go of every Project panel thumbnail and the renders in flight for them (a cache purge, or
|
||||
/// a project closed: the next project's item ids can be the closed one's).
|
||||
pub fn forget_thumbnails(ctx: &egui::Context) {
|
||||
|
||||
@@ -64,9 +64,7 @@ fn comp_thumbnail_renders_off_the_ui_thread() {
|
||||
let mut landed = false;
|
||||
for _ in 0..400 {
|
||||
h.step();
|
||||
if h.state().auto.find("project.thumbnail").is_some()
|
||||
&& h.ctx.data(|d| d.get_temp::<(u64, egui::TextureHandle)>(egui::Id::unique(("proj-thumb", main.0)))).is_some()
|
||||
{
|
||||
if h.state().auto.find("project.thumbnail").is_some() && effectcraft_ui_egui::panels::project::cached_thumbnail(&h.ctx, main).is_some() {
|
||||
landed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user