BodyPaint - Selected UV Points



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

    On 06/04/2006 at 07:19, xxxxxxxx wrote:

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

    ---------
    As the title suggests, I'm writing a plugin that modifies selected UV points of a PolygonObject.  The other plugins I've written deal with the UVs of the selected Polygons, but in this case, I specifically need to work with the selected points, and therein lies m problem/question...
    I could op->GetPointS(), but that only gets me the vertices that are selected, which is not the same thing as which UV points are selected (anywhere there's a seam/split of the uv-mapping, polygons that happen to use any point along that seam/split will have 'separate' UV points for that vertex).
    Off-hand, I don't see any mechanism for directly determining which UV points are selected... or any way to correlate selected vertices to the actual UV points that are selected.  I assume BodyPaint is tracking this information internally, but is there any way for a plugin to get that info?
    To clarify, I guess what I'm looking for is what would be a op->GetUVPointS() (get selected UV points).
    Thanks,
    - Keith



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

    On 06/04/2006 at 07:36, xxxxxxxx wrote:

    ...while I'm at it, here's what I'm trying to do...
    When using the modeller to move vertices around, you are able to 'lock' any of the 3 axis, however BodyPaint has no such locking mechanism (grrrr). So anytime I move sets of UV points around, I might ONLY want to move them in the X or Y direction, but since I can't lock the other direction, it's a crap-shoot as to whether I can get the points where I want them (again, grrrrrrr).
    So, what I'm doing is writing a 'Align Vertical' and 'Align Horizontal' plugins, to allow me to select a set of points that I just moved and re-align them (since, as I mentioned, you can't lock an axis when moving points around!! GRRRRR) :).
    BTW, I know this is probably not the place to leave feature requests for the development team, but if you could pass this along, I'd appreciate it...
    BodyPaint Feature Requests:
    1. Add a mechanism to lock X/Y (U/V) axis when using the move/scale tools (Please!).
    2. Add a 'Slide UV Point Along Line' tool (like the one for points and edges in C4D - Pretty Please!).



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

    On 06/04/2006 at 12:49, xxxxxxxx wrote:

    See c4d_painter.h and TempUVHandle::GetUVPointSel().



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

    On 06/04/2006 at 13:00, xxxxxxxx wrote:

    Will do - thanks!



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

    On 06/04/2006 at 15:27, xxxxxxxx wrote:

    Cool beans - that works - thanks!
    Just for anyone else reading this, and since there doesn't seem to be any documentation on these routines... 
    - To get the current UV point selection, you first need to get a TempUVHandle.  For this, I used:
    TempUVHandle *pTempUV = GetActiveUVSet (doc, GETACTIVEUVSET_POINTSELECTION);
    - Once you have that, you can get a BaseSelect, like so:
    BaseSelect *pUserSelected = pTempUV-> GetUVPointSel ();
    - The selection is set up similar to how edges work, so the individual UV points are indexed like so:
    (4*polycnt) + [0..3] = a,b,c,d
    ...so, to get at the UV values, you first need to determine which Poly the point is in and then which (a,b,c or d) corner of the poly it is.  Here's the code I used for that:

        
        
        
        
        // ................ S N I P ...............
        
        
        
        
        seg = 0; 
        
        
        
        
        while( pUserSelected->GetRange(seg++,&smin,&smax) )  
         {  
          for( ndx=smin; ndx<=smax; ndx++ )  
          {  
           UVWStruct uvw;
        
        
        
        
           LONG polyNdx, ptNdx;
        
        
        
        
           polyNdx = ndx >> 2; // first determine which poly this is (divide by 4)  
           ptNdx = ndx % 4; // next determine which point by: ndx mod(4)  
          uvw = m_uvTag->Get(polyNdx);
        
        
        
        
           switch( ptNdx )  
           {  
            case 0:  
             // do something with uvw.a  
             break;
        
        
        
        
            case 1:  
             // do something with uvw.b  
             break;
        
        
        
        
            case 2:  
             // do something with uvw.c  
             break;
        
        
        
        
            case 3:  
             // do something with uvw.d  
             break;  
           }  
          }  
         }  
        // ................ S N I P ...............
        
        
        
    

    - Finally (and I got bit by this), you need to free the TempUVHandle - BUT - don't free it until AFTER you're done with the BaseSelect.  You can free it with:
    FreeActiveUVSet (pTempUV);
    ...again, I couldn't find any documentation (aside from the one comment decribing the point indexing), so the above comments come with the caveat that I assume that's how it's supposed to work (and seems to).
    Cheers,
    - Keith


Log in to reply