Regarding Tagging and getting Transform from Maya (SOLVED)

I think this question has been asked before, but I’m not sure how to search for it…

Basically, I have created a melscript of sorts which allow me to add extra attributes to the objects, such as XPos, Type, etc.

So… How do I make it such that it will be exported into the egg file?


Look at the eggObjectFlags.mel script, which is provided with Panda. This assigns the “eggObjectTypes” (or “eggObjectTypes1”, etc.) node attribute to the string you specified; and the maya2egg converter copies that string into the flag within the egg file.

So you can use any of the pre-defined ObjectType flags, or you can define your own with the egg-object-type syntax in your Config.prc file, e.g. “egg-object-type-myflag { egg syntax }”.


Thanks for the reply, but I was kind of referring to making it such that I add the attribute to the objects in Maya, and when I export it into an egg file, it will have a tag in it.


I add the XPos attribute with the value 5.00 to the object in Maya.
I then export it into an egg file.
In the egg file, there will be a part in the object:
XPos {5.00}

Any ideas?

I don’t believe maya2egg supports the attribute. It only supports .

Thus, you would have to do this by predefining the kinds of tags you might want to enter, e.g. you could add to your Config.prc:

egg-object-type-xpos500 <Tag> XPos {5.00}

And then add “xpos500” to the list of tags offered by eggObjectFlags.mel. Then you can add that tag in Maya with the selection box created by eggObjectFlags.mel.


Oh damn. Are you sure?

'cuz basically, what I’m doing is that I’m actually creating a level, and then tagging objects in the level, so that I can replace those objects with panda scripted objects.

HOWEVER, I need to tag values on them as well, mainly their orientation (HPR) and their scale, 'cuz I have no idea how to get their maya scale and orientation from the egg files. So I created a melscript which actually automatically takes their orientations and their scale, and tags it onto them as new attributes.

Any suggestions? And if anyone knows, can someone teach me how to modify the maya2egg file?

The Maya transform, including HPR and scale, will be part of the egg node’s entry. Easy to access directly from the egg file. Reading this transform makes more sense than trying to copy all this data into a set of redundant tags.

If you’re loading an egg file via loader.loadModel(), the easiest way to get the transform is just to put a Maya locator there. It will be translated as a node with the correct HPR and scale already loaded on it.


… Wait… Seriously?!? Oh man…

But… I can’t seem to find anything under the entry… Is there something special I’m supposed to do to actually have something there?

This is how it looks like now:

groundPlane_transform {

And groundPlane isn’t even in the game… Am I supposed to clear all history or freeze transformations?

And… How do I add Maya Locators? And what are they?

Sorry, I’m not exactly very good with terms…

Thanks alot for all the help!

It’s ignorable.

Find it in Edit menu (in Modelling menu sets).

Thanks! I found it under Create menu, polygon menu set, by the way.

Anywho, I made a locator, parented the cube TO the locator, and played around with the locator.

And it produced a transform, which had the correct translate values. However, that was the only thing it had. It didn’t have the Hpr values or the scale values. Am I doing something wrong?

Hmm, maybe Maya locators don’t preserve rotation and scale.

In that case, your best bet is to create an ordinary node, and tag it with the “DCS” eggObjectType. This tells maya2egg that the transform on the node is important to preserve all the way through the system.


Maya locators do preserve rotation and scales.
But once the transformation is frozen, you can’t reset it for locators.
Or you can use implicitSpheres with which you can reset transformation even after it’s frozen.
The only problem for implicitSpheres are there is no menu to create them in Maya besides using following MEL command:

createNode implicitSphere;

Um… But if it does preserve it… Then why can’t I see it in the egg file?

Heres how it looks like now.

 <Group> locator1 {
    <DCS> { 1 }
    <Transform> {
      <Translate> { 1.98798 0.0105734 -3.1443 }
    <Group> pCube1 {{

What I did was create a locator locator1, parent pCube1 to locator1, and then moved, rotated, and scaled locator1 around, and then used the Maya Panda Exporter melscript to export it out into an egg file.

I also tried transforming pCube1 itself, and reparenting the locator1 to pCube1 instead, to no avail.

Was I supposed to do anything extra?

Well… I kinda looked around for locators… And… … I still don’t know how they work…

Can someone please enlighten me as to how to export Locators so that they’ll still retain their rotation and scale? Please?

Sorry, I’m running a deadline, so I’m somewhat desperate…

When I converted my maya file with locator and pCube, I got this:

<Group> locator1 {
  <DCS> { net }
  <Transform> {
    <Matrix4> {
      1.97055 0 1.77095 0
      0 2.64941 0 0
      -1.77095 0 1.97055 0
      9.47359 11.7716 0 1
    <Translate> { 0 0 0 }

Could you post section at the top of your egg file, so I can see which maya2egg arguments were used during the conversion?

It seems like when you select “Actor”, “Both” or “Animation” at the Export Type of Maya Panda Exporter mel UI it will export locator’s position only. So Select “Mesh” or “Pose” there.

Thank you for replying gyedo!

… Wait… What does the matrix4 mean again? And how do I interpret it? 'cuz I was just experimenting a while back with actually using constrains to reparent the thing, and I got what you have now as well… I was thinking it had something to do with the angles and the scale…

And the comments are now…

“maya2egg2008 sadd_temp_temp_temp.mb sadd.egg”

… Don’t ask me why there are so many temps.

Oh, and merry christmas!

About transformation matrix, refer this:

And Merry Christmas to you, too :slight_smile:


Now I just need to find out:

a) how this transform matrix works…

b) how to get it in panda3D…

Attempting to decipher the link you gave me now…

Transformation matrices are built in Panda.

If you want to get Pos, Hpr, Scale from a transformation matrix, easiest way is

  1. make a nodepath transformed by a matrix using setMat() function
  2. then use getPos(), getHpr(), getScale() from that nodepath.

… I was just about to ask, got confused over the link…

THANK YOU VERY MUCH GYEDO! I appreciate you helping me so much.

And thanks drwr and ynjh_jo!

I’ll just use the search function to get access to the transform bits of each object in the scene, and setMat() to the object that i am using to replace it.

Now, I’ll just take a break, and add this in tomorrow (its 2.05 am over here). The rest I should be able to handle via debugging.

Thanks once again everyone! And merry christmas!