Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

morpher: addind progressives via maxscript problem

0 REPLIES 0
Reply
Message 1 of 1
metamesh
293 Views, 0 Replies

morpher: addind progressives via maxscript problem

hey guys, I did a very simple script ( with the help of Jonathan de Blok, thanks man!)to add targets to a morpher modifier. The way it works is simple, it reads the name of toe objects you want to add and whenever 2 objects have the same name, adds them to the same channel, it reads the sufix of the object and gets the value from there to set the % of each target. For example: smile_100, smile_025, smile_050. you can run the script, select the 3 objects and those will be added to the same channel, each with its own correct value of % BUT i've hit a problem ( maybe a bug ) when doing that, the targets get the right value, but the little listbox with the targets is in the wrong order, almost if it doesn't update properly when adding the values via maxscript. Could anyone have a look and see if I'm just getting crazy or this is indeed a bug? thanks, here is the code and the usage

 

usage:

1) select your object that has an empty ’Morpher’ modifier applied
2) run script
3) it ask to to pick targets  where name = "chn_percentage"

 

 

mainObject=selection[1]

trgs=selectByName  prompt:"Pick objects" single:false

--Setup main channels for item with 100%
channels = #()
for item in trgs do
(

chop=filterString item.name "_"

if (chop.count==2) do
(
chn=chop[1]
prc=chop[2] as float

appendIfUnique channels chn  --store channels in an array

chn_index= findItem channels  chn

if (prc==100) do
( print "aa"
WM3_MC_BuildFromNode mainObject.Morpher  chn_index item
WM3_SetProgressiveMorphWeight mainObject.Morpher chn_index  item  prc
)
)

)


--Setup item with <100% as Prog targets

for item in trgs do
(
chop=filterString item.name "_"

if (chop.count==2) do
(
chn=chop[1]
prc=chop[2] as float

chn_index= findItem channels  chn
if (prc<100) do
(
WM3_AddProgressiveMorphNode mainObject.Morpher chn_index item
WM3_SetProgressiveMorphWeight mainObject.Morpher chn_index  item  prc


for i in 1 to 100 do
(
if WM3_MC_HasData $.morpher i then
(
numMorph = WM3_NumberOfProgressiveMorphs $.morpher i
--append info numMorph
for m in 1 to numMorph do
(
nameProg = WM3_GetProgressiveMorphNode  $.morpher i m
print nameProg
chop=filterString nameProg.name "_"
print chop
value = chop[2] as float
print value
WM3_SetProgressiveMorphWeight $.morpher i nameProg value 



)
)
)

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report