#!BPY
"""
Name: 'Radiosity (.radio)...'
Blender: 232
Group: 'Import'
Tooltip: 'Import Radiosity File Format (.radio) with vertex colors'
"""
__author__ = "Anthony D'Agostino (Scorpius)"
__url__ = ("blender", "elysiun",
"Author's homepage, http://www.redrival.com/scorpius")
__version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script imports Radiosity files to Blender.
The Radiosity file format is my own personal format. I created it to
learn how meshes and vertex colors were stored. See IO-Examples.zip, the
example *.radio files on my web page.
Usage:
Execute this script from the "File->Import" menu and choose a Radiosity
file to open.
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2002 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |
# | scorpius@netzero.com |
# | April 11, 2002 |
# | Released under the Blender Artistic Licence (BAL) |
# | Import Export Suite v0.5 |
# +---------------------------------------------------------+
# | Read and write Radiosity File Format (*.radio) |
# +---------------------------------------------------------+
import Blender, meshtools
#import time
try:
import struct
except:
msg = "Error: you need a full Python install to run this script."
meshtools.print_boxed(msg)
Blender.Draw.PupMenu("ERROR%t|"+msg)
# ===============================
# ====== Read Radio Format ======
# ===============================
def read(filename):
#start = time.clock()
file = open(filename, "rb")
mesh = Blender.NMesh.GetRaw()
#mesh.addMaterial(Blender.Material.New())
# === Object Name ===
namelen, = struct.unpack("tools.create_mesh(verts, faces, objname):
Blender.NMesh.PutRaw(mesh, objname)
object = Blender.Object.GetSelected()
object[0].name=objname
# ->tools.create_mesh(verts, faces, objname):
Blender.Window.DrawProgressBar(1.0, '') # clear progressbar
file.close()
#end = time.clock()
#seconds = " in %.2f %s" % (end-start, "seconds")
message = "Successfully imported " + Blender.sys.basename(filename)# + seconds
meshtools.print_boxed(message)
def fs_callback(filename):
read(filename)
Blender.Window.FileSelector(fs_callback, "Import Radio")