Thread Tools Display Modes
06/20/14, 08:38 PM   #1
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
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

Last edited by SkOODaT : 06/20/14 at 09:28 PM.
  Reply With Quote
06/20/14, 10:57 PM   #2
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
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
  Reply With Quote
06/20/14, 11:02 PM   #3
katkat42
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
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?
  Reply With Quote
06/21/14, 04:13 AM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by SkOODaT View Post
...

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)

Last edited by Garkin : 06/21/14 at 04:16 AM.
  Reply With Quote
06/21/14, 11:17 AM   #5
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
@Garkin you've helped me so much on this site recently thank you, ill try this out
  Reply With Quote
06/21/14, 02:22 PM   #6
katkat42
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
Garkin is awesome that way.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Troubbleshooting/error help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off