mirror of
https://github.com/drewcassidy/TexTools-Blender
synced 2024-09-01 14:54:44 +00:00
Fix Align Island by Edge only working in Blender 2.83
This commit is contained in:
parent
a6a28029d6
commit
e1403bd7ca
@ -126,9 +126,14 @@ def align_island(uv_vert0, uv_vert1, faces):
|
||||
loop[uv_layers].select = True
|
||||
|
||||
diff = uv_vert1 - uv_vert0
|
||||
current_angle = math.atan2(diff.y, diff.x)
|
||||
current_angle = math.atan2(diff.x, diff.y)
|
||||
angle_to_rotate = round(current_angle / (math.pi/2)) * (math.pi/2) - current_angle
|
||||
|
||||
# For some reason bpy.ops.transform.rotate rotates in the opposite
|
||||
# direction in Blender 2.83 than in other versions.
|
||||
if float(bpy.app.version_string[0:4]) == 2.83:
|
||||
angle_to_rotate = -angle_to_rotate
|
||||
|
||||
bpy.ops.uv.select_linked()
|
||||
|
||||
bpy.context.tool_settings.transform_pivot_point = 'CURSOR'
|
||||
|
Loading…
Reference in New Issue
Block a user