- Fixes by Jean-Michel Soler: mod_ai2obj.py, mod_svg2obj.py;
- Fixes by Campbell Barton: obj_import.py;
- Small fix to mod_meshtools.py (fixes bug #1605: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1605&group_id=9);
- Updates by Jean-Baptiste (Jiba) to his blender2cal3d.py;
- Updates to all his import / export scripts (added doc data) by Anthony D'Agostino;
- Update to off_import: support for uv data, by Arne Schmitz.

BPython:
- Removed Object.get and .getSelected (deprecated long ago, we use .Get and .GetSelected) -- fixes #1861: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1861&group_id=9
- Applied patch by Michael Reimpell: quat.c - fix for wrong initialization with newQuaternionObject; Mathutils documentation improvements.
- Stani reported a wrong return msg in IpoCurve.Get (that is unimplemented).

Thanks to all coders mentioned above!
This commit is contained in:
Willian Padovani Germano 2004-11-30 02:27:46 +00:00
parent e4562134d2
commit 6d9c02be4c
25 changed files with 1000 additions and 1096 deletions

File diff suppressed because it is too large Load Diff

@ -15,9 +15,28 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script exports meshes to LightWave file format.
Usage:
LightWave is a full-featured commercial modeling and rendering
application. The lwo file format is composed of 'chunks,' is well
defined, and easy to read and write. It is similar in structure to the
trueSpace cob format.
Select meshes to be exported and run this script from "File->Export" menu.
Usage:<br>
Select meshes to be exported and run this script from "File->Export" menu.
Supported:<br>
UV Coordinates, Meshes, Materials, Material Indices, Specular
Highlights, and Vertex Colors. For added functionality, each object is
placed on its own layer.
Missing:<br>
Not too much, I hope! :).
Known issues:<br>
Empty objects crash has been fixed.
Notes:<br>
For compatibility reasons, it also reads lwo files in the old LW
v5.5 format.
"""
# $Id$

@ -15,10 +15,28 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script imports LightWave files to Blender.
Usage:
LightWave is a full-featured commercial modeling and rendering
application. The lwo file format is composed of 'chunks,' is well
defined, and easy to read and write. It is similar in structure to the
trueSpace cob format.
Execute this script from the "File->Import" menu and choose a LightWave file to
open.
Usage:<br>
Execute this script from the "File->Import" menu and choose a LightWave
file to open.
Supported:<br>
Meshes only.
Missing:<br>
Materials, UV Coordinates, and Vertex Color info will be ignored.
Known issues:<br>
Triangulation of convex polygons works fine, and uses a very simple
fanning algorithm. Convex polygons (i.e., shaped like the letter "U")
require a different algorithm, and will be triagulated incorrectly.
Notes:<br>
Also reads lwo files in the old LW v5.5 format.
"""
# $Id$

@ -58,20 +58,17 @@ os.split=split
os.join=join
def filtreFICHIER(nom):
f=open(nom,'r')
f=open(nom,'rU')
t=f.readlines()
f.close()
if len(t)==1 and t[0].find('\r'):
t=t[0].split('\r')
if len(t)>1:
return t
else:
name = "OK?%t| Not a valid file or an empty file ... " # if no %xN int is set, indices start from 1
result = Draw.PupMenu(name)
return 'false'
return 'false'
#===============================
# Data
@ -140,6 +137,8 @@ def test_egalitedespositions(f1,f2):
def Open_GEOfile(dir,nom):
if BLversion>=233:
in_editmode = Blender.Window.EditMode()
if in_editmode: Blender.Window.EditMode(0)
Blender.Load(dir+nom+'OOO.obj', 1)
BO=Blender.Object.Get()
BO[-1].RotY=0.0

@ -94,7 +94,8 @@ def versioned_name(objname):
existing_names = []
for object in Blender.Object.Get():
existing_names.append(object.name)
existing_names.append(object.data.name)
data = object.data
if data: existing_names.append(data.name)
if objname in existing_names: # don't over-write other names
try:
name, ext = objname.split('.')

