|
4 | 4 |
|
5 | 5 | from meshroom.core import desc |
6 | 6 | from meshroom.core.utils import COLORSPACES, VERBOSE_LEVEL |
| 7 | +from . ldrToHdrCommon import NbOfBracketsShouldBeAMultipleOfNbOfImages |
7 | 8 |
|
8 | 9 | def findMetadata(d, keys, defaultValue): |
9 | 10 | v = None |
@@ -55,9 +56,8 @@ class LdrToHdrCalibration(desc.AVCommandLineNode): |
55 | 56 | value=0, |
56 | 57 | range=(0, 15, 1), |
57 | 58 | invalidate=False, |
58 | | - group="user", # not used directly on the command line |
59 | | - errorMessage="The set number of brackets is not a multiple of the number of input images.\n" |
60 | | - "Errors will occur during the computation.", |
| 59 | + group="user", # not used directly on the command line, |
| 60 | + validators=[NbOfBracketsShouldBeAMultipleOfNbOfImages()], |
61 | 61 | exposed=True, |
62 | 62 | ), |
63 | 63 | desc.IntParam( |
@@ -176,23 +176,15 @@ def update(cls, node): |
176 | 176 | if "userNbBrackets" not in node.getAttributes().keys(): |
177 | 177 | # Old version of the node |
178 | 178 | return |
179 | | - node.userNbBrackets.validValue = True # Reset the status of "userNbBrackets" |
180 | 179 |
|
181 | 180 | cameraInitOutput = node.input.getLinkParam(recursive=True) |
182 | 181 | if not cameraInitOutput: |
183 | 182 | node.nbBrackets.value = 0 |
184 | 183 | return |
185 | 184 | if node.userNbBrackets.value != 0: |
186 | | - # The number of brackets has been manually forced: check whether it is valid or not |
187 | | - if cameraInitOutput and cameraInitOutput.node and cameraInitOutput.node.hasAttribute("viewpoints"): |
188 | | - viewpoints = cameraInitOutput.node.viewpoints.value |
189 | | - # The number of brackets should be a multiple of the number of input images |
190 | | - if (len(viewpoints) % node.userNbBrackets.value != 0): |
191 | | - node.userNbBrackets.validValue = False |
192 | | - else: |
193 | | - node.userNbBrackets.validValue = True |
194 | | - node.nbBrackets.value = node.userNbBrackets.value |
195 | | - return |
| 185 | + if len(node.userNbBrackets.getErrorMessages()) > 0: |
| 186 | + node.nbBrackets.value = node.userNbBrackets.value |
| 187 | + return |
196 | 188 |
|
197 | 189 | if not cameraInitOutput.node.hasAttribute("viewpoints"): |
198 | 190 | if cameraInitOutput.node.hasAttribute("input"): |
|
0 commit comments