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

    Transform UVs with CallUVCommand

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 322 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 13/04/2010 at 04:18, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:    
      Platform:      
      Language(s) :

      ---------
      Hi,
      I am trying to Transform the UV-Coordinates I generated with the CallUVCommand Function (c4d_painter).

      This works fine but if I try to transform the UV-Coords it doesn't have any effect although the function returns TRUE..
      Here is the Code, I would be grateful for any help.

      ------------------------------------------------------------
      TempUVHandle *handle = GetActiveUVSet(GetActiveDocument(), GETACTIVEUVSET_ALL);

      settings.SetBool(OPTIMALMAPPING_STRETCHTOFIT, FALSE);
           settings.SetReal(OPTIMALMAPPING_DISTORTION, Rad(50.0));
           settings.SetReal(OPTIMALMAPPING_SPACING, Rad(0.0));
           settings.SetBool(OPTIMALMAPPING_PROGRESSBAR, TRUE);
           settings.SetLong(OPTIMALMAPPING_RELAXCOUNT, 0);

      CallUVCommand(points, nPoints, polygons, nPolygons,
           uvwStructs, baseSelects[iSelection], pointSel, po,
           Muvpolygons, UVCOMMAND_OPTIMALMAPPING, settings);

      BaseContainer settings1;
      settings1.SetReal(UVCOMMAND_TRANSFORM_SCALE_X, 10.0);//scaleFactor);
      settings1.SetReal(UVCOMMAND_TRANSFORM_SCALE_Y, 11.0);
           
      CallUVCommand(points, nPoints, polygons, nPolygons,
                uvwStructs, baseSelects[iSelection], pointSel, po,
                Muvpolygons, UVCOMMAND_TRANSFORM, settings1);

      handle->SetUVW(uvwStructs);

      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 13/04/2010 at 06:38, xxxxxxxx wrote:

        I don't exactly know what is wrong with your code but the following test code works fine for me.

          
        Bool MenuTest::Execute(BaseDocument *doc)  
        {  
          BaseObject *op = doc->GetActiveObject();  
          if (!op || op->GetType() != Opolygon)  
              return FALSE;  
          
          BaseContainer settings, settings1;  
          TempUVHandle *handle = NULL;  
          
          handle = GetActiveUVSet(doc, GETACTIVEUVSET_ALL);  
          if (!handle)  
              goto Error;  
          
          settings.SetBool(OPTIMALMAPPING_PRESERVEORIENTATION, FALSE);  
          settings.SetBool(OPTIMALMAPPING_STRETCHTOFIT, FALSE);  
          settings.SetReal(OPTIMALMAPPING_DISTORTION, Rad(50.0));  
          settings.SetReal(OPTIMALMAPPING_SPACING, 2.0);  
          settings.SetBool(OPTIMALMAPPING_PROGRESSBAR, TRUE);  
          settings.SetLong(OPTIMALMAPPING_RELAXCOUNT, 1);  
          
          
          
          if (!CallUVCommand(handle->GetPoint(), handle->GetPointCount(), handle->GetPoly(), handle->GetPolyCount(),  
              handle->GetUVW(), handle->GetPolySel(), handle->GetUVPointSel(), handle->GetBaseObject(), handle->GetMode(),  
              UVCOMMAND_OPTIMALMAPPING, settings))  
              goto Error;  
          
          handle->SetUVW(handle->GetUVW());  
          
          settings1.SetReal(UVCOMMAND_TRANSFORM_MOVE_X, 0.0);  
          settings1.SetReal(UVCOMMAND_TRANSFORM_MOVE_Y, 0.0);  
          settings1.SetReal(UVCOMMAND_TRANSFORM_SCALE_X, 10.0);  
          settings1.SetReal(UVCOMMAND_TRANSFORM_SCALE_Y, 11.0);  
          settings1.SetReal(UVCOMMAND_TRANSFORM_ANGLE, 0.0);  
          
          if (!CallUVCommand(handle->GetPoint(), handle->GetPointCount(), handle->GetPoly(), handle->GetPolyCount(),  
              handle->GetUVW(), handle->GetPolySel(), handle->GetUVPointSel(), handle->GetBaseObject(), handle->GetMode(),  
              UVCOMMAND_TRANSFORM, settings1))  
              goto Error;  
          
          handle->SetUVW(handle->GetUVW());  
          
          FreeActiveUVSet(handle);  
          
          return TRUE;  
          
        Error:  
          FreeActiveUVSet(handle);  
          return FALSE;  
        }  
        

        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 14/04/2010 at 02:14, xxxxxxxx wrote:

          Thanks a lot, got it working now 🙂

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