Yet Another Blender Egg Exporter (YABEE)

ok while… i poked around a bit, reducing += string operations given those mechanisms http://wiki.python.org/moin/PythonSpeed/PerformanceTips#String_Concatenation
it reduced the export time from 200 to 180 seconds.
appears that the tangent and binormal generation take the lion share and i cant find any 2.59 references for tangent calculation code. altho blender sure is capable on c level as it. so… until blender wraps up the tanget calc , disregard my performance advice above. btw. respect for caculating tangets and binormal manually.

i would favor a switch to turn tangets and binormal calculation off. Unless one uses normal maps those may not be necessary.

Thank you for your comments. I was planning to enter the variable to disable the calculation of TBN.
I did not find information on how to calculate the TBN in Blender too, so i had to reinvent the wheel.
btw. TBN is not my merit - I just translated the the C++ code, which i found through Google.

last month I was on vacation and resting from computer =) So, now i plan to continue work with exporter

nice :slight_smile:

I’ve found that Yabee doesn’t seem to export vertex colors. Is that correct? And if so, I’d like to make a request for this feature :slight_smile:.

Welcome back, then :slight_smile:. I can’t wait for the new updates.

Hi,

Really good work here, I’ve wanted to upgrade to 2.5 more or less for the gui for a long time now, I’m glad someone managed to create an export script for it!

I’ve got a bit of a weird problem though, I built an animated character using an armature + armature modifier + weight paint (on 6 different blender nodes/models, ex. left & right feet, hands, body, and tail, are all seperate)

when I export it (with separate animation files on, mind you), I get a strange behavior

Viewing the model in pview, ex “pview pico.egg pico-walk.egg”, works perfectly.

However, viewing the model as a simple panda3d Actor class, fails miserably and only shows his right shoe, clearly I want his whole body shown,

This is the code I am using:

from direct.directbase import DirectStart
from direct.actor.Actor import Actor

print 'For some magical reason, loading the animation as an Actor class, is failing miserably'
print 'and only shows his right shoe, however, try running the following to preview it in pview:'
print '    pview pico.egg pico-walk.egg'

m = Actor('pico', {'startWalk': 'pico-startWalk', 'walk': 'pico-walk', 'stopWalk': 'pico-stopWalk'})
m.reparentTo(render)
m.loop('walk')

run()

I wrapped all of this, minimal textures, code in “err.py”, and the egg and blender versions of the model, I am using r10 of the script, there are no errors exporting as far as I’ve seen, and again, it views perfectly in pview, just has problems in python’s Actor class

in this zip file here:
http://www.mediafire.com/?p90t66p55t35m5t
it’s < 1mb so you should have no problems getting it, if you need me to upload it somewhere else or email it to you let me know,

I really appreciate any help or clarification on what’s going wrong with it :smiley:

~powerpup118

Actually, you has more then one actor in the single file. Pview processed this situation, and Actor class - not. Actor load only one animated mesh. You should join all parts in the single mesh in Blender to get single Actor, or do something like this:

pico = loader.loadModel('pico')
pico.reparentTo(render)
pico_parts = []
for part in pico.findAllMatches('**/+Character'):
    actor = Actor(part, {'startWalk': 'pico-startWalk', 'walk': 'pico-walk', 'stopWalk': 'pico-stopWalk'})
    actor.reparentTo(render)
    actor.loop('walk')
    pico_parts.append(actor)
    part.removeNode()

Although, thanks to your example, I found one more bug in YABEE :slight_smile:

Thank you alot! It works properly now that you explain it, the reason I have different Actor’s is for customization (changing textures on him in-game etc)

Thank you again,
~powerpup118

Hi, I’ve been having bone roll issues with the exporter. The orientation of models’ parts changes depending on the roll of the armatures’ bones. I have to manually adjust the roll for each bone, export, and then readjust the roll until the egg looks like the original animation. Is this an error on my part or the exporters?

Can you upload a couple of explaining screenshots? I’m not quite realize what’s going on :frowning:

What ambyra says is, I guess, that a bone in blender has more properties than position and direction.
It also has a length and a rotation around its own length axis.
All those can be used in blender for rigging and animation.

