THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/02/2006 at 19:58, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.012
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
---------
Am I to assume that
polyinfo->edge[n]
baseselect->IsSelected(polyinfo->edge[n])
refer to the same edge index for both what is returned in PolyInfo and what is stored in BaseSelect? For I am not seeing this.
For every point, I get a PolyInfo structure from an Init.ialized Neightbor class. I then check mark[] == FALSE and edge[] != NOTOK. But the polygon indices and/or the edge indices are not correlating. Here's the code:
// SSDialog:SplitTagEdge
//*---------------------------------------------------------------------------*
BOOL SSDialog::SplitTagEdge(PolygonObject* obj, SelectionTag* stagOld)
//*---------------------------------------------------------------------------*
{
// Get tag object's points and polys
Vector* vert = obj->GetPoint();
if (!vert) return TRUE;
#ifdef C4D_R9
CPolygon* poly = obj->GetPolygon();
#else
Polygon* poly = obj->GetPolygon();
#endif
if (!poly) return TRUE;
// Copy tag
SelectionTag* stagNew = static_cast<SelectionTag*>(stagOld->GetClone(0L, NULL));
if (!stagNew) return ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "SSDialog.SplitTagEdge.stagNew");
obj->InsertTag(stagNew, NULL);
baseDocument->AddUndo(UNDO_NEW, stagNew);
// Split old and new tags
BaseSelect* selectOld = stagOld->GetBaseSelect();
if (!selectOld) return ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "SSDialog.SplitTagEdge.selectOld");
BaseSelect* selectNew = stagNew->GetBaseSelect();
if (!selectNew) return ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "SSDialog.SplitTagEdge.selectNew");
String baseName = stagOld->GetName();
Matrix m = obj->GetMg();
LONG pcount = obj->GetPolygonCount();
LONG x;
LONG e;
PolyInfo* pli;
Neighbor neighbor;
if (!neighbor.Init(obj->GetPointCount(), poly, pcount, NULL)) return ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "SSDialog.SplitTagEdge.neighbor.Init()");
if (symPlane == PLANE_XY)
{
// Remove redundant selections
if (oldSide == SIDE_POS)
{
for (x = 0; x < pcount; x++)
{
pli = neighbor.GetPolyInfo(x);
e = pli->edge[0];
if (e != NOTOK)
{
if (selectOld->IsSelected(e) && ((vert[poly[x].a]*m).z <= 0.0)) selectOld->Deselect(e);
if (selectNew->IsSelected(e) && ((vert[poly[x].a]*m).z >= 0.0)) selectNew->Deselect(e);
}
e = pli->edge[1];
if (e != NOTOK)
{
if (selectOld->IsSelected(e) && ((vert[poly[x].b]*m).z <= 0.0)) selectOld->Deselect(e);
if (selectNew->IsSelected(e) && ((vert[poly[x].b]*m).z >= 0.0)) selectNew->Deselect(e);
}
e = pli->edge[2];
if (e != NOTOK)
{
if (selectOld->IsSelected(e) && ((vert[poly[x].c]*m).z <= 0.0)) selectOld->Deselect(e);
if (selectNew->IsSelected(e) && ((vert[poly[x].c]*m).z >= 0.0)) selectNew->Deselect(e);
}
e = pli->edge[3];
if (e != NOTOK)
{
if (selectOld->IsSelected(e) && ((vert[poly[x].d]*m).z <= 0.0)) selectOld->Deselect(e);
if (selectNew->IsSelected(e) && ((vert[poly[x].d]*m).z >= 0.0)) selectNew->Deselect(e);
}
}
stagOld->SetName(posPrefix+baseName);
stagNew->SetName(negPrefix+baseName);
}
else if (oldSide == SIDE_NEG)
{
for (x = 0; x < pcount; x++)
{
pli = neighbor.GetPolyInfo(x);
e = pli->edge[0];
if (e != NOTOK)
{
if (selectOld->IsSelected(e) && ((vert[poly[x].a]*m).z >= 0.0)) selectOld->Deselect(e);
if (selectNew->IsSelected(e) && ((vert[poly[x].a]*m).z <= 0.0)) selectNew->Deselect(e);
}
e = pli->edge[1];
if (e != NOTOK)
{
if (selectOld->IsSelected(e) && ((vert[poly[x].b]*m).z >= 0.0)) selectOld->Deselect(e);
if (selectNew->IsSelected(e) && ((vert[poly[x].b]*m).z <= 0.0)) selectNew->Deselect(e);
}
e = pli->edge[2];
if (e != NOTOK)
{
if (selectOld->IsSelected(e) && ((vert[poly[x].c]*m).z >= 0.0)) selectOld->Deselect(e);
if (selectNew->IsSelected(e) && ((vert[poly[x].c]*m).z <= 0.0)) selectNew->Deselect(e);
}
e = pli->edge[3];
if (e != NOTOK)
{
if (selectOld->IsSelected(e) && ((vert[poly[x].d]*m).z >= 0.0)) selectOld->Deselect(e);
if (selectNew->IsSelected(e) && ((vert[poly[x].d]*m).z <= 0.0)) selectNew->Deselect(e);
}
}
stagOld->SetName(negPrefix+baseName);
stagNew->SetName(posPrefix+baseName);
}
}
...
}
Note that I've removed the mark[] check. This started out using the identical code in the docs and has been slowly modified for speed and removal of unused junk. It did not work then and still doesn't work now.
Why can't you just have a stupidly easy method on PolygonObject to return an array of edges? Or can you explain how the Tedgeselection SelectionTag BaseSelect is structured?
Thank you,