Skip to content

Commit d8a7f17

Browse files
fix: Add a signal 'expressionApplied' to notify node if an output attribute expression has been applied
1 parent cff6ac5 commit d8a7f17

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

meshroom/core/attribute.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def _setValue(self, value):
181181
# validity of the value and apply some conversion if needed
182182
convertedValue = self.validateValue(value)
183183
self._value = convertedValue
184+
self.expressionApplied.emit()
184185
# Request graph update when input parameter value is set
185186
# and parent node belongs to a graph
186187
# Output attributes value are set internally during the update process,
@@ -352,10 +353,12 @@ def _is3dDisplayable(self) -> bool:
352353
"""
353354
if self._desc.semantic == "3d":
354355
return True
356+
355357
# If the attribute is a File attribute, it is an instance of str and can be iterated over
356358
hasSupportedExt = isinstance(self.value, str) and any(ext in self.value for ext in Attribute.VALID_3D_EXTENSIONS)
357359
if hasSupportedExt:
358360
return True
361+
359362
return False
360363

361364
def uid(self) -> str:
@@ -563,6 +566,8 @@ def matchText(self, text: str) -> bool:
563566
# Whether the attribute or any of its elements is linked by another attribute.
564567
hasAnyOutputLinks = Property(bool, _hasAnyOutputLinks, notify=outputLinksChanged)
565568

569+
expressionApplied = Signal()
570+
566571

567572
def raiseIfLink(func):
568573
"""

meshroom/core/node.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,10 +1811,10 @@ def _hasDisplayableShape(self):
18111811
hasDuplicatesChanged = Signal()
18121812
hasDuplicates = Property(bool, lambda self: self._hasDuplicates, notify=hasDuplicatesChanged)
18131813

1814-
outputAttrEnabledChanged = Signal()
1815-
hasImageOutput = Property(bool, hasImageOutputAttribute, notify=outputAttrEnabledChanged)
1816-
hasSequenceOutput = Property(bool, hasSequenceOutputAttribute, notify=outputAttrEnabledChanged)
1817-
has3DOutput = Property(bool, has3DOutputAttribute, notify=outputAttrEnabledChanged)
1814+
outputAttrChanged = Signal()
1815+
hasImageOutput = Property(bool, hasImageOutputAttribute, notify=outputAttrChanged)
1816+
hasSequenceOutput = Property(bool, hasSequenceOutputAttribute, notify=outputAttrChanged)
1817+
has3DOutput = Property(bool, has3DOutputAttribute, notify=outputAttrChanged)
18181818
# Whether the node contains a ShapeAttribute, a ShapeListAttribute or a shape File.
18191819
hasDisplayableShape = Property(bool, _hasDisplayableShape, constant=True)
18201820

@@ -1847,7 +1847,9 @@ def __init__(self, nodeType, position=None, parent=None, uid=None, **kwargs):
18471847
# Declare events for specific output attributes
18481848
for attr in self._attributes:
18491849
if attr.isOutput and attr.desc.semantic == "image":
1850-
attr.enabledChanged.connect(self.outputAttrEnabledChanged)
1850+
attr.enabledChanged.connect(self.outputAttrChanged)
1851+
if attr.isOutput:
1852+
attr.expressionApplied.connect(self.outputAttrChanged)
18511853

18521854
# List attributes per UID
18531855
for attr in self._attributes:
@@ -2066,7 +2068,7 @@ def attributeDescFromValue(attrName, value, isOutput):
20662068
groupDesc.append(eltDesc)
20672069
attrDesc = desc.GroupAttribute(groupDesc=groupDesc, **params)
20682070
# Override empty default value with
2069-
attrDesc._value = value
2071+
attrDesc.value = value
20702072
return attrDesc
20712073
# Handle any other type of parameters as Strings
20722074
return desc.StringParam(**params)

meshroom/ui/qml/Application.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ Page {
12171217
workspaceView.viewIn2D(attribute, mouse)
12181218
}
12191219

1220-
else if (attribute.is3D) {
1220+
else if (attribute.is3dDisplayable) {
12211221
workspaceView.viewIn3D(attribute, mouse)
12221222
}
12231223

meshroom/ui/qml/Viewer/Viewer2D.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ FocusScope {
398398

399399
Connections {
400400
target: displayedNode
401-
function onOutputAttrEnabledChanged() {
401+
function onOutputAttrChanged() {
402402
tryLoadNode(displayedNode)
403403
}
404404
}

0 commit comments

Comments
 (0)