From 73fc57f15af044eebfe044f1f172c65395c28fae Mon Sep 17 00:00:00 2001 From: shagu Date: Wed, 25 Nov 2020 09:55:03 +0100 Subject: [PATCH] unitframes: queue and process full updates only once --- api/unitframes.lua | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/api/unitframes.lua b/api/unitframes.lua index cfa038ba..3400dbef 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -784,21 +784,21 @@ function pfUI.uf.OnEvent() -- update regular frames if event == "PLAYER_ENTERING_WORLD" then - pfUI.uf:RefreshUnit(this, "all") + this.fullupdate = true elseif this.label == "target" and event == "PLAYER_TARGET_CHANGED" then - pfUI.uf:RefreshUnit(this, "all") + this.fullupdate = true elseif ( this.label == "raid" or this.label == "party" or this.label == "player" ) and event == "PARTY_MEMBERS_CHANGED" then - pfUI.uf:RefreshUnit(this, "all") + this.fullupdate = true elseif ( this.label == "raid" or this.label == "party" ) and event == "PARTY_MEMBER_ENABLE" then - pfUI.uf:RefreshUnit(this, "all") + this.fullupdate = true elseif ( this.label == "raid" or this.label == "party" ) and event == "PARTY_MEMBER_DISABLE" then - pfUI.uf:RefreshUnit(this, "all") + this.fullupdate = true elseif ( this.label == "raid" or this.label == "party" ) and event == "RAID_ROSTER_UPDATE" then - pfUI.uf:RefreshUnit(this, "all") + this.fullupdate = true + elseif this.label == "pet" and event == "UNIT_PET" then + this.fullupdate = true elseif this.label == "player" and (event == "PLAYER_AURAS_CHANGED" or event == "UNIT_INVENTORY_CHANGED") then pfUI.uf:RefreshUnit(this, "aura") - elseif this.label == "pet" and event == "UNIT_PET" then - pfUI.uf:RefreshUnit(this, "all") elseif this.label == "pet" and event == "UNIT_HAPPINESS" then pfUI.uf:RefreshUnit(this) -- UNIT_XXX Events @@ -821,6 +821,12 @@ function pfUI.uf.OnUpdate() -- update combat feedback if this.feedbackText then CombatFeedback_OnUpdate(arg1) end + -- process all queued unit full updates + if this.fullupdate then + pfUI.uf:RefreshUnit(this, "all") + this.fullupdate = nil + end + -- early return on unset focus frames if this.unitname then local unitname = ( this.label and UnitName(this.label) ) or ""