ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Troubbleshooting/error help (https://www.esoui.com/forums/showthread.php?t=1823)

SkOODaT 06/20/14 08:38 PM

Troubbleshooting/error help
 
Im getting a warning

Gui Warning: Avoiding anchor cycle from [ZO_TargetUnitFramereticleoverName] to [ZO_TargetUnitFramereticleoverLevel]

not too sure whats causing it tho this is how i am anchoring its only occuring when i disable and set Default Anchors
i have this running OnUpdate only when shown too.....

Lua Code:
  1. if TMSaved.ImprovedLevel then
  2.             ZO_TargetUnitFramereticleoverLevel:ClearAnchors()
  3.             ZO_TargetUnitFramereticleoverLevel:SetAnchor(TOP, ZO_TargetUnitFramereticleover, BOTTOM, 0, 0)
  4.             ZO_TargetUnitFramereticleoverName:ClearAnchors()
  5.             ZO_TargetUnitFramereticleoverName:SetAnchor(TOP, ZO_TargetUnitFramereticleoverLevel, BOTTOM, 0, 0)
  6.             ZO_TargetUnitFramereticleoverCaption:ClearAnchors()
  7.             ZO_TargetUnitFramereticleoverCaption:SetAnchor(TOP, ZO_TargetUnitFramereticleoverName, BOTTOM, 0, 0)
  8.             ZO_TargetUnitFramereticleoverVeteranIcon:ClearAnchors()
  9.             ZO_TargetUnitFramereticleoverVeteranIcon:SetAnchor(RIGHT, ZO_TargetUnitFramereticleoverName, LEFT, 0, 0)
  10.             ZO_TargetUnitFramereticleoverRankIcon:ClearAnchors()
  11.             ZO_TargetUnitFramereticleoverRankIcon:SetAnchor(LEFT, ZO_TargetUnitFramereticleoverName, RIGHT, 0, 0)
  12.             ZO_TargetUnitFramereticleoverLevel:SetHidden(false)                                                                           -- Force Level To Always Show Name Anchors To Lv And NPCs Etc Have Lvs Shown Everything Does As It Should
  13.         else
  14.             -- Default Anchors --------------------------------------------------------------------------
  15.             ZO_TargetUnitFramereticleoverName:ClearAnchors()
  16.             ZO_TargetUnitFramereticleoverName:SetAnchor(TOP, ZO_TargetUnitFramereticleover, BOTTOM, 0, 0)
  17.             ZO_TargetUnitFramereticleoverCaption:ClearAnchors()
  18.             ZO_TargetUnitFramereticleoverCaption:SetAnchor(TOP, ZO_TargetUnitFramereticleoverName, BOTTOM, 0, 0)
  19.             ZO_TargetUnitFramereticleoverLevel:ClearAnchors()
  20.             ZO_TargetUnitFramereticleoverLevel:SetAnchor(RIGHT, ZO_TargetUnitFramereticleoverName, LEFT, -5, 0)     ------ ITS THIS LINE CAUSEIN IT?????
  21.             ZO_TargetUnitFramereticleoverVeteranIcon:ClearAnchors()
  22.             ZO_TargetUnitFramereticleoverVeteranIcon:SetAnchor(RIGHT, ZO_TargetUnitFramereticleoverLevel, LEFT, 0, 0)  
  23.             ZO_TargetUnitFramereticleoverRankIcon:ClearAnchors()
  24.             ZO_TargetUnitFramereticleoverRankIcon:SetAnchor(LEFT, ZO_TargetUnitFramereticleoverName, RIGHT, 0, 0)  
  25.             ZO_TargetUnitFramereticleoverLevel:SetHidden(false)            
  26.         end
i think it could be because im redefining the anchors and their already defined in the default UI i dont know tho im learning lol

**it seems as long as ZO_TargetUnitFramereticleoverLevel isnt anchored to ZO_TargetUnitFramereticleoverName everything is fine no error but isnt that the way its anchored default ??

ZO_TargetUnitFramereticleoverLevel:SetAnchor(RIGHT, ZO_TargetUnitFramereticleoverName, LEFT, -5, 0)

** is everyhting anchored to ZO_TargetUnitFramereticleoverTextArea would anyone know ? and then eso has just adjusted the x,y to proper places?

any help would be awesome thank you

SkOODaT 06/20/14 10:57 PM

well this is what ive figured out to fix the error

Lua Code:
  1. ZO_TargetUnitFramereticleoverName:ClearAnchors()
  2.             ZO_TargetUnitFramereticleoverName:SetAnchor(TOP, ZO_TargetUnitFramereticleoverTextArea, NONE, 0, 0)
  3.             ZO_TargetUnitFramereticleoverCaption:ClearAnchors()
  4.             ZO_TargetUnitFramereticleoverCaption:SetAnchor(TOP, ZO_TargetUnitFramereticleoverName, BOTTOM, 0, 0)
  5.             ZO_TargetUnitFramereticleoverLevel:ClearAnchors()
  6.             ZO_TargetUnitFramereticleoverLevel:SetAnchor(TOP, ZO_TargetUnitFramereticleoverTextArea, TOPLEFT, -5, 0)
  7.             ZO_TargetUnitFramereticleoverVeteranIcon:ClearAnchors()
  8.             ZO_TargetUnitFramereticleoverVeteranIcon:SetAnchor(RIGHT, ZO_TargetUnitFramereticleoverLevel, LEFT, -5, 0)  
  9.             ZO_TargetUnitFramereticleoverRankIcon:ClearAnchors()
  10.             ZO_TargetUnitFramereticleoverRankIcon:SetAnchor(LEFT, ZO_TargetUnitFramereticleoverName, RIGHT, 5, 0)  
  11.             ZO_TargetUnitFramereticleoverLevel:SetHidden(false)

but if anyone knows how all the default text gets anchored to the target frame any insight would still be awesome this is more of a workaround to get everything aligned correctly without having the anchor error and to reloading the UI on disable :S

katkat42 06/20/14 11:02 PM

Well, an anchor cycle is when you have x anchored with reference to y, and y anchored with reference to x, at the same time. Maybe you could try clearing all anchors together, then setting them all, rather than clear/set, clear/set?

Garkin 06/21/14 04:13 AM

Quote:

Originally Posted by SkOODaT (Post 9574)
...

but if anyone knows how all the default text gets anchored to the target frame any insight would still be awesome this is more of a workaround to get everything aligned correctly without having the anchor error and to reloading the UI on disable :S

By default is everything anchored to the ZO_TargetUnitFramereticleoverTextArea:
Lua Code:
  1. local unitFrame = ZO_UnitFrames_GetUnitFrame("reticleover")
  2. local textArea = GetControl(unitFrame.frame, "TextArea")
  3.  
  4. if TMSaved.ImprovedLevel then
  5.    unitFrame.levelLabel:ClearAnchors()
  6.    unitFrame.nameLabel:ClearAnchors()
  7.    unitFrame.veteranIcon:ClearAnchors()
  8.    unitFrame.rankIcon:ClearAnchors()
  9.    unitFrame.captionLabel:ClearAnchors()
  10.    unitFrame.levelLabel:SetAnchor(TOP, textArea, BOTTOM, 0, 0)
  11.    unitFrame.nameLabel:SetAnchor(TOP, unitFrame.levelLabel, BOTTOM, 0, 0)
  12.    unitFrame.captionLabel:SetAnchor(TOP, unitFrame.nameLabel, BOTTOM, 0, 0)
  13.    unitFrame.veteranIcon:SetAnchor(RIGHT, unitFrame.nameLabel, LEFT, 0, 0)
  14.    unitFrame.rankIcon:SetAnchor(LEFT, unitFrame.nameLabel, RIGHT, 0, 0)
  15. else
  16.    unitFrame.levelLabel:ClearAnchors()
  17.    unitFrame.nameLabel:ClearAnchors()
  18.    unitFrame.veteranIcon:ClearAnchors()
  19.    unitFrame.rankIcon:ClearAnchors()
  20.    unitFrame.captionLabel:ClearAnchors()
  21.    unitFrame.levelLabel:SetAnchor(TOPLEFT, textArea, TOPLEFT, 0, 0)
  22.    unitFrame.nameLabel:SetAnchor(TOPLEFT, textArea, TOPLEFT, 0, 0)
  23.    unitFrame.veteranIcon:SetAnchor(TOPRIGHT, textArea, TOPLEFT, -2, -4)
  24.    unitFrame.rankIcon:SetAnchor(TOPLEFT, textArea, TOPRIGHT, 2, -4)
  25.    unitFrame.captionLabel:SetAnchor(TOP, textArea, BOTTOM, 0, 1)
  26. end
  27.  
  28. unitFrame.levelLabel:SetHidden(false)

But to be sure, you can store default anchors first:
Lua Code:
  1. local unitFrame = ZO_UnitFrames_GetUnitFrame("reticleover")
  2. local textArea = GetControl(unitFrame.frame, "TextArea")
  3.  
  4. local defautAnchors = {
  5.    levelLabel = ZO_Anchor:New():SetFromControlAnchor(unitFrame.levelLabel, 0),
  6.    nameLabel = ZO_Anchor:New():SetFromControlAnchor(unitFrame.nameLabel, 0),
  7.    veteranIcon = ZO_Anchor:New():SetFromControlAnchor(unitFrame.veteranIcon, 0),
  8.    rankIcon = ZO_Anchor:New():SetFromControlAnchor(unitFrame.rankIcon, 0),
  9.    captionLabel = ZO_Anchor:New():SetFromControlAnchor(unitFrame.captionLabel, 0),
  10. }
  11. local improvedAnchors = {
  12.    levelLabel = ZO_Anchor:New(TOP, textArea, BOTTOM, 0, 0)
  13.    nameLabel = ZO_Anchor:New(TOP, unitFrame.levelLabel, BOTTOM, 0, 0)
  14.    veteranIcon = ZO_Anchor:New(RIGHT, unitFrame.nameLabel, LEFT, 0, 0)
  15.    rankIcon = ZO_Anchor:New(LEFT, unitFrame.nameLabel, RIGHT, 0, 0)
  16.    captionLabel = ZO_Anchor:New(TOP, unitFrame.nameLabel, BOTTOM, 0, 0)
  17. }
  18.  
  19. local function SetAnchors(frame, anchorTable)
  20.    for key, anchor in pairs(anchorTable) do
  21.       anchor:Set(frame[key])
  22.    end
  23. end
  24.  
  25. if TMSaved.ImprovedLevel then
  26.    SetAnchors(unitFrame, improvedAnchors)
  27. else
  28.    SetAnchors(unitFrame, defaultAnchors)
  29. end
  30.  
  31. unitFrame.levelLabel:SetHidden(false)

SkOODaT 06/21/14 11:17 AM

@Garkin you've helped me so much on this site recently thank you, ill try this out :)

katkat42 06/21/14 02:22 PM

Garkin is awesome that way. :banana:


All times are GMT -6. The time now is 07:57 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI