6060
6161# TODO: add this to the **kwargs of all mobjects that use OpenGLVMobject
6262class VMobjectKwargs (MobjectKwargs , total = False ):
63- color : ParsableManimColor | list [ParsableManimColor ]
64- fill_color : ParsableManimColor | list [ParsableManimColor ]
65- fill_opacity : float
66- stroke_color : ParsableManimColor | list [ParsableManimColor ]
67- stroke_opacity : float
63+ color : ParsableManimColor | Sequence [ParsableManimColor ] | None
64+ fill_color : ParsableManimColor | Sequence [ParsableManimColor ] | None
65+ fill_opacity : float | None
66+ stroke_color : ParsableManimColor | Sequence [ParsableManimColor ] | None
67+ stroke_opacity : float | None
6868 stroke_width : float
6969 draw_stroke_behind_fill : bool
70- background_image_file : str
70+ background_image_file : str | None
7171 long_lines : bool
7272 joint_type : LineJointType
7373 flat_stroke : bool
74+ shade_in_3d : bool
75+ checkerboard_colors : bool # TODO: remove
7476
7577
7678class OpenGLVMobject (OpenGLMobject ):
@@ -95,17 +97,10 @@ def __init__(
9597 long_lines : bool = False ,
9698 joint_type : LineJointType = LineJointType .AUTO ,
9799 flat_stroke : bool = False ,
98- shade_in_3d = False , # TODO: Can be ignored for now but we should think about using some sort of shader to introduce lighting after deferred rendering has completed
99- checkerboard_colors = False , # ignore,
100+ shade_in_3d : bool = False , # TODO: Can be ignored for now but we should think about using some sort of shader to introduce lighting after deferred rendering has completed
101+ checkerboard_colors : bool = False , # ignore,
100102 ** kwargs : Unpack [MobjectKwargs ],
101103 ):
102- super ().__init__ (** kwargs )
103- if fill_color is None :
104- fill_color = self .color
105- if stroke_color is None :
106- stroke_color = self .color
107- self .set_fill (color = fill_color , opacity = fill_opacity )
108- self .set_stroke (color = stroke_color , opacity = stroke_opacity )
109104 self .stroke_width = listify (stroke_width )
110105 self .draw_stroke_behind_fill = draw_stroke_behind_fill
111106 self .background_image_file = background_image_file
@@ -116,6 +111,14 @@ def __init__(
116111 self .needs_new_triangulation = True
117112 self .triangulation = np .zeros (0 , dtype = "i4" )
118113
114+ super ().__init__ (** kwargs )
115+ if fill_color is None :
116+ fill_color = self .color
117+ if stroke_color is None :
118+ stroke_color = self .color
119+ self .set_fill (color = fill_color , opacity = fill_opacity )
120+ self .set_stroke (color = stroke_color , width = stroke_width , opacity = stroke_opacity )
121+
119122 # self.refresh_unit_normal()
120123
121124 def _assert_valid_submobjects (self , submobjects : Iterable [OpenGLVMobject ]) -> Self :
0 commit comments