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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    UV relax

    SDK Help
    0
    3
    361
    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
      Helper
      last edited by

      On 04/12/2016 at 06:54, xxxxxxxx wrote:

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

      ---------
      As the CallUVCommand isn't functional within the Python API, I have been playing around with the C++ SDK.
      I am trying to perform a relaxation of the polygons defined in the BaseSelect bsPolys , given a set of edges specified in BaseSelect bsEdges. However, I haven't found any documentation, nor example as how to set the BaseSelect into the BaseContainer being passed to CallUVCommand.

      Could someone explain, or point me to some explanation how to go about this?
      Thanks

        
        TempUVHandle* handle = GetActiveUVSet(doc, GETACTIVEUVSET_ALL);  
        
        if (handle)  
        {  
            BaseSelect* bsPolys;  
            BaseSelect* bsEdges;  
        
            ...   
        
            BaseContainer bc;  
        
            bc.SetBool(RELAXUV_CUT_EDGESEL, true);  
            bc. ??? (RELAXUV_EDGESEL_POINTER, ??? bsEdges); //     <-----------  
            bc.SetBool(RELAXUV_KEEP_NEIGHBORS, false);  
            bc.SetBool(RELAXUV_KEEP_BORDER, false);  
            bc.SetInt32(RELAXUV_MODE, RELAXUV_MODE_LSCM);  
        
            CallUVCommand(  
                handle->GetPoint(),  
                handle->GetPointCount(),  
                handle->GetPoly(),  
                handle->GetPolyCount(),  
                handle->GetUVW(),  
                handle->GetPolySel(),  
                handle->GetUVPointSel(),  
                handle->GetBaseObject(),  
                Muvpolygons,  
                UVCOMMAND_RELAX,  
                bc);  
        
            handle->SetUVWFromTextureView(handle->GetUVW(), false, false, false);  
            FreeActiveUVSet(handle);  
        }  
      
      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 04/12/2016 at 10:59, xxxxxxxx wrote:

        You need to use SetVoid() to use the active edges pointer.

        Here's an example written for R13

            PolygonObject *pObj = (PolygonObject* )doc->GetActiveObject();  
          if (!(pObj && (pObj->GetType() == Opolygon))) return false;  
          
          BaseSelect *EdgeS = pObj->GetEdgeS();  
           
          TempUVHandle *handle = GetActiveUVSet(doc, GETACTIVEUVSET_ALL);  
          if (handle)  
          {  
              BaseContainer bc;  
              bc.SetBool(RELAXUV_CUT_EDGESEL, true);  
              bc.SetVoid(RELAXUV_EDGESEL_POINTER, EdgeS); //<---Use the currently selected edges when cutting the UVs  
              bc.SetBool(RELAXUV_KEEP_NEIGHBORS, false);  
              bc.SetBool(RELAXUV_KEEP_BORDER, false);  
              bc.SetLong(RELAXUV_MODE, RELAXUV_MODE_LSCM);  
          
              CallUVCommand(  
                  handle->GetPoint(),  
                  handle->GetPointCount(),  
                  handle->GetPoly(),  
                  handle->GetPolyCount(),  
                  handle->GetUVW(),  
                  handle->GetPolySel(),  
                  handle->GetUVPointSel(),  
                  handle->GetBaseObject(),  
                  Muvpolygons,  
                  UVCOMMAND_RELAX,  
                  bc);  
          
              //handle->SetUVWFromTextureView(handle->GetUVW(), false, false, false); //R17 function  
              handle->SetUVW(handle->GetUVW()); //R13 function  
              FreeActiveUVSet(handle);  
          }
        

        -ScottA

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

          On 04/12/2016 at 12:07, xxxxxxxx wrote:

          Thanks Scott.
          I looked into trying SetVoid, but got mislead as Visual Studio reported a mismatch in my code ... which turns out to be a typo.
          Your example works as expected. Thanks again.

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