Skip to content

Commit bb9df08

Browse files
authored
Merge pull request #2697 from alicevision/dev/addAVNodes
Move nodes and templates to AliceVision's repository
2 parents 09720f6 + c3e8b88 commit bb9df08

File tree

122 files changed

+342
-18966
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+342
-18966
lines changed

meshroom/core/__init__.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,11 @@ def initSubmitters():
347347

348348
def initPipelines():
349349
meshroomFolder = os.path.dirname(os.path.dirname(__file__))
350-
# Load pipeline templates: check in the default folder and any folder the user might have
351-
# added to the environment variable
352-
additionalPipelinesPath = os.environ.get("MESHROOM_PIPELINE_TEMPLATES_PATH", "").split(os.pathsep)
353-
additionalPipelinesPath = [i for i in additionalPipelinesPath if i]
354-
pipelineTemplatesFolders = [os.path.join(meshroomFolder, 'pipelines')] + additionalPipelinesPath
350+
# Load pipeline templates: check in any folder the user might have added to the environment variable
351+
pipelinesPath = os.environ.get("MESHROOM_PIPELINE_TEMPLATES_PATH", "").split(os.pathsep)
352+
pipelineTemplatesFolders = [i for i in pipelinesPath if i]
355353
for f in pipelineTemplatesFolders:
356354
if os.path.isdir(f):
357355
loadPipelineTemplates(f)
358356
else:
359-
logging.error("Pipeline templates folder '{}' does not exist.".format(f))
357+
logging.warning("Pipeline templates folder '{}' does not exist.".format(f))
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,36 @@
11
#!/usr/bin/env python
22
# coding:utf-8
33

4-
from meshroom.core.graph import Graph
5-
from meshroom.core import pipelineTemplates, Version
4+
from meshroom.core import unregisterNodeType, pipelineTemplates, Version
65
from meshroom.core.node import CompatibilityIssue, CompatibilityNode
76
from meshroom.core.graphIO import GraphIO
87

9-
import json
108
import meshroom
119

10+
import json
1211

13-
def test_templateVersions():
14-
"""
15-
This test checks that there is no compatibility issue with the nodes saved in the template files.
16-
It fails when an upgrade of a templates is needed. Any template can still be opened even if its
17-
nodes are not up-to-date, as they will be automatically upgraded.
18-
"""
19-
meshroom.core.initNodes()
20-
meshroom.core.initPipelines()
21-
22-
assert len(pipelineTemplates) >= 1
12+
def checkTemplateVersions(path: str, nodesAlreadyLoaded: bool = False) -> bool:
13+
""" Check whether there is a compatibility issue with the nodes saved in the template provided with "path". """
14+
if not nodesAlreadyLoaded:
15+
meshroom.core.initNodes()
2316

24-
for _, path in pipelineTemplates.items():
25-
with open(path) as jsonFile:
26-
fileData = json.load(jsonFile)
17+
with open(path) as jsonFile:
18+
fileData = json.load(jsonFile)
2719

20+
try:
2821
graphData = fileData.get(GraphIO.Keys.Graph, fileData)
29-
30-
assert isinstance(graphData, dict)
22+
if not isinstance(graphData, dict):
23+
return False
3124

3225
header = fileData.get(GraphIO.Keys.Header, {})
33-
assert header.get("template", False)
26+
if not header.get("template", False):
27+
return False
3428
nodesVersions = header.get(GraphIO.Keys.NodesVersions, {})
3529

3630
for _, nodeData in graphData.items():
3731
nodeType = nodeData["nodeType"]
38-
assert nodeType in meshroom.core.nodesDesc
32+
if not nodeType in meshroom.core.nodesDesc:
33+
return False
3934

4035
nodeDesc = meshroom.core.nodesDesc[nodeType]
4136
currentNodeVersion = meshroom.core.nodeVersion(nodeDesc)
@@ -58,4 +53,25 @@ def test_templateVersions():
5853
compatibilityIssue = CompatibilityIssue.DescriptionConflict
5954
break
6055

61-
assert compatibilityIssue is None, "{} in {} for node {}".format(compatibilityIssue, path, nodeType)
56+
if compatibilityIssue is not None:
57+
print("{} in {} for node {}".format(compatibilityIssue, path, nodeType))
58+
return False
59+
60+
return True
61+
62+
finally:
63+
if not nodesAlreadyLoaded:
64+
nodeTypes = [nodeType for _, nodeType in meshroom.core.nodesDesc.items()]
65+
for nodeType in nodeTypes:
66+
unregisterNodeType(nodeType)
67+
68+
69+
def checkAllTemplatesVersions() -> bool:
70+
meshroom.core.initNodes()
71+
meshroom.core.initPipelines()
72+
73+
validVersions = []
74+
for _, path in pipelineTemplates.items():
75+
validVersions.append(checkTemplateVersions(path, nodesAlreadyLoaded=True))
76+
77+
return all(validVersions)

meshroom/nodes/aliceVision/ApplyCalibration.py

-49
This file was deleted.

meshroom/nodes/aliceVision/CameraCalibration.py

-129
This file was deleted.

0 commit comments

Comments
 (0)