Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions meshroom/core/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
super(Graph, self).__init__(parent)
self.name = name
self._loading = False
self._saving = False
self._updateEnabled = True
self._updateRequested = False
self.dirtyTopology = False
Expand Down Expand Up @@ -251,6 +252,11 @@
def isLoading(self):
""" Return True if the graph is currently being loaded. """
return self._loading

@property
def isSaving(self):
""" Return True if the graph is currently being saved. """
return self._saving

Check warning on line 259 in meshroom/core/graph.py

View check run for this annotation

Codecov / codecov/patch

meshroom/core/graph.py#L259

Added line #L259 was not covered by tests

@Slot(str)
def load(self, filepath, setupProjectFile=True, importProject=False, publishOutputs=False):
Expand Down Expand Up @@ -1347,6 +1353,23 @@
return str(self.toDict())

def save(self, filepath=None, setupProjectFile=True, template=False):
"""
Save the current Meshroom graph as a serialized ".mg" file.

Args:
filepath: project filepath to save as.
setupProjectFile: Store the reference to the project file and setup the cache directory.
If false, it only saves the graph of the project file as a template.
template: If true, saves the current graph as a template.
"""
# Update the saving flag indicating that the current graph is being saved
self._saving = True
try:
self._save(filepath=filepath, setupProjectFile=setupProjectFile, template=template)
finally:
self._saving = False

def _save(self, filepath=None, setupProjectFile=True, template=False):
path = filepath or self._filepath
if not path:
raise ValueError("filepath must be specified for unsaved files.")
Expand Down Expand Up @@ -1636,6 +1659,7 @@
edges = Property(BaseObject, edges.fget, constant=True)
filepathChanged = Signal()
filepath = Property(str, lambda self: self._filepath, notify=filepathChanged)
isSaving = Property(bool, isSaving.fget, constant=True)
fileReleaseVersion = Property(str, lambda self: self.header.get(Graph.IO.Keys.ReleaseVersion, "0.0"),
notify=filepathChanged)
fileDateVersion = Property(float, fileDateVersion.fget, fileDateVersion.fset, notify=filepathChanged)
Expand Down
10 changes: 10 additions & 0 deletions meshroom/ui/qml/Application.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ Page {
property alias unsavedDialog: unsavedDialog
property alias workspaceView: workspaceView

readonly property var scenefile: _reconstruction ? _reconstruction.graph.filepath : "";

onScenefileChanged: {
// Check if we're not currently saving and emit the currentProjectChanged signal
if (! _reconstruction.graph.isSaving) {
// Refresh the NodeEditor
nodeEditor.refresh();
}
}

Settings {
id: settingsUILayout
category: "UILayout"
Expand Down
19 changes: 16 additions & 3 deletions meshroom/ui/qml/GraphEditor/NodeEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ Panel {
}
}

function refresh() {
/**
* Refresh properties of the Node Editor.
*/
// Reset tab bar's current index
tabBar.currentIndex = 0;
}

headerBar: RowLayout {
Label {
id: computationInfo
Expand Down Expand Up @@ -372,6 +380,9 @@ Panel {

property bool isComputable: root.node !== null && root.node.isComputable

// The indices of the tab bar which can be shown for incomputable nodes
readonly property var nonComputableTabIndices: [0, 4, 5];

Layout.fillWidth: true
width: childrenRect.width
position: TabBar.Footer
Expand Down Expand Up @@ -415,9 +426,11 @@ Panel {
rightPadding: leftPadding
}

onIsComputableChanged: {
if (!isComputable) {
tabBar.currentIndex = 0
onVisibleChanged: {
// If we have a node selected and the node is not Computable
// Reset the currentIndex to 0, if the current index is not allowed for an incomputable node
if ((root.node && !root.node.isComputable) && (nonComputableTabIndices.indexOf(tabBar.currentIndex) === -1)) {
tabBar.currentIndex = 0;
}
}
}
Expand Down
Loading
Loading