@ -1,6 +1,7 @@
"""
(c) jm soler juillet 2004, released under Blender Artistic Licence
for the Blender 2.34 Python Scripts Bundle.
SVG 2 OBJ translater, 0.2.6
(c) jm soler juillet/novembre 2004, released under Blender Artistic Licence
for the Blender 2.34/35 Python Scripts Bundle.
#---------------------------------------------------------------------------
# Page officielle :
# http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_import_svg.htm
@ -9,7 +10,6 @@
#---------------------------------------------------------------------------
-- Concept : translate SVG file in GEO .obj file and try to load it.
-- Real problem : the name of the blender file is changed ...
-- Curiousity : the original matrix must be :
0.0 0.0 1.0 0.0
@ -55,14 +55,17 @@ Changelog:
0.2.3 : - read a few new relative displacements
0.2.4 : - better hash for command with followed by a lone data
(h,v) or uncommun number (a)
0.2.5 : - correction for gimp import
0.2.6 : - correction for illustrator 10 SVG
==================================================================================
=================================================================================="""
SHARP_IMPORT=0
SCALE=1
scale=1
DEBUG =0
DEVELOPPEMENT=1
DEBUG =0 #print
DEVELOPPEMENT=0
import sys
#oldpath=sys.path
@ -107,16 +110,21 @@ os.split=split
os.join=join
def filtreFICHIER(nom):
f=open(nom,'r')
f=open(nom,'rU')
t=f.read()
f.close()
t=t.replace('\r','')
t=t.replace('\n','')
if t.upper().find('<SVG')==-1:
if t.upper().find('<SVG')==-1 :
name = "OK?%t| Not a valid file or an empty file ... " # if no %xN int is set, indices start from 1
result = Blender.Draw.PupMenu(name)
return "false"
elif t.upper().find('<PATH')==-1:
name = "OK?%t| Sorry, no Path in this file ... " # if no %xN int is set, indices start from 1
result = Blender.Draw.PupMenu(name)
return "false"
else:
return t
@ -329,7 +337,7 @@ def courbe_vers_s(c,D,n0,CP): #S,s
if DEBUG==1: print B.co,BP.co
CP=[l[4],l[5]]
if D[c[1]+3] not in TAGcourbe :
if len(D)<c[1]+3 and D[c[1]+3] not in TAGcourbe :
c[1]+=2
courbe_vers_c(c, D, n0,CP)
return courbes,n0,CP
@ -379,8 +387,10 @@ def courbe_vers_c(c, D, n0,CP): #c,C
if DEBUG==1: print B.co,BP.co
CP=[l[4],l[5]]
if D[c[1]+4] not in TAGcourbe :
if DEBUG==1:
print 'D[c[1]]', D[c[1]], c
print D
if len(D)<c[1]+4 and D[c[1]+4] not in TAGcourbe :
c[1]+=3
courbe_vers_c(c, D, n0,CP)
@ -402,7 +412,7 @@ def ligne_tracee_l(c, D, n0,CP): #L,l
CP=[l[0],l[1]]
if D[c[1]+2] not in TAGcourbe :
if len(D)<c[1]+2 and D[c[1]+2] not in TAGcourbe :
c[1]+=1
ligne_tracee_l(c, D, n0,CP) #L
@ -557,6 +567,13 @@ def format_PATH(t):
#print "D0= :",D
D=D.split(' ')
try:
while D.index(''):
del D[D.index('')]
except:
pass
#print len(D)
#for D0 in D:
#print " ----> D = :", D0
@ -600,16 +617,12 @@ def scan_FILE(nom):
#print t
while t.find('path')!=-1:
t,D=format_PATH(t)
cursor=0
for cell in D:
if DEBUG==2 : print 'cell : ',cell ,' --'
#print 'cell',cell
if len(cell)>=1 and cell[0] in TAGcourbe:
courbes,n0,CP=Actions[cell]([cell,cursor], D, n0,CP)
courbes,n0,CP=Actions[cell]([cell,cursor], D, n0,CP)
cursor+=1
courbes.number_of_items=len(courbes.ITEM.keys())
@ -642,6 +655,6 @@ def ajustement(v,s):
def fonctionSELECT(nom):
scan_FILE(nom)
if DEVELOPPEMENT==0:
if DEVELOPPEMENT==1:
Blender.Window.FileSelector (fonctionSELECT, 'SELECT a .SVG FILE')
#sys.path=oldpath

