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 105 commits into
base: develop
Choose a base branch
from
Open

feat: Node Graph module system #1995

wants to merge 105 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).

commit 42b43ffdadf4f484ef19793f45dbe922d5f8d915
Author: Adam Washington <[email protected]>
Date:   Mon Jan 13 14:01:26 2025 +0000

    Connect edges by name

commit 9e9ee4bff829c8cb9478a71ffbfab6ff2ec8c44d
Author: Adam Washington <[email protected]>
Date:   Mon Jan 13 11:17:45 2025 +0000

    Remove temperature from Generator node

commit bd2cd2c30db829b0c052c908a65cac2766b5dfe0
Author: Adam Washington <[email protected]>
Date:   Mon Jan 13 11:08:41 2025 +0000

    Create lookup table of nodes by name

    This is stored in `nodeType`, which is very confusing and should be fixed

commit 3825a14532c54f9c54c29b8317383ee9b2236efb
Author: Adam Washington <[email protected]>
Date:   Mon Jan 13 11:07:38 2025 +0000

    Update nixpkgs
@rprospero
Copy link
Contributor Author

rprospero commented Jan 31, 2025

GraphNodeJanuary

A screenshot of the current status of the GraphNodes for the generator. We now just show the graph nodes in order and display the data for the four types I've implemented thus far (with the goal of loading examples/argon/input.txt).

Some immediate improvements that can be made

  • Change most of the display values to edits so the nodes can be modified. My last attempt was bugged, so this might be non-trivial. Or I might have just done that in a dumb way
  • Handling the parameters node needs an obvious improvement
  • More node types need to be implemed
  • Perhaps we would be better off with a more general structure? Instead of having a delegate for each node type, we could crate a GeneratorNodeKeywordModel that inherits from AbstractTableModel. The first column would always just be the name and the second column would be the values. Since it's an AbstractTableModel and not an AbstractListModel, we can use extra columns for extra information on te node (e.g. x, y, & z dimensions in the box size can be columns 2, 3, & 4).

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