Notifications
Clear all
[Closed] morpher: addind progressives via maxscript problem
Page 3 / 3
Prev
Nov 25, 2014 10:12 pm
Here is the second function of my previous post with a little GUI.
You can add or delete targets and then run this tool to fix both the Weights and List order.
Apparently it works in Max 2011-2015
try(destroydialog ::RO_MORPH_FIXER)catch()
rollout RO_MORPH_FIXER "Morph Fixer" width:160 height:288
(
listbox lbx1 "Morph Channels:" pos:[8,8] width:144 height:11
button bt_getChannels "Get Morph Channels" pos:[8,184] width:144 height:32
button bt_fixChannel "Fix Selected Channel" pos:[8,216] width:144 height:32
button bt_fixAllChannels "Fix All Channels" pos:[8,248] width:144 height:32
local usedChannels = #()
local morphTarget
local morpherMod
struct morphTarget (node, channel, value)
fn FixMorphTargetListAndWeights channels:#() =
(
targets = #()
for j in channels do
(
pMorphCount = WM3_NumberOfProgressiveMorphs morpherMod j
for i = 1 to pMorphCount do
(
pMorphNode = WM3_GetProgressiveMorphNode morpherMod j i
pMorphWeight = (filterString pMorphNode.name "_")[2] as float
append targets (morphTarget node:pMorphNode channel:j value:pMorphWeight)
)
)
for i in targets do WM3_SetProgressiveMorphWeight morpherMod i.channel i.node 0.0
for i in targets do WM3_SetProgressiveMorphWeight morpherMod i.channel i.node i.value
)
fn PopulateListBox =
(
max modify mode
morpherMod = modPanel.getCurrentObject()
if classof morpherMod != Morpher do
(
messagebox "Invalid Modifier."
lbx1.items=#()
return ()
)
usedChannels=#()
for j = 1 to 100 where WM3_MC_HasData morpherMod j do
(
usedChannels[j] = (j as string) + " - " + (WM3_MC_GetName morpherMod j)
)
lbx1.items = for j in usedChannels where j != undefined collect j
)
on lbx1 selected arg do
(
WM3_SetChannelSel morpherMod (finditem usedChannels lbx1.selected)
)
on bt_getChannels pressed do
(
PopulateListBox()
)
on bt_fixChannel pressed do
(
chnIndex = lbx1.selected
FixMorphTargetListAndWeights channels:#(finditem usedChannels chnIndex)
)
on bt_fixAllChannels pressed do
(
chnIndex = for j in lbx1.items collect (finditem usedChannels j)
FixMorphTargetListAndWeights channels:chnIndex
)
)
createdialog RO_MORPH_FIXER
Page 3 / 3
Prev