Skeletal animations and Egg

Hi all,

My exporter is coming along, but I’m a bit stuck on skeletal animations. I believe I’ve got all the animation stuff the eggSyntax.txt told me to do exported, although, pview is listing my animation, with the correct amount of frames, but when I play it I can’t see anything moving.
This is vaguely my egg file structure: (I left out most of the boring data)

<CoordinateSystem> { Z-Up }

<Comment> {
  "dae2egg /home/pro-rsoft/Projects/collada/Goblin.DAE -o goblin.egg"
}
<Material> _3_-_Default {
  <Scalar> diffr { 0.588 }
  ... more scalars ...
  <Scalar> shininess { 10 }
}
<Group> objgoblin_1-node {
  <Group> objgoblin_1-mesh-skin {
    <VertexPool> objgoblin_1-mesh-skin {
      <Vertex> 0 {
        -3.48694 9.24587 41.4919
        <UV> {
          0.3235 0.057749
          <Tangent> { -0.988697 -0.094952 0.116029 }
          <Binormal> { 0.115994 0.005908 0.993232 }
        }
        <Normal> { -0.094995 0.995464 0.005172 }
        // AlienPelvis-node:1
      }
      ... more vertices ...
    }
    <Polygon> {
      <MRef> { _3_-_Default }
      <VertexRef> { 0 1 2 <Ref> { objgoblin_1-mesh-skin } }
    }
    ... more polygons ...
  }
  ... more groups ...
}
<Table> {
  <Bundle> AlienPelvis-node {
    <Table> "<skeleton>" {
      <Table> AlienPelvis-node {
        <Xfm$Anim_S$> xform {
          <Scalar> fps { 30 }
          <Char*> order { srpht }
          <S$Anim> i {
            <V> {
              ... lots of data here ...
            }
          }
          ... more Xfm$Anim_S$ tags ...
}
<Joint> AlienPelvis-node {
  <Dart> { 1 }
  <Transform> {
    <Matrix4> {
    }
  }
  ... here a joint hierarchy ...
                    <Joint> AlienLArmDigit13-node {
                      <Transform> {
                        <Matrix4> {
                        }
                      }
                      <VertexRef> {
                        3397
                        <Scalar> membership { 0.4 }
                        <Ref> { objgoblin_1-mesh-skin }
                      }

My joint hierarchy exactly matches my animation data hierarchy, and I’m not getting any errors from chan.
As far as I’m seeing, I did everything I needed – or am I still missing something?

Thanks in advance,
pro-rsoft

There is one curiosity: the top group, the one that encloses the flag, is usually a entry, not a ; and it usually encloses all the 's and 's too. (The flag is the key flag that switches the egg loader into the character-loading mode, so it needs to be the first thing it sees, even before it sees the top joint, or any polygons or vertices.)

The animation tables, of course, should remain outside the flag group, as they are now. The structure should be something like this:

<CoordinateSystem> { Z-Up }

<Comment> {
  "dae2egg /home/pro-rsoft/Projects/collada/Goblin.DAE -o goblin.egg"
}
<Material> _3_-_Default {
  <Scalar> diffr { 0.588 }
  ... more scalars ...
  <Scalar> shininess { 10 }
}
<Group> Alien {
  <Dart> { 1 }
  <Group> objgoblin_1-node {
    <Group> objgoblin_1-mesh-skin {
      <VertexPool> objgoblin_1-mesh-skin {
        <Vertex> 0 {
          -3.48694 9.24587 41.4919
          <UV> {
            0.3235 0.057749
            <Tangent> { -0.988697 -0.094952 0.116029 }
            <Binormal> { 0.115994 0.005908 0.993232 }
          }
          <Normal> { -0.094995 0.995464 0.005172 }
          // AlienPelvis-node:1
        }
        ... more vertices ...
      }
      <Polygon> {
        <MRef> { _3_-_Default }
        <VertexRef> { 0 1 2 <Ref> { objgoblin_1-mesh-skin } }
      }
      ... more polygons ...
    }
    ... more groups ...
  }

  <Joint> AlienPelvis-node {
    ... here a joint hierarchy ...
                      <Joint> AlienLArmDigit13-node {
                        <Transform> {
                          <Matrix4> {
                          }
                        }
                        <VertexRef> {
                          3397
                          <Scalar> membership { 0.4 }
                          <Ref> { objgoblin_1-mesh-skin }
                        }
    ...
}
<Table> {
  <Bundle> Alien {
    <Table> "<skeleton>" {
      <Table> AlienPelvis-node {
        <Xfm$Anim_S$> xform {
          <Scalar> fps { 30 }
          <Char*> order { srpht }
          <S$Anim> i {
            <V> {
              ... lots of data here ...
            }
          }
          ... more Xfm$Anim_S$ tags ...
}

I’m not 100% sure this is the problem, but it seems like a likely guess.

Note that I also renamed the character name–the name that is applied both to the topmost , and to the dart –to be different from your top joint name, since it’s just confusing if they’re the same thing.

David

Thanks for your quick reply.
That however gives a problem that seems totally unrelated.

Loading goblin.egg
:loader: loading file type module: ptloader
:egg2pg: Reading goblin.egg
:egg2pg: Flattened 1 nodes.
:chan: Attempting to bind CharacterJointBundle Alien to AnimBundle Alien, 101 frames at 30 fps
:chan: Bind succeeded, index 0; accessible as Alien
Assertion failed: n >= 0 && n < (int)_points.size() at line 159 of geomVertexFormat.I
Assertion failed: i >= 0 && i < (int)_cdata->_arrays.size() at line 2213 of geomVertexData.cxx
Segmentation fault

Well, that sure seems strange. Can you email me the egg file in question?

David

Sure, I’ve put it online:
bin.pro-rsoft.com/goblin.egg.bz2

Ah, OK. Turned out to be a bug I’d introduced recently on the CVS trunk (but not on the 1.5 branch, fortunately) that caused a problem when you animate a character that includes tangents and binormals (Panda has to animate these too, if they’re present). I’ve just checked in a fix.

David

Thanks! Just did a clean build and it works great! Thanks.

(Although, as you might have noticed, it’s not animating correctly yet, but that’s probably a transform or vertexref error in my exporter or so :stuck_out_tongue: )