Merge pull request #26 from nagadomi/py38

Fix time.clock() error in Python 3.8
master
SavMartin 4 years ago committed by GitHub
commit 53d1f1bf5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,6 +4,7 @@ import operator
from mathutils import Vector from mathutils import Vector
from collections import defaultdict from collections import defaultdict
from math import pi from math import pi
import sys
import time import time
from math import radians, hypot from math import radians, hypot
@ -38,7 +39,11 @@ class op(bpy.types.Operator):
rectify(self, context) rectify(self, context)
return {'FINISHED'} return {'FINISHED'}
def time_clock():
if sys.version_info >= (3, 3):
return time.process_time()
else:
return time.clock()
precision = 3 precision = 3
@ -61,7 +66,7 @@ def rectify(self, context):
def main(square = False, snapToClosest = False): def main(square = False, snapToClosest = False):
startTime = time.clock() startTime = time_clock()
obj = bpy.context.active_object obj = bpy.context.active_object
me = obj.data me = obj.data
bm = bmesh.from_edit_mesh(me) bm = bmesh.from_edit_mesh(me)
@ -310,7 +315,7 @@ def SuccessFinished(me, startTime):
#use for backtrack of steps #use for backtrack of steps
#bpy.ops.ed.undo_push() #bpy.ops.ed.undo_push()
bmesh.update_edit_mesh(me) 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.") #if (elapsed >= 0.05): operator.report({'INFO'}, "UvSquares finished, elapsed:", elapsed, "s.")
return return
@ -634,4 +639,4 @@ def hypotVert(v1, v2):
hyp = hypot(v1.x - v2.x, v1.y - v2.y) hyp = hypot(v1.x - v2.x, v1.y - v2.y)
return hyp return hyp
bpy.utils.register_class(op) bpy.utils.register_class(op)

Loading…
Cancel
Save