Skip to content

Commit

Permalink
90º island rotate fixes
Browse files Browse the repository at this point in the history
Solved errors in multi-object UV editing and inconsistencies in the rotation center. Now, the rotation pivot for the selection is the same as the Rotation/Scaling Pivot defined on the Header of the UV Editor UI.
  • Loading branch information
franMarz authored Dec 14, 2020
1 parent c0672e3 commit b187264
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions op_island_rotate_90.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def main(context, angle):
bpy.ops.uv.select_linked()

#Bounds
bounds_initial = utilities_uv.getSelectionBBox()
#bounds_initial = utilities_uv.getSelectionBBox()

# bpy.ops.transform.rotate behaves differently based on the version of Blender on the UV Editor. Not expected to be fixed for every version of master
bversion = float(bpy.app.version_string[0:4])
Expand All @@ -69,14 +69,14 @@ def main(context, angle):
bpy.ops.transform.rotate(value=-angle, orient_axis='Z', constraint_axis=(False, False, False), use_proportional_edit=False)

#Align rotation to top left|right
bounds_post = utilities_uv.getSelectionBBox()
dy = bounds_post['max'].y - bounds_initial['max'].y
dx = 0
if angle > 0:
dx = bounds_post['max'].x - bounds_initial['max'].x
else:
dx = bounds_post['min'].x - bounds_initial['min'].x
bpy.ops.transform.translate(value=(-dx, -dy, 0), constraint_axis=(False, False, False), use_proportional_edit=False)
# bounds_post = utilities_uv.getSelectionBBox()
# dy = bounds_post['max'].y - bounds_initial['max'].y
# dx = 0
# if angle > 0:
# dx = bounds_post['max'].x - bounds_initial['max'].x
# else:
# dx = bounds_post['min'].x - bounds_initial['min'].x
# bpy.ops.transform.translate(value=(-dx, -dy, 0), constraint_axis=(False, False, False), use_proportional_edit=False)

#Restore selection
utilities_uv.selection_restore()
Expand Down

0 comments on commit b187264

Please sign in to comment.