function to completely delete
add function to completely delete objects safely
This commit is contained in:
parent
459bf739dd
commit
3feef9f5ab
1 changed files with 16 additions and 0 deletions
16
butils.py
16
butils.py
|
@ -486,6 +486,22 @@ def ShowMessageBox(title = "Message Box", icon = 'INFO', message=""):
|
||||||
self.layout.label(text=n)
|
self.layout.label(text=n)
|
||||||
bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
|
bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
|
||||||
|
|
||||||
|
def completely_delete_objs(objs):
|
||||||
|
context_override = bpy.context.copy()
|
||||||
|
context_override["selected_objects"] = list(objs)
|
||||||
|
with bpy.context.temp_override(**context_override):
|
||||||
|
bpy.ops.object.delete()
|
||||||
|
|
||||||
|
# remove deleted objects
|
||||||
|
# this is necessary
|
||||||
|
for g in objs:
|
||||||
|
if type(g) != type(None):
|
||||||
|
try:
|
||||||
|
bpy.data.objects.remove(g, do_unlink=True)
|
||||||
|
except ReferenceError as e:
|
||||||
|
# not important
|
||||||
|
pass
|
||||||
|
|
||||||
def set_text_on_curve(text_properties):
|
def set_text_on_curve(text_properties):
|
||||||
# starttime = time.perf_counter_ns()
|
# starttime = time.perf_counter_ns()
|
||||||
mom = text_properties.text_object
|
mom = text_properties.text_object
|
||||||
|
|
Loading…
Reference in a new issue