[Bf-extensions-cvs] [a1d1012] master: Some minor cleanup, mostly enhance reload (F8) behavior!

Bastien Montagne noreply at git.blender.org
Sun Jul 6 19:15:49 CEST 2014


Commit: a1d1012a0c4aca65e22203e7a4eb00d6c4390fc0
Author: Bastien Montagne
Date:   Sun Jul 6 15:32:14 2014 +0200
https://developer.blender.org/rBAa1d1012a0c4aca65e22203e7a4eb00d6c4390fc0

Some minor cleanup, mostly enhance reload (F8) behavior!

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

M	io_scene_fbx/__init__.py
M	io_scene_fbx/export_fbx_bin.py
M	io_scene_fbx/fbx_utils.py
M	io_scene_fbx/import_fbx.py

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

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index e3cbb22..6e0c105 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -34,13 +34,13 @@ bl_info = {
 
 
 if "bpy" in locals():
-    import imp
+    import importlib
     if "import_fbx" in locals():
-        imp.reload(import_fbx)
+        importlib.reload(import_fbx)
     if "export_fbx_bin" in locals():
-        imp.reload(export_fbx_bin)
+        importlib.reload(export_fbx_bin)
     if "export_fbx" in locals():
-        imp.reload(export_fbx)
+        importlib.reload(export_fbx)
 
 
 import bpy
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index c80615a..483f0db 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -30,11 +30,20 @@ import time
 from collections import OrderedDict
 from itertools import zip_longest, chain
 
+if "bpy" in locals():
+    import importlib
+    if "encode_bin" in locals():
+        importlib.reload(encode_bin)
+    if "data_types" in locals():
+        importlib.reload(data_types)
+    if "fbx_utils" in locals():
+        importlib.reload(fbx_utils)
+
 import bpy
 import bpy_extras
 from mathutils import Vector, Matrix
 
-from . import encode_bin, data_types
+from . import encode_bin, data_types, fbx_utils
 from .fbx_utils import (
     # Constants.
     FBX_VERSION, FBX_HEADER_VERSION, FBX_SCENEINFO_VERSION, FBX_TEMPLATES_VERSION,
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index 5ee70fe..465688a 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -523,7 +523,7 @@ def elem_props_template_finalize(template, elem):
     """
     Finalize one element's template/props.
     Issue is, some templates might be "needed" by different types (e.g. NodeAttribute is for lights, cameras, etc.),
-    but values for only *one* subtype can be written as template. So we have to be sure we write those for ths other
+    but values for only *one* subtype can be written as template. So we have to be sure we write those for the other
     subtypes in each and every elements, if they are not overriden by that element.
     Yes, hairy, FBX that is to say. When they could easily support several subtypes per template... :(
     """
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 3d165ca..0ee770f 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -20,21 +20,27 @@
 
 # Script copyright (C) Blender Foundation
 
-# FBX 7.1.0 -> 7.3.0 loader for Blender
+# FBX 7.1.0 -> 7.4.0 loader for Blender
 
 # Not totally pep8 compliant.
 #   pep8 import_fbx.py --ignore=E501,E123,E702,E125
 
+if "bpy" in locals():
+    import importlib
+    if "parse_fbx" in locals():
+        importlib.reload(parse_fbx)
 
 import bpy
 
-# global singleton, assign on execution
-fbx_elem_nil = None
-
 # -----
 # Utils
+from . import parse_fbx
+
 from .parse_fbx import data_types, FBXElem
 
+# global singleton, assign on execution
+fbx_elem_nil = None
+
 
 def tuple_deg_to_rad(eul):
     return (eul[0] / 57.295779513,
@@ -118,10 +124,6 @@ def elem_props_find_first(elem, elem_prop_id):
         for e in elem:
             result = elem_props_find_first(e, elem_prop_id)
             if result is not None:
-                '''
-                if e is elem[1]:
-                    print("Using templ!!!", elem_prop_id)
-                '''
                 return result
         assert(len(elem) > 0)
         return None
@@ -145,7 +147,6 @@ def elem_props_get_color_rgb(elem, elem_prop_id, default=None):
         else:
             assert(elem_prop.props[1] == b'ColorRGB')
             assert(elem_prop.props[2] == b'Color')
-            #print(elem_prop.props_type[4:7])
         assert(elem_prop.props_type[4:7] == bytes((data_types.FLOAT64,)) * 3)
         return elem_prop.props[4:7]
     return default
@@ -1064,7 +1065,6 @@ def load(operator, context, filepath="",
 
     def _():
         for fbx_link in fbx_connections.elems:
-            # print(fbx_link)
             c_type = fbx_link.props[0]
             if fbx_link.props_type[1:3] == b'LL':
                 c_src, c_dst = fbx_link.props[1:3]
@@ -1190,7 +1190,6 @@ def load(operator, context, filepath="",
                     ok = True
                     break
             if ok:
-                # print(fbx_lnk_type)
                 # create when linking since we need object data
                 obj = blen_read_object(fbx_tmpl, fbx_obj, fbx_lnk_item)
                 assert(fbx_item[1] is None)
@@ -1484,5 +1483,4 @@ def load(operator, context, filepath="",
                                 material.use_raytrace = False
     _(); del _
 
-    # print(list(sorted(locals().keys())))
     return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list