PDA

View Full Version : Blender 2.5 Voodoo .py import



PuG
12-Jan-10, 03:30
Good day, experimenting with the latest Blender 2.5 and Voodoo motion tracking - exported a .py scene from Voodoo though when trying to run the script I keep getting a syntax error on the following line:


print o.name[:10]Error in Blender:


location:<unknown location>:-1
SyntaxError:invalid syntax
^

print o.name[:10]Unfortunately my python isn't good enough to understand the problem, im guessing the print function has changed in the different python versions?

Pastebin of the file: http://pastebin.com/m27d430f9

Has anyone else had this problem?

Best Regards



Update:

Okay made some progress, turns out the print function needs to be enclosed in brackets, e.g :


print(o.name[:10])Now problems with the import Blender module, doesn't exist.

Probably easier to import into 2.49 and save the scene :)

JoshG3D
04-Feb-11, 17:39
yea i'm getting some errors like that too

revolt_randy
04-Feb-11, 17:54
Just used voodoo a couple of days ago. I'm not very good at python, but from what I see you are using voodoo's export 2.49, and not the exporter for 2.5. The version of python for 2.49 doesn't require parenthesis for print statements, the version for 2.5 does require them. So I think you are exporting the wrong python export.

As another note, the python file for 2.5 that I got from voodoo didn't just work with 2.56a beta. There was a change in the python api. I think the change was set_frame was changed to frame_set. So I had to go thru the entire script from voodoo and do a find & replace on the script. It went really fast, no big deal...

Randy

Uncle Entity
04-Feb-11, 18:35
You also have to change a bunch of Matrix() init functions since the old way has changed. IIRC it involves making them a tuple by adding () surrounding the parameters.

So this:
vcam.matrix_world = mathutils.Matrix([0.986389,0.010807,0.164070,0.000000], [-0.004649,-0.995605,0.093532,0.000000], [0.164360,-0.093022,-0.982004,0.000000], [-1.506059,0.231502,7.789379,1.000000])

becomes:

vcam.matrix_world = mathutils.Matrix(([0.986389,0.010807,0.164070,0.000000], [-0.004649,-0.995605,0.093532,0.000000], [0.164360,-0.093022,-0.982004,0.000000], [-1.506059,0.231502,7.789379,1.000000]))

...or something like that.

Plus the camera doesn't get imported properly so you'd probably be better off importing into 2.49 and then opening the .blend in 2.5x.