WoWInterface SVN TidyPlatesBeta

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 604 to Rev 603
    Reverse comparison

Rev 604 → Rev 603

trunk/TidyPlates/TidyPlatesCore.lua
10,12 → 10,12
local massQueue, targetQueue, functionQueue = {}, {}, {} -- Queue Lists
local ForEachPlate -- Allocated for Function (Defined later in file)
local EMPTY_TEXTURE = "Interface\\Addons\\TidyPlates\\Media\\Empty"
local select, pairs, tostring, wipe = select, pairs, tostring, wipe -- Local function copies
local select, pairs, tostring = select, pairs, tostring -- Local function copies
local CreateTidyPlatesStatusbar = CreateTidyPlatesStatusbar -- Local function copy
local InCombat, HasTarget, EnableFadeIn = false, false, true
local Plates, PlatesVisible, PlatesFading, GUID = {}, {}, {}, {} -- Plate Lists
local PlatesScaling = {} -- ScaleFade
local nameplate, extended, bars, regions, visual -- Temp/Local/Current References
local nameplate, extended, bars, regions, visual -- Temp References
local unit, unitcache, style, stylename, unitchanged -- Temp References
local currentTarget -- Stores current target plate pointer
local extendedSetAlpha, HighlightIsShown, HighlightSetAlpha -- Local copies of methods; faster than table lookups
225,14 → 225,11
-- UpdateIndicator_CustomAlpha: Calls the alpha delegate to get the requested alpha
function UpdateIndicator_CustomAlpha()
if activetheme.SetAlpha then
extended.requestedAlpha = activetheme.SetAlpha(unit) or unit.alpha or 1
 
local previousAlpha = extended.requestedAlpha
extended.requestedAlpha = activetheme.SetAlpha(unit) or previousAlpha or unit.alpha or 1
else extended.requestedAlpha = unit.alpha or 1 end
 
if extended.requestedAlpha == 0 then print(nameplate, extended, unit.name) end
 
if EnableFadeIn then
extended.visibleAlpha = extended:GetAlpha() -- Just to be sure the values haven't been messed up
if EnableFadeIn then
if extended.requestedAlpha ~= extended.visibleAlpha then
PlatesFading[nameplate] = true
end
259,7 → 256,6
extended.requestedScale = tonumber(activetheme.SetScale(unit)) or 0
 
if EnableFadeIn then
extended.visibleScale = extended:GetScale() -- Just to be sure!
if extended.visibleScale ~= extended.requestedScale then -- ScaleFade
PlatesScaling[nameplate] = true
end
501,20 → 497,17
unit.alpha = 1
unit.isTarget = false
unit.isMouseover = false
extended.unit = wipe(extended.unit)
--extended.unitcache = ClearIndices(extended.unitcache)
extended.unitcache = wipe(extended.unitcache) -- Gonna try the native 'wipe' function
extended.unitcache = ClearIndices(extended.unitcache)
extended.stylename = ""
 
-- For Fading In
PlatesFading[plate] = EnableFadeIn
extended.requestedAlpha = 0
extended.visibleAlpha = 0
PlatesScaling[plate] = EnableFadeIn -- ScaleFade
extended.requestedScale = 1
extended.visibleScale = 1 -- Inital scale
extended:SetAlpha(0)
 
PlatesScaling[plate] = EnableFadeIn -- ScaleFade
extended.requestedScale = 1
extended.visibleScale = 1 -- Inital scale
extended:SetScale(1)
 
-- Graphics
522,13 → 515,11
bars.castbar:Hide()
visual.highlight:Hide()
regions.highlight:Hide()
visual.raidicon:Hide()
visual.target:Hide()
 
 
-- Widgets/Extensions -- Moved to OnEchoNewNameplate
if activetheme.OnInitialize then activetheme.OnInitialize(extended) end
end
 
 
--------------------------------
-- Individual Gather/Entry-Point Functions
--------------------------------
553,42 → 544,33
This function takes care of the full update after the TidyP lates plate has
been prepared, and the parent plate has been fully populated with data.
--]]
 
 
 
local function OnEchoNewNameplate(plate)
UpdateReferences(plate)
local health, cast = bars.health, bars.cast
health:HookScript("OnShow", OnShowNameplate )
health:HookScript("OnHide", OnHideNameplate)
health:HookScript("OnValueChanged", OnUpdateHealth)
health:HookScript("OnMinMaxChanged", OnUpdateHealthRange)
extended.isHooked = true
if not plate:IsShown() then return end
UpdateReferences(plate)
 
