voodoo to blender script problem

hey, can anyone help me with this import script? i cant remember who made it.


######################################## 
#  Importer for maxscript output       # 
#  from Voodoo camera tracker          # 
######################################## 
#    Modify the path / filename        # 
#    then ALT-P to start.....          # 
######################################## 
# Almost no error checking I'm afraid! # 
# It is entirely possible that your    # 
# computer could explode if you run    # 
# this script!!!!                      # 
######################################## 

import Blender 
from Blender import * 
from math import * 

#Change the filename below to the name of your maxscript exported from Voodoo 
max_file = 'c:\Camerascript.ms'            

sc = Scene.getCurrent() 

# Main code 
# Open the file specified in max_file 
fp = open(max_file) 
dt = fp.read() 
fp.close() 

source = dt.splitlines() 
total_lines = len(source) 
no_points = 0 
ref_points = [] 

# Now loop through each line in the file 
for i in range(total_lines): 
    line = source[i] 
    if line[:8] == 'at time ': 
        pass 
    # Will fix camera creation later on    
    # 
    # Now check for points 
    if line[:12] == '  point pos:': 
        # Parse out the three numbers 
        part1 = line.split("[") 
        part2 = part1[1].split("]") 
        part3 = part2[0].split(",") 
        points = [float(part3[0]),float(part3[1]),float(part3[2])] 
        ref_points.append(points) 
        no_points = no_points + 1  

ref_mesh = NMesh.New() 

# Now create the mesh of reference points 
for i in range(no_points): 
    mypoint = NMesh.Vert(ref_points[i][2],ref_points[i][0]*-1,ref_points[i][1]*-1) 
    ref_mesh.verts.append(mypoint) 

NMesh.PutRaw(ref_mesh, "Reference points") 

Blender.Redraw() 

no matter where i put the file, blender says “error, check console” and the console says that the file doesnt exist. but it does, it tried it three times in 3 different places

in case it helps, windows xp comp, no 3ds max on it.

\ is the escape character in Python’s string. To use a backslash, you have to double it. For example:

max_file = 'c:\\Camerascript.ms'

Martin

thanks, but it still doesnt work, any other ideas?

Do you still get an error message? If so, what is it?

If not, I’m not sure if NMesh.PutRaw() create an object to link the mesh to? (I haven’t used it myself, always used Blender.Object.New().link())

Maybe try this:

  1. Add a plane (or any mesh, really)
  2. Exit edit mode
  3. In editbuttons (F9) find the “ME:” datablock selector (probably in/near the top left)
  4. Change it to the mesh “Reference points”

Also, the created mesh has verts, but no faces, so it won’t render… but it should turn up as dots in the view (like a particle system does) if you’re in wireframe mode. It’ll be invisible in shaded (ZKey) mode

It does, so that’s probably not the problem.

Martin

i tried your mesh thing, but it still doesnt work. wat happens exactly is the text window highlights "fp = open(max_file) " in red, and says “error: python script error, check console”

the console says: IOError: [Errno2] No such file or directory: ‘c:\Camerascript.ms’

That’s pretty much straight forward I’d say. The file either doesn’t exist or is misspelled.

Martin

thanks, i feel really stupid, i spelled it wrong. but now i have another problem. i can get the script to run, but nothing happens. any ideas?