mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-11 16:16:56 +02:00
[core] Set internal attributes when copy/pasting nodes
This commit is contained in:
parent
6791f02f2d
commit
5d70a51285
2 changed files with 14 additions and 0 deletions
|
@ -617,6 +617,7 @@ class Graph(BaseObject):
|
||||||
attributes = {}
|
attributes = {}
|
||||||
attributes.update(data[key].get("inputs", {}))
|
attributes.update(data[key].get("inputs", {}))
|
||||||
attributes.update(data[key].get("outputs", {}))
|
attributes.update(data[key].get("outputs", {}))
|
||||||
|
attributes.update(data[key].get("internalInputs", {}))
|
||||||
|
|
||||||
node = Node(nodeType, position=position[positionCnt], **attributes)
|
node = Node(nodeType, position=position[positionCnt], **attributes)
|
||||||
self._addNode(node, key)
|
self._addNode(node, key)
|
||||||
|
|
|
@ -1258,6 +1258,7 @@ class Node(BaseNode):
|
||||||
self.attributesPerUid[uidIndex].add(attr)
|
self.attributesPerUid[uidIndex].add(attr)
|
||||||
|
|
||||||
self.setAttributeValues(kwargs)
|
self.setAttributeValues(kwargs)
|
||||||
|
self.setInternalAttributeValues(kwargs)
|
||||||
self.optionalCallOnDescriptor("onNodeCreated")
|
self.optionalCallOnDescriptor("onNodeCreated")
|
||||||
|
|
||||||
def optionalCallOnDescriptor(self, methodName, *args, **kwargs):
|
def optionalCallOnDescriptor(self, methodName, *args, **kwargs):
|
||||||
|
@ -1270,6 +1271,9 @@ class Node(BaseNode):
|
||||||
def setAttributeValues(self, values):
|
def setAttributeValues(self, values):
|
||||||
# initialize attribute values
|
# initialize attribute values
|
||||||
for k, v in values.items():
|
for k, v in values.items():
|
||||||
|
if not self.hasAttribute(k):
|
||||||
|
# skip missing attributes
|
||||||
|
continue
|
||||||
attr = self.attribute(k)
|
attr = self.attribute(k)
|
||||||
if attr.isInput:
|
if attr.isInput:
|
||||||
attr.value = v
|
attr.value = v
|
||||||
|
@ -1287,6 +1291,15 @@ class Node(BaseNode):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def setInternalAttributeValues(self, values):
|
||||||
|
# initialize internal attribute values
|
||||||
|
for k, v in values.items():
|
||||||
|
if not self.hasInternalAttribute(k):
|
||||||
|
# skip missing attributes
|
||||||
|
continue
|
||||||
|
attr = self.internalAttribute(k)
|
||||||
|
attr.value = v
|
||||||
|
|
||||||
def upgradeInternalAttributeValues(self, values):
|
def upgradeInternalAttributeValues(self, values):
|
||||||
# initialize internal attibute values
|
# initialize internal attibute values
|
||||||
for k, v in values.items():
|
for k, v in values.items():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue