From 72201a80ffa703dfd53e9cd2183a2c3d4b99b1db Mon Sep 17 00:00:00 2001 From: Aurore LAFAURIE Date: Mon, 22 Jul 2024 11:44:18 +0200 Subject: [PATCH] [GraphEditor] Implementation of Recompute Button Allows to do Delete data + Compute in less clicks --- meshroom/ui/qml/GraphEditor/GraphEditor.qml | 32 +++++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/GraphEditor.qml b/meshroom/ui/qml/GraphEditor/GraphEditor.qml index 311ff88c..c7f6c292 100755 --- a/meshroom/ui/qml/GraphEditor/GraphEditor.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditor.qml @@ -29,6 +29,8 @@ Item { signal computeRequest(var nodes) signal submitRequest(var nodes) + signal dataDeleted() + property int nbMeshroomScenes: 0 property int nbDraggedFiles: 0 // Files have been dropped @@ -67,6 +69,13 @@ Item { } } + onDataDeleted: { + if (computeMenuItem.recompute) { + computeRequest(uigraph.selectedNodes) + computeMenuItem.recompute = false + } + } + /// Duplicate a node and optionally all the following ones function duplicateNode(duplicateFollowingNodes) { var nodes @@ -443,11 +452,20 @@ Item { property bool canComputeNode: currentNode != null && uigraph.graph.canCompute(currentNode) //canSubmitOrCompute: return int n : 0 >= n <= 3 | n=0 cannot submit or compute | n=1 can compute | n=2 can submit | n=3 can compute & submit property int canSubmitOrCompute: currentNode != null && uigraph.graph.canSubmitOrCompute(currentNode) + property bool isComputed: { + for (var i = 0; i < uigraph.selectedNodes.count; ++i) { + if (!uigraph.selectedNodes.at(i).isComputed) + return false + } + return uigraph.selectedNodes.count > 0 + } width: 220 onClosed: currentNode = null MenuItem { - text: "Compute" + id: computeMenuItem + property bool recompute: false + text: nodeMenu.isComputed ? "Recompute" : "Compute" visible: { for (var i = 0; i < uigraph.selectedNodes.count; ++i) { if (!uigraph.selectedNodes.at(i).isComputable) @@ -464,12 +482,17 @@ Item { canCompute = true } } - return canCompute //canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit) + return canCompute || nodeMenu.isComputed //canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit) } onTriggered: { - computeRequest(uigraph.selectedNodes) + if (nodeMenu.isComputed) { + recompute = true + deleteDataMenuItem.showConfirmationDialog(false) + } else { + computeRequest(uigraph.selectedNodes) + } } } MenuItem { @@ -584,6 +607,7 @@ Item { visible: nodeMenu.currentNode ? nodeMenu.currentNode.isComputable : false } MenuItem { + id: deleteDataMenuItem text: "Delete Data" + (deleteFollowingButton.hovered ? " From Here" : "" ) + "..." visible: nodeMenu.currentNode ? nodeMenu.currentNode.isComputable : false height: visible ? implicitHeight : 0 @@ -645,6 +669,8 @@ Item { uigraph.clearDataFrom(uigraph.selectedNodes) else uigraph.clearData(uigraph.selectedNodes) + + root.dataDeleted() } onClosed: destroy() }