mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-13 06:47:26 +02:00
[core] plugins: Move validateNodeDesc
from __init__.py to plugins.py
The validation of the node descriptions will be handled directly within the `NodePlugin` objects and there is thus no need for this method to exist outside of plugins.py.
This commit is contained in:
parent
1531e11b83
commit
fa3cb8c4d6
2 changed files with 35 additions and 35 deletions
|
@ -8,6 +8,40 @@ from pathlib import Path
|
|||
from meshroom.common import BaseObject
|
||||
from meshroom.core import desc
|
||||
|
||||
def validateNodeDesc(nodeDesc: desc.Node) -> list:
|
||||
"""
|
||||
Check that the node has a valid description before being loaded. For the description
|
||||
to be valid, the default value of every parameter needs to correspond to the type
|
||||
of the parameter.
|
||||
An empty returned list means that every parameter is valid, and so is the node's description.
|
||||
If it is not valid, the returned list contains the names of the invalid parameters. In case
|
||||
of nested parameters (parameters in groups or lists, for example), the name of the parameter
|
||||
follows the name of the parent attributes. For example, if the attribute "x", contained in group
|
||||
"group", is invalid, then it will be added to the list as "group:x".
|
||||
|
||||
Args:
|
||||
nodeDesc: description of the node.
|
||||
|
||||
Returns:
|
||||
errors: the list of invalid parameters if there are any, empty list otherwise
|
||||
"""
|
||||
errors = []
|
||||
|
||||
for param in nodeDesc.inputs:
|
||||
err = param.checkValueTypes()
|
||||
if err:
|
||||
errors.append(err)
|
||||
|
||||
for param in nodeDesc.outputs:
|
||||
if param.value is None:
|
||||
continue
|
||||
err = param.checkValueTypes()
|
||||
if err:
|
||||
errors.append(err)
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
class ProcessEnv(BaseObject):
|
||||
"""
|
||||
Describes the environment required by a node's process.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue