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

[ui] GraphEditor: create new pipelines with the node menu #1833

Merged
merged 6 commits into from
Dec 5, 2022

Conversation

cbentejac
Copy link
Contributor

Description

This PR adds a "Pipelines" category to the node menu (opened with a right click or a press of the TAB key in the GraphEditor) which contains the list of available templates. Selecting a pipeline through the menu creates said pipeline into the current scene, with its top-left corner being placed on the mouse's position. Pipelines can be searched using the search bar at the same time as any node type.

Features list

  • Add the list of available templates in a "Pipelines" category in the node menu
  • If a pipeline in the "Pipelines" category is clicked, create it and add it to the current scene (like any node type)
  • Support searching for a pipeline in the node menu's search bar (like any node type)

Implementation remarks

  • Creating a pipeline with the node menu is functionally akin to importing a template into the current project, and moving it to the mouse's position (instead of leaving it below the current graph).
  • The "Pipelines" category's creation is hard-coded, and then filled with the list of the available templates' names.
  • Since the "Pipelines" category is added as a regular one, it is alphabetically sorted with the other categories, which only contain node types.

Artificially add a "Pipelines" category in the node menu. The category
contains the list of available pipeline templates. Selecting a pipeline
instead of a regular node type "creates" the pipeline in the GraphEditor
(using the "import project" functionality). The imported pipeline is
by default placed under the current graph.

This commit does not include enabling the search for pipelines from the
"Pipelines" category in the search bar.
@cbentejac cbentejac self-assigned this Nov 29, 2022
@fabiencastan fabiencastan added this to the Meshroom 2022.1.0 milestone Nov 29, 2022
@mugulmd
Copy link
Contributor

mugulmd commented Dec 1, 2022

A few UI problems to note with the node menu (not directly caused by this PR but extending the menu is highlighting those problems):

  • the width of the sub-menu (that appears when hovering over a menu item) doesn't adapt to its content, and thus can be too narrow sometimes (it is the case with "Photogrammetry and Camera Tracking")
  • when typing in the search bar, the node menu dimensions change and it takes the entire height of the window

meshroom/ui/commands.py Outdated Show resolved Hide resolved
meshroom/ui/graph.py Outdated Show resolved Hide resolved
…de menu

If a pipeline is imported with the node menu instead of the "Import
Project" action from the File menu, the top-left "corner" of the graph
should be placed on the mouse's position.
The position of pipelines imported with the "Import Project" menu
remains unchanged: they are automatically placed below the lowest
node in the current graph.
This property simplifies and optimizes the addition of templates in
the node menu and their import into the graph, as it prevents us from
looping over the entire "pipelineTemplateFiles" dictionary to retrieve
the information we need.
Pipelines can be searched in the list of available node types / pipelines
like regular node types.
…he menu

This commit is a bugfix.
When adding new nodes with the node menu, the selection was never
explicitly cleared and nodes were added to the selection rather than
being exclusively selected.

This behaviour used to be hidden when the node menu could only appear
with a right click, as the click would automatically empty the
selection. However, with the node menu being now openable with the TAB
key, there might not be a click to empty the selection. If new nodes
are added by opening the menu with the TAB key and using the arrow keys
to select the node to create, an infinite number of them can be created
and added to the selection.
Add all the nodes from a pipeline imported through the node menu to the
node selection.
This involves changing the return value of ImportProjectCommand from a
boolean to a list of imported nodes.
@@ -363,8 +364,10 @@ def importProject(self, filepath):
localFile = filepath.toString()
else:
localFile = filepath
if isinstance(position, QPoint):
position = Position(position.x(), position.y())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not import at the center of the GraphEditor when we do not have a mouse position, like for the copy/paste nodes?

@fabiencastan fabiencastan merged commit e1bd923 into develop Dec 5, 2022
@fabiencastan fabiencastan deleted the dev/pipelineInNodeMenu branch December 5, 2022 14:56
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.

3 participants