UV relax
-
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?
ThanksTempUVHandle* 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); }
-
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
-
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.