# Import DEC Object File Format (*.off)\r
\r
\r
-bl_addon_info = {\r
+bl_info = {\r
"name": "Import DEC Object File Format (.off)",\r
- "author": "Stefan Huber (shuber)",\r
- "version": (0,7),\r
- "blender": (2, 5, 3),\r
+ "author": "Stefan Huber (shuber2@gmail.com)",\r
+ "version": (0,0),\r
+ "blender": (2, 5, 57),\r
"api": 31667,\r
"location": "File > Import > Import DEC Object File Format (.off)",\r
"description": "Import DEC Object File Format (.off) files",\r
"warning": "",\r
- "category": "Import/Export"\r
+ "category": "Import-Export"\r
}\r
\r
-\r
-\r
-__author__ = "Stefan Huber"\r
-#__url__ = ("blender", "blenderartists.org", "Author's homepage, http://www.redrival.com/scorpius")\r
-#__version__ = "Part of IOSuite 0.5"\r
-\r
-__bpydoc__ = """\\r
+"""\r
This script imports DEC Object File Format files to Blender.\r
\r
The DEC (Digital Equipment Corporation) OFF format is very old and\r
New Mesh module now used. - Cam\r
"""\r
\r
+__version__ = '.'.join([str(s) for s in bl_info['version']])\r
+\r
+\r
+\r
+\r
import bpy\r
from bpy.props import *\r
\r
# Rotate triangle, such that last index is not zero\r
if tri[2] == 0:\r
tri = [ tri[2], tri[0], tri[1] ]\r
- \r
+\r
l.extend(tri)\r
l.extend([0])\r
\r
def importFile(filepath, context):\r
\r
# List of vertices, a vertex is a 3-tuple (x,y,z)\r
- vertices = [] \r
+ vertices = []\r
# List of faces, a face is a list of indices within vertices\r
faces = []\r
\r
# Get all faces\r
for n in range(numFaces):\r
line = getNextLine(f).split()\r
- \r
+\r
# Get number of vertices\r
lenFace = int(line[0])\r
line = line[1:]\r
\r
# Add given number of vertices and faces\r
me.vertices.add( len(vertexdata)//3 )\r
- me.faces.add( len(facedata)//4 )\r
+ me.tessfaces.add( len(facedata)//4 )\r
me.vertices.foreach_set("co", vertexdata)\r
- me.faces.foreach_set("vertices_raw", facedata)\r
+ me.tessfaces.foreach_set("vertices_raw", facedata)\r
me.update()\r
\r
ob = bpy.data.objects.new("Mesh", me)\r
print("Error reading .off file")\r
print(e)\r
return False\r
- \r
\r
\r
-class ImportOffFile(bpy.types.Operator):\r
+\r
+class IMPORT_OT_dec_off(bpy.types.Operator):\r
'''Import DEC object file format (.off) files as specified by\r
http://shape.cs.princeton.edu/benchmark/documentation/off_format.html'''\r
\r
- bl_idname = "import.off_files"\r
- bl_label = "Import DEC Object File Format (.off)"\r
+ bl_idname = "import_scene.dec_off"\r
+ bl_label = "Import DEC off"\r
bl_description = "Imports DEC object file format (.off)"\r
bl_options = {'REGISTER'}\r
\r
filepath = StringProperty(name="File Path",\r
description="Filepath used for importing the file",\r
maxlen=1024,\r
- default="" )\r
+ default=""\r
+ )\r
\r
extEnum = [\r
('*', 'All image formats', 'Import all know image (or movie) formats.'),\r
\r
def invoke(self, context, event):\r
wm = bpy.context.window_manager\r
- wm.add_fileselect(self)\r
+ wm.fileselect_add(self)\r
\r
return {'RUNNING_MODAL'}\r
\r
\r
# Registering / Unregister\r
def menu_func(self, context):\r
- self.layout.operator(ImportOffFile.bl_idname, \\r
- text="DEC Object File Format (.off)", icon='PLUGIN')\r
+ self.layout.operator(IMPORT_OT_dec_off.bl_idname,\r
+ text="DEC Object File Format (.off)",\r
+ icon='PLUGIN' )\r
\r
def register():\r
+ bpy.utils.register_module(__name__)\r
bpy.types.INFO_MT_file_import.append(menu_func)\r
\r
def unregister():\r
+ bpy.utils.unregister_module(__name__)\r
bpy.types.INFO_MT_file_import.remove(menu_func)\r
\r
\r