improvement code cleanity

use function to completely delete objects
This commit is contained in:
themancalledjakob 2024-08-07 11:53:03 +02:00
parent f194c4cd24
commit 1bcce247e0

View file

@ -526,16 +526,17 @@ def set_text_on_curve(text_properties):
# if we regenerate.... delete objects # if we regenerate.... delete objects
if regenerate: if regenerate:
context_override = bpy.context.copy() completely_delete_objects(glyph_objects)
context_override["selected_objects"] = list(glyph_objects) # context_override = bpy.context.copy()
with bpy.context.temp_override(**context_override): # context_override["selected_objects"] = list(glyph_objects)
bpy.ops.object.delete() # with bpy.context.temp_override(**context_override):
# bpy.ops.object.delete()
# remove deleted objects # # remove deleted objects
# this is necessary # # this is necessary
for g in glyph_objects: # for g in glyph_objects:
if type(g) != type(None): # if type(g) != type(None):
bpy.data.objects.remove(g, do_unlink=True) # bpy.data.objects.remove(g, do_unlink=True)
text_properties.glyphs.clear() text_properties.glyphs.clear()