Skip to content
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

feat: Node Graph module system #1995

Open
wants to merge 99 commits into
base: develop
Choose a base branch
from
Open

feat: Node Graph module system #1995

wants to merge 99 commits into from

Conversation

rprospero
Copy link
Contributor

@rprospero rprospero commented Nov 7, 2024

This contains the intial prototype for the Node Graph viewer. Full user support isn't available, but it does provide a very basic infrastructure.

20241119_16h01m56s_grim

Above is a basic screenshot of an example of the code. The nodes of the generator are currently linked linearly to indicate the order of the events, but it's perfectly posible to have them each connect back to the generator individually.

This most interesting files to examine are

  • gui/models/nodeGraph/nodeWrapper.h : Defines all of the functions which node types must ultimately implement
  • gui/models/nodeGraph/graphModelBase.h : The lowest foundation of the model
  • gui/models/nodeGraph/graphModel.h : The main template model
  • gui/models/nodeGraph/graphNodeModel.h : The QAbstractListModel that handles displaying the nodes
  • gui/models/nodeGraph/graphEdgesModel.h : The QAbstractListModel that handles displaying the edges
  • gui/models/nodeGraph/exampleGraphModel.h : An example of a conctrete graph mode (which isn't actually used anywhere in Dissolve, but shows how the Connection setup works)
  • gui/models/nodeGraph/generatorGraphModel : A very work in progress example of using a graph model with real data
  • gui/models/nodeGraph/instances/configuration.cpp : An example of an slightly more interesting node type implementation
  • gui/qml/nodeGraph/GeneratorDelegate.qml : The QML code to display the GeneratorGraphModel models

The following changes should be made eventually, but are out of scope of the current PR:

  • GraphNodeModel should return an insertion object used to insert new nodes. This could use RAII for better safety, instead of needing to remember to call beginInsert and endInsert
  • Add function to automatically rearrange nodes (especially useful after file load)

@rprospero rprospero marked this pull request as ready for review November 21, 2024 18:16
@RobBuchananCompPhys
Copy link
Contributor

Is there a reason we aren't using the directory src/gui-qml to host the graph view related C++ and qml modules? Just found it surprising since the frontend entrypoint appears to be the new DissolveMain.qml.

@rprospero
Copy link
Contributor Author

@RobBuchananCompPhys Ironically, I originally did have everything in the src/gui-qml folder and spent a whole commit moving all of the models and qml over to src/gui. My thought at the time was that it would be less confusing to keep putting the code in the same place, but I can also see it being the other way around. There was also a slight benefit of having all the models together for linker simplicity, though this also leads to a slightly larger than necessary executable size.

I'm not opposed to moving the code into the other directory if people find that clearer (as clarity was the entire point of the move in the first place).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants