* Fixed stale images being displayed when threading is enabled and no image was called in a while
This commit is contained in:
LoafyLemon 2023-07-18 16:17:35 +01:00
parent b41a4263ea
commit ebc865b798

View File

@ -155,25 +155,25 @@ init python:
def _image(self, st, at): def _image(self, st, at):
return self._sprite.get_with_default(Null()), None return self._sprite.get_with_default(Null()), None
def is_stale(self):
curr_hash = self.generate_hash()
stale = curr_hash != self._hash
self._hash = curr_hash
if stale and settings.get("multithreading"):
self.build_image()
return stale
@property @property
def image(self): def image(self):
if settings.get("multithreading"):
if not renpy.is_skipping() and self.is_stale(): if not renpy.is_skipping() and self.is_stale():
self.build_image()
if renpy.showing(get_character_tag(self.name), layer=self.layer): if renpy.showing(get_character_tag(self.name), layer=self.layer):
self.show() self.show()
# elif renpy.in_rollback():
# self.build_image()
if settings.get("multithreading"):
return DynamicDisplayable(self._image) return DynamicDisplayable(self._image)
else: else:
if not renpy.is_skipping() and self.is_stale():
if renpy.showing(get_character_tag(self.name), layer=self.layer):
self.show()
return self._build_image(self._hash) return self._build_image(self._hash)
def equip(self, obj, remove_old=True): def equip(self, obj, remove_old=True):