Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Get data of MaterialPreviewData

    SDK Help
    0
    5
    413
    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.
    • H
      Helper
      last edited by

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

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

      ---------
      Hello.

      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.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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,
        Sebastian

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          Hello peterakos,

          was your question answered?

          Best wishes,
          Sebastian

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

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

              Hello,

              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,
              Sebastian

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