Skip to content

Commit ac04df9

Browse files
committed
Use utility function for collection creation
Use the utility function to create blender collection instead of a new bpy-method
1 parent 27f2366 commit ac04df9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/compas_blender/artists/robotmodelartist.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,9 @@ def draw_geometry(self, geometry, name=None, color=None):
4343

4444
if self.collection:
4545
if self.collection not in bpy.data.collections.keys():
46-
target_collection = bpy.data.collections.new(self.collection) # create new collection if none exists
47-
bpy.context.scene.collection.children.link(target_collection) # link the new collection to the base collection
48-
else: # not necessary: linking the object to an existing collection is done in compas_blender.draw_mesh
49-
target_collection = bpy.data.collections.get(self.collection)
46+
compas_blender.utilities.create_collection(self.collection)
5047

5148
v, f = geometry.to_vertices_and_faces()
52-
# Draw the mesh in Blender in the specified collection
5349
return compas_blender.draw_mesh(vertices=v, faces=f, name=name, color=color, centroid=False, collection=self.collection)
5450

5551
def redraw(self, timeout=None):

0 commit comments

Comments
 (0)