mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-08 13:51:57 +02:00
[ui] GraphEditor: check node is valid
Only count valid nodes
This commit is contained in:
parent
c0d87b68da
commit
d563451a53
1 changed files with 29 additions and 11 deletions
|
@ -559,11 +559,16 @@ Item {
|
||||||
//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: {
|
||||||
|
var count = 0
|
||||||
for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
|
for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
|
||||||
if (!uigraph.selectedNodes.at(i).isComputed)
|
var node = uigraph.selectedNodes.at(i)
|
||||||
|
if (!node)
|
||||||
|
continue
|
||||||
|
if (!node.isComputed)
|
||||||
return false
|
return false
|
||||||
|
count += 1
|
||||||
}
|
}
|
||||||
return uigraph.selectedNodes.count > 0
|
return count > 0
|
||||||
}
|
}
|
||||||
width: 220
|
width: 220
|
||||||
onClosed: currentNode = null
|
onClosed: currentNode = null
|
||||||
|
@ -573,27 +578,34 @@ Item {
|
||||||
property bool recompute: false
|
property bool recompute: false
|
||||||
text: nodeMenu.isComputed ? "Recompute" : "Compute"
|
text: nodeMenu.isComputed ? "Recompute" : "Compute"
|
||||||
visible: {
|
visible: {
|
||||||
|
var count = 0
|
||||||
for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
|
for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
|
||||||
if (!uigraph.selectedNodes.at(i).isComputable)
|
var node = uigraph.selectedNodes.at(i)
|
||||||
|
if (!node)
|
||||||
|
continue
|
||||||
|
if (!node.isComputable)
|
||||||
return false
|
return false
|
||||||
|
count += 1
|
||||||
}
|
}
|
||||||
return uigraph.selectedNodes.count > 0
|
return count > 0
|
||||||
}
|
}
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
|
|
||||||
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.canComputeTopologically(uigraph.selectedNodes.at(i))) {
|
var node = uigraph.selectedNodes.at(i)
|
||||||
|
if (!node)
|
||||||
|
continue
|
||||||
|
if (uigraph.graph.canComputeTopologically(node)) {
|
||||||
if (nodeMenu.isComputed) {
|
if (nodeMenu.isComputed) {
|
||||||
canCompute = true
|
canCompute = true
|
||||||
} else if (uigraph.graph.canSubmitOrCompute(uigraph.selectedNodes.at(i)) % 2 == 1) {
|
} else if (uigraph.graph.canSubmitOrCompute(node) % 2 == 1) {
|
||||||
canCompute = true
|
canCompute = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return canCompute //canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit)
|
return canCompute //canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
@ -610,21 +622,27 @@ Item {
|
||||||
property bool resubmit: false
|
property bool resubmit: false
|
||||||
text: nodeMenu.isComputed ? "Re-Submit" : "Submit"
|
text: nodeMenu.isComputed ? "Re-Submit" : "Submit"
|
||||||
visible: {
|
visible: {
|
||||||
|
var count = 0
|
||||||
for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
|
for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
|
||||||
if (!uigraph.selectedNodes.at(i).isComputable)
|
var node = uigraph.selectedNodes.at(i)
|
||||||
|
if (node && !node.isComputable)
|
||||||
return false
|
return false
|
||||||
|
count += 1
|
||||||
}
|
}
|
||||||
return uigraph.selectedNodes.count > 0 || uigraph.canSubmit
|
return count > 0 || uigraph.canSubmit
|
||||||
}
|
}
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
|
|
||||||
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.canComputeTopologically(uigraph.selectedNodes.at(i))) {
|
var node = uigraph.selectedNodes.at(i)
|
||||||
|
if (!node)
|
||||||
|
continue
|
||||||
|
if (uigraph.graph.canComputeTopologically(node)) {
|
||||||
if (nodeMenu.isComputed) {
|
if (nodeMenu.isComputed) {
|
||||||
canSubmit = true
|
canSubmit = true
|
||||||
} else if (uigraph.graph.canSubmitOrCompute(uigraph.selectedNodes.at(i)) > 1) {
|
} else if (uigraph.graph.canSubmitOrCompute(node) > 1) {
|
||||||
canSubmit = true
|
canSubmit = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue