On 23/11/2017 at 02:21, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 18.057
Platform: Windows ;
Language(s) : C++ ;
---------
Hello everybody,
currently I am trying to get used to the C4D MATPREVIEW GUI Control. I am trying to connect a LinkBox which accepts materials with a MaterialPreview. As soon as I link a material to the LinkBox I want the material preview control to show the rendered preview image. Additionally I want to update the image as soon as the referenced material changed.
Current attempt:
* listening to the EVMSG_MATERIALPREVIEW event (emitted when a material is changed)
* checking if the changed material is the material hold in the link box
* problem: how to update/connect the preview control
Could anyone give me some hints or some little explanation/examples how to use the MaterialPreview Control?
Greetings
Svente
if (id == EVMSG_MATERIALPREVIEW)
{
//get material container
BaseObject* pMaterialContainer = (BaseObject* )msg.GetVoid(BFM_CORE_PAR1);
if (!pMaterialContainer)
return GeDialog::CoreMessage(id, msg);
//get the LinkBox from plugin dialog in order to get the linked material
LinkBoxGui* pLinkBox = (LinkBoxGui* )this->FindCustomGui(MATERIALCHANGE_LINK_BROWSER_LINK, CUSTOMGUI_LINKBOX);
if (!pLinkBox)
return GeDialog::CoreMessage(id, msg);
////get the linked materials BaseObject
BaseObject* pLinkedMat = (BaseObject* )pLinkBox->GetLink(GetActiveDocument());
if (!pLinkedMat)
return GeDialog::CoreMessage(id, msg);
//check if linked material is the same as the one of the calling message and return otherwise
if (pMaterialContainer != pLinkedMat)
return GeDialog::CoreMessage(id, msg);
MaterialPreviewCustomGui* pPreview = (MaterialPreviewCustomGui* )this->FindCustomGui(MATERIALCHANGE_MATPREV_MAT, CUSTOMGUI_MATPREVIEW);
if (!pPreview)
return GeDialog::CoreMessage(id, msg);
//??? what to do?
}