Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Get UVW coord for each point?

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 499 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      On 24/04/2009 at 15:18, xxxxxxxx wrote:

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

      ---------
      Hi,

      supposed I have an array with points from a geometry, retrieved from PointObject::GetPointR(), and a UVW tag, how can I get the UVW coordinate for each point in the array?

      I know how to get the UVW coordinate for any point on any polygon. But it seems I have a mental blockage here.

      Thanks for tips!

      Greetings,
      Jack

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 24/04/2009 at 16:20, xxxxxxxx wrote:

        A 3D point can have several UVW points depending if 3D polygons share this point. There is a UVW polygon for every 3D polygon. If you have a certain 3D point index go through the UVW polygons (UVWStruct) and check for this index.

        cheers,
        Matthias

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 24/04/2009 at 16:25, xxxxxxxx wrote:

          Since the vertices are stored per polygon in the UVW array, you can't do it like this. There is one UVW entry for every polygon vertex not per vertex in the point array. That is, the same point has as many entries in the UVW array as it has polygons indexing it (!).

          I would imagine that to get the UVW coordinates for each point, you would still need to go through the polygon array to find all of the polygons that index the current point under consideration and then retrieve the UVW coordinate (which you know how to do).

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

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

            On 24/04/2009 at 17:06, xxxxxxxx wrote:

            I was afraid this would be the answer 😉
            Well, then there's nothing else to do than just do it.

            Thanks, Robert & Matthias!

            Greetings,
            Jack

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

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

              On 27/04/2009 at 07:22, xxxxxxxx wrote:

              The above answers your initial question.  But if the question was "how do I get the UV values of the UV-points currently selected in BodyPaint?", the answer is a bit more detailed...
              First:
              //--------- S N I P ---------

                  
                  
                    
                      // if we got here, we're in point mode, so let's check the current uvpoint selection  
                      // for this, we first need a TempUVHandle...  
                      TempUVHandle *pTempUV = GetActiveUVSet(m_baseDoc, GETACTIVEUVSET_POINTSELECTION);  
                      if( !pTempUV )  
                      {  
                          return;    // Failure  
                      }
                  
                  
                  
                  
                      BaseSelect *pUVSelected = pTempUV->GetUVPointSel();  
                      if( !pUVSelected )  
                      {  
                          FreeActiveUVSet(pTempUV);  
                          return;    // Failure  
                      }  
                  
              

              //--------- S N I P ---------
              ...you now have a regular BaseSelect that you can process, but you need to split the values contained in it to extract the polygon vs point indices...
              //--------- S N I P ---------

                  
                  
                    
                      LONG ndx, seg = 0, smin, smax;  
                      while( pUVSelected->GetRange(seg++,&smin,&smax) )  
                      {  
                          for( ndx=smin; ndx<=smax; ndx++ )  
                          {  
                              UVWStruct uvw;  
                              LONG polyNdx;
                  
                  
                  
                  
                              polyNdx = ndx >> 2; // first determine which poly this is (divide by 4)  
                              uvw = m_uvTag->Get(polyNdx);
                  
                  
                  
                  
                              switch( ndx % 4 ) // next determine which point by: ndx mod(4)  
                              {  
                                  case 0: // do something with uv-point A  
                                      break;
                  
                  
                  
                  
                                  case 1: // do something with uv-point B  
                                      break;
                  
                  
                  
                  
                                  case 2: // do something with uv-point C  
                                      break;
                  
                  
                  
                  
                                  case 3: // do something with uv-point D  
                                      break;  
                              }  
                          }  
                      }  
                  
              

              //--------- S N I P ---------
              ...finally, make sure to free up the TempUVHandle when done...
              //--------- S N I P ---------

                  
                  
                    
                      FreeActiveUVSet(pTempUV);  
                  
              

              //--------- S N I P ---------

              1 Reply Last reply Reply Quote 0
              • First post
                Last post