Skip to content

Commit 53724bc

Browse files
committed
[ui] commands: Fix wrong oldValue for keyable attribute
1 parent 1c84111 commit 53724bc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

meshroom/ui/commands.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,9 @@ def __init__(self, graph, attribute, key, value, parent=None):
313313
self.keyable = attribute.keyable
314314
self.key = key
315315
self.value = value
316-
self.oldValue = None if not attribute.keyable else attribute.keyValues.pairs.get(int(key))
316+
self.oldValue = None
317+
if attribute.keyable and attribute.keyValues.hasKey(key):
318+
self.oldValue = attribute.keyValues.pairs.get(int(key)).value
317319
self.setText(f"Add (key, value) for attribute '{attribute.fullName}' at key: '{key}'")
318320

319321
def redoImpl(self):
@@ -346,7 +348,9 @@ def __init__(self, graph, attribute, key, parent=None):
346348
self.attrName = attribute.fullName
347349
self.keyable = attribute.keyable
348350
self.key = key
349-
self.oldValue = None if not attribute.keyable else attribute.keyValues.pairs.get(int(key))
351+
self.oldValue = None
352+
if attribute.keyable and attribute.keyValues.hasKey(key):
353+
self.oldValue = attribute.keyValues.pairs.get(int(key)).value
350354
self.setText(f"Remove (key, value) for attribute '{attribute.fullName}' at key: '{key}'")
351355

352356
def redoImpl(self):

0 commit comments

Comments
 (0)