feat(frame): region:GetDebugName([preferParentKey])

Retail's debug name for a region: its global name; else its parent's
debug name, a dot, and the key that holds it in the parent's Lua table,
or its address in hex when no key holds it; "" for an unnamed region
with no parent. preferParentKey puts the key path ahead of a global
name. The key comes from the parent's table, so a plain Lua assignment
resolves once the region is parented, as on retail.

The frame stack tooltip prints names through it, which removes the
debug tools' local _DebugName. Game::Lua::ObjectName exposes the
engine's GetName virtual for unnamed-aware callers.
This commit is contained in:
Brues
2026-10-27 18:06:38 -05:00
parent 04ce033907
commit 7add0fc88f
5 changed files with 160 additions and 15 deletions
@@ -1042,14 +1042,6 @@ local function _StringToBoolean(stringToCheck, defaultReturn)
return defaultReturn;
end
-- What the modern tooltip prints through GetDebugName: the global name,
-- else the object's table.
local function _DebugName(obj)
local name = obj.GetName and obj:GetName();
if (name and name ~= "") then return name; end
return tostring(obj);
end
local function _WrapColor(text, colorHex)
return "|c" .. colorHex .. text .. "|r";
end
@@ -1084,7 +1076,7 @@ end
function FrameStackTooltip_InspectTable(self)
if (self.highlightFrame) then
TableInspector_Show(self.highlightFrame, _DebugName(self.highlightFrame));
TableInspector_Show(self.highlightFrame, self.highlightFrame:GetDebugName());
end
end
@@ -1114,7 +1106,7 @@ local function _FormatTextureInfo(region)
if (file == nil) then
return nil;
end
return string.format("%s : %s: %s %s", _DebugName(region), _WrapColor("File", "ffff0000"),
return string.format("%s : %s: %s %s", region:GetDebugName(), _WrapColor("File", "ffff0000"),
tostring(file), _FormatTextureCoordinates(region:GetTexCoord()));
end
@@ -1153,7 +1145,7 @@ function FrameStackTooltip_OnTooltipSetFrameStack(self, highlightFrame)
end
if (fsobj) then
self:AddLine(string.format("\nfsobj = %s", _DebugName(fsobj)));
self:AddLine(string.format("\nfsobj = %s", fsobj:GetDebugName()));
end
end