From fca80ff61e8bbce39bc2584a6ad7e7659577d1b1 Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Mon, 16 May 2011 07:52:45 +0000
Subject: [PATCH] update for changes in blender module layout, also add global
 axis conversion to FBX.

---
 add_mesh_ant_landscape.py                     |  4 +-
 .../add_mesh_3d_function_surface.py           |  4 +-
 .../add_mesh_extra_objects.py                 |  4 +-
 add_mesh_extra_objects/add_mesh_gears.py      |  4 +-
 add_mesh_extra_objects/add_mesh_gemstones.py  |  4 +-
 .../add_mesh_twisted_torus.py                 |  4 +-
 add_mesh_pipe_joint.py                        |  4 +-
 add_mesh_solid.py                             |  2 +-
 io_anim_bvh/__init__.py                       |  2 +-
 io_anim_camera.py                             |  2 +-
 io_convert_image_to_mesh_img/__init__.py      |  2 +-
 io_curve_svg/__init__.py                      |  2 +-
 io_export_pc2.py                              |  2 +-
 io_import_images_as_planes.py                 |  2 +-
 io_import_scene_mhx.py                        |  2 +-
 io_mesh_ply/__init__.py                       |  2 +-
 io_mesh_ply/import_ply.py                     |  2 +-
 io_mesh_raw/import_raw.py                     |  2 +-
 io_mesh_stl/__init__.py                       |  2 +-
 io_scene_3ds/__init__.py                      |  2 +-
 io_scene_3ds/export_3ds.py                    |  3 +-
 io_scene_3ds/import_3ds.py                    |  2 +-
 io_scene_fbx/__init__.py                      | 53 ++++++++++---------
 io_scene_fbx/export_fbx.py                    |  8 +--
 io_scene_m3/__init__.py                       |  2 +-
 io_scene_m3/import_m3.py                      |  2 +-
 io_scene_obj/__init__.py                      |  5 +-
 io_scene_obj/export_obj.py                    |  8 +--
 io_scene_obj/import_obj.py                    |  2 +-
 io_scene_x3d/__init__.py                      |  2 +-
 io_scene_x3d/export_x3d.py                    |  2 +-
 io_scene_x3d/import_x3d.py                    |  2 +-
 io_shape_mdd/__init__.py                      |  2 +-
 object_cloud_gen.py                           |  2 +-
 system_demo_mode/__init__.py                  |  2 +-
 texture_paint_layer_manager.py                |  2 +-
 36 files changed, 77 insertions(+), 76 deletions(-)

diff --git a/add_mesh_ant_landscape.py b/add_mesh_ant_landscape.py
index e287030dd..d7ca08d04 100644
--- a/add_mesh_ant_landscape.py
+++ b/add_mesh_ant_landscape.py
@@ -94,8 +94,8 @@ def create_mesh_object(context, verts, edges, faces, name):
     # Update mesh geometry after adding stuff.
     mesh.update()
 
-    import add_object_utils
-    return add_object_utils.object_data_add(context, mesh, operator=None)
+    from bpy_extras import object_utils
+    return object_utils.object_data_add(context, mesh, operator=None)
 
 # A very simple "bridge" tool.
 # Connects two equally long vertex rows with faces.
diff --git a/add_mesh_extra_objects/add_mesh_3d_function_surface.py b/add_mesh_extra_objects/add_mesh_3d_function_surface.py
index e415813ab..7b0bd8c0a 100644
--- a/add_mesh_extra_objects/add_mesh_3d_function_surface.py
+++ b/add_mesh_extra_objects/add_mesh_3d_function_surface.py
@@ -140,8 +140,8 @@ def create_mesh_object(context, verts, edges, faces, name):
     # Update mesh geometry after adding stuff.
     mesh.update()
 
-    import add_object_utils
-    return add_object_utils.object_data_add(context, mesh, operator=None)
+    from bpy_extras import object_utils
+    return object_utils.object_data_add(context, mesh, operator=None)
 
 
 # A very simple "bridge" tool.
diff --git a/add_mesh_extra_objects/add_mesh_extra_objects.py b/add_mesh_extra_objects/add_mesh_extra_objects.py
index f87bb0442..c5caa1203 100644
--- a/add_mesh_extra_objects/add_mesh_extra_objects.py
+++ b/add_mesh_extra_objects/add_mesh_extra_objects.py
@@ -38,8 +38,8 @@ def create_mesh_object(context, verts, edges, faces, name):
     # Update mesh geometry after adding stuff.
     mesh.update()
 
-    import add_object_utils
-    return add_object_utils.object_data_add(context, mesh, operator=None)
+    from bpy_extras import object_utils
+    return object_utils.object_data_add(context, mesh, operator=None)
 
 
 # A very simple "bridge" tool.
diff --git a/add_mesh_extra_objects/add_mesh_gears.py b/add_mesh_extra_objects/add_mesh_gears.py
index 47cc950e8..a04e6bebe 100644
--- a/add_mesh_extra_objects/add_mesh_gears.py
+++ b/add_mesh_extra_objects/add_mesh_gears.py
@@ -87,8 +87,8 @@ def create_mesh_object(context, verts, edges, faces, name):
     # Update mesh geometry after adding stuff.
     mesh.update()
 
-    import add_object_utils
-    return add_object_utils.object_data_add(context, mesh, operator=None)
+    from bpy_extras import object_utils
+    return object_utils.object_data_add(context, mesh, operator=None)
 
 
 # A very simple "bridge" tool.
diff --git a/add_mesh_extra_objects/add_mesh_gemstones.py b/add_mesh_extra_objects/add_mesh_gemstones.py
index 9af8cdb66..d4158b689 100644
--- a/add_mesh_extra_objects/add_mesh_gemstones.py
+++ b/add_mesh_extra_objects/add_mesh_gemstones.py
@@ -53,8 +53,8 @@ def create_mesh_object(context, verts, edges, faces, name):
     # Update mesh geometry after adding stuff.
     mesh.update()
 
-    import add_object_utils
-    return add_object_utils.object_data_add(context, mesh, operator=None)
+    from bpy_extras import object_utils
+    return object_utils.object_data_add(context, mesh, operator=None)
 
 
 # A very simple "bridge" tool.
diff --git a/add_mesh_extra_objects/add_mesh_twisted_torus.py b/add_mesh_extra_objects/add_mesh_twisted_torus.py
index 82edee6b2..6eb8cc245 100644
--- a/add_mesh_extra_objects/add_mesh_twisted_torus.py
+++ b/add_mesh_extra_objects/add_mesh_twisted_torus.py
@@ -68,8 +68,8 @@ def create_mesh_object(context, verts, edges, faces, name):
     # Update mesh geometry after adding stuff.
     mesh.update()
 
-    import add_object_utils
-    return add_object_utils.object_data_add(context, mesh, operator=None)
+    from bpy_extras import object_utils
+    return object_utils.object_data_add(context, mesh, operator=None)
 
 # A very simple "bridge" tool.
 # Connects two equally long vertex rows with faces.
diff --git a/add_mesh_pipe_joint.py b/add_mesh_pipe_joint.py
index 6156d4591..69b547ed5 100644
--- a/add_mesh_pipe_joint.py
+++ b/add_mesh_pipe_joint.py
@@ -148,8 +148,8 @@ def create_mesh_object(context, verts, edges, faces, name):
     # Update mesh geometry after adding stuff.
     mesh.update()
 
-    import add_object_utils
-    return add_object_utils.object_data_add(context, mesh, operator=None)
+    from bpy_extras import object_utils
+    return object_utils.object_data_add(context, mesh, operator=None)
 
 # A very simple "bridge" tool.
 # Connects two equally long vertex rows with faces.
diff --git a/add_mesh_solid.py b/add_mesh_solid.py
index f8e4f3b4e..01825d291 100644
--- a/add_mesh_solid.py
+++ b/add_mesh_solid.py
@@ -37,7 +37,7 @@ from bpy.props import FloatProperty,EnumProperty,BoolProperty
 from math import sqrt
 from mathutils import Vector,Matrix
 from functools import reduce
-from add_object_utils import object_data_add
+from bpy_extras.object_utils import object_data_add
 
 # this function creates a chain of quads and, when necessary, a remaining tri
 # for each polygon created in this script. be aware though, that this function
