Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi,
Apart from dragging the parameter to the console, how do I set the strength values of "Pose Morph Target" in Animated Mode using Python? You can see an illustration of the problem here: https://www.dropbox.com/s/dcc34oyaxp81p9q/c4d271_setting_value_of_pose_morph_target.jpg?dl=0
Here is my WIP code:
def main(): tag = doc.GetActiveTag() morph = tag.GetMorph(1) node = morph.GetFirst() # I'm stuck at GetParam and SetParam node.GetParam(index) # No matter what index I put, it returns none. node.SetParam # I can't use the code because I lack the DESCID from the GetParam
Regards, Ben
GetParam() and SetParam() have nothing to do with strength; they are used to set arbitrary overwritten object parameters. See CAMorphNode Manual.
GetParam()
SetParam()
The DescID of the morph's "Strength" value is obtained with GetMorphID(), see CAPoseMorphTag Manual.
DescID
GetMorphID()
hi,
you should have a look at the manuals @PluginStudent linked you.
you can do it in several ways
import c4d from c4d import gui # Welcome to the world of Python # Main function def main(): tag = doc.GetActiveTag() # Using descid ginven by the function for i in xrange( tag.GetMorphCount()): descID = tag.GetMorphID(i) tag[descID] = .5 # Using get/set parameter for i in xrange( tag.GetMorphCount()): descID = tag.GetMorphID(i) currentValue = tag.GetParameter(descID, c4d.DESCFLAGS_GET_NONE) print descID, currentValue tag.SetParameter(descID, currentValue + 0.6, c4d.DESCFLAGS_GET_NONE ) # Using calculate id for i in xrange( tag.GetMorphCount()): sliderID = 1001 + i * 100 tag[4000,sliderID] = .1 c4d.EventAdd() # Execute main() if __name__=='__main__': main()
cheers, Manuel
@PluginStudent @m_magalhaes
Thanks for the reference link and sample code. It works as expected. Thanks also for the giving different methods in setting the strength. Provides more flexibility.