diff --git a/meshroom/ui/qml/GraphEditor/GraphEditor.qml b/meshroom/ui/qml/GraphEditor/GraphEditor.qml index 5da643ac..e54f45d9 100755 --- a/meshroom/ui/qml/GraphEditor/GraphEditor.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditor.qml @@ -22,6 +22,7 @@ Item { // signals signal workspaceMoved() signal workspaceClicked() + signal nodeDoubleClicked(var node) clip: true @@ -221,6 +222,7 @@ Item { onAttributePinCreated: registerAttributePin(attribute, pin) onPressed: draggable.selectNode(nodeDelegate) + onDoubleClicked: root.nodeDoubleClicked(node) Keys.onDeletePressed: uigraph.removeNode(node) diff --git a/meshroom/ui/qml/GraphEditor/Node.qml b/meshroom/ui/qml/GraphEditor/Node.qml index 51e3ca7c..d9f6d2ac 100755 --- a/meshroom/ui/qml/GraphEditor/Node.qml +++ b/meshroom/ui/qml/GraphEditor/Node.qml @@ -11,6 +11,7 @@ Item { property color shadowColor: "black" signal pressed(var mouse) + signal doubleClicked(var mouse) signal attributePinCreated(var attribute, var pin) implicitHeight: body.height @@ -27,6 +28,8 @@ Item { root.pressed(mouse) } + onDoubleClicked: root.doubleClicked(mouse) + Menu { id: nodeMenu MenuItem { diff --git a/meshroom/ui/qml/Viewer/MaterialSwitcher.qml b/meshroom/ui/qml/Viewer/MaterialSwitcher.qml index a79d6a62..781c9f6f 100644 --- a/meshroom/ui/qml/Viewer/MaterialSwitcher.qml +++ b/meshroom/ui/qml/Viewer/MaterialSwitcher.qml @@ -16,10 +16,10 @@ Entity { property bool showTextures: true property string diffuseMap: "" - property color ambient: "#999999" + property color ambient: "#AAA" property real shininess property color specular - property color diffuseColor: "#AA9999" + property color diffuseColor: "#AAA" property alias object: instantiator.object NodeInstantiator { diff --git a/meshroom/ui/qml/Viewer/Viewer3D.qml b/meshroom/ui/qml/Viewer/Viewer3D.qml index 5faa22ef..c89321ee 100644 --- a/meshroom/ui/qml/Viewer/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer/Viewer3D.qml @@ -74,15 +74,24 @@ FocusScope { // unparent previous material // and exclude it from the entity components comp.parent = null + continue; // skip original component and continue } - else - comps.push(comp) + + // make default material brighter + if(comp.toString().indexOf("QPhongMaterial") > -1) { + comp.diffuse = "#AAA" + comp.ambient = "#AAA" + } + comps.push(comp) } entity.components = comps mats.forEach(function(m){ // create a material switcher for each material definition var matSwitcher = materialSwitcherComponent.createObject(entity, m) - // bind textures checkbox to texture switch property + // trigger showTextures update by inverting it + // and re-bind textures checkbox to texture switch property + // (this double update ensure the texture display is correct) + matSwitcher.showTextures = !matSwitcher.showTextures matSwitcher.showTextures = Qt.binding(function(){ return texturesCheckBox.checked }) }) }) diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index b7fc9c32..3e5ed54f 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -26,6 +26,12 @@ Item { onMeshFileChanged: viewer3D.clear() + // Load a 3D media file in the 3D viewer + function load3DMedia(filepath) + { + viewer3D.source = filepath + } + SystemPalette { id: palette } Controls1.SplitView { diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index 9c0dc399..da414601 100755 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -7,6 +7,7 @@ import QtQml.Models 2.2 import Qt.labs.platform 1.0 as Platform import GraphEditor 1.0 import MaterialIcons 2.2 +import "filepath.js" as Filepath ApplicationWindow { id: _window @@ -322,7 +323,7 @@ ApplicationWindow { } WorkspaceView { - id: imageGallery + id: workspaceView reconstruction: _reconstruction Layout.fillWidth: true Layout.fillHeight: true @@ -339,19 +340,30 @@ ApplicationWindow { orientation: Qt.Horizontal anchors.fill: parent - ColumnLayout { + Item { Layout.fillHeight: true Layout.fillWidth: true Layout.margins: 10 GraphEditor { id: graphEditor - Layout.fillHeight: true - Layout.fillWidth: true + anchors.fill: parent uigraph: _reconstruction nodeTypesModel: _nodeTypes readOnly: _reconstruction.computing + onNodeDoubleClicked: { + for(var i=0; i < node.attributes.count; ++i) + { + var attr = node.attributes.at(i) + if(attr.isOutput + && attr.desc.type === "File" + && Filepath.extension(attr.value) === ".obj") + { + workspaceView.load3DMedia(attr.value) + break // only load first model found + } + } + } } - } Item { implicitHeight: Math.round(parent.height * 0.2)