Skip to content

Commit

Permalink
ability to disable poolers
Browse files Browse the repository at this point in the history
  • Loading branch information
kodewdle committed Nov 23, 2024
1 parent 6c27022 commit 990c6a4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 9 additions & 4 deletions ElvUI/Core/Modules/Nameplates/StyleFilter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1636,16 +1636,17 @@ end
do -- oUF style filter inject watch functions without actually registering any events
local pooler = CreateFrame('Frame')
pooler.delay = 0.1 -- update check rate
pooler.frames = {}
pooler.active = true -- off is always instant
pooler.tracked = {}

ElvUF.Pooler.StyleFilter = pooler

function NP:StyleFilterPoolerRun()
for frame in pairs(pooler.frames) do
for frame in pairs(pooler.tracked) do
NP:StyleFilterUpdate(frame, 'PoolerUpdate')
end

wipe(pooler.frames) -- clear it out
wipe(pooler.tracked) -- clear it out
end

function NP:StyleFilterPoolerOnUpdate(elapsed)
Expand Down Expand Up @@ -1676,7 +1677,11 @@ do -- oUF style filter inject watch functions without actually registering any e
if trigger == 2 and (self.unit ~= arg1) then
return -- this blocks rechecking other plates on added when not using the amount trigger (preformance thing)
elseif trigger and (auraEvent or NP.StyleFilterDefaultEvents[event] or (arg1 and arg1 == self.unit)) then
pooler.frames[self] = true
if pooler.active then
pooler.tracked[self] = true
else
NP:StyleFilterUpdate(self, 'PoolerUpdate')
end
end
end

Expand Down
7 changes: 6 additions & 1 deletion ElvUI_Libraries/Core/oUF/simpy/pooler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ object.times = {}

object.delay = 0.1 -- update check rate
object.instant = 1 -- seconds since last event
object.active = true -- off is always instant

pooler.run = function(funcs, frame, event, ...)
for i = 1, #funcs do
Expand Down Expand Up @@ -87,7 +88,9 @@ end
pooler.tracker = function(frame, event, arg1, ...)
-- print('tracker', frame, event, arg1, ...)
local pool = object.events[event]
if pool then
if not pool then return end

if object.active then
local now = time()
local last = object.times[event]
if last and (last + object.instant) < now then
Expand All @@ -111,6 +114,8 @@ pooler.tracker = function(frame, event, arg1, ...)
end

object.times[event] = now
else
pooler.execute(event, pool, true, arg1, ...)
end
end

Expand Down

0 comments on commit 990c6a4

Please sign in to comment.