Improve when the cache is wiped during EID hidden
This commit is contained in:
1 parent
0f714135f1
commit
0fb08399f6
1 file changed
+21
-9
@@ -452,6 +452,14 @@ EID.CachedRenderPoses = {}
|
|||||||
EID.descriptionsToPrint = {}
|
EID.descriptionsToPrint = {}
|
||||||
EID.entitiesToPrint = {}
|
EID.entitiesToPrint = {}
|
||||||
|
|
||||||
|
local function resetDescCache()
|
||||||
|
EID.CachedIcons = {}
|
||||||
|
EID.CachedStrings = {}
|
||||||
|
EID.CachedRenderPoses = {}
|
||||||
|
-- EID.CachedIndicators = {}
|
||||||
|
EID.previousDescs = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function EID:addDescriptionToPrint(desc)
|
function EID:addDescriptionToPrint(desc)
|
||||||
if desc.Entity and EID.entitiesToPrint[GetPtrHash(desc.Entity)] then return end
|
if desc.Entity and EID.entitiesToPrint[GetPtrHash(desc.Entity)] then return end
|
||||||
@@ -459,7 +467,11 @@ function EID:addDescriptionToPrint(desc)
|
|||||||
if desc.Entity then EID.entitiesToPrint[GetPtrHash(desc.Entity)] = true end
|
if desc.Entity then EID.entitiesToPrint[GetPtrHash(desc.Entity)] = true end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local prevPrintFrame = 0
|
||||||
|
|
||||||
function EID:printDescriptions(useCached)
|
function EID:printDescriptions(useCached)
|
||||||
|
prevPrintFrame = EID.GameRenderCount
|
||||||
|
|
||||||
EID.CachingDescription = false
|
EID.CachingDescription = false
|
||||||
if not useCached then
|
if not useCached then
|
||||||
-- Test if we should print our cached descriptions or not
|
-- Test if we should print our cached descriptions or not
|
||||||
@@ -489,10 +501,7 @@ end
|
|||||||
|
|
||||||
function EID:printNewDescriptions()
|
function EID:printNewDescriptions()
|
||||||
EID.CachingDescription = true
|
EID.CachingDescription = true
|
||||||
EID.CachedIcons = {}
|
resetDescCache()
|
||||||
EID.CachedStrings = {}
|
|
||||||
EID.CachedRenderPoses = {}
|
|
||||||
EID.previousDescs = {}
|
|
||||||
|
|
||||||
for i,newDesc in ipairs(EID.descriptionsToPrint) do
|
for i,newDesc in ipairs(EID.descriptionsToPrint) do
|
||||||
if newDesc.Description == "UnidentifiedPill" then
|
if newDesc.Description == "UnidentifiedPill" then
|
||||||
@@ -1179,13 +1188,13 @@ local function onRender(t)
|
|||||||
EID.descriptionsToPrint = {}
|
EID.descriptionsToPrint = {}
|
||||||
EID.entitiesToPrint = {}
|
EID.entitiesToPrint = {}
|
||||||
alwaysUseLocalMode = false
|
alwaysUseLocalMode = false
|
||||||
if EID:RefreshThisFrame() then
|
|
||||||
EID.CachedIcons = {}
|
-- if frames were skipped (due to EID being hidden / in battle / in options), wipe the desc cache
|
||||||
EID.CachedStrings = {}
|
if EID.GameRenderCount > prevPrintFrame + 1 then
|
||||||
EID.CachedRenderPoses = {}
|
resetDescCache()
|
||||||
EID.CachedIndicators = {}
|
EID.CachedIndicators = {}
|
||||||
EID.previousDescs = {}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Do not check our hide or scale hotkeys while a tab that can modify them is open
|
-- Do not check our hide or scale hotkeys while a tab that can modify them is open
|
||||||
if EID.MCMCompat_isDisplayingEIDTab ~= "Visuals" then
|
if EID.MCMCompat_isDisplayingEIDTab ~= "Visuals" then
|
||||||
-- scale key must be handled before resetting to non-local mode
|
-- scale key must be handled before resetting to non-local mode
|
||||||
@@ -1242,6 +1251,9 @@ local function onRender(t)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- We'll redraw the indicators in the process of determining what's in range, so wipe their cache
|
||||||
|
EID.CachedIndicators = {}
|
||||||
|
|
||||||
if EID.Config["EnableMouseControls"] then
|
if EID.Config["EnableMouseControls"] then
|
||||||
local hudDescription = EID:handleHoverHUD()
|
local hudDescription = EID:handleHoverHUD()
|
||||||
if hudDescription then
|
if hudDescription then
|
||||||
|
|||||||
Reference in new issue
Block a user