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

    MoGraph Form Control

    Cinema 4D SDK
    c++ r20 sdk
    2
    3
    676
    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.
    • J
      JohnThomas
      last edited by

      Hello,

      I am working on an object plugin that is retrieving points from a MoGraph Matrix for use by the plugin. Per recommendations from a previous forum post I am using this code to retrieve the points.

      BaseTag *tmp = mographObj->GetTag(ID_MOTAGDATA);
      if (!tmp)
      	continue;
      
      // populate the GetMoDataMessage instance by sending a MSG_GET_MODATA
      GetMoDataMessage modataMsg;
      if (!tmp->Message(MSG_GET_MODATA, &modataMsg))
      	continue;
      
      // access the MoData from the returned GetMoDataMessage and check its validity
      MoData *matrixData = modataMsg.modata;
      if (!matrixData)
      	continue;
      
      // retrieve the number of Matrix items as well as the array containing the matrix for each of them
      Int32 matrixItemsCnt = matrixData->GetCount();
      Matrix* itemsMtxArray = static_cast<Matrix*>(matrixData->GetArray(MODATA_MATRIX));
      
      // Properly cycles through the contents of the matrix and gets all of the positions of the points
      for (Int32 matrixIndex = 0; matrixIndex < matrixItemsCnt; matrixIndex++)
      {
      	dataContainer.pos = itemsMtxArray[matrixIndex].off;
      }
      

      This code works perfectly fine retrieving the points from a Mograph when the "Form" control is set to Cubic. When the control is set to one of the other options such as Sphere or Cylinder, where the amount of points has now visually changed, I am still receiving all of the points as if it was still set to Cubic.

      My question is, is there an alternative way to retrieve just the points that are shown by the Matrix while its Form control is set to one of the other choices besides Cubic?

      Any help would be greatly appreciated.

      John,

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

        Hello and thanks for the question,

        First, for your next threads, please help us keeping things organised and clean. I know it's not your priority but it really simplify our work here.

        • Q&A New Functionality.
        • How to Post Questions especially the tagging part.

        I've marked this thread as a question so when you considered it as solved, please change the state 🙂

        Regarding your question, as i understand it, you should check also the flags states of the cloners.

        The flags are stored in the Modata Array with ID MODATA_FLAGS and can have different values

        MOGENFLAG_CLONE_ON and MOGENFLAG_DISABLE should help you.
        In that case, it seems that both flag have the same values. I'll check if i can have information about that.

        	maxon::Int32 matrixItemsCnt = moData->GetCount();
        	maxon::Matrix* itemsMtxArray = static_cast<maxon::Matrix*>(moData->GetArray(MODATA_MATRIX));
        	maxon::Int32* flags = static_cast<maxon::Int32*>(moData->GetArray(MODATA_FLAGS));
        
        	for (maxon::Int32 matrixIndex = 0; matrixIndex < matrixItemsCnt; matrixIndex++)
        	{
        		DiagnosticOutput("The clone state MOGENFLAG_CLONE_ON is @ / MOGENFLAG_DISABLE is @ and position @", flags[matrixIndex] & MOGENFLAG_CLONE_ON == MOGENFLAG_CLONE_ON, flags[matrixIndex] & MOGENFLAG_DISABLE == MOGENFLAG_DISABLE, itemsMtxArray[matrixIndex]);
        	}
        
        
        

        Cheers
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

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

          hello,

          if you have nothing to add, this thread will be considered as 'solved' and will be closed tomorrow

          Cheers
          Manuel

          MAXON SDK Specialist

          MAXON Registered Developer

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