Blender DAG node graph

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Midnightas
Knows some wx things
Knows some wx things
Posts: 39
Joined: Fri Feb 02, 2018 1:48 pm

Blender DAG node graph

Post 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.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Blender DAG node graph

Post 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.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Blender DAG node graph

Post by ONEEYEMAN »

Hi,
Or even better - use the existing library for that. wxShapeFramework comes to mind but its not the only one.

Thank you.
Midnightas
Knows some wx things
Knows some wx things
Posts: 39
Joined: Fri Feb 02, 2018 1:48 pm

Re: Blender DAG node graph

Post 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.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Blender DAG node graph

Post 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.
Midnightas
Knows some wx things
Knows some wx things
Posts: 39
Joined: Fri Feb 02, 2018 1:48 pm

Re: Blender DAG node graph

Post 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.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Blender DAG node graph

Post 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.
Midnightas
Knows some wx things
Knows some wx things
Posts: 39
Joined: Fri Feb 02, 2018 1:48 pm

Re: Blender DAG node graph

Post 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.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Blender DAG node graph

Post 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.
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Blender DAG node graph

Post 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.
Midnightas
Knows some wx things
Knows some wx things
Posts: 39
Joined: Fri Feb 02, 2018 1:48 pm

Re: Blender DAG node graph

Post 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)?
catalin
Moderator
Moderator
Posts: 1618
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: Blender DAG node graph

Post by catalin »

Midnightas wrote: Fri Aug 23, 2019 8:18 amI 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.
ImreLovasz
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Jun 15, 2020 12:43 am

Re: Blender DAG node graph

Post by ImreLovasz »

Hi,

You can try imGui, here's a nice example of a node-based editor implementation: https://github.com/thedmd/imgui-node-editor
I don't know how hard to integrate it into wxWidgets though...

Cheers,
Imre
ollydbg23
Super wx Problem Solver
Super wx Problem Solver
Posts: 438
Joined: Fri Dec 12, 2008 10:31 am

Re: Blender DAG node graph

Post by ollydbg23 »

I found a wxWidgets based project, which has a node editor, see here:

pulkomandy/RapidoFSM: Graphical finite state machine editor with code generator. — https://github.com/pulkomandy/RapidoFSM

You can see the image shot of the application in its github home page.
ImreLovasz
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Jun 15, 2020 12:43 am

Re: Blender DAG node graph

Post by ImreLovasz »

Nice, I haven't seen this one!

I tried https://code.google.com/archive/p/wxworkspaceview/ back then, but didn't scale well, because it was using the OS's native GUI drawing functionality, and those are always slower than low level (OpenGL) solutions.
That being said, I'd love to see it in action.

Cheers,
Imre
Post Reply