[core] introduce CompatibilityNode for improved scene compatibilities

Improve node serialization/deserialization to be able to recreate the exact same node in the graph when loading a meshroom project, even if the corresponding node's description has changed or does not exist anymore. This allows to recover already computed data on disk, without being impacted by changed uids. CompatibilityNode also provides an on-demand upgrade system to turn into a Node that meets the current node description (if possible).
 
* new abstract class BaseNode, base class for Node and CompatibiliyNode 
* Node: serialize everything needed to spawn a CompatibilityNode with precomputed outputs: inputs, uids, parallelization settings, unresolved internal folders and outputs
* node_factory: handles node deserialization and compatibility issues to create either a Node or a CompatibilityNode
* add compatibility unit tests
This commit is contained in:
Yann Lanthony 2018-07-15 13:13:44 +02:00
parent b6cbb0cc63
commit 33eb7f3a7f
6 changed files with 458 additions and 101 deletions

View file

@ -16,7 +16,15 @@ class UnknownNodeTypeError(GraphException):
"""
Raised when asked to create a unknown node type.
"""
def __init__(self, nodeType):
def __init__(self, nodeType, msg=None):
msg = "Unknown Node Type: " + nodeType
super(UnknownNodeTypeError, self).__init__(msg)
self.nodeType = nodeType
class NodeUpgradeError(GraphException):
def __init__(self, nodeName, details=None):
msg = "Failed to upgrade node {}".format(nodeName)
if details:
msg += ": {}".format(details)
super(NodeUpgradeError, self).__init__(msg)