02-24-2016, 09:22 PM
I'm having an issue with the importing scripts...
The line "skinOps.ReplaceVertexWeights skinMod i bi wv" is causing a data conversion error: "-- Unable to convert: undefined to type: Integer".
What should I do?
Code:
msh = mesh vertices:Vert_array faces:Face_array
msh.numTVerts = Vert_array.count
setNumCPVVerts msh msh.numTVerts
setCVertMode msh true
setShadeCVerts msh true
defaultVCFaces msh
buildTVFaces msh
msh.name = "Mesh " + z as string + " (" + MaterialNames_array[PolyTextureID] as string + ")"
msh.material = mat
for j = 1 to Color_array.count do setvertcolor msh j Color_array[j]
for j = 1 to Alpha_array.count do(meshop.setVertAlpha msh -2 j Alpha_array[j])
for j = 1 to UV_array.count do setTVert msh j UV_array[j]
for j = 1 to Face_array.count do setTVFace msh j Face_array[j]
for j = 1 to msh.numfaces do setFaceSmoothGroup msh j 1
max modify mode
select msh
addmodifier msh (Edit_Normals ()) ui:off
msh.Edit_Normals.MakeExplicit selection:#{1..Normal_array.count}
EN_convertVS = msh.Edit_Normals.ConvertVertexSelection
EN_setNormal = msh.Edit_Normals.SetNormal
normID = #{}
for v = 1 to Normal_array.count do(
free normID
EN_convertVS #{v} &normID
for id in normID do EN_setNormal id Normal_array[v]
)
if BoneCount > 0 do(
skinMod = skin ()
addModifier msh skinMod
for i = 1 to BoneCount do (
maxbone = getnodebyname BoneArray[i].name
if i != BoneCount then
skinOps.addBone skinMod maxbone 0
else
skinOps.addBone skinMod maxbone 1
)
modPanel.setCurrentObject skinMod
for i = 1 to Weight_array.count do (
w = Weight_array[i]
bi = #() --bone index array
wv = #() --weight value array
for j = 1 to w.boneids.count do
(
boneid = w.boneids[j]
weight = w.weights[j]
append bi boneid
append wv weight
)
skinOps.ReplaceVertexWeights skinMod i bi wv
)
)
The line "skinOps.ReplaceVertexWeights skinMod i bi wv" is causing a data conversion error: "-- Unable to convert: undefined to type: Integer".
What should I do?