Fix T60172: UV smart project fails for unselected active object

Support multi-object edit-mode too.
This commit is contained in:
Campbell Barton 2019-03-14 10:47:25 +11:00
parent 3a58e97aed
commit e63642f9cd
Notes: blender-bot 2023-02-14 05:28:01 +01:00
Referenced by issue #60172, UV smart project fails for unselected active object
1 changed files with 8 additions and 8 deletions

View File

@ -728,8 +728,14 @@ def main(context,
USER_FILL_HOLES_QUALITY = 50 # Only for hole filling.
USER_VIEW_INIT = 0 # Only for hole filling.
obList = [ob for ob in context.selected_editable_objects if ob and ob.type == 'MESH']
is_editmode = (context.active_object.mode == 'EDIT')
is_editmode = (context.mode == 'EDIT_MESH')
if is_editmode:
obList = context.objects_in_mode_unique_data
else:
obList = [
ob for ob in context.selected_editable_objects
if ob.type == 'MESH' and ob.data.library is None
]
if not is_editmode:
USER_ONLY_SELECTED_FACES = False
@ -737,12 +743,6 @@ def main(context,
if not obList:
raise Exception("error, no selected mesh objects")
# Reuse variable
if len(obList) == 1:
ob = "Unwrap %i Selected Mesh"
else:
ob = "Unwrap %i Selected Meshes"
# Convert from being button types
USER_PROJECTION_LIMIT_CONVERTED = cos(USER_PROJECTION_LIMIT * DEG_TO_RAD)
USER_PROJECTION_LIMIT_HALF_CONVERTED = cos((USER_PROJECTION_LIMIT / 2) * DEG_TO_RAD)