--[[
Hook for Updates Note:
This used to be done in OnNewNameplate. It has been moved because
the event handler would sometimes call for events right after the
nameplate was created, but before the data was populated.
 
This hooking function has been placed prior to the IsShown check
because sometimes the nameplate gets created and hidden in a single
frame.
nameplate was created, but before the data was populated.
--]]
 
--if not plate:IsShown() then print("Hook would have Failed", plate); return else print("Hook suceeded", plate) end
if not plate:IsShown() then return else end
-- Hook for Updates
local health, cast = bars.health, bars.cast
health:HookScript("OnShow", OnShowNameplate )
health:HookScript("OnHide", OnHideNameplate)
health:HookScript("OnValueChanged", OnUpdateHealth)
health:HookScript("OnMinMaxChanged", OnUpdateHealthRange)
PlatesVisible[plate] = true
 
-- Gather Information
GatherData_BasicInfo()
GatherData_Alpha(plate)
ProcessUnitChanges(true) -- Forces an update
ProcessUnitChanges(true) -- Forces an update
end
 
-- OnNewNameplate:
--[[
When a nameplate is created, this function prepares the conditions
When a nameplate is created, this function prepares the textures
and queues the plate for a more complete update. Why? On the
cycle that the nameplate is created, its data hasn't been
completely populated by Blizzard's client. The data is complete
596,11 → 578,37
--]]
function OnNewNameplate(plate)
UpdateReferences(plate)
PrepareNameplate(plate)
PrepareNameplate(plate)
--GatherData_BasicInfo() -- in PrepareNameplate... no need to call twice
 
--[[
Notes:
If I comment these lines out, and let the Echo take care of everything, that should solve a few issues, right?
No, because OnUpdateHealth can be triggered between updates, in rare conditions.
Ok, so, move the hooks to the OnEchoNewNameplate.
--]]
 
--[[
local health, cast = bars.health, bars.cast
 
-- Alternative to reduce initial CPU load
CheckNameplateStyle()
UpdateIndicator_CustomAlpha()
 
-- Hook for Updates
health:HookScript("OnShow", OnShowNameplate)
health:HookScript("OnHide", OnHideNameplate)
health:HookScript("OnValueChanged", OnUpdateHealth)
health:HookScript("OnMinMaxChanged", OnUpdateHealthRange)
 
-- Activates nameplate visibility
PlatesVisible[plate] = true
--]]
 
SetTargetQueue(plate, OnEchoNewNameplate) -- Echo for a full update (alpha only)
end
 
-- OnShowNameplate: This occurs when a nameplate is Reused
-- OnShowNameplate
function OnShowNameplate(source)
local plate = source.parentPlate
-- Activate Plate
907,8 → 915,7
end
 
function ApplyPlateExtension(plate)
Plates[plate] = GetTime()
--Plates[plate] = true
Plates[plate] = true
plate.extended = CreateFrame("Frame", nil, plate)
local extended = plate.extended
platelevels = platelevels - 1; if platelevels < 1 then platelevels = 1 end
1085,10 → 1092,11
end
 
-- Fade Function
local function UpdateFade(frame, func, visible, requested, rate)
local FadeRate = .15
local function UpdateFade(frame, func, visible, requested)
if visible == requested then return nil, requested end
 
local scaledRate = rate * (30/FrameRate)
local scaledRate = FadeRate * (30/FrameRate)
if visible < requested then
visible = min(visible + scaledRate, requested)
elseif visible > requested then
1134,13 → 1142,13
-- Fade/Scale Transition Loops
for plate in pairs(PlatesFading) do
local extended = plate.extended
PlatesFading[plate] , extended.visibleAlpha = UpdateFade(extended, extendedSetAlpha, extended.visibleAlpha, extended.requestedAlpha, .15)
PlatesFading[plate] , extended.visibleAlpha = UpdateFade(extended, extendedSetAlpha, extended.visibleAlpha, extended.requestedAlpha)
end
 
-- [[ Disabled
for plate in pairs(PlatesScaling) do
local extended = plate.extended
PlatesScaling[plate], extended.visibleScale = UpdateFade(extended, extendedSetScale, extended.visibleScale, extended.requestedScale, .15)
PlatesScaling[plate], extended.visibleScale = UpdateFade(extended, extendedSetScale, extended.visibleScale, extended.requestedScale)
end
--]]