mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-03 03:11:56 +02:00
[core] add Graph.attribute method
shortcut to get an attribute from its fullname
This commit is contained in:
parent
925d2e71f6
commit
7f78fac119
1 changed files with 8 additions and 0 deletions
|
@ -639,6 +639,14 @@ class Graph(BaseObject):
|
|||
def node(self, nodeName):
|
||||
return self._nodes.get(nodeName)
|
||||
|
||||
def attribute(self, fullName):
|
||||
# type: (str) -> Attribute
|
||||
"""
|
||||
Return the attribute identified by the unique name 'fullName'.
|
||||
"""
|
||||
node, attribute = fullName.split('.', 1)
|
||||
return self.node(node).attribute(attribute)
|
||||
|
||||
def findNodeCandidates(self, nodeNameExpr):
|
||||
pattern = re.compile(nodeNameExpr)
|
||||
return [v for k, v in self._nodes.objects.items() if pattern.match(k)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue