mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-24 20:17:17 +02:00
use semantic field in file attributes to specify images and store displayed node in 2D viewer to adapt UI
This commit is contained in:
parent
fc5ab540f5
commit
a574c0fc9b
9 changed files with 139 additions and 83 deletions
|
@ -851,11 +851,17 @@ ApplicationWindow {
|
|||
reconstruction: _reconstruction
|
||||
readOnly: _reconstruction.computing
|
||||
|
||||
function viewAttribute(attribute, mouse) {
|
||||
let viewable = false;
|
||||
viewable = workspaceView.viewIn2D(attribute);
|
||||
viewable |= workspaceView.viewIn3D(attribute, mouse);
|
||||
return viewable;
|
||||
function viewNode(node, mouse) {
|
||||
// 2D viewer
|
||||
viewer2D.displayedNode = node;
|
||||
|
||||
// 3D viewer
|
||||
for(var i=0; i < node.attributes.count; ++i)
|
||||
{
|
||||
var attr = node.attributes.at(i)
|
||||
if(attr.isOutput && workspaceView.viewIn3D(attr, mouse))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function viewIn3D(attribute, mouse) {
|
||||
|
@ -867,33 +873,6 @@ ApplicationWindow {
|
|||
panel3dViewer.viewer3D.solo(attribute);
|
||||
return loaded;
|
||||
}
|
||||
|
||||
function viewIn2D(attribute) {
|
||||
var imageExts = ['.exr', '.jpg', '.tif', '.png'];
|
||||
var ext = Filepath.extension(attribute.value);
|
||||
if(imageExts.indexOf(ext) == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(attribute.value.includes('*'))
|
||||
{
|
||||
// For now, the viewer only supports a single image.
|
||||
var firstFile = Filepath.globFirst(attribute.value)
|
||||
viewer2D.source = Filepath.stringToUrl(firstFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
viewer2D.source = Filepath.stringToUrl(attribute.value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function setImageTypes(types) {
|
||||
viewer2D.setImageTypes(types);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -958,17 +937,8 @@ ApplicationWindow {
|
|||
nodeTypesModel: _nodeTypes
|
||||
|
||||
onNodeDoubleClicked: {
|
||||
workspaceView.setImageTypes(node.outputImageTypes);
|
||||
|
||||
_reconstruction.setActiveNode(node);
|
||||
|
||||
let viewable = false;
|
||||
for(var i=0; i < node.attributes.count; ++i)
|
||||
{
|
||||
var attr = node.attributes.at(i)
|
||||
if(attr.isOutput && workspaceView.viewAttribute(attr, mouse))
|
||||
break;
|
||||
}
|
||||
workspaceView.viewNode(node, mouse);
|
||||
}
|
||||
onComputeRequest: computeManager.compute(node)
|
||||
onSubmitRequest: computeManager.submit(node)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue