Assign Texture to Polygon Selections



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

    On 17/11/2009 at 04:26, xxxxxxxx wrote:

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

    ---------
    Hi,

    in my PlugIn, I am trying to automatically assign colors to selections of my PolygonObject. I can successfully create the Selections, the Materials and the Texture Tags. Now my problem is the assignment of the texture to the selection.

    The item "TEXTURETAG_RESTRICTION" in Ttexture is only a string, and simply setting this string to my selection name seems not work. Is there other means of doing that?

    Here's part of my code on the problem:

      
    PolygonObject* op = (PolygonObject* )doc->GetActiveObject();   
    SelectionTag* opTag = SelectionTag::Alloc(Tpolygonselection);   
    op->InsertTag(opTag, op->GetTag(IDxxx);   
    opTag->SetName(GeLoadString(ID_STRING));   
      
    Material* opMat = Material::Alloc();   
    opMat->SetName(GeLoadString(ID_STRING));   
    opMat->GetDataInstance()->SetVector(MATERIAL_COLOR_COLOR, Vector(0,0,0));   
    doc->InsertMaterial(opMat);   
      
    TextureTag* opTex = TextureTag::Alloc();   
    op->InsertTag(opTex);   
    opTex->SetMaterial(opMat);               opTex->GetDataInstance()->SetString(TEXTURETAG_RESTRICTION, opTag->GetName());   
    

    Would appreciate any help on that!

    Best regards,
    Juergen



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

    On 17/11/2009 at 07:52, xxxxxxxx wrote:

    Do it this way instead:

    opTex->SetParameter(DescID(TEXTURETAG_RESTRICTION), GeData(opTag->GetName()), NULL);

    Don't forget to send update messages (opTex->Message(MSG_UPDATE)).



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

    On 18/11/2009 at 07:46, xxxxxxxx wrote:

    Thanks. That did it!


Log in to reply