@ -15,12 +15,37 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script exports meshes to Nendo file format.
Usage:
Nendo is (was) a commercial polygon modeler that has about half of the
features found in Wings. The .ndo file format is a simple, uncompressed,
memory dump of structures that represent the mesh objects, uv coords,
and image textures.
Select meshes to be exported and run this script from "File->Export" menu.
Usage:<br>
Select meshes to be exported and run this script from "File->Export" menu.
Supported:<br>
1. Exports meshes only. Hint: use ALT-C to convert non-mesh objects,
and CTRL-ALT-A if you have "dupliverts" objects.<br>
2. Exports Vertex Colors & Radiosity Solutions.
Missing:<br>
Materials and UV Coordinates info will be ignored.
Known issues:<br>
Exports only well-behaved and topologically correct meshes (i.e,
closed meshes, manifolds, meshes imported from wings, etc). The mesh
cannot have duplicate vertices, missing faces (holes), open edges, etc.<br>
PowerUser Hint: In editmode, if CTRL-ALT-SHIFT-M results in a selection,
then your mesh is not a manifold and most likely will not export.
Notes:<br>
Blender & Wings can read/write ndo files with a maximum of 65,535 edges.
Nendo can read/write ndo files with a maximum of 32,767 edges.<br>
If you have a very large mesh that you want to import into nendo, modify
the 'write_edge_table' function to use a signed integer (i.e., ">h") for the 'len(edge_table)'
field.
"""
# $Id$
#
# +---------------------------------------------------------+

@ -15,13 +15,32 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script imports Nendo files to Blender.
Usage:
Nendo is (was) a commercial polygon modeler that has about half of the
features found in Wings. The .ndo file format is a simple, uncompressed,
memory dump of structures that represent the mesh objects, uv coords,
and image textures.
Execute this script from the "File->Import" menu and choose a Nendo file to
open.
Usage:<br>
Execute this script from the "File->Import" menu and choose a Nendo file
to open.
Supported:<br>
Meshes only.
Missing:<br>
Materials, UV Coordinates, and Vertex Color info will be ignored.
Known issues:<br>
Triangulation of convex polygons works fine, and uses a very simple
fanning algorithm. Convex polygons (i.e., shaped like the letter "U")
require a different algorithm, and will be triagulated incorrectly.
Notes:<br>
Last tested with Wings 3D 0.98.25 & Nendo 1.1.6. Some models cannot be
imported due to the fact that Nendo erroneously creates doubled back
edges during the course of modeling.
"""
# $Id$
#
# +---------------------------------------------------------+

@ -202,8 +202,11 @@ def getUniqueName(name):
name += '.' + str(uniqueInt)
uniqueInt +=1
except:
return name
if NMesh.GetRaw(name) == None:
return name
else:
name += '.' + str(uniqueInt)
uniqueInt +=1
#==================================================================================#
# This loads data from .obj file #
@ -215,16 +218,16 @@ def load_obj(file):
if len( meshList[objectName][0].materials ) >= MATLIMIT:
print 'Warning, max material limit reached, using an existing material'
return meshList[objectName][0]
mIdx = 0
for m in meshList[objectName][0].materials:
if m.getName() == mat.getName():
break
mIdx+=1
if mIdx == len(mesh.materials):
meshList[objectName][0].addMaterial(mat)
f.mat = mIdx
return f
@ -263,25 +266,26 @@ def load_obj(file):
# Load all verts first (texture verts too) #
#==================================================================================#
lIdx = 0
print len(fileLines)
while lIdx < len(fileLines):
l = fileLines[lIdx]
# EMPTY LINE
if len(l) == 0 or l[0] == '#':
pass
# VERTEX
l = fileLines[lIdx]
if len(l) == 0:
fileLines.pop(lIdx)
lIdx-=1
elif l[0] == 'v':
# This is a new vert, make a new mesh
vertList.append( NMesh.Vert(float(l[1]), float(l[2]), float(l[3]) ) )
fileLines.remove(fileLines[lIdx])
fileLines.pop(lIdx)
lIdx-=1
# UV COORDINATE
elif l[0] == 'vt':
# This is a new vert, make a new mesh
uvMapList.append( (float(l[1]), float(l[2])) )
fileLines.remove(fileLines[lIdx])
fileLines.pop(lIdx)
lIdx-=1
lIdx+=1
@ -298,6 +302,7 @@ def load_obj(file):
meshList = {}
meshList[objectName] = (NMesh.GetRaw(), [-1]*len(vertList)) # Mesh/meshList[objectName][1]
meshList[objectName][0].verts.append(vertList[0])
meshList[objectName][0].hasFaceUV(1)
#==================================================================================#
# Load all faces into objects, main loop #
@ -306,15 +311,15 @@ def load_obj(file):
# Face and Object loading LOOP
while lIdx < len(fileLines):
l = fileLines[lIdx]
# COMMENTS AND EMPTY LINES
if len(l) == 0 or l[0] == '#':
pass
# VERTEX
elif l[0] == 'v':
if l[0] == 'v':
pass
# Comment
if l[0] == '#':
pass
# VERTEX NORMAL
elif l[0] == 'vn':
pass
@ -374,8 +379,9 @@ def load_obj(file):
# UV MAPPING
if fHasUV:
for i in [0,1,2,3]:
f.uv.append( uvMapList[ vtIdxLs[i] ] )
f.uv.extend([uvMapList[ vtIdxLs[0] ],uvMapList[ vtIdxLs[1] ],uvMapList[ vtIdxLs[2] ],uvMapList[ vtIdxLs[3] ]])
#for i in [0,1,2,3]:
# f.uv.append( uvMapList[ vtIdxLs[i] ] )
if f.v > 0:
f = applyMat(meshList[objectName][0], f, currentMat)
@ -400,9 +406,7 @@ def load_obj(file):
# UV MAPPING
if fHasUV:
f.uv.append( uvMapList[ vtIdxLs[0] ] )
f.uv.append( uvMapList[ vtIdxLs[i+1] ] )
f.uv.append( uvMapList[ vtIdxLs[i+2] ] )
f.uv.extent([uvMapList[ vtIdxLs[0] ], uvMapList[ vtIdxLs[i+1] ], uvMapList[ vtIdxLs[i+2] ]])
if f.v > 0:
f = applyMat(meshList[objectName][0], f, currentMat)
@ -450,6 +454,7 @@ def load_obj(file):
# if we have then we'll just keep appending to it, this is required for soem files.
if objectName not in meshList.keys():
meshList[objectName] = (NMesh.GetRaw(), [-1]*len(vertList))
meshList[objectName][0].hasFaceUV(1)
meshList[objectName][0].verts.append( vertList[0] )
@ -466,7 +471,7 @@ def load_obj(file):
currentImg = NULL_IMG
else:
currentImg = getImg(DIR + ' '.join(l[1:])) # Use join in case of spaces
# MATERIAL FILE
elif l[0] == 'mtllib':
mtl_fileName = ' '.join(l[1:])
@ -482,12 +487,24 @@ def load_obj(file):
if mtl_fileName != '':
load_mtl(DIR, mtl_fileName, meshList[mk][0])
if len(meshList[mk][0].verts) >1:
meshList[mk][0].verts.remove(meshList[mk][0].verts[0])
meshList[mk][0].verts.pop(0)
name = getUniqueName(mk)
ob = NMesh.PutRaw(meshList[mk][0], mk)
ob.name = mk
ob = NMesh.PutRaw(meshList[mk][0], name)
ob.name = name
print "obj import time: ", sys.time() - time1
Window.FileSelector(load_obj, 'Import Wavefront OBJ')
'''
# For testing compatability
import os
for obj in os.listdir('/obj/'):
if obj[-3:] == 'obj':
print obj
newScn = Scene.New(obj)
newScn.makeCurrent()
load_obj('/obj/' + obj)
'''

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Object File Format (.off)...'
Name: 'DEC Object File Format (.off)...'
Blender: 232
Group: 'Export'
Tooltip: 'Export selected mesh to Object File Format (*.off)'
Tooltip: 'Export selected mesh to DEC Object File Format (*.off)'
"""
__author__ = "Anthony D'Agostino (Scorpius)"
@ -13,11 +13,19 @@ __url__ = ("blender", "elysiun",
__version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script exports meshes to Object File Format.
This script exports meshes to DEC Object File Format.
Usage:
The DEC (Digital Equipment Corporation) OFF format is very old and
almost identical to Wavefront's OBJ. I wrote this so I could get my huge
meshes into Moonlight Atelier. (DXF can also be used but the file size
is five times larger than OFF!) Blender/Moonlight users might find this
script to be very useful.
Select meshes to be exported and run this script from "File->Export" menu.
Usage:<br>
Select meshes to be exported and run this script from "File->Export" menu.
Notes:<br>
Only exports a single selected mesh.
"""
# +---------------------------------------------------------+

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Object File Format (.off)...'
Name: 'DEC Object File Format (.off)...'
Blender: 232
Group: 'Import'
Tooltip: 'Import Object File Format (*.off)'
Tooltip: 'Import DEC Object File Format (*.off)'
"""
__author__ = "Anthony D'Agostino (Scorpius)"
@ -13,12 +13,20 @@ __url__ = ("blender", "elysiun",
__version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script imports Object File Format files to Blender.
This script imports DEC Object File Format files to Blender.
Usage:
The DEC (Digital Equipment Corporation) OFF format is very old and
almost identical to Wavefront's OBJ. I wrote this so I could get my huge
meshes into Moonlight Atelier. (DXF can also be used but the file size
is five times larger than OFF!) Blender/Moonlight users might find this
script to be very useful.
Execute this script from the "File->Import" menu and choose an OFF file to
Usage:<br>
Execute this script from the "File->Import" menu and choose an OFF file to
open.
Notes:<br>
UV Coordinate support has been added.
"""
@ -45,19 +53,27 @@ def read(filename):
verts = []
faces = []
uv = []
# === OFF Header ===
offheader = file.readline()
numverts, numfaces, null = file.readline().split()
numverts = int(numverts)
numfaces = int(numfaces)
if offheader.find('ST') >= 0:
has_uv = True
else:
has_uv = False
# === Vertex List ===
for i in range(numverts):
if not i%100 and mod_meshtools.show_progress:
Blender.Window.DrawProgressBar(float(i)/numverts, "Reading Verts")
x, y, z = file.readline().split()
x, y, z = float(x), float(y), float(z)
if has_uv:
x, y, z, u, v = map(float, file.readline().split())
uv.append((u, v))
else:
x, y, z = map(float, file.readline().split())
verts.append((x, y, z))
# === Face List ===
@ -75,7 +91,7 @@ def read(filename):
objname = Blender.sys.splitext(Blender.sys.basename(filename))[0]
mod_meshtools.create_mesh(verts, faces, objname)
mod_meshtools.create_mesh(verts, faces, objname, faces, uv)
Blender.Window.DrawProgressBar(1.0, '') # clear progressbar
file.close()
#end = time.clock()

