WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   PTR General Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=172)
-   -   Bubbles in 9.0.1 (https://www.wowinterface.com/forums/showthread.php?t=58159)

Platine 08-19-20 12:07 AM

Bubbles in 9.0.1
 
I have a function fired on event CHAT_MSG_MONSTER_SAY - ChatFrame_AddMessageEventFilter("CHAT_MSG_MONSTER_SAY", ChatFilter) :

Code:

local function BB_bubblizeText()
  for i = 1, WorldFrame:GetNumChildren() do
    local child = select(i, WorldFrame:GetChildren());
    if not child:IsForbidden() then
        for j = 1, child:GetNumRegions() do
          region = select(j, child:GetRegions());
          ----more code
        end
    end
  end
  BB_ctrFrame:SetScript("OnUpdate", nil);
end


local function ChatFilter(self, event, arg1, arg2, arg3, _, arg5, ...)
  if (GetCVar("ChatBubbles")) then
      BB_ctrFrame:SetScript("OnUpdate", BB_bubblizeText);
  end
end

Method child:GetNumRegions() return always 0 now.
Is now any other way to review bubblized frames on the screen?

Goldpaw 08-26-20 03:52 AM

It returns 0 because all the regions have been moved to a nameless subframe now. I was able to discover the regions more or less this way;

Lua Code:
  1. -- Iterate all the bubbles.
  2. -- This function only returns bubbles we can edit,
  3. -- so we can bypass all the forbidden stuff, and save time.
  4. for _, bubble in pairs(C_ChatBubbles.GetAllChatBubbles()) do
  5.     -- Iterate the children, as the actual bubble content
  6.     -- has been placed in a nameless subframe in 9.0.1.
  7.     for i = 1, bubble:GetNumChildren() do
  8.         local child = select(i, select(i, bubble:GetChildren()))
  9.         if (child:GetObjectType() == "Frame") and (child.String) and (child.Center) then
  10.             -- This is hopefully the frame with the content
  11.             for i = 1, child:GetNumRegions() do
  12.                 local region = select(i, child:GetRegions())
  13.                 if (region:GetObjectType() == "Texture") then
  14.                     local texture = region:GetTexture()
  15.                     -- do something
  16.  
  17.                 elseif (region:GetObjectType() == "FontString") then
  18.                     local text = region
  19.                     -- do something
  20.                 end
  21.             end
  22.         end
  23.     end
  24.  
  25. end

Platine 10-16-20 10:26 AM

Yes, yes! This is the solution.
Thank you, Goldpaw.


All times are GMT -6. The time now is 03:26 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI