Plugin Cafe's original forum is still archived and available for searches. The ability to post here has been disabled.
 
Developer's Forum [PREV] [NEXT]
Subject: RE: Creating PolygonObject with points
From: Mikael Sterner
Date: 8/12/2000 5:54 AM GMT
    Hiroshi Ikeda wrote:
    > Dear Forum,
    > For V6 COFFEE, is there any equivalent
    > of V5's NewPolygonObject() function,
    > which can include a given number of
    > points?Polygon object only by
    > InsertObject() has no points, so
    > SetPoint() doesn't work.

    No. However, writing one isn't too difficult:

    NewPolygonObject(pointCount,
    polygonCount)
    {
    if (pointCount < 0 || polygonCount < 0) return FALSE;

    var newObject = new(PolygonObject);

    var pointArray = new(array, pointCount);
    var polygonArray = new(array, polygonCount * 4);

    // Modify the arrays here if you want!

    newObject->SetPoints(pointArray);
    newObject->SetPolygons(polygonArray);

    var variableChanged = new(VariableChanged);
    var backupTags = new(BackupTags);

    backupTags->Init(newObject);
    variableChanged->Init(0, pointCount);
    if (!newObject->Message(MSG_POINTS_CHANGED, variableChanged))
    {
    backupTags->Restore();
    return FALSE;
    }

    backupTags->Init(newObject);
    variableChanged->Init(0, polygonCount);
    if (!newObject->Message(MSG_POLYGONS_CHANGED, variableChanged))
    {
    backupTags->Restore();
    return FALSE;
    }

    newObject->Message(MSG_UPDATE);
    return newObject;
    }

    Mikael Sterner
    Developer Support
Current Message String
new Creating PolygonObject with points - Hiroshi Ikeda - 8/11/2000 6:12 AM GMT
 new RE: Creating PolygonObject with points - Mikael Sterner - 8/12/2000 5:54 AM GMT
[PREV] [NEXT]