How To use DrawPolygonObject ?



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

    On 10/01/2010 at 07:27, xxxxxxxx wrote:

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

    ---------
    Hi,

    i want to draw different types of Objects in the viewport as a visual aid for my tool plugin.

    So inside my Draw() Function I execute this code:

      
    // create test object   
    BaseObject* pObj = BaseObject::Alloc(Osphere);   
    pObj->GetDataInstance()->SetReal(PRIM_SPHERE_RAD,width*0.5);   
    // draw it   
    if(pObj){                                           
         PolygonObject* pp = ToPoly(pObj);   
         if(pp) bd->DrawPolygonObject(bh,pp,0);                       
         BaseObject::Free(pObj);   
    }   
    

    but for some reason the object is not drawn.
    The Object is free'd to prevent mem-leaks. If i dont free it, it is still not drawn.

    Am I missing something here ?

    thanks,
    Daniel



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

    On 11/01/2010 at 03:35, xxxxxxxx wrote:

    The problem in your code is that you allocate a Generator object, the sphere. This has not yet be processed by the drawing pipeline, no caches are being build yet. I recommend to use the GeneratePrimitive() function instead of BaseObject::Alloc(). You can cast this directly into a polygon object.

    Example:

      
    Bool LookAtCamera::Draw(PluginTag *tag, BaseObject *op, BaseDraw *bd, BaseDrawHelp *bh)  
    {  
      PolygonObject* sphere = NULL;  
      sphere = (PolygonObject* )GeneratePrimitive(bh->GetDocument(), Osphere, BaseContainer(), 1.0, FALSE, NULL);  
      if (!sphere) return FALSE;  
      
      bd->DrawPolygonObject(bh, sphere, 0);  
      
      PolygonObject::Free(sphere);  
      
      return TRUE;  
    }  
    

    cheers,
    Matthias



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

    On 11/01/2010 at 04:08, xxxxxxxx wrote:

    aah ok, I wasn't aware of this.
    Thank you Matthias, it works perfectly now with GeneratePrimitive().

    greetings,
    Daniel



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

    On 19/03/2010 at 10:51, xxxxxxxx wrote:

    i have a question related to this topic,
    in my plugin i have an atomarray with some polygon object in it, i clone all object of this array and i append this in another atom array.
    now i'dd like to draw the cloned object with some tranformation via modeling lib, but not is drawed on the screen..

    any idea ?
    Franz



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

    On 06/06/2012 at 19:08, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    The problem in your code is that you allocate a Generator object, the sphere. This has not yet be processed by the drawing pipeline, no caches are being build yet. I recommend to use the GeneratePrimitive() function instead of BaseObject::Alloc(). You can cast this directly into a polygon object.

    Hi Matthias,

    I also tried your suggestion in one of my projects but I have a problem with it!

    My test code (for R12), based on your example, looks like this:

      
    DRAWRESULT BaseDrawTest::Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh)   
    {   
         if (drawpass==DRAWPASS_OBJECT)   
         {   
              PolygonObject* sphere = NULL;   
              sphere = (PolygonObject* )GeneratePrimitive(bh->GetDocument(), Osphere, BaseContainer(), 1.0, FALSE, NULL);   
              if (!sphere)     return DRAWRESULT_SKIP;   
              bd->DrawPolygonObject(bh, sphere, DRAWOBJECT_0, op, NULL);   
              PolygonObject::Free(sphere);   
         }   
         return DRAWRESULT_OK;   
    }   
    

    Unfortunately, C4D crashes from the:

    PolygonObject::Free(sphere);
    

    Without it, it works but I have memory leaks of course!

    Edit:
    I don't know, why my code is shown with interlines here in this post.



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

    On 06/06/2012 at 20:35, xxxxxxxx wrote:

    I allocate draw objects at the Init() of my plugin and free at Free() of my plugin.  While they exist for the entire existence of my plugin (or Cinema 4D session), they never need to be allocated/freed in the Draw() method.



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

    On 06/06/2012 at 20:51, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    I allocate draw objects at the Init() of my plugin and free at Free() of my plugin.  While they exist for the entire existence of my plugin (or Cinema 4D session), they never need to be allocated/freed in the Draw() method.

    Yes, that makes perfect sence. I was just confused by Matthias example!
    Thank you Robert.

    Kind regards,
    Tom



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

    On 07/06/2012 at 09:22, xxxxxxxx wrote:

    Can you possibly explain how you do that Robert?

    All of the SDK examples use global functions to create the objects. And I'd like to try out your method.
    But when I try to create the objects inside of the Init() method. I of course, run into scope problems.
    I don't know how you are able to Draw() an object that was created inside of the Init() method.

    -ScottA



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

    On 07/06/2012 at 16:14, xxxxxxxx wrote:

    Declare a member of your class as a pointer to the object and use that to extend the scope to the entire class and its methods.

      
    MyClass  
    {  
     ...  
    PolygonObject*  drawObj;  
    }  
      
    MyClass::MyClass()  
    {  
    drawObj = NULL;  
    }  
      
    MyClass::Init()  
    {  
    // Whatever you are using to allocate the object  
    drawObj = PolygonObject();  
    }  
      
    MyClass::Free()  
    {  
    PolygonObject::Free(drawObj);  
    }
    


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

    On 07/06/2012 at 16:14, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Can you possibly explain how you do that Robert?

    I second that request!

    Originally posted by xxxxxxxx

    All of the SDK examples use global functions to create the objects. And I'd like to try out your method.But when I try to create the objects inside of the Init() method. I of course, run into scope problems.I don't know how you are able to Draw() an object that was created inside of the Init() method.-ScottA

    To declare the PolygonObject in the class declaration works, but I guess that's not a very good place for it.

    I'd really like to come to know where the best place for that would be.
    And how to do it the right way.

    Here is my example code so far:

      
    /////////////////////////////////////////////////////////////   
    // basedrawtest.cpp                                        //   
    /////////////////////////////////////////////////////////////   
      
    #include "c4d.h"   
    #include "c4d_symbols.h"   
    #include "obasedrawtest.h"   
      
      
    /////////////////////////////////////////////////////////   
    // Class functions   
    /////////////////////////////////////////////////////////   
      
    class BaseDrawTest : public ObjectData   
    {   
         INSTANCEOF(BaseDrawTest, ObjectData)   
      
         public:   
              virtual Bool Init(GeListNode* node);   
              virtual void Free(GeListNode* node);   
      
              virtual EXECUTIONRESULT Execute(BaseObject* op, BaseDocument* doc, BaseThread* bt, LONG priority, EXECUTIONFLAGS flags);   
              virtual DRAWRESULT Draw(BaseObject* op, DRAWPASS drawpass, BaseDraw* bd, BaseDrawHelp* bh);   
      
              static NodeData *Alloc(void) { return gNew BaseDrawTest; }   
      
      
              PolygonObject* sphere;   
    };   
      
      
    Bool BaseDrawTest::Init(GeListNode *node)   
    {   
         sphere = (PolygonObject* )GeneratePrimitive(node->GetDocument(), Osphere, BaseContainer(), 1.0, FALSE, NULL);   
      
         return TRUE;   
    }   
      
      
    void BaseDrawTest::Free(GeListNode* node)   
    {   
        PolygonObject::Free(sphere);   
    }   
      
      
    EXECUTIONRESULT BaseDrawTest::Execute(BaseObject* op, BaseDocument* doc, BaseThread* bt, LONG priority, EXECUTIONFLAGS flags)   
    {   
         return EXECUTIONRESULT_OK;   
    }   
      
      
    DRAWRESULT BaseDrawTest::Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh)   
    {   
         if (drawpass==DRAWPASS_OBJECT)   
         {   
              if (!sphere)     return DRAWRESULT_SKIP;   
                 
              bd->DrawPolygonObject(bh, sphere, DRAWOBJECT_0, op, NULL);   
         }   
            
         return DRAWRESULT_OK;   
    }   
      
      
      
    /////////////////////////////////////////////////////////   
    // Register function   
    /////////////////////////////////////////////////////////   
      
    Bool RegisterBaseDrawTest(void)   
    {   
         // decide by name if the plugin shall be registered - just for user convenience   
         String name = GeLoadString(IDS_BASEDRAWTEST); if (!name.Content()) return TRUE;   
    #if API_VERSION < 12000   
         return RegisterObjectPlugin(ID_BASEDRAWTEST,name,OBJECT_USECACHECOLOR,BaseDrawTest::Alloc,"Obasedrawtest","icon.tif",0);   
    #else   
         return RegisterObjectPlugin(ID_BASEDRAWTEST,name,OBJECT_USECACHECOLOR,BaseDrawTest::Alloc,"Obasedrawtest",AutoBitmap("icon.tif"),0);   
    #endif   
    }   
      
    


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

    On 07/06/2012 at 16:24, xxxxxxxx wrote:

    It is perfectly good practice to include member variables in your class declaration.  This extends the variable's scope to the class level and as long as a class instance exists.  Since it is only a pointer, it only uses the space required to store the memory address (32-bits or 64-bits - 4 or 8 bytes).  You can declare it in the private: section if you want to disallow direct access to it from another class/method - this is usually only necessary if you expect external access (such as when developing a static/dynamic library or library code used by third parties).

    The global scope is not the best place to declare these things in C++ and is more of a holdover from the old procedural connections to C.  Global variables are stored in the data segment (which could be heap or stack but most likely the stack).  If it ends up on the stack, which is a fixed size, and you use many of them, you may find your stack running out of memory since it also stores the method traceback, method arguments, and local variables within methods.



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

    On 07/06/2012 at 16:33, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    It is perfectly good practice to include member variables in your class declaration.  This extends the variable's scope to the class level and as long as a class instance exists.  Since it is only a pointer, it only uses the space required to store the memory address (32-bits or 64-bits - 4 or 8 bytes).  You can declare it in the private: section if you want to disallow direct access to it from another class/method - this is usually only necessary if you expect external access (such as when developing a static or dynamic library or library used by third parties).The global scope is not the best place to declare these things in C++ and is more of a holdover from the old procedural connections to C.

    Okay, thank you for the clarification, Robert.

    Then I'll do it that way (but private ) if nobody else lay good reasons against it.

    Kind regards,
    Tom



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

    On 07/06/2012 at 17:10, xxxxxxxx wrote:

    Thanks for the clarification.
    When you said you create your objects in the Init() method. I didn't know that you were also using a class member variable with it.

    I was wondering how the heck you were creating something completely brand new in one method. And then pointing to it from another method. Without using a global, or class member variable, that they could both use to communicate with each other.
    I thought I was about to learn a clever new trick on making two methods talk to each other.🙂

    -ScottA



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

    On 08/06/2012 at 08:57, xxxxxxxx wrote:

    Okay, next problem:

    How can I access the BaseContainer() of a BaseObject() created this way to manipulate it?

    Neither the SetParameter/GetParameter nor the GetDataInstance method seems to work!

    I can fill the base container with parameters and pass it to the object with GeneratePrimitive() but how can I change them afterwards?

    I'm confused.

      
    /////////////////////////////////////////////////////////////   
    // CINEMA 4D BaseDrawTest                                  //   
    /////////////////////////////////////////////////////////////   
    // (c) 2012 Thomas Chen, all rights reserved               //   
    /////////////////////////////////////////////////////////////   
    // basedrawtest.cpp                                        //   
    /////////////////////////////////////////////////////////////   
      
    #include "c4d.h"   
    #include "c4d_symbols.h"   
    #include "obasedrawtest.h"   
      
      
    #if API_VERSION < 12000   
    #define EXECUTIONRESULT          LONG   
    #define EXECUTIONFLAGS          LONG   
    #define EXECUTIONRESULT_OK     EXECUTION_RESULT_OK   
      
    #define DRAWRESULT               Bool   
    #define DRAWPASS               LONG   
    #define DRAWRESULT_OK          TRUE   
    #endif   
      
      
    /////////////////////////////////////////////////////////   
    // Class functions   
    /////////////////////////////////////////////////////////   
      
    class BaseDrawTest : public ObjectData   
    {   
         INSTANCEOF(BaseDrawTest, ObjectData)   
      
         public:   
              virtual Bool Init(GeListNode* node);   
              virtual void Free(GeListNode* node);   
      
              virtual EXECUTIONRESULT Execute(BaseObject* op, BaseDocument* doc, BaseThread* bt, LONG priority, EXECUTIONFLAGS flags);   
              virtual DRAWRESULT Draw(BaseObject* op, DRAWPASS drawpass, BaseDraw* bd, BaseDrawHelp* bh);   
      
              static NodeData *Alloc(void) { return gNew BaseDrawTest; }   
      
         private:   
              BaseObject* plane;   
    };   
      
      
    Bool BaseDrawTest::Init(GeListNode *node)   
    {   
         //plane: GeneratePrimitive(), Osinglepoly   
         BaseContainer bc_plane;   
         bc_plane.SetReal(PRIM_POLY_WIDTH, 200.0);   
         bc_plane.SetReal(PRIM_POLY_HEIGHT, 200.0);   
         bc_plane.SetLong(PRIM_POLY_SUB, 1);   
         bc_plane.SetBool(PRIM_POLY_TRIANG, FALSE);   
         bc_plane.SetLong(PRIM_AXIS, PRIM_AXIS_ZN);   
      
         plane = (BaseObject* )GeneratePrimitive(node->GetDocument(), Osinglepoly, bc_plane, 1.0, FALSE, NULL);   
      
         return TRUE;   
    }   
      
      
    void BaseDrawTest::Free(GeListNode* node)   
    {   
        BaseObject::Free(plane);   
    }   
      
      
    EXECUTIONRESULT BaseDrawTest::Execute(BaseObject* op, BaseDocument* doc, BaseThread* bt, LONG priority, EXECUTIONFLAGS flags)   
    {   
         return EXECUTIONRESULT_OK;   
    }   
      
      
    DRAWRESULT BaseDrawTest::Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh)   
    {   
         if (drawpass==DRAWPASS_OBJECT)   
         {   
              const Matrix &m; = bh->GetMg();   
      
              //pplane: DrawPolygonObject(), Osinglepoly   
              if (plane)   
              {   
      
                   plane->SetParameter(DescID(PRIM_POLY_WIDTH), GeData(1000.0), DESCFLAGS_SET_0);          //<--- Doesn't work!   
      
      
                   BaseContainer *bc = plane->GetDataInstance();                                           //<--- Doesn't work either!   
                   bc->SetReal(PRIM_POLY_HEIGHT,1000.0);                                                  //<--- Doesn't work either!   
      
      
                   plane->SetMg(m);                                                                       //<--- Okay, that works of course! ;o)   
      
                   bd->DrawPolygonObject(bh, plane, DRAWOBJECT_XRAY_ON, op, NULL);   
              }   
         }   
      
         return DRAWRESULT_OK;   
    }   
      
      
    /////////////////////////////////////////////////////////   
    // Register function   
    /////////////////////////////////////////////////////////   
      
    Bool RegisterBaseDrawTest(void)   
    {   
         // decide by name if the plugin shall be registered - just for user convenience   
         String name = GeLoadString(IDS_BASEDRAWTEST); if (!name.Content()) return TRUE;   
    #if API_VERSION < 12000   
         return RegisterObjectPlugin(ID_BASEDRAWTEST,name,OBJECT_USECACHECOLOR,BaseDrawTest::Alloc,"Obasedrawtest","icon.tif",0);   
    #else   
         return RegisterObjectPlugin(ID_BASEDRAWTEST,name,OBJECT_USECACHECOLOR,BaseDrawTest::Alloc,"Obasedrawtest",AutoBitmap("icon.tif"),0);   
    #endif   
    }   
      
    


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

    On 08/06/2012 at 13:30, xxxxxxxx wrote:

    There's an object example plugin on Steve's(microbian) website called Diamond Object:http://www.microbion.co.uk/graphics/c4d/create_plugins6.htm

    What's nice about it is that it's got everything tucked inside of the object class(no globals).
    And it even uses an .h file to declare the class, member variables, and member methods.
    It's a true OOP example of creating an object with the ObjectData class. Which is what you're doing.

    You should be able to replace his diamond vectors code with your sphere code.
    It might help you figure things out.

    -ScottA



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

    On 08/06/2012 at 15:41, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    There's an object example plugin on Steve's(microbian) website called Diamond Object:http://www.microbion.co.uk/graphics/c4d/create_plugins6.htmWhat's nice about it is that it's got everything tucked inside of the object class(no globals).And it even uses an .h file to declare the class, member variables, and member methods.It's a true OOP example of creating an object with the ObjectData class. Which is what you're doing.You should be able to replace his diamond vectors code with your sphere code. It might help you figure things out.-ScottA

    I know this tutorial, thank you anyway, but there he uses GetVirtualObjects() and with that, things are handled different to Draw() (at least I think so).

    I did it with GetVirtualObjects() myself before and I know how to use it, but I didn't want to create a real editable polygon object that appear in the object manager but a visual helper that is just drawn in the editor for an object Plugin.

    In GetVirtualObjects() I did it with

      
    BaseObject* plane = BaseObject::Alloc(Osinglepoly);   
    

    But, as far as I remember, that doesn't work in Draw().

    By the way, in fact I don't need a sphere but an "Osinglepoly" but that's just a side note.



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

    On 08/06/2012 at 19:21, xxxxxxxx wrote:

    Here's an altered version of your code that will generate a sphere object. But not create any actual geometry object in the OM(just the generator object itself).
    It has one attribute to control the scale of it when the users changes it in the AM:

    #include "c4d.h"  
    #include "c4d_symbols.h"  
    #include "myObject.h"  
      
    // be sure to use a unique ID obtained from www.plugincafe.com  
    #define PLUGIN_ID 1000007  
      
    class MyObject : public ObjectData  
    {  
      public:  
      
          virtual Bool Init               (GeListNode *node);  
          virtual DRAWRESULT Draw         (BaseObject *op, DRAWPASS type, BaseDraw *bd, BaseDrawHelp *bh);  
          virtual EXECUTIONRESULT       Execute(BaseObject *op,   
      
          BaseDocument *doc, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags);  
      
          static NodeData *Alloc(void) { return gNew MyObject; }  
      
    private:  
      
          BaseObject *sphere;  
      
    };  
      
    Bool MyObject::Init(GeListNode *node)  
    {  
      BaseObject    *op   = (BaseObject* )node;  
      BaseContainer *bc = op->GetDataInstance();  
      bc->SetReal(POLY_SCALE, 1.0);     //A gui attribute to change the size of the sphere  
      
      sphere = (BaseObject* )GeneratePrimitive(node->GetDocument(), Osphere, BaseContainer(), 1.0, FALSE, NULL);  
      
      return TRUE;  
    }  
      
    DRAWRESULT MyObject::Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh)  
    {  
       if(drawpass==DRAWPASS_OBJECT)  
       {  
         const Matrix &m = bh->GetMg();  
      
         BaseContainer *data = op->GetDataInstance();  
         Real  s = data->GetReal(POLY_SCALE);  
         op->SetAbsScale(s);  
      
         sphere->SetMg(m);  
      
         bd->DrawPolygonObject(bh, sphere, DRAWOBJECT_XRAY_ON, op, NULL);  
       }  
      
      return DRAWRESULT_OK;  
    }  
      
    EXECUTIONRESULT MyObject::Execute(BaseObject *op, BaseDocument *doc, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags)  
    {  
      return EXECUTIONRESULT_OK;  
    }  
      
      
    Bool RegisterMyObject(void)  
    {  
      return RegisterObjectPlugin(PLUGIN_ID, GeLoadString(IDS_MYOBJECT), OBJECT_GENERATOR|OBJECT_ISSPLINE|OBJECT_CALL_ADDEXECUTION, MyObject::Alloc, "MyObject", AutoBitmap("MyIcon.tif"), 0);  
    }
    

    First you said you were making a tool plugin..Then you posted generator plugin code(ObjectData class).
    So I have to admit I'm a bit confused about what your end goal is.

    -ScottA



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

    On 08/06/2012 at 19:51, xxxxxxxx wrote:

    Hi Scott,

    first, thank you for your efforts trying to help me.

    Originally posted by xxxxxxxx

    Here's an altered version of your code that will generate a sphere object. But not create any actual geometry object in the OM(just the generator object itself).It has one attribute to control the scale of it when the users changes it in the AM:

    Unfortunately I can find nothing new to me in your code example and SetAbsScale() doesn't help me at all.
    That belongs to the same category as the SetMg() I used but has nothing to do with the BaseContainer() of the sphere (or plane, in my case)!

    What I need is access to PRIM_POLY_WIDTH, PRIM_POLY_HEIGHT, PRIM_POLY_SUB and PRIM_POLY_TRIANG of the "Osinglepoly".

    Okay, the last one is less important, I predefine it as quad and it needn't be changeable.

    Isn't it possible to use the BaseContainer() of an (with GeneratePrimitive() created) object in this context?

    Originally posted by xxxxxxxx

    First you said you were making a tool plugin...

    Where did I say that?

    Kind regards,
    Tom



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

    On 08/06/2012 at 20:48, xxxxxxxx wrote:

    Sorry. My Bad.
    I got you confused with cineast2008.
    Maybe I'm being dense(again 😉). But what you're asking for doesn't make sense to me.
    It's true that a polygon primitive does have these attributes:

    enum  
    {  
      PRIM_POLY_WIDTH    = 1270, // REAL   
      PRIM_POLY_HEIGHT   = 1271, // REAL  
      PRIM_POLY_SUB      = 1272, // LONG  
      PRIM_POLY_TRIANG   = 1273 // BOOL  
    };
    

    But when you cast(convert) a primitive to a polygon object like this:

    plane = (BaseObject* )GeneratePrimitive(node->GetDocument(), Osinglepoly, bc_plane, 1.0, FALSE, NULL);
    

    You loose those primitive based attributes in the conversion. They aren't available any more because the object is now a polygon based object.
    At that point you have to grab the points, polygons, and edges and work with them manually.

    -ScottA



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

    On 08/06/2012 at 22:48, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Sorry. My Bad.I got you confused with cineast2008.

    No problem!   

    Originally posted by xxxxxxxx

    Maybe I'm being dense(again 😉). But what you're asking for doesn't make sense to me.It's true that a polygon primitive does have these attributes:
    But when you cast(convert) a primitive to a polygon object like this:

    plane = (BaseObject* )GeneratePrimitive(node->GetDocument(), Osinglepoly, bc_plane, 1.0, FALSE, NULL);
    

    You loose those primitive based attributes in the conversion. They aren't available any more because the object is now a polygon based object.At that point you have to grab the points, polygons, and edges and work with them manually.-ScottA

    Okay, of course that explains why it can't work!

    I didn't know, that GeneratePrimitive() in fact converts the primitive to an editable polygon object. I didn't find a word about that in the SDK doku or at least I didn't realize it.

    Then maybe I have to go back to use GetVirtualObjects() again for my intention, although I thought that's the wrong place for that kind of things.

    Or is there another way to use base objects in there parametric form inside Draw()?

    Kind regards,
    Tom


Log in to reply