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

[ui] Load 3D Depth Map: minor improvements #1852

Merged
merged 2 commits into from
Jan 4, 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
22 changes: 17 additions & 5 deletions meshroom/ui/qml/Viewer/Viewer2D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ FocusScope {
onDisplayedNodeChanged: {
// clear metadata if no displayed node
if (!displayedNode) {
metadata = {};
root.source = "";
root.metadata = {};
}

// update output attribute names
Expand All @@ -268,6 +269,9 @@ FocusScope {
}
names.push("gallery");
outputAttribute.names = names;

root.source = getImageFile();
root.metadata = getMetadata();
}

Connections {
Expand Down Expand Up @@ -1157,18 +1161,26 @@ FocusScope {
id: fontMetrics
}
Layout.preferredWidth: model.reduce((acc, label) => Math.max(acc, fontMetrics.boundingRect(label).width), 0) + 3.0 * Qt.application.font.pixelSize

onNameChanged: {
root.source = getImageFile();
root.metadata = getMetadata();
}
}

MaterialToolButton {
property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get('allDepthMap').node : null
enabled: activeNode
ToolTip.text: "View Depth Map in 3D (" + (activeNode ? activeNode.label : "No DepthMap Node Selected") + ")"
id: displayImageOutputIn3D
enabled: root.aliceVisionPluginAvailable && _reconstruction && displayedNode && Filepath.basename(root.source).includes("depthMap")
ToolTip.text: "View Depth Map in 3D"
text: MaterialIcons.input
font.pointSize: 11
Layout.minimumWidth: 0

onClicked: {
root.viewIn3D(root.getFileAttributePath(activeNode, "depth", _reconstruction.selectedViewId));
root.viewIn3D(
root.source,
displayedNode.name + ":" + outputAttribute.name + " " + String(_reconstruction.selectedViewId)
);
}
}

Expand Down
5 changes: 2 additions & 3 deletions meshroom/ui/qml/Viewer3D/MediaLibrary.qml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Entity {
return -1;
}

function load(filepath) {
function load(filepath, label = undefined) {
var pathStr = Filepath.urlToString(filepath);
if(!Filepath.exists(pathStr))
{
Expand All @@ -99,12 +99,11 @@ Entity {
// add file to the internal ListModel
m.mediaModel.append(makeElement({
"source": pathStr,
"label": Filepath.basename(pathStr),
"label": label ? label : Filepath.basename(pathStr),
"section": "External"
}));
}


function view(attribute) {
if(m.sourceToEntity[attribute]) {
ensureVisible(attribute);
Expand Down
4 changes: 2 additions & 2 deletions meshroom/ui/qml/Viewer3D/Viewer3D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ FocusScope {
mainCamera.viewCenter = defaultCamViewCenter;
}

function load(filepath) {
mediaLibrary.load(filepath);
function load(filepath, label = undefined) {
mediaLibrary.load(filepath, label);
}

/// View 'attribute' in the 3D Viewer. Media will be loaded if needed.
Expand Down
4 changes: 2 additions & 2 deletions meshroom/ui/qml/WorkspaceView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Item {


// Load a 3D media file in the 3D viewer
function load3DMedia(filepath) {
function load3DMedia(filepath, label = undefined) {
if(panel3dViewerLoader.active) {
panel3dViewerLoader.item.viewer3D.load(filepath);
panel3dViewerLoader.item.viewer3D.load(filepath, label);
}
}

Expand Down