I’m not sure.
Actually bone’s length is not affect to anything (I’m do not mean the scale or spline bones). Direction and rotation around its axis is equivalent of the Euler angles, used in the *.EGG

Hello,

Right to the point: I can’t get my textures to work.

Now some background. I’m totally new to Python and Panda3D, so forgive me if there is an obvious solution I’m not seeing.

I’ve created a basic cube in blender 2.59. The UVs have been unwrapped and I assigned a material to it which contain a normal map, emitter map, specular map, and diffuse map(all set to Coordinates: UV). I tried using the script you have so generously provided everyone and followed the instructions to the best of my ability. But when I take the new .egg into pview.exe the only map that seems to be working is my emitter map. Could you take a look and please tell me what I am doing wrong? Here are a couple screen shots of the cube, first is how it’s supposed to look, second is how it looks in pview:


Here’s what my .egg looks like:

<CoordinateSystem> { Z-up } 
<Material> Panel_Material {
  <Scalar> diffr { 0.640 }
  <Scalar> diffg { 0.640 }
  <Scalar> diffb { 0.640 }
  <Scalar> specr { 0.500 }
  <Scalar> specg { 0.500 }
  <Scalar> specb { 0.500 }
  <Scalar> shininess { 37.0 }
  <Scalar> emitr { 0.000 }
  <Scalar> emitg { 0.000 }
  <Scalar> emitb { 0.000 }
}

<Texture> Spec {
  "/c/Projects/eggTests/Panel_Spec.png"
}

<Texture> Emitter {
  "/c/Projects/eggTests/Panel_Illum.png"
}

<Texture> Diffuse {
  "/c/Projects/eggTests/Panel_Diffuse.png"
}

