mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
[ui] Viewer3D: add SfMTransformGizmo to MediaLibrary and Inspector3D
This commit is contained in:
parent
180b492ba1
commit
9fd90745e2
2 changed files with 47 additions and 1 deletions
|
@ -300,6 +300,22 @@ FloatingPane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Transform visibility (if SfMTransform node)
|
||||||
|
MaterialToolButton {
|
||||||
|
visible: model.hasTransform
|
||||||
|
enabled: model.visible
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.fillHeight: true
|
||||||
|
text: MaterialIcons._3d_rotation
|
||||||
|
font.pointSize: 10
|
||||||
|
ToolTip.text: model.displayTransform ? "Hide Gizmo" : "Show Gizmo"
|
||||||
|
flat: true
|
||||||
|
opacity: model.visible ? (model.displayTransform ? 1.0 : 0.6) : 0.6
|
||||||
|
onClicked: {
|
||||||
|
model.displayTransform = !model.displayTransform
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Media label and info
|
// Media label and info
|
||||||
Item {
|
Item {
|
||||||
implicitHeight: childrenRect.height
|
implicitHeight: childrenRect.height
|
||||||
|
|
|
@ -48,6 +48,8 @@ Entity {
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"hasBoundingBox": false, // for Meshing node only
|
"hasBoundingBox": false, // for Meshing node only
|
||||||
"displayBoundingBox": true, // for Meshing node only
|
"displayBoundingBox": true, // for Meshing node only
|
||||||
|
"hasTransform": false, // for SfMTransform node only
|
||||||
|
"displayTransform": true, // for SfMTransform node only
|
||||||
"section": "",
|
"section": "",
|
||||||
"attribute": null,
|
"attribute": null,
|
||||||
"entity": null,
|
"entity": null,
|
||||||
|
@ -160,7 +162,7 @@ Entity {
|
||||||
property var currentNode: model.attribute ? model.attribute.node : null
|
property var currentNode: model.attribute ? model.attribute.node : null
|
||||||
property string nodeType: currentNode ? currentNode.nodeType: null
|
property string nodeType: currentNode ? currentNode.nodeType: null
|
||||||
|
|
||||||
// Specific properties to the Meshing node (declared and initialiazed for every MediaLoader anyway)
|
// Specific properties to the Meshing node (declared and initialized for every MediaLoader anyway)
|
||||||
property bool hasBoundingBox: {
|
property bool hasBoundingBox: {
|
||||||
if(nodeType === "Meshing") { // Can have a BoundingBox
|
if(nodeType === "Meshing") { // Can have a BoundingBox
|
||||||
const value = currentNode.attribute("useBoundingBox") ? currentNode.attribute("useBoundingBox").value : false
|
const value = currentNode.attribute("useBoundingBox") ? currentNode.attribute("useBoundingBox").value : false
|
||||||
|
@ -171,6 +173,17 @@ Entity {
|
||||||
}
|
}
|
||||||
property bool displayBoundingBox: model.displayBoundingBox
|
property bool displayBoundingBox: model.displayBoundingBox
|
||||||
|
|
||||||
|
// Specific properties to the SfMTransform node (declared and initialized for every MediaLoader anyway)
|
||||||
|
property bool hasTransform: {
|
||||||
|
if(nodeType === "SfMTransform") { // Can have a Transform
|
||||||
|
const value = currentNode.attribute("method") ? currentNode.attribute("method").value === "manual" : false
|
||||||
|
model.hasTransform = value
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
property bool displayTransform: model.displayTransform
|
||||||
|
|
||||||
// whether MediaLoader has been fully instantiated by the NodeInstantiator
|
// whether MediaLoader has been fully instantiated by the NodeInstantiator
|
||||||
property bool fullyInstantiated: false
|
property bool fullyInstantiated: false
|
||||||
|
|
||||||
|
@ -227,6 +240,23 @@ Entity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Transform: display a TransformGizmo for SfMTransform node only
|
||||||
|
// note: use a NodeInstantiator to evaluate if the current node is a SfMTransform node and if the transform mode is set to Manual
|
||||||
|
NodeInstantiator {
|
||||||
|
id: sfmTransformGizmoInstantiator
|
||||||
|
property var currentNode: mediaLoader.currentNode
|
||||||
|
active: mediaLoader.hasTransform
|
||||||
|
model: 1
|
||||||
|
|
||||||
|
SfMTransformGizmo {
|
||||||
|
sceneCameraController: root.sceneCameraController
|
||||||
|
frontLayerComponent: root.frontLayerComponent
|
||||||
|
window: root.window
|
||||||
|
currentSfMTransformNode: sfmTransformGizmoInstantiator.currentNode
|
||||||
|
enabled: mediaLoader.displayTransform
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 'visible' property drives media loading request
|
// 'visible' property drives media loading request
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
// always request media loading if visible
|
// always request media loading if visible
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue