From 2b232b0c85d832796b0846d1856ceef8432f074e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 7 Mar 2023 09:19:50 +0100 Subject: [PATCH 1/3] Viewer2D: Update list of loaded node's outputs when they are en/dis-abled When a node with viewable output attributes is loaded, the combo box of the 2D Viewer lists these attributes. As some of these attributes are enabled or disabled, they need to be added or removed from that list, without needing to load another node first, or to unload the node. This commit connects the signal that is emitted when an output attribute with a viewable output is enabled or disabled to the slot that reloads the currently loaded node (and thus updates the list). --- meshroom/core/node.py | 4 ++++ meshroom/ui/qml/Viewer/Viewer2D.qml | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/meshroom/core/node.py b/meshroom/core/node.py index 7e5999f606..aedb6e17ba 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -1166,6 +1166,8 @@ def canBeCanceled(self): hasDuplicatesChanged = Signal() hasDuplicates = Property(bool, lambda self: self._hasDuplicates, notify=hasDuplicatesChanged) + outputAttrEnabledChanged = Signal() + class Node(BaseNode): """ @@ -1192,6 +1194,8 @@ def __init__(self, nodeType, position=None, parent=None, **kwargs): # List attributes per uid for attr in self._attributes: + if attr.isOutput and attr.desc.semantic == "image": + attr.enabledChanged.connect(self.outputAttrEnabledChanged) for uidIndex in attr.attributeDesc.uid: self.attributesPerUid[uidIndex].add(attr) diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 7c437ba43a..9b12d83afc 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -184,7 +184,7 @@ FocusScope { var hasImageOutputAttr = false; for (var i = 0; i < node.attributes.count; i++) { var attr = node.attributes.at(i); - if (attr.isOutput && attr.desc.semantic == "image") { + if (attr.isOutput && attr.desc.semantic === "image" && attr.enabled) { hasImageOutputAttr = true; break; } @@ -280,7 +280,7 @@ FocusScope { // store attr name for output attributes that represent images for (var i = 0; i < displayedNode.attributes.count; i++) { var attr = displayedNode.attributes.at(i); - if (attr.isOutput && attr.desc.semantic == "image") { + if (attr.isOutput && attr.desc.semantic === "image" && attr.enabled) { names.push(attr.name); } } @@ -300,6 +300,10 @@ FocusScope { } } + Connections { + target: displayedNode + onOutputAttrEnabledChanged: tryLoadNode(displayedNode) + } // context menu property Component contextMenu: Menu { MenuItem { @@ -1193,7 +1197,7 @@ FocusScope { property var names: ["gallery"] property string name: names[currentIndex] - model: names.map(n => (n == "gallery") ? "Image Gallery" : displayedNode.attributes.get(n).label) + model: names.map(n => (n === "gallery") ? "Image Gallery" : displayedNode.attributes.get(n).label) enabled: count > 1 FontMetrics { From 79305b80edc44fab51360f70fb8ff83a56dcc2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 6 Mar 2023 16:17:30 +0100 Subject: [PATCH 2/3] [nodes] DepthMap: Enable/disable outputs depending on inputs' values --- meshroom/nodes/aliceVision/DepthMap.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meshroom/nodes/aliceVision/DepthMap.py b/meshroom/nodes/aliceVision/DepthMap.py index 023da0970c..4e0bb79e4b 100644 --- a/meshroom/nodes/aliceVision/DepthMap.py +++ b/meshroom/nodes/aliceVision/DepthMap.py @@ -483,7 +483,7 @@ class DepthMap(desc.AVCommandLineNode): value=desc.Node.internalFolder + '_tilePattern.obj', uid=[], group='', # do not export on the command line - # enabled=lambda node: node.intermediateResults.exportTilePattern.value, + enabled=lambda node: node.intermediateResults.exportTilePattern.value, ), desc.File( name='depthSgm', @@ -493,7 +493,7 @@ class DepthMap(desc.AVCommandLineNode): value=desc.Node.internalFolder + '_depthMap_scale2_sgm.exr', uid=[], group='', # do not export on the command line - # enabled=lambda node: node.intermediateResults.exportIntermediateDepthSimMaps.value, + enabled=lambda node: node.intermediateResults.exportIntermediateDepthSimMaps.value, ), desc.File( name='depthSgmUpscaled', @@ -503,7 +503,7 @@ class DepthMap(desc.AVCommandLineNode): value=desc.Node.internalFolder + '_depthMap_sgmUpscaled.exr', uid=[], group='', # do not export on the command line - # enabled=lambda node: node.intermediateResults.exportIntermediateDepthSimMaps.value, + enabled=lambda node: node.intermediateResults.exportIntermediateDepthSimMaps.value, ), desc.File( name='depthRefined', @@ -513,6 +513,6 @@ class DepthMap(desc.AVCommandLineNode): value=desc.Node.internalFolder + '_depthMap_refinedFused.exr', uid=[], group='', # do not export on the command line - # enabled=lambda node: node.intermediateResults.exportIntermediateDepthSimMaps.value, + enabled=lambda node: node.intermediateResults.exportIntermediateDepthSimMaps.value, ), ] From 4e130e70908f560eb7e8d2561c6a451e6111d78a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Vital?= Date: Fri, 9 Jun 2023 15:12:04 +0200 Subject: [PATCH 3/3] [nodes] DepthMap: fix uid of intermediate export attributes --- meshroom/nodes/aliceVision/DepthMap.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meshroom/nodes/aliceVision/DepthMap.py b/meshroom/nodes/aliceVision/DepthMap.py index 4e0bb79e4b..7161fbcd78 100644 --- a/meshroom/nodes/aliceVision/DepthMap.py +++ b/meshroom/nodes/aliceVision/DepthMap.py @@ -391,7 +391,7 @@ class DepthMap(desc.AVCommandLineNode): label='Export Depth Maps', description='Export intermediate depth/similarity maps from the SGM and Refine steps.', value=False, - uid=[], + uid=[0], advanced=True, ), desc.BoolParam( @@ -399,7 +399,7 @@ class DepthMap(desc.AVCommandLineNode): label='Export Volumes', description='Export intermediate full similarity volumes from the SGM and Refine steps.', value=False, - uid=[], + uid=[0], advanced=True, ), desc.BoolParam( @@ -407,7 +407,7 @@ class DepthMap(desc.AVCommandLineNode): label='Export Cross Volumes', description='Export intermediate similarity cross volumes from the SGM and Refine steps.', value=False, - uid=[], + uid=[0], advanced=True, ), desc.BoolParam( @@ -415,7 +415,7 @@ class DepthMap(desc.AVCommandLineNode): label='Export 9 Points', description='Export intermediate volumes 9 points from the SGM and Refine steps in CSV files.', value=False, - uid=[], + uid=[0], advanced=True, ), desc.BoolParam( @@ -423,7 +423,7 @@ class DepthMap(desc.AVCommandLineNode): label='Export Tile Pattern', description='Export the bounding boxes of tiles volumes as meshes. This allows to visualize the depth map search areas.', value=False, - uid=[], + uid=[0], advanced=True, ), ]),