Maxscript Python equivalent for WM3_MC_BuimdFromNode?

Maxscript Python equivalent for WM3_MC_BuimdFromNode?

Anonymous
Not applicable
1,624 Views
3 Replies
Message 1 of 4

Maxscript Python equivalent for WM3_MC_BuimdFromNode?

Anonymous
Not applicable

I would like a INode to have multiple morphers since a morpher has only 100 channels. Therefore in python I initialise as many morphers as needed for the amount of channels I have. Afterwards I'm trying to add targets to specified channels for specific morphers.

 

The following code explains the essential problem, target and node are INodes which are collected earlier:

import MaxPlus

test = MaxPlus.FPValue()
#The target node has only one morpher and I want to retrieve it using
# .morpher[1]
bool = MaxPlus.Core.EvalMAXScript("WM3_MC_BuildFromNode $node.morpher[1] 1 $target", test)
print bool

This snippet of code doesn't work, the boolean returns false. The following code does work but I need multiple morphers.

import MaxPlus
test = MaxPlus.FPValue()
#The target node has only one morpher
bool = MaxPlus.Core.EvalMAXScript("WM3_MC_BuildFromNode $node.morpher 1 $target", test)
print bool

What am I doing wrong? I do not know much about MaxScript and the API isn't very specific. Would MaxPlus.Animatable.AssignController work instead? I'm not sure.

Thank you in advance.

0 Likes
Accepted solutions (1)
1,625 Views
3 Replies
Replies (3)
Message 2 of 4

Swordslayer
Advisor
Advisor
Accepted solution
0 Likes
Message 3 of 4

Anonymous
Not applicable

Thank you for the quick reply! After plugging in your suggestion in a minor testcase, it still seems to fail. The forloop works, it does indeed what i needed but the boolean still returns false and no channel is added to the retrieved morpher from the forloop (and I have two morphers for ELLA_Head_Basis).

 

st1="
test = MaxPlus.FPValue()
bool = MaxPlus.Core.EvalMAXScript('WM3_MC_BuildFromNode (for mod in ELLA_Head_Basis.modifiers where isKindOf mod Morpher collect mod)[2] 1 $MOL_Zn', test)
print bool
"

python.Execute st1

where ELLA_Head_Basis and MOL_Zn are nodes in the scene. I must be doing something stupid wrong. Can you help?

Note: I work in Python but just to quickly test your solution, I wrote it in de MAXScript editor.

0 Likes
Message 4 of 4

Anonymous
Not applicable
I fixed it, it needed a "$" before ELLA_Head_Basis. Thank you very much Swordslayer for the help!
0 Likes