mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-24 14:36:29 +02:00
[graph] add GraphModification inside upgradeNode method
This commit is contained in:
parent
f5820b3eb1
commit
3417f58335
1 changed files with 8 additions and 7 deletions
|
@ -429,13 +429,14 @@ class Graph(BaseObject):
|
||||||
if not isinstance(node, CompatibilityNode):
|
if not isinstance(node, CompatibilityNode):
|
||||||
raise ValueError("Upgrade is only available on CompatibilityNode instances.")
|
raise ValueError("Upgrade is only available on CompatibilityNode instances.")
|
||||||
upgradedNode = node.upgrade()
|
upgradedNode = node.upgrade()
|
||||||
inEdges, outEdges = self.removeNode(nodeName)
|
with GraphModification(self):
|
||||||
self.addNode(upgradedNode, nodeName)
|
inEdges, outEdges = self.removeNode(nodeName)
|
||||||
for dst, src in outEdges.items():
|
self.addNode(upgradedNode, nodeName)
|
||||||
try:
|
for dst, src in outEdges.items():
|
||||||
self.addEdge(self.attribute(src), self.attribute(dst))
|
try:
|
||||||
except (KeyError, ValueError) as e:
|
self.addEdge(self.attribute(src), self.attribute(dst))
|
||||||
logging.warning("Failed to restore edge {} -> {}: {}".format(src, dst, str(e)))
|
except (KeyError, ValueError) as e:
|
||||||
|
logging.warning("Failed to restore edge {} -> {}: {}".format(src, dst, str(e)))
|
||||||
|
|
||||||
return inEdges, outEdges
|
return inEdges, outEdges
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue