mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-18 10:42:00 +02:00
[ui] GraphEditor: Improved node status computable/submitable checks
This commit is contained in:
parent
38e82b926f
commit
c01aefc4f3
2 changed files with 15 additions and 16 deletions
|
@ -330,7 +330,7 @@ class TaskManager(BaseObject):
|
||||||
def checkNodesDependencies(self, graph, toNodes, context):
|
def checkNodesDependencies(self, graph, toNodes, context):
|
||||||
"""
|
"""
|
||||||
Check dependencies of nodes to process.
|
Check dependencies of nodes to process.
|
||||||
Update toNodes with computable/submittable nodes only.
|
Update toNodes with computable/submitable nodes only.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True if all the nodes can be processed. False otherwise.
|
bool: True if all the nodes can be processed. False otherwise.
|
||||||
|
|
|
@ -574,35 +574,34 @@ Item {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property bool isSelectionOnlyComputableNodes: {
|
readonly property bool selectionContainsComputableNodes: {
|
||||||
return uigraph.nodeSelection.selectedIndexes.every(function(idx) {
|
return uigraph.nodeSelection.selectedIndexes.some(function(idx) {
|
||||||
const node = uigraph.graph.nodes.at(idx.row);
|
const node = uigraph.graph.nodes.at(idx.row);
|
||||||
return (
|
return node.isComputable;
|
||||||
node.isComputable
|
|
||||||
&& uigraph.graph.canComputeTopologically(node)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property bool canSelectionBeComputed: {
|
readonly property bool canSelectionBeComputed: {
|
||||||
if(!isSelectionOnlyComputableNodes)
|
if(!selectionContainsComputableNodes)
|
||||||
return false;
|
return false;
|
||||||
if(isSelectionFullyComputed)
|
if(isSelectionFullyComputed)
|
||||||
return true;
|
return true;
|
||||||
return uigraph.nodeSelection.selectedIndexes.every(function(idx) {
|
var b = uigraph.nodeSelection.selectedIndexes.every(function(idx) {
|
||||||
const node = uigraph.graph.nodes.at(idx.row);
|
const node = uigraph.graph.nodes.at(idx.row);
|
||||||
return (
|
return (
|
||||||
node.isComputed
|
node.isComputed ||
|
||||||
|
(uigraph.graph.canComputeTopologically(node) &&
|
||||||
// canCompute if canSubmitOrCompute == 1(can compute) or 3(can compute & submit)
|
// canCompute if canSubmitOrCompute == 1(can compute) or 3(can compute & submit)
|
||||||
|| nodeSubmitOrComputeStatus[node] % 2 == 1
|
nodeSubmitOrComputeStatus[node] % 2 == 1)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property bool isSelectionSubmittable: uigraph.canSubmit && isSelectionOnlyComputableNodes
|
readonly property bool isSelectionSubmitable: uigraph.canSubmit && selectionContainsComputableNodes
|
||||||
|
|
||||||
readonly property bool canSelectionBeSubmitted: {
|
readonly property bool canSelectionBeSubmitted: {
|
||||||
if(!isSelectionOnlyComputableNodes)
|
if(!selectionContainsComputableNodes)
|
||||||
return false;
|
return false;
|
||||||
if(isSelectionFullyComputed)
|
if(isSelectionFullyComputed)
|
||||||
return true;
|
return true;
|
||||||
|
@ -624,7 +623,7 @@ Item {
|
||||||
MenuItem {
|
MenuItem {
|
||||||
id: computeMenuItem
|
id: computeMenuItem
|
||||||
text: nodeMenu.isSelectionFullyComputed ? "Recompute" : "Compute"
|
text: nodeMenu.isSelectionFullyComputed ? "Recompute" : "Compute"
|
||||||
visible: nodeMenu.isSelectionOnlyComputableNodes
|
visible: nodeMenu.selectionContainsComputableNodes
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
enabled: nodeMenu.canSelectionBeComputed
|
enabled: nodeMenu.canSelectionBeComputed
|
||||||
|
|
||||||
|
@ -645,7 +644,7 @@ Item {
|
||||||
id: submitMenuItem
|
id: submitMenuItem
|
||||||
|
|
||||||
text: nodeMenu.isSelectionFullyComputed ? "Re-Submit" : "Submit"
|
text: nodeMenu.isSelectionFullyComputed ? "Re-Submit" : "Submit"
|
||||||
visible: nodeMenu.isSelectionSubmittable
|
visible: nodeMenu.isSelectionSubmitable
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
enabled: nodeMenu.canSelectionBeSubmitted
|
enabled: nodeMenu.canSelectionBeSubmitted
|
||||||
|
|
||||||
|
@ -678,7 +677,7 @@ Item {
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: "Open Folder"
|
text: "Open Folder"
|
||||||
visible: nodeMenu.currentNode.isComputable
|
visible: nodeMenu.currentNode.isComputable
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
onTriggered: Qt.openUrlExternally(Filepath.stringToUrl(nodeMenu.currentNode.internalFolder))
|
onTriggered: Qt.openUrlExternally(Filepath.stringToUrl(nodeMenu.currentNode.internalFolder))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue