[Bf-extensions-cvs] [9a578cb5] blender2.8: io_mesh_uv_layout: lazy import exporter modules

Campbell Barton noreply at git.blender.org
Mon Oct 8 23:38:41 CEST 2018


Commit: 9a578cb56610e7f7ec8c9349b77c9cd970b17c8d
Author: Campbell Barton
Date:   Tue Oct 9 08:37:38 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBA9a578cb56610e7f7ec8c9349b77c9cd970b17c8d

io_mesh_uv_layout: lazy import exporter modules

Minimize time spent loading modules on startup.

===================================================================

M	io_mesh_uv_layout/__init__.py

===================================================================

diff --git a/io_mesh_uv_layout/__init__.py b/io_mesh_uv_layout/__init__.py
index 2c525140..bd2c97bd 100644
--- a/io_mesh_uv_layout/__init__.py
+++ b/io_mesh_uv_layout/__init__.py
@@ -46,10 +46,6 @@ if "bpy" in locals():
 import os
 import bpy
 
-from . import export_uv_eps
-from . import export_uv_png
-from . import export_uv_svg
-
 from bpy.props import (
     StringProperty,
     BoolProperty,
@@ -221,10 +217,13 @@ class ExportUVLayout(bpy.types.Operator):
 
     def get_exporter(self):
         if self.mode == 'PNG':
+            from . import export_uv_png
             return export_uv_png.export
         elif self.mode == 'EPS':
+            from . import export_uv_eps
             return export_uv_eps.export
         elif self.mode == 'SVG':
+            from . import export_uv_svg
             return export_uv_svg.export
         else:
             assert False



More information about the Bf-extensions-cvs mailing list