Thread Tools Display Modes
06/29/15, 05:36 PM   #1
Hozec
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 11
Hiding things when in game menus

Hey guys I am a noob eso addon developer and need a little help hiding my addon while in a game menu or inventory/map/character sheet etc.

I have plenty of addons installed that do this but i tried seeing how it is done and have gotten no where.

Thanks in advance for your help.
  Reply With Quote
06/29/15, 06:29 PM   #2
Kraeius
 
Kraeius's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 25
Originally Posted by Hozec View Post
Hey guys I am a noob eso addon developer and need a little help hiding my addon while in a game menu or inventory/map/character sheet etc.

I have plenty of addons installed that do this but i tried seeing how it is done and have gotten no where.

Thanks in advance for your help.
These are the controls I use in InfoHub to check;

Lua Code:
  1. local isSettingsMenuHidden = ZO_GameMenu_InGame:IsHidden()
  2. local isInteractWindowHidden = ZO_InteractWindow:IsHidden()
  3. local isWorldMapHidden = ZO_WorldMap:IsHidden()
  4. local isCraftingHidden = ZO_CraftingResultsTopLevel:IsHidden()
  5. local isJournalHidden = ZO_QuestJournal:IsHidden()
  6. local areGamePanelsHidden = ZO_KeybindStripControl:IsHidden()
  Reply With Quote
06/29/15, 07:17 PM   #3
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
The proper way is to wrap your top-level control in a scene fragment, add that fragment to specific scenes and let the scene manager handle its visibility.

Look for SCENE_MANAGER in the addons that do this, or here on forums, e.g.:

http://www.esoui.com/forums/showthre...=scene_manager
http://www.esoui.com/forums/showthre...=scene_manager
  Reply With Quote
06/29/15, 08:23 PM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
How to show/hide window using the SCENE_MANAGER:
http://www.esoui.com/portal.php?&id=27&pageid=12
  Reply With Quote
06/29/15, 11:44 PM   #5
Kraeius
 
Kraeius's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 25
Why not just SetHidden his addon's top level control? What's the catch with SCENE_MANAGER?
  Reply With Quote
06/30/15, 12:54 AM   #6
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Is even more clean. You are checking few scenes, but there's a loot more.

each fragment is optional here

Lua Code:
  1. -- Main Scene
  2.     MYADDON_MAIN_SCENE = ZO_Scene:New("MyAddonMain", SCENE_MANAGER)
  3.    
  4.     -- Mouse standard position and background
  5.     MYADDON_MAIN_SCENE:AddFragmentGroup(FRAGMENT_GROUP.MOUSE_DRIVEN_UI_WINDOW)
  6.     -- MYADDON_MAIN_SCENE:AddFragmentGroup(FRAGMENT_GROUP.FRAME_TARGET_STANDARD_RIGHT_PANEL)
  7.    
  8.     -- Background Right, it will set ZO_RightPanelFootPrint and its stuff.
  9.     -- MYADDON_MAIN_SCENE:AddFragment(RIGHT_BG_FRAGMENT)
  10.    
  11.     -- The title fragment
  12.     -- MYADDON_MAIN_SCENE:AddFragment(TITLE_FRAGMENT)
  13.    
  14.     -- Set Title
  15.     -- ZO_CreateStringId("SI_MYADDON_MAIN_MENU_TITLE", "My Addon Name")
  16.     -- MYADDON_MAIN_TITLE_FRAGMENT = ZO_SetTitleFragment:New(SI_MYADDON_MAIN_MENU_TITLE)
  17.     -- MYADDON_MAIN_SCENE:AddFragment(MYADDON_MAIN_TITLE_FRAGMENT)
  18.    
  19.     -- Add the XML to our scene
  20.     MYADDON_MAIN_WINDOW = ZO_FadeSceneFragment:New(MyUINameInXML)
  21.     MYADDON_MAIN_SCENE:AddFragment(MYADDON_MAIN_WINDOW)
  Reply With Quote
06/30/15, 07:05 AM   #7
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Kraeius View Post
Why not just SetHidden his addon's top level control? What's the catch with SCENE_MANAGER?
The SCENE_MANAGER solution is more robust. It's also likely that the SCENE_MANAGER can check the rules faster than a Lua handler.

I don't use your Infohub, but just looking at the code -- see how HideCheck starts with a not-so-small condition? It's still quite readable, but if you had more complex rules, it'd quickly get very hard to read and debug. Then, if I read it correctly, it's called upon every OnUpdate on your top-level RAETIA_InfoHub control, which is always visible? That's not good. Why do a visibility check on every single frame? (Edit: oh, it's throttled at 1 per second. My bad. But that means it won't show up immediately, right? I think you could only gain with fragments ) If you had everything in fragments, your HideCheck wouldn't need to exist

Last edited by merlight : 06/30/15 at 07:11 AM.
  Reply With Quote
06/30/15, 02:41 PM   #8
Hozec
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 11
Thanks everyone. I now understand how the scene manager works! Appreciate the help.
  Reply With Quote
06/30/15, 03:47 PM   #9
Kraeius
 
Kraeius's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 25
Originally Posted by merlight View Post
The SCENE_MANAGER solution is more robust. It's also likely that the SCENE_MANAGER can check the rules faster than a Lua handler.

I don't use your Infohub, but just looking at the code -- see how HideCheck starts with a not-so-small condition? It's still quite readable, but if you had more complex rules, it'd quickly get very hard to read and debug. Then, if I read it correctly, it's called upon every OnUpdate on your top-level RAETIA_InfoHub control, which is always visible? That's not good. Why do a visibility check on every single frame? (Edit: oh, it's throttled at 1 per second. My bad. But that means it won't show up immediately, right? I think you could only gain with fragments ) If you had everything in fragments, your HideCheck wouldn't need to exist
Yeah my hide check is messy. I got your point now, I may also need to revise mine.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Hiding things when in game menus


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