-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
global ImGui::hasChanged() ? #1049
Comments
Hello and welcome! It's better to split the feedback in different threads. It's been hard for me to answer single questions with my resources (shipping a game right now) so answering 3-4 unrelated questions isn't helping :) There's no global state of this kind. But would be easy to make all code returning true also set a flag that would be queryiable. Personally I don't really see this as a big benefit over the existing style but why not.
Columns in particular are still quite broken/limited in dear imgui, I almost regret hastily putting them in for version 1.0. Will probably and rewrite/finish this in 2017 tho.
They aren't much possibilities in term of layout yet. There is a PR for stack layout ( #846 )
That would break a lot of possibilities (movig/scrolling things around, preserving keyboard/gamepad focus when changing layout, etc.) and that wouldn't really be a win. Once you get the hang of it, the id stack and |
OK, one post per issue from now on ;) !
I can live without, just different habits I guess. Still think it wouldn't hurt, can be a nice fallback in some cases when you want a higher view of things. I feel like there would be very few places where it would have to be maintained (all the WidgetBehaviours or something, basically).
Wow, I'd like to see that :) ! You're being too hard on yourself though, try doing a grid with resizable columns in Unity... you'll feel the pain.
Beware of multi-pass, don't fall in Unity's trap :) !
OK the rect doesn't cut it (still thinking in Unity's term where the rect from Layout pass is the id used in Event/Repaint pass). Anyway, thanks again! |
I'm looking for a feature similar to Unity's GUI.changed, which allows to track if any widget was clicked/modified so far (button clicked, checkbox toggled, field modified, etc). I know ImGui widgets return the "changed" value as their return value, I'm looking for a global state.
What's nice about GUI.changed is you can track a whole block of widgets (using begin/end stacks) without checking every single one (so you can eg dirtify an object if any of its fields is touched).
I couldn't find anything like it in ImGuiIO, and a quick look at ButtonBehaviour didn't reveal anything that seemed relevant... am I missing something?
So far I have mixed feelings about either API styles.
dear imgui-style:
Unity-style:
Both styles have their pros & cons. ImGui is more terse (or probably more efficient, only writing to variables when they changed), Unity doesn't touch variables directly (and is compatible with get/set property accessors, but that's a C# specificity), and makes it easier (IMO) to track/validate.
Obviously I can wrap dear-style to Unity-style, but then I lose the "changed" return value. Or, I have to handle it in my wrapper smarter, which smells wrong.
Overall, after years spent writing OnGUI editor code in Unity, it's fun to finally try dear imgui! I really like immediate mode, and Unity's implementation is great, but so far there's a lot I prefer in dear imgui: no double/triple Layout/[Event/]Repaint passes!!, much leaner API (no dozens of overloads, no GUILayoutOption yuckness), tree and column layouts seem MUCH easier to implement, and richer!
I've only tried flow layouts so far, not sure how it compares with explicit layouts (I saw some rects in the cpp so I'm guessing it's possible). Maybe a bit less easy to do flexible layouts? although Unity's flexible/stretching options are probably the culprits for requiring the Layout/Repaint double pass.
One thing that surprised me is hashing is based on label, so 2 buttons in a row with same label = fail. I saw it's fixable with Push/PopID, but wouldn't it be possible to add the rect to the hash?
Another thing I liked in Unity was their handling of mixed values (for multi-selection edit), quite elegant... I looked for a three-state checkbox in dear imgui, couldn't find one. Dig deeper?
Uh... what was supposed to be a simple question turned into a bunch of random feedback, sorry about that!
The text was updated successfully, but these errors were encountered: