|
1 | 1 | import time |
2 | | -from functools import lru_cache |
3 | 2 | from typing import TYPE_CHECKING |
4 | 3 |
|
5 | 4 | from numpy import float32 |
|
17 | 16 | from compas_viewer.scene import TagObject |
18 | 17 | from compas_viewer.scene.buffermanager import BufferManager |
19 | 18 | from compas_viewer.scene.gridobject import GridObject |
20 | | -from compas_viewer.scene.vectorobject import VectorObject |
21 | 19 |
|
22 | 20 | from .camera import Camera |
23 | 21 | from .shaders import Shader |
@@ -499,43 +497,6 @@ def sort_objects_from_viewworld(self, objects: list["MeshObject"], viewworld: li |
499 | 497 | transparent_objects, _ = zip(*transparent_objects) |
500 | 498 | return opaque_objects + list(transparent_objects) |
501 | 499 |
|
502 | | - @lru_cache(maxsize=3) |
503 | | - def sort_objects_from_category(self, objs: tuple["MeshObject"]) -> tuple[list["TagObject"], list["VectorObject"], list["MeshObject"]]: |
504 | | - """Sort objects by their categories |
505 | | -
|
506 | | - Returns |
507 | | - ------- |
508 | | - tuple(list[:class:`compas_viewer.scene.tagobject.TagObject`], |
509 | | - list[:class:`compas_viewer.scene.vectorobject.VectorObject`], |
510 | | - list[:class:`compas_viewer.scene.sceneobject.MeshObject`]) |
511 | | - A tuple of sorted objects. |
512 | | -
|
513 | | - Notes |
514 | | - ----- |
515 | | - This function is cached to improve the performance. |
516 | | -
|
517 | | - References |
518 | | - ---------- |
519 | | - * https://docs.python.org/3/library/functools.html#functools.lru_cache |
520 | | - * https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU) |
521 | | - """ |
522 | | - tag_objs = [] |
523 | | - vector_objs = [] |
524 | | - mesh_objs = [] |
525 | | - |
526 | | - def sort(obj): |
527 | | - if isinstance(obj, TagObject): |
528 | | - tag_objs.append(obj) |
529 | | - elif isinstance(obj, VectorObject): |
530 | | - vector_objs.append(obj) |
531 | | - else: |
532 | | - mesh_objs.append(obj) |
533 | | - |
534 | | - for obj in objs: |
535 | | - sort(obj) |
536 | | - |
537 | | - return tag_objs, vector_objs, mesh_objs |
538 | | - |
539 | 500 | def paint(self, is_instance: bool = False): |
540 | 501 | """Paint all the items in the render""" |
541 | 502 |
|
|
0 commit comments