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
    • Register
    • Login

    Updating a Texture Path

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 269 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 14/03/2005 at 16:19, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   9.101 
      Platform:   Windows  ;   
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      I have been having problems getting a texture field to update to a shortened path. For example I want to remove the entire directory from the image's name, but have the name of the texture remain. In the Console the right name prints out, but the texture in the channel that it is applied to will not update to the new name. Here is the function that gets the textures name and TRYS to update it:

          
          
          
          
          NOABSPATH::RemoveTexPath(mt1,Channel)             
          {  
          println(mt1);  
          var Tex = mt1->GetChannel(Channel);  
          var TexBC = Tex->GetContainer();  
          var TexName = TexBC->GetString(CH_TEXTURE);  
          var NewTexName = new(Filename);  
          NewTexName->SetLastString(TexName);  
          TexBC->SetData(CH_TEXTURE, NewTexName);  
          println(NewTexName);  
          }
          
          
          
      

      I know I am probably missing something obvious 😃 Thanks in advance for any help with this problem.
      -Josh-

      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 14/03/2005 at 17:53, xxxxxxxx wrote:

        For 8.2 and above, the texture filename goes like this (C++ SDK) :

          
        BaseContainer bdata;  
        BaseChannel* bchan = mt1->GetChannel(Channel);  
        bdata.SetFilename(BASECHANNEL_SUGGESTEDFOLDER, Filename(map).GetDirectory());  
        bchan->SetData(bdata);  
        bdata.SetString(BASECHANNEL_TEXTURE, Filename(map).GetFileString());  
        bchan->SetData(bdata);  
        

        The BaseChannel has already been extracted. You don't need to get the BaseChannel's container to set new values and you must set the data to the BaseChannel not the BaseContainer only.

        Hope that helps a little as I've not tried the new COFFEE.

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