Can I manipulate an object within an egg file


noob question I guess.

I have made a scene in Max. In that scene I have placed boxes that are supposed to help me place other objects in the scene (by code).

So my problem is:
How do I get the coordinates of my boxes?


I don’t know much about Max, but I know in Maya there is a concept of a “Locator”. When you put a Locator into a Maya scene it is converted to a node with a position on it, so you can find that node by name and get its position in the Python code.

Maybe there is an equivalent construct in Max.

But if you just put an ordinary box, it’s difficult to get the position from it, because the position is encoded in the vertices.


Max does have locator nodes, but I believe the max exporter doesn’t export them.

My suggestion would be to use bones. Export the scene using one of the export options that preserves bones — does “pose” preserve bones? Then, use exposeJoint to get the bone and attach something to it.

Thanks guys.
I will try what you suggested


You could just write a little maxscript to get the positions and write them to an egg file that you can load and use, if the bone thing doesn’t work out.

The way we’ve been doing it, is to create a small plane instead of a box, label the plane appropriately. Then you can find it in panda using this name, by calling

position = [pandaNode].find("**/[fancy name here]").getPos()

load another model in at that location, by calling


edit: removed ‘italic’ tags from [ code] part

This does definately help, exactly what I want to do.

one more question though.
Does the egg exporter for Maya export the Maya locators?

best regards,
Eggert Steinsen

Yes, generally, though not in a scene that you convert for animation.


I still have problems with this

trying to use SilentStorms suggestion:

position = [i][pandaNode][/i].find("**/[i][loc1][/i]").getPos() 

where loc1 is my locator. Panda gives me an error and doesnt want to recognize the [/i] … one thing I dont quite understand [pandaNode] should I put the name of my environment there?

I also tried to find it with:

 position = environ.find("**/loc1").getPos()

but it doesnt find anything (i tried to print out the position variable but it says not found or something like that

and this is how the locator is represented in the .egg file

<Group> loc1 {
    <Transform> {
      <Translate> { 79.0729 3.7566 -64.1567 }

well I hope someone understands my ramblings

I’m sorry about the confusion. I tried addin italics to it in ubb, missing the fact that the tag does not work within code tags.

In short: ignore the [ i] and [ /i]'s.

edit: this should be easier to understand :slight_smile:

sorry bro… I am not quite sure what you mean
but what what do you mean and’s

this is getting embarrasing…
I have used java mobile 3d a bit… and I had no problem with these things
Python confuses me abit…

What he means is, the correct code is this:

position = [pandaNode].find("**/[loc1]").getPos()

instead of:

position = [i][pandaNode][/i].find("**/[i][loc1][/i]").getPos()

Well… I am still getting:

position = self.environ.find("**/loc1").getPos()

AssertionError: !isEmpty() at line 943 of panda/src/pgraph/nodePath.cxx

I cleared up my posts a bit. I had a class to attend to just before I wrote that, so I didn’t read my post trough before hitting submit. Sorry for making stuff harder on you.

The error you’re getting now means something like ‘could not find this pandanode’. If you didn’t receive any error when loading the ‘environ’ egg, I suspect the node you are looking for is not known in panda by that reference. If you use max, you’ll need to use the ‘Pose’ setting on the exporter if you want your node tree to be searchable. (Use pose if you are not exporting an actor or an animation. Although I haven’t seen the exporter for Maya for myself, I believe the setting there is called ‘None’)

If the above did not help you --> can you find ‘loc1’ in the ‘environ’ egg file using a text editor? If not, something is wrong with your model or the way you are exporting it. If you can find it, please post a few lines more of the error log.

Watchout, if you used Maya, you’d better read –[THIS]–.

Thanks for the help people…
I exported with the “pose” setting in the exporter and now I find it…

great stuff