Transform UVs with CallUVCommand



  • 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);



  • 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



  • 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 :)


Log in to reply