mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-25 12:37:33 +02:00
[ui] display output 3D files when double clicking on a node
* iterate over output attributes to find an "obj" file * make default material brighter
This commit is contained in:
parent
76ec5a1913
commit
b8f61bf033
6 changed files with 42 additions and 10 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -74,15 +74,24 @@ FocusScope {
|
|||
// unparent previous material
|
||||
// and exclude it from the entity components
|
||||
comp.parent = null
|
||||
continue; // skip original component and continue
|
||||
}
|
||||
|
||||
// make default material brighter
|
||||
if(comp.toString().indexOf("QPhongMaterial") > -1) {
|
||||
comp.diffuse = "#AAA"
|
||||
comp.ambient = "#AAA"
|
||||
}
|
||||
else
|
||||
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 })
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue