RayObject and polygon selections/textures [SOLVED]



  • On 06/07/2015 at 23:01, xxxxxxxx wrote:

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

    ---------
    consider a polygon object which got many different textures, each with its own selection, how to retrieve this data through RayObject "I searched and found old threads, found this thread: https://plugincafe.maxon.net/topic/3147/2527_uvw-projections&KW=rsadr "

    it has an example, but it is not a complete one, may be more clarification here please.



  • On 07/07/2015 at 07:38, xxxxxxxx wrote:

    Hello,

    the index of the restriction is stored in the TexData object (TexData::restrict). With that index you can check if there is a restriction and then you can test if a given polygon is selected or not. Something like this:

      
    // get selection  
    const Int32 selection = texData->restrict;  
      
    // if there is a selection  
    if(selection != 0)  
    {  
     // check for each polygon  
      
     for (Int32 polyIndex = 0; polyIndex < rayObject->vcnt; ++polyIndex)  
     {  
         GePrint("Texture "+String::IntToString(textureIndex) + ", Polygon "+String::IntToString(polyIndex));  
         if ((rayObject->rsadr[texData->restrict][polyIndex >> 5] & (1 << (polyIndex & 31))) == 0)  
         {  
             GePrint("not selected");  
         }  
         else  
         {  
             GePrint("selected");  
         }  
     }  
    }  
    

    best wishes,
    Sebastian



  • On 07/07/2015 at 07:42, xxxxxxxx wrote:

    thanks a lot Sebastian , consider this solved.


Log in to reply