22from stlib .core .baseParameters import BaseParameters , Callable , Optional , dataclasses , Any
33from stlib .geometry import Geometry , GeometryParameters
44from stlib .geometry .file import FileParameters
5+ from splib .core .utils import DEFAULT_VALUE , addObject
6+
57from Sofa .Core import Object
68
79@dataclasses .dataclass
810class VisualParameters (BaseParameters ):
9- color : Optional [list [float ]] = None
10- texture : Optional [str ] = None
11+ color : Optional [list [float ]] = DEFAULT_VALUE
12+ texture : Optional [str ] = DEFAULT_VALUE
1113
1214 geometry : GeometryParameters = dataclasses .field (default_factory = lambda : GeometryParameters ())
1315 addMapping : Optional [Callable ] = None
@@ -18,8 +20,7 @@ def __init__(self, params: VisualParameters):
1820 BasePrefab .__init__ (self , params )
1921
2022 geom = self .add (Geometry , params .geometry )
21- # TODO : handle optional color, texture using DEFAULT_VALUE mechanism (as implemented by Paul)
22- self .addObject ("OglModel" , color = params .color , src = geom .container .linkpath )
23+ addObject (self ,"OglModel" , "MechanicalState" , color = params .color , src = geom .container .linkpath , ** params .kwargs )
2324
2425 if params .addMapping is not None :
2526 params .addMapping (self )
0 commit comments