<Texture> Normal {
  "/c/Projects/eggTests/Panel_Norm.png"
  <Scalar> envtype { NORMAL }
}

  <Group> Cube {
    <Transform> {
      <Matrix4> {
        1.000 0.000 0.000 0.000
        0.000 1.000 0.000 0.000
        0.000 0.000 1.000 0.000
        0.000 0.000 0.000 1.000
      }
    }
    
    <VertexPool> Cube {
      <Vertex> 0 {
        1.000 1.000 -1.000
        <UV>  {
          0.000 0.000
          <Tangent> { 0.363 -0.893 0.265 }
          <Binormal> { -0.845 -0.496 -0.201 }
        }
      }
      <Vertex> 1 {
        1.000 -1.000 -1.000
        <UV>  {
          1.000 0.000
          <Tangent> { 0.196 -0.535 0.822 }
          <Binormal> { -0.822 -0.535 -0.196 }
        }
      }
      <Vertex> 2 {
        -1.000 -1.000 -1.000
        <UV>  {
          1.000 1.000
          <Tangent> { -0.094 -0.656 0.749 }
          <Binormal> { -0.749 0.656 0.094 }
        }
      }
      <Vertex> 3 {
        -1.000 1.000 -1.000
        <UV>  {
          0.000 1.000
          <Tangent> { -0.000 -0.707 -0.707 }
          <Binormal> { -0.959 0.167 0.229 }
        }
      }
      <Vertex> 4 {
        1.000 1.000 1.000
        <UV>  {
          0.000 0.000
          <Tangent> { -0.893 0.363 -0.265 }
          <Binormal> { -0.496 -0.845 0.201 }
        }
      }
      <Vertex> 5 {
        -1.000 1.000 1.000
        <UV>  {
          1.000 0.000
          <Tangent> { -0.509 -0.695 0.509 }
          <Binormal> { -0.509 0.509 -0.695 }
        }
      }
      <Vertex> 6 {
        -1.000 -1.000 1.000
        <UV>  {
          1.000 1.000
          <Tangent> { -0.496 0.201 0.845 }
          <Binormal> { -0.893 -0.265 -0.363 }
        }
      }
      <Vertex> 7 {
        1.000 -1.000 1.000
        <UV>  {
          0.000 1.000
          <Tangent> { -0.535 0.196 0.822 }
          <Binormal> { -0.535 -0.822 -0.196 }
        }
      }
      <Vertex> 8 {
        1.000 1.000 -1.000
        <UV>  {
          0.000 0.000
          <Tangent> { 0.363 -0.893 0.265 }
          <Binormal> { -0.845 -0.496 -0.201 }
        }
      }
      <Vertex> 9 {
        1.000 1.000 1.000
        <UV>  {
          1.000 0.000
          <Tangent> { -0.893 0.363 -0.265 }
          <Binormal> { -0.496 -0.845 0.201 }
        }
      }
      <Vertex> 10 {
        1.000 -1.000 1.000
        <UV>  {
          1.000 1.000
          <Tangent> { -0.535 0.196 0.822 }
          <Binormal> { -0.535 -0.822 -0.196 }
        }
      }
      <Vertex> 11 {
        1.000 -1.000 -1.000
        <UV>  {
          0.000 1.000
          <Tangent> { 0.196 -0.535 0.822 }
          <Binormal> { -0.822 -0.535 -0.196 }
        }
      }
      <Vertex> 12 {
        1.000 -1.000 -1.000
        <UV>  {
          0.000 0.000
          <Tangent> { 0.196 -0.535 0.822 }
          <Binormal> { -0.822 -0.535 -0.196 }
        }
      }
      <Vertex> 13 {
        1.000 -1.000 1.000
        <UV>  {
          1.000 0.000
          <Tangent> { -0.535 0.196 0.822 }
          <Binormal> { -0.535 -0.822 -0.196 }
        }
      }
      <Vertex> 14 {
        -1.000 -1.000 1.000
        <UV>  {
          1.000 1.000
          <Tangent> { -0.496 0.201 0.845 }
          <Binormal> { -0.893 -0.265 -0.363 }
        }
      }
      <Vertex> 15 {
        -1.000 -1.000 -1.000
        <UV>  {
          0.000 1.000
          <Tangent> { -0.094 -0.656 0.749 }
          <Binormal> { -0.749 0.656 0.094 }
        }
      }
      <Vertex> 16 {
        -1.000 -1.000 -1.000
        <UV>  {
          0.000 0.000
          <Tangent> { -0.094 -0.656 0.749 }
          <Binormal> { -0.749 0.656 0.094 }
        }
      }
      <Vertex> 17 {
        -1.000 -1.000 1.000
        <UV>  {
          1.000 0.000
          <Tangent> { -0.496 0.201 0.845 }
          <Binormal> { -0.893 -0.265 -0.363 }
        }
      }
      <Vertex> 18 {
        -1.000 1.000 1.000
        <UV>  {
          1.000 1.000
          <Tangent> { -0.509 -0.695 0.509 }
          <Binormal> { -0.509 0.509 -0.695 }
        }
      }
      <Vertex> 19 {
        -1.000 1.000 -1.000
        <UV>  {
          0.000 1.000
          <Tangent> { -0.000 -0.707 -0.707 }
          <Binormal> { -0.959 0.167 0.229 }
        }
      }
      <Vertex> 20 {
        1.000 1.000 1.000
        <UV>  {
          0.000 0.000
          <Tangent> { -0.893 0.363 -0.265 }
          <Binormal> { -0.496 -0.845 0.201 }
        }
      }
      <Vertex> 21 {
        1.000 1.000 -1.000
        <UV>  {
          1.000 0.000
          <Tangent> { 0.363 -0.893 0.265 }
          <Binormal> { -0.845 -0.496 -0.201 }
        }
      }
      <Vertex> 22 {
        -1.000 1.000 -1.000
        <UV>  {
          1.000 1.000
          <Tangent> { -0.000 -0.707 -0.707 }
          <Binormal> { -0.959 0.167 0.229 }
        }
      }
      <Vertex> 23 {
        -1.000 1.000 1.000
        <UV>  {
          0.000 1.000
          <Tangent> { -0.509 -0.695 0.509 }
          <Binormal> { -0.509 0.509 -0.695 }
        }
      }
    }
    
    
    <Polygon> {
      <TRef> { Normal }
      <TRef> { Diffuse }
      <TRef> { Emitter }
      <TRef> { Spec }
      <MRef> { Panel_Material }
      <Normal> {0.000 0.000 -1.000}
      <VertexRef> { 0 1 2 3 <Ref> { Cube }}
    }
    <Polygon> {
      <TRef> { Normal }
      <TRef> { Diffuse }
      <TRef> { Emitter }
      <TRef> { Spec }
      <MRef> { Panel_Material }
      <Normal> {0.000 0.000 1.000}
      <VertexRef> { 4 5 6 7 <Ref> { Cube }}
    }
    <Polygon> {
      <TRef> { Normal }
      <TRef> { Diffuse }
      <TRef> { Emitter }
      <TRef> { Spec }
      <MRef> { Panel_Material }
      <Normal> {1.000 -0.000 0.000}
      <VertexRef> { 8 9 10 11 <Ref> { Cube }}
    }
    <Polygon> {
      <TRef> { Normal }
      <TRef> { Diffuse }
      <TRef> { Emitter }
      <TRef> { Spec }
      <MRef> { Panel_Material }
      <Normal> {-0.000 -1.000 -0.000}
      <VertexRef> { 12 13 14 15 <Ref> { Cube }}
    }
    <Polygon> {
      <TRef> { Normal }
      <TRef> { Diffuse }
      <TRef> { Emitter }
      <TRef> { Spec }
      <MRef> { Panel_Material }
      <Normal> {-1.000 0.000 -0.000}
      <VertexRef> { 16 17 18 19 <Ref> { Cube }}
    }
    <Polygon> {
      <TRef> { Normal }
      <TRef> { Diffuse }
      <TRef> { Emitter }
      <TRef> { Spec }
      <MRef> { Panel_Material }
      <Normal> {0.000 1.000 0.000}
      <VertexRef> { 20 21 22 23 <Ref> { Cube }}
    }
  }

