mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-03 11:21:52 +02:00
Merge pull request #2440 from alicevision/dev/sortToSave
File export ordering
This commit is contained in:
commit
154babbf5c
14 changed files with 1478 additions and 1471 deletions
|
@ -1291,7 +1291,9 @@ class Graph(BaseObject):
|
|||
node._applyExpr()
|
||||
|
||||
def toDict(self):
|
||||
return {k: node.toDict() for k, node in self._nodes.objects.items()}
|
||||
nodes = {k: node.toDict() for k, node in self._nodes.objects.items()}
|
||||
nodes = dict(sorted(nodes.items()))
|
||||
return nodes
|
||||
|
||||
@Slot(result=str)
|
||||
def asString(self):
|
||||
|
@ -1305,14 +1307,18 @@ class Graph(BaseObject):
|
|||
self.header[Graph.IO.Keys.ReleaseVersion] = meshroom.__version__
|
||||
self.header[Graph.IO.Keys.FileVersion] = Graph.IO.__version__
|
||||
|
||||
# store versions of node types present in the graph (excluding CompatibilityNode instances)
|
||||
# Store versions of node types present in the graph (excluding CompatibilityNode instances)
|
||||
# and remove duplicates
|
||||
usedNodeTypes = set([n.nodeDesc.__class__ for n in self._nodes if isinstance(n, Node)])
|
||||
|
||||
self.header[Graph.IO.Keys.NodesVersions] = {
|
||||
# Convert to node types to "name: version"
|
||||
nodesVersions = {
|
||||
"{}".format(p.__name__): meshroom.core.nodeVersion(p, "0.0")
|
||||
for p in usedNodeTypes
|
||||
}
|
||||
|
||||
# Sort them by name (to avoid random order changing from one save to another)
|
||||
nodesVersions = dict(sorted(nodesVersions.items()))
|
||||
# Add it the header
|
||||
self.header[Graph.IO.Keys.NodesVersions] = nodesVersions
|
||||
self.header["template"] = template
|
||||
|
||||
data = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue