View Full Version : skinops.getvertexweight problem....
05 May 2008, 02:57 PM
This fucntion allways returns an error to me no matter what I do.
I am writing a script for loding and here in a little snippit of it.
any help would be greatly appreciated
i even tried running this little line of code seperately on different computers and different bones and verts manually typing in the bone and the vert.:
skinops.getvertexweight $.modifiers 121 15
the syntax is:
skinops.getvertexweight <skin> <vertid> <boneid>
every time I use this expression i get this error:
Runtime error: Exceeded the vertex weight list countSkin:Skin
I previosly stored an array of vert ids in selected_verts
oldBoneWeight = 0.0
parentWeight = 0.0
for y = 1 to selected_verts.count do
skinOps.SelectVertices myskin selected_verts[y]
oldBoneWeight = skinOps.GetVertexWeight myskin selected_verts[y] oldbone -- get old bones weight
parentWeight = skinOps.GetVertexWeight myskin selected_verts[(y] parentbone -- get parent weight
skinOps.SetVertexWeights myskin selected_verts[(y+1)] oldbone 0 -- set the old bone to 0 weighting
skinOps.SetVertexWeights myskin selected_verts[(y+1)] parentbone ( parentWeight + oldBoneWeight ) -- set the parent bones wiethgin to the sum of old bone and parent bone
05 May 2008, 09:58 PM
that was answered in this thread:
it's for setvertexweight but i guess it's the same case with getvertexweight.
it seems a legendary max bug.
05 May 2008, 10:15 PM
actually i figured it out...
its kinda dumb
the syntax for the operation is...
skinops.getvertexweight <skin> <vert integer > <bone integer>
bone integer is not the number of the bone in the skin modifier its the number of the bone
as it relates to that vert when using this function.
skinopts.getvertexweightboneID(cant remember exactly)
so i had 5 bones affectign a vert and the bone was bone number 3 affecting that vert.
but the integer of that bone was 15
so I needed to have bone integer be 3 not 15 since there were not 15 bones affecting that vert it was going out of range.
Its kinda dumb syntax if you ask me.
I just hope in next release of max they change it to be the bone integer rather than the weightboneID they could allways just return 0 if the bone is not affecting the vert.
I basically just wrote my own function that does what I thought thiers would do. :)
Anyways now i have a script that saves me mucho time :)
05 May 2008, 10:15 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.