mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-19 03:56:26 +02:00
[core] Do not save default internal attributes in template mode
This commit is contained in:
parent
930af07966
commit
fe3a0764b0
1 changed files with 14 additions and 2 deletions
|
@ -1236,14 +1236,14 @@ class Graph(BaseObject):
|
||||||
|
|
||||||
def getNonDefaultInputAttributes(self):
|
def getNonDefaultInputAttributes(self):
|
||||||
"""
|
"""
|
||||||
Instead of getting all the inputs attribute keys, only get the keys of
|
Instead of getting all the inputs and internal attribute keys, only get the keys of
|
||||||
the attributes whose value is not the default one.
|
the attributes whose value is not the default one.
|
||||||
The output attributes, UIDs, parallelization parameters and internal folder are
|
The output attributes, UIDs, parallelization parameters and internal folder are
|
||||||
not relevant for templates, so they are explicitly removed from the returned dictionary.
|
not relevant for templates, so they are explicitly removed from the returned dictionary.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
dict: self.toDict() with the output attributes, UIDs, parallelization parameters, internal folder
|
dict: self.toDict() with the output attributes, UIDs, parallelization parameters, internal folder
|
||||||
and input attributes with default values removed
|
and input/internal attributes with default values removed
|
||||||
"""
|
"""
|
||||||
graph = self.toDict()
|
graph = self.toDict()
|
||||||
for nodeName in graph.keys():
|
for nodeName in graph.keys():
|
||||||
|
@ -1251,12 +1251,24 @@ class Graph(BaseObject):
|
||||||
|
|
||||||
inputKeys = list(graph[nodeName]["inputs"].keys())
|
inputKeys = list(graph[nodeName]["inputs"].keys())
|
||||||
|
|
||||||
|
internalInputKeys = []
|
||||||
|
|
||||||
|
internalInputs = graph[nodeName].get("internalInputs", None)
|
||||||
|
if internalInputs:
|
||||||
|
internalInputKeys = list(internalInputs.keys())
|
||||||
|
|
||||||
for attrName in inputKeys:
|
for attrName in inputKeys:
|
||||||
attribute = node.attribute(attrName)
|
attribute = node.attribute(attrName)
|
||||||
# check that attribute is not a link for choice attributes
|
# check that attribute is not a link for choice attributes
|
||||||
if attribute.isDefault and not attribute.isLink:
|
if attribute.isDefault and not attribute.isLink:
|
||||||
del graph[nodeName]["inputs"][attrName]
|
del graph[nodeName]["inputs"][attrName]
|
||||||
|
|
||||||
|
for attrName in internalInputKeys:
|
||||||
|
attribute = node.internalAttribute(attrName)
|
||||||
|
# check that internal attribute is not a link for choice attributes
|
||||||
|
if attribute.isDefault and not attribute.isLink:
|
||||||
|
del graph[nodeName]["internalInputs"][attrName]
|
||||||
|
|
||||||
del graph[nodeName]["outputs"]
|
del graph[nodeName]["outputs"]
|
||||||
del graph[nodeName]["uids"]
|
del graph[nodeName]["uids"]
|
||||||
del graph[nodeName]["internalFolder"]
|
del graph[nodeName]["internalFolder"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue