Quantcast
WoWInterface - View Single Post - caelNameplates
Thread: caelNameplates
View Single Post
08-17-16, 06:13 AM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Short version:
It's probably easier just to delete everything and start over from scratch, since you're going to have to rewrite 90% of your code anyway.

Long version:

This is not how you identify nameplate children/regions anymore:

lua Code:
  1. frame.barFrame, frame.nameFrame = frame:GetChildren()
  2.     frame.healthBar, frame.absorbBar, frame.castBar = frame.barFrame:GetChildren()
  3.  
  4.     local healthBar, castBar = frame.healthBar, frame.castBar
  5.     local glowRegion, overlayRegion, highlightRegion, levelTextRegion, bossIconRegion, raidIconRegion, stateIconRegion = frame.barFrame:GetRegions()
  6.     local _, castbarOverlay, shieldedRegion, spellIconRegion = castBar:GetRegions()
  7.     local nameTextRegion = frame.nameFrame:GetRegions()

All of the objects on a nameplate are accessible through named keys now. See here:
https://www.townlong-yak.com/framexm...Plates.xml#289

This is no longer relevant either:
lua Code:
  1. local numKids = 0
  2. local lastUpdate = 0
  3. local index = 1
  4. local OnUpdate = function(self, elapsed)
  5.     lastUpdate = lastUpdate + elapsed
  6.  
  7.     if lastUpdate > 0.1 then
  8.         lastUpdate = 0
  9.  
  10.         local newNumKids = WorldFrame:GetNumChildren()
  11.         if newNumKids ~= numKids then
  12.             numKids = WorldFrame:GetNumChildren()
  13.             for i = index, numKids do
  14.                 local frame = select(i, WorldFrame:GetChildren())
  15.                 local name = frame:GetName()
  16.  
  17.                 if name and name:find("NamePlate") and not frame.done then
  18.                     --StyleFrame(frame)
  19.                     CreatePlate(frame)
  20.                     index = i
  21.                 end
  22.             end
  23.         end
  24.     end
  25. end
  26. caelNamePlates:SetScript("OnUpdate", OnUpdate)

This should work now:

lua Code:
  1. hooksecurefunc(NamePlateDriverFrame, "OnNamePlateCreated", function(_, frame)
  2.     CreatePlate(frame.UnitFrame)
  3. end)
  4.  
  5. hooksecurefunc(NamePlateDriverFrame, "ApplyFrameOptions", function(_, frame, unit)
  6.     UpdatePlate(frame.UnitFrame)
  7. end)

Other changes you'll need to make:

Your "CreatePlate" function should only create any new objects you want to add. It should not:

- assign existing objects to keys (eg. don't write "nameplate.healthBar = <something>")
- overwrite existing keys (look what exists before adding keys for your custom objects)

Your "UpdatePlate" function will need to be updated to refer to the existing keys for default objects.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Donít message me about addon bugs or programming questions.
  Reply With Quote