Any help on this would be greatly appreciated!

Thanks muchly,
~B-Man

i ran into the same problem. but when exporting multiple meshes with different materials at once. it seems to assign all textures to all faces.

So what you’re saying is that it’s basically applying every map type as a color map?

Is there something special I need to do in blender to flag the different map types?

And I probably should have asked this first: what can Panda3D handle shader-wise? Does it only support basic diffuse textures? Or can it handle specular, emitter, and normal maps too?

Thanks,
~B-Man

panda can deal with anything you teach your shader to process. i think the autoshader works with diffuse, spec, normal and glow at least. from what it looks like. it applies all textures to all meshes.

it does seem to tag the normal maps correctly, the diffuse don’t need any special tags. spec and glow probably are not handled correctly yet.

Cool. I just tried exporting again. This time I left out the glow and spec and it shows the diffuse correctly now, but I don’t see any sign of a normal map being applied in pview (I pressed ‘l’ to show lights and still nothing but the color map). Does the pview not support normal maps?
Sorry, ignore the greyed out bit, didn’t realize you had to turn on per-pixel lighting :blush:

Also is there a way I can apply the spec and glow map after I use the yabee.py to export the .egg?

Thanks,
~B-Man

You have to also press ‘p’ in pview to enable per-pixel lighting for the normal maps.

David

Thank-you, didn’t realize I needed to turn it on :laughing:.

I have another question that may be out of the scope of this thread, but: How do you add collision surfaces to the models? Is there a special naming convention for the meshes so that they turn into collision surfaces upon export?

Thanks,
~B-Man

At the moment, are not exported envtypes. I’m working on it. ) For your particular case needs to be written envtypes by hand. Like this:

<Texture> Spec {
  "/c/Projects/eggTests/Panel_Spec.png"
  <Scalar> envtype { GLOSS }
}

<Texture> Emitter {
  "/c/Projects/eggTests/Panel_Illum.png"
  <Scalar> envtype { GLOW }
}

<Texture> Diffuse {
  "/c/Projects/eggTests/Panel_Diffuse.png"
  <Scalar> envtype { MODULATE }
}

<Texture> Normal {
  "/c/Projects/eggTests/Panel_Norm.png"
  <Scalar> envtype { NORMAL }
} 

Awesome! Thank you very much! :smiley:
I’ll give this a shot.

~B-Man