Updating a Texture Path



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



  • 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.


Log in to reply