diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2020-03-09 18:30:31 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2020-03-09 18:30:31 +0300 |
commit | 5b0b0b3781d1831a06687f89e169150133181b06 (patch) | |
tree | 179a4ed7674e1aed18cfbec5adc68302715fd7e4 /io_scene_gltf2/blender/imp/gltf2_blender_gltf.py | |
parent | 6e7dfdd8a91fdccae321f6192dd22accb5bc2426 (diff) |
glTF importer: speedup import of vertex color
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_gltf.py')
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_gltf.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py b/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py index 8e6c1950..e00e2449 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py @@ -24,7 +24,26 @@ class BlenderGlTF(): @staticmethod def create(gltf): - """Create glTF main method.""" + """Create glTF main method, with optional profiling""" + profile = bpy.app.debug_value == 102 + if profile: + import cProfile, pstats, io + from pstats import SortKey + pr = cProfile.Profile() + pr.enable() + BlenderGlTF._create(gltf) + pr.disable() + s = io.StringIO() + sortby = SortKey.TIME + ps = pstats.Stats(pr, stream=s).sort_stats(sortby) + ps.print_stats() + print(s.getvalue()) + else: + BlenderGlTF._create(gltf) + + @staticmethod + def _create(gltf): + """Create glTF main worker method.""" BlenderGlTF.set_convert_functions(gltf) BlenderGlTF.pre_compute(gltf) BlenderScene.create(gltf) |