diff --git a/io_anim_bvh/__init__.py b/io_anim_bvh/__init__.py
index 5cdc79f2f..94d048f67 100644
--- a/io_anim_bvh/__init__.py
+++ b/io_anim_bvh/__init__.py
@@ -42,7 +42,7 @@ if "bpy" in locals():
 
 import bpy
 from bpy.props import StringProperty, FloatProperty, IntProperty, BoolProperty, EnumProperty
-from io_utils import ImportHelper, ExportHelper
+from bpy_extras.io_utils import ImportHelper, ExportHelper
 
 
 class ImportBVH(bpy.types.Operator, ImportHelper):
diff --git a/io_anim_camera.py b/io_anim_camera.py
index 22b2cf0d6..2026254de 100644
--- a/io_anim_camera.py
+++ b/io_anim_camera.py
@@ -115,7 +115,7 @@ def writeCameras(context, filepath, frame_start, frame_end, only_selected=False)
 
 
 from bpy.props import StringProperty, IntProperty, BoolProperty
-from io_utils import ExportHelper
+from bpy_extras.io_utils import ExportHelper
 
 
 class CameraExporter(bpy.types.Operator, ExportHelper):
diff --git a/io_convert_image_to_mesh_img/__init__.py b/io_convert_image_to_mesh_img/__init__.py
index 93e3ac252..e3309617a 100644
--- a/io_convert_image_to_mesh_img/__init__.py
+++ b/io_convert_image_to_mesh_img/__init__.py
@@ -50,7 +50,7 @@ else:
 
 import bpy
 from bpy.props import *
-from io_utils import ImportHelper
+from bpy_extras.io_utils import ImportHelper
 
 
 class ImportHiRISEIMGDTM(bpy.types.Operator, ImportHelper):
diff --git a/io_curve_svg/__init__.py b/io_curve_svg/__init__.py
index cf5ad416e..dc68490b1 100644
--- a/io_curve_svg/__init__.py
+++ b/io_curve_svg/__init__.py
@@ -43,7 +43,7 @@ if "bpy" in locals():
 
 import bpy
 from bpy.props import StringProperty
-from io_utils import ImportHelper, ExportHelper
+from bpy_extras.io_utils import ImportHelper, ExportHelper
 
 
 class ImportSVG(bpy.types.Operator, ImportHelper):
diff --git a/io_export_pc2.py b/io_export_pc2.py
index 53303fc44..f91706523 100644
--- a/io_export_pc2.py
+++ b/io_export_pc2.py
@@ -44,7 +44,7 @@ from bpy.props import *
 import mathutils, math, struct
 from os import remove
 import time
