[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3323] trunk/py/scripts/addons/ io_import_scene_mhx.py: BMesh check made to work even if bpy.app. build_revision is unknown.

Thomas Larsson thomas_larsson_01 at hotmail.com
Mon Apr 30 05:20:21 CEST 2012


Revision: 3323
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3323
Author:   thomasl
Date:     2012-04-30 03:20:17 +0000 (Mon, 30 Apr 2012)
Log Message:
-----------
BMesh check made to work even if bpy.app.build_revision is unknown.

Modified Paths:
--------------
    trunk/py/scripts/addons/io_import_scene_mhx.py

Modified: trunk/py/scripts/addons/io_import_scene_mhx.py
===================================================================
--- trunk/py/scripts/addons/io_import_scene_mhx.py	2012-04-29 23:34:43 UTC (rev 3322)
+++ trunk/py/scripts/addons/io_import_scene_mhx.py	2012-04-30 03:20:17 UTC (rev 3323)
@@ -194,10 +194,9 @@
 #
 
 def readMhxFile(filePath):
-    global todo, nErrors, theScale, defaultScale, One, toggle, warnedVersion, BMeshAware, theMessage
+    global todo, nErrors, theScale, defaultScale, One, toggle, warnedVersion, theMessage
 
     print("Blender r%s" % bpy.app.build_revision)
-    BMeshAware = (int(bpy.app.build_revision) > 44136)    
     defaultScale = theScale
     One = 1.0/theScale
     warnedVersion = False
@@ -1191,7 +1190,7 @@
 #
 
 def parseMesh (args, tokens):
-    global todo
+    global todo, BMeshAware
     if verbosity > 2:
         print( "Parsing mesh %s" % args )
 
@@ -1220,6 +1219,15 @@
         me.from_pydata(verts, edges, [])
     me.update()
     linkObject(ob, me)
+    
+    if faces:
+        try:
+            me.polygons
+            BMeshAware = True
+            print("Using BMesh")
+        except:
+            BMeshAware = False
+            print("Not using BMesh")
         
     mats = []
     nuvlayers = 0



More information about the Bf-extensions-cvs mailing list