mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-20 18:17:17 +02:00
[ui] Recompute and Re-submit not allowed with Compatibility Nodes
Renaming of canCompute to canComputeTopologically to understand the static aspect of the function
This commit is contained in:
parent
24b7a378f8
commit
b6df2852e7
3 changed files with 21 additions and 11 deletions
|
@ -1132,9 +1132,10 @@ class Graph(BaseObject):
|
||||||
return nodes, edges
|
return nodes, edges
|
||||||
|
|
||||||
@Slot(Node, result=bool)
|
@Slot(Node, result=bool)
|
||||||
def canCompute(self, node):
|
def canComputeTopologically(self, node):
|
||||||
"""
|
"""
|
||||||
Return the computability of a node based on itself and its dependency chain.
|
Return the computability of a node based on itself and its dependency chain.
|
||||||
|
It is a static result as it depends on the graph topology.
|
||||||
Computation can't happen for:
|
Computation can't happen for:
|
||||||
- CompatibilityNodes
|
- CompatibilityNodes
|
||||||
- nodes having a non-computed CompatibilityNode in its dependency chain
|
- nodes having a non-computed CompatibilityNode in its dependency chain
|
||||||
|
@ -1200,7 +1201,7 @@ class Graph(BaseObject):
|
||||||
self.dfs(visitor=visitor, startNodes=leaves)
|
self.dfs(visitor=visitor, startNodes=leaves)
|
||||||
|
|
||||||
# update graph computability status
|
# update graph computability status
|
||||||
canComputeLeaves = all([self.canCompute(node) for node in leaves])
|
canComputeLeaves = all([self.canComputeTopologically(node) for node in leaves])
|
||||||
if self._canComputeLeaves != canComputeLeaves:
|
if self._canComputeLeaves != canComputeLeaves:
|
||||||
self._canComputeLeaves = canComputeLeaves
|
self._canComputeLeaves = canComputeLeaves
|
||||||
self.canComputeLeavesChanged.emit()
|
self.canComputeLeavesChanged.emit()
|
||||||
|
@ -1290,6 +1291,7 @@ class Graph(BaseObject):
|
||||||
def canSubmitOrCompute(self, startNode):
|
def canSubmitOrCompute(self, startNode):
|
||||||
"""
|
"""
|
||||||
Check if a node can be submitted/computed.
|
Check if a node can be submitted/computed.
|
||||||
|
It does not depend on the topology of the graph and is based on the node status and its dependencies.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: 0 = cannot be submitted or computed /
|
int: 0 = cannot be submitted or computed /
|
||||||
|
|
|
@ -341,12 +341,12 @@ class TaskManager(BaseObject):
|
||||||
if not node.isComputable:
|
if not node.isComputable:
|
||||||
inputNodes.append(node)
|
inputNodes.append(node)
|
||||||
elif context == "COMPUTATION":
|
elif context == "COMPUTATION":
|
||||||
if graph.canCompute(node) and graph.canSubmitOrCompute(node) % 2 == 1:
|
if graph.canComputeTopologically(node) and graph.canSubmitOrCompute(node) % 2 == 1:
|
||||||
ready.append(node)
|
ready.append(node)
|
||||||
elif node.isComputed:
|
elif node.isComputed:
|
||||||
computed.append(node)
|
computed.append(node)
|
||||||
elif context == "SUBMITTING":
|
elif context == "SUBMITTING":
|
||||||
if graph.canCompute(node) and graph.canSubmitOrCompute(node) > 1:
|
if graph.canComputeTopologically(node) and graph.canSubmitOrCompute(node) > 1:
|
||||||
ready.append(node)
|
ready.append(node)
|
||||||
elif node.isComputed:
|
elif node.isComputed:
|
||||||
computed.append(node)
|
computed.append(node)
|
||||||
|
|
|
@ -555,7 +555,7 @@ Item {
|
||||||
Menu {
|
Menu {
|
||||||
id: nodeMenu
|
id: nodeMenu
|
||||||
property var currentNode: null
|
property var currentNode: null
|
||||||
property bool canComputeNode: currentNode != null && uigraph.graph.canCompute(currentNode)
|
property bool canComputeNode: currentNode != null && uigraph.graph.canComputeTopologically(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
|
//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 int canSubmitOrCompute: currentNode != null && uigraph.graph.canSubmitOrCompute(currentNode)
|
||||||
property bool isComputed: {
|
property bool isComputed: {
|
||||||
|
@ -584,11 +584,15 @@ Item {
|
||||||
enabled: {
|
enabled: {
|
||||||
var canCompute = false
|
var canCompute = false
|
||||||
for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
|
for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
|
||||||
if (uigraph.graph.canCompute(uigraph.selectedNodes.at(i)) && uigraph.graph.canSubmitOrCompute(uigraph.selectedNodes.at(i)) % 2 == 1) {
|
if (uigraph.graph.canComputeTopologically(uigraph.selectedNodes.at(i))) {
|
||||||
canCompute = true
|
if (nodeMenu.isComputed) {
|
||||||
|
canCompute = true
|
||||||
|
} else if (uigraph.graph.canSubmitOrCompute(uigraph.selectedNodes.at(i)) % 2 == 1) {
|
||||||
|
canCompute = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return canCompute || nodeMenu.isComputed //canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit)
|
return canCompute //canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,11 +621,15 @@ Item {
|
||||||
enabled: {
|
enabled: {
|
||||||
var canSubmit = false
|
var canSubmit = false
|
||||||
for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
|
for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
|
||||||
if (uigraph.graph.canCompute(uigraph.selectedNodes.at(i)) && uigraph.graph.canSubmitOrCompute(uigraph.selectedNodes.at(i)) > 1) {
|
if (uigraph.graph.canComputeTopologically(uigraph.selectedNodes.at(i))) {
|
||||||
canSubmit = true
|
if (nodeMenu.isComputed) {
|
||||||
|
canSubmit = true
|
||||||
|
} else if (uigraph.graph.canSubmitOrCompute(uigraph.selectedNodes.at(i)) > 1) {
|
||||||
|
canSubmit = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return canSubmit || nodeMenu.isComputed
|
return canSubmit
|
||||||
}
|
}
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (nodeMenu.isComputed) {
|
if (nodeMenu.isComputed) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue