Page 1 of 1

Blender DAG node graph

Posted: Thu Aug 22, 2019 12:04 pm
by Midnightas
Here's an example:
Image

I've thought of a couple ways to do this:
1. Each node is a wxPanel that is absolutely positioned (even though technically wxWidgets doesn't allow overlapping panels, I had them work in all backends I wanted to support fine). The lines between them are drawn on the parent panel with wxDC.
2. The entire thing is custom drawn a single panel with OpenGL, and all lines as well.

The first approach would seem to work, although I don't think it would be practical to get the "dots" on the side to be drawn natively without a lot of hacks.
The second approach would overall be more flexible but would cost the program some nativeness points.

Re: Blender DAG node graph

Posted: Thu Aug 22, 2019 12:22 pm
by doublemax
Is this a question?

If yes, go 100% custom drawn. When using panels you're limited by their rectangular shape and you might get redraw / flicker issues.

Re: Blender DAG node graph

Posted: Thu Aug 22, 2019 2:49 pm
by ONEEYEMAN
Hi,
Or even better - use the existing library for that. wxShapeFramework comes to mind but its not the only one.

Thank you.

Re: Blender DAG node graph

Posted: Thu Aug 22, 2019 3:55 pm
by Midnightas
doublemax wrote:
Thu Aug 22, 2019 12:22 pm
If yes, go 100% custom drawn. When using panels you're limited by their rectangular shape and you might get redraw / flicker issues.
I don't need the prettiness, native doesn't really often intersect with "pretty". I simply need an intuitive UI.
Going custom also means I'd have to remake every single text, number, combo input. I don't want that because that means putting two separate GUIs in one program with different behaviours, that's even worse than Qt!

EDIT: Although technically if I have a custom drawn wxPanel per node, I can sorta do this with existing controls, might go for that technique, then.

Re: Blender DAG node graph

Posted: Thu Aug 22, 2019 6:24 pm
by ONEEYEMAN
Hi,
Also, remember - if you are doing Windows you will limit yourself with 32K controls (windows window id limitation). Which in practice will be even less since you will have other windows, menus, dialogs, etc.

wxShapeFramework might be a good choice.
If not - there are others: see complete list here.

Thank you.

Re: Blender DAG node graph

Posted: Thu Aug 22, 2019 8:48 pm
by Midnightas
ONEEYEMAN wrote:
Thu Aug 22, 2019 6:24 pm
Hi,
Also, remember - if you are doing Windows you will limit yourself with 32K controls (windows window id limitation). Which in practice will be even less since you will have other windows, menus, dialogs, etc.

wxShapeFramework might be a good choice.
If not - there are others: see complete list here.

Thank you.
You're not giving me any alternative to text, number, combo boxes; this is a requirement, along with it to be just as native. If I wanted the above I would've went with Qt.

Re: Blender DAG node graph

Posted: Thu Aug 22, 2019 8:55 pm
by ONEEYEMAN
Midnightas wrote:
Thu Aug 22, 2019 8:48 pm
ONEEYEMAN wrote:
Thu Aug 22, 2019 6:24 pm
Hi,
Also, remember - if you are doing Windows you will limit yourself with 32K controls (windows window id limitation). Which in practice will be even less since you will have other windows, menus, dialogs, etc.

wxShapeFramework might be a good choice.
If not - there are others: see complete list here.

Thank you.
You're not giving me any alternative to text, number, combo boxes; this is a requirement, along with it to be just as native. If I wanted the above I would've went with Qt.
Well wxSF does support text/numbers (I presume you are talking about wxStaticText here). However combo boxes are not supported.
But it will be easy to implement them in terms of the framework you choose.

I plan to do that myself in the near future.

Thank you.

Re: Blender DAG node graph

Posted: Thu Aug 22, 2019 9:09 pm
by Midnightas
No, I'm talking about native boxes where the user can input data themselves, not wxStaticText. Just like in the Blender picture above.

Re: Blender DAG node graph

Posted: Thu Aug 22, 2019 9:28 pm
by ONEEYEMAN
Ah, OK.
Then you will need to implement it yourself.

I doubt it is too hard. You can probably look at the wxUniversal and see how it is done there.

Remember - Windows has a limitation on the number of control that can be created, since every control is connected to the id, which is declared as I believe unsigned integer (wxWindowID).

Also, I think if you look at MS Access Query design view, you will see that the tables there is custom drawn "control" and not a scrolled panels.

Thank you.

Re: Blender DAG node graph

Posted: Thu Aug 22, 2019 10:07 pm
by New Pagodi
Midnightas wrote:
Thu Aug 22, 2019 9:09 pm
No, I'm talking about native boxes where the user can input data themselves, not wxStaticText. Just like in the Blender picture above.
One way to do this using the renderer/editor division of labor. wxWidgets uses this for wxGrid, wxDataViewCtrl, and wxPropgrid. The idea is to bring up the editor (the spin control, text control, combo box, or whatever control used to edit the data) only when it is needed. That way you don't have to use thousands of windows. The rest of the time, the tenderer is used to display the data. If you want, you can use wxRenderNative to make it look like the data is displayed in the control used to edit it.

Re: Blender DAG node graph

Posted: Fri Aug 23, 2019 8:18 am
by Midnightas
New Pagodi wrote:
Thu Aug 22, 2019 10:07 pm
One way to do this using the renderer/editor division of labor. wxWidgets uses this for wxGrid, wxDataViewCtrl, and wxPropgrid. The idea is to bring up the editor (the spin control, text control, combo box, or whatever control used to edit the data) only when it is needed. That way you don't have to use thousands of windows. The rest of the time, the tenderer is used to display the data. If you want, you can use wxRenderNative to make it look like the data is displayed in the control used to edit it.
That is a mighty fancy optimization, I'll do that once it goes through the prototype stage.
I came across that class before but I guessed: I assume I have to draw text separately from the actual textbox (DrawTextCtrl then DrawText)?

Re: Blender DAG node graph

Posted: Mon Aug 26, 2019 9:23 am
by catalin
Midnightas wrote:
Fri Aug 23, 2019 8:18 am
I assume I have to draw text separately from the actual textbox (DrawTextCtrl then DrawText)?
AFAIU no, it should be as simple as setting up a native control, then use it as the first argument in the corresponding DrawXXX() method,
i.e. for a text control use it from a paint event handler with wxRendererNative::Get().DrawTextCtrl(myTextCtrl, ...)
There is also a 'render' sample that might help.