Simple Poygon Problem



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

    On 18/04/2003 at 12:02, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.100 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    hi there...
    im starting to programm with the c++ SDK.
    The Dialogs and the Dialog resources are no problem,
    but i cant create a simple polygon and a simple cube.

    can anyone show me a short example how to manage that ?

    i cant believe that it should be so difficult... :-(

    thanks in advance



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

    On 19/04/2003 at 07:20, xxxxxxxx wrote:

    is nobody able to give me a simple hint ?
    im now 2 days reading the SDK Documentation and the sample files.
    I find a lot of starting points - but nothing, that really works....
    i dont expect a tutorial, but a hint which classes i have to use to create a simple polygon or a standard object.
    i found the c4d_baseobject. is the GeneratePrmitive Member the right thing for a simple cube ?
    i think that for the Polygon Object i have to use the class Object Data(Generator)...
    i would be happy about every hint... :-(
    best regards



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

    On 19/04/2003 at 08:23, xxxxxxxx wrote:

    You could certainly use GeneratePrimitive() if the goal is just to create a cube. However, if the goal is to learn the SDK you should examine PolygonObject, and especially PolygonObject::Alloc(), PolygonObject::GetPolygon() and PointObject::GetPoint(). A little Atom::Message(MSG_UPDATE) couldn't hurt either. Finally you might want to have a look at BaseDocument::InsertObject() and GeEventAdd().
    ObjectData would be if you wanted to create your own cube primitive object, not just for creating a simple polygonal cube.



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

    On 19/04/2003 at 08:48, xxxxxxxx wrote:

    thanks !
    i'll try it :-)



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

    On 20/04/2003 at 04:37, xxxxxxxx wrote:

    hi once again...
    i still have heavy problems with it. i think that it should look a little bit like this to create one polygon.. but where should i put the bold-written functions (if they are right...)?
    does anyone has a sample-source for me with only one polygon or a simple object ?
    best regards
    -------------------------------------------------------------------------------------------
    class Polyg : public ObjectData
    {
     public:
      
      static NodeData *Alloc(void) { return gNew Polyg; }
    };

    //NewPolygonObjectAlloc
    po = PolygonObject::Alloc(0,0);

    //Start of the array of Polygons
    padr = po->GetPolygon();

    //set Polygon
    padr[0] = Polygon((0,0,0),(100,0,0),(100,100,0));

    Bool RegisterPolyg(void)
    {
     return RegisterObjectPlugin(1000010,"Objekt Test",OBJECT_GENERATOR,Polyg::Alloc,"",0);
     
    }



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

    On 20/04/2003 at 08:01, xxxxxxxx wrote:

    First, remove everything that isn't bold. You don't want to create an ObjectData plugin.
    Instead, put the bold statements in the Execute() function of the MenuTest.cpp example of the SDK. There you have a platform for testing.



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

    On 21/04/2003 at 03:53, xxxxxxxx wrote:

    hi,
    it really worked after some tests :-) thank you !
     ...but i have some more questions,
    because i do not understand the following 4 things:
    1. I have to click in the viewport to see the PolygonObject in the object manager ... why ?
    2. Do i have to create every time the points first ?
    3. Do i have to know the polygon and point count before i "Alloc" the PolygonObject ?
    4. Why i can't select the new polygon with the Mouse in the viewport
       (it is only possible, when i save and reload the scene) ?
    ---------------------------------------------------------------------------------------------
    Bool Polygon::Execute(BaseDocument *doc)
    {
    PolygonObject *po=NULL;
    Vector *padr=NULL;
    Polygon *vadr=NULL;
    po = PolygonObject::Alloc(3,1);
    po-> SetName ("My Polygon");
    vadr = po->GetPolygon();
    padr = po->GetPoint();
    padr[0] = Vector(100,0,0);
    padr[1] = Vector(100,100,0);
    padr[2] = Vector(0,0,0);
    vadr[0] = Polygon(0,1,2);
    doc->InsertObject(po,NULL,NULL,NULL);
    doc->Message(MSG_UPDATE);
    return TRUE;
    }



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

    On 21/04/2003 at 04:18, xxxxxxxx wrote:

    1. You forgot the GeEventAdd() at the end. This tells C4D that the document has changed.
    2. No, the order isn't important as long as you create both points and polygons before you call MSG_UPDATE. But it is often more logical to start with the points.
    3. No, but that's easiest. Otherwise there's PolygonObject::ResizeObject().
    4. I guess this is because of 1.



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

    On 21/04/2003 at 04:23, xxxxxxxx wrote:

    1. I think, you have to use "po->Message(MSG_UPDATE);" instead of "doc->...".
    2. Yes. What's the problem with it?
    3. You may use po->ResizeObject(LONG pcntNew, LONG vcntNew) to add points and polys to an existing polygon object. (Don't forget the update message!).
    4. See 1.



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

    On 21/04/2003 at 08:55, xxxxxxxx wrote:

    thanks you both!
    the "po->Message(MSG_UPDATE);" instead of "doc->..." was the selection problem same as the EventAdd() Function.
    next i'll try to add a description resource/dialog to my polygon in the attrinute manager. I'll try it myself first, before i ask here again... but i think i will have to ask :-)



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

    On 22/04/2003 at 14:45, xxxxxxxx wrote:

    hi again with the next question:
    i made a dialog (Button and a field for the size of the poly) in the attribute editor...that works well...
    i want that every time i click on the button the first polygigon i created before will be deleted and a new on should be created (or overwritten by new points).
    i know that "po -> ResizeObject(4,1);" resizes an existing polygonobject. and the function " po->Free;" deletes a object. but for that ill have to select the old polygon and change or delete it, because everytime i click on my button a new polygonobject will be created....
    here the existing code:
    BaseObject  *op  = (BaseObject* )node;
     PolygonObject *po=NULL;
     Vector  *padr=NULL;
     Polygon  *vadr=NULL;
     po = PolygonObject::Alloc(4,1);
                             //po -> ResizeObject(4,1);   changes the poly and pointcount
     po-> SetName ("My Polygon");
     vadr = po->GetPolygon();
     padr = po->GetPoint();
     BaseContainer *data = op->GetDataInstance();
     Real size;
     size = data->GetReal(ATOMOBJECT_CRAD);
     padr[0] = Vector(size,0,0);
     padr[1] = Vector(size,size,0);
     padr[2] = Vector(0,size,0);
     padr[3] = Vector(0,0,0);
     vadr[0] = Polygon(0,1,2,3);
     po->Message(MSG_UPDATE);
     po->InsertUnder(op); 
                                 //po->Free; deletes a object
     EventAdd(EVENT_FORCEREDRAW);
     return TRUE;



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

    On 23/04/2003 at 03:33, xxxxxxxx wrote:

    nobody a idea to access a polygon (that is not selected) to delete ?
    the only thing i am able to delete is the whole generator object which contains the dialog. the polygon is createtd as a child of the generator....
    everytime i click on the button a new polygon child is createtd... thats wrong...



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

    On 23/04/2003 at 08:36, xxxxxxxx wrote:

    ok ... i managed it ...


Log in to reply