Yet Another Blender Egg Exporter (YABEE)

adamr, it should be keep in mind that the script does not really able to export the whole scene (sound, light, camera e.t.c.), because the possibility of the YABEE / EGG file in this regard are limited.

sam.szuflita, You should select “Blender game” as render, then select “Game Logic” and add game property. If you enter “Collide” or “ObjectType” as the name of the property, then script process option as Collide/ObjectType respectively, otherwise the option will be exported as the “Tag”.

Tag, Collide, ObjectType

Screen

Great job on the exporter! Is there any way to put it permanently in a window? An export button would be nice, instead of always having to go through menus. Or even a shortcut key that goes to the current export menu.

Also, would it be possible to set tags through the ‘custom properties’ section of the object tab, instead of having to switch to the game render? I feel that this makes more sense anyway, since the property has nothing to do with the BGE.

I think it’s possible.

I was planning to use it when I was writing an export for the Tags, but I couldn’t find the way to get this options :frowning:

To get the options from a custom property of an object you just treat the object like a dictionary, i.e. context.active_object[‘Collide’]. It basically works exactly like a dictionary for the custom properties - its kinda hard to find in the documentation due to it not being in the list of methods. Note that it does some kind of type detection depending on what the user types in, so you would be well advised to type cast it as needed, e.g. str(context.active_object[‘Collide’]).

Ok. Thank You very much. Now I think I can add this ability in the next update.

Thanks!!! You guys are great.

OK, I tested today YABEE with one of my level blend files. The blends were originally made in Blender 2.4.

Firstly, good job on making the script faster, ninth. It took about as long as the old Chicken exporter to export my level.

Now for suggestions and issues:

  1. I’ve mentioned this before, just putting with the rest: texture relative paths are ignored. Full path is written. In Blender a relative path starts with “//”, scan the file paths for those before export.

  2. By comparing the old egg by Chicken and new by YABEE inside Panda3d, I notice the new map has almost no specularity.
    It’s either the specularity or shininess/hardness that YABEE writes differently.

  3. Seems you made an option to start Pview like Chicken. Cool. You should add check buttons for “egg2bam” and “pzip” too.
    Note that then the file path you supply to Pview will be different, a bam file or pz file, not the original egg file path.
    Same form these two. If both checkbuttons will be True, the bam file should be pzipped, not the original egg.

I haven’t tested any animated characters with the script yet.

Good job so far, ninth!

Why would I get an empty egg file? Blender is giving me this

Ideally I’d convert files from bryce, but then it gets more complicated with the obj files and the textures. There are some nice textures in there to use.

my guess would be that your blender+yabee version don’t match up.

a suggestion for yabee here: check the blender version and warn the user if yabee and blender version mismatch.

Well, I used version 12. I thought that was right. Maybe I need to check.

In some regard we need installation instructions to install the correct software in the right place for Panda, python and blender.

Using Panda isn’t that inspiring when you can’t get models and textures across. Presumably with Yabee you can bake or use UV maps. I quite like a load of textures in Bryce, but I guess that’s a complication.

I can use obj2egg to get basic models into Panda, although its uninspiring as animations are quite helpful.

Hmm. But thanks for the pointer.

You are likely using YABEE version below 12 on Blender version 2.63.
Maybe you didn’t overwrite the old script files properly?

In 2.63 BMesh was added which adds ngons support to Blender, but breaks some old code.
Mesh.faces is now Mesh.polygons. Or if you don’t want to modify your script too much there’s Mesh.tessfaces which is there just for backward campatibility. With the latter you only need slight code modifications to make your old scripts work in 2.63.

mesh.update(calc_tessface = True) # so Blender will generate a triangulated copy you can access instead
mesh.faces -> mesh.tessfaces
mesh.vertex_colors -> mesh.tessface_vertex_colors
mesh.uv_textures -> mesh.tessface_uv_textures

I had a Blender script I needed to work on both 2.63 and older versions. Having two separate scripts was too much work as each time I updated one I had to modify the other one too, so I chose to check the version of Blender and access the above data types differently depending on the Blender version.
Maybe YABEE should do that too, it complicates the code a bit but makes it campatible with older Blender versions.

if bpy.app.version[0] == 2 and bpy.app.version[1] >= 63: # for Blender 2.63 API
    mesh.update(calc_tessface = True)
    mesh.tessfaces
    mesh.tessface_vertex_colors
    mesh.tessface_uv_textures

else:
    mesh.faces
    mesh.vertex_colors
    mesh.uv_textures

Thanks. I’ve got a basic white model of it now. No material colour, but I don’t know whether it works like obj2egg and it can produce the basic material colour or not.

Btw ashamebly it was the revision 11 not 12. I had d/l 12 but obviously hadn’t done things properly. A simple copy and paste of the ioscene folder fixed it up nicely.

I can’t get animations out.
Do we need to do something more than create an object, armature, parent the object to armature (with auto weights), move some bones, press I->LocRotScale, then move to another frame and do the same, before export?

Make sure you click + and add the animations in the export panel. Also, you can apply the armature as a modifier so you know its there.

Hi, I’m having a bit of trouble getting this to work. I load up and run init.py, and then try to export it. When I do, I get this:

Traceback (most recent call last):
  File "/__init__.py", line 331, in execute
ValueError: Attempted relative import in non-package

location:<unknown location>:-1

This is the line from init.py line 331:

from .yabee_libs import egg_writer

I’m assuming blender is looking in a certain directory for modules, but I’m not sure where that is. I tried putting the yabee_libs folder in ~/.blender/scripts and in ~/.blender/scripts/modules. Anyone know what I did wrong? Thanks!

I’ve been fooling around with trying to get this to work for about 6 hours now and it just isn’t happening. No matter what paths I use, or where I put my textures, this is always the output when trying to load the .egg model:

Error in ../mypath/mymodel.egg at ...
<Texture> My Model Texture 512 {
parse error

I’m out of ideas; hopefully someone else will know what’s up.

Ok, I don’t know why I didn’t think of this before but the problem lies with spaces in any names used by Blender. I had to rename the material, uv map and texture to remove any spaces in their names. Panda was then able to correctly load the models.

RylandAlmanza, You should place io_scene_egg in the scripts/addons dir, then run Blender and activate YABEE in the Blender user preferences menu (Ctrl + Alt + U) -> Addons -> Import-Export -> Import-Export: Panda3D EGG format.

Rabbit, it’s strange, I thought I made ​​the processing of names with spaces. I’ll check it.

  1. Addon fails to copy texture images if they are packed in the blend file.

  2. I see these in the egg file

<Scalar> alpha-file { "./tex\mytexture.png" }

Is that right? I don’t use separate files for alpha textures.
Also it should be “./tex / mytexture.png”.

  1. If copy textures is disabled, relative paths are ignored.

  2. can only see textures in Pview if I click on the “UV as textures”. But my model has a material with texture on it.

egg: pasteall.org/34514
blend to export to egg: pasteall.org/blend/15932

  1. Also I can’t get an animated egg to export. I mean i can if I use the UI, but if I generate and assign Armatures by code then no Dart group is exported.
object.parent = armObject
object.parent_type = 'ARMATURE'

I couldn’t reproduce the problem with the UI, but since the Armature acts just fine in Blender, maybe the exporter has the problem.
I’ll try to make an example blend.

This is absolute a great add. I think adding the tagging to the object custom properties will be nice too. Smooth the work flow. This really* adds a lot of functionality w/o having to futz around by hand with egg files. Thank you thank you thank you!

ahh thank you this is so cool