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

    Extracting the Texturename from a Materia

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 344 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 19/04/2007 at 00:32, xxxxxxxx wrote:

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

      ---------
      I need the Texturename (and path) from the colorchannel in a material.

      Following the examples I found here, thats my code:

        
      BaseMaterial* mat = P406Exporter.doc->GetFirstMaterial();  
      BaseChannel* pChannel = mat->GetChannel(CHANNEL_COLOR);  
      if (pChannel)  
      {       
      // Extract full image file path  
      Filename suggestedFolder = pChannel->GetData().GetFilename(BASECHANNEL_SUGGESTEDFOLDER);  
      String map = pChannel->GetData().GetString(BASECHANNEL_TEXTURE);  
      Filename fullpath = suggestedFolder + Filename(map);       
      }  
      

      But the filename is always empty.

        
      GenerateTexturePath(P406Exporter.doc->GetDocumentPath(), Filename(pChannel->GetData().GetString(BASECHANNEL_TEXTURE)), Filename(), &path;) ;  
      

      This one returns an empty filename too.

      I had no problems accessing other values in the different channels, but this seems to be stored different than the other values.
      I find it a little confusing how the values are stored and I somehow never now how to access them (getParameter, getContainer, getData, getDataInstance)

      Any suggestions are welcome

      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 19/04/2007 at 01:08, xxxxxxxx wrote:

        This is how you get the complete path including the name of the file for your texture. bc is the BaseContainer of the BaseChannel.

        Filename path = bc.GetFilename(BASECHANNEL_SUGGESTEDFOLDER);
        if(!path.Content())      path = doc->GetDocumentPath();
        Filename file = bc.GetString(BASECHANNEL_TEXTURE);
        path = path+file;
        GePrint(path.GetString());

        hope this helps

        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 19/04/2007 at 02:11, xxxxxxxx wrote:

          Yes, it works perfectly.
          Thanks for the help

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