Skip to content

Commit

Permalink
blender work added, vfpmathlibrary cleaned
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Jan 5, 2010
1 parent 2eefda6 commit 8629aaf
Show file tree
Hide file tree
Showing 20 changed files with 428 additions and 2,156 deletions.
Binary file added BlenderWork/cube.blend
Binary file not shown.
Binary file added BlenderWork/cube.blend1
Binary file not shown.
128 changes: 128 additions & 0 deletions BlenderWork/exportScript
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import bpy
import Blender
from Blender import *


SMOOTH_DEF = 1


outFile = open("out.txt", "w")


def meshProcess(object):
print "---- meshProcess start ----"
print object.getData(name_only=1)

outFile.write( "type Mesh\n" )
outFile.write( "name %s\n" % object.getData(name_only=1) )

mesh = object.getData(mesh=1)
print "vertex count %d" % len(mesh.verts)
print "face count %d" % len(mesh.faces)

outFile.write( "vertexCount %d\n" % len(mesh.verts) )



for vert in mesh.verts:
#print vert.index
#print vert.co
#print vert.no
vert.sel = 0
outFile.write( "vert %f %f %f\n" % (vert.co.x, vert.co.y, vert.co.z) )

for groupName in mesh.getVertGroupNames():
vertIndexes = mesh.getVertsFromGroup(groupName)
outFile.write( "vertexGroup %s\n" % groupName )

for vertIndex in vertIndexes:
mesh.verts[vertIndex].sel = 1

faceCount = 0
for face in mesh.faces:
if( face.verts[0].sel == 1 and face.verts[1].sel == 1 and face.verts[2].sel == 1 ):
faceCount += 1

print "vertex group ", groupName
print "vertex count %d" % len(vertIndexes)
print "face count %d" % faceCount
outFile.write( "vertexIndexCount %d\n" % faceCount )

for face in mesh.faces:
if( face.verts[0].sel == 1 and face.verts[1].sel == 1 and face.verts[2].sel == 1 ):
outFile.write( "face %d %d %d\n" % (face.verts[0].index, face.verts[1].index, face.verts[2].index) )

for vertIndex in vertIndexes:
mesh.verts[vertIndex].sel = 0

outFile.write( "end\n" )

#print
#print "mesh.faces"
#for face in mesh.faces:
# print
# print face, "no = ", face.no
#
# if( mesh.faceUV ):
# print "have uv"
#
# for uv in face.uv:
# print uv
#
# else:
# print "not have uv"
#
# print "\tface.verts"
# for vert in face.verts:
# print "\tindex = ", vert.index, "no = ", vert.no

print "materials"
for material in mesh.materials:
print material
print "alpha = ", material.alpha
print "diffuse = ", material.rgbCol
print "specular = ", material.specCol

print
print "Textures"
for texture in material.getTextures():
if(texture != None):
print texture
print texture.tex.image.filename


outFile.write( "end\n" )

print "---- meshProcess end ----"


def cameraProcess(object):
print "---- cameraProcess start ----"
print object.getData(name_only=1)
print "---- cameraProcess end ----"


def lampProcess(object):
print "---- lampProcess start ----"
print object.getData(name_only=1)
print "---- lampProcess end ----"


print "---- start ----"
print list(bpy.data.objects)

for obj in bpy.data.objects:
mesh = obj.getData(mesh=1)
print type(mesh)

if( type(mesh) == Types.MeshType ):
meshProcess(obj)

elif( type(mesh) == Types.CameraType ):
cameraProcess(obj)

elif( type(mesh) == Types.LampType ):
lampProcess(obj)

outFile.close()
print "---- end ----"
Binary file added BlenderWork/ground.blend
Binary file not shown.
Binary file added BlenderWork/ground.blend1
Binary file not shown.
Binary file added BlenderWork/ground1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BlenderWork/ground2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8629aaf

Please sign in to comment.