Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Setting Strength Values of the Pose Morph Target?

    Cinema 4D SDK
    r21 python
    3
    4
    772
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bentraje
      last edited by bentraje

      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

      1 Reply Last reply Reply Quote 0
      • P
        PluginStudent
        last edited by

        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.

        1 Reply Last reply Reply Quote 1
        • ManuelM
          Manuel
          last edited by Manuel

          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

          MAXON SDK Specialist

          MAXON Registered Developer

          1 Reply Last reply Reply Quote 1
          • B
            bentraje
            last edited by

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

            1 Reply Last reply Reply Quote 0
            • i_mazlovI i_mazlov referenced this topic on
            • First post
              Last post