@ -15,12 +15,30 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script exports meshes to Radiosity file format.
Usage:
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.
Select meshes to be exported and run this script from "File->Export" menu.
Usage:<br>
Select meshes to be exported and run this script from "File->Export" menu.
Notes:<br>
Before exporting to .radio format, the mesh must have vertex colors.
Here's how to assign them:
1. Use radiosity!
2. Set up lights and materials, select a mesh, switch the drawing mode
to "textured," press the VKEY.
3. Press the VKEY and paint manually.
4. Use a custom script to calculate and apply simple diffuse shading and
specular highlights to the vertex colors.
5. The Videoscape format also allows vertex colors to be specified.
"""
# $Id$
#
# +---------------------------------------------------------+

@ -15,13 +15,15 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script imports Radiosity files to Blender.
Usage:
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.
Execute this script from the "File->Import" menu and choose a Radiosity file to
open.
Usage:<br>
Execute this script from the "File->Import" menu and choose a Radiosity
file to open.
"""
# $Id$
#
# +---------------------------------------------------------+

@ -15,9 +15,14 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script exports meshes to Raw Triangle file format.
Usage:
The raw triangle format is very simple; it has no verts or faces lists.
It's just a simple ascii text file with the vertices of each triangle
listed on each line. There were some very old utilities (when the PovRay
forum was in existence on CompuServe) that preformed operations on these
files.
Select meshes to be exported and run this script from "File->Export" menu.
Usage:<br>
Select meshes to be exported and run this script from "File->Export" menu.
"""

@ -15,12 +15,21 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script imports Raw Triangle File format files to Blender.
Usage:
The raw triangle format is very simple; it has no verts or faces lists.
It's just a simple ascii text file with the vertices of each triangle
listed on each line. There were some very old utilities (when the PovRay
forum was in existence on CompuServe) that preformed operations on these
files.
Execute this script from the "File->Import" menu and choose a Raw file to
Usage:<br>
Execute this script from the "File->Import" menu and choose a Raw file to
open.
"""
Notes:<br>
Generates the standard verts and faces lists, but without duplicate
verts. Only *exact* duplicates are removed, there is no way to specify a
tolerance.
"""
# $Id$
#

@ -15,10 +15,18 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script imports Pro Engineer files to Blender.
Usage:
This format can be exported from Pro/Engineer and most other CAD
applications. Written at the request of a Blender user. It is almost
identical to RAW format.
Execute this script from the "File->Import" menu and choose an SLP file to
Usage:<br>
Execute this script from the "File->Import" menu and choose an SLP file to
open.
Notes:<br>
Generates the standard verts and faces lists, but without duplicate
verts. Only *exact* duplicates are removed, there is no way to specify a
tolerance.
"""
# $Id$

