|
3 | 3 | from typing import List |
4 | 4 | from typing import Optional |
5 | 5 | from typing import Tuple |
| 6 | +from typing import Union |
6 | 7 |
|
7 | 8 | import bpy |
8 | 9 |
|
|
18 | 19 | from compas.utilities import color_to_colordict |
19 | 20 |
|
20 | 21 | colordict = partial(color_to_colordict, colorformat='rgb', normalize=True) |
| 22 | +Color = Union[Tuple[int, int, int], Tuple[float, float, float]] |
21 | 23 |
|
22 | 24 |
|
23 | 25 | __all__ = ['MeshArtist'] |
@@ -270,7 +272,7 @@ def draw_mesh(self) -> List[bpy.types.Object]: |
270 | 272 |
|
271 | 273 | def draw_vertices(self, |
272 | 274 | vertices: Optional[List[int]] = None, |
273 | | - color: Optional[str, Tuple, List, Dict] = None) -> List[bpy.types.Object]: |
| 275 | + color: Optional[str, Color, List[Color], Dict[int, Color]] = None) -> List[bpy.types.Object]: |
274 | 276 | """Draw a selection of vertices. |
275 | 277 |
|
276 | 278 | Parameters |
@@ -302,7 +304,7 @@ def draw_vertices(self, |
302 | 304 |
|
303 | 305 | def draw_faces(self, |
304 | 306 | faces: Optional[List[int]] = None, |
305 | | - color: Optional[str, Tuple, List, Dict] = None) -> List[bpy.types.Object]: |
| 307 | + color: Optional[str, Color, List[Color], Dict[int, Color]] = None) -> List[bpy.types.Object]: |
306 | 308 | """Draw a selection of faces. |
307 | 309 |
|
308 | 310 | Parameters |
@@ -332,8 +334,8 @@ def draw_faces(self, |
332 | 334 | return objects |
333 | 335 |
|
334 | 336 | def draw_edges(self, |
335 | | - edges: Optional[List[Tuple[int]]] = None, |
336 | | - color: Optional[str, Tuple, List, Dict] = None) -> List[bpy.types.Object]: |
| 337 | + edges: Optional[List[Tuple[int, int]]] = None, |
| 338 | + color: Optional[str, Color, List[Color], Dict[int, Color]] = None) -> List[bpy.types.Object]: |
337 | 339 | """Draw a selection of edges. |
338 | 340 |
|
339 | 341 | Parameters |
@@ -369,8 +371,8 @@ def draw_edges(self, |
369 | 371 |
|
370 | 372 | def draw_vertexnormals(self, |
371 | 373 | vertices: Optional[List[int]] = None, |
372 | | - color: Optional[str, Tuple, List, Dict] = None, |
373 | | - scale: Optional[float] = 1.0) -> List[bpy.types.Object]: |
| 374 | + color: Optional[str, Color, List[Color], Dict[int, Color]] = None, |
| 375 | + scale: float = 1.0) -> List[bpy.types.Object]: |
374 | 376 | """Draw the normals at the vertices of the mesh. |
375 | 377 |
|
376 | 378 | Parameters |
@@ -408,8 +410,8 @@ def draw_vertexnormals(self, |
408 | 410 |
|
409 | 411 | def draw_facenormals(self, |
410 | 412 | faces: Optional[List[List[int]]] = None, |
411 | | - color: Optional[str, Tuple, List, Dict] = None, |
412 | | - scale: Optional[float] = 1.0) -> List[bpy.types.Object]: |
| 413 | + color: Optional[str, Color, List[Color], Dict[int, Color]] = None, |
| 414 | + scale: float = 1.0) -> List[bpy.types.Object]: |
413 | 415 | """Draw the normals of the faces. |
414 | 416 |
|
415 | 417 | Parameters |
@@ -453,7 +455,7 @@ def draw_facenormals(self, |
453 | 455 |
|
454 | 456 | def draw_vertexlabels(self, |
455 | 457 | text: Optional[Dict[int, str]] = None, |
456 | | - color: Optional[str, Tuple, List, Dict] = None) -> List[bpy.types.Object]: |
| 458 | + color: Optional[str, Color, List[Color], Dict[int, Color]] = None) -> List[bpy.types.Object]: |
457 | 459 | """Draw labels for a selection vertices. |
458 | 460 |
|
459 | 461 | Parameters |
@@ -490,8 +492,8 @@ def draw_vertexlabels(self, |
490 | 492 | return objects |
491 | 493 |
|
492 | 494 | def draw_edgelabels(self, |
493 | | - text: Optional[Dict[Tuple[int], str]] = None, |
494 | | - color: Optional[str, Tuple, List, Dict] = None) -> List[bpy.types.Object]: |
| 495 | + text: Optional[Dict[Tuple[int, int], str]] = None, |
| 496 | + color: Optional[str, Color, List[Color], Dict[int, Color]] = None) -> List[bpy.types.Object]: |
495 | 497 | """Draw labels for a selection of edges. |
496 | 498 |
|
497 | 499 | Parameters |
@@ -528,7 +530,7 @@ def draw_edgelabels(self, |
528 | 530 |
|
529 | 531 | def draw_facelabels(self, |
530 | 532 | text: Optional[Dict[int, str]] = None, |
531 | | - color: Optional[str, Tuple, List, Dict] = None) -> List[bpy.types.Object]: |
| 533 | + color: Optional[str, Color, List[Color], Dict[int, Color]] = None) -> List[bpy.types.Object]: |
532 | 534 | """Draw labels for a selection of faces. |
533 | 535 |
|
534 | 536 | Parameters |
|
0 commit comments