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
    • Recent
    • Tags
    • Users
    • Login

    Reading texture data

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 395 Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 15/06/2010 at 00:43, xxxxxxxx wrote:

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

      ---------
      Hello,

      i like to read the size of an texture from a material which assigned to an base object.
      I do this with the PluginShader.

      PluginShader *shd = (PluginShader* )matdata->GetLink(MATERIAL_COLOR_SHADER, GetActiveDocument() , Xbitmap);

      BaseBitmap *pbb = shd->GetBitmap();
      if (pbb) {
          lx = pbb->GetBw();
          ly = pbb->GetBh();
      }

      But i get always an NULL pointer for the base bitmap??
      Has someone an idea?

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 15/06/2010 at 01:08, xxxxxxxx wrote:

        You have to make sure to call GetBitmap() within a pair of InitRender()/FreeRender() calls. If there is no InitRenderStruct avaible you can create a dummy structure on the stack.

        here an example:

          
        Bool MenuTest::Execute(BaseDocument *doc)  
        {  
          BaseMaterial *mat = doc->GetActiveMaterial();  
          if (!mat) return FALSE;  
          
          BaseContainer *data = mat->GetDataInstance();  
          
          PluginShader *shd = (PluginShader* )data->GetLink(MATERIAL_COLOR_SHADER, doc, Xbitmap);  
          if (!shd) return FALSE;  
          
          InitRenderStruct is;  
          is.version = GetC4DVersion();  
          is.time = doc->GetTime();  
          is.fps = doc->GetFps();  
          Filename docpath = doc->GetDocumentPath();  
          is.docpath = &docpath;  
          String matname = mat->GetName();  
          is.matname = &matname;  
          is.errorlist = NULL;  
          is.vd = NULL;  
          is.doc = doc;  
          is.thread = NULL;  
          is.flags = INITRENDERFLAG_TEXTURES;  
          
          shd->InitRender(&is);  
          
          BaseBitmap *bmp = shd->GetBitmap();  
          if (!bmp) return FALSE;  
          
          GePrint(LongToString(bmp->GetBw()));  
          GePrint(LongToString(bmp->GetBh()));  
          
          shd->FreeRender();  
          
          return TRUE;  
        }  
        

        cheers,
        Matthias

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 15/06/2010 at 01:35, xxxxxxxx wrote:

          i see, create it works
          thanks a lot

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