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] widgets visibility options #1545

Merged
merged 2 commits into from
Oct 22, 2021
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
124 changes: 79 additions & 45 deletions meshroom/ui/qml/WorkspaceView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Item {
property variant reconstruction: _reconstruction
readonly property variant cameraInits: _reconstruction.cameraInits
property bool readOnly: false
readonly property Viewer3D viewer3D: viewer3D
property alias panel3dViewer: panel3dViewerLoader.item
readonly property Viewer2D viewer2D: viewer2D

implicitWidth: 300
Expand All @@ -31,12 +31,18 @@ Item {

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

Connections {
target: reconstruction
onGraphChanged: viewer3D.clear()
onGraphChanged: {
if(panel3dViewerLoader.active) {
panel3dViewerLoader.item.viewer3D.clear()
}
}
onSfmChanged: viewSfM()
onSfmReportChanged: viewSfM()
}
Expand All @@ -47,7 +53,9 @@ Item {
var activeNode = _reconstruction.activeNodes.get('sfm').node;
if(!activeNode)
return;
viewer3D.view(activeNode.attribute('output'));
if(panel3dViewerLoader.active) {
panel3dViewerLoader.item.viewer3D.view(activeNode.attribute('output'));
}
}

SystemPalette { id: activePalette }
Expand All @@ -57,7 +65,9 @@ Item {

Controls1.SplitView {
orientation: Qt.Vertical
Layout.fillWidth: true
Layout.fillHeight: true
implicitWidth: Math.round(parent.width * 0.2)
Layout.minimumWidth: imageGallery.defaultCellSize

ImageGallery {
Expand All @@ -78,8 +88,11 @@ Item {
Layout.preferredHeight: childrenRect.height
}
}

Panel {
title: "Image Viewer"
visible: settings_UILayout.showImageViewer
implicitWidth: Math.round(parent.width * 0.35)
Layout.fillHeight: true
Layout.fillWidth: true
Layout.minimumWidth: 50
Expand Down Expand Up @@ -159,55 +172,76 @@ Item {
}
}

Panel {
title: "3D Viewer"
implicitWidth: Math.round(parent.width * 0.45)
Item {
visible: settings_UILayout.showViewer3D
Layout.minimumWidth: 20
Layout.minimumHeight: 80
Layout.fillHeight: true
Layout.fillWidth: true
implicitWidth: Math.round(parent.width * 0.45)

Controls1.SplitView {
Loader {
id: panel3dViewerLoader
active: settings_UILayout.showViewer3D
visible: active
anchors.fill: parent
Viewer3D {
id: viewer3D

Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: 20

DropArea {
anchors.fill: parent
keys: ["text/uri-list"]
onDropped: {
drop.urls.forEach(function(url){ load3DMedia(url); });
sourceComponent: panel3dViewerComponent
}
}

Component {
id: panel3dViewerComponent
Panel {
id: panel3dViewer
title: "3D Viewer"

property alias viewer3D: c_viewer3D

Controls1.SplitView {
id: c_viewer3DSplitView
anchors.fill: parent
Viewer3D {
id: c_viewer3D

Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: 20

DropArea {
anchors.fill: parent
keys: ["text/uri-list"]
onDropped: {
drop.urls.forEach(function(url){ load3DMedia(url); });
}
}

// Load reconstructed model
Button {
readonly property var outputAttribute: _reconstruction.texturing ? _reconstruction.texturing.attribute("outputMesh") : null
readonly property bool outputReady: outputAttribute && _reconstruction.texturing.globalStatus === "SUCCESS"
readonly property int outputMediaIndex: c_viewer3D.library.find(outputAttribute)

text: "Load Model"
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
anchors.horizontalCenter: parent.horizontalCenter
visible: outputReady && outputMediaIndex == -1
onClicked: viewer3D.view(_reconstruction.texturing.attribute("outputMesh"))
}
}

// Load reconstructed model
Button {
readonly property var outputAttribute: _reconstruction.texturing ? _reconstruction.texturing.attribute("outputMesh") : null
readonly property bool outputReady: outputAttribute && _reconstruction.texturing.globalStatus === "SUCCESS"
readonly property int outputMediaIndex: viewer3D.library.find(outputAttribute)

text: "Load Model"
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
anchors.horizontalCenter: parent.horizontalCenter
visible: outputReady && outputMediaIndex == -1
onClicked: viewer3D.view(_reconstruction.texturing.attribute("outputMesh"))

// Inspector Panel
Inspector3D {
id: inspector3d
width: 200
Layout.minimumWidth: 5

mediaLibrary: c_viewer3D.library
camera: c_viewer3D.mainCamera
uigraph: reconstruction
onNodeActivated: _reconstruction.setActiveNode(node)
}
}

// Inspector Panel
Inspector3D {
id: inspector3d
width: 200
Layout.minimumWidth: 5

mediaLibrary: viewer3D.library
camera: viewer3D.mainCamera
uigraph: reconstruction
onNodeActivated: _reconstruction.setActiveNode(node)
}
}
}
}
Expand Down
20 changes: 18 additions & 2 deletions meshroom/ui/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ ApplicationWindow {
category: 'UILayout'
property alias showLiveReconstruction: liveSfMVisibilityCB.checked
property alias showGraphEditor: graphEditorVisibilityCB.checked
property alias showImageViewer: imageViewerVisibilityCB.checked
property alias showViewer3D: viewer3DVisibilityCB.checked
}

Component.onDestruction: {
Expand Down Expand Up @@ -581,6 +583,18 @@ ApplicationWindow {
checkable: true
checked: false
}
MenuItem {
id: imageViewerVisibilityCB
text: "Image Viewer"
checkable: true
checked: true
}
MenuItem {
id: viewer3DVisibilityCB
text: "3D Viewer"
checkable: true
checked: true
}
MenuSeparator {}
Action {
text: "Fullscreen"
Expand Down Expand Up @@ -742,10 +756,12 @@ ApplicationWindow {
}

function viewIn3D(attribute, mouse) {
var loaded = viewer3D.view(attribute);
if(!panel3dViewer)
return false;
var loaded = panel3dViewer.viewer3D.view(attribute);
// solo media if Control modifier was held
if(loaded && mouse && mouse.modifiers & Qt.ControlModifier)
viewer3D.solo(attribute);
panel3dViewer.viewer3D.solo(attribute);
return loaded;
}

Expand Down