3dsmax python add float script to sub animations -


i have next setup: have sphere has morpher modifier. morpher modifier has amount of channels filled morph targets aka sub animations. want add controller each of these subanimations, more controller float script. have code snippet should work when go curve editor, morph channels/ sub animations did not change controller, nor value of controller changed.

import maxplus target = maxplus.inode.getinodebyname('sphere001') #retrieve morpher modifier mod = target.getmodifier(0) #id of float script controller id = maxplus.class_id(1233584870,1911625032) #create float controller float_co = maxplus.factory.createfloatcontroller(id) #retrieve first morph channel / sub animation sub = mod.getsubanim(1) #controller assigned sub animation sub.assigncontroller(float_co,1) #basic test assigns 20 sub animation float_co.parameterblock.script.value = '20' 

when add wrong value script, example:

float_co.parameterblock.script.value = '=20' 

i receive error , usual window when manually add controller object or node. strange thing @ top of window: name of object connected, not show. see figure clarification:enter image description here

can tell me i'm doing wrong? thank you!

i solved using ugly way:

import maxplus test = maxplus.fpvalue() success = maxplus.core.evalmaxscript(string_with_command,test) 

this used twice: first create float script controller , second time add script controller. careful if wants try this, script controller needs string. not use

x string 

with expressing want use script float script controller since maxscript evaluate x on timeframe in 3ds max , convert value string. value used script time frames not want. small hack used was:

script_value_example = '"amax #(0, ($sphere.position.x - cube.position.y))"' 

this still string python , maxscript see " " , interpret string. other way around doesn't work, maxscript not interpret ' ' string. maybe in future. if knows proper way using code in question, please leave reply, i'm interested know.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -