mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-28 00:16:32 +02:00
[commands] AddNode: serialize links to other Attributes
avoid storing a reference to Attribute objects that might get deleted
This commit is contained in:
parent
f939b36999
commit
d4c0d4cb36
1 changed files with 5 additions and 1 deletions
|
@ -4,7 +4,7 @@ from contextlib import contextmanager
|
||||||
|
|
||||||
from PySide2.QtWidgets import QUndoCommand, QUndoStack
|
from PySide2.QtWidgets import QUndoCommand, QUndoStack
|
||||||
from PySide2.QtCore import Property, Signal
|
from PySide2.QtCore import Property, Signal
|
||||||
from meshroom.core.graph import Node, ListAttribute, Graph, GraphModification
|
from meshroom.core.graph import Node, ListAttribute, Graph, GraphModification, Attribute
|
||||||
|
|
||||||
|
|
||||||
class UndoCommand(QUndoCommand):
|
class UndoCommand(QUndoCommand):
|
||||||
|
@ -89,6 +89,10 @@ class AddNodeCommand(GraphCommand):
|
||||||
self.nodeType = nodeType
|
self.nodeType = nodeType
|
||||||
self.nodeName = None
|
self.nodeName = None
|
||||||
self.kwargs = kwargs
|
self.kwargs = kwargs
|
||||||
|
# Serialize Attributes as link expressions
|
||||||
|
for key, value in self.kwargs.items():
|
||||||
|
if isinstance(value, Attribute):
|
||||||
|
self.kwargs[key] = value.asLinkExpr()
|
||||||
|
|
||||||
def redoImpl(self):
|
def redoImpl(self):
|
||||||
node = self.graph.addNewNode(self.nodeType, **self.kwargs)
|
node = self.graph.addNewNode(self.nodeType, **self.kwargs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue