mirror of
https://github.com/drewcassidy/TexTools-Blender
synced 2024-09-01 14:54:44 +00:00
commit
18ad90e894
@ -1447,14 +1447,10 @@ def register():
|
||||
|
||||
|
||||
def unregister():
|
||||
#GUI Utilities
|
||||
# utilities_ui.unregister()
|
||||
|
||||
from bpy.utils import unregister_class
|
||||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
|
||||
|
||||
#Unregister Settings
|
||||
del bpy.types.Scene.texToolsSettings
|
||||
|
||||
@ -1463,6 +1459,9 @@ def unregister():
|
||||
km.keymap_items.remove(kmi)
|
||||
keymaps.clear()
|
||||
|
||||
#GUI Utilities
|
||||
utilities_ui.unregister()
|
||||
|
||||
bpy.types.IMAGE_MT_uvs.remove(menu_IMAGE_uvs)
|
||||
bpy.types.IMAGE_MT_select.remove(menu_IMAGE_select)
|
||||
bpy.types.IMAGE_MT_image.remove(menu_IMAGE_MT_image)
|
||||
|
@ -126,17 +126,15 @@ def align_island(uv_vert0, uv_vert1, faces):
|
||||
loop[uv_layers].select = True
|
||||
|
||||
diff = uv_vert1 - uv_vert0
|
||||
angle = math.atan2(diff.y, diff.x)%(math.pi/2)
|
||||
current_angle = math.atan2(diff.y, diff.x)
|
||||
angle_to_rotate = round(current_angle / (math.pi/2)) * (math.pi/2) - current_angle
|
||||
|
||||
bpy.ops.uv.select_linked()
|
||||
|
||||
bpy.context.tool_settings.transform_pivot_point = 'CURSOR'
|
||||
bpy.ops.uv.cursor_set(location=uv_vert0 + diff/2)
|
||||
|
||||
if angle >= (math.pi/4):
|
||||
angle = angle - (math.pi/2)
|
||||
|
||||
bpy.ops.transform.rotate(value=angle, orient_axis='Z', constraint_axis=(False, False, False), orient_type='GLOBAL', mirror=False, use_proportional_edit=False)
|
||||
bpy.ops.transform.rotate(value=angle_to_rotate, orient_axis='Z', constraint_axis=(False, False, False), orient_type='GLOBAL', mirror=False, use_proportional_edit=False)
|
||||
|
||||
|
||||
bpy.utils.register_class(op)
|
||||
|
@ -4,6 +4,7 @@ import operator
|
||||
from mathutils import Vector
|
||||
from collections import defaultdict
|
||||
from math import pi
|
||||
import sys
|
||||
import time
|
||||
from math import radians, hypot
|
||||
|
||||
@ -38,7 +39,11 @@ class op(bpy.types.Operator):
|
||||
rectify(self, context)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def time_clock():
|
||||
if sys.version_info >= (3, 3):
|
||||
return time.process_time()
|
||||
else:
|
||||
return time.clock()
|
||||
|
||||
precision = 3
|
||||
|
||||
@ -61,7 +66,7 @@ def rectify(self, context):
|
||||
|
||||
def main(square = False, snapToClosest = False):
|
||||
|
||||
startTime = time.clock()
|
||||
startTime = time_clock()
|
||||
obj = bpy.context.active_object
|
||||
me = obj.data
|
||||
bm = bmesh.from_edit_mesh(me)
|
||||
@ -310,7 +315,7 @@ def SuccessFinished(me, startTime):
|
||||
#use for backtrack of steps
|
||||
#bpy.ops.ed.undo_push()
|
||||
bmesh.update_edit_mesh(me)
|
||||
#elapsed = round(time.clock()-startTime, 2)
|
||||
#elapsed = round(time_clock()-startTime, 2)
|
||||
#if (elapsed >= 0.05): operator.report({'INFO'}, "UvSquares finished, elapsed:", elapsed, "s.")
|
||||
return
|
||||
|
||||
@ -634,4 +639,4 @@ def hypotVert(v1, v2):
|
||||
hyp = hypot(v1.x - v2.x, v1.y - v2.y)
|
||||
return hyp
|
||||
|
||||
bpy.utils.register_class(op)
|
||||
bpy.utils.register_class(op)
|
||||
|
@ -155,12 +155,13 @@ def unregister():
|
||||
from bpy.types import WindowManager
|
||||
for preview_collection in preview_collections.values():
|
||||
bpy.utils.previews.remove(preview_collection)
|
||||
preview_collections.clear()
|
||||
preview_collection.clear()
|
||||
|
||||
|
||||
# Unregister icons
|
||||
# global preview_icons
|
||||
bpy.utils.previews.remove(preview_icons)
|
||||
# bpy.utils.previews.remove(preview_icons)
|
||||
preview_icons.clear()
|
||||
|
||||
|
||||
del bpy.types.Scene.TT_bake_mode
|
||||
|
Loading…
Reference in New Issue
Block a user