Instancing an .egg file

Hello people!

I am new here and this is my first question: how can I make an instance of an existing .egg file into another .egg file? I mean: I have a modeled room exported as an .egg and I want to add some objects to it without to be included together with the room.

I can make it by code (I have made already something similar with pickups and ForceEmpty tags) but I have read in the Chicken documentation that is possible to do it automatically, only tagging meshes. When Panda find one of these empty meshes, looks for the destination model.

Well, I have searched the forum but I haven’t find a clear example on how to use this feature. So it would be great if someone could teach me how to do this.

Thanks!!

Here is the egg syntax to do it:

<Instance> {
  <File> { path/to/otherfile.egg }
}

The “Instance” is needed to give the included egg file its own local coordinate space.

I’m not sure how to do it in Blender in a way that Chicken understands it.

How about Maya? Does maya2egg support that kind of thing?

Hey, it works!
It just would be great if it could be posible to do directly from blender, but it’s good enough for me now.

Thanks a lot, pro-rsoft!

:smiley:

It is possible to do it directly from Blender, and the Chicken manual explains how. It does involve some advanced concepts though, so I can understand why a lot of people wouldn’t get it. Effectively it involves the dupligroup feature - you create an empty, enable dupligroup and enter a group to duplicate. That empty will then be exported to the file with the syntax pro-rsoft gave above. There are quite complex rules to work out what filename it uses, though the easiest is to give it a ‘filename’ tag with what you want. If the group used has been linked from another blend file it will take the path of the blend file without the extension however. My advice would be to go read up on dupligroups in the blender manual - once you get them the rest should make sense.

I readed about dupligroup in the chicken manual, but it wasn’t clear enough for me. I’ll give it a more deep look. Manually editing the .egg file will be tedious if there are many instances.

Thanks!

If you can give me any feedback about what you find unclear then I’ld be happy to clarify and update the manual:-)

Well, I have already do it:

  • First I created a group with the object that I wanted to instantiate (for example a lamp).
  • Then I gave that group the name of the relative path to the .egg lamp I previously exported.
  • I created en empty, enabled dupligroup and inserted the name of the group (the path).
  • I put that empty in the correct place in the scene.
  • Finally I selected all in the scene except the lamp itself (I selected the empty instead), and exported with chicken.

Maybe there is a easier way to do this, but this is how I have done it.

For lethe: I’d like if you explain to me about the “‘filename’ property (from the game engine tab)” that the manual says in the section ‘3.13 Instancing’. Where can I find it?

Hey, I hope this will help some people! :wink:

Tags are in the logic panel - the little pac man icon. Click on that and on the left is an ‘Add Property’ button - click that, change the type to String, name to ‘filename’, and then the value to whatever filename you want it to use. (Without the .egg extension.)

Ok, I knew that button. Is where I insert the ‘ForceEmpty’ and ‘ObjectType’ tags. But I tried what you said and it outputs something like:

<Tag> filename { path/to/the/file}

that seems not to work properly. But it is not a great problem to me, since I can do it the way I described before.

Thanks for your answers!

Oh, one thing that probably isn’t clear - the filename tag is applied to the object being instanced (Well, one of the objects in the group being instanced.), not the empty doing the instancing. Hmmm, maybe I should make it work with both.

Ok, now it works!