mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-29 06:27:35 +02:00
[commands] UpgradeNode.undo: only set expected uid when "downgrading" UidConflict
Only set the expectedUid when undoing the upgrade of a uid conflicting node. Otherwise, let the other type of conflicts take precedence.
This commit is contained in:
parent
9794f43ed1
commit
bb20786802
1 changed files with 8 additions and 3 deletions
|
@ -7,7 +7,7 @@ from PySide6.QtCore import Property, Signal
|
||||||
|
|
||||||
from meshroom.core.attribute import ListAttribute, Attribute
|
from meshroom.core.attribute import ListAttribute, Attribute
|
||||||
from meshroom.core.graph import Graph, GraphModification
|
from meshroom.core.graph import Graph, GraphModification
|
||||||
from meshroom.core.node import Position
|
from meshroom.core.node import Position, CompatibilityIssue
|
||||||
from meshroom.core.nodeFactory import nodeFactory
|
from meshroom.core.nodeFactory import nodeFactory
|
||||||
from meshroom.core.typing import PathLike
|
from meshroom.core.typing import PathLike
|
||||||
|
|
||||||
|
@ -439,15 +439,20 @@ class UpgradeNodeCommand(GraphCommand):
|
||||||
super(UpgradeNodeCommand, self).__init__(graph, parent)
|
super(UpgradeNodeCommand, self).__init__(graph, parent)
|
||||||
self.nodeDict = node.toDict()
|
self.nodeDict = node.toDict()
|
||||||
self.nodeName = node.getName()
|
self.nodeName = node.getName()
|
||||||
|
self.compatibilityIssue = None
|
||||||
self.setText("Upgrade Node {}".format(self.nodeName))
|
self.setText("Upgrade Node {}".format(self.nodeName))
|
||||||
|
|
||||||
def redoImpl(self):
|
def redoImpl(self):
|
||||||
if not self.graph.node(self.nodeName).canUpgrade:
|
if not (node := self.graph.node(self.nodeName)).canUpgrade:
|
||||||
return False
|
return False
|
||||||
|
self.compatibilityIssue = node.issue
|
||||||
return self.graph.upgradeNode(self.nodeName)
|
return self.graph.upgradeNode(self.nodeName)
|
||||||
|
|
||||||
def undoImpl(self):
|
def undoImpl(self):
|
||||||
expectedUid = self.graph.node(self.nodeName)._uid
|
expectedUid = None
|
||||||
|
if self.compatibilityIssue == CompatibilityIssue.UidConflict:
|
||||||
|
expectedUid = self.graph.node(self.nodeName)._uid
|
||||||
|
|
||||||
# recreate compatibility node
|
# recreate compatibility node
|
||||||
with GraphModification(self.graph):
|
with GraphModification(self.graph):
|
||||||
node = nodeFactory(self.nodeDict, name=self.nodeName, expectedUid=expectedUid)
|
node = nodeFactory(self.nodeDict, name=self.nodeName, expectedUid=expectedUid)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue