Re: CryEngine - Flowgraph - Check if an UI Element is visible or not

#2
Have you tried the node "UI:Display:UIElementListner"?
Paste with links or CTRL+V in a empty Flow graph, you should get a similar effect.

Code: Select all

<Graph Description="" Group=""> <Nodes> <Node Id="115" Class="UI:Display:Display" pos="2826,252,0"> <Inputs uiElements_Element="HUD3D" instanceID="-1"/> </Node> <Node Id="122" Class="UI:Display:UIElementListener" pos="2826,486,0"> <Inputs uiElements_Element="HUD3D" instanceID="-1"/> </Node> <Node Id="124" Class="Logic:Any" pos="3222,486,0"> <Inputs /> </Node> <Node Id="128" Class="Debug:InputKey" pos="2322,270,0"> <Inputs entityId="0" Key="enter" NonDevMode="0"/> </Node> <Node Id="130" Class="Logic:Sequentializer" pos="2592,288,0"> <Inputs Closed="0" Reverse="0"/> </Node> <Node Id="132" Class="Math:BooleanTo" pos="3222,270,0"> <Inputs /> </Node> <Node Id="134" Class="Logic:Any" pos="3456,270,0"> <Inputs /> </Node> </Nodes> <Edges> <Edge nodeIn="132" nodeOut="115" portIn="false" portOut="onHide" enabled="1"/> <Edge nodeIn="132" nodeOut="115" portIn="true" portOut="onShow" enabled="1"/> <Edge nodeIn="124" nodeOut="122" portIn="in5" portOut="onHide" enabled="1"/> <Edge nodeIn="124" nodeOut="122" portIn="in4" portOut="onShow" enabled="1"/> <Edge nodeIn="130" nodeOut="128" portIn="In" portOut="Pressed" enabled="1"/> <Edge nodeIn="115" nodeOut="130" portIn="hide" portOut="Out1" enabled="1"/> <Edge nodeIn="115" nodeOut="130" portIn="show" portOut="Out2" enabled="1"/> <Edge nodeIn="134" nodeOut="132" portIn="in1" portOut="out" enabled="1"/> </Edges> </Graph>

Re: CryEngine - Flowgraph - Check if an UI Element is visible or not

#3
Have you tried the node "UI:Display:UIElementListner"?
Paste with links or CTRL+V in a empty Flow graph, you should get a similar effect.

Code: Select all

<Graph Description="" Group=""> <Nodes> <Node Id="115" Class="UI:Display:Display" pos="2826,252,0"> <Inputs uiElements_Element="HUD3D" instanceID="-1"/> </Node> <Node Id="122" Class="UI:Display:UIElementListener" pos="2826,486,0"> <Inputs uiElements_Element="HUD3D" instanceID="-1"/> </Node> <Node Id="124" Class="Logic:Any" pos="3222,486,0"> <Inputs /> </Node> <Node Id="128" Class="Debug:InputKey" pos="2322,270,0"> <Inputs entityId="0" Key="enter" NonDevMode="0"/> </Node> <Node Id="130" Class="Logic:Sequentializer" pos="2592,288,0"> <Inputs Closed="0" Reverse="0"/> </Node> <Node Id="132" Class="Math:BooleanTo" pos="3222,270,0"> <Inputs /> </Node> <Node Id="134" Class="Logic:Any" pos="3456,270,0"> <Inputs /> </Node> </Nodes> <Edges> <Edge nodeIn="132" nodeOut="115" portIn="false" portOut="onHide" enabled="1"/> <Edge nodeIn="132" nodeOut="115" portIn="true" portOut="onShow" enabled="1"/> <Edge nodeIn="124" nodeOut="122" portIn="in5" portOut="onHide" enabled="1"/> <Edge nodeIn="124" nodeOut="122" portIn="in4" portOut="onShow" enabled="1"/> <Edge nodeIn="130" nodeOut="128" portIn="In" portOut="Pressed" enabled="1"/> <Edge nodeIn="115" nodeOut="130" portIn="hide" portOut="Out1" enabled="1"/> <Edge nodeIn="115" nodeOut="130" portIn="show" portOut="Out2" enabled="1"/> <Edge nodeIn="134" nodeOut="132" portIn="in1" portOut="out" enabled="1"/> </Edges> </Graph>
Thank for your help :D But let me confirm a little bit
Image
So the exact node that make the the toggle here work is Logic:Sequentializer, not UI:Display:UIElementListener. So the result is not as expected (as expected, if the MainMenu is visible, then hide it, if it is in-visible, then show it. In this case, it just hides, shows, hides,...), so it's kind of toggle but not really toggle, for example, in the case the MainMenu is hidden at initial, then the first hit Enter, the flow-graph just hides the MainMenu again instead of showing it.
About UI:Display:UIElementListener, I see that this flowgraph doesn't use it - just showcases it. So if I want to make it works, I need a boolean variable to store the current visible state of the MainMenu - and the Toggle flowgraph will use this boolean to determine to show or hide. But currently, I don't know how to make a boolean variable in flowgraph & put it in the if statement. The idea is like this (but after a few tries, I don't know if it's possible to implement this idea in flowgraph):
Image
Small tips
How to add an image to a forum post
[C++] How to smoothly turn your character

