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

Blender DAG node graph

Post by Midnightas » Thu Aug 22, 2019 12:04 pm

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: 14194
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Blender DAG node graph

Post by doublemax » Thu Aug 22, 2019 12:22 pm

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: 3517
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Blender DAG node graph

Post by ONEEYEMAN » Thu Aug 22, 2019 2:49 pm

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: 38
Joined: Fri Feb 02, 2018 1:48 pm

Re: Blender DAG node graph

Post by Midnightas » Thu Aug 22, 2019 3:55 pm

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: 3517
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Blender DAG node graph

Post by ONEEYEMAN » 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.

Midnightas
Knows some wx things
Knows some wx things
Posts: 38
Joined: Fri Feb 02, 2018 1:48 pm

Re: Blender DAG node graph

Post by Midnightas » 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.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3517
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Blender DAG node graph

Post by ONEEYEMAN » Thu Aug 22, 2019 8:55 pm

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: 38
Joined: Fri Feb 02, 2018 1:48 pm

Re: Blender DAG node graph

Post by Midnightas » 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.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3517
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Blender DAG node graph

Post by ONEEYEMAN » Thu Aug 22, 2019 9:28 pm

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: 310
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Blender DAG node graph

Post by New Pagodi » Thu Aug 22, 2019 10:07 pm

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: 38
Joined: Fri Feb 02, 2018 1:48 pm

Re: Blender DAG node graph

Post by Midnightas » Fri Aug 23, 2019 8:18 am

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: 1526
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: Blender DAG node graph

Post by catalin » Mon Aug 26, 2019 9:23 am

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.

Post Reply