Skip to content

Commit 17cafa3

Browse files
committed
wip
1 parent e75dff5 commit 17cafa3

6 files changed

Lines changed: 33 additions & 21 deletions

File tree

meshroom/core/desc/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
InternalAttributesFactory,
4848
MrNodeType,
4949
Node,
50+
InlineNode,
5051
NodeVersionType,
5152
NodeVersionTypeEnum,
5253
)

meshroom/core/desc/node.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class MrNodeType(enum.Enum):
5757
NONE = enum.auto()
5858
BASENODE = enum.auto()
5959
NODE = enum.auto()
60+
INLINE = enum.auto()
6061
COMMANDLINE = enum.auto()
6162
INIT = enum.auto()
6263
BACKDROP = enum.auto()
@@ -527,9 +528,6 @@ class InitNode(BaseNode):
527528
def __init__(self):
528529
super(InitNode, self).__init__()
529530

530-
def getMrNodeType(self):
531-
return self._mrNodeType
532-
533531
def processChunk(self, chunk):
534532
pass
535533

@@ -586,6 +584,16 @@ def processChunkInEnvironment(self, chunk):
586584
env=runtimeEnv)
587585

588586

587+
class InlineNode(BaseNode):
588+
"""
589+
"""
590+
parallelization = None
591+
_mrNodeType: MrNodeType = MrNodeType.INLINE
592+
593+
def __init__(self):
594+
super(InlineNode, self).__init__()
595+
596+
589597
class CommandLineNode(BaseNode):
590598
"""
591599
"""

meshroom/nodes/general/FlattenFiles.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from meshroom.core import desc
44

55

6-
class FlattenFiles(desc.CommandLineNode):
6+
class FlattenFiles(desc.InlineNode):
77
"""
88
This node takes a list of lists of files as input and produces a single flat list of
99
files as output.
@@ -50,9 +50,9 @@ class FlattenFiles(desc.CommandLineNode):
5050
),
5151
]
5252

53-
def processChunk(self, chunk):
53+
def process(self, node):
5454
flatFiles = []
55-
for fileList in chunk.node.inputFiles.value:
55+
for fileList in node.inputFiles.value:
5656
for fileAttr in fileList.value:
5757
flatFiles.append(fileAttr.value)
58-
chunk.node.outputFiles.value = flatFiles
58+
node.outputFiles.value = flatFiles

meshroom/nodes/general/GetFileExtension.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from meshroom.core import desc
55

66

7-
class GetFileExtension(desc.CommandLineNode):
7+
class GetFileExtension(desc.InlineNode):
88
inputs = [
99
desc.File(
1010
name="path",
@@ -20,5 +20,8 @@ class GetFileExtension(desc.CommandLineNode):
2020
),
2121
]
2222

23-
def processChunk(self, chunk):
24-
chunk.node.extension.value = os.path.splitext(chunk.node.path.value)[1]
23+
def process(self, node):
24+
if not node.path.value:
25+
node.extension.value = ""
26+
else:
27+
node.extension.value = os.path.splitext(node.path.value)[1]

meshroom/nodes/general/GetParentFolder.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from meshroom.core import desc
66

77

8-
class GetParentFolder(desc.CommandLineNode):
8+
class GetParentFolder(desc.InlineNode):
99
""" Get the parent folder """
1010

1111
category = "Other"
@@ -29,14 +29,14 @@ class GetParentFolder(desc.CommandLineNode):
2929
)
3030
]
3131

32-
def processChunk(self, chunk):
33-
chunk.node.folder.value = ""
34-
path = chunk.node.file.value
32+
def process(self, node):
33+
node.folder.value = ""
34+
path = node.file.value
3535
if not path:
3636
return
3737
# Additional security but it's supposedly handeled by the validator
3838
path = os.path.normpath(path)
3939
parent = os.path.dirname(path)
4040
if not os.path.exists(parent):
4141
logging.warning(f"Parent path {parent} does not exist")
42-
chunk.node.folder.value = parent
42+
node.folder.value = parent

meshroom/nodes/general/PathJoin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from meshroom.core import desc
55

66

7-
class PathJoin(desc.CommandLineNode):
7+
class PathJoin(desc.InlineNode):
88
""" Join multiple paths """
99

1010
category = "Other"
@@ -34,15 +34,15 @@ class PathJoin(desc.CommandLineNode):
3434
)
3535
]
3636

37-
def processChunk(self, chunk):
37+
def process(self, node):
3838
parts = []
39-
for item in chunk.node.paths.value:
39+
for item in node.paths.value:
4040
path = item.value
4141
if path:
4242
parts.append(path)
4343
if parts:
4444
outputPath = os.path.join(*parts)
45-
if not chunk.node.checkIfExists.value or os.path.exists(outputPath):
46-
chunk.node.outputPath.value = str(outputPath)
45+
if not node.checkIfExists.value or os.path.exists(outputPath):
46+
node.outputPath.value = str(outputPath)
4747
return
48-
chunk.node.folder.value = ""
48+
node.folder.value = ""

0 commit comments

Comments
 (0)