mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-06 21:01:59 +02:00
[core] support for non-exclusive choice params
This commit is contained in:
parent
977a6b1507
commit
76fad411a4
2 changed files with 9 additions and 3 deletions
|
@ -56,9 +56,10 @@ class FloatParam(Param):
|
||||||
class ChoiceParam(Param):
|
class ChoiceParam(Param):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
def __init__(self, label, description, value, values, exclusive, uid, group='allParams'):
|
def __init__(self, label, description, value, values, exclusive, uid, group='allParams', joinChar=' '):
|
||||||
self.values = values
|
self.values = values
|
||||||
self.exclusive = exclusive
|
self.exclusive = exclusive
|
||||||
|
self.joinChar = joinChar
|
||||||
super(ChoiceParam, self).__init__(label=label, description=description, value=value, uid=uid, group=group)
|
super(ChoiceParam, self).__init__(label=label, description=description, value=value, uid=uid, group=group)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import collections
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
@ -13,6 +14,7 @@ from enum import Enum # available by default in python3. For python2: "pip inst
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
from . import stats
|
from . import stats
|
||||||
|
from . import desc
|
||||||
from meshroom import core as pg
|
from meshroom import core as pg
|
||||||
from meshroom.common import BaseObject, Model, Slot, Signal, Property
|
from meshroom.common import BaseObject, Model, Slot, Signal, Property
|
||||||
|
|
||||||
|
@ -310,6 +312,9 @@ class Node(BaseObject):
|
||||||
if linkAttr:
|
if linkAttr:
|
||||||
attr._value = linkAttr._value
|
attr._value = linkAttr._value
|
||||||
v = attr._value
|
v = attr._value
|
||||||
|
if isinstance(attr.attributeDesc, desc.ChoiceParam) and not attr.attributeDesc.exclusive:
|
||||||
|
assert(isinstance(v, collections.Sequence) and not isinstance(v, basestring))
|
||||||
|
v = attr.attributeDesc.joinChar.join(v)
|
||||||
|
|
||||||
self._cmdVars[name] = '--{name} {value}'.format(name=name, value=v)
|
self._cmdVars[name] = '--{name} {value}'.format(name=name, value=v)
|
||||||
self._cmdVars[name + 'Value'] = str(v)
|
self._cmdVars[name + 'Value'] = str(v)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue