MoGraph Form Control



  • 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,



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

    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



  • hello,

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

    Cheers
    Manuel


Log in to reply