Notifications
Clear all

[Closed] Python add float script to morph channels /sub animations

I have the next setup: I have a sphere which has a morpher modifier. This morpher modifier has a certain amount of channels filled with morph targets aka sub animations. Now I want to add a controller to each of these subanimations, more specifically a controller with a float script. I have a code snippet that should work but when I go to the curve editor, the morph channels/ sub animations did not change controller, nor is the value of their controller changed.


  import MaxPlus target = MaxPlus.INode.GetINodeByName('Sphere001') 
 #Retrieve the morpher modifier 
 mod = target.GetModifier(0) 
 #ID of a float script controller 
 id = MaxPlus.Class_ID(1233584870,1911625032) 
 #Create float controller 
 float_co = MaxPlus.Factory.CreateFloatController(id) 
 #Retrieve the first morph channel / sub animation s
 ub = mod.GetSubAnim(1) 
 #Controller is assigned to the sub animation 
 sub.AssignController(float_co,1) 
 #Basic test which assigns 20 to the sub animation 
 float_co.ParameterBlock.Script.Value = '20'
 

When I add a wrong value to the script, for example:


 float_co.ParameterBlock.Script.Value = '=20'

receive an error and the usual window when you manually add a controller to an object or node. However the strange thing is that at the top of the window: the name of the object to which it is connected, does not show. See figure for clarification:

Can someone tell me what I’m doing wrong? Thank you!