Create a UVWTag in C.O.F.F.E.E.



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

    On 30/05/2003 at 15:51, xxxxxxxx wrote:

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

    ---------
    Hello everybody.
     
    If anyone have an example of how to create and apply a UVWTag to a polygonobject using C.O.F.F.E.E I'd really like to see it.
    I have succeeded in applying the tag but cinema crashes when I try to use it (View it with bodypaint or apply a texture). I assume that I'm filling the tag with corrupt data or miss something when I apply it to the object.
    Is the UVWCoords ranging from (float) 0-1 on each axis or (integer) width, height of the texture?
     
    (Pardon my bad english but it's late and I'm tired and frustrated)
    Regards / Feccand



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

    On 01/06/2003 at 11:52, xxxxxxxx wrote:

    Sorry, but this is impossible in C.O.F.F.E.E. due to the cannot-create-VariableTags limitation. It should be possible to manipulate UVWTags that C4D has created.



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

    On 01/06/2003 at 15:24, xxxxxxxx wrote:

    Actually it is quite possible.
    With  help  from the cg-talk forum I resolved the issue.
    Here is a small example to show how it is done.

        
        
        
        
        main(doc,op)  
        {  
         var checktag = op->GetFirstTag();  
         while(checktag)  
         {  
          if(checktag->GetType() == TAG_UVW)  
          {  
           println("Object already has UVWTag");  
           return;  
          }  
          checktag = checktag->GetNext();  
         }
        
        
        
        
         var st_time = GeGetSysTime();  
         println("Time: ", st_time->hour, ":", st_time->minute, ":", st_time->second);
        
        
        
        
         var t_tag = new(UVWTag);  
         var random = new(Random);  
         random->Init(198376);
        
        
        
        
         var a_uvwcoords = new(array, 6*4);
        
        
        
        
         var counter;  
         var v_coord = vector(0);  
         for(counter = 0; counter < 6*4; counter++)  
         {  
          v_coord.x = random->Get01();  
          v_coord.y = random->Get01();  
          a_uvwcoords[counter] = v_coord;  
          println("Poly: ", counter/4, " Point: ", counter%4, " ", v_coord);  
         }
        
        
        
        
         var vc = new(VariableChanged);    
         vc->Init(0,op->GetPolygonCount());    
         if (!t_tag->Message(MSG_POLYGONS_CHANGED,vc))  
          return;    
           
         if(!t_tag->SetData(a_uvwcoords))  
         {  
          println("SetData Failed!");  
          return;  
         }  
         t_tag->Message(MSG_UPDATE);
        
        
        
        
         if(!op->InsertTag(t_tag, NULL))  
         {  
          println("InsertTag Failed!");  
          return;  
         }  
         op->Message(MSG_UPDATE);  
        }
        
        
        
    

    Voila! And there it is.
     
    Regards / Feccand



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

    On 01/06/2003 at 15:26, xxxxxxxx wrote:

    Oh. Forgot to mention that the example assumes that the tag is on a cube that is made editable and has no UVWTag.
     
    Regards / Feccand



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

    On 02/06/2003 at 01:26, xxxxxxxx wrote:

    Sorry, I forgot about that workaround.



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

    On 02/06/2003 at 05:46, xxxxxxxx wrote:

    Hey. No problem.
    I'm just glad it works..
     
    Regards / Feccand


Log in to reply