@ -15,9 +15,38 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script exports meshes to TrueSpace file format.
Usage:
TrueSpace is a commercial modeling and rendering application. The .cob
file format is composed of 'chunks,' is well defined, and easy to read and
write. It's very similar to LightWave's lwo format.
Select meshes to be exported and run this script from "File->Export" menu.
Usage:<br>
Select meshes to be exported and run this script from "File->Export" menu.
Supported:<br>
Vertex colors will be exported, if they are present.
Known issues:<br>
Before exporting to .cob format, the mesh must have real-time UV
coordinates. Press the FKEY to assign them.
Notes:<br>
There are a few differences between how Blender & TrueSpace represent
their objects' transformation matrices. Blender simply uses a 4x4 matrix,
and trueSpace splits it into the following two fields.
For the 'Local Axes' values: The x, y, and z-axis represent a simple
rotation matrix. This is equivalent to Blender's object matrix before
it was combined with the object's scaling matrix. Dividing each value by
the appropriate scaling factor (and transposing at the same time)
produces the original rotation matrix.
For the 'Current Position' values: This is equivalent to Blender's
object matrix except that the last row is omitted and the xyz location
is used in the last column. Binary format uses a 4x3 matrix, ascii
format uses a 4x4 matrix.
For Cameras: The matrix here gets a little confusing, and I'm not sure of
how to handle it.
"""

@ -13,12 +13,46 @@ __url__ = ("blender", "elysiun",
__version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script imports TrueSpace files to Blender.
This script imports TrueSpace files to Blender
Usage:
TrueSpace is a commercial modeling and rendering application. The .cob
file format is composed of 'chunks,' is well defined, and easy to read and
write. It's very similar to LightWave's lwo format.
Execute this script from the "File->Import" menu and choose a TrueSpace file to
open.
Usage:<br>
Execute this script from the "File->Import" menu and choose a TrueSpace
file to open.
Supported:<br>
Meshes only. Supports UV Coordinates. COB files in ascii format can't be
read.
Missing:<br>
Materials, and Vertex Color info will be ignored.
Known issues:<br>
Triangulation of convex polygons works fine, and uses a very simple
fanning algorithm. Convex polygons (i.e., shaped like the letter "U")
require a different algorithm, and will be triagulated incorrectly.
Notes:<br>
There are a few differences between how Blender & TrueSpace represent
their objects' transformation matrices. Blender simply uses a 4x4 matrix,
and trueSpace splits it into the following two fields.
For the 'Local Axes' values: The x, y, and z-axis represent a simple
rotation matrix. This is equivalent to Blender's object matrix before
it was combined with the object's scaling matrix. Dividing each value by
the appropriate scaling factor (and transposing at the same time)
produces the original rotation matrix.
For the 'Current Position' values: This is equivalent to Blender's
object matrix except that the last row is omitted and the xyz location
is used in the last column. Binary format uses a 4x3 matrix, ascii
format uses a 4x4 matrix.
For Cameras: The matrix here gets a little confusing, and I'm not sure of
how to handle it.
"""
# $Id$
@ -227,19 +261,3 @@ def fs_callback(filename):
Blender.Window.FileSelector(fs_callback, "Import COB")
# === Matrix Differences between Blender & trueSpace ===
#
# For the 'Local Axes' values:
# The x, y, and z-axis represent a simple rotation matrix.
# This is equivalent to Blender's object matrix before it was
# combined with the object's scaling matrix. Dividing each value
# by the appropriate scaling factor (and transposing at the same
# time) produces the original rotation matrix.
#
# For the 'Current Position' values:
# This is equivalent to Blender's object matrix except that the
# last row is omitted and the xyz location is used in the last
# column. Binary format uses a 4x3 matrix, ascii format uses a 4x4
# matrix.
#
# For Cameras: The matrix is a little confusing.

