mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-06 12:51:57 +02:00
[ui] Value of current edge iteration and TaskManager protected
This commit is contained in:
parent
0d397b4baf
commit
0d346ab2da
3 changed files with 17 additions and 8 deletions
|
@ -764,24 +764,22 @@ class UIGraph(QObject):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@Slot(Edge)
|
@Slot(Edge, result=Edge)
|
||||||
def expandForLoop(self, currentEdge):
|
def expandForLoop(self, currentEdge):
|
||||||
""" Expand 'node' by creating all its output nodes. """
|
""" Expand 'node' by creating all its output nodes. """
|
||||||
with self.groupedGraphModification("Expand For Loop Node"):
|
with self.groupedGraphModification("Expand For Loop Node"):
|
||||||
listAttribute = currentEdge.src.root
|
listAttribute = currentEdge.src.root
|
||||||
dst = currentEdge.dst
|
dst = currentEdge.dst
|
||||||
|
|
||||||
# First, replace the edge with the first element of the list
|
|
||||||
currentEdge = self.replaceEdge(currentEdge, listAttribute.at(0), dst)
|
|
||||||
|
|
||||||
srcIndex = listAttribute.index(currentEdge.src)
|
|
||||||
dst = currentEdge.dst
|
|
||||||
for i in range(1, len(listAttribute)):
|
for i in range(1, len(listAttribute)):
|
||||||
duplicates = self.duplicateNodesFrom(dst.node)
|
duplicates = self.duplicateNodesFrom(dst.node)
|
||||||
newNode = duplicates[0]
|
newNode = duplicates[0]
|
||||||
previousEdge = self.graph.edge(newNode.attribute(dst.name))
|
previousEdge = self.graph.edge(newNode.attribute(dst.name))
|
||||||
self.replaceEdge(previousEdge, listAttribute.at(i), previousEdge.dst)
|
self.replaceEdge(previousEdge, listAttribute.at(i), previousEdge.dst)
|
||||||
|
|
||||||
|
# Last, replace the edge with the first element of the list
|
||||||
|
return self.replaceEdge(currentEdge, listAttribute.at(0), dst)
|
||||||
|
|
||||||
@Slot(Edge)
|
@Slot(Edge)
|
||||||
def collapseForLoop(self, currentEdge):
|
def collapseForLoop(self, currentEdge):
|
||||||
""" Collapse 'node' by removing all its output nodes. """
|
""" Collapse 'node' by removing all its output nodes. """
|
||||||
|
|
|
@ -390,11 +390,22 @@ Item {
|
||||||
|
|
||||||
contentItem: Row {
|
contentItem: Row {
|
||||||
IntSelector {
|
IntSelector {
|
||||||
|
id: loopIterationSelector
|
||||||
tooltipText: "Iterations"
|
tooltipText: "Iterations"
|
||||||
visible: edgeMenu.currentEdge && edgeMenu.forLoop
|
visible: edgeMenu.currentEdge && edgeMenu.forLoop
|
||||||
|
|
||||||
property var listAttr: edgeMenu.currentEdge ? edgeMenu.currentEdge.src.root : null
|
property var listAttr: edgeMenu.currentEdge ? edgeMenu.currentEdge.src.root : null
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: edgeMenu
|
||||||
|
function onCurrentEdgeChanged() {
|
||||||
|
if (edgeMenu.currentEdge) {
|
||||||
|
loopIterationSelector.listAttr = edgeMenu.currentEdge.src.root
|
||||||
|
loopIterationSelector.value = loopIterationSelector.listAttr ? loopIterationSelector.listAttr.value.indexOf(edgeMenu.currentEdge.src) + 1 : 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We add 1 to the index because of human readable index (starting at 1)
|
// We add 1 to the index because of human readable index (starting at 1)
|
||||||
value: listAttr ? listAttr.value.indexOf(edgeMenu.currentEdge.src) + 1 : 0
|
value: listAttr ? listAttr.value.indexOf(edgeMenu.currentEdge.src) + 1 : 0
|
||||||
range: { "min": 1, "max": listAttr ? listAttr.value.count : 0 }
|
range: { "min": 1, "max": listAttr ? listAttr.value.count : 0 }
|
||||||
|
@ -437,7 +448,7 @@ Item {
|
||||||
text: MaterialIcons.open_in_full
|
text: MaterialIcons.open_in_full
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
uigraph.expandForLoop(edgeMenu.currentEdge)
|
edgeMenu.currentEdge = uigraph.expandForLoop(edgeMenu.currentEdge)
|
||||||
canExpand = false
|
canExpand = false
|
||||||
edgeMenu.close()
|
edgeMenu.close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,7 +264,7 @@ Item {
|
||||||
spacing: 3
|
spacing: 3
|
||||||
|
|
||||||
delegate: Label {
|
delegate: Label {
|
||||||
width: (ListView.view.width / ListView.view.model.count) - 3
|
width: ListView.view.model ? (ListView.view.width / ListView.view.model.count) - 3 : 0
|
||||||
height: ListView.view.height
|
height: ListView.view.height
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue