Skip to content

Commit d78b127

Browse files
authored
Merge pull request #2983 from alicevision/dev/refacto_reconstruction
[refacto] Rename `reconstruction` to `scene`
2 parents cca5cc5 + fa85f05 commit d78b127

36 files changed

+369
-369
lines changed

meshroom/ui/app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from meshroom.ui.components.messaging import MessageController
3131
from meshroom.ui.components.shapes import ShapeFilesHelper, ShapeViewerHelper
3232
from meshroom.ui.palette import PaletteManager
33-
from meshroom.ui.reconstruction import Reconstruction
33+
from meshroom.ui.scene import Scene
3434
from meshroom.ui.utils import QmlInstantEngine
3535
from meshroom.ui import commands
3636

@@ -281,13 +281,13 @@ def __init__(self, inputArgs):
281281
# expose available node types that can be instantiated
282282
self.engine.rootContext().setContextProperty("_nodeTypes", {n: {"category": pluginManager.getRegisteredNodePlugins()[n].nodeDescriptor.category} for n in sorted(pluginManager.getRegisteredNodePlugins().keys())})
283283

284-
# instantiate Reconstruction object
284+
# instantiate the 3D Scene object
285285
self._undoStack = commands.UndoStack(self)
286286
self._defaultSubmitterName = os.environ.get('MESHROOM_DEFAULT_SUBMITTER', '')
287287
self._taskManager = TaskManager(self)
288-
self._activeProject = Reconstruction(undoStack=self._undoStack, taskManager=self._taskManager, defaultPipeline=args.pipeline, parent=self)
288+
self._activeProject = Scene(undoStack=self._undoStack, taskManager=self._taskManager, defaultPipeline=args.pipeline, parent=self)
289289
self._activeProject.setSubmitLabel(args.submitLabel)
290-
self.engine.rootContext().setContextProperty("_reconstruction", self._activeProject)
290+
self.engine.rootContext().setContextProperty("_currentScene", self._activeProject)
291291

292292
# those helpers should be available from QML Utils module as singletons, but:
293293
# - qmlRegisterUncreatableType is not yet available in PySide2

meshroom/ui/components/shapes/shapeFilesHelper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from meshroom.ui.reconstruction import Reconstruction
1+
from meshroom.ui.scene import Scene
22
from meshroom.common import BaseObject, Property, Variant, Signal, ListModel, Slot
33
from meshroom.core.attribute import GroupAttribute, ListAttribute
44
from shiboken6 import isValid
@@ -13,7 +13,7 @@ class ShapeFilesHelper(BaseObject):
1313
Manages active project selected node shape files.
1414
"""
1515

16-
def __init__(self, activeProject:Reconstruction, parent=None):
16+
def __init__(self, activeProject:Scene, parent=None):
1717
super().__init__(parent)
1818
self._activeProject = activeProject
1919
self._currentNode = activeProject.selectedNode

meshroom/ui/qml/Application.qml

Lines changed: 93 additions & 93 deletions
Large diffs are not rendered by default.

meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RowLayout {
2424
property int labelWidth // Shortcut to set the fixed size of the Label
2525

2626
readonly property bool editable: !attribute.isOutput && !attribute.isLink &&
27-
!readOnly && !(attribute.keyable && _reconstruction.selectedViewId === "-1")
27+
!readOnly && !(attribute.keyable && _currentScene.selectedViewId === "-1")
2828

2929
signal doubleClicked(var mouse, var attr)
3030
signal inAttributeClicked(var srcItem, var mouse, var inAttributes)
@@ -144,7 +144,7 @@ RowLayout {
144144
text: "Reset To Default Value"
145145
enabled: root.editable && !attribute.isDefault
146146
onTriggered: {
147-
_reconstruction.resetAttribute(attribute)
147+
_currentScene.resetAttribute(attribute)
148148
updateAttributeLabel()
149149
}
150150
}
@@ -160,7 +160,7 @@ RowLayout {
160160
text: "Paste"
161161
enabled: Clipboard.getText() != "" && !attribute.keyable && root.editable
162162
onTriggered: {
163-
_reconstruction.setAttribute(attribute, Clipboard.getText())
163+
_currentScene.setAttribute(attribute, Clipboard.getText())
164164
}
165165
}
166166

@@ -210,7 +210,7 @@ RowLayout {
210210

211211
MaterialLabel {
212212
property bool isDisplayable: attribute.isOutput && (attribute.is2dDisplayable || attribute.is3dDisplayable)
213-
property bool isDisplayed: attribute === _reconstruction.displayedAttr2D || _reconstruction.displayedAttrs3D.count && _reconstruction.displayedAttrs3D.contains(attribute)
213+
property bool isDisplayed: attribute === _currentScene.displayedAttr2D || _currentScene.displayedAttrs3D.count && _currentScene.displayedAttrs3D.contains(attribute)
214214
text: isDisplayed ? MaterialIcons.visibility : MaterialIcons.visibility_off
215215
enabled: isDisplayed
216216
visible: isDisplayable
@@ -262,16 +262,16 @@ RowLayout {
262262
case "FloatParam":
263263
// We don't set a number because we want to keep the invalid expression
264264
if(attribute.keyable)
265-
_reconstruction.addAttributeKeyValue(root.attribute, _reconstruction.selectedViewId, Number(value))
265+
_currentScene.addAttributeKeyValue(root.attribute, _currentScene.selectedViewId, Number(value))
266266
else
267-
_reconstruction.setAttribute(root.attribute, Number(value))
267+
_currentScene.setAttribute(root.attribute, Number(value))
268268
updateAttributeLabel()
269269
break
270270
case "File":
271-
_reconstruction.setAttribute(root.attribute, value)
271+
_currentScene.setAttribute(root.attribute, value)
272272
break
273273
default:
274-
_reconstruction.setAttribute(root.attribute, value.trim())
274+
_currentScene.setAttribute(root.attribute, value.trim())
275275
updateAttributeLabel()
276276
break
277277
}
@@ -517,11 +517,11 @@ RowLayout {
517517
onClicked: {
518518
if (checked) {
519519
if (colorText.text == "")
520-
_reconstruction.setAttribute(attribute, "#0000FF")
520+
_currentScene.setAttribute(attribute, "#0000FF")
521521
else
522-
_reconstruction.setAttribute(attribute, colorText.text)
522+
_currentScene.setAttribute(attribute, colorText.text)
523523
} else {
524-
_reconstruction.setAttribute(attribute, "")
524+
_currentScene.setAttribute(attribute, "")
525525
}
526526
}
527527
}
@@ -583,7 +583,7 @@ RowLayout {
583583
enabled: root.editable
584584

585585
onEditingFinished: (value) => {
586-
_reconstruction.setAttribute(root.attribute, value)
586+
_currentScene.setAttribute(root.attribute, value)
587587
}
588588
}
589589
}
@@ -603,7 +603,7 @@ RowLayout {
603603
} else {
604604
currentValue.push(value);
605605
}
606-
_reconstruction.setAttribute(attribute, currentValue);
606+
_currentScene.setAttribute(attribute, currentValue);
607607
}
608608
}
609609
}
@@ -618,7 +618,7 @@ RowLayout {
618618
enabled: root.editable
619619
// Cast value to string to avoid intrusive scientific notations on numbers
620620
property string displayValue: String(slider.active && slider.item.pressed ? slider.item.formattedValue :
621-
attribute.keyable ? attribute.keyValues.getValueAtKeyOrDefault(_reconstruction.selectedViewId) :
621+
attribute.keyable ? attribute.keyValues.getValueAtKeyOrDefault(_currentScene.selectedViewId) :
622622
attribute.value)
623623
text: displayValue
624624
selectByMouse: true
@@ -667,7 +667,7 @@ RowLayout {
667667
readonly property int stepDecimalCount: stepSize < 1 ? String(stepSize).split(".").pop().length : 0
668668
readonly property real formattedValue: value.toFixed(stepDecimalCount)
669669
enabled: root.editable
670-
value: attribute.keyable ? attribute.keyValues.getValueAtKeyOrDefault(_reconstruction.selectedViewId) : attribute.value
670+
value: attribute.keyable ? attribute.keyValues.getValueAtKeyOrDefault(_currentScene.selectedViewId) : attribute.value
671671
from: attribute.desc.range[0]
672672
to: attribute.desc.range[1]
673673
stepSize: attribute.desc.range[2]
@@ -676,9 +676,9 @@ RowLayout {
676676
onPressedChanged: {
677677
if (!pressed) {
678678
if(attribute.keyable)
679-
_reconstruction.addAttributeKeyValue(attribute, _reconstruction.selectedViewId, formattedValue)
679+
_currentScene.addAttributeKeyValue(attribute, _currentScene.selectedViewId, formattedValue)
680680
else
681-
_reconstruction.setAttribute(attribute, formattedValue)
681+
_currentScene.setAttribute(attribute, formattedValue)
682682
updateAttributeLabel()
683683
}
684684
}
@@ -692,16 +692,16 @@ RowLayout {
692692
Row {
693693
CheckBox {
694694
enabled: root.editable
695-
checked: attribute.keyable ? attribute.keyValues.getValueAtKeyOrDefault(_reconstruction.selectedViewId) : attribute.value
695+
checked: attribute.keyable ? attribute.keyValues.getValueAtKeyOrDefault(_currentScene.selectedViewId) : attribute.value
696696
onToggled: {
697697
if(attribute.keyable)
698698
{
699-
const value = attribute.keyValues.getValueAtKeyOrDefault(_reconstruction.selectedViewId)
700-
_reconstruction.addAttributeKeyValue(attribute, _reconstruction.selectedViewId, !value)
699+
const value = attribute.keyValues.getValueAtKeyOrDefault(_currentScene.selectedViewId)
700+
_currentScene.addAttributeKeyValue(attribute, _currentScene.selectedViewId, !value)
701701
}
702702
else
703703
{
704-
_reconstruction.setAttribute(attribute, !attribute.value)
704+
_currentScene.setAttribute(attribute, !attribute.value)
705705
}
706706
}
707707
}
@@ -731,7 +731,7 @@ RowLayout {
731731
font.pointSize: 11
732732
padding: 2
733733
enabled: root.editable
734-
onClicked: _reconstruction.appendAttribute(attribute, undefined)
734+
onClicked: _currentScene.appendAttribute(attribute, undefined)
735735
}
736736
}
737737
ListView {
@@ -779,7 +779,7 @@ RowLayout {
779779
padding: 2
780780
ToolTip.text: "Remove Element"
781781
ToolTip.visible: hovered
782-
onClicked: _reconstruction.removeAttribute(item.childAttrib)
782+
onClicked: _currentScene.removeAttribute(item.childAttrib)
783783
}
784784
}
785785
}
@@ -860,7 +860,7 @@ RowLayout {
860860
snapMode: Slider.SnapAlways
861861
onPressedChanged: {
862862
if (!pressed)
863-
_reconstruction.setAttribute(attribute, formattedValue)
863+
_currentScene.setAttribute(attribute, formattedValue)
864864
}
865865

866866
background: ShaderEffect {
@@ -882,13 +882,13 @@ RowLayout {
882882
padding: 6
883883
text: MaterialIcons.circle
884884
checkable: true
885-
checked: attribute.keyable && attribute.keyValues.hasKey(_reconstruction.selectedViewId)
885+
checked: attribute.keyable && attribute.keyValues.hasKey(_currentScene.selectedViewId)
886886
enabled: root.editable
887887
onClicked: {
888-
if (attribute.keyValues.hasKey(_reconstruction.selectedViewId))
889-
_reconstruction.removeAttributeKey(attribute, _reconstruction.selectedViewId)
888+
if (attribute.keyValues.hasKey(_currentScene.selectedViewId))
889+
_currentScene.removeAttributeKey(attribute, _currentScene.selectedViewId)
890890
else
891-
_reconstruction.addAttributeKeyDefaultValue(attribute, _reconstruction.selectedViewId)
891+
_currentScene.addAttributeKeyDefaultValue(attribute, _currentScene.selectedViewId)
892892
}
893893
}
894894
}

meshroom/ui/qml/GraphEditor/AttributePin.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ RowLayout {
151151

152152
onDropped: function(drop) {
153153
root.edgeAboutToBeRemoved(undefined)
154-
_reconstruction.addEdge(drag.source.attribute, inputDragTarget.attribute)
154+
_currentScene.addEdge(drag.source.attribute, inputDragTarget.attribute)
155155
}
156156
}
157157

@@ -384,7 +384,7 @@ RowLayout {
384384

385385
onDropped: function(drop) {
386386
root.edgeAboutToBeRemoved(undefined)
387-
_reconstruction.addEdge(outputDragTarget.attribute, drag.source.attribute)
387+
_currentScene.addEdge(outputDragTarget.attribute, drag.source.attribute)
388388
}
389389
}
390390

meshroom/ui/qml/GraphEditor/ChunksListView.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ ColumnLayout {
9494
}
9595

9696
Connections {
97-
target: _reconstruction
97+
target: _currentScene
9898
function onSelectedChunkChanged() {
9999
for (var i = 0; i < root.chunks.count; i++) {
100-
if (_reconstruction.selectedChunk === root.chunks.at(i)) {
100+
if (_currentScene.selectedChunk === root.chunks.at(i)) {
101101
root.currentIndex = i
102102
break;
103103
}

meshroom/ui/qml/GraphEditor/NodeEditor.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ Panel {
303303
// Node shape editor
304304
Loader {
305305
id: shapeEditorLoader
306-
active: _reconstruction ?
307-
(_reconstruction.selectedNode ? _reconstruction.selectedNode.hasDisplayableShape : false) : false
306+
active: _currentScene ?
307+
(_currentScene.selectedNode ? _currentScene.selectedNode.hasDisplayableShape : false) : false
308308
sourceComponent: ShapeEditor {
309309
model: root.node.attributes
310310
filterText: searchBar.text

meshroom/ui/qml/Homepage.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Page {
264264
function onClicked() {
265265
// Open pipeline
266266
mainStack.push("Application.qml")
267-
_reconstruction.new(modelData["path"])
267+
_currentScene.new(modelData["path"])
268268
}
269269
}
270270
}
@@ -363,7 +363,7 @@ Page {
363363
else {
364364
// Open project
365365
mainStack.push("Application.qml")
366-
if (_reconstruction.load(modelData["path"])) {
366+
if (_currentScene.load(modelData["path"])) {
367367
MeshroomApp.addRecentProjectFile(modelData["path"])
368368
}
369369
}
@@ -379,7 +379,7 @@ Page {
379379
enabled: projectDelegate.fileExists
380380
text: "Open"
381381
onTriggered: {
382-
if (_reconstruction.load(modelData["path"])) {
382+
if (_currentScene.load(modelData["path"])) {
383383
mainStack.push("Application.qml")
384384
MeshroomApp.addRecentProjectFile(modelData["path"])
385385
}

meshroom/ui/qml/ImageGallery/ImageDelegate.qml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,24 @@ Item {
8787
}
8888
MenuItem {
8989
text: "Define As Center Image"
90-
property var activeNode: _reconstruction ? _reconstruction.activeNodes.get("SfMTransform").node : null
91-
enabled: !root.readOnly && _viewpoint.viewId != -1 && _reconstruction && activeNode
92-
onClicked: _reconstruction.setAttribute(activeNode.attribute("transformation"), _viewpoint.viewId.toString())
90+
property var activeNode: _currentScene ? _currentScene.activeNodes.get("SfMTransform").node : null
91+
enabled: !root.readOnly && _viewpoint.viewId != -1 && _currentScene && activeNode
92+
onClicked: _currentScene.setAttribute(activeNode.attribute("transformation"), _viewpoint.viewId.toString())
9393
}
9494
Menu {
9595
id: sfmSetPairMenu
9696
title: "SfM: Define Initial Pair"
97-
property var activeNode: _reconstruction ? _reconstruction.activeNodes.get("StructureFromMotion").node : null
98-
enabled: !root.readOnly && _viewpoint.viewId != -1 && _reconstruction && activeNode
97+
property var activeNode: _currentScene ? _currentScene.activeNodes.get("StructureFromMotion").node : null
98+
enabled: !root.readOnly && _viewpoint.viewId != -1 && _currentScene && activeNode
9999

100100
MenuItem {
101101
text: "A"
102-
onClicked: _reconstruction.setAttribute(sfmSetPairMenu.activeNode.attribute("initialPairA"), _viewpoint.viewId.toString())
102+
onClicked: _currentScene.setAttribute(sfmSetPairMenu.activeNode.attribute("initialPairA"), _viewpoint.viewId.toString())
103103
}
104104

105105
MenuItem {
106106
text: "B"
107-
onClicked: _reconstruction.setAttribute(sfmSetPairMenu.activeNode.attribute("initialPairB"), _viewpoint.viewId.toString())
107+
onClicked: _currentScene.setAttribute(sfmSetPairMenu.activeNode.attribute("initialPairB"), _viewpoint.viewId.toString())
108108
}
109109
}
110110
}

0 commit comments

Comments
 (0)