Skip to content

Commit

Permalink
Merge pull request #1889 from alicevision/fix/attributeErrors
Browse files Browse the repository at this point in the history
Fix exceptions raised when accessing attributes that either do not exist or are not associated to a graph
  • Loading branch information
fabiencastan authored Feb 8, 2023
2 parents d21b70f + 909f38c commit e2df8f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions meshroom/core/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def getFullNameToNode(self):

def getFullNameToGraph(self):
""" Name inside the Graph: graphName.nodeName.groupName.name """
return '{}.{}'.format(self.node.graph.name, self.getFullNameToNode())
graphName = self.node.graph.name if self.node.graph else "UNDEFINED"
return '{}.{}'.format(graphName, self.getFullNameToNode())

def asLinkExpr(self):
""" Return link expression for this Attribute """
Expand Down Expand Up @@ -124,7 +125,8 @@ def getFullLabelToNode(self):

def getFullLabelToGraph(self):
""" Label inside the Graph: graphName nodeLabel groupLabel Label """
return '{} {}'.format(self.node.graph.name, self.getFullLabelToNode())
graphName = self.node.graph.name if self.node.graph else "UNDEFINED"
return '{} {}'.format(graphName, self.getFullLabelToNode())

def getEnabled(self):
if isinstance(self.desc.enabled, types.FunctionType):
Expand Down
4 changes: 2 additions & 2 deletions meshroom/ui/qml/Viewer/Viewer2D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1003,9 +1003,9 @@ FocusScope {
{
return true;
}
var inputAttr = activeNode.attribute("input");
if(!inputAttr)
if(!activeNode.hasAttribute("input"))
return false;
var inputAttr = activeNode.attribute("input");
var inputAttrLink = inputAttr.rootLinkParam;
if(!inputAttrLink)
return false;
Expand Down

0 comments on commit e2df8f8

Please sign in to comment.