Here you will find documentation on all the descriptions that Cinema 4D currently has. You can list them Alphabetically, by Type or Plugin . The sample Python and C++ code is automatically generated and in some cases may not be 100% correct. If something doesn't work then please refer to the official Cinema 4D SDK documentation for more information.

IDs and information for MGpoly

MGpoly

Attributes

  • ENGLISH NAME : PolygonObjectClone
  • NAME : MGpoly
  • INCLUDE : Obase
  • PATH : mograph/description/mgpoly.res
  • PLUGIN : mograph
  • MAXON online help (may not exist): MGPOLY

Elements

ID UI Name Type Parameters Cycle
MG_POLY_UPVECTOR UpVector LONG  
MG_POLY_UPVECTOR_NONE None
MG_POLY_UPVECTOR_XP X+
MG_POLY_UPVECTOR_XN X-
MG_POLY_UPVECTOR_YP Y+
MG_POLY_UPVECTOR_YN Y-
MG_POLY_UPVECTOR_ZP Z+
MG_POLY_UPVECTOR_ZN Z-
MG_POLY_MODE_ Distribution LONG  
MG_POLY_MODE_VERTEX Vertex
MG_POLY_MODE_EDGE Edge
MG_POLY_MODE_POLY PolygonCenter
MG_POLY_MODE_SURFACE Surface
MG_POLY_MODE_VOLUME Volume
MG_POLY_MODE_AXIS Axis
MG_POLY_SELECTION Selection STRING SCALE_H
MG_POLY_SELECTION_ACTIVE Enable BOOL  
MG_POLY_LIVE_RESTRICT RestricttoLiveSelection BOOL  
MG_POLY_SCALEONPOLY EnableScaling BOOL PARENTCOLLAPSE
MG_POLY_SCALEONPOLY_AMOUNT Scale REAL
SCALE_H
UNIT PERCENT
MINSLIDER 0.0
MAXSLIDER 200.0
STEP 1.0
CUSTOMGUI REALSLIDER
MG_POLY_SCALEONPOLY_SPLINE ScaleSpline SPLINE
SCALE_H
PARENTCOLLAPSE MG_POLY_SCALEONPOLY

Example Code

The following code does not use the correct values when setting the data. You should check directly in C4D for the correct values that you should use in place of the ones that are shown. This code is just to show you how to access the values for getting and setting the parameters.

Python

import c4d
from c4d import gui
def main():
    obj = c4d.BaseObject(c4d.MGpoly)
    doc.InsertObject(obj)
    c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
    
    #You can set parameters two different ways. 
    #First way              
    obj[c4d.MG_POLY_UPVECTOR] = c4d.MG_POLY_UPVECTOR_NONE
    obj[c4d.MG_POLY_MODE_] = c4d.MG_POLY_MODE_VERTEX
    obj[c4d.MG_POLY_SELECTION] = "Hello World"
    obj[c4d.MG_POLY_SELECTION_ACTIVE] = True
    obj[c4d.MG_POLY_LIVE_RESTRICT] = True
    obj[c4d.MG_POLY_SCALEONPOLY] = True
    obj[c4d.MG_POLY_SCALEONPOLY_AMOUNT] = 0.1
    
    #Second way, using the base container.
    bc = obj.GetDataInstance()
    bc.SetInt32(c4d.MG_POLY_UPVECTOR,c4d.MG_POLY_UPVECTOR_NONE)
    bc.SetInt32(c4d.MG_POLY_MODE_,c4d.MG_POLY_MODE_VERTEX)
    bc.SetString(c4d.MG_POLY_SELECTION,"Hello World")
    bc.SetBool(c4d.MG_POLY_SELECTION_ACTIVE,True)
    bc.SetBool(c4d.MG_POLY_LIVE_RESTRICT,True)
    bc.SetBool(c4d.MG_POLY_SCALEONPOLY,True)
    bc.SetFloat(c4d.MG_POLY_SCALEONPOLY_AMOUNT,0.1)

if __name__=='__main__':
    main()
             

C++

#include "c4d.h"
#include "../mograph/description/mgpoly.h"
void SampleFunction()
{
    BaseDocument *pDoc = GetActiveDocument();
    BaseObject *pObject = BaseObject::Alloc(MGpoly);
    pDoc->InsertObject(pObject);
    pDoc->StartUndo();
    pDoc->AddUndo(UNDO_NEW,pObject);
    pDoc->EndUndo();
    EventAdd(EVENT_FORCEREDRAW);
    
    //You can set parameters two different ways. 

    //First way              
    //Some objects do not store all their data in the container. You need to use GetParameter()/SetParameter() instead. 

    DESCFLAGS_SET flags = DESCFLAGS_SET_PARAM_SET;
    pObject->SetParameter(DescID(MG_POLY_UPVECTOR),GeData(MG_POLY_UPVECTOR_NONE),flags);
    pObject->SetParameter(DescID(MG_POLY_MODE_),GeData(MG_POLY_MODE_VERTEX),flags);
    pObject->SetParameter(DescID(MG_POLY_SELECTION),GeData("Hello World"),flags);
    pObject->SetParameter(DescID(MG_POLY_SELECTION_ACTIVE),GeData(true),flags);
    pObject->SetParameter(DescID(MG_POLY_LIVE_RESTRICT),GeData(true),flags);
    pObject->SetParameter(DescID(MG_POLY_SCALEONPOLY),GeData(true),flags);
    pObject->SetParameter(DescID(MG_POLY_SCALEONPOLY_AMOUNT),GeData(0.1),flags);
    pObject->Message(MSG_UPDATE);            

    //Second way, using the base container.
    BaseContainer *bc =     pObject->GetDataInstance();
    bc->SetInt32(MG_POLY_UPVECTOR,MG_POLY_UPVECTOR_NONE);
    bc->SetInt32(MG_POLY_MODE_,MG_POLY_MODE_VERTEX);
    bc->SetString(MG_POLY_SELECTION,"Hello World");
    bc->SetBool(MG_POLY_SELECTION_ACTIVE,true);
    bc->SetBool(MG_POLY_LIVE_RESTRICT,true);
    bc->SetBool(MG_POLY_SCALEONPOLY,true);
    bc->SetFloat(MG_POLY_SCALEONPOLY_AMOUNT,0.1);
    pObject->Message(MSG_UPDATE);                                                      
}