[Solved]Beginner Question: "Merging" some models..

Hi,

since I’m searching for a answer on that question for a few days (obviously without any results) you hopefully excuse me asking that question.

I have created some models that can stand for themselves as small worlds. They are all rectangular and have the same dimensions (regarding width and length). Now I would like to merge these models in different combinations and save the combined models to a file (I think whether it is .bam or .egg doesn’t mind).

I know how I can load these models, but how can I combine them into one single model?

Regards,
Danny

You can write Python code like this:

root = NodePath('root')
for filename in ['m1', 'm2', 'm3', 'm4']:
  m = loader.loadModel(filename)
  m.reparentTo(root)
root.writeBamFile('root.bam')

This will combine all of your models into root.bam. Note that you will still want to save the individual egg files, so you can repeat this step later when you upgrade to the next version of Panda (unlike egg files, bam files are not guaranteed to be backward compatible between version upgrades).

David

Thanks for your reply, it works fine.