Seneral / Node_Editor_Framework

A flexible and modular Node Editor Framework for creating node based displays and editors in Unity
https://nodeeditor.seneral.dev
MIT License
2.02k stars 414 forks source link

OverlayGUI (Popups) #38

Open Seneral opened 8 years ago

Seneral commented 8 years ago

Description: For the Node Editor to properly work at runtime, we need support for all kinds of popups (GenericMenu, EnumPopup, IntPopup, etc., even Tooltip). This will also fix some bugs regarding node focussing problems, as these will not block user input straight away when clicking it (even the first click event). Additionally, this will open up the possibility to let them account for the zooming - respective built-in controls will simply ignore the GUI scaling:/

State: This is easily possible using the Popup Engine I already made for the GenericMenu to work.

Location: OverlayGUI.cs and RTEditorGUI.cs for implementing new popups

yeneZan commented 8 years ago

When curEditorState.zoom != 1,the hint&popups wouldn't draw on the node.It troubles me the whole daytime,but I have no idea what's the renderring space when use the GUI class instead of GUILayout. I was trying to fix it with GUI.BeginArea(Node.rect) but failed. I'm looking for your suggestion, thank you.

Seneral commented 8 years ago

That's an internal error of Unity. Apparently they considered the GUI scaling not as important to adjust popups, generic menus and tooltips to it:/ So these elements do not consider that their controls have been scaled and so they are offsetted very weirdly. I'm partially trying to fix this, by replacing these messed controls. This is why the context menu in this framework is not looking the same as it does in the rest of the editor, because it's a custom one that accounts for scaling:)

yeneZan commented 8 years ago

That's what I explained to my teammates.I just want to check out whether you guys have any idea. As I say above, GUI.BeginArea(Node.rect) could make these draw at a certain point. But the position would also be influenced with scaling and window size. And I try a function to make this position come close to the node. It do work but because of some mistake it still not render correct,so I finally make scale become 1.

Finally, I want to show you my usage and thank you for your answer and great work.

image

thinklikeanarchitect commented 6 years ago

So, is there a solution to use enum popup at runtime?

Seneral commented 6 years ago

Not one that I know of. I've had plans to extend this - which isn't too hard given the base of the popups already in the framework - but not came to this so far. OverlayGUI is where I would put it, if you want you can check it out and see if it's something you want to tackle yourself.