@ -15,9 +15,32 @@ __version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script exports meshes (including vertex colors) to VideoScape File Format.
Usage:
The VideoScape file format is a simple format that is natively supported
in Blender. I wrote this module because Blender's internal exporter
doesn't export vertex colors correctly. Check the source for a *fast* algorithm for
averaging vertex colors.
Select meshes to be exported and run this script from "File->Export" menu.
Usage:<br>
Select meshes to be exported and run this script from "File->Export" menu.
Supported:<br>
Exports meshes only. Hint: use ALT-C to convert non-mesh objects,
and CTRL-ALT-A if you have "dupliverts" objects.
Notes:<br>
Before exporting, the mesh must have vertex colors. Here's how to assign them:
1. Use radiosity!
2. Set up lights and materials, select a mesh, switch the drawing mode
to "textured," press the VKEY.
3. Press the VKEY and paint manually.
4. Use a custom script to calculate and apply simple diffuse shading and
specular highlights to the vertex colors.
5. The Videoscape format also allows vertex colors to be specified.
"""
@ -32,8 +55,6 @@ Select meshes to be exported and run this script from "File->Export" menu.
# | Import Export Suite v0.5 |
# +---------------------------------------------------------+
# | Write Videoscape File Format (*.obj NOT WAVEFRONT OBJ) |
# | Includes a *fast* algorithm for averaging vertex colors |
# | Blender's a|w doesn't export proper vertex colors |
# +---------------------------------------------------------+
import Blender, mod_meshtools

@ -14,14 +14,35 @@ __url__ = ("blender", "elysiun",
__version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script exports meshes to Wings 3D file format.
This script exports meshes to Wings3D file format.
Usage:
Wings3D is an open source polygon modeler written in Erlang, a
language similar to Lisp. The .wings file format is a binary
representation of erlang terms (lists, tuples, atoms, etc.) and is
compressed with zlib.
Select meshes to be exported and run this script from "File->Export" menu.
Usage:<br>
Select meshes to be exported and run this script from "File->Export" menu.
Supported:<br>
1. Exports meshes only. Hint: use ALT-C to convert non-mesh objects,
and CTRL-ALT-A if you have "dupliverts" objects.<br>
2. Exports Vertex Colors & Radiosity Solutions.
Missing:<br>
Materials and UV Coordinates info will be ignored.
Known issues:<br>
Exports only well-behaved and topologically correct meshes (i.e,
closed meshes, manifolds, meshes imported from wings, etc). The mesh
cannot have duplicate vertices, missing faces (holes), open edges, etc.<br>
PowerUser Hint: In editmode, if CTRL-ALT-SHIFT-M results in a selection,
then your mesh is not a manifold and most likely will not export.
Notes:<br>
Last tested with Wings 3D 0.98.25 & Blender 2.35a.
"""
# $Id$
#
# +---------------------------------------------------------+

