Yet Another Blender Egg Exporter (YABEE)

yabee
blender

#1

Egg exporter for the Blender 2.5, 2.6, 2.7

[i]Exporting:

  • Meshes
  • UV layers
  • Materials and textures (Partially)
  • Armature (skeleton) animation
  • ShapeKeys (morph) animation
  • and collision otions export through Blender’s “Game logic” -> “properties”
  • Non cyclic NURBS Curves
    [/i]

Old versions: R7, R10/B2.57, R11/B2.57, R12-13

Doc by Preusser 2shared.com/document/jfPo7OPo/yabee.html

New versions:
Mercurial repository http://yabee.googlecode.com (deprecated)
GitHub https://github.com/09th/YABEE (Main)

Download latest version https://github.com/09th/YABEE/archive/master.zip


Textures of Models in Blender not Showing up in Panda3D
Blender to Panda3D
Chicken Exporter + Octree
Help with applying a texture
How to import Blender to Panda
Not loading blender animations
Collision Detection for a Cube and Uneven Ground?
Recomended or best 3D modeling program
reliable exporter to egg [SOLVED]
Blender object exporting trouble
What's your art path?
Textures
Hello! I'm new :)
Will Panda work for me?
Options on Exporting Models with Animations
Export egg using latest Blender
Textured Models, blender -> dae2egg/ x2egg -> panda??
x2egg problem
Chicken error
import procedural texture from blender
Visual C++ edition to use with version 1.8.0 of Panda 3D ?
modeling
#2

Yeah, I was thinking of doing one, I’m really tired of waiting for the full Collada support. I think a 2.5 egg exporter wasn’t written till now because both Blender 2.5 and the 2.5 API were beta. Blender 2.57 is considered stable, but the API, according to the site description, is still subject to change. I’m not sure if it’s worth to write one now, but I also don’t think there will be any huge changes to the API.
Just to make sure, is this reference up to date?
panda3d.cvs.sourceforge.net/pand … iew=markup

Also, I have written some similar tools, but I’ve never worked with morphs, so i could use some help on that.

BTW, this won’t run on 2.57.0
this line:

from bpy_extras.io_utils import ExportHelper

#3

Thanks for the link. It’s tonn of works to make support all panda egg features )
Hm. I test script on Blender 2.57.1 r37344 Ubuntu 10.04.
An example of the interface code I get from the standard script, going with blender, so you can see how this line looks in your version. For example in *.OBJ exporter.
Also you can remove interface code and replace

if __name__ == "__main__":
    register()

with

if __name__ == "__main__":
    write_out('/path/to/file.egg')

to avoid use interface functions.


#4

I guess this proves one more time that Blender 2.5 API is still changing, the code you had written for 2.57 didnt work for 2.56, thats why Im wondering if its worth to wait a bit more.


#5

Yes, I agree. But I think in the future changes will not be so major that the script could not be brought into compliance with the actual version.


#6

Yay, finally somebody started on this :slight_smile:
On time or not, many surely will find this post very useful.
Since there are a few people interested in this, how about starting a community repo now (github, bitbucket, sourceforge)? We could use this code as a base.

Will try it out by chance.

Thanks again.


#7

if we are going to work together, we need to follow some common set of rules. We can break down the script into blocks. I think we could have every entry as a separate function. Make it so you don’t need to know the internals of each if you want to add something new. This will also make it easier to modify the code.

I’m still getting used to the new 2.5 API.


#8

If someone makes a repo, I’ll be happy :wink:
I’ll try to break down the script into the blocks, but it may be a bit difficult. For example: Blender holds UV information in faces, Panda - in vertices.


#9

I dont know what you mean by Blender holding UV information in faces, Ive never heard of such way.
I think you can do:

uvs = []

for face mesh.faces:
    for vert in face.verts:
        uv = vert.uvco
        uvs.append(uv)

These are called “sticky” UVs, there is also face.uv, maybe its the one you are using.


#10

I get UV layers throug the object.data.uv_textures becouse object can contain more then one UV layer


