Fix #104670: Update Modifier Tools for removal of old context override #104671

Merged
Jesse Yurkovich merged 1 commits from deadpin/blender-addons:fix104670-context into main 2023-06-05 09:00:00 +02:00
Showing only changes of commit c607258975 - Show all commits

View File

@ -34,23 +34,19 @@ class ApplyAllModifiers(Operator):
is_select = True
# copying context for the operator's override
contx = bpy.context.copy()
contx['object'] = obj
context_override = {'object': obj}
modifiers = modifier_type(obj)
for mod in modifiers[:]:
contx['modifier'] = mod
context_override['modifier'] = mod
is_mod = True
try:
bpy.ops.object.modifier_apply(
contx,
modifier=contx['modifier'].name
)
bpy.ops.object.gpencil_modifier_apply(
modifier=contx['modifier'].name
)
with bpy.context.temp_override(**context_override):
if obj.type != 'GPENCIL':
bpy.ops.object.modifier_apply(modifier=mod.name)
else:
bpy.ops.object.gpencil_modifier_apply(modifier=mod.name)
except:
obj_name = getattr(obj, "name", "NO NAME")
collect_names.append(obj_name)