mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-01 11:17:53 +02:00
[core] graph: variable rename
This commit is contained in:
parent
06543f89a9
commit
a53940d29f
3 changed files with 13 additions and 13 deletions
|
@ -234,14 +234,14 @@ class Graph(BaseObject):
|
||||||
return Graph.IO.getFeaturesForVersion(self.header.get(Graph.IO.Keys.FileVersion, "0.0"))
|
return Graph.IO.getFeaturesForVersion(self.header.get(Graph.IO.Keys.FileVersion, "0.0"))
|
||||||
|
|
||||||
@Slot(str)
|
@Slot(str)
|
||||||
def load(self, filepath, setupFileRef=True):
|
def load(self, filepath, setupProjectFile=True):
|
||||||
"""
|
"""
|
||||||
Load a meshroom graph ".mg" file.
|
Load a meshroom graph ".mg" file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
filepath: project filepath to load
|
filepath: project filepath to load
|
||||||
setupFileRef: Setup reference to the project file, like setup cacheDir, keep filepath for save, etc.
|
setupProjectFile: Store the reference to the project file and setup the cache directory.
|
||||||
This option allows to disable it, to only load the project file as a template.
|
If false, it only loads the graph of the project file as a template.
|
||||||
"""
|
"""
|
||||||
self.clear()
|
self.clear()
|
||||||
with open(filepath) as jsonFile:
|
with open(filepath) as jsonFile:
|
||||||
|
@ -273,7 +273,7 @@ class Graph(BaseObject):
|
||||||
# Add node to the graph with raw attributes values
|
# Add node to the graph with raw attributes values
|
||||||
self._addNode(n, nodeName)
|
self._addNode(n, nodeName)
|
||||||
|
|
||||||
if setupFileRef:
|
if setupProjectFile:
|
||||||
# Update filepath related members
|
# Update filepath related members
|
||||||
self._setFilepath(filepath)
|
self._setFilepath(filepath)
|
||||||
|
|
||||||
|
@ -905,7 +905,7 @@ class Graph(BaseObject):
|
||||||
def asString(self):
|
def asString(self):
|
||||||
return str(self.toDict())
|
return str(self.toDict())
|
||||||
|
|
||||||
def save(self, filepath=None, setupFileRef=True):
|
def save(self, filepath=None, setupProjectFile=True):
|
||||||
path = filepath or self._filepath
|
path = filepath or self._filepath
|
||||||
if not path:
|
if not path:
|
||||||
raise ValueError("filepath must be specified for unsaved files.")
|
raise ValueError("filepath must be specified for unsaved files.")
|
||||||
|
@ -929,7 +929,7 @@ class Graph(BaseObject):
|
||||||
with open(path, 'w') as jsonFile:
|
with open(path, 'w') as jsonFile:
|
||||||
json.dump(data, jsonFile, indent=4)
|
json.dump(data, jsonFile, indent=4)
|
||||||
|
|
||||||
if path != self._filepath and setupFileRef:
|
if path != self._filepath and setupProjectFile:
|
||||||
self._setFilepath(path)
|
self._setFilepath(path)
|
||||||
|
|
||||||
def _setFilepath(self, filepath):
|
def _setFilepath(self, filepath):
|
||||||
|
|
|
@ -313,11 +313,11 @@ class UIGraph(QObject):
|
||||||
|
|
||||||
def setDefaultPipeline(self, pipelineFilepath):
|
def setDefaultPipeline(self, pipelineFilepath):
|
||||||
self._defaultPipelineFilepath = pipelineFilepath
|
self._defaultPipelineFilepath = pipelineFilepath
|
||||||
self._graph.load(pipelineFilepath, setupFileRef=False)
|
self._graph.load(pipelineFilepath, setupProjectFile=False)
|
||||||
|
|
||||||
def load(self, filepath, setupFileRef=True):
|
def load(self, filepath, setupProjectFile=True):
|
||||||
g = Graph('')
|
g = Graph('')
|
||||||
g.load(filepath, setupFileRef)
|
g.load(filepath, setupProjectFile)
|
||||||
if not os.path.exists(g.cacheDir):
|
if not os.path.exists(g.cacheDir):
|
||||||
os.mkdir(g.cacheDir)
|
os.mkdir(g.cacheDir)
|
||||||
self.setGraph(g)
|
self.setGraph(g)
|
||||||
|
|
|
@ -197,14 +197,14 @@ class Reconstruction(UIGraph):
|
||||||
""" Create a new photogrammetry pipeline. """
|
""" Create a new photogrammetry pipeline. """
|
||||||
if self._defaultPipelineFilepath:
|
if self._defaultPipelineFilepath:
|
||||||
# use the user-provided default photogrammetry project file
|
# use the user-provided default photogrammetry project file
|
||||||
self.load(self._defaultPipelineFilepath, setupFileRef=False)
|
self.load(self._defaultPipelineFilepath, setupProjectFile=False)
|
||||||
else:
|
else:
|
||||||
# default photogrammetry pipeline
|
# default photogrammetry pipeline
|
||||||
self.setGraph(multiview.photogrammetry())
|
self.setGraph(multiview.photogrammetry())
|
||||||
|
|
||||||
def load(self, filepath, setupFileRef=True):
|
def load(self, filepath, setupProjectFile=True):
|
||||||
try:
|
try:
|
||||||
super(Reconstruction, self).load(filepath, setupFileRef)
|
super(Reconstruction, self).load(filepath, setupProjectFile)
|
||||||
# warn about pre-release projects being automatically upgraded
|
# warn about pre-release projects being automatically upgraded
|
||||||
if Version(self._graph.fileReleaseVersion).major == "0":
|
if Version(self._graph.fileReleaseVersion).major == "0":
|
||||||
self.warning.emit(Message(
|
self.warning.emit(Message(
|
||||||
|
|
Loading…
Add table
Reference in a new issue