@ -14,12 +14,30 @@ __url__ = ("blender", "elysiun",
__version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
This script imports Wings 3d files to Blender.
This script imports Wings3D files to Blender.
Usage:
Wings3D is an open source polygon modeler written in Erlang, a
language similar to Lisp. The .wings file format is a binary
representation of erlang terms (lists, tuples, atoms, etc.) and is
compressed with zlib.
Execute this script from the "File->Import" menu and choose a Wings file to
open.
Usage:<br>
Execute this script from the "File->Import" menu and choose a Wings file
to open.
Supported:<br>
Meshes only. Not guaranteed to work in all situations.
Missing:<br>
Materials, UV Coordinates, and Vertex Color info will be ignored.
Known issues:<br>
Triangulation of convex polygons works fine, and uses a very simple
fanning algorithm. Convex polygons (i.e., shaped like the letter "U")
require a different algorithm, and will be triagulated incorrectly.
Notes:<br>
Last tested with Wings 3D 0.98.25 & Blender 2.35a.
"""
# $Id$

@ -195,7 +195,8 @@ PyObject *IpoCurve_Init( void )
/*****************************************************************************/
static PyObject *M_IpoCurve_Get( PyObject * self, PyObject * args )
{
return 0;
Py_INCREF(Py_None);
return Py_None;
}
/*****************************************************************************/

@ -57,9 +57,7 @@
/*****************************************************************************/
static PyObject *M_Object_New( PyObject * self, PyObject * args );
PyObject *M_Object_Get( PyObject * self, PyObject * args );
PyObject *M_Object_get( PyObject * self, PyObject * args );
static PyObject *M_Object_GetSelected( PyObject * self, PyObject * args );
static PyObject *M_Object_getSelected( PyObject * self, PyObject * args );
/*****************************************************************************/
/* The following string definitions are used for documentation strings. */
@ -90,12 +88,8 @@ struct PyMethodDef M_Object_methods[] = {
M_Object_New_doc},
{"Get", ( PyCFunction ) M_Object_Get, METH_VARARGS,
M_Object_Get_doc},
{"get", ( PyCFunction ) M_Object_get, METH_VARARGS,
M_Object_Get_doc},
{"GetSelected", ( PyCFunction ) M_Object_GetSelected, METH_VARARGS,
M_Object_GetSelected_doc},
{"getSelected", ( PyCFunction ) M_Object_getSelected, METH_VARARGS,
M_Object_GetSelected_doc},
{NULL, NULL, 0, NULL}
};
@ -516,21 +510,9 @@ PyObject *M_Object_Get( PyObject * self, PyObject * args )
}
}
/*****************************************************************************/
/* Function: M_Object_get */
/* Python equivalent: Blender.Object.get */
/*****************************************************************************/
PyObject *M_Object_get( PyObject * self, PyObject * args )
{
PyErr_Warn( PyExc_DeprecationWarning,
"The Object.get() function will be removed in Blender 2.29\n"
"Please update the script to use Object.Get" );
return ( M_Object_Get( self, args ) );
}
/*****************************************************************************/
/* Function: M_Object_GetSelected */
/* Python equivalent: Blender.Object.getSelected */
/* Python equivalent: Blender.Object.GetSelected */
/*****************************************************************************/
static PyObject *M_Object_GetSelected( PyObject * self, PyObject * args )
{
@ -583,19 +565,6 @@ static PyObject *M_Object_GetSelected( PyObject * self, PyObject * args )
return ( list );
}
/*****************************************************************************/
/* Function: M_Object_getSelected */
/* Python equivalent: Blender.Object.getSelected */
/*****************************************************************************/
static PyObject *M_Object_getSelected( PyObject * self, PyObject * args )
{
PyErr_Warn( PyExc_DeprecationWarning,
"The Object.getSelected() function will be removed in "
"Blender 2.29\n"
"Please update the script to use Object.GetSelected" );
return ( M_Object_GetSelected( self, args ) );
}
/*****************************************************************************/
/* Function: initObject */
/*****************************************************************************/

@ -319,7 +319,7 @@ class Vector:
v = Blender.Mathutils.Vector([1,0,0])
@type list: PyList of float or int
@param list: The list of values for the Vector object.
Must be 2, 3, or 4 values.
Must be 2, 3, or 4 values. The list is mapped to the parameters as [x,y,z,w].
@rtype: Vector object.
@return: It depends wheter a parameter was passed:
- (list): Vector object initialized with the given values;
@ -420,16 +420,16 @@ class Quaternion:
in degrees.
"""
def __init__(list = None, angle = None):
def __init__(list, angle = None):
"""
Create a new quaternion object from initialized values.
Example::
quat = Mathutils.Quaternion()
quat = Mathutils.Quaternion([1.0,0.0,0.0])
@type list: PyList of int/float
@param list: A 3d or 4d list to initialize quaternion.
4d if intializing, 3d if will be used as an axis of rotation.
4d if intializing [w,x,y,z], 3d if used as an axis of rotation.
@type angle: float (optional)
@param angle: An arbitrary rotation amount around 'list'.
List is used as an axis of rotation in this case.
@ -527,7 +527,7 @@ class Matrix:
def determinant():
"""
Return a the determinant of a matrix.
Return the determinant of a matrix.
@rtype: int
@return: Return a the determinant of a matrix.
@ -540,9 +540,12 @@ class Matrix:
def rotationPart():
"""
Return the 3d rotation matrix.
Return the 3d submatrix corresponding to the linear term of the
embedded affine transformation in 3d. This matrix represents rotation
and scale. Note that the (4,4) element of a matrix can be used for uniform
scaling, too.
@rtype: Matrix object.
@return: Return the 3d rotation matrix.
@return: Return the 3d matrix for rotation and scale.
"""
@ -561,17 +564,17 @@ class Matrix:
def toEuler():
"""
Return a euler representing the rotation matrix.
Return an Euler representation of the rotation matrix.
@rtype: Euler object
@return: Return a euler representing the rotation matrix.
@return: Euler representation of the rotation matrix.
"""
def toQuat():
"""
Return a quaternion representation the rotation matrix
Return a quaternion representation of the rotation matrix
@rtype: Quaternion object
@return: Quaternion representation the rotation matrix
@return: Quaternion representation of the rotation matrix
"""

@ -531,13 +531,17 @@ PyTypeObject quaternion_Type = {
&Quaternion_SeqMethods, /*tp_as_sequence */
};
/*
newQuaternionObject
if the quat arg is not null, this method allocates memory and copies *quat into it.
we will free the memory in the dealloc routine.
*/
/** Creates a new quaternion object.
*
* Memory for a new quaternion is allocated. The quaternion copies the given
* list of parameters or initializes to the identity, if a <code>NULL</code>
* pointer is given as parameter. The memory will be freed in the dealloc
* routine.
*
* @param quat Pointer to a list of floats for the quanternion parameters w, x, y, z.
* @return Quaternion Python object.
* @see Quaternion_Identity
*/
PyObject *newQuaternionObject( float *quat )
{
QuaternionObject *self;
@ -550,10 +554,7 @@ PyObject *newQuaternionObject( float *quat )
self->quat = PyMem_Malloc( 4 * sizeof( float ) );
if( !quat ) {
for( x = 0; x < 4; x++ ) {
self->quat[x] = 0.0f;
}
self->quat[3] = 1.0f;
Quaternion_Identity(self);
} else {
for( x = 0; x < 4; x++ ) {
self->quat[x] = quat[x];