SOLVED Setting Strength Values of the Pose Morph Target?


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:

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


GetParam() and SetParam() have nothing to do with strength; they are used to set arbitrary overwritten object parameters. See CAMorphNode Manual.

The DescID of the morph's "Strength" value is obtained with GetMorphID(), see CAPoseMorphTag Manual.


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


# Execute main()
if __name__=='__main__':


@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.