From 311d7e31cc51cb2f5a10bb53727f9036272d0f96 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Aug 2007 10:19:16 +0000 Subject: [PATCH] minor changes from stable --- release/scripts/3ds_import.py | 13 +++++-- release/scripts/export_fbx.py | 1 + release/scripts/lightwave_import.py | 53 ++++++----------------------- 3 files changed, 21 insertions(+), 46 deletions(-) diff --git a/release/scripts/3ds_import.py b/release/scripts/3ds_import.py index 56acc50e38d..8324b668284 100644 --- a/release/scripts/3ds_import.py +++ b/release/scripts/3ds_import.py @@ -1,7 +1,7 @@ #!BPY """ Name: '3D Studio (.3ds)...' -Blender: 241 +Blender: 244 Group: 'Import' Tooltip: 'Import from 3DS file format (.3ds)' """ @@ -945,6 +945,7 @@ if __name__=='__main__' and not DEBUG: #load_3ds('/metavr/convert/vehicle/truck_002/TruckTanker1.3DS', False) #load_3ds('/metavr/archive/convert/old/arranged_3ds_to_hpx-2/only-need-engine-trains/Engine2.3DS', False) ''' + else: # DEBUG ONLY TIME= Blender.sys.time() @@ -956,6 +957,11 @@ else: file= open('/tmp/temp3ds_list', 'r') lines= file.readlines() file.close() + # sort by filesize for faster testing + lines_size = [(os.path.getsize(f[:-1]), f[:-1]) for f in lines] + lines_size.sort() + lines = [f[1] for f in lines_size] + def between(v,a,b): if v <= max(a,b) and v >= min(a,b): @@ -963,8 +969,8 @@ else: return False for i, _3ds in enumerate(lines): - if between(i, 1,200): - _3ds= _3ds[:-1] + if between(i, 650,800): + #_3ds= _3ds[:-1] print 'Importing', _3ds, '\nNUMBER', i, 'of', len(lines) _3ds_file= _3ds.split('/')[-1].split('\\')[-1] newScn= Blender.Scene.New(_3ds_file) @@ -972,4 +978,5 @@ else: load_3ds(_3ds, False) print 'TOTAL TIME: %.6f' % (Blender.sys.time() - TIME) + ''' \ No newline at end of file diff --git a/release/scripts/export_fbx.py b/release/scripts/export_fbx.py index a4a4787d5f3..320211a8f77 100644 --- a/release/scripts/export_fbx.py +++ b/release/scripts/export_fbx.py @@ -706,6 +706,7 @@ def write_scene(file, sce, world): textures = {} armatures = [] # We should export standalone armatures also armatures_totbones = 0 # we need this because each bone is a model + ob_type = None # incase no objects are exported, so as not to raise an error for ob_base in sce.objects.context: for ob, mtx in BPyObject.getDerivedObjects(ob_base): #for ob in [ob_base,]: diff --git a/release/scripts/lightwave_import.py b/release/scripts/lightwave_import.py index eb2447090fe..24e072f018a 100644 --- a/release/scripts/lightwave_import.py +++ b/release/scripts/lightwave_import.py @@ -1006,46 +1006,6 @@ def read_surfs(lwochunk, surf_list, tag_list): ###if DEBUG: print "-> Material pre-allocated." return my_dict - - -def reduce_face(verts, face): - - ####if DEBUG: print len(face), face - # wants indicies local to the face - len_face= len(face) - - - # Dont do this, its no good - odd quads are ok and used in subsurf modeling - """ - TriangleArea= Blender.Mathutils.TriangleArea - if len_face==3: - return [face] - elif len_face==4: - vecs= [Vector(verts[i]) for i in face] - # Get the convave quad area - a1= TriangleArea(vecs[0], vecs[1], vecs[2]) - a2= TriangleArea(vecs[0], vecs[2], vecs[3]) - - a3= TriangleArea(vecs[0], vecs[1], vecs[3]) - a4= TriangleArea(vecs[1], vecs[2], vecs[3]) - - if abs((a1+a2) - (a3+a4)) < (a1+a2+a3+a4)/100: # Not convace - ####if DEBUG: print 'planer' - return [[0,1,2,3]] - if a1+a2 4: - meta_faces= reduce_face(complete_vertlist, cur_face) # Indices of triangles + meta_faces= BPyMesh.ngon(complete_vertlist, cur_face, PREF_FIX_LOOPS= True) edge_face_count = {} for mf in meta_faces: # These will always be tri's since they are scanfill faces @@ -1689,6 +1649,12 @@ os.system('find /fe/lwo/Objects/ -follow -iname "*.lwo" > /tmp/templwo_list') print '...Done' file= open('/tmp/templwo_list', 'r') lines= file.readlines() + +# sort by filesize for faster testing +lines_size = [(os.path.getsize(f[:-1]), f[:-1]) for f in lines] +lines_size.sort() +lines = [f[1] for f in lines_size] + file.close() def between(v,a,b): @@ -1705,8 +1671,9 @@ for i, _lwo in enumerate(lines): #if between(i, 525, 550): #if i > 1635: #if i != 1519: # 730 - if i>125: - _lwo= _lwo[:-1] + if i>141: + #if 1: + # _lwo= _lwo[:-1] print 'Importing', _lwo, '\nNUMBER', i, 'of', len(lines) _lwo_file= _lwo.split('/')[-1].split('\\')[-1] newScn= bpy.data.scenes.new(_lwo_file)