View Single Post
05-13-21, 11:40 AM   #9
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Code:
local glyphedSpells = GetGlyphedSpells()
You're setting up your lookup table of glyphs when your addon loads before much of the character data has been gathered especially when first loggin in. Doing this also means the information in the table doesn't change even if spells are updated during play.

This table needs to be refreshed when new data is available (the chached spell information won't have been flushed during a /reload which is why it is already available so early "second time in").

Something like adding glyphedSpells = GetGlyphedSpells() to your cache_writer OnEvent script (might refresh too often but gives you an idea of what's going on).

Code:
button.GlyphActive:SetTexture("Interface\\Tooltips\\UI-Tooltip-Background")
button.GlyphActive:SetGradientAlpha("HORIZONTAL", unpack({0.15,0.6,0.15,1, 0.15,0.6,0.15,0}))
 
button.GlyphConflict:SetTexture("Interface\\Tooltips\\UI-Tooltip-Background")
button.GlyphConflict:SetGradientAlpha("HORIZONTAL", unpack({0.6,0.15,0.15,1, 0.6,0.15,0.15,0}))
As with the texture originally, your resetting the highlight file and gradient every time you scroll. While this doesn't create the problem seen previously, it's doing things over and over again that only need to be done once. You could move this to your XML with

Code:
 
<Texture parentKey="GlyphActive" setAllPoints="true" file="Interface\Tooltips\UI-Tooltip-Background">
	<Gradient orientation="HORIZONTAL">
		<MinColor r="0.15" g="0.6" b="0.15" a="1"/>
		<MaxColor r="0.15" g="0.6" b="0.15" a="0"/>
	</Gradient>
</Texture>
<Texture parentKey="GlyphConflict" setAllPoints="true" file="Interface\Tooltips\UI-Tooltip-Background">
	<Gradient orientation="HORIZONTAL">
		<MinColor r="0.6" g="0.15" b="0.15" a="1"/>
		<MaxColor r="0.6" g="0.15" b="0.15" a="0"/>
	</Gradient>
</Texture>
As an aside, unpack({0.15,0.6,0.15,1, 0.15,0.6,0.15,0}) is creating a table just to unpack it straight away and then discard it.
Code:
button.GlyphActive:SetGradientAlpha("HORIZONTAL", 0.15, 0.6, 0.15, 1, 0.15, 0.6, 0.15, 0)
Is the same without adding the middle step.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-13-21 at 12:20 PM.
  Reply With Quote