mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-06 21:01:59 +02:00
[ui] split 2D and 3D viewers into separate modules
+ remove historical MayaCameraController
This commit is contained in:
parent
7db4beea89
commit
7415c1d391
16 changed files with 7 additions and 134 deletions
|
@ -1,128 +0,0 @@
|
||||||
import QtQuick 2.7
|
|
||||||
import Qt3D.Core 2.1
|
|
||||||
import Qt3D.Render 2.1
|
|
||||||
import Qt3D.Input 2.1
|
|
||||||
//import Qt3D.Extras 2.0
|
|
||||||
import Qt3D.Logic 2.0
|
|
||||||
import QtQml 2.2
|
|
||||||
|
|
||||||
Entity {
|
|
||||||
|
|
||||||
id: root
|
|
||||||
property Camera camera
|
|
||||||
property real translateSpeed: 100.0
|
|
||||||
property real tiltSpeed: 500.0
|
|
||||||
property real panSpeed: 500.0
|
|
||||||
property bool moving: false
|
|
||||||
|
|
||||||
signal mousePressed(var mouse)
|
|
||||||
signal mouseReleased(var mouse)
|
|
||||||
signal mouseWheeled(var wheel)
|
|
||||||
|
|
||||||
KeyboardDevice { id: keyboardSourceDevice }
|
|
||||||
MouseDevice { id: mouseSourceDevice; sensitivity: 0.1 }
|
|
||||||
|
|
||||||
MouseHandler {
|
|
||||||
|
|
||||||
sourceDevice: mouseSourceDevice
|
|
||||||
onPressed: mousePressed(mouse)
|
|
||||||
onReleased: mouseReleased(mouse)
|
|
||||||
onWheel: {
|
|
||||||
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.05;
|
|
||||||
var tz = (wheel.angleDelta.y / 120) * d;
|
|
||||||
root.camera.translate(Qt.vector3d(0, 0, tz), Camera.DontTranslateViewCenter)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LogicalDevice {
|
|
||||||
id: cameraControlDevice
|
|
||||||
actions: [
|
|
||||||
Action {
|
|
||||||
id: actionLMB
|
|
||||||
inputs: [
|
|
||||||
ActionInput {
|
|
||||||
sourceDevice: mouseSourceDevice
|
|
||||||
buttons: [MouseEvent.LeftButton]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
Action {
|
|
||||||
id: actionRMB
|
|
||||||
inputs: [
|
|
||||||
ActionInput {
|
|
||||||
sourceDevice: mouseSourceDevice
|
|
||||||
buttons: [MouseEvent.RightButton]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
Action {
|
|
||||||
id: actionMMB
|
|
||||||
inputs: [
|
|
||||||
ActionInput {
|
|
||||||
sourceDevice: mouseSourceDevice
|
|
||||||
buttons: [MouseEvent.MiddleButton]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
Action {
|
|
||||||
id: actionAlt
|
|
||||||
onActiveChanged: root.moving = active
|
|
||||||
inputs: [
|
|
||||||
ActionInput {
|
|
||||||
sourceDevice: keyboardSourceDevice
|
|
||||||
buttons: [Qt.Key_Alt]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
axes: [
|
|
||||||
Axis {
|
|
||||||
id: axisMX
|
|
||||||
inputs: [
|
|
||||||
AnalogAxisInput {
|
|
||||||
sourceDevice: mouseSourceDevice
|
|
||||||
axis: MouseDevice.X
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
Axis {
|
|
||||||
id: axisMY
|
|
||||||
inputs: [
|
|
||||||
AnalogAxisInput {
|
|
||||||
sourceDevice: mouseSourceDevice
|
|
||||||
axis: MouseDevice.Y
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
components: [
|
|
||||||
FrameAction {
|
|
||||||
onTriggered: {
|
|
||||||
if(!actionAlt.active)
|
|
||||||
return;
|
|
||||||
if(actionLMB.active) { // rotate
|
|
||||||
var rx = -axisMX.value;
|
|
||||||
var ry = -axisMY.value;
|
|
||||||
root.camera.panAboutViewCenter(root.panSpeed * rx * dt, Qt.vector3d(0,1,0))
|
|
||||||
root.camera.tiltAboutViewCenter(root.tiltSpeed * ry * dt)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(actionMMB.active) { // translate
|
|
||||||
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.03;
|
|
||||||
var tx = axisMX.value * root.translateSpeed * d;
|
|
||||||
var ty = axisMY.value * root.translateSpeed * d;
|
|
||||||
root.camera.translate(Qt.vector3d(-tx, -ty, 0).times(dt))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(actionRMB.active) { // zoom
|
|
||||||
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.05;
|
|
||||||
var tz = axisMX.value * root.translateSpeed * d;
|
|
||||||
root.camera.translate(Qt.vector3d(0, 0, tz).times(dt), Camera.DontTranslateViewCenter)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -2,9 +2,3 @@ module Viewer
|
||||||
|
|
||||||
Viewer2D 1.0 Viewer2D.qml
|
Viewer2D 1.0 Viewer2D.qml
|
||||||
ImageMetadataView 1.0 ImageMetadataView.qml
|
ImageMetadataView 1.0 ImageMetadataView.qml
|
||||||
Viewer3D 1.0 Viewer3D.qml
|
|
||||||
DefaultCameraController 1.0 DefaultCameraController.qml
|
|
||||||
MayaCameraController 1.0 MayaCameraController.qml
|
|
||||||
Locator3D 1.0 Locator3D.qml
|
|
||||||
Grid3D 1.0 Grid3D.qml
|
|
||||||
|
|
||||||
|
|
6
meshroom/ui/qml/Viewer3D/qmldir
Normal file
6
meshroom/ui/qml/Viewer3D/qmldir
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
module Viewer3D
|
||||||
|
|
||||||
|
Viewer3D 1.0 Viewer3D.qml
|
||||||
|
DefaultCameraController 1.0 DefaultCameraController.qml
|
||||||
|
Locator3D 1.0 Locator3D.qml
|
||||||
|
Grid3D 1.0 Grid3D.qml
|
|
@ -4,6 +4,7 @@ import QtQuick.Controls 1.4 as Controls1 // For SplitView
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import Qt.labs.platform 1.0 as Platform
|
import Qt.labs.platform 1.0 as Platform
|
||||||
import Viewer 1.0
|
import Viewer 1.0
|
||||||
|
import Viewer3D 1.0
|
||||||
import MaterialIcons 2.2
|
import MaterialIcons 2.2
|
||||||
import Utils 1.0
|
import Utils 1.0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue