exporting .x models from blender, then importing to panda

Hi All,

I’m a huge noob when it comes to coding/panda3D/python but I know how to use computer modeling tools. I looked in the panda manual and it said if I export a .x file from blender and load it directly into panda it will work, but its not working for me.

So far this is my code:

import direct.directbase.DirectStart

enemyTurret = loader.loadModel(“models/enemyTurret”)
enemyTurret.reparentTo(render)

run()

I have made sure my model is in the right folder and everything. I even tried importing the enemyTurret.x file into blender and everything imports fine. The problem is that the program crashes with the error:

:loader(error): Couldn’t load file models/enemyTurret.egg: not found on model path (currently: “/c/Documents and Settings/Admin2/Desktop/CSA 251;/c/Panda3D-1.5.3/etc/…;/c/Panda3D-1.5.3/etc/…/models”)
Traceback (most recent call last):
File “testingModels.py”, line 4, in
enemyTurret.reparentTo(render)
AttributeError: ‘NoneType’ object has no attribute ‘reparentTo’

**** End of process output ****

This is weird considering how I load all my models out of the same folder (which enemyTurret.x is in). If anyone could give me some feedback I would greatly appreciate it. I browsed the forums and couldn’t find any similar topics, but sorry if I missed a previous thread.

Cheers,
CJ

Try adding the .x file extension to your loading code. The loader seems to look for eggs by default.

After adding .x the default panda screen shows up (all grey) but I get this error message:

:angry:file(error): Cannot open /c/Documents and Settings/Admin2/Desktop/CSA 251/models/enemyTurret.x for reading.
Unable to open X file: /c/Documents and Settings/Admin2/Desktop/CSA 251/models/enemyTurret.x
:util(warning): Adjusting global clock’s real time by -1.14434 seconds.

Did I export the x file wrong?

Also, it seems I may be better off using the x2egg converter… however I can’t find any instructions on how to use it even after spending 2 hours in the forums and manual… so either good instructions aren’t out there or I’m Ben Dover

If you think you will be working with blender as modelling app, I would recommend you to use Chicken, a Blender plugin that makes an egg from your .blend

x2egg works just like this:

x2egg blah.x blah.egg