Skip to content

Create a new node subtype to allow execution directly in Meshroom environment #3166

Description

@Alxiice

if not inCurrentEnv and self.node.getMrNodeType() == MrNodeType.NODE:
self._processInIsolatedEnvironment()
return

Because of this when we launch graph execution, any node based on desc.Node will execute in a subprocess.

On several occasions this isn't necessary, for example for nodes that will do a simple file lookup and don't require a specific environment. There is a workaround which is using desc.CommandLineNode with the processChunk method:

import os
from meshroom.core import desc

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

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

    def processChunk(self, chunk):
        chunk.node.extension.value = os.path.splitext(chunk.node.path.value)[1]

Comparison:

mode time
desc.Node 4.8s
desc.CommandLineNode 0.02s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions