Meshroom/meshroom/ui/qml/Viewer3D/AlembicLoader.qml
Yann Lanthony 109b980ae5 [ui] Viewer3D: introduce new 3D media loading backend
This commit adds several components to centralize and extend 3D media loading. They are not yet integrated into Viewer3D. The entry point to this system is the MediaLibrary component that:
    * can load N medias based on a filepath or load-and-watch node attributes
    * provides a cache mechanism to instant-reload medias that were unloaded under certain conditions
    * gives access to statistics (vertex/face/camera/textureCount) through a unified interface
2018-12-07 15:57:57 +01:00

63 lines
1.9 KiB
QML

import AlembicEntity 1.0
import QtQuick 2.9
import Qt3D.Core 2.1
import Qt3D.Render 2.1
import Qt3D.Extras 2.1
/**
* Support for Alembic files in Qt3d.
* Create this component dynamically to test for AlembicEntity plugin availability.
*/
AlembicEntity {
id: root
signal cameraSelected(var viewId)
function spawnCameraSelectors() {
var validCameras = 0;
// spawn camera selector for each camera
for(var i = 0; i < root.cameras.length; ++i)
{
var cam = root.cameras[i];
// retrieve view id
var viewId = cam.userProperties["mvg_viewId"];
if(viewId === undefined)
continue;
// filter out non-reconstructed cameras
if(cam.parent.parent.objectName === "mvgCamerasUndefined") {
cam.enabled = false;
continue;
}
camSelectionComponent.createObject(cam, {"viewId": viewId});
validCameras++;
}
return validCameras;
}
SystemPalette {
id: activePalette
}
// Camera selection picking and display
Component {
id: camSelectionComponent
Entity {
id: camSelector
property string viewId
components: [
CuboidMesh { xExtent: 0.2; yExtent: 0.2; zExtent: 0.2;},
PhongMaterial{
id: mat
ambient: viewId === _reconstruction.selectedViewId ? activePalette.highlight : "#CCC"
diffuse: cameraPicker.containsMouse ? Qt.lighter(activePalette.highlight, 1.2) : ambient
},
ObjectPicker {
id: cameraPicker
enabled: root.enabled
onClicked: _reconstruction.selectedViewId = camSelector.viewId
}
]
}
}
}