-from io_utils import ExportHelper
+from bpy_extras.io_utils import ExportHelper
 
 def getSampling(start, end, sampling):
     samples = [start - sampling
diff --git a/io_import_images_as_planes.py b/io_import_images_as_planes.py
index c4191fc06..38c8efdc3 100644
--- a/io_import_images_as_planes.py
+++ b/io_import_images_as_planes.py
@@ -35,7 +35,7 @@ bl_info = {
 import bpy, os, mathutils
 from bpy.props import *
 from add_utils import *
-from io_utils import ImportHelper, load_image
+from bpy_extras.io_utils import ImportHelper, load_image
 
 ## GLOBAL VARS ##
 EXT_LIST = {
diff --git a/io_import_scene_mhx.py b/io_import_scene_mhx.py
index 386423904..e861fcf88 100644
--- a/io_import_scene_mhx.py
+++ b/io_import_scene_mhx.py
@@ -2617,7 +2617,7 @@ def writeDefaults():
 
 DEBUG = False
 from bpy.props import StringProperty, FloatProperty, EnumProperty, BoolProperty
-from io_utils import ImportHelper
+from bpy_extras.io_utils import ImportHelper
 
 
 MhxBoolProps = [
diff --git a/io_mesh_ply/__init__.py b/io_mesh_ply/__init__.py
index eabfc54ef..e8384923d 100644
--- a/io_mesh_ply/__init__.py
+++ b/io_mesh_ply/__init__.py
@@ -44,7 +44,7 @@ if "bpy" in locals():
 import os
 import bpy
 from bpy.props import CollectionProperty, StringProperty, BoolProperty
-from io_utils import ImportHelper, ExportHelper
+from bpy_extras.io_utils import ImportHelper, ExportHelper
 
 
 class ImportPLY(bpy.types.Operator, ImportHelper):
diff --git a/io_mesh_ply/import_ply.py b/io_mesh_ply/import_ply.py
index fc87e66ed..bd5250650 100644
--- a/io_mesh_ply/import_ply.py
+++ b/io_mesh_ply/import_ply.py
@@ -207,7 +207,7 @@ import bpy
 
 def load_ply(filepath):
     import time
-    from io_utils import load_image, unpack_list, unpack_face_list
+    from bpy_extras.io_utils import load_image, unpack_list, unpack_face_list
 
     t = time.time()
     obj_spec, obj = read(filepath)
diff --git a/io_mesh_raw/import_raw.py b/io_mesh_raw/import_raw.py
index eb7725856..047245449 100644
--- a/io_mesh_raw/import_raw.py
+++ b/io_mesh_raw/import_raw.py
@@ -43,7 +43,7 @@ tolerance.
 import bpy
 
 # move those to a utility modul
-from io_utils import unpack_face_list, unpack_list # TODO, make generic
+from bpy_extras.io_utils import unpack_face_list, unpack_list # TODO, make generic
 
 
 def readMesh(filename, objName):
diff --git a/io_mesh_stl/__init__.py b/io_mesh_stl/__init__.py
index 24e1650d0..48c37af46 100644
--- a/io_mesh_stl/__init__.py
+++ b/io_mesh_stl/__init__.py
@@ -60,7 +60,7 @@ import os
 
 import bpy
 from bpy.props import StringProperty, BoolProperty, CollectionProperty
-from io_utils import ExportHelper, ImportHelper
+from bpy_extras.io_utils import ExportHelper, ImportHelper
 
 
 class ImportSTL(bpy.types.Operator, ImportHelper):
diff --git a/io_scene_3ds/__init__.py b/io_scene_3ds/__init__.py
index 21bed64ac..4915512a7 100644
--- a/io_scene_3ds/__init__.py
+++ b/io_scene_3ds/__init__.py
@@ -43,7 +43,7 @@ if "bpy" in locals():
 
 import bpy
 from bpy.props import StringProperty, FloatProperty, BoolProperty
-from io_utils import ImportHelper, ExportHelper
+from bpy_extras.io_utils import ImportHelper, ExportHelper
 
 
 class Import3DS(bpy.types.Operator, ImportHelper):
diff --git a/io_scene_3ds/export_3ds.py b/io_scene_3ds/export_3ds.py
index bf7bd9909..8def27b16 100644
--- a/io_scene_3ds/export_3ds.py
+++ b/io_scene_3ds/export_3ds.py
@@ -893,8 +893,7 @@ def save(operator, context, filepath="",
 
     import bpy
     import time
-    import io_utils
-    from io_utils import create_derived_objects, free_derived_objects
+    from bpy_extras.io_utils import create_derived_objects, free_derived_objects
 
     '''Save the Blender scene to a 3ds file.'''
 
diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py
index 1aea63849..d66ace47c 100644
--- a/io_scene_3ds/import_3ds.py
+++ b/io_scene_3ds/import_3ds.py
@@ -25,7 +25,7 @@ import os
 import time
 import struct
 
-from io_utils import load_image
+from bpy_extras.io_utils import load_image
 
 import bpy
 import mathutils
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 33651d2a5..dafc4e15f 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -41,8 +41,7 @@ if "bpy" in locals():
 
 import bpy
 from bpy.props import StringProperty, BoolProperty, FloatProperty, EnumProperty
-import io_utils
-from io_utils import ExportHelper
+from bpy_extras.io_utils import ExportHelper, path_reference_mode, axis_conversion
 
 
 class ExportFBX(bpy.types.Operator, ExportHelper):
@@ -61,15 +60,28 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
 # 	EXP_OBS_SCENE = BoolProperty(name="Scene Objects", description="Export all objects in this scene", default=True)
     global_scale = FloatProperty(name="Scale", description="Scale all data, (Note! some imports dont support scaled armatures)", min=0.01, max=1000.0, soft_min=0.01, soft_max=1000.0, default=1.0)
 
-    global_rotate = EnumProperty(
-            name="Rotate",
-            options={'ENUM_FLAG'},
-            items=(('X_90', "X 90", ""),
-                   ('Y_90', "Y 90", ""),
-                   ('Z_90', "Z 90", ""),
+    global_axis_forward = EnumProperty(
+            name="Forward",
+            items=(('X', "X Forward", ""),
+                   ('Y', "Y Forward", ""),
+                   ('Z', "Z Forward", ""),
+                   ('-X', "-X Forward", ""),
+                   ('-Y', "-Y Forward", ""),
+                   ('-Z', "-Z Forward", ""),
+                   ),
+            default='Y',
+            )
+
+    global_axis_up = EnumProperty(
+            name="Up",
+            items=(('X', "X Up", ""),
+                   ('Y', "Y Up", ""),
+                   ('Z', "Z Up", ""),
+                   ('-X', "-X Up", ""),
+                   ('-Y', "-Y Up", ""),
+                   ('-Z', "-Z Up", ""),
                    ),
-            default={'X_90'},
-            description="Global rotation to apply to the exported scene",
+            default='Z',
             )
 
     object_types = EnumProperty(
@@ -84,7 +96,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
             default={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH'},
             )
 
-    mesh_apply_modifiers = BoolProperty(name="Modifiers", description="Apply modifiers to mesh objects", default=True)
+    mesh_apply_modifiers = BoolProperty(name="Apply Modifiers", description="Apply modifiers to mesh objects", default=True)
 
     mesh_smooth_type = EnumProperty(
             name="Smoothing",
@@ -114,7 +126,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
     BATCH_OWN_DIR = BoolProperty(name="Own Dir", description="Create a dir for each exported file", default=True)
     use_metadata = BoolProperty(name="Use Metadata", default=True, options={'HIDDEN'})
 
-    path_mode = io_utils.path_reference_mode
+    path_mode = path_reference_mode
 
     @property
     def check_extension(self):
@@ -126,22 +138,13 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
         if not self.filepath:
             raise Exception("filepath not set")
 
-        mtx4_x90n = Matrix.Rotation(-math.pi / 2.0, 4, 'X')
-        mtx4_y90n = Matrix.Rotation(-math.pi / 2.0, 4, 'Y')
-        mtx4_z90n = Matrix.Rotation(-math.pi / 2.0, 4, 'Z')
-
         GLOBAL_MATRIX = Matrix()
         GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.global_scale
-        if 'X_90' in self.global_rotate:
-            GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX
-        if 'Y_90' in self.global_rotate:
-            GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
-        if 'Z_90' in self.global_rotate:
-            GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
-
-        keywords = self.as_keywords(ignore=("global_rotate", "global_scale", "check_existing", "filter_glob"))
-        keywords["GLOBAL_MATRIX"] = GLOBAL_MATRIX
+        GLOBAL_MATRIX = GLOBAL_MATRIX * axis_conversion(to_forward=self.global_axis_forward, to_up=self.global_axis_up).to_4x4()
 
+        keywords = self.as_keywords(ignore=("global_axis_forward", "global_axis_up", "global_scale", "check_existing", "filter_glob"))
+        keywords["GLOBAL_MATRIX"] = GLOBAL_MATRIX
+        print(GLOBAL_MATRIX)
         from . import export_fbx
         return export_fbx.save(self, context, **keywords)
 
diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py
index 47bbb178b..16789bf9a 100644
--- a/io_scene_fbx/export_fbx.py
+++ b/io_scene_fbx/export_fbx.py
@@ -214,7 +214,7 @@ def save_single(operator, scene, filepath="",
         path_mode='AUTO',
     ):
 
-    import io_utils
+    import bpy_extras.io_utils
 
     mtx_x90 = Matrix.Rotation(math.pi / 2.0, 3, 'X')
     mtx4_z90 = Matrix.Rotation(math.pi / 2.0, 4, 'Z')
@@ -1097,7 +1097,7 @@ def save_single(operator, scene, filepath="",
             Property: "Width", "int", "",0
             Property: "Height", "int", "",0''')
         if tex:
-            fname_rel = io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set)
+            fname_rel = bpy_extras.io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set)
             fname_strip = os.path.basename(fname_rel)
         else:
             fname_strip = fname_rel = ""
@@ -1156,7 +1156,7 @@ def save_single(operator, scene, filepath="",
         file.write('\n\t\tMedia: "Video::%s"' % texname)
 
         if tex:
-            fname_rel = io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set)
+            fname_rel = bpy_extras.io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set)
             fname_strip = os.path.basename(fname_rel)
         else:
             fname_strip = fname_rel = ""
@@ -2747,7 +2747,7 @@ Takes:  {''')
     file.close()
 
     # copy all collected files.
-    io_utils.path_reference_copy(copy_set)
+    bpy_extras.io_utils.path_reference_copy(copy_set)
 
     print('export finished in %.4f sec.' % (time.clock() - start_time))
     return {'FINISHED'}
diff --git a/io_scene_m3/__init__.py b/io_scene_m3/__init__.py
index cde21f586..78c2498d2 100644
--- a/io_scene_m3/__init__.py
+++ b/io_scene_m3/__init__.py
@@ -47,7 +47,7 @@ import time
 import datetime
 import bpy
 from bpy.props import StringProperty, BoolProperty
-from io_utils import ImportHelper, ExportHelper
+from bpy_extras.io_utils import ImportHelper, ExportHelper
 
 
 class ImportM3(bpy.types.Operator, ImportHelper):
diff --git a/io_scene_m3/import_m3.py b/io_scene_m3/import_m3.py
index ec0a635f7..a3e42e70f 100644
--- a/io_scene_m3/import_m3.py
+++ b/io_scene_m3/import_m3.py
@@ -56,7 +56,7 @@ import mathutils
 import struct
 import os.path
 from bpy.props import *
-from io_utils import load_image
+from bpy_extras.io_utils import load_image
 
 ##################
 ## Struct setup ##
diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py
index a990afe61..b5f3cb9b9 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -43,8 +43,7 @@ if "bpy" in locals():
 
 import bpy
 from bpy.props import BoolProperty, FloatProperty, StringProperty, EnumProperty
-import io_utils
-from io_utils import ExportHelper, ImportHelper
+from bpy_extras.io_utils import ExportHelper, ImportHelper, path_reference_mode
 
 
 class ImportOBJ(bpy.types.Operator, ImportHelper):
@@ -158,7 +157,7 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
     group_by_material = BoolProperty(name="Material Groups", description="", default=False)
     keep_vertex_order = BoolProperty(name="Keep Vertex Order", description="", default=False)
 
-    path_mode = io_utils.path_reference_mode
+    path_mode = path_reference_mode
 
     def execute(self, context):
         from . import export_obj
diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index b2537696d..5c24fbf7a 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -24,7 +24,7 @@ import shutil
 
 import bpy
 import mathutils
-import io_utils
+import bpy_extras.io_utils
 
 
 def name_compat(name):
@@ -108,7 +108,7 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
         # Write images!
         if face_img:  # We have an image on the face!
             # write relative image path
-            rel = io_utils.path_reference(face_img.filepath, source_dir, dest_dir, path_mode, "", copy_set)
+            rel = bpy_extras.io_utils.path_reference(face_img.filepath, source_dir, dest_dir, path_mode, "", copy_set)
             file.write('map_Kd %s\n' % rel)  # Diffuse mapping image
 
         if mat:  # No face image. if we havea material search for MTex image.
@@ -135,7 +135,7 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
                             image_map["map_Ns"] = image
 
             for key, image in image_map.items():
-                filepath = io_utils.path_reference(image.filepath, source_dir, dest_dir, path_mode, "", copy_set)
+                filepath = bpy_extras.io_utils.path_reference(image.filepath, source_dir, dest_dir, path_mode, "", copy_set)
                 file.write('%s %s\n' % (key, repr(filepath)[1:-1]))
 
         file.write('\n\n')
@@ -650,7 +650,7 @@ def write_file(filepath, objects, scene,
         write_mtl(scene, mtlfilepath, EXPORT_PATH_MODE, copy_set, mtl_dict)
 
     # copy all collected files.
-    io_utils.path_reference_copy(copy_set)
+    bpy_extras.io_utils.path_reference_copy(copy_set)
 
     print("OBJ Export time: %.2f" % (time.clock() - time1))
 
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index d37608ca8..a97081215 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -36,7 +36,7 @@ import time
 import bpy
 import mathutils
 from mathutils.geometry import tesselate_polygon
-from io_utils import load_image, unpack_list, unpack_face_list
+from bpy_extras.io_utils import load_image, unpack_list, unpack_face_list
 
 
 def BPyMesh_ngon(from_data, indices, PREF_FIX_LOOPS=True):
diff --git a/io_scene_x3d/__init__.py b/io_scene_x3d/__init__.py
index f3b6dad65..9da017354 100644
--- a/io_scene_x3d/__init__.py
+++ b/io_scene_x3d/__init__.py
@@ -41,7 +41,7 @@ if "bpy" in locals():
 
 import bpy
 from bpy.props import StringProperty, BoolProperty
-from io_utils import ImportHelper, ExportHelper
+from bpy_extras.io_utils import ImportHelper, ExportHelper
 
 
 class ImportX3D(bpy.types.Operator, ImportHelper):
diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py
index 94bb3bd58..391f8ec32 100644
--- a/io_scene_x3d/export_x3d.py
+++ b/io_scene_x3d/export_x3d.py
@@ -39,7 +39,7 @@ import os
 import bpy
 import mathutils
 
-from io_utils import create_derived_objects, free_derived_objects
+from bpy_extras.io_utils import create_derived_objects, free_derived_objects
 
 
 def round_color(col, cp):
diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py
index fe8a15895..9a20db265 100644
--- a/io_scene_x3d/import_x3d.py
+++ b/io_scene_x3d/import_x3d.py
@@ -1432,7 +1432,7 @@ for i, f in enumerate(files):
 # NO BLENDER CODE ABOVE THIS LINE.
 # -----------------------------------------------------------------------------------
 import bpy
-import image_utils
+from bpy_extras import image_utils
 # import BPyImage
 # import BPySys
 # reload(BPySys)
diff --git a/io_shape_mdd/__init__.py b/io_shape_mdd/__init__.py
index be9334ada..bc195735b 100644
--- a/io_shape_mdd/__init__.py
+++ b/io_shape_mdd/__init__.py
@@ -43,7 +43,7 @@ if "bpy" in locals():
 
 import bpy
 from bpy.props import StringProperty, IntProperty
-from io_utils import ExportHelper, ImportHelper
+from bpy_extras.io_utils import ExportHelper, ImportHelper
 
 
 class ImportMDD(bpy.types.Operator, ImportHelper):
diff --git a/object_cloud_gen.py b/object_cloud_gen.py
index 0b74e8638..954e5cf15 100644
--- a/object_cloud_gen.py
+++ b/object_cloud_gen.py
@@ -655,7 +655,7 @@ class GenerateCloud(bpy.types.Operator):
                 cldPntsModifiers[0].name = "CloudPnts"
                 cldPntsModifiers[0].texture = cloudtex
                 cldPntsModifiers[0].texture_coords = 'OBJECT'
-                cldPntsModifiers[0].texture_coordinate_object = cloud
+                cldPntsModifiers[0].texture_coords_object = cloud
                 cldPntsModifiers[0].strength = -1.4
 
                 # Apply modifier
diff --git a/system_demo_mode/__init__.py b/system_demo_mode/__init__.py
index cc568c11a..902ed37b0 100644
--- a/system_demo_mode/__init__.py
+++ b/system_demo_mode/__init__.py
@@ -41,7 +41,7 @@ if "bpy" in locals():
 
 import bpy
 from bpy.props import StringProperty, BoolProperty, IntProperty, FloatProperty, EnumProperty
-from io_utils import ImportHelper
+from bpy_extras.io_utils import ImportHelper
 
 
 class DemoModeSetup(bpy.types.Operator):
diff --git a/texture_paint_layer_manager.py b/texture_paint_layer_manager.py
index b3f2d088e..bff56c3da 100644
--- a/texture_paint_layer_manager.py
+++ b/texture_paint_layer_manager.py
@@ -15,7 +15,7 @@ bl_info = {
 import bpy
 from bpy.props import*
 import os
-from io_utils import ImportHelper
+from bpy_extras.io_utils import ImportHelper
 
 
 #-------------------------------------------
-- 
GitLab