forked from bartvdbraak/blender
minor changes from stable
This commit is contained in:
parent
a84c598b35
commit
311d7e31cc
@ -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)
|
||||
|
||||
'''
|
@ -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,]:
|
||||
|
@ -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<a3+a4:
|
||||
return [[0,1,2], [0,2,3]]
|
||||
else:
|
||||
return [[0,1,3], [1,2,3]]
|
||||
"""
|
||||
|
||||
if len(face) <= 4:
|
||||
return [face]
|
||||
else: # 5+
|
||||
###if DEBUG: print 'SCANFILL...', len(face)
|
||||
return BPyMesh.ngon(verts, face, PREF_FIX_LOOPS= True)
|
||||
|
||||
|
||||
|
||||
# =========================
|
||||
# === Recalculate Faces ===
|
||||
# =========================
|
||||
@ -1200,7 +1160,7 @@ def my_create_mesh(clip_list, surf, objspec_list, current_facelist, objname, not
|
||||
face_data.append( [vertex_map[j] for j in rev_face] )
|
||||
if uv_flag: face_uvs.append(tmp_get_face_uvs(rev_face, i))
|
||||
elif numfaceverts > 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)
|
||||
|
Loading…
Reference in New Issue
Block a user