File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,11 @@ def focus_on_object(obj, edit=False):
33
33
34
34
def remove_object (obj ):
35
35
if (obj ):
36
- data = obj .data
37
- type = obj .type
36
+ try :
37
+ data = obj .data
38
+ type = obj .type
39
+ except :
40
+ return
38
41
bpy .data .objects .remove (obj , do_unlink = True , do_id_user = True )
39
42
if hasattr (data , "users" ):
40
43
if data .users == 0 :
@@ -43,10 +46,12 @@ def remove_object(obj):
43
46
elif (type in ['CURVE' , 'FONT' ]):
44
47
bpy .data .curves .remove (data , do_unlink = True , do_id_user = True )
45
48
46
- def apply_all_modifiers ():
47
- obj = bpy .context .active_object
48
- while (obj .modifiers ):
49
- bpy .ops .object .modifier_apply (modifier = obj .modifiers [0 ].name )
49
+ def apply_all_modifiers (object ):
50
+ if (object ):
51
+ if (object .name in bpy .context .view_layer .objects ):
52
+ bpy .context .view_layer .objects .active = object
53
+ while (object .modifiers ):
54
+ bpy .ops .object .modifier_apply (modifier = object .modifiers [0 ].name )
50
55
51
56
def get_override (active = None , edit = False , selected = [], type = 'VIEW_3D' ):
52
57
override = bpy .context .copy ()
You can’t perform that action at this time.
0 commit comments