From 3c71ef479348a22c5ffe22efe5c344c75955e0b4 Mon Sep 17 00:00:00 2001 From: avitasia Date: Fri, 6 Feb 2026 08:09:27 -0800 Subject: [PATCH] add keybind/slash command to cycle doodad visibility --- Bindings.xml | 4 ++++ settings.lua | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/Bindings.xml b/Bindings.xml index d632749..4be304b 100644 --- a/Bindings.xml +++ b/Bindings.xml @@ -19,4 +19,8 @@ SlashCmdList.PBCYCLEPLAYERVISIBILITY() + + SlashCmdList.PBCYCLEDOODADVISIBILITY() + + diff --git a/settings.lua b/settings.lua index 9e6d085..f939530 100644 --- a/settings.lua +++ b/settings.lua @@ -11,6 +11,7 @@ PerfBoost:RegisterDefaults("profile", { per_character_settings = false, previous_player_render_dist = nil, previous_player_render_dist_in_combat = nil, + previous_doodad_render_dist = nil, }) PerfBoost.frame = CreateFrame("Frame", "PerfBoost", UIParent) @@ -20,6 +21,7 @@ BINDING_NAME_PBHIDEALLPLAYERS = "Toggle hide all players (overrides other settin BINDING_NAME_PBTOGGLEPLAYERRENDERIST = "Toggle 0 player render distance (hides all players respecting other settings)"; BINDING_NAME_PBSHOWALLPLAYERS = "Toggle show all players (overrides other settings)"; BINDING_NAME_PBCYCLEPLAYERVISIBILITY = "Cycle player visibility: show all -> hide all -> normal"; +BINDING_NAME_PBCYCLEDOODADVISIBILITY = "Cycle doodad visibility: current -> hidden -> always render"; -- used when turning on per character settings function PerfBoost:SavePerCharacterSettings() @@ -886,6 +888,37 @@ function SlashCmdList.PBTOGGLEPLAYERRENDERIST(msg, editbox) end end +SLASH_PBCYCLEDOODADVISIBILITY1, SLASH_PBCYCLEDOODADVISIBILITY2 = '/pbcycledoodadvisibility', '/pbcycledoodads' +function SlashCmdList.PBCYCLEDOODADVISIBILITY(msg, editbox) + local has_doodad = pcall(GetCVar, "PB_DoodadRenderDist") + if not has_doodad then + DEFAULT_CHAT_FRAME:AddMessage("|cffffcc00PerfBoost:|r PB_DoodadRenderDist not available") + return + end + + local currentDist = tonumber(GetCVar("PB_DoodadRenderDist")) or 0 + + if PerfBoost.db.profile.previous_doodad_render_dist == nil then + -- Normal -> 0 (hide doodads) + PerfBoost.db.profile.previous_doodad_render_dist = currentDist + PerfBoost.db.profile.PB_DoodadRenderDist = 0 + SetCVar("PB_DoodadRenderDist", "0") + DEFAULT_CHAT_FRAME:AddMessage("|cffffcc00PerfBoost:|r Doodad render distance set to 0 (hidden)") + elseif currentDist == 0 then + -- 0 -> -1 (always render) + PerfBoost.db.profile.PB_DoodadRenderDist = -1 + SetCVar("PB_DoodadRenderDist", "-1") + DEFAULT_CHAT_FRAME:AddMessage("|cffffcc00PerfBoost:|r Doodad render distance set to -1 (always render)") + else + -- -1 (or any other state) -> restore previous + local restoreValue = PerfBoost.db.profile.previous_doodad_render_dist + PerfBoost.db.profile.PB_DoodadRenderDist = restoreValue + SetCVar("PB_DoodadRenderDist", tostring(restoreValue)) + DEFAULT_CHAT_FRAME:AddMessage("|cffffcc00PerfBoost:|r Doodad render distance restored to " .. tostring(restoreValue)) + PerfBoost.db.profile.previous_doodad_render_dist = nil + end +end + -- Conditionally add new CVars if they exist (for compatibility with older DLL versions) local has_laggy_boss_spells = pcall(GetCVar, "PB_HideLaggyBossSpellsOnOthers") if has_laggy_boss_spells then