[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [981] contrib/py/scripts/addons/ io_import_scene_lwo.py: reverse point order per-face to correct normal direction
Ken Nign
ken at virginpi.com
Sat Sep 4 02:42:19 CEST 2010
Revision: 981
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=981
Author: ken9
Date: 2010-09-04 02:42:19 +0200 (Sat, 04 Sep 2010)
Log Message:
-----------
reverse point order per-face to correct normal direction
added breaks when uvs and vertex colors can't be created
Modified Paths:
--------------
contrib/py/scripts/addons/io_import_scene_lwo.py
Modified: contrib/py/scripts/addons/io_import_scene_lwo.py
===================================================================
--- contrib/py/scripts/addons/io_import_scene_lwo.py 2010-09-03 16:19:14 UTC (rev 980)
+++ contrib/py/scripts/addons/io_import_scene_lwo.py 2010-09-04 00:42:19 UTC (rev 981)
@@ -36,6 +36,9 @@
# NGons, polygons with more than 4 points are supported, but are
# added (as triangles) after the vertex maps have been applied. Thus they
# won't contain all the vertex data that the original ngon had.
+#
+# Blender is limited to only 8 UV Texture and 8 Vertex Color maps,
+# thus only the first 8 of each can be imported.
bl_addon_info= {
@@ -43,11 +46,12 @@
"author": "Ken Nign (Ken9)",
"version": (1,0),
"blender": (2, 5, 3),
- "api": 31704,
+ "api": 31744,
"location": "File > Import > LightWave Object (.lwo)",
"description": "Imports a LWO file including any UV, Morph and Color maps. Can convert Skelegons to an Armature.",
"warning": "",
- "wiki_url": "",
+ "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
+ "Scripts/File_I-O/LightWave_Object",
"tracker_url": "",
"category": "Import/Export"}
@@ -924,6 +928,7 @@
ngons= {} # To keep the FaceIdx consistant, handle NGons later.
has_edges= False
for fi in range(len(layer_data.pols)):
+ layer_data.pols[fi].reverse() # Reversing gives correct normal directions
# PointID 0 in the last element causes Blender to think it's un-used.
if layer_data.pols[fi][-1] == 0:
layer_data.pols[fi].insert(0, layer_data.pols[fi][-1])
@@ -987,6 +992,8 @@
for cmap_key in layer_data.colmaps:
map_pack= create_mappack(layer_data, cmap_key, "COLOR")
vcol= me.vertex_colors.new(cmap_key)
+ if not vcol:
+ break
for fi in map_pack:
if fi > len(vcol.data):
continue
@@ -1006,6 +1013,8 @@
for uvmap_key in layer_data.uvmaps:
map_pack= create_mappack(layer_data, uvmap_key, "UV")
uvm= me.uv_textures.new(uvmap_key)
+ if not uvm:
+ break
for fi in map_pack:
if fi > len(uvm.data):
continue
More information about the Bf-extensions-cvs
mailing list