Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2006-07-04 00:17:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-07-04 00:17:40 +0400
commitc4b4e2922fb7a219decd9702cd2924e2bc4117d4 (patch)
treea4bee370d405de7568e4bf1baa100fdd3d7338c3 /release/scripts/lightwave_import.py
parent64ff9ae4a846deb780c186893267f11bc40465d5 (diff)
more updates, mostly 2.3 error checking, nice messages when pythons not installed and some nendo import optimizations.
BPyMesh will work with the exception of the redux function in py2.3
Diffstat (limited to 'release/scripts/lightwave_import.py')
-rw-r--r--release/scripts/lightwave_import.py61
1 files changed, 20 insertions, 41 deletions
diff --git a/release/scripts/lightwave_import.py b/release/scripts/lightwave_import.py
index 0f24caa2f6e..d4799cfb171 100644
--- a/release/scripts/lightwave_import.py
+++ b/release/scripts/lightwave_import.py
@@ -50,6 +50,11 @@ importername = "lwo_import 0.3.0a - devel"
# +----------------------------------------------------------
# +---------------------------------------------------------+
# | Release log: |
+# | 0.2.2 : This code works with Blender 2.42 RC3 |
+# | Added a new PolyFill function for BPYMesh's |
+# | ngon() to use, checked compatibility |
+# | lightwaves ngons are imported as fgons |
+# | Checked compatibility against 1711 lwo files |
# | 0.2.1 : This code works with Blender 2.40 RC1 |
# | modified material mode assignment to deal with |
# | Python API modification |
@@ -85,8 +90,14 @@ import Blender
# use for comprehensiveImageLoad
import BPyImage
+# Use this ngon function
+import BPyMesh
+
#python specific modules import
-import struct, chunk, os, cStringIO
+try:
+ import struct, chunk, os, cStringIO
+except:
+ struct= chunk= os= cStringIO= None
# ===========================================================
# === Utility Preamble ======================================
@@ -1060,8 +1071,6 @@ def read_surfs(lwochunk, surf_list, tag_list):
-import BPyMesh
-reload(BPyMesh)
def reduce_face(verts, face):
TriangleArea= Blender.Mathutils.TriangleArea
Vector= Blender.Mathutils.Vector
@@ -1428,35 +1437,6 @@ def create_objects(clip_list, objspec_list, surf_list):
return
-# =====================
-# === Load an image ===
-# =====================
-#extensively search for image name
-"""
-def load_image(dir_part, name):
- img = None
- nname = os.path.splitext(name)
- lname = [c.lower() for c in nname]
- ext_list = [nname[1]]
- if lname[1] != nname[1]:
- ext_list.append(lname[1])
- ext_list.extend(['.tga', '.png', '.jpg', '.gif', '.bmp']) #order from best to worst (personal judgement) bmp last cause of nasty bug
- #first round: original "case"
- name_list = []
- name_list.extend([os.path.join(dir_part, nname[0] + ext) for ext in ext_list])
- #second round: lower "case"
- if lname[0] != nname[0]:
- name_list.extend([os.path.join(dir_part, lname[0] + ext) for ext in ext_list])
- for nn in name_list:
- if os.path.exists(nn) == 1:
- break
- try:
- img = Blender.Image.Load(nn)
- return img
- except IOError:
- return None
-"""
-
# ===========================================
# === Lookup for image index in clip_list ===
@@ -1788,16 +1768,15 @@ def read_faces_6(lwochunk):
tobj.pprint("read %s faces; type of block %d (0=FACE; 1=PATCH)" % (len(faces), subsurf))
return faces, subsurf
+def main():
+ if not struct:
+ Blender.Draw.PupMenu('This importer requires a full python install')
+ return
+
+ Blender.Window.FileSelector(read, "Import LWO", '*.lwo')
-
-# ===========================================================
-# === Start the show and main callback ======================
-# ===========================================================
-
-def fs_callback(filename):
- read(filename)
-
-Blender.Window.FileSelector(fs_callback, "Import LWO")
+if __name__=='__main__':
+ main()
# Cams debugging lwo loader
"""