Skip to content

Commit

Permalink
Add workaround for replaceVertexWeights bug in 2015
Browse files Browse the repository at this point in the history
  • Loading branch information
pudingus committed Jan 29, 2022
1 parent a4f8b6d commit e4d427e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/max4ds/skin_compat.ms
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,32 @@
skinOps.SelectBone xdata.skinMod xdata.listIds[boneId]
)
--------------------------

fn replaceVertexWeights_2015 xdata vertId boneId weight = (
local numbones = skinOps.GetNumberBones xdata.skinMod

local count = 1
if classof boneId == Array then count = boneId.count
else (
boneId = #(boneId)
weight = #(weight)
)

local boneIds_all = #()
local weights_all = #()
for i = 1 to numBones do (
append boneIds_all i
append weights_all 0.0
)

for i = 1 to count do (
local id = boneId[i]
boneIds_all[id] = id
weights_all[id] = weight[i]
)

skinOps.SetVertexWeights xdata.skinMod vertId boneIds_all weights_all
)


::skin_makeCache = makeCache
Expand All @@ -113,6 +139,9 @@
::skin_getVertexWeightBoneId = getVertexWeightBoneId_2012
::skin_selectBone = selectBone_2012
)
else if maxver == 17000 then ( --2015
::skin_replaceVertexWeights = replaceVertexWeights_2015
)



Expand Down

0 comments on commit e4d427e

Please sign in to comment.