bind textures to materials/objects



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

    On 02/02/2004 at 15:02, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.100 
    Platform:      Mac OSX  ; 
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hi:

    I am trying to import obj files from maya (running on linux   hence can't use the direct plugin). Unfortunately bodypaint ignores the texture information contained in the mtl file during obj import but it reads the objects just fine.

    How can I bind texture files at run time to materials using COFFEE?
    I thought that I can create a map file as follows
    objname1 : texturefile1.tif
    objname2 : texturefile2.tif
    ...
    ..

    Then using COFFEE somehow read this simple map file and and bind the texture file to the appropriate object/material.

    Is this possible? Can someone provide an example? I am new to MAXON prodcuts.

    Thanks.
    --rajesh



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

    On 09/02/2004 at 17:22, xxxxxxxx wrote:

    This functionality seems to be unavailable in C.O.F.F.E.E. right now, with the new material system. Normally you would connect materials with objects by creating a TextureTag and insert it on the object. I'll see if I can find a workaround. (Other than to use the C++ SDK.)



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

    On 10/02/2004 at 15:28, xxxxxxxx wrote:

    Unfortunately there's no workaround. The following was supposed to work in 8.503 but there's a bug that prevents it. Will be fixed in a future version.

        
        
        var mat = doc->GetFirstMaterial();  
        var tt = new(TextureTag);  
        var bc = tt->GetContainer();  
        bc->SetObject(TEXTURETAG_MATERIAL, mat);  
        tt->SetContainer(bc);  
        tt->Message(MSG_UPDATE);  
        op->InsertTag(tt, NULL);
    


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

    On 10/02/2004 at 17:07, xxxxxxxx wrote:

    Will the following work?

    for each pair in the map file:

    var objName = "objectName";
       var obj = doc->findObject(objName);
       var mat = new(Material);
       doc->InsertMaterial(mat);
       mat->SetName(stradd(objName, "_color");
       mat->setChannelState(CHANNEL_COLOR, TRUE);
       var colChannel = mat->GetChannel(CHANNEL_COLOR);
       var colChanCntr = colChannel->GetContainer();
       colChanCntr->SetData(CH_TEXTURE, "texturefile.tif");
       colChannel->SetContainer(colC);
       var matMaker = mat->GetMarker();
       var texTag = new(TextureTag);
       obj->InsertTag(texTag);
       texTag->SetMaterial(matMarker);

    Thanks.
    --rajesh.



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

    On 11/02/2004 at 17:49, xxxxxxxx wrote:

    It didn't look like that would work in 8.5 and above, since materials are assigned by links and not markers. I haven't tried it in 8.2 and below yet. Have you? (What you're doing is the traditional way of assigning materials in C.O.F.F.E.E., so if it works everything is alright.)


Log in to reply