fix: redirect some reference of bpy.context to context passed by operator argument

This commit is contained in:
2025-01-03 10:37:26 +08:00
parent 89a5e6367b
commit 4181096a9e
2 changed files with 16 additions and 15 deletions

View File

@ -135,7 +135,7 @@ class BBP_OT_flatten_uv(bpy.types.Operator):
@classmethod
def poll(cls, context):
obj = bpy.context.active_object
obj = context.active_object
if obj is None:
return False
if obj.type != 'MESH':
@ -162,7 +162,7 @@ class BBP_OT_flatten_uv(bpy.types.Operator):
return {'CANCELLED'}
# do flatten uv and report
failed: int = _flatten_uv_wrapper(bpy.context.active_object.data, flatten_param_)
failed: int = _flatten_uv_wrapper(context.active_object.data, flatten_param_)
if failed != 0:
print(f'[Flatten UV] {failed} faces are not be processed correctly because process failed.')
return {'FINISHED'}