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

View File

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