File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
src/compas_blender/artists Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414### Changed
1515
1616* Changed new artist registration to check if subclass.
17+ * Fixed ` RobotModelArtist ` for blender: missing abstract method impl and handle init order.
1718
1819### Removed
1920
Original file line number Diff line number Diff line change @@ -21,11 +21,10 @@ class BlenderArtist(Artist):
2121 def __init__ (self ,
2222 collection : Optional [Union [str , bpy .types .Collection ]] = None ,
2323 ** kwargs : Any ):
24-
25- super ().__init__ (** kwargs )
26-
24+ # Initialize collection before even calling super because other classes depend on that
2725 self ._collection = None
2826 self .collection = collection
27+ super ().__init__ (** kwargs )
2928
3029 @property
3130 def collection (self ) -> bpy .types .Collection :
Original file line number Diff line number Diff line change @@ -60,20 +60,28 @@ def create_geometry(self,
6060 def redraw (self , timeout : float = 0.0 ) -> None :
6161 bpy .ops .wm .redraw_timer (type = 'DRAW_WIN_SWAP' , iterations = 1 , time_limit = timeout )
6262
63- def clear (self ) -> None :
64- compas_blender .delete_objects (self .collection .objects )
63+ def _ensure_geometry (self ):
64+ if len (self .collection .objects ) == 0 :
65+ self .create ()
66+
67+ def draw (self ) -> None :
68+ self ._ensure_geometry ()
69+ self .draw_visual ()
6570
6671 def draw_visual (self ) -> None :
72+ self ._ensure_geometry ()
6773 visuals = super (RobotModelArtist , self ).draw_visual ()
6874 for visual in visuals :
6975 visual .hide_set (False )
7076
7177 def draw_collision (self ) -> None :
78+ self ._ensure_geometry ()
7279 collisions = super (RobotModelArtist , self ).draw_collision ()
7380 for collision in collisions :
7481 collision .hide_set (False )
7582
7683 def draw_attached_meshes (self ) -> None :
84+ self ._ensure_geometry ()
7785 meshes = super (RobotModelArtist , self ).draw_attached_meshes ()
7886 for mesh in meshes :
7987 mesh .hide_set (False )
You can’t perform that action at this time.
0 commit comments