1
0
mirror of https://github.com/drewcassidy/TexTools-Blender synced 2024-09-01 14:54:44 +00:00

Fix time.clock() error in Python 3.8

This commit is contained in:
nagadomi 2020-07-01 11:12:06 +09:00
parent 2b5a6c8e12
commit 65a35c8e4b

View File

@ -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