diff --git a/meshroom/core/attribute.py b/meshroom/core/attribute.py index ac576404..be1aec82 100644 --- a/meshroom/core/attribute.py +++ b/meshroom/core/attribute.py @@ -330,10 +330,15 @@ class ListAttribute(Attribute): self.extend(newValue) self.requestGraphUpdate() - def upgradeValue(self, exportedValue): - values = exportedValue if isinstance(exportedValue, list) else [exportedValue] + def upgradeValue(self, exportedValues): + if not isinstance(exportedValues, list): + if isinstance(exportedValues, ListAttribute) or Attribute.isLinkExpression(exportedValues): + self._set_value(exportedValues) + return + raise RuntimeError("ListAttribute.upgradeValue: the given value is of type " + str(type(exportedValues)) + " but a 'list' is expected.") + attrs = [] - for v in values: + for v in exportedValues: a = attributeFactory(self.attributeDesc.elementDesc, None, self.isOutput, self.node, self) a.upgradeValue(v) attrs.append(a) diff --git a/meshroom/nodes/aliceVision/CameraInit.py b/meshroom/nodes/aliceVision/CameraInit.py index ba46d8eb..9663bf1b 100644 --- a/meshroom/nodes/aliceVision/CameraInit.py +++ b/meshroom/nodes/aliceVision/CameraInit.py @@ -1,4 +1,4 @@ -__version__ = "5.0" +__version__ = "6.0" import os import json @@ -255,12 +255,22 @@ The metadata needed are: ] def upgradeAttributeValues(self, attrValues, fromVersion): - if fromVersion <= Version(4, 0): + # Starting with version 5, the focal length is now split on x and y + if fromVersion < Version(5, 0): for intrinsic in attrValues['intrinsics']: - # focal length is now split on x and y pxFocalLength = intrinsic['pxFocalLength'] if not isinstance(pxFocalLength, dict): intrinsic['pxFocalLength'] = {"x": pxFocalLength, "y": pxFocalLength} + + # Starting with version 6, the principal point is now relative to the image center + if fromVersion < Version(6, 0): + for intrinsic in attrValues['intrinsics']: + principalPoint = intrinsic['principalPoint'] + intrinsic['principalPoint'] = { + "x": int(principalPoint["x"] - 0.5 * intrinsic['width']), + "y": int(principalPoint["y"] - 0.5 * intrinsic['height']) + } + return attrValues def readSfMData(self, sfmFile): @@ -328,7 +338,7 @@ The metadata needed are: view['metadata'] = json.loads(view['metadata']) sfmData = { - "version": [1, 2, 0], + "version": [1, 2, 1], "views": views + newViews, "intrinsics": intrinsics, "featureFolder": "",