From 5df396e9388606fba216b5d2758307e6725da279 Mon Sep 17 00:00:00 2001 From: Thomas Portassau Date: Mon, 28 Nov 2022 06:53:18 +0100 Subject: [PATCH] fixed time.clock --- io_scene_forest/__init__.py | 2 +- io_scene_forest/export_forest.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/io_scene_forest/__init__.py b/io_scene_forest/__init__.py index f474672..8ece9dd 100644 --- a/io_scene_forest/__init__.py +++ b/io_scene_forest/__init__.py @@ -8,7 +8,7 @@ bl_info = { "name": "BeamNG forest item (*.forest4.json)", "author": "BeamNG / dmn", - "version": (0, 2, 0), + "version": (0, 2, 1), "blender": (2, 80, 0), "location": "File > Import-Export", "description": "Import-Export forest files", diff --git a/io_scene_forest/export_forest.py b/io_scene_forest/export_forest.py index ec9af28..b4390c6 100644 --- a/io_scene_forest/export_forest.py +++ b/io_scene_forest/export_forest.py @@ -5,7 +5,8 @@ # # ##### END LICENSE BLOCK ##### -import os, time, math +import os, math +import datetime import bpy , mathutils ###################################################### @@ -37,7 +38,8 @@ def export_forest(file, object_name, data_source): loc = ob.location - items.append('{"type":"' + object_name + '","pos":[' + str(loc[0]) + ',' + str(loc[1]) + ',' + str(loc[2]) + '],"quat":[' + str(object_quaternion[2]) + ',' + str(object_quaternion[1] * -1) + ',' + str(object_quaternion[0]) + "," + str(object_quaternion[3]) + '],"scale":' + str(uniform_scale) + "}") + items.append('{"type":"' + object_name + '","pos":[' + str(loc[0]) + ',' + str(loc[1]) + ',' + str(loc[2]) + '],"quat":[' + + str(object_quaternion[2]) + ',' + str(object_quaternion[1] * -1) + ',' + str(object_quaternion[0]) + "," + str(object_quaternion[3]) + '],"scale":' + str(uniform_scale) + "}") # write to file file.write("\n".join(items)) @@ -53,7 +55,7 @@ def save_forest(filepath, print("exporting forest: %r..." % (filepath)) - time1 = time.clock() + time1 = datetime.datetime.now() # get data source data_source = bpy.data.objects @@ -66,7 +68,7 @@ def save_forest(filepath, file.close() # forest export complete - print(" done in %.4f sec." % (time.clock() - time1)) + print(" done in %.4f sec." % ((datetime.datetime.now() - time1).total_seconds())) def save(operator,