how to make groups invisible?

I have a model with a bunch of different arms, which are a bunch of different objects in blender. I exported the model with all the different arms into an egg file. Each arm is a different . Like arm1, arm2, etc. Is there a way to hide different groups in an egg? In the game engine, the model shows a blob of all the arms together. I want only one arm showing at a time, depending on which one is equipped.

I found the following when looking at the egg documentation:

  <Scalar> visibility { hidden | normal }

If the visibility of a group is set to "hidden", the primitives nested within that group are not generated as a normally visible primitive.  If the Config.prc variable egg-suppress-hidden is set to true, the primitives are not converted at all; otherwise, they are converted as a "stashed" node.

Is there a way to change visibility when the model is already loaded?

At least for models exported from Maya, the egg files commonly have internal hierarchies that are in parallel with the scene structure in Maya. If the Blender exporter works similarly, you should be able to do some poking around with nodePath.getChildren(), dig out your individual parts, and .hide()/.show() them.

Alternatively, you could describe your intended goal and current setup and see if anyone has any better suggestions than making one model with a zillion pieces of overlapping geometry.

I’m working on a megaman legends game, where megaman can get a bunch of different weapons. The player can go through a list of obtained weapons and equip one on his left arm. If you have played armored core for playstation, this is similar.

LoneKiltedNinja: How do I ‘dig out’ nodes? I’m not sure how to implement what you’re saying.

EDIT:

a nodepath.ls() just gives me the parent node BONES, not the groups attached to it. I added a { 1 } to the LEFTHAND group underneath the BONES to keep the structure, but nodepath.ls still just returns BONES:

PandaNode BONES
  Character __Actor_modelRoot
    GeomNode  (2 geoms: S:(MaterialAttrib TextureAttrib))
None

How do I turn the groups underneath BONES into nodes themselves to be made visible and invisible? my egg, which I marked with the Model flag is here.

If a .getChildren() on your model isn’t returning anything, there may not be anything to return. For an animated Actor, this may actually be the norm.

What I’d suggest for any sort of mix-n-match model is to actually load up multiple files, one containing each interchangeable part. The ones you don’t need can be left off the scenegraph entirely, and as long as you run the animations on all parts in parallel, they should stay well enough together. This is probably what they did in Legends, and almost certainly what happens in Armored Core. And really, it’s a big part of why the Panda scene hierarchy is so useful- parent accessory parts to a core model and they’ll all move at once. If Blender doesn’t have an “export only selected” option, the hack method is just copy your file however many times and delete the parts you don’t need in each. Keep everything in its current position relative to the origin, however, or you’ll need to do some realignment in Panda.

So there is no way to keep the group structure when an egg is loaded into an Actor? I thought that was what the { 1 } tag was supposed to do. I won’t be able to do a mix-n-match the way you’re talking about if I can’t keep the bone group structure. There have to be subsections of the main BONES group to attach the parts to.

I need to maintain the egg(ambyra.googlepages.com/megaman.egg) structure, which is something like:

BONES
-----ARM
-----LEG
-----BODY

Can you direct me to a bit of code that will load a model into an Actor, and turn the subgroups into nodes instead of ignoring them? I’m sure this is a fairly common situation. I have a bunch of different objects attached to a BONES armature. I just want some of them to disappear.

EDIT: I think what I want is here: panda3d.org/manual/index.php/M … of_a_Model

The manual says:

If your model is animated via keyframe animation in a package such as 3DSMax or Maya--that is, the sort of model you expect to load in via the Actor interface--then Panda will be aggressive in combining all of the geometry into as few nodes as possible. 

I just want panda to tone down the aggressiveness. I’ll try egg-optchar.

You have to use egg-optchar for this.

egg-optchar -d destdir -flag ARM=ARM -flag LEG=LEG -flag BODY=BODY model.egg anim.egg

David

thanks David, I didn’t know where to look earlier.

Also, thanks lonekiltedninja. I tried the multi-part animation before and its a really big headache to get all the parts working already. I’ll tell you what happens with this. It will be super cool when I’m done.