Polygon Plane



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

    On 06/03/2010 at 20:13, xxxxxxxx wrote:

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

    ---------
    Hey everyone,

    Could anyone tell me the process involved in creating a polygon plane object from scratch?  Or point toward something that can guide me through this process.

    Thanks,

    ~Shawn



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

    On 08/03/2010 at 09:41, xxxxxxxx wrote:

    Anyone have any info about this.  I want to know how to create a plane from scratch.  Not creating a plane primitive, but creating a polygon object and adjusting its points and polygons to create a plane.  Is there something that could point me in the right direction.  I checked out the rounded tube sample in the SDK but I do not see where the geometry is created.

    Thanks,

    ~Shawn



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

    On 08/03/2010 at 12:22, xxxxxxxx wrote:

    Hi, this little example will create a quad with the given coordinates:

      
    BaseObject *drawPlane::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh)   
    {   
         PolygonObject *obj = NULL;   
         Vector *padr=NULL;   
         CPolygon *vadr=NULL;   
         obj = PolygonObject::Alloc(4,1);   
         if (!obj) goto Error;   
         padr=obj->GetPointW();   
         vadr=obj->GetPolygonW();   
         padr[0] = Vector(-100,0,-100);   
         padr[1] = Vector(-100,0,100);   
         padr[2] = Vector(100,0,100);   
         padr[3] = Vector(100,0,-100);   
         vadr[0] = CPolygon(0,1,2,3);   
         return obj;   
    Error:   
         return NULL;   
    }   
    

    hope it helps..
    cheers,
    ello



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

    On 08/03/2010 at 12:33, xxxxxxxx wrote:

    Great, thanks ello.    I want to be able to control the number of polys on the plane so I would do this by creating more polys like this?

    Thanks again.

    ~Shawn



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

    On 08/03/2010 at 13:29, xxxxxxxx wrote:

    yes, you just need to allocate the PolygonObject corresponding to that number, or you adjust it later on with ResizeObject(LONG pcnt, LONG vcnt)

    cheers,
    ello



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

    On 08/03/2010 at 15:18, xxxxxxxx wrote:

    Hi ello,   I copied and pasted your code in to my object plugin just to see how it works and I get nothing.  No polygon is created.  Any thoughts as yo why this is?

    Thanks,

    ~Shawn



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

    On 08/03/2010 at 23:15, xxxxxxxx wrote:

    hm. it worked at home. i'll give it another try here at work when i have a break...



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

    On 08/03/2010 at 23:33, xxxxxxxx wrote:

    ok, it works here, too.

    here is my whole code:

      
    #define pluginID 1000001   
    #include "c4d.h"   
    #include "c4d_symbols.h"   
    #include "customgui_description.h"   
      
    #define pluginName "testObj"   
      
    class testObj : public ObjectData   
    {        
         INSTANCEOF(testObj,ObjectData);   
    public:   
         virtual Bool Init(GeListNode *node);   
         virtual BaseObject* GetVirtualObjects(PluginObject *op, HierarchyHelp *hh);   
         virtual Bool Message(GeListNode *node, LONG type, void *t_data);   
         static NodeData *Alloc(void) { return gNew testObj; }   
    };   
      
      
      
    Bool testObj::Init(GeListNode *node)   
    {   
         BaseObject          *op          = (BaseObject* )node;   
         BaseContainer *data = op->GetDataInstance();   
      
         return TRUE;   
    }   
      
    Bool testObj::Message(GeListNode *node, LONG type, void *t_data)   
    {   
         if (type==MSG_DESCRIPTION_VALIDATE)   
         {   
              BaseContainer *data = ((BaseObject* )node)->GetDataInstance();   
         }   
         return TRUE;   
    }   
      
    BaseObject *testObj::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh)   
    {   
         PolygonObject *obj = NULL;   
         Vector *padr=NULL;   
         CPolygon *vadr=NULL;   
         obj = PolygonObject::Alloc(4,1);   
         if (!obj) goto Error;   
         padr=obj->GetPointW();   
         vadr=obj->GetPolygonW();   
         padr[0] = Vector(-100,0,-100);   
         padr[1] = Vector(-100,0,100);   
         padr[2] = Vector(100,0,100);   
         padr[3] = Vector(100,0,-100);   
         vadr[0] = CPolygon(0,1,2,3);   
         return obj;   
    Error:   
         return NULL;   
    }   
      
      
      
    Bool Register_testObj(void)   
    {   
         return RegisterObjectPlugin(pluginID,pluginName,OBJECT_GENERATOR|OBJECT_INPUT,testObj::Alloc,"OtestObj","testObj.tif",0);   
    }   
    

    hope it works for you..


Log in to reply