#11

Didn’t think of that.
Im not sure.

BTW, can you post a link where you downloaded your Blender version? The latest one from graphicall doesnt even render any buttons.


#12

I use ppa repository
sudo add-apt-repository ppa:cheleb/blender-svn

MultiUV

As i known, multi UV used for shadow maps, normal maps etc.


#13

Yes, I know that Blender and egg support multiple UV maps. I just mean I’m not sure how to access them. From what you say by your method you get face UV maps, but you need vertex UVs, right?

As for Blender 2.57, I’ll just try the not so new versions and see if they have the same problem.
EDIT: OK, got a working 2.57, reading your code now…

BTW, is there no epydoc/ doxygen API reference for 2.5? I got used to those.


#14

I can provide access to the sourceforge repository if people are serious about developing it - not sure if that is what people want to do or not. I would want to make sure that the revision history in there remains however, so people can continue to get the 2.4x version (i.e. deleting the existing files (Though you would probably want to keep the exisitng test suite) and then checking in the new once would be fine, as the history would remain, but resetting the repository would not.).

As for breaking up the functionality I would strongly recommend separating it into classes, preferably spread over multiple files, and using inheritance where appropriate - Chicken did that and it still ended up as spaghetti - without at least them I suspect you would be doomed. Also be careful of the material/texture system - its very easy to end up with a never-ending sequence of if statements, as there are so many possible combinations.


#15

Anon: blender.org/documentation/bl … pi_2_57_1/ it’s all that we have
As for me - i mostly use dir/doc and examples.

lethe: thanks for advice ) I’m not sure about the seriousness )
I’ll continue to publish the script in this thread and if someone will want to add something, then we’ll can think about the repo)


#16

I don’t see a need for classes. I’ve never needed them in Blender scripts.

As for the repo, we could just make a new one. If it is written from scratch and doesn’t work the same way, I don’t see a point in calling it “Chicken exporter”. It would be misleading. People would think it works the same way, has the same GUI, etc.


#17

imho, object-oriented style is not only useful but also just a good tone)

Yes, it’s really not chicken. But I would like to make a script similar with chicken’s features.

Added hierarchy conversion for the selected objects as shown below


#18

I think for a “simple” exporter it wont help much. I know its not “simple” to make, but what the script basically does is retrieve data and write it to a file. I dont see how inheritance and polimorphism, etc. could be used here. I do use oop in most of my projects, but I think an exporter could even be put in a single module. Ive worked on some importers/exporters and other Blender scripts before, so I dont think im a noob, but the formats were alot simpler than egg. Many Blender exporters seem to work the same way. If you could give an example of how using oop would help here, then I’d be happy to learn.

But I wouldn’t wrap everything up in a class just for the “good tone” (Im not really sure what you mean by that).

BTW, if its just preference, then Ill still be happy to work with you on this, its not a big deal.


#19

Go look at the current Chicken exporter if you want to see why its a good idea. It divides the functionality up in a neat and easily extendible way - and yes, inheritance is used because a static mesh is an empty with extra stuff, and an animated mesh is a static mesh with extra stuff. It also makes handling the hierarchy and the shared nature of materials/textures relatively neat (I know Chicken is a terrible example, as its a total mess, but its the most relevant one to give.). Also note that an export can not be done with a single pass, at least not sensibly, so you have to store data - if you use functions alone you will end up either emulating objects or duplicating calculation, both of which would be silly.

Most exporters are relatively simple, because they are simple file formats with few features, but egg is not a simple file format. Collada is a format of comparable complexity - if you look at Blenders Collada exporter it has multiple classes in multiple files extending to thousands of lines of code (In c++, but the point remains.).


#20

Is there a list of things which can’t be done in a single pass?

Yeah, I know. Ive worked on one which supported materials, textures, bones and animations, but it was still alot simpler than egg.

You have worked on the Chicken exporter for some time, do you have some suggestions on how to structure the code? Is the current one okay? Or should we just work and restructure the code in the future if needed?