diff --git a/meshroom/ui/qml/GraphEditor/NodeEditor.qml b/meshroom/ui/qml/GraphEditor/NodeEditor.qml index 3d4684229e..fc570cb026 100644 --- a/meshroom/ui/qml/GraphEditor/NodeEditor.qml +++ b/meshroom/ui/qml/GraphEditor/NodeEditor.qml @@ -257,11 +257,37 @@ Panel { Controls1.SplitView { anchors.fill: parent + // The list of iterations + NodeEditorElementsListView { + id: iterationsLV + visible: root.node.countForLoop > 0 + elements: { + if (root.node.countForLoop == 0) + return [] + var elements = [] + for (let i = 0; i < node.attributes.count; ++i) { + if (node.attributes.at(i).isLink) { + var srcAttr = node.attributes.at(i).linkParam + for (let j = 0; j < srcAttr.root.value.count; ++j) { + elements.push(j) + } + return elements + } + } + } + + // TODO to remove when the elements would be correct + currentElement: elements[0] + + isChunk: false + title: "Iterations" + } + // The list of chunks - ChunksListView { + NodeEditorElementsListView { id: chunksLV visible: (tabBar.currentIndex >= 1 && tabBar.currentIndex <= 3) - chunks: root.node.chunks + elements: root.node.chunks } StackLayout { @@ -295,7 +321,7 @@ Panel { id: nodeLog node: root.node currentChunkIndex: chunksLV.currentIndex - currentChunk: chunksLV.currentChunk + currentChunk: chunksLV.currentElement } } @@ -310,7 +336,7 @@ Panel { Layout.fillWidth: true node: root.node currentChunkIndex: chunksLV.currentIndex - currentChunk: chunksLV.currentChunk + currentChunk: chunksLV.currentElement } } @@ -325,7 +351,7 @@ Panel { Layout.fillWidth: true node: root.node currentChunkIndex: chunksLV.currentIndex - currentChunk: chunksLV.currentChunk + currentChunk: chunksLV.currentElement } } diff --git a/meshroom/ui/qml/GraphEditor/ChunksListView.qml b/meshroom/ui/qml/GraphEditor/NodeEditorElementsListView.qml similarity index 58% rename from meshroom/ui/qml/GraphEditor/ChunksListView.qml rename to meshroom/ui/qml/GraphEditor/NodeEditorElementsListView.qml index c8fd39cba8..27039dc58a 100644 --- a/meshroom/ui/qml/GraphEditor/ChunksListView.qml +++ b/meshroom/ui/qml/GraphEditor/NodeEditorElementsListView.qml @@ -8,52 +8,56 @@ import Controls 1.0 import "common.js" as Common /** - * ChunkListView + * NodeEditorElementsListView */ ColumnLayout { id: root - property variant chunks + property variant elements property int currentIndex: 0 - property variant currentChunk: (chunks && currentIndex >= 0) ? chunks.at(currentIndex) : undefined + property bool isChunk: true + property string title: "Chunks" - onChunksChanged: { + // TODO : change to currentElement + property variant currentElement: (elements && currentIndex >= 0) ? elements.at(currentIndex) : undefined + + onElementsChanged: { // When the list changes, ensure the current index is in the new range - if (currentIndex >= chunks.count) - currentIndex = chunks.count-1 + if (currentIndex >= elements.count) + currentIndex = elements.count-1 } - // chunksSummary is in sync with allChunks button (but not directly accessible as it is in a Component) - property bool chunksSummary: (currentIndex === -1) + // elementsSummary is in sync with allElements button (but not directly accessible as it is in a Component) + property bool elementsSummary: (currentIndex === -1) - width: 60 + width: 75 ListView { - id: chunksLV + id: elementsLV Layout.fillWidth: true Layout.fillHeight: true - model: root.chunks + model: root.elements - highlightFollowsCurrentItem: (root.chunksSummary === false) + highlightFollowsCurrentItem: (root.elementsSummary === false) keyNavigationEnabled: true focus: true currentIndex: root.currentIndex onCurrentIndexChanged: { - if (chunksLV.currentIndex !== root.currentIndex) { + if (elementsLV.currentIndex !== root.currentIndex) { // When the list is resized, the currentIndex is reset to 0. // So here we force it to keep the binding. - chunksLV.currentIndex = Qt.binding(function() { return root.currentIndex }) + elementsLV.currentIndex = Qt.binding(function() { return root.currentIndex }) } } header: Component { Button { - id: allChunks - text: "Chunks" + id: allElements + text: title width: parent.width flat: true checkable: true - property bool summaryEnabled: root.chunksSummary + property bool summaryEnabled: root.elementsSummary checked: summaryEnabled onSummaryEnabledChanged: { checked = summaryEnabled @@ -66,7 +70,7 @@ ColumnLayout { } highlight: Component { Rectangle { - visible: true // !root.chunksSummary + visible: true // !root.elementsSummary color: activePalette.highlight opacity: 0.3 z: 2 @@ -76,19 +80,19 @@ ColumnLayout { highlightResizeDuration: 0 delegate: ItemDelegate { - id: chunkDelegate - property var chunk: object + id: elementDelegate + property var element: object text: index width: parent ? parent.width : 0 leftPadding: 8 onClicked: { - chunksLV.forceActiveFocus() + elementsLV.forceActiveFocus() root.currentIndex = index } Rectangle { width: 4 height: parent.height - color: Common.getChunkColor(parent.chunk) + color: isChunk ? Common.getChunkColor(parent.element) : palette.mid } } }