Copy weight table


I want to link the root bone to the skined mesh, but unfortunatelly 3ds max don´t let me do so, it shows some billsh*t about dependency loop. If I am linking the root bone to a mesh without skin and adding skin modifier after that there is no problem. However I don´t want to do all the skin weights from scratch. I tried something like this:

deleteModifier myMesh (myMesh.modifiers["skin"])
addModifier myMesh mySkin

The code can have a lot of errors, since I am writing from memory. After execution of this code the root bone is linked to mesh, but the weight table is mising, so I have to make it again from scratch. Is there a way to make a copy of the old weight table and apply it to the mesh again?


Actually by giving this warning the MAX prevents you to do “bullsh*t”.


Think yourself… the skin stores its local data initialized to hierarchy at the moment of the skin modifier been applied. Now you want to change it on-the-fly. Maybe you need to delete the current Skin and reapply it?


Nah I was tallking exactly about delete the current Skin and reapply it. Unfortunatelly the weight table is geting lost, so when I reapply the skin it´s useles as al weight are mising.


the way you try to reapply is wrong.


it doesn’t make sense


I already said that my code can have a lot of errors, as I was writing from memory and this line was defenetly wrong. I have fixed that line in my first post.


Why would you need to link the root to the mesh, which is skinned to the root?
Seems more a case of you are trying to solve your problem incorrectly.


Max could not ask this question, and therefore gave only politically correct warning :wink:


I wouldn´t call it warning, as warnings can simply be ignored and unfortunately I can´t do it here.
The answer to the question why I need to link the root bone to the skined mesh is simple, the game engine wants it so. Also I see no problem in linking the root bone to the skined mesh, as I can link the root bone to the mesh befor it was skined and do all the skining stuff after that. I defenetly have never noticed any kind of loops when doing so. Even all animations worcked fine.
However I really don´t want to argue about all this stuff. All I need to know is if there is a way to copy the skin modifier from a mesh with the correspondin weight table? In some old thread here I read that Skin_Wrap modifier could be helpfull but there was no explanation how and after taking a look on documentation of Skin_Wrap modifier it makes no real sence for me, but that has nothing to say, as my maxscript knowledge is minimal.


But how can I do that?


You can copy skin modifier (or “modified object skin” if you take look where should be looking when animating), delete it, link whatever, than paste it to yours mesh…
Although that hierarchy make no sense in Max (actually no sense at all)

How could you expect to bring back skinning information with “empty” skin modifier!?


Sorry but where exactly I should be looking for that “modified object skin”? Like mentioned, my maxscript knowledge is very low.
I gues by hierarchy make no sense in Max you mean that it makes no sence to link the root bone to the corresponding skined mesh, right? Like already said, not going argue about that, as considering max you seems to be right, as other users, that posted here, say the same, but at the end it doesn´t meter if it makes sence in max, as the game engine wants such hierarchy.


What ever game engine you’re using that requires the root to be a child of the skinned mesh is probably not worth using.

If you want to continue down the path of sillyness, ignoring suggestions from people who have been doing this for a long time, then look at the skinOps methods:

In particular, GetVertexWeight and SetVertexWeight.


I am not using the gameengine directlly, but the game the skined models are made for uses it, so switching to any other engine is not an option.
Also, can somebody explain why should it be sily? The bones are influencing only vertices of a mesh but not the node, to which the mesh is attached, so see really not where that loops should come from.


Out of interest, what game engine is it?

The problem with hiearchachly linking a mesh to the root of the hierarchy it is skinned to is you will end up getting double transforms.
The simple order of operations for a mesh object in max is:
1 - transform is computed.
2 - mesh updates relative to its transform.
3 - modifiers adjust the mesh.

This allows nodes to modify a mesh without being a hierarchical parent of said mesh, by computing in a modifier at step 3.
Now skinning a mesh to its hierarchical parent will result in double transforms, meaning moving the parent will cause all 1 - 3 steps to evaluate, as the root moves the mesh, the mesh updates and the the modifiers tick, rather than just the modifiers updating.
Now max handles this, but it is very inefficient, especially if you have a relatively complex rig, likely resulting in significant slowdowns. So it is very much considered bad practice as you are getting the same ( potentially unstable ) result with much more calculations to get there.

You are getting the dependency loop warning because max stores a reference to all nodes a mesh is skinned to on said mesh, so linking to one of those parents, as far as max can tell when it tests for a loop, is the same as trying to make the parent of bone1, bone2 at the same time as trying to make the parent of bone2, bone1.


There’s “Back transform vertices” in skin mod., that will take care of double transforms…
And there wouldn’t be “dependency bulsh*t”.
But as I understand he want to link rooth bone to mesh.
@gtafan And that could be done like i wrote before - delete skin mod. (putin it in “sleep mode” not helping), link and reapply same skin mod. (that’s the reason I mention “modified object skin”).
Hierarchy will hold on “on paper”, so if you need it…
But my son can’t be my father. Maybe in soap operas.

I know there was some probs. with Unity and root bones, didn’t hear about this solution



The skin skeleton (hierarchy of skin bones) must not be linked to the skin mesh. It’s one of the main skinning rules. Skin bones drive the mesh! Mesh can’t drive its own drivers.

If any engine asks about linking driver bones to a driven objects it’s something wrong with this engine.
the best what this engine developers can do is just kill themselves.


From Unity:

If you prefer to keep animation and Mesh information in the same Unity GameObject, parent the Mesh node to a bone in the bone hierarchy in 3ds Max before exporting.

Now, in Max parenting is called linking and it goes child->parent.
So could it be “Lost in Translation”:smiley:


I thought from my nickname you can see for which game I need to do the models.
Also I am not triing to link the mesh to a bone, but the root bone to the mesh node. I see the reasons, why max has problems with that, but because of my bad english, wasn´t able to explain clearlly, what I wanted to do.
I was jus searching a way around that max limitation, so I tried to make a copy of the skin modifier, delete it, link the root bone to a mesh witout skin which is no problem in max and then add the skin modifier back with all the weights information.


That was exactly what I tried to do with my code from the very first post, but my my maxscript knowledge is very low, so it didn´t worck. I searched for that “modified object skin”, but looks like google hate me :slight_smile:, so no results.