mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-05 12:21:59 +02:00
[core] add node position property
Nodes can now be placed at a certain position * add Position namedtuple * expose 'position', 'x' and 'y' properties on BaseNode
This commit is contained in:
parent
5843c36435
commit
dfb0934ef4
2 changed files with 39 additions and 9 deletions
|
@ -426,13 +426,14 @@ class Graph(BaseObject):
|
|||
|
||||
return inEdges, outEdges
|
||||
|
||||
def addNewNode(self, nodeType, name=None, **kwargs):
|
||||
def addNewNode(self, nodeType, name=None, position=None, **kwargs):
|
||||
"""
|
||||
Create and add a new node to the graph.
|
||||
|
||||
Args:
|
||||
nodeType (str): the node type name.
|
||||
name (str): if specified, the desired name for this node. If not unique, will be prefixed (_N).
|
||||
position (Position): (optional) the position of the node
|
||||
**kwargs: keyword arguments to initialize node's attributes
|
||||
|
||||
Returns:
|
||||
|
@ -441,7 +442,7 @@ class Graph(BaseObject):
|
|||
if name and name in self._nodes.keys():
|
||||
name = self._createUniqueNodeName(name)
|
||||
|
||||
n = self.addNode(Node(nodeType, **kwargs), uniqueName=name)
|
||||
n = self.addNode(Node(nodeType, position=position, **kwargs), uniqueName=name)
|
||||
n.updateInternals()
|
||||
return n
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue