mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 16:58:24 +02:00
[ui] create GraphEditor module
This commit is contained in:
parent
a7cd42a140
commit
886ded7f19
9 changed files with 13 additions and 1 deletions
151
meshroom/ui/qml/GraphEditor/Node.qml
Executable file
151
meshroom/ui/qml/GraphEditor/Node.qml
Executable file
|
@ -0,0 +1,151 @@
|
|||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
property variant node: object
|
||||
property bool readOnly: false
|
||||
property color baseColor: "#607D8B"
|
||||
property color shadowColor: "black"
|
||||
|
||||
signal pressed(var mouse)
|
||||
signal attributePinCreated(var attribute, var pin)
|
||||
|
||||
implicitHeight: body.height
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
drag.target: parent
|
||||
drag.threshold: 0
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onPressed: {
|
||||
if(mouse.button == Qt.RightButton)
|
||||
nodeMenu.popup()
|
||||
root.pressed(mouse)
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: nodeMenu
|
||||
MenuItem {
|
||||
text: "Compute"
|
||||
enabled: !root.readOnly
|
||||
onTriggered: _reconstruction.execute(node)
|
||||
}
|
||||
MenuItem {
|
||||
text: "Open Folder"
|
||||
onTriggered: Qt.openUrlExternally(node.internalFolder)
|
||||
}
|
||||
MenuSeparator {}
|
||||
MenuItem {
|
||||
text: "Clear Data"
|
||||
enabled: !root.readOnly
|
||||
onTriggered: node.clearData()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Delete Node"
|
||||
enabled: !root.readOnly
|
||||
onTriggered: _reconstruction.removeNode(node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cheaper shadow
|
||||
/*
|
||||
Rectangle {
|
||||
id: shadow
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
x: 0.5
|
||||
y: 0.5
|
||||
color: "black"
|
||||
opacity: 0.4
|
||||
}
|
||||
*/
|
||||
Rectangle {
|
||||
id: background
|
||||
anchors.fill: parent
|
||||
color: palette.base
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow { radius: 2; color: shadowColor }
|
||||
}
|
||||
|
||||
Column {
|
||||
id: body
|
||||
width: parent.width
|
||||
|
||||
Label {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
padding: 4
|
||||
text: node.nodeType
|
||||
color: "#EEE"
|
||||
font.pointSize: 8
|
||||
background: Rectangle {
|
||||
color: root.baseColor
|
||||
}
|
||||
}
|
||||
|
||||
// Node Chunks
|
||||
NodeChunks {
|
||||
defaultColor: Qt.darker(baseColor, 1.3)
|
||||
implicitHeight: 3
|
||||
width: parent.width
|
||||
model: node.chunks
|
||||
}
|
||||
|
||||
Item { width: 1; height: 2}
|
||||
|
||||
RowLayout {
|
||||
width: parent.width + 6
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Column {
|
||||
id: inputs
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Repeater {
|
||||
model: node.attributes
|
||||
delegate: Loader {
|
||||
active: !object.isOutput && object.type == "File"
|
||||
|| (object.type == "ListAttribute" && object.desc.elementDesc.type == "File") // TODO: review this
|
||||
|
||||
sourceComponent: AttributePin {
|
||||
id: inPin
|
||||
nodeItem: root
|
||||
attribute: object
|
||||
readOnly: root.readOnly
|
||||
Component.onCompleted: attributePinCreated(attribute, inPin)
|
||||
onChildPinCreated: attributePinCreated(childAttribute, inPin)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Column {
|
||||
id: outputs
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
anchors.right: parent.right
|
||||
Repeater {
|
||||
model: node.attributes
|
||||
|
||||
delegate: Loader {
|
||||
active: object.isOutput
|
||||
anchors.right: parent.right
|
||||
|
||||
sourceComponent: AttributePin {
|
||||
id: outPin
|
||||
nodeItem: root
|
||||
attribute: object
|
||||
readOnly: root.readOnly
|
||||
Component.onCompleted: attributePinCreated(object, outPin)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Item { width: 1; height: 2}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue