Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions meshroom/core/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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):
"""
Expand Down
12 changes: 7 additions & 5 deletions meshroom/core/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion meshroom/ui/qml/Application.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ Page {
workspaceView.viewIn2D(attribute, mouse)
}

else if (attribute.is3D) {
else if (attribute.is3dDisplayable) {
workspaceView.viewIn3D(attribute, mouse)
}

Expand Down
2 changes: 1 addition & 1 deletion meshroom/ui/qml/Viewer/Viewer2D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ FocusScope {

Connections {
target: displayedNode
function onOutputAttrEnabledChanged() {
function onOutputAttrChanged() {
tryLoadNode(displayedNode)
}
}
Expand Down