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

    Cloner with multi-instance

    Cinema 4D SDK
    c++ r21
    3
    4
    753
    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.
    • P
      peterakos
      last edited by

      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 !

      1 Reply Last reply Reply Quote 0
      • fwilleke80F
        fwilleke80
        last edited by

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

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

        Cheers,
        Frank

        www.frankwilleke.de
        Only asking personal code questions here.

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

          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)

          Cheers,
          Manuel.

          MAXON SDK Specialist

          MAXON Registered Developer

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

            hello,

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

            Cheers,
            Manuel.

            MAXON SDK Specialist

            MAXON Registered Developer

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