From 325928064e36bb7fc6aa2e84921c02f8b23f7b2b Mon Sep 17 00:00:00 2001 From: cidoku Date: Thu, 20 Feb 2025 21:09:27 -0300 Subject: [PATCH] support characters with emotions in subfolders --- gameview.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/gameview.py b/gameview.py index ba175a4..34c689e 100644 --- a/gameview.py +++ b/gameview.py @@ -255,12 +255,17 @@ class AOCharMovie(QtGui.QLabel): def set_flipped(self, flip): self.m_flipped = flip + + def test_path(self, paths): + for path in paths: + if exists(path): + return path + return False def play(self, p_char, p_emote, emote_prefix, scaling = SCALING_AUTO): if p_emote[0] == "/" or p_emote[0] == "/": p_emote = p_emote[1:] elif "../../characters" in p_emote: - print p_emote a = p_emote.split("/") p_char = a[3] emote = a[4] @@ -273,15 +278,16 @@ class AOCharMovie(QtGui.QLabel): self.scaling = scaling p_char = p_char.lower().decode('utf-8') - - original_path = AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif" + p_emote = p_emote.lower() + + original_path = self.test_path([AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif", AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif"]) alt_path = AOpath+"characters/"+p_char+"/"+p_emote+".png" - apng_path = AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".apng" - webp_path = AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".webp" + apng_path = self.test_path([AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".apng", AOpath+"characters/"+p_char+"/"+emote_prefix+"/"+p_emote+".apng"]) + webp_path = self.test_path([AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".webp", AOpath+"characters/"+p_char+"/"+emote_prefix+"/"+p_emote+".webp"]) placeholder_path = AO2XPpath+"themes/default/placeholder.gif" gif_path = "" - - if exists(apng_path): + + if apng_path: gif_path = apng_path self.use_pillow = 1 else: @@ -290,7 +296,7 @@ class AOCharMovie(QtGui.QLabel): url = url.replace(" ", "%20") thread.start_new_thread(download_thread, (url, apng_path)) - if exists(webp_path): + if webp_path: gif_path = webp_path self.use_pillow = 2 else: @@ -299,7 +305,7 @@ class AOCharMovie(QtGui.QLabel): url = url.replace(" ", "%20") thread.start_new_thread(download_thread, (url, webp_path)) - if exists(original_path): + if original_path: gif_path = original_path self.use_pillow = 0 else: @@ -2027,7 +2033,7 @@ class gui(QtGui.QWidget): if "looping_sfx" in self.features: # AO 2.8 msg += emote[6]+"#" # loop sound? msg += "%d#" % self.shakebtn.isPressed() # screen shake - emotes_to_check = [emote[1], "(b)"+emote[2], "(a)"+emote[2]] + emotes_to_check = [emote[1], "(b)"+emote[2], "(b)/"+emote[2], "(a)"+emote[2], "(a)/"+emote[2] ] effects_to_check = ["_FrameScreenshake", "_FrameRealization", "_FrameSFX"] for f_effect in effects_to_check: