Thanks for the response.
Yes I am trying to get the MoData from the MoDataTag on a MoGraph generator object, and I am utilizing a Virtual document that has not added to the list of documents. Sorry for using the incorrect terminology, I am trying to get the MODATA_MATRIX.
This is the code that I am using.
BaseObject *matrixObj = BaseObject::Alloc(1018545); // Matrix Object
if (matrixObj == nullptr)
return nullptr;
BaseObject *boolebj = op->GetDown(); // I know for a fact that this is a Boole object
if (boolebj == nullptr)
return nullptr;
BaseDocument *virtualDoc = BaseDocument::Alloc();
BaseObject *clonedBooleObj = (BaseObject*)boolebj->GetClone(COPYFLAGS::NONE, nullptr);
if (clonedBooleObj == nullptr)
return nullptr;
virtualDoc->InsertObject(clonedBooleObj, nullptr, nullptr);
virtualDoc->InsertObject(matrixObj, nullptr, nullptr);
BaseContainer *matrixData = matrixObj->GetDataInstance();
matrixData->SetInt32(ID_MG_MOTIONGENERATOR_MODE, 0); // Setting to Object Mode
matrixData->SetLink(MG_OBJECT_LINK, clonedBooleObj);
matrixData->SetInt32(MG_POLY_MODE_, 0); // Set to Surface Distribution Mode
matrixData->SetInt32(MG_POLYSURFACE_SEED, 1234567);
matrixData->SetInt32(MG_POLYSURFACE_COUNT, 20);
matrixData->SetBool(MG_OBJECT_ALIGN, FALSE);
matrixData->SetVector(ID_MG_TRANSFORM_SCALE, Vector(0));
virtualDoc->ExecutePasses(nullptr, true, true, true, BUILDFLAGS::NONE);
if (virtualDoc->GetFirstObject() != nullptr)
{
BaseTag *tmp = matrixObj->GetTag(ID_MOTAGDATA); // This tag is not found inside of the Virtual document
if (!tmp)
return nullptr;
GetMoDataMessage modataMsg;
if (!tmp->Message(MSG_GET_MODATA, &modataMsg))
return nullptr;
MoData *matrixData = modataMsg.modata;
if (!matrixData)
return nullptr;
Int32 matrixItemsCnt = matrixData->GetCount();
MDArray<Matrix> mdmat = modataMsg.modata->GetMatrixArray(MODATA_MATRIX);
Matrix* itemsMtxArray = static_cast<Matrix*>(matrixData->GetArray(MODATA_MATRIX));
maxon::Int32* flags = static_cast<maxon::Int32*>(matrixData->GetArray(MODATA_FLAGS));
for (Int32 index2 = 0; index2 < matrixItemsCnt; index2++)
{
if (flags[index2] & MOGENFLAG_CLONE_ON == MOGENFLAG_CLONE_ON)
{
}
}
}
This code has worked as expected with most objects but not with a Boole object.
John Thomas