* API
Instead of having a single `load` function that exposes in its API
some elements only applicable to initializing a graph from a templates,
split it into 2 distinct functions: `load` and `initFromTemplate`.
Apply those changes to users of the API (UI, CLI), and simplify Graph
wrapper classes to better align with those concepts.
* Deserialization
Reduce the cognitive complexity of the deserizalization process
by splitting it into more atomic functions, while maintaining the
current behavior.
`invalidate` does not need to be specified anymore and is set to `True`
by default. Output attributes with `invalidate=True` are handled at the
attribute-level.
Up to this commit, `meshroom_batch` only supported absolute input and
output paths: using relative ones led to a failure during the execution
of the `CameraInit` node.
Now, if relative paths are provided by the user, they are automatically
converted to absolute ones, thus ensuring that everything will run
smoothly.
If the "save" argument has been provided, the graph should be saved
outside of the `GraphModificatioǹ event, once it has been set up entirely
and resolved.
When it is saved within the `GraphModification`, UIDs are not yet
available.
This does not cause any issue for the rest of the execution if the graph
is to be computed locally, since the UIDs will be computed right
after (but the UIDs will still never be written in the project file).
However, when submitting the graph to a renderfarm, the project file is
loaded again. If it does not contain any UID:
- all the nodes will present the `UidConflict` compatibility issue
- key errors will be raised when trying to apply the links between nodes
since they contain direct references to UIDs, which cannot be resolved as
they are not present in the project file.
- `meshroom_submit`: the submission to the render farm is now effective
(the script did not work at all).
- `meshroom_status`: the `--toNode` option did not work and caused errors.
- `meshroom_statistics`: some adjustments needed to be made for the script
to run with Python3 instead of Python2, an issue in the core/stats.py file
led the `statistics` file to never being read correctly, and the calls
to the Matplotlib API were outdated.
This commit adds an option to the "load" method, "publishOutputs", that
determines whether "Publish" nodes in a template project file should be
ignored during the graph's creation.
If "publishOutputs=True", then the "Publish" nodes from the template will
be added to the graph. "Publish" nodes in a project file that is not
a template will not be affected by this and will always be added to the
graph, as any other node.
This allows to have templates that are compatible with meshroom_batch,
which requires a "Publish" node when the --output option is specified,
while not having unneeded nodes in the UI or unneeded operations:
when --output is specified in meshroom_batch, "publishOutputs=True",
otherwise it will be set to False so that the "Publish" nodes are not
executed needlessly.
In particular:
- In common/, remove the backport of weakref.WeakMethod
- In docs/ and ui/, use the standard FileNotFoundError class
- Use built-in open() instead of io.open(), and stop importing io
- In core/stats.py, use the standard implementation of xml.etree instead
of the C one
InitNode is an abstract class which is meant to be inherited
by all the initialization nodes (such as CameraInit), included
those that might be created by the user.
InitNode contains methods that can be reimplemented by the
children classes if necessary.
This abstract class allows to keep on using scripts such as
meshroom_batch without having to modify them specifically or
being limited to using a CameraInit node.
- Support loading external pipelines as templates with project files
- Add template files for some standard pipelines
- Remove the hard-coded generation of new pipelines
- Update multiviewPipeline test: the multiviewPipeline test relied on the hard-coded generation of
pipelines.