File tree Expand file tree Collapse file tree 5 files changed +27
-4
lines changed
Expand file tree Collapse file tree 5 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 11### Added:
2- - ASTC Image Compression option:
2+ - ASTC Image Compression option ( # 212 by @ Willy-JL ) :
33 - Compresses images for instantaneous load times (after first compression which is slower)
44 - Potentially less VRAM usage, overall slightly less disk usage on average (if ASTC Replace is also enabled, otherwise files are duplicated)
55 - Some GPUs may not be compatible, some others may render images less efficiently like this
6- - Unload Images Off-screen option:
6+ - Unload Images Off-screen option ( # 212 by @ Willy-JL ) :
77 - Saves a lot of VRAM usage by unloading images not currently shown
88 - Only recommended together with ASTC Image Compression, otherwise it is very slow
9+ - Play GIFs and Play GIFs Unfocused options (#212 by @Willy-JL ):
10+ - Saves a lot of VRAM if completely disabled, no GIFs play and only first frame is loaded
11+ - Saves CPU/GPU usage by redrawing less if disabled when unfocused, but still uses same VRAM
912
1013### Updated:
1114- Nothing
Original file line number Diff line number Diff line change @@ -756,6 +756,8 @@ class Settings:
756756 mark_installed_after_add : bool
757757 max_connections : int
758758 max_retries : int
759+ play_gifs : bool
760+ play_gifs_unfocused : bool
759761 proxy_type : ProxyType
760762 proxy_host : str
761763 proxy_port : int
Original file line number Diff line number Diff line change @@ -361,6 +361,8 @@ def astc_compress_one(src_path: pathlib.Path):
361361 if duration < 1 :
362362 duration = 100
363363 self .durations .append (duration / 1000 )
364+ if not globals .settings .play_gifs :
365+ break
364366 self .animated = len (self .textures ) > 1
365367
366368 if self .glob and globals .settings .astc_compression and globals .settings .astc_replace :
@@ -398,6 +400,8 @@ def astc_compress_one(src_path: pathlib.Path):
398400 if (duration := frame .info .get ("duration" , 0 )) < 1 :
399401 duration = 100
400402 self .durations .append (duration / 1000 )
403+ if not globals .settings .play_gifs :
404+ break
401405 self .animated = len (self .textures ) > 1
402406
403407 self .loaded = True
@@ -457,7 +461,7 @@ def texture_id(self):
457461 if not self .applied :
458462 return dummy_texture_id ()
459463
460- if self .animated :
464+ if self .animated and globals . settings . play_gifs and ( globals . gui . focused or globals . settings . play_gifs_unfocused ) :
461465 if self .prev_time != (new_time := imgui .get_time ()):
462466 self .prev_time = new_time
463467 self .elapsed += imgui .get_io ().delta_time
Original file line number Diff line number Diff line change @@ -206,6 +206,8 @@ async def connect():
206206 "mark_installed_after_add" : f'INTEGER DEFAULT { int (False )} ' ,
207207 "max_connections" : f'INTEGER DEFAULT 10' ,
208208 "max_retries" : f'INTEGER DEFAULT 2' ,
209+ "play_gifs" : f'INTEGER DEFAULT { int (True )} ' ,
210+ "play_gifs_unfocused" : f'INTEGER DEFAULT { int (False )} ' ,
209211 "proxy_type" : f'INTEGER DEFAULT { ProxyType .Disabled } ' ,
210212 "proxy_host" : f'TEXT DEFAULT ""' ,
211213 "proxy_port" : f'INTEGER DEFAULT 8080' ,
Original file line number Diff line number Diff line change @@ -896,6 +896,7 @@ def main_loop(self):
896896 # Redraw only when needed
897897 draw = (
898898 (api .downloads and any (dl .state in (dl .State .Verifying , dl .State .Extracting ) for dl in api .downloads .values ()))
899+ or (imagehelper .redraw and globals .settings .play_gifs and (self .focused or globals .settings .play_gifs_unfocused ))
899900 or imgui .io .mouse_wheel or self .input_chars or any (imgui .io .mouse_down ) or any (imgui .io .keys_down )
900901 or (prev_mouse_pos != mouse_pos and (prev_win_hovered or win_hovered ))
901902 or prev_scaling != globals .settings .interface_scaling
@@ -906,7 +907,6 @@ def main_loop(self):
906907 or prev_hidden != self .hidden
907908 or size != self .prev_size
908909 or self .recalculate_ids
909- or imagehelper .redraw
910910 or self .new_styles
911911 or api .updating
912912 )
@@ -4299,6 +4299,18 @@ def cant_install_extension_tooltip():
42994299 if not set .zoom_enabled :
43004300 imgui .pop_disabled ()
43014301
4302+ draw_settings_label ("Play GIFs:" )
4303+ if draw_settings_checkbox ("play_gifs" ):
4304+ for image in imagehelper .ImageHelper .instances :
4305+ image .loaded = False
4306+
4307+ if not set .play_gifs :
4308+ imgui .push_disabled ()
4309+ draw_settings_label ("Play GIFs unfocused:" )
4310+ draw_settings_checkbox ("play_gifs_unfocused" )
4311+ if not set .play_gifs :
4312+ imgui .pop_disabled ()
4313+
43024314 draw_settings_label (
43034315 "ASTC compression:" ,
43044316 "Compress images using ASTC 6x6/80. Results in dramatically faster image loading and smaller filesize on disk, "
You can’t perform that action at this time.
0 commit comments