diff --git a/meshroom/core/__init__.py b/meshroom/core/__init__.py index e40d5d4e..08b13cc7 100644 --- a/meshroom/core/__init__.py +++ b/meshroom/core/__init__.py @@ -257,7 +257,8 @@ class Version: status = '' # If there is a status, it is placed after a "-" splitComponents = versionName.split("-", maxsplit=1) - if (len(splitComponents) > 1): # If there is no status, splitComponents is equal to [versionName] + # If there is no status, splitComponents is equal to [versionName] + if len(splitComponents) > 1: status = splitComponents[-1] return tuple([int(v) for v in splitComponents[0].split(".")]), status @@ -354,6 +355,7 @@ def loadPluginFolder(folder): pluginManager.addPlugin(plugin) pluginManager.registerPlugin(plugin.name) pipelineTemplates.update(plugin.templates) + return plugins @@ -404,7 +406,7 @@ def initSubmitters(): additionalPaths = EnvVar.getList(EnvVar.MESHROOM_SUBMITTERS_PATH) allSubmittersFolders = [meshroomFolder] + additionalPaths for folder in allSubmittersFolders: - subs = loadSubmitters(folder, 'submitters') + subs = loadSubmitters(folder, "submitters") for sub in subs: registerSubmitter(sub()) @@ -413,7 +415,7 @@ def initPipelines(): # Load pipeline templates: check in the default folder and any folder the user might have # added to the environment variable additionalPipelinesPath = EnvVar.getList(EnvVar.MESHROOM_PIPELINE_TEMPLATES_PATH) - pipelineTemplatesFolders = [os.path.join(meshroomFolder, 'pipelines')] + additionalPipelinesPath + pipelineTemplatesFolders = [os.path.join(meshroomFolder, "pipelines")] + additionalPipelinesPath for f in pipelineTemplatesFolders: loadPipelineTemplates(f) for plugin in pluginManager.getPlugins().values(): @@ -422,6 +424,6 @@ def initPipelines(): def initPlugins(): additionalpluginsPath = EnvVar.getList(EnvVar.MESHROOM_PLUGINS_PATH) - nodesFolders = [os.path.join(meshroomFolder, 'plugins')] + additionalpluginsPath + nodesFolders = [os.path.join(meshroomFolder, "plugins")] + additionalpluginsPath for f in nodesFolders: loadPluginFolder(folder=f) diff --git a/meshroom/core/desc/node.py b/meshroom/core/desc/node.py index 5c663e01..4d940c75 100644 --- a/meshroom/core/desc/node.py +++ b/meshroom/core/desc/node.py @@ -39,8 +39,10 @@ class BaseNode(object): name="invalidation", label="Invalidation Message", description="A message that will invalidate the node's output folder.\n" - "This is useful for development, we can invalidate the output of the node when we modify the code.\n" - "It is displayed in bold font in the invalidation/comment messages tooltip.", + "This is useful for development, we can invalidate the output of the node " + "when we modify the code.\n" + "It is displayed in bold font in the invalidation/comment messages " + "tooltip.", value="", semantic="multiline", advanced=True, @@ -50,7 +52,8 @@ class BaseNode(object): name="comment", label="Comments", description="User comments describing this specific node instance.\n" - "It is displayed in regular font in the invalidation/comment messages tooltip.", + "It is displayed in regular font in the invalidation/comment messages " + "tooltip.", value="", semantic="multiline", invalidate=False, @@ -58,7 +61,8 @@ class BaseNode(object): StringParam( name="label", label="Node's Label", - description="Customize the default label (to replace the technical name of the node instance).", + description="Customize the default label (to replace the technical name of the node " + "instance).", value="", invalidate=False, ), diff --git a/meshroom/core/nodeFactory.py b/meshroom/core/nodeFactory.py index c3b74b37..1b3e678f 100644 --- a/meshroom/core/nodeFactory.py +++ b/meshroom/core/nodeFactory.py @@ -123,13 +123,14 @@ class _NodeCreator: def _checkAttributesAreCompatibleWithDescription(self) -> bool: return ( self._checkAttributesCompatibility(self.nodeDesc.inputs, self.inputs) - and self._checkAttributesCompatibility(self.nodeDesc.internalInputs, self.internalInputs) + and self._checkAttributesCompatibility(self.nodeDesc.internalInputs, + self.internalInputs) and self._checkAttributesCompatibility(self.nodeDesc.outputs, self.outputs) ) def _checkInputAttributesNames(self) -> bool: def serializedInput(attr: desc.Attribute) -> bool: - """Filter that excludes not-serialized desc input attributes.""" + """ Filter that excludes not-serialized desc input attributes. """ if isinstance(attr, desc.PushButtonParam): # PushButtonParam are not serialized has they do not hold a value. return False @@ -140,7 +141,7 @@ class _NodeCreator: def _checkOutputAttributesNames(self) -> bool: def serializedOutput(attr: desc.Attribute) -> bool: - """Filter that excludes not-serialized desc output attributes.""" + """ Filter that excludes not-serialized desc output attributes. """ if attr.isDynamicValue: # Dynamic outputs values are not serialized with the node, # as their value is written in the computed output data. diff --git a/meshroom/ui/reconstruction.py b/meshroom/ui/reconstruction.py index d35a38f0..7e61a07e 100755 --- a/meshroom/ui/reconstruction.py +++ b/meshroom/ui/reconstruction.py @@ -736,14 +736,16 @@ class Reconstruction(UIGraph): """ if not startNode: return None - nodes = self._graph.dfsOnDiscover(startNodes=[startNode], filterTypes=nodeTypes, reverse=True)[0] + nodes = self._graph.dfsOnDiscover(startNodes=[startNode], + filterTypes=nodeTypes, reverse=True)[0] if not nodes: return None # order the nodes according to their depth in the graph, then according to their name nodes.sort(key=lambda n: (n.depth, n.name)) node = nodes[-1] if preferredStatus: - node = next((n for n in reversed(nodes) if n.getGlobalStatus() == preferredStatus), node) + node = next((n for n in reversed(nodes) + if n.getGlobalStatus() == preferredStatus), node) return node def addSfmAugmentation(self, withMVS=False): @@ -800,7 +802,8 @@ class Reconstruction(UIGraph): This method allows to reduce process time by doing it on Python side. Args: - {images, videos, panoramaInfo, meshroomScenes, otherFiles}: Map containing the lists of paths for recognized images, videos, Meshroom scenes and other files. + {images, videos, panoramaInfo, meshroomScenes, otherFiles}: Map containing the + lists of paths for recognized images, videos, Meshroom scenes and other files. Node: cameraInit node used to add new images to it QPoint: position to locate the node (usually the mouse position) """ @@ -821,7 +824,8 @@ class Reconstruction(UIGraph): else: p = position cameraInit = self.addNewNode("CameraInit", position=p) - self._workerThreads.apply_async(func=self.importImagesSync, args=(filesByType["images"], cameraInit,)) + self._workerThreads.apply_async(func=self.importImagesSync, + args=(filesByType["images"], cameraInit,)) if filesByType["videos"]: if self.nodes: boundingBox = self.layout.boundingBox() @@ -840,7 +844,8 @@ class Reconstruction(UIGraph): newVideoNodeMessage, "Warning: You need to manually compute the KeyframeSelection node \n" "and then reimport the created images into Meshroom for the reconstruction.\n\n" - "If you know the Camera Make/Model, it is highly recommended to declare them in the Node." + "If you know the Camera Make/Model, it is highly recommended to declare " + "them in the Node." )) if filesByType["panoramaInfo"]: @@ -848,15 +853,15 @@ class Reconstruction(UIGraph): self.error.emit( Message( "Multiple XML files in input", - "Ignore the xml Panorama files:\n\n'{}'.".format(',\n'.join(filesByType["panoramaInfo"])), + "Ignore the XML Panorama files:\n\n'{}'.".format(',\n'.join(filesByType["panoramaInfo"])), "", )) else: - panoramaInitNodes = self.graph.nodesOfType('PanoramaInit') + panoramaInitNodes = self.graph.nodesOfType("PanoramaInit") for panoramaInfoFile in filesByType["panoramaInfo"]: for panoramaInitNode in panoramaInitNodes: - panoramaInitNode.attribute('initializeCameras').value = 'File' - panoramaInitNode.attribute('config').value = panoramaInfoFile + panoramaInitNode.attribute("initializeCameras").value = "File" + panoramaInitNode.attribute("config").value = panoramaInfoFile if panoramaInitNodes: self.info.emit( Message( @@ -918,7 +923,11 @@ class Reconstruction(UIGraph): filesByType.extend(multiview.findFilesByTypeInFolder(localFile)) else: filesByType.addFile(localFile) - return {"images": filesByType.images, "videos": filesByType.videos, "panoramaInfo": filesByType.panoramaInfo, "meshroomScenes": filesByType.meshroomScenes, "other": filesByType.other} + return {"images": filesByType.images, + "videos": filesByType.videos, + "panoramaInfo": filesByType.panoramaInfo, + "meshroomScenes": filesByType.meshroomScenes, + "other": filesByType.other} def importImagesFromFolder(self, path, recursive=False): """