Skip to content

Commit

Permalink
Merge pull request #2163 from alicevision/dev/keyframeVideoOutput
Browse files Browse the repository at this point in the history
KeyframeSelection: Flag `outputExtension` attribute when it is set to "none" for video inputs
  • Loading branch information
mugulmd authored Aug 28, 2023
2 parents 1a08d9f + 76d2e86 commit 2bea35d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions meshroom/core/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def _set_value(self, value):
self.requestNodeUpdate()

self.valueChanged.emit()
self.validValueChanged.emit()

def upgradeValue(self, exportedValue):
self._set_value(exportedValue)
Expand Down
6 changes: 4 additions & 2 deletions meshroom/core/desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,15 @@ def checkValueTypes(self):
class ChoiceParam(Param):
"""
"""
def __init__(self, name, label, description, value, values, exclusive, uid, group='allParams', joinChar=' ', advanced=False, semantic='', enabled=True):
def __init__(self, name, label, description, value, values, exclusive, uid, group='allParams', joinChar=' ', advanced=False, semantic='',
enabled=True, validValue=True, errorMessage=""):
assert values
self._values = values
self._exclusive = exclusive
self._joinChar = joinChar
self._valueType = type(self._values[0]) # cast to value type
super(ChoiceParam, self).__init__(name=name, label=label, description=description, value=value, uid=uid, group=group, advanced=advanced, semantic=semantic, enabled=enabled)
super(ChoiceParam, self).__init__(name=name, label=label, description=description, value=value, uid=uid, group=group, advanced=advanced,
semantic=semantic, enabled=enabled, validValue=validValue, errorMessage=errorMessage)

def conformValue(self, val):
""" Conform 'val' to the correct type and check for its validity """
Expand Down
5 changes: 5 additions & 0 deletions meshroom/nodes/aliceVision/KeyframeSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import os
from meshroom.core import desc

# List of supported video extensions (provided by OpenImageIO)
videoExts = [".avi", ".mov", ".mp4", ".m4a", ".m4v", ".3gp", ".3g2", ".mj2", ".m4v", ".mpg"]

class KeyframeSelectionNodeSize(desc.DynamicNodeSize):
def computeSize(self, node):
inputPathsSize = super(KeyframeSelectionNodeSize, self).computeSize(node)
Expand Down Expand Up @@ -299,6 +302,8 @@ class KeyframeSelection(desc.AVCommandLineNode):
value="none",
values=["none", "exr", "jpg", "png"],
exclusive=True,
validValue=lambda node: not (any(ext in input.value.lower() for ext in videoExts for input in node.inputPaths.value) and node.outputExtension.value == "none"),
errorMessage="A video input has been provided. The output extension should be different from 'none'.",
uid=[0],
),
desc.ChoiceParam(
Expand Down

0 comments on commit 2bea35d

Please sign in to comment.