Obj2egg Update and Fork

Hello everyone,
I’m working on a computer science project and required the use of something to get models out of Blender 2.8 (and other programs like Autodesk Inventor) for use with Panda3D. As Yabee is currently unavailable for Blender 2.8 I set about updating Treeform’s obj2egg script.

I believe it works with the latest Panda3D and is designed to work with Python 3. Please let me know if you come across any bugs.


So, apologies in advance for sounding ignorant on something probably very basic. I tried to open the readme in order to better understand how to use the python file; however when I open it, I see this as follows:

Last login: Fri Dec 27 17:37:20 on ttys001

/Users/User/Desktop/obj/obj2egg-master/README ; exit;

(base) Users-MacBook-Pro-4:~ User$ /Users/User/Desktop/obj/obj2egg-master/README ; exit;
Saving session…
…copying shared history…
…saving history…truncating history files…
[Process completed]
Should this not give me information on how to use the .py file for the file conversions?

Also, when I type in python3 obj2egg.py Slime.obj it returns this error:
(base) Users-MacBook-Pro-4:obj2egg-master User$ python3 obj2egg.py SLime.obj

Blender v2.80 (sub 75) OBJ File: ‘Slime.blend’

Blender MTL File: ‘Slime.blend’

Material Count: 4

SLime.obj:545: ignoring: [‘s’, ‘1’]

SLime.obj:711: ignoring: [‘s’, ‘off’]


name ‘Point2D’ is not defined

That last error is odd.

Try something, if you will please: in a terminal/command-prompt (I’m not sure of what Mac calls it ^^; ) run python3 by itself (i.e. type “python3”, followed by pressing “enter”). That should give you an interactive Python console. In that console, attempt to import Panda classes (as you would in a normal program), in particular “Point2D”. Report back, please, whether importing such classes succeeds or fails.

As an as-yet unfounded guess, I’m wondering whether perhaps you have the Python2 version of Panda installed, and not that Python3 version…

1 Like

It looks like the obj2egg.py script is simply missing a from panda3d.core import Point2D line.

The README file should not be opened in Terminal.app, but in a text editor.


That was it! The file converted to a .egg; however, it seems the .mtl that was placed in the same location as the .obj file was not used with the conversion. I used pview to confirm that the model was textureless after the conversion.

Considering the lines in the code:
def __eggifymats(self, eprim, wmat):
if wmat in self.materialsbyname:
mtl = self.materialsbyname[wmat]
if mtl.isTextured():
# NOTE: it looks like you almost always want to setMaterial()
# for textured polys… [continued below…]

During the conversion process, it never actually enters the “if textured” statement at all. I have tried multiple different models from different online sources.

(Side Note) It seems this also does not work if the original models used either .png or .jpg files to texture the model.

This works for me! I should be in the correct version of Panda.

1 Like