mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-19 12:06:28 +02:00
[ui] GraphEditor: Import pipeline on the mouse's position with the node 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 commit is contained in:
parent
04ab813cef
commit
c2570ca0fb
3 changed files with 12 additions and 5 deletions
|
@ -221,10 +221,11 @@ class ImportProjectCommand(GraphCommand):
|
|||
"""
|
||||
Handle the import of a project into a Graph.
|
||||
"""
|
||||
def __init__(self, graph, filepath=None, yOffset=0, parent=None):
|
||||
def __init__(self, graph, filepath=None, position=None, yOffset=0, parent=None):
|
||||
super(ImportProjectCommand, self).__init__(graph, parent)
|
||||
self.filepath = filepath
|
||||
self.importedNames = []
|
||||
self.position = position
|
||||
self.yOffset = yOffset
|
||||
|
||||
def redoImpl(self):
|
||||
|
@ -239,7 +240,10 @@ class ImportProjectCommand(GraphCommand):
|
|||
|
||||
for node in importedNodes:
|
||||
self.importedNames.append(node.name)
|
||||
self.graph.node(node.name).position = Position(node.x, node.y + lowestY + self.yOffset)
|
||||
if self.position is not None:
|
||||
self.graph.node(node.name).position = Position(node.x + self.position.x, node.y + self.position.y)
|
||||
else:
|
||||
self.graph.node(node.name).position = Position(node.x, node.y + lowestY + self.yOffset)
|
||||
|
||||
return status
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue