I have a sticky business.

There is a lovely girl which with 4 models include spring,summer,autumn and winter. The differences between them are just the dresses. Dresses are model, too.
But there are only 4 egg files(spring,summer,autum,winter), spring dresses and the girl are in one and summer dresses and the girl are in another one.etc…

Now I want the winter girl dress a skirt which is a summer dress. I do like this:
1, In egg I use egg-optchar to define skirt. egg-optchar -inplace -flag XXXskirt=skirt girl_summer.egg girl_winter.egg
2, In my codes,

    summer_skirt = summer_actor.find("**/skirt"). 
    summer_skirt.reparentTo(winter_actor)

Then ,successful.

When let the two girls jumping(playAnimation), all is work. the skirt is moving on the winter girl.
I want there is just a winter girl is jumping ,so I hide the summer girl,
But after I hiding the summer girl ,the skirt is unmoving(do animation). I want the skirt is moving with the winter girl,how to?

wzj19811113 I suggest you to reformulate more clearly your question, maybe with some image, because it is hard to understand what you’re asking for.

like this:

I move the winter girl’s coat away, and put the skirt on the winter girl.
When the two girl dancing, all the components dancing.
But I just want the winter girl with skirt on the scene, so I have to hide the summer girl and the winter coat on the right.

The winter coat can be hidden ,but afte I hiding the summer girl, the skirt won’t dancing(be shownn but stop moving).

How to arrive what I want?

Three questions.

(1) do your winter girl and summer girl models have precisely the same skeleton?

(2) do they have the same character name internally, so that egg-optchar recognizes them as a single character and not as multiple different characters?

(3) did you load them both into the same Actor object?

If the answer to all three of the above is “yes”, then it should have worked.

David

first off, when you post an image make sure it is a jpeg or gif image otherwise you won’t see it in your post.
Anyway now I converted and uploaded on my site your pictures for reference:

I see David made you questions so I’ll wait your reply before to go further

(1) do your winter girl and summer girl models have precisely the same skeleton?
[color=red] YES
(2) do they have the same character name internally, so that egg-optchar recognizes them as a single character and not as multiple different characters?

[color=red]What’s they? Dresses or girls?
In my egg files ,summer girl egg file includes girl_summer_coat and winter girl egg file includes girl_winter_coat . And all Groups in egg files have named with summer or winter or spring or autumn.
And I use egg-optchar like this:
egg-optchar -inplace -flag girl_summer_coat=coat -flag girl_winter_coat=coat girl_model_summer.egg girl_model_winter.egg girl_animation1.egg girl_animation2.egg

(3) did you load them both into the same Actor object?
[color=red] NO. I load them as two objects. Bcz sometimes they would do different animation actions.

Oh, I understand what you’re trying to do now.

    summer_skirt = summer_actor.find("**/skirt").
    summer_skirt.reparentTo(winter_actor) 

The above code doesn’t change the nature of summer girl’s skirt. It’s still summer girl’s skirt, even though you’ve parented it under winter girl. This means it’s still controlled by summer girl’s animation.

There’s no easy way to change the summer girl’s skirt to winter girl’s skirt. But one thing you can can do is store the skirt as a separate egg file (not part of summer girl’s egg file), and load it up onto winter girl’s actor with a second actor.loadModel() call. Then it will be winter girl’s skirt and will animate with winter girl.

In order for this to work, all of the models–summer girl, winter girl, and the skirt–must have the same character name. In a model file, this is the name of the that contains the entry; in an animation file, this is the name of the node. The character name is important to Panda; think of it as the skeleton name. All models and animations that have the same character name are considered to have the same skeleton and may be used interchangeably.

If your egg files have different character names, egg-optchar will process them individually (and will tell you it is doing so). If they have the same character name, egg-optchar will process them all together in the same pass (and will tell you it is doing so).

David

Thank you David.
I tried that, a new problem appears

there are 6 egg fiels: body.egg, coat.egg,pant.egg, hair.egg, shoes.egg and dancing.egg(animation egg)

I used actor.loadModel() function. Actor(body).loadModel(coat pant hair shoes)

In dresses egg files, coat,pant have skeleton system and hair,shoes have no skeleton system.

So the phenomenon is the body dancing with coat and pant. But her hair and shoes are still.

How to fix it? I usually use reparentTo function to make a model follow with Actor, but now the model is loadModel by Actor. I don’t know how to use reparentTo.

As to hair and shoes, if I use Actor construct instead of using Body.loadModel(), and then reparentTo(body), they will be small than normal. Maybe their position has been changed.

if I got what you’re saying, there is a tutorial in the official panda3d samples callled “Looking-and-Gripping” that explain how to do what you’re asking for.

in the Looking-and-Gripping example, the teapot or something else is a model not a actor. And when teapot reparentTo the actor’s some joint, it will move following the joint.
I know that example.

But in my problem, the coat and pant are actor,bcz they have skeletong system. Hair and shoes have no skeletong system.
Now coat and pant can move with the girl, but hair and shoes cann’t even if I make them reparentTo the girl.

So I don’t know how to do.

I guess you are taking a wrong approach - I would not make the cloths as actors but as models with the vertex assigned by bone influence, like an actor but saved as a model and then attached to the proper actor joint. But mine is just theoretical speculation, anyway this is a feature I’m interested to learn so I’ll try to test it soon and make a sample out of it.

Yes, you r right. I am wrong.
They are influenced by the bones and they have no bones.

Attach to some joint, yes ,all examples show me that attach to a single joint. But always clothes are influenced by several joints , so I don’t know how to deal with such a thing.

Thanks

so you’re doing right then - ok this is time to show up some code: do you mind to pack a zip file with your code and some model to make us see what’s going on into? I guess this will speed up things for you…

I am sorry for too long time to login.

the model files arehttp://cid-21ba8e05e140ed81.skydrive.live.com/self.aspx/%e6%96%b0%e5%bb%ba%e7%9b%b8%e5%86%8c/upload/test.rar

The codes are:http://cid-21ba8e05e140ed81.skydrive.live.com/self.aspx/%e6%96%b0%e5%bb%ba%e7%9b%b8%e5%86%8c/upload/code.rar

In model files, there are 6 egg files, “girl_zoulu.egg” is the animation file.

In codes, there are 2 py files, one is class Pet and another is main.py.
In Pet.py file, there are lots of ASCII characters, but they have been commented. Dont care about them.
In main.py, just main4() function is valid. Dont care about main1 and main2 and main3.

sorry wzj but that code is useless - just commenting out the character animation

    girl_body.loadAnimation("zoulu", "character/test/girl_zoulu.egg")
    girl_body.loopAnimation("zoulu")

I was able to see a cutie but that’s it - if I activate the animation everything explodes in a incomprehensible mess

Maybe that is because that the hair and shoes are stock-still and the body,coat,pant are moved.

You can remove the hair and shoes ,and have a test.

And I have lots of tests. That when I make the hair reparentTo the body, the hair wouldn’t move follow the body’s head.

Why?

That is different with the example looking and Gripping.

I cann’t find any differences between mine and that example

ok wzj I’m finally back with some working stuff for you I’m satisfied with.

It is a work-in-progress but it works as you expect.
You will find all the infos into the python and blender sources in the zip package.
Hope you’ll enjoy it and will find useful: click here to download.

Excellent demo !d