Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-04-14 16:33:52 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-04-14 16:33:52 +0300
commit8366db568607ec20a5f087d3a156d2d4dd4f8f89 (patch)
tree29f84df8adfcdd37365e0e52b8885744cb9081bd /io_scene_fbx/fbx_utils.py
parent83ca4a3f61aeb88f9d739227d9bf9bd9222c82fe (diff)
FBX IO: fix related to T44386: do not add again and again same material to a mesh on import.
Issue here is that FBX assigns materials by objects, while in Blender it is by default assigned to meshes (obdata). This becomes critical with tons of objects using the same mesh (as generated e.g. by exporting from Blender's dupliobjects). We may add an option later to assign materials to objects too, but meh... We already have tons of options in FBX. :| Also, added some timing/steps reporting in console, helps seeing io process going on, and spotting stupid issues like this one!
Diffstat (limited to 'io_scene_fbx/fbx_utils.py')
-rw-r--r--io_scene_fbx/fbx_utils.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index 07e4d824..65ab2470 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -22,6 +22,7 @@
import math
+import time
from collections import namedtuple, OrderedDict
from collections.abc import Iterable
@@ -147,6 +148,56 @@ FBX_FRAMERATES = (
# ##### Misc utilities #####
+DO_PERFMON = True
+
+if DO_PERFMON:
+ class PerfMon():
+ def __init__(self):
+ self.level = -1
+ self.ref_time = []
+
+ def level_up(self, message=""):
+ self.level += 1
+ self.ref_time.append(None)
+ if message:
+ print("\t" * self.level, message, sep="")
+
+ def level_down(self, message=""):
+ if not self.ref_time:
+ if message:
+ print(message)
+ return
+ ref_time = self.ref_time[self.level]
+ print("\t" * self.level,
+ "\tDone (%f sec)\n" % ((time.process_time() - ref_time) if ref_time is not None else 0.0),
+ sep="")
+ if message:
+ print("\t" * self.level, message, sep="")
+ del self.ref_time[self.level]
+ self.level -= 1
+
+ def step(self, message=""):
+ ref_time = self.ref_time[self.level]
+ curr_time = time.process_time()
+ if ref_time is not None:
+ print("\t" * self.level, "\tDone (%f sec)\n" % (curr_time - ref_time), sep="")
+ self.ref_time[self.level] = curr_time
+ print("\t" * self.level, message, sep="")
+else:
+ class PerfMon():
+ def __init__(self):
+ pass
+
+ def level_up(self, message=""):
+ pass
+
+ def level_down(self, message=""):
+ pass
+
+ def step(self, message=""):
+ pass
+
+
# Note: this could be in a utility (math.units e.g.)...
UNITS = {