Re: CryEngine - Flowgraph - Check if an UI Element is visible or not

#4
In that example i was using hud3d which is on by default in the GameSDK.
That's why i had the the Sequentializer out1 and out2 crossed over.
for the menu you can simply change:
Logic:Sequentializer Out1 -> Show UI:Display:Display
Logic:Sequentializer Out2 -> Hide UI:Display:Display

I understand your approach and at this moment all i can offer is this workaround.

To simulate what you would like get you may want to do it this way:
Image

You can make a game token.
Flowgraph > Tools > Edit Graph Tokens > New Token > Name e.g "Menu_isVisible" Type=Bool

And here the code:

Code: Select all

<Graph Description="" Group="Tests_FG"> <Nodes> <Node Id="115" Class="UI:Display:Display" pos="-108,1512,0"> <Inputs uiElements_Element="MainMenu" instanceID="-1"/> </Node> <Node Id="122" Class="UI:Display:UIElementListener" pos="-108,1782,0"> <Inputs uiElements_Element="MainMenu" instanceID="-1"/> </Node> <Node Id="128" Class="Debug:InputKey" pos="-612,1530,0"> <Inputs entityId="0" Key="enter" NonDevMode="0"/> </Node> <Node Id="130" Class="Logic:Sequentializer" pos="-342,1548,0"> <Inputs Closed="0" Reverse="0"/> </Node> <Node Id="140" Class="Mission:GameTokenGet" pos="-36,2052,0"> <Inputs gametoken_Token="Menu_isVisible"/> </Node> <Node Id="142" Class="Mission:GameTokenSet" pos="306,1764,0"> <Inputs gametoken_Token="Menu_isVisible" Value="1"/> </Node> <Node Id="143" Class="Mission:GameTokenSet" pos="306,1890,0"> <Inputs gametoken_Token="Menu_isVisible" Value="0"/> </Node> <Node Id="147" Class="Time:Timer" pos="-270,2052,0"> <Inputs period="0.1" min="0" max="0" paused="0"/> </Node> <Node Id="149" Class="Logic:Any" pos="360,2052,0"> <Inputs /> </Node> <Node Id="150" Name="Menu_isVisible_state_bool" Class="_comment" pos="360,2034,0"/> </Nodes> <Edges> <Edge nodeIn="142" nodeOut="122" portIn="Trigger" portOut="onShow" enabled="1"/> <Edge nodeIn="143" nodeOut="122" portIn="Trigger" portOut="onHide" enabled="1"/> <Edge nodeIn="130" nodeOut="128" portIn="In" portOut="Pressed" enabled="1"/> <Edge nodeIn="115" nodeOut="130" portIn="show" portOut="Out1" enabled="1"/> <Edge nodeIn="115" nodeOut="130" portIn="hide" portOut="Out2" enabled="1"/> <Edge nodeIn="149" nodeOut="140" portIn="in1" portOut="OutValue" enabled="1"/> <Edge nodeIn="140" nodeOut="147" portIn="Trigger" portOut="out" enabled="1"/> </Edges> </Graph>

Who is online

Users browsing this forum: No registered users and 1 guest