diff --git a/meshroom/core/attribute.py b/meshroom/core/attribute.py index d0fbd59431..0e24f6cbfe 100644 --- a/meshroom/core/attribute.py +++ b/meshroom/core/attribute.py @@ -181,6 +181,7 @@ def _setValue(self, value): # validity of the value and apply some conversion if needed convertedValue = self.validateValue(value) self._value = convertedValue + self.expressionApplied.emit() # Request graph update when input parameter value is set # and parent node belongs to a graph # Output attributes value are set internally during the update process, @@ -352,10 +353,12 @@ def _is3dDisplayable(self) -> bool: """ if self._desc.semantic == "3d": return True + # If the attribute is a File attribute, it is an instance of str and can be iterated over hasSupportedExt = isinstance(self.value, str) and any(ext in self.value for ext in Attribute.VALID_3D_EXTENSIONS) if hasSupportedExt: return True + return False def uid(self) -> str: @@ -563,6 +566,8 @@ def matchText(self, text: str) -> bool: # Whether the attribute or any of its elements is linked by another attribute. hasAnyOutputLinks = Property(bool, _hasAnyOutputLinks, notify=outputLinksChanged) + expressionApplied = Signal() + def raiseIfLink(func): """ diff --git a/meshroom/core/node.py b/meshroom/core/node.py index f95304a63b..8af8e4e642 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -1811,10 +1811,10 @@ def _hasDisplayableShape(self): hasDuplicatesChanged = Signal() hasDuplicates = Property(bool, lambda self: self._hasDuplicates, notify=hasDuplicatesChanged) - outputAttrEnabledChanged = Signal() - hasImageOutput = Property(bool, hasImageOutputAttribute, notify=outputAttrEnabledChanged) - hasSequenceOutput = Property(bool, hasSequenceOutputAttribute, notify=outputAttrEnabledChanged) - has3DOutput = Property(bool, has3DOutputAttribute, notify=outputAttrEnabledChanged) + outputAttrChanged = Signal() + hasImageOutput = Property(bool, hasImageOutputAttribute, notify=outputAttrChanged) + hasSequenceOutput = Property(bool, hasSequenceOutputAttribute, notify=outputAttrChanged) + has3DOutput = Property(bool, has3DOutputAttribute, notify=outputAttrChanged) # Whether the node contains a ShapeAttribute, a ShapeListAttribute or a shape File. hasDisplayableShape = Property(bool, _hasDisplayableShape, constant=True) @@ -1847,7 +1847,9 @@ def __init__(self, nodeType, position=None, parent=None, uid=None, **kwargs): # Declare events for specific output attributes for attr in self._attributes: if attr.isOutput and attr.desc.semantic == "image": - attr.enabledChanged.connect(self.outputAttrEnabledChanged) + attr.enabledChanged.connect(self.outputAttrChanged) + if attr.isOutput: + attr.expressionApplied.connect(self.outputAttrChanged) # List attributes per UID for attr in self._attributes: diff --git a/meshroom/ui/qml/Application.qml b/meshroom/ui/qml/Application.qml index d9ba6b515b..0d56b1595c 100644 --- a/meshroom/ui/qml/Application.qml +++ b/meshroom/ui/qml/Application.qml @@ -1217,7 +1217,7 @@ Page { workspaceView.viewIn2D(attribute, mouse) } - else if (attribute.is3D) { + else if (attribute.is3dDisplayable) { workspaceView.viewIn3D(attribute, mouse) } diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index f5eef8e8bb..e841696618 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -398,7 +398,7 @@ FocusScope { Connections { target: displayedNode - function onOutputAttrEnabledChanged() { + function onOutputAttrChanged() { tryLoadNode(displayedNode) } }