Model Utilities. python script bug in obj2dattex.py
Posted: Sat Apr 28, 2007 7:55 am
i recently created my first model for oolite..
I created my model in 3d max 7.0 and exported it to wavefront object. mymodel.obj
i struck upon a problem when i tried to convert it using the python script
i have installed python 2.5 on windows XP enterprise (updated all across the line)
when the script obj2dattex.py was executed..
"it said, error in line 73 empty float"
x = -float(tokens[1])
i looked at the script and the object file..
The section of the script in Question looks like this
What happens here is ofcourse it looks for for the Character 'V'
after which it puts the next Character into X, and makes it negative
The obj file i was using lookes like this at the first line where it has 'v'
Notice that following immiditately after the 'v' is 2 spaces
this means that as far as i can understand that now during the scripts
first loop here that
token[0]='v '
token[1]=' ' <--- notice it holds a space a white space
token[2]='-0.01808810 '
token[3]='6.54705524 '
i have no idea how string.split(line, ' ') works but can understand how it is supposed to work..
i figured it had that empty slot in
token[1], and therefore
token[2] would hold the X value
token[3] would hold the Y value
token[4] would hold the Z value
so, i alterd the script accordingly to
and viola it works, and proof of it is that my model/s is ingame...
i have no clue who to report this to but i figured someone here prolly has something todo with it..
Cheers
Frame
I created my model in 3d max 7.0 and exported it to wavefront object. mymodel.obj
i struck upon a problem when i tried to convert it using the python script
i have installed python 2.5 on windows XP enterprise (updated all across the line)
when the script obj2dattex.py was executed..
"it said, error in line 73 empty float"
x = -float(tokens[1])
i looked at the script and the object file..
The section of the script in Question looks like this
Code: Select all
for line in lines:
tokens = string.split(line, ' ')
if (tokens[0] == 'v'):
n_verts = n_verts + 1
# x = float(tokens[1])
# negate x value for vertex to allow correct texturing...
x = -float(tokens[1])
y = float(tokens[2])
z = float(tokens[3])
vertex.append( ( x, y, z) )
after which it puts the next Character into X, and makes it negative
The obj file i was using lookes like this at the first line where it has 'v'
Code: Select all
v -0.01808810 6.54705524 -7.28214598
this means that as far as i can understand that now during the scripts
first loop here that
token[0]='v '
token[1]=' ' <--- notice it holds a space a white space
token[2]='-0.01808810 '
token[3]='6.54705524 '
i have no idea how string.split(line, ' ') works but can understand how it is supposed to work..
i figured it had that empty slot in
token[1], and therefore
token[2] would hold the X value
token[3] would hold the Y value
token[4] would hold the Z value
so, i alterd the script accordingly to
Code: Select all
x = -float(tokens[2])
y = float(tokens[3])
z = float(tokens[4])
i have no clue who to report this to but i figured someone here prolly has something todo with it..
Cheers
Frame