mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-05 04:12:15 +02:00
[ui] Viewer3D: specific bounding box options in the Inspector3D
This commit is contained in:
parent
f2a75861c3
commit
c45d29976b
2 changed files with 21 additions and 23 deletions
|
@ -284,19 +284,19 @@ FloatingPane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transform visibility (bbox for meshing)
|
// BoundingBox visibility (if meshing node)
|
||||||
MaterialToolButton {
|
MaterialToolButton {
|
||||||
visible: model.hasTransform
|
visible: model.hasBoundingBox
|
||||||
enabled: model.visible
|
enabled: model.visible
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
text: MaterialIcons.transform
|
text: MaterialIcons.transform
|
||||||
font.pointSize: 10
|
font.pointSize: 10
|
||||||
ToolTip.text: model.displayTransform ? "Hide BBox" : "Show BBox"
|
ToolTip.text: model.displayBoundingBox ? "Hide BBox" : "Show BBox"
|
||||||
flat: true
|
flat: true
|
||||||
opacity: model.visible ? (model.displayTransform ? 1.0 : 0.6) : 0.6
|
opacity: model.visible ? (model.displayBoundingBox ? 1.0 : 0.6) : 0.6
|
||||||
onClicked: {
|
onClicked: {
|
||||||
model.displayTransform = !model.displayTransform
|
model.displayBoundingBox = !model.displayBoundingBox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,8 @@ Entity {
|
||||||
"valid": true,
|
"valid": true,
|
||||||
"label": "",
|
"label": "",
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"hasTransform": false,
|
"hasBoundingBox": false, // for Meshing node only
|
||||||
"displayTransform": true,
|
"displayBoundingBox": true, // for Meshing node only
|
||||||
"section": "",
|
"section": "",
|
||||||
"attribute": null,
|
"attribute": null,
|
||||||
"entity": null,
|
"entity": null,
|
||||||
|
@ -156,20 +156,20 @@ Entity {
|
||||||
delegate: MediaLoader {
|
delegate: MediaLoader {
|
||||||
id: mediaLoader
|
id: mediaLoader
|
||||||
|
|
||||||
|
// Get the node
|
||||||
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
|
||||||
property bool hasTransform: {
|
|
||||||
if(nodeType !== "Meshing") // Cannot have a Transform
|
|
||||||
return false
|
|
||||||
const value = currentNode ? currentNode.attribute("useBoundingBox").value : null
|
|
||||||
if (value !== null)
|
|
||||||
mediaLoader.hasTransformPropertyChanged(value)
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
property bool displayTransform: model.displayTransform
|
|
||||||
|
|
||||||
signal hasTransformPropertyChanged(bool transform)
|
// Specific properties to the Meshing node (declared and initialiazed for every MediaLoader anyway)
|
||||||
onHasTransformPropertyChanged: model.hasTransform = transform
|
property bool hasBoundingBox: {
|
||||||
|
if(nodeType === "Meshing") { // Can have a BoundingBox
|
||||||
|
const value = currentNode.attribute("useBoundingBox") ? currentNode.attribute("useBoundingBox").value : false
|
||||||
|
model.hasBoundingBox = value
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
property bool displayBoundingBox: model.displayBoundingBox
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -210,12 +210,12 @@ Entity {
|
||||||
onObjectRemoved: remove(idx)
|
onObjectRemoved: remove(idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BoundingBox: display bounding box for meshing computation
|
// BoundingBox: display bounding box for MESHING computation
|
||||||
// note: use a NodeInstantiator to evaluate if the current node is a MESHING node and if the checkbox is active
|
// note: use a NodeInstantiator to evaluate if the current node is a MESHING node and if the checkbox is active
|
||||||
NodeInstantiator {
|
NodeInstantiator {
|
||||||
id: boundingBoxInstantiator
|
id: boundingBoxInstantiator
|
||||||
property var currentNode: mediaLoader.currentNode
|
property var currentNode: mediaLoader.currentNode
|
||||||
active: currentNode.nodeType === "Meshing" && currentNode.attribute("useBoundingBox").value
|
active: mediaLoader.hasBoundingBox
|
||||||
model: 1
|
model: 1
|
||||||
|
|
||||||
MeshingBoundingBox {
|
MeshingBoundingBox {
|
||||||
|
@ -223,7 +223,7 @@ Entity {
|
||||||
frontLayerComponent: root.frontLayerComponent
|
frontLayerComponent: root.frontLayerComponent
|
||||||
window: root.window
|
window: root.window
|
||||||
currentMeshingNode: boundingBoxInstantiator.currentNode
|
currentMeshingNode: boundingBoxInstantiator.currentNode
|
||||||
enabled: mediaLoader.displayTransform
|
enabled: mediaLoader.displayBoundingBox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,8 +266,6 @@ Entity {
|
||||||
// if external media failed to open, remove element from model
|
// if external media failed to open, remove element from model
|
||||||
if(!attribute && !object)
|
if(!attribute && !object)
|
||||||
remove(index)
|
remove(index)
|
||||||
// tell the model if it has a Transform (Gizmo)
|
|
||||||
model.hasTransform = hasTransform
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentSourceChanged: {
|
onCurrentSourceChanged: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue