[Panorama Viewer] change pitch and yaw from SfMTransform Node

This commit is contained in:
Thomas Zorroche 2021-02-18 16:37:25 +01:00 committed by Fabien Castan
parent 733362fe1d
commit 2e1c80b879
3 changed files with 303 additions and 12 deletions

View file

@ -60,6 +60,28 @@ AliceVision.PanoramaViewer {
property int yaw: 0;
property int pitch: 0;
// Yaw and Pitch in Degrees from SfMTransform sliders
property int yawNode: _reconstruction.activeNodes.get('SfMTransform').node.attribute("manualTransform.manualRotation.y").value;
property int pitchNode: _reconstruction.activeNodes.get('SfMTransform').node.attribute("manualTransform.manualRotation.x").value;
onYawNodeChanged: {
if (!isRotating) {
for (var i = 0; i < repeater.model; i++) {
repeater.itemAt(i).item.rotatePanoramaDegrees(yawNode, pitchNode);
}
}
}
onPitchNodeChanged: {
if (!isRotating) {
for (var i = 0; i < repeater.model; i++) {
repeater.itemAt(i).item.rotatePanoDegrees(yawNode, pitchNode);
}
}
}
Item {
id: containerPanorama
z: 10
@ -90,8 +112,7 @@ AliceVision.PanoramaViewer {
lastX = mouse.x;
lastY = mouse.y;
for (var i = 0; i < repeater.model; i++) {
//repeater.itemAt(i).item.rotatePanorama((xoffset / width) * mouseMultiplier, -(yoffset / height) * mouseMultiplier)
repeater.itemAt(i).item.rotatePanorama(0, -(yoffset / height) * mouseMultiplier)
repeater.itemAt(i).item.rotatePanoRadians((xoffset / width) * mouseMultiplier, -(yoffset / height) * mouseMultiplier);
}
}
}
@ -106,7 +127,7 @@ AliceVision.PanoramaViewer {
if (isRotating)
{
// Update Euler angles
var activeNode = _reconstruction.activeNodes.get('sfm').node;
var activeNode = _reconstruction.activeNodes.get('SfMTransform').node;
root.yaw = repeater.itemAt(0).item.getYaw();
root.pitch = repeater.itemAt(0).item.getPitch();
@ -152,12 +173,11 @@ AliceVision.PanoramaViewer {
}
property string sfmPath: ""
function updateSfmPath() {
var activeNode = _reconstruction.activeNodes.get('sfm').node;
console.warn("SFM UPDATE - PANO")
var activeNode = _reconstruction.activeNodes.get('SfMTransform').node;
if(!activeNode)
{
@ -165,7 +185,7 @@ AliceVision.PanoramaViewer {
}
else
{
root.sfmPath = activeNode.attribute("outputViewsAndPoses").value;
root.sfmPath = activeNode.attribute("input").value;
}
root.setSfmPath(sfmPath);
}
@ -196,7 +216,6 @@ AliceVision.PanoramaViewer {
'index' : index,
'idView': Qt.binding(function() { return cId; }),
})
//repeater.itemAt(index).item.rotatePanorama(yaw * (3.14 / 180), pitch * (3.14 / 180))
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14