Previous Thread  Next Thread

chat icon Please help me get this python script to work

anotherfantasy

Posted: Tue Jun 17, 2003 1:58 am
Joined: 17 Jun 2003
Posts: 2
I want to convert my models with animations to a .X file (the Direct X Format). http://space.tin.it/clubnet/arbenom/Export.htm has a python script that was supposed to do the job but I can't get it to work.

I'm using Blender 2.27. The webpage says that 2.2 and higher is supported. I downloaded Python 2.3 into C:\Python23.

After I open up the .blend file that is included in the exporter download, I tried to run it with Alt+P. The Blender console says that line

import Blender210

is no good. I comment it out with a # and attempted to run it again. The console now says that line

import string

is no good. I then put all the python scripts and the .blend file into C:\python23\lib, which is where string.py is.

It still doesn't work. If I comment out more stuff, It still complains about not being able to import the DirectXExport modules. Please help me.
Reply with quote


Michel

Posted: Tue Jun 17, 2003 9:58 am
Joined: 16 Oct 2002
Posts: 209
Hi,
anotherfantasy wrote:

import Blender210

The above line in the script means that it's a script written for the Blender 2.10 Python API. This API is still available in Blender 2.23, but not in 2.26 and later.
So you'll have to use Blender 2.23 or convert the script to use the newer API.
Furthermore, it looks as if your PYTHONPATH is not correct. Look in the Python forum at Elysiun for tips on how to set the PYTHONPATH.

With regards,
Michel
Reply with quote


anotherfantasy

Posted: Wed Jun 18, 2003 7:56 pm
Joined: 17 Jun 2003
Posts: 2
Thanks for your help. I'm able to get it to work almost completely. Now I have a new problem.

I'm using Blender version 2.23 with Python 2.3

I'm trying to export animations to .X files using the Direct X export suite at http://space.tin.it/clubnet/arbenom/Export.htm

Seems as if only version 2.23 works. I am able to export meshes and simple animations with it. It is working properly. However, when I attempt to export animations using armatures, I get this error in the console.

File "AnimX.py", line 42, in write Materials
mesh = Blender210.getMesh(object.data)
TypeError: argument1: expected string, None found

After looking in AnimX.py (it's a file included with the Direct X export suite) the function of interest is

def writeMaterials(self,name,object):
object = Blender210.getObject(name)
mesh = Blender210.getMesh(object.data)
for index in range(len(object.materials)):
namecol = object.materials[index]
mat = Blender210.getMaterial(namecol)
self.file.write("Material")

Apparently Blender210.getObject() takes a string for a parameter but Blender210.getObject(name).data is not a string. Could someone please help me debug this? I really need this animation exporter. I don't know the data types of the objects and stuff so I'm unable to attempt to fix this on my own. If anyone can point me to documation that descripes the blender objects, that would help too.

Again, higher versions of Blender will not work with this script because of the Blender210 module usage.
Reply with quote


paposo

Posted: Thu Jun 19, 2003 4:15 am
Joined: 19 May 2003
Posts: 2
I don't think any of the documentation includes what the blender210 module does. I guess you could open the module's .py file if you had the old versions' source code to see. I was trying to update the quake model importer for blender that used the blender210 module as was able to do the same things by using the blender and nmesh modules instead of mesh and blender210. If your up for a weekend of python training and looking through the blender documentation you could probably rewrite the offensive function. Go to the documentation section in blender.org and look at the python docs 2.25
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group