Home Technical Talk

[Max Script] Adding a Bone without Influences

Hey - I'm currently trying to write a little script that allows me to add a bone to a Skin Modifier without assigning any weights to it.

The problem I face is that I've got a perfect Mesh and Rig already but I need additional bones in the Rig that will later on drive other Elements. Now - so far what I always did was add the bone and then go to the weight-table and look at the selected Bone and hand delete all it's influences but clearly that's time consuming and hopefully unnecessary.

I found this little helper here already "skinOps.ReplaceVertexWeights" but I've no clue how to properly use it... Anyone who could help? Thanks :)

Replies

  • monster
    Options
    Offline / Send Message
    monster polycounter
    When you are done with your weighting, you can convert all the vertices to "Modified". This will allow you to add bones without any of their weights changing. When a vertex is tagged as "Modified" changing the size of the cross sections no longer updates the influence on the vertices, and the influence can only be changed by hand (with the Weight Tool).

    To tag all the vertices modified:
    1. Open the weight table.
    2. Make sure "All Vertices" is displayed in the lower left.
    3. Turn on "Show Global" in the options menu.
    4. Check the box under the "M" (M for Modified.)

    Alternatively:
    1. Enable vertex selection.
    2. Select all the vertices.
    3. Press the Bake Selected Vertices button just above the weight table button.

    After you've done this you can add a bone without it changing the influence of any of the vertices.
  • e-freak
    Options
    Offline / Send Message
    awesome - thank you so much! The alternative solution looks like an easy enough script to do :)
  • e-freak
    Options
    Offline / Send Message
    In case anyone is interested:
    $.modifiers[#Skin].bone_Limit = 4 -- Optional: 4 Bones per Vert Max
    subobjectLevel = 1
    $.modifiers[#Skin].effect = 1
    skinOps.SelectVertices $.modifiers[#Skin] #{1..(polyOp.getNumVerts $)}
    $.modifiers[#Skin].effect = 1
    skinOps.bakeSelectedVerts $.modifiers[#Skin]
    
Sign In or Register to comment.