[Closed] find <vertex_bone_integer> form the bone's name?
I have skin data saved as a nested array of Bone names and weights by vertex
so per vertex I have an array of 2 element arrays #([boneName] , [weight float])
#(
--vert 1
#(#("bone_jaw", 0.0618116), #("bone_l_arm_a", 0.0539818), #("bone_l_arm_b", 0.884207)),
--vert2
#(#("bone_jaw", 0.0124441), #("bone_l_arm_a", 0.00920344), #("bone_l_arm_b", 0.978352)),
--vert3
#(#("bone_jaw", 0.00450266), #("bone_l_arm_a", 0.003811), #("bone_l_arm_b", 0.991686)),
...
)
I want to use skinOps.SetVertexWeights to set weights based on the bone’s name
but the skinOps.SetVertexWeights asks for vertex_bone_integer
how can I find vertex_bone_integer form the bone’s name?
fn buildBoneList skinMod = –builds a list of paired arrays of bone ID’s and their names
(
boneList = #(#(),#())
totalBones = skinOps.GetNumberBones skinMod
for b = 1 to totalBones do
(
append boneList[1] b --appends bone index
currentBonename = skinOps.getBoneName skinMod b 0
append boneList[2] currentBonename
)
return boneList
)
what max version do you use? as i know the skin bone ids are screwed up in versions 2012, 2013, and 2014. i don’t know about 2015. i know it was a high priority bug to fix.
the problem is that skinops returns bone list in a current sorting order. but there is no method to know this order.
we run 2013.
thanks for letting me know, I was going to dedicate some serious debugging time to this.
Is there an autodesk thread where I can keep an eye on the bug?
we talked a little about this bug on this forum, and remember a thread about this matter on Area
An Area thread on this bug from last year
but it mentions the issue being specific to 2014.
i’ve never played with 2013. but if its skin modifier has bone sorting feature, the skin bone id list is screwed.
If the skin bone IDs are screwed,
[ol]
[li]how can I verify this is happening?
[/li][li]Is there any other way to apply weights from my bone/weight data pairs?
[/li][/ol]
you didn’t answer my question: does max 2013 skin modifier has in its UI the option to show skin bone list in alphabetical order or not?
well. i’ve checked it myself. it has. so the max since 2013 version has the same screwed skin bone ids issue as 2014
We could have an entire sub forum to discuss how screwed up the skin modifier is…
Is there any other way aside from skinOps.SetVertexWeights
to set the weight of a vertex for a given bone?
select bone
select only one vert
set weight (which will be set for currently selected bone and vert)
but you have to understand how slow is it
As it turns out, ‘select one vert’ seems harder than I thought it would be.
for v = 1 to obj.verts.count do (
vert=obj.verts[v]
for b = 1 to _vertsWeight[i].count do(
...
obj.selectedVerts =#(v)
-- Runtime error: Mesh operation on non-mesh: PolyMesh
...
)
)
how do i select just one vert by index in a polymesh?