mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-18 11:36:27 +02:00
Merge pull request #1744 from alicevision/dev/internalAttributes
Add internal attributes in "Notes" tab
This commit is contained in:
commit
ce2085faad
10 changed files with 471 additions and 25 deletions
|
@ -695,9 +695,24 @@ class Graph(BaseObject):
|
|||
# type: (str) -> Attribute
|
||||
"""
|
||||
Return the attribute identified by the unique name 'fullName'.
|
||||
If it does not exist, return None.
|
||||
"""
|
||||
node, attribute = fullName.split('.', 1)
|
||||
return self.node(node).attribute(attribute)
|
||||
if self.node(node).hasAttribute(attribute):
|
||||
return self.node(node).attribute(attribute)
|
||||
return None
|
||||
|
||||
@Slot(str, result=Attribute)
|
||||
def internalAttribute(self, fullName):
|
||||
# type: (str) -> Attribute
|
||||
"""
|
||||
Return the internal attribute identified by the unique name 'fullName'.
|
||||
If it does not exist, return None.
|
||||
"""
|
||||
node, attribute = fullName.split('.', 1)
|
||||
if self.node(node).hasInternalAttribute(attribute):
|
||||
return self.node(node).internalAttribute(attribute)
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def getNodeIndexFromName(name):
|
||||
|
@ -1229,14 +1244,14 @@ class Graph(BaseObject):
|
|||
|
||||
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 output attributes, UIDs, parallelization parameters and internal folder are
|
||||
not relevant for templates, so they are explicitly removed from the returned dictionary.
|
||||
|
||||
Returns:
|
||||
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()
|
||||
for nodeName in graph.keys():
|
||||
|
@ -1244,12 +1259,27 @@ class Graph(BaseObject):
|
|||
|
||||
inputKeys = list(graph[nodeName]["inputs"].keys())
|
||||
|
||||
internalInputKeys = []
|
||||
internalInputs = graph[nodeName].get("internalInputs", None)
|
||||
if internalInputs:
|
||||
internalInputKeys = list(internalInputs.keys())
|
||||
|
||||
for attrName in inputKeys:
|
||||
attribute = node.attribute(attrName)
|
||||
# check that attribute is not a link for choice attributes
|
||||
if attribute.isDefault and not attribute.isLink:
|
||||
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]
|
||||
|
||||
# If all the internal attributes are set to their default values, remove the entry
|
||||
if len(graph[nodeName]["internalInputs"]) == 0:
|
||||
del graph[nodeName]["internalInputs"]
|
||||
|
||||
del graph[nodeName]["outputs"]
|
||||
del graph[nodeName]["uids"]
|
||||
del graph[nodeName]["internalFolder"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue