1

I'm very much trying to do what was asked here:

http://www.qtcentre.org/threads/45028-Designing-a-Node-Editor-(Hint-Blender-Node-Editor)

Which is basically a blender style node editor using Qt. Creating rects with circles which can be drag/dropped is fairly simple to figure out (see the image below).

The issue I have is how the algorithm for connecting the circles between nodes would work. Also I don't know how this could be drawn efficiently using QGraphicsItem API's? I have seen QPainter::cubicTo() which looks like it may be the way to go?

I assume it somehow manages to find a none overlapping path? But it must also handle the case where it has to overlap?

And what about the user being able to move these lines around in case the algorithm has done a bad job? I don't think this would be simple to implement using QPainter::cubicTo() as you could only move the curves control points?

enter image description here

4
  • I guess Blender just assumes there is no overlap, and the user is responsible for that. Commented Dec 13, 2012 at 12:38
  • Even so, I would like to know an algorithm which will try its best not to overlap. Although this isn't true anyway, for example in the image above connect Image on the left to Image on the right and it won't "go through" the middle node, it will go around it. Commented Dec 13, 2012 at 12:46
  • 1
    Routing algorithms are no easy matter and are better left to humans. You could make an interface for that, so that an edge is made of several cubics and the user does the routing. Commented Dec 13, 2012 at 12:48
  • But there are many simple cases where only 1 node appears to block the connection path to the target node, I guess there must be some well know algorithm for this? Although the several cubics option sounds like it would still be required as well. Commented Dec 13, 2012 at 12:52

2 Answers 2

5

I don't think you'll get anyone posting the code for doing the whole lot here.

Well, I volunteer -- just in case someone still needs such a library.

It is a Qt-based node editor implemented on top of QGraphicsView. A library consumer defines data models, the rest is done by the node editor. Some features:

  • Model-view approach.
  • Models describe data types, number of input and outputs and optional embedded QWidget.
  • The Scene could be saved to file.

The rest similar projects were either not finished, not supported anymore or lacking some features.

https://github.com/paceholder/nodeeditor enter image description here

Sign up to request clarification or add additional context in comments.

Comments

1

I would suggest that you implement it without taking into consideration overlap but with the possibility of overriding how the connecting line is drawn.

It looks like there were some good replies on the Qt forum. I don't think you'll get anyone posting the code for doing the whole lot here.

Perhaps take a look at the Qt demos Graphics View/Elastic Nodes - There is code for the demo that you can use as a starting point, but it is a lot of work to get from there to something like the Blender node editor.

Another node editor to take a look at is SynthEdit or Synth Maker (has a nice one).

1 Comment

I'll take a look at SynthEdit and Synth Maker, I'm not asking for the code just the algorithm to avoid overlapping. I think something like A* might be what I need?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.