Skip to content

Commit

Permalink
[Viewer3D] Display resection IDs of the active 3D model
Browse files Browse the repository at this point in the history
Instead of displaying the resection IDs of the 3D model that was loaded
last, update the display whenever the active model selection changes.
  • Loading branch information
cbentejac committed Nov 6, 2023
1 parent 08404f1 commit 80b9f81
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions meshroom/ui/qml/Viewer3D/Inspector3D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,25 @@ FloatingPane {
if(mouse.button == Qt.RightButton)
contextMenu.popup();
mediaListView.currentIndex = index;

// Update the resection ID-related objects based on the active model
Viewer3DSettings.resectionIdCount = model.resectionIdCount
Viewer3DSettings.resectionGroups = model.resectionGroups
Viewer3DSettings.resectionId = model.resectionId
resectionIdSlider.value = model.resectionId
}
onDoubleClicked: {
model.visible = true;
nodeActivated(model.attribute.node);
}

Connections {
target: resectionIdSlider
function onValueChanged() {
model.resectionId = resectionIdSlider.value
}
}

RowLayout {
width: parent.width
spacing: 2
Expand Down
5 changes: 4 additions & 1 deletion meshroom/ui/qml/Viewer3D/MediaLibrary.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ Entity {
"faceCount": 0,
"cameraCount": 0,
"textureCount": 0,
"resectionIdCount": 0,
"resectionId": 0,
"resectionGroups": [],
"status": SceneLoader.None
})
}
Expand Down Expand Up @@ -309,7 +312,7 @@ Entity {
if(object) {
// bind media info to corresponding model roles
// (test for object validity to avoid error messages right after object has been deleted)
var boundProperties = ["vertexCount", "faceCount", "cameraCount", "textureCount"];
var boundProperties = ["vertexCount", "faceCount", "cameraCount", "textureCount", "resectionIdCount", "resectionId", "resectionGroups"];
boundProperties.forEach( function(prop){
model[prop] = Qt.binding(function() { return object ? object[prop] : 0; });
})
Expand Down
3 changes: 3 additions & 0 deletions meshroom/ui/qml/Viewer3D/MediaLoader.qml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ import Utils 1.0
}
Viewer3DSettings.resectionIdCount = obj.countResectionIds();
Viewer3DSettings.resectionGroups = obj.countResectionGroups(Viewer3DSettings.resectionIdCount + 1);
resectionIdCount = Viewer3DSettings.resectionIdCount
resectionGroups = Viewer3DSettings.resectionGroups
resectionId = Viewer3DSettings.resectionIdCount
root.status = obj.status;
})
}
Expand Down
6 changes: 6 additions & 0 deletions meshroom/ui/qml/Viewer3D/MediaLoaderEntity.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ Entity {
property int cameraCount
/// Number of textures
property int textureCount
/// Number of resection IDs
property int resectionIdCount
/// Current resection ID
property int resectionId
/// Groups of cameras based on resection IDs
property var resectionGroups
}

0 comments on commit 80b9f81

Please sign in to comment.