<Collide> Tag from Maya?

This is sort of a hybrid Maya/egg question, mainly because I’m not too familiar with Maya.

Does the have to be inserted manually into meshes to be used for collision after exporting with maya2egg, or is there a way to specify meshes for collision within Maya that maya2egg will recognize during conversion?

The good news is that there is a way to do it from inside maya. The bad news is that I never actually got it to work, myself.

Somewhere within the Panda3D ‘direct’ tree is a mel script which can be loaded into Maya. I believe that this mel script was written for an older version of Maya, and no longer works with Maya 2008. This mel script is supposed to be able to tag models as collision geometry and the like, and the exporter will see that designation. If the mel script could be updated, I suspect it would work fine again.

Is eggObjectFlags.mel distributed in the new releases, Josh ? Until 1.4.2, it’s still stuck in the CVS.
panda3d.cvs.sourceforge.net/*che … tFlags.mel

May I ask which version of Maya this script was last known to work on?

The Disney guys use Maya 6, and it works for them. I never tried it myself until a few months ago, and it didn’t work on Maya 8.5.

And ynjh_jo is right: the MEL is not in the panda distribution, although it is in the source archive. If we can get it working, I’ll put it in the distribution.

just an idea but maybe it would me more usefull to have a simple post processor for egg file that could manage eggs tags.

On the same idea that the egg-optchar stuff.

You would create your model in 3DSMAX,Maya, Blender etc… and export it to .egg.
Then you would launch egg-opttag.exe on the .egg file with a set of options like -collide _collision and it would add a collide tag to every group that match “*collision” name pattern.

We could have some “built in” tag recognised (like the collide one) and have a free one like -custom _map_trigger that would apply a text fragment to every group reconigzed by the pattern.

We would avoid the pain to maintain X workaround scripts (mel, 3Dsmax ,etc…) and still get a full efficient pipeline.

My pipe line is heavily post processed. I get the all the models in one big egg files. I break the egg file in many little egg files. I record special turret node positions in .py files, i analyze, string and regenerate tons of stuff using the egg library. Its all there i find that using the egg functions directly form a python script is much better then command line - more power and i know how it works.

@ Josh Yelon :
that MEL doesn’t do anything like checking Maya version, so what’s the problem ? It’s a very very simple script, in what way does it fail ?
And how do you run it ? By typing eggObjectFlags() at the prompt everytime you want to use it ?
You have fixed the missing semicolon, but the procedure is still not auto-executed.

All I know is that I tried dragging it into maya and it gave me some sort of error message. I don’t know MEL.

Josh, what’s the error ? Did you read the whole error message, or only its last line on the 1 line error output next to Maya prompt ? The whole message is dumped to ScriptEditor. May I see it ?
Perhaps the API has changed.

Just checked it, the MEL script works. I think Josh just wasn’t familiar with how it works. It could use a simpler install method or a detailed manual page I guess. The script is basically a globally scoped procedure, executing makes it so that you can run the procedure from anywhere. So to run the script, you just have to call the procedure from the shelf or where ever.

Installation instructions:

  1. Open up maya’s script editor (Window>General Editors>Script Editor)
  2. Open the script in the editor and execute it (Ctrl+Enter or Script>Execute)
  3. Type “eggObjectFlags()” at the script editor and select the text.
  4. Middle mouse drag the selection into your custom shelf.
  5. Go to the shelf editor and give it a custom icon/name


  1. Select the objects that you want to tag and press the shelf script
  2. Set the object type by going to the channel box of the object, there should be a new attribute called Egg Object TypesN
  3. For a collision mesh, set the type to barrier. Some of the other types are defined in the eggSyntax doc. panda3d.cvs.sourceforge.net/*che … Syntax.txt


ynjh_jo: do you know how to MEL Script? It seems to me that the material application procedures for 1.5.0 could be scripted and integrated into MayaPandaTool.mel

So ZeroByte, which Maya version are you using ?

Yes, me and MEL are good friends. :smiley:
If you’re using v8+, it would be easier to use Python rather than MEL.
Unfortunately, I’m still using P3D 1.4.2 :laughing: and I haven’t familiar with the new material application.
Getting object’s material is trivial, learn from my other MEL :
and extend my MayaPandaTool.mel mod, if you like it :slight_smile:

Thanks. Got the script running.


This is a bit off-topic now, since its no longer about entry, but it still concerns carrying attributes for meshes defined in Maya to the .egg format. I’m curious about defining custom object types in Config.prc and using the entry.

Is it possible to use Maya to define numerical and string properties in meshes that could be retrieved during run-time? Looking at egg’s syntax, I’d probably use egg’s Tag entry:

key { value }

The tag’s key can easily be defined by adding a line in config.prc:

egg-object-type-mykey mykey { value }

But how would I go about setting the value? Can I pass an argument to the object type to set it? Or would I have to manually type in the entry to the specific entries in each egg?

Read there :

Since the values you want aren’t going to be set in stone, I’d tackle this with two scripts. Write a Python script that uses panda’s EggGroup and EggData classes that will search the egg file for certain groups and set the tag values. Then modify the MayaPandaTool.mel to run the script after converting the model, passing in values by searching through the maya scene attributes.

ynjh_jo, I’m a Maya 7 user. Not experienced with MEL Script though but I want to learn. Looking through your MEL scripts, the material converter thing looks like something I’ll try my hand in over the weekend and try integrating into your MayaPandaTool.

Added a field for channel names in the script, for people who want to mix and match models with animations. Never written MEL script before, so it’s little more than a hack job. Someone might want to rearrange the layout, if it bothers them that I just slapped the text field right above the export button.

Don’t have my own file server so:
fileshost.com/en/file/41557/ … 1-mel.html

I’ve read that, actually. That’d work if I had a limited range of values for my key (e.g. Animal - Dog, Cat, Bird)… the solution doesn’t quite work for unrestricted values…

I guess I’ll delve a bit into more MEL scripting… ynjh_jo, know any web tutorials for accessing mesh attributes? And formatted file reading?

I think it’d be more efficient to just open up the EGG file as ASCII text with MEL, instead of writing a python script to do it. The exporter’s line spacing is consistent anyway.

I don’t get it. It’s not the MEL does the export/conversion, it’s maya2egg. And so far I know, MEL doesn’t provide extensive string operations, unlike Python.
If you’re really obsessive, you should try to modify maya2egg instead of messing around with the generated egg, though I can’t help you on that. I shouldn’t start any coding for the next 2 months. But definitely the devs would help when you’re working on it.

So far, I don’t use any web tut about MEL. It’s already included in Maya, complete with some samples for each command. A command search should do it.
To know object’s attributes, I used to use listAttr to get a mesh’s attributes and print them, so I can look for an attribute which holds the info I need, using getAttr/setAttr.
Maya is connected-attributes system. If you need to know to which attr an attr is connected, use listConnections, and connectAttr/disconnectAttr to manipulate attributes connection.
Most of the time spent is not for mastering MEL, but to understand Maya internal system, about which connection can bring you to the value you need, and which attr holds the connection. Luckily, you can see how objects are connected by looking at Maya’s graphs.
And, sometimes when it’s too foggy, you can always see all commands executed when you do something with the visual interface, by opening ScriptEditor and echoing all commands (Script > Echo All Commands).

Ah, yes… I was referring to modifying the EGG file after maya2egg is through with it. MEL’s string operations seem to work sufficiently enough for my purposes… It’s got a tokenize operator, concatenation, substrings… all the basic stuff. Pretty much got what I needed done. Thanks for pointing me to some of the more useful commands…

I was considering this, but it didn’t seem worth the effort, considering the time I had, and the effect I needed. Maybe if I need something more complicated and had more time.