mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 16:58:24 +02:00
[ui] basic sequence player: control selected viewId with a slider
This commit is contained in:
parent
6c135e14b9
commit
d9264473e4
2 changed files with 49 additions and 0 deletions
45
meshroom/ui/qml/Viewer/SequencePlayer.qml
Normal file
45
meshroom/ui/qml/Viewer/SequencePlayer.qml
Normal file
|
@ -0,0 +1,45 @@
|
|||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
Slider {
|
||||
|
||||
function sequence(vps) {
|
||||
let objs = []
|
||||
for (let i = 0; i < vps.count; i++) {
|
||||
objs.push({
|
||||
viewId: m.viewpoints.at(i).childAttribute("viewId").value,
|
||||
filename: Filepath.basename(m.viewpoints.at(i).childAttribute("path").value)
|
||||
});
|
||||
}
|
||||
objs.sort((a, b) => { return a.filename < b.filename ? -1 : 1; });
|
||||
|
||||
let viewIds = [];
|
||||
for (let i = 0; i < objs.length; i++) {
|
||||
viewIds.push(objs[i].viewId);
|
||||
}
|
||||
|
||||
return viewIds;
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: m
|
||||
property var currentCameraInit: _reconstruction && _reconstruction.cameraInit ? _reconstruction.cameraInit : undefined
|
||||
property var viewpoints: currentCameraInit ? currentCameraInit.attribute('viewpoints').value : undefined
|
||||
property var sortedViewIds: viewpoints ? sequence(viewpoints) : []
|
||||
}
|
||||
|
||||
stepSize: 1
|
||||
snapMode: Slider.SnapAlways
|
||||
live: true
|
||||
|
||||
from: 0
|
||||
to: Math.max(m.sortedViewIds.length, 1)
|
||||
|
||||
onValueChanged: {
|
||||
let idx = Math.floor(value);
|
||||
if (_reconstruction && idx >= 0 && idx < m.sortedViewIds.length - 1) {
|
||||
_reconstruction.selectedViewId = m.sortedViewIds[idx];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1296,6 +1296,10 @@ FocusScope {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
FloatingPane {
|
||||
SequencePlayer {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue