Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Adding CAMorph to CAPoseMorphTag [SOLVED]

    SDK Help
    0
    2
    245
    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.
    • H
      Helper
      last edited by

      On 12/05/2015 at 11:10, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R16 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hi, I am trying to add a absolute pose morph to the pose morph tag in C++. Below is code that adds a new morph to the tag.

      CAPoseMorphTag * rootPose = (CAPoseMorphTag * )clone->MakeTag(Tposemorph, nullptr);
      rootPose->InitMorphs();
        
      C4DAtom * rootAtom = (C4DAtom * )rootPose;
      rootAtom->SetParameter(DescID(ID_CA_POSE_POINTS), GeData(1), DESCFLAGS_SET_0);
        
      CAMorph * morph = rootPose->AddMorph();
      morph->SetTarget(rootPose, document, obj);
      morph->SetMode(document, rootPose, CAMORPH_MODE_FLAGS_COLLAPSE, CAMORPH_MODE_ABS);
      morph->Apply(document, rootPose, CAMORPH_DATA_FLAGS_POINTS);
      rootPose->UpdateMorphs(document);
      

      This code fails to set the morph mixing mode to absolute. I've also tried to set the mixing mode via SetParameter using ID_CA_POSE_MIXING. But this crashes C4D.

      C4DAtom * morphAtom = (C4DAtom * )morph;
      morphAtom->SetParameter(DescID(ID_CA_POSE_MIXING), GeData(ID_CA_POSE_MIXING_ABS), DESCFLAGS_SET_0);
      

      I noticed that the mixing parameters are inactive. Could this be related?

      I have an alembic hierarchy. And I am generating a polygon version of that hierarchy. Each object in the hierarchy has a pose morph tag that targets the alembic equivalent object.

      How do I correctly add morph targets with the correct mixing mode?

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 12/05/2015 at 11:55, xxxxxxxx wrote:

        Figured it out, you have to set the pose morph tag's active morph index. Like this:

        rootPose->SetActiveMorphIndex(0);
        rootPose->SetParameter(DescID(ID_CA_POSE_MIXING), GeData(ID_CA_POSE_MIXING_ABS), DESCFLAGS_SET_0);
        

        This seems to select the pose morph in the pose list, allowing you to access the parameters.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post