diff --git a/meshroom/ui/commands.py b/meshroom/ui/commands.py index f0ece7e4..d07a1a88 100644 --- a/meshroom/ui/commands.py +++ b/meshroom/ui/commands.py @@ -168,18 +168,23 @@ class ListAttributeAppendCommand(GraphCommand): assert isinstance(listAttribute, ListAttribute) self.attrName = listAttribute.fullName() self.index = None - self.value = value + self.count = 1 + self.value = value if len(value) else None self.setText("Append to {}".format(self.attrName)) def redoImpl(self): listAttribute = self.graph.attribute(self.attrName) - listAttribute.append(self.value) - self.index = len(listAttribute) - 1 + self.index = len(listAttribute) + if isinstance(self.value, list): + listAttribute.extend(self.value) + self.count = len(self.value) + else: + listAttribute.append(self.value) return True def undoImpl(self): listAttribute = self.graph.attribute(self.attrName) - listAttribute.remove(self.index) + listAttribute.remove(self.index, self.count) class ListAttributeRemoveCommand(GraphCommand): diff --git a/meshroom/ui/reconstruction.py b/meshroom/ui/reconstruction.py index 78d796eb..b8eef887 100755 --- a/meshroom/ui/reconstruction.py +++ b/meshroom/ui/reconstruction.py @@ -63,7 +63,11 @@ class Reconstruction(QObject): @Slot(graph.Attribute, QJsonValue) def appendAttribute(self, attribute, value): - self._undoStack.tryAndPush(commands.ListAttributeAppendCommand(self._graph, attribute, value.toObject())) + if value.isArray(): + pyValue = value.toArray().toVariantList() + else: + pyValue = None if value.isNull() else value.toObject() + self._undoStack.tryAndPush(commands.ListAttributeAppendCommand(self._graph, attribute, pyValue)) @Slot(graph.Attribute) def removeAttribute(self, attribute):