Create a polyobject using C.O.F.F.E.E.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/05/2003 at 17:46, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.100 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hello everybody.
    Could someone gifted please help me expand this codesnippet to show me how to add new points and polygons to an object?
    I have put a simple C.O.F.F.E.E tag on a null object.
    I got this code from peranders.com so a great thanx to him to begin with.
    main(doc,op)
    {
    if (op->GetDown()) return FALSE;
    var childop=new(PolygonObject);
    **
    childop- >InsertUnder(op); ****
    }**
    **** 
    I have read the "Simple Poygon Problem" thread by Newbee but I didn't understand enough of it. I cannot find the alloc function talked about in that thread in the C.O.F.F.E.E. SDK.
     
    Regards / Feccand



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/05/2003 at 18:47, xxxxxxxx wrote:

    Hi Feccand

    I'm also a coffee-newbie but may this code can help you:
    **********

    var newObject = new(PolygonObject);

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

    var totalpoints = 8; // change this value to you desired pointcount

    backupTags->Init(newObject);
    variableChanged->Init(0, totalpoints);

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

    var totalpolys = 6; // change this value to you desired polygoncount

    backupTags->Init(newObject);
    variableChanged->Init(0, totalpolys);

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

    newObject->Message(MSG_UPDATE);

    doc->InsertObject(newObject, NULL, NULL);

    **********

    cya


Log in to reply