Get data of MaterialPreviewData

On 20/07/2015 at 02:16, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R16 
Platform:   Windows  ;   
Language(s) :     C++  ;


How can i get the bitmap data of a MaterialPreviewData? 
I can't find anything in MaterialPreviewData that allows me to do that. 
I need a function that returns void * or char* that describe the RGB values of the Material Preview.

BaseContainer *data = getData();
if (data){
    GeData previewData = data->GetData(MATERIAL_PREVIEW);
    if (previewData.GetType() == CUSTOMDATATYPE_MATPREVIEW) {
        MaterialPreviewData* preview =(MaterialPreviewData* )previewData.GetCustomDataType(CUSTOMDATATYPE_MATPREVIEW);
        if (preview){
            //use the preview data here.

Thank you for your time.

On 21/07/2015 at 02:44, xxxxxxxx wrote:

Hello and welcome,

it seems that the MaterialPreviewData can only be used to configure the settings of the material preview and not to access any internal bitmap. In the Cinema 4D SDK bitmap data is typically not stored as a char* array but as a BaseBitmap object.

You can access the preview BaseBitmap of a given material using GetPreview().

Best wishes,

On 31/07/2015 at 10:34, xxxxxxxx wrote:

Hello peterakos,

was your question answered?

Best wishes,

On 03/08/2015 at 14:06, xxxxxxxx wrote:

Greetings !

How can i get the preview bytes though ?
It seems i can save it in a file using:
_<_t_>_IMAGERESULT | Save (const Filename &name, Int32 format, BaseContainer *data, SAVEBIT savebits) const<_<_t_>_

Thank you very much for your reply.

On 04/08/2015 at 00:24, xxxxxxxx wrote:


as said before, image data is typically stored in a BaseBitmap object. The mentioned Save() function is a member function of that class. You can access the preview bitmap of a material using GetPreview().

Best wishes,