Skip to content
Open
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
1 change: 1 addition & 0 deletions meshroom/core/desc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
InternalAttributesFactory,
MrNodeType,
Node,
InlineNode,
NodeVersionType,
NodeVersionTypeEnum,
)
15 changes: 12 additions & 3 deletions meshroom/core/desc/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class MrNodeType(enum.Enum):
NONE = enum.auto()
BASENODE = enum.auto()
NODE = enum.auto()
INLINE = enum.auto()
COMMANDLINE = enum.auto()
INIT = enum.auto()
BACKDROP = enum.auto()
Expand Down Expand Up @@ -527,9 +528,6 @@ class InitNode(BaseNode):
def __init__(self):
super(InitNode, self).__init__()

def getMrNodeType(self):
return self._mrNodeType

def processChunk(self, chunk):
pass

Expand Down Expand Up @@ -586,6 +584,17 @@ def processChunkInEnvironment(self, chunk):
env=runtimeEnv)


class InlineNode(BaseNode):
"""
Node that can be computed in the current Meshroom environment.
"""
parallelization = None
_mrNodeType: MrNodeType = MrNodeType.INLINE

def __init__(self):
super(InlineNode, self).__init__()


class CommandLineNode(BaseNode):
"""
"""
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/general/FlattenFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from meshroom.core import desc


class FlattenFiles(desc.Node):
class FlattenFiles(desc.InlineNode):
"""
This node takes a list of lists of files as input and produces a single flat list of
files as output.
Expand Down
27 changes: 27 additions & 0 deletions meshroom/nodes/general/GetFileExtension.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
__version__ = "1.0"

import os
from meshroom.core import desc


class GetFileExtension(desc.InlineNode):
inputs = [
desc.File(
name="path",
value="",
exposed=True,
),
]

outputs = [
desc.StringParam(
name="extension",
value=None,
),
]

def process(self, node):
if not node.path.value:
node.extension.value = ""
else:
node.extension.value = os.path.splitext(node.path.value)[1]
2 changes: 1 addition & 1 deletion meshroom/nodes/general/GetParentFolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from meshroom.core import desc


class GetParentFolder(desc.Node):
class GetParentFolder(desc.InlineNode):
""" Get the parent folder """

category = "Other"
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/general/PathJoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from meshroom.core import desc


class PathJoin(desc.Node):
class PathJoin(desc.InlineNode):
""" Join multiple paths """

category = "Other"
Expand Down
6 changes: 3 additions & 3 deletions meshroom/nodes/general/UnwrapMeshroomSceneParam.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from meshroom.core import desc


class UnwrapMeshroomSceneParam(desc.CommandLineNode):
class UnwrapMeshroomSceneParam(desc.InlineNode):
"""Unwrap the JSON file created by a GetMeshroomSceneParams node
to expose its items to the graph.

Expand Down Expand Up @@ -96,5 +96,5 @@ def update(self, node):
except Exception as e:
logging.warning(f"[UnwrapMeshroomSceneParam] Failed to set the choices: {e}")

def processChunk(self, chunk):
self.setOutput(chunk.node)
def process(self, node):
self.setOutput(node)
Loading