You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
970 B
Python

def convert_model(geo_model, mesh, obj):
#Create vertices
#todo: populate coordinates
#todo: populate normals
#todo: create edges
#todo: create faces
#todo: populate uvs
mesh.validate()
mesh.update()
#todo: attempt to load textures/images
def load(operator, context, scale = 1.0, filepath = "", global_matrix = None, use_mesh_modifiers = True):
#load .geo
fh_in = open(filepath, "rb")
geo = Geo()
geo.loadFromFile(fh_in)
fh_in.close()
for geo_model in geo.models:
#create object matching model's name (or next equivilant)
mesh = bpy.data.meshes.new(name = model.name.decode("utf-8"))
#convert model to mesh
convert_mode(geo_model, mesh, None)
#Create object for this mesh
scn = bpy.context.scene
obj = bpy.data.objects.new(ply_name, mesh)
scn.objects.link(obj)
scn.objects.active = obj
obj.select = True
pass
pass