Cloner with multi-instance

  • Hello.

    I want to support to fully support multi-instances in my render engine, but I find some difficulties with cloners.
    I transfer the cloner data into my engine by reading the Cache. The problem is that the multi instances that exist inside the cloner have the parameter INSTANCEOBJECT_MULTIPOSITIONINPUT empty.
    How can I get the multi instance positions from the cloner ?

    Thank you for your time !

  • You can get the array with matrices using this member function:

    const maxon::BaseArray<Matrix>* InstanceObject::GetInstanceMatrices() const


  • hello,

    I'm not sure if you are talking about a Mograph Cloner or an Instance with Instance Mode set to Multi-Instance.

    For a Cloner Object you can retrieve the matrices inside the MoData like this

            BaseObject *mographObj = doc->GetActiveObject();
    	if (mographObj == nullptr)
    		return maxon::NullptrError(MAXON_SOURCE_LOCATION);
    	BaseTag *tag = mographObj->GetTag(ID_MOTAGDATA);
    	if (tag == nullptr)
    		return maxon::NullptrError(MAXON_SOURCE_LOCATION);
    	// populate the GetMoDataMessage instance by sending a MSG_GET_MODATA
    	GetMoDataMessage modataMsg;
    	if (!tag->Message(MSG_GET_MODATA, &modataMsg))
    		return maxon::UnexpectedError(MAXON_SOURCE_LOCATION);
    	if (!modataMsg.modata)
    		return maxon::UnexpectedError(MAXON_SOURCE_LOCATION);
    	// access the MoData from the returned GetMoDataMessage and check its validity
    	MoData *moData = modataMsg.modata;
    	if (!moData)
    		return maxon::NullptrError(MAXON_SOURCE_LOCATION);
    	// retrieve the number of Matrix items as well as the array containing the matrix for each of them
    	maxon::Int32 matrixItemsCnt = moData->GetCount();
    	maxon::Matrix* itemsMtxArray = static_cast<maxon::Matrix*>(moData->GetArray(MODATA_MATRIX));

    If you are using An InstanceObject you can check our manual .
    As @fwilleke80 said you have GetInstanceMatrices or you can read the multi-instanceData (example in the manual)


  • hello,

    without further addition on your part, this thread will be considered as solved tomorrow.


Log in to reply