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
    The Maxon SDK Team is currently short staffed due to the winter holidays. No forum support is being provided between 15/12/2025 and 5/1/2026. For details see Maxon SDK 2025 Winter Holidays.

    UV relax

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 361 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

      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 Offline
        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 Offline
          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