Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewer2D: Dynamically update the list of viewable outputs #2044

Merged
merged 3 commits into from
Jun 9, 2023
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
4 changes: 4 additions & 0 deletions meshroom/core/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,8 @@ def canBeCanceled(self):
hasDuplicatesChanged = Signal()
hasDuplicates = Property(bool, lambda self: self._hasDuplicates, notify=hasDuplicatesChanged)

outputAttrEnabledChanged = Signal()


class Node(BaseNode):
"""
Expand All @@ -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)

Expand Down
18 changes: 9 additions & 9 deletions meshroom/nodes/aliceVision/DepthMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,39 +391,39 @@ 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(
name='exportIntermediateVolumes',
label='Export Volumes',
description='Export intermediate full similarity volumes from the SGM and Refine steps.',
value=False,
uid=[],
uid=[0],
advanced=True,
),
desc.BoolParam(
name='exportIntermediateCrossVolumes',
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(
name='exportIntermediateVolume9pCsv',
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(
name='exportTilePattern',
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,
),
]),
Expand Down Expand Up @@ -483,7 +483,7 @@ class DepthMap(desc.AVCommandLineNode):
value=desc.Node.internalFolder + '<VIEW_ID>_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',
Expand All @@ -493,7 +493,7 @@ class DepthMap(desc.AVCommandLineNode):
value=desc.Node.internalFolder + '<VIEW_ID>_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',
Expand All @@ -503,7 +503,7 @@ class DepthMap(desc.AVCommandLineNode):
value=desc.Node.internalFolder + '<VIEW_ID>_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',
Expand All @@ -513,6 +513,6 @@ class DepthMap(desc.AVCommandLineNode):
value=desc.Node.internalFolder + '<VIEW_ID>_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,
),
]
10 changes: 7 additions & 3 deletions meshroom/ui/qml/Viewer/Viewer2D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -300,6 +300,10 @@ FocusScope {
}
}

Connections {
target: displayedNode
onOutputAttrEnabledChanged: tryLoadNode(displayedNode)
}
// context menu
property Component contextMenu: Menu {
MenuItem {
Expand Down Expand Up @@ -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 {
Expand Down