Oxpgenerator
Attributes
-
ENGLISH NAME : X-ParticlesGeneratorObject
-
NAME : Oxpgenerator
-
INCLUDE : Obase
-
PATH : res/description/oxpgenerator.res
-
PLUGIN : X-Particles
-
MAXON online help (may not exist): OXPGENERATOR
Elements
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.Oxpgenerator)
doc.InsertObject(obj)
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
#You can set parameters two different ways.
#First way
obj[c4d.XGEN_GENERATE_OBJECTS] = True
obj[c4d.XGEN_MULTI_OBJ] = c4d.XGEN_MULTI_SEQ
obj[c4d.XGEN_MULTI_SELECT] = 1
obj[c4d.XGEN_MULTI_RANSEED] = 1
obj[c4d.XGEN_INSTANCES] = c4d.XGEN_INSTANCES_CLONE
obj[c4d.XGEN_DRAWMODE] = c4d.XGEN_DRAWMODE_GEOM
obj[c4d.XGEN_ANIMATE] = True
obj[c4d.XGEN_ANIMATE_SCALE] = 0.1
obj[c4d.XGEN_ANIMATE_SCALE_VAR] = 0.1
obj[c4d.XGEN_ANIMATE_OFFSET_RANDOM] = True
obj[c4d.XGEN_OBJECT_OFFSET] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.XGEN_OBJECT_OFFSET_VAR] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.XGEN_SCALEMODE] = c4d.XGEN_SCALEMODE_PSCALE
obj[c4d.XGEN_OBJECT_SCALE] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.XGEN_OBJECT_SCALE_VAR] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.XGEN_ROTMODE] = c4d.XGEN_ROTMODE_PARTICLE
obj[c4d.XGEN_OBJECT_ROT] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.XGEN_OBJECT_ROT_VAR] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.XGEN_MORPH_ENABLE] = True
obj[c4d.XGEN_MORPH_INDEX] = 1
obj[c4d.XGEN_MORPH_MAX] = 0.1
obj[c4d.XGEN_MORPH_MAX_VAR] = 0.1
obj[c4d.XGEN_CACHEINFO_CACHEDELEMENTS] = 1
#Second way, using the base container.
bc = obj.GetDataInstance()
bc.SetBool(c4d.XGEN_GENERATE_OBJECTS,True)
bc.SetInt32(c4d.XGEN_MULTI_OBJ,c4d.XGEN_MULTI_SEQ)
bc.SetInt32(c4d.XGEN_MULTI_SELECT,1)
bc.SetInt32(c4d.XGEN_MULTI_RANSEED,1)
bc.SetInt32(c4d.XGEN_INSTANCES,c4d.XGEN_INSTANCES_CLONE)
bc.SetInt32(c4d.XGEN_DRAWMODE,c4d.XGEN_DRAWMODE_GEOM)
bc.SetBool(c4d.XGEN_ANIMATE,True)
bc.SetFloat(c4d.XGEN_ANIMATE_SCALE,0.1)
bc.SetFloat(c4d.XGEN_ANIMATE_SCALE_VAR,0.1)
bc.SetBool(c4d.XGEN_ANIMATE_OFFSET_RANDOM,True)
bc.SetVector(c4d.XGEN_OBJECT_OFFSET, c4d.Vector(1.0,1.0,1.0)
bc.SetVector(c4d.XGEN_OBJECT_OFFSET_VAR, c4d.Vector(1.0,1.0,1.0)
bc.SetInt32(c4d.XGEN_SCALEMODE,c4d.XGEN_SCALEMODE_PSCALE)
bc.SetVector(c4d.XGEN_OBJECT_SCALE, c4d.Vector(1.0,1.0,1.0)
bc.SetVector(c4d.XGEN_OBJECT_SCALE_VAR, c4d.Vector(1.0,1.0,1.0)
bc.SetInt32(c4d.XGEN_ROTMODE,c4d.XGEN_ROTMODE_PARTICLE)
bc.SetVector(c4d.XGEN_OBJECT_ROT, c4d.Vector(1.0,1.0,1.0)
bc.SetVector(c4d.XGEN_OBJECT_ROT_VAR, c4d.Vector(1.0,1.0,1.0)
bc.SetBool(c4d.XGEN_MORPH_ENABLE,True)
bc.SetInt32(c4d.XGEN_MORPH_INDEX,1)
bc.SetFloat(c4d.XGEN_MORPH_MAX,0.1)
bc.SetFloat(c4d.XGEN_MORPH_MAX_VAR,0.1)
bc.SetInt32(c4d.XGEN_CACHEINFO_CACHEDELEMENTS,1)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../res/description/oxpgenerator.h"
void SampleFunction()
{
BaseDocument *pDoc = GetActiveDocument();
BaseObject *pObject = BaseObject::Alloc(Oxpgenerator);
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(XGEN_GENERATE_OBJECTS),GeData(true),flags);
pObject->SetParameter(DescID(XGEN_MULTI_OBJ),GeData(XGEN_MULTI_SEQ),flags);
pObject->SetParameter(DescID(XGEN_MULTI_SELECT),GeData(1),flags);
pObject->SetParameter(DescID(XGEN_MULTI_RANSEED),GeData(1),flags);
pObject->SetParameter(DescID(XGEN_INSTANCES),GeData(XGEN_INSTANCES_CLONE),flags);
pObject->SetParameter(DescID(XGEN_DRAWMODE),GeData(XGEN_DRAWMODE_GEOM),flags);
pObject->SetParameter(DescID(XGEN_ANIMATE),GeData(true),flags);
pObject->SetParameter(DescID(XGEN_ANIMATE_SCALE),GeData(0.1),flags);
pObject->SetParameter(DescID(XGEN_ANIMATE_SCALE_VAR),GeData(0.1),flags);
pObject->SetParameter(DescID(XGEN_ANIMATE_OFFSET_RANDOM),GeData(true),flags);
pObject->SetParameter(DescID(XGEN_OBJECT_OFFSET),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(XGEN_OBJECT_OFFSET_VAR),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(XGEN_SCALEMODE),GeData(XGEN_SCALEMODE_PSCALE),flags);
pObject->SetParameter(DescID(XGEN_OBJECT_SCALE),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(XGEN_OBJECT_SCALE_VAR),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(XGEN_ROTMODE),GeData(XGEN_ROTMODE_PARTICLE),flags);
pObject->SetParameter(DescID(XGEN_OBJECT_ROT),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(XGEN_OBJECT_ROT_VAR),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(XGEN_MORPH_ENABLE),GeData(true),flags);
pObject->SetParameter(DescID(XGEN_MORPH_INDEX),GeData(1),flags);
pObject->SetParameter(DescID(XGEN_MORPH_MAX),GeData(0.1),flags);
pObject->SetParameter(DescID(XGEN_MORPH_MAX_VAR),GeData(0.1),flags);
pObject->SetParameter(DescID(XGEN_CACHEINFO_CACHEDELEMENTS),GeData(1),flags);
pObject->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pObject->GetDataInstance();
bc->SetBool(XGEN_GENERATE_OBJECTS,true);
bc->SetInt32(XGEN_MULTI_OBJ,XGEN_MULTI_SEQ);
bc->SetInt32(XGEN_MULTI_SELECT,1);
bc->SetInt32(XGEN_MULTI_RANSEED,1);
bc->SetInt32(XGEN_INSTANCES,XGEN_INSTANCES_CLONE);
bc->SetInt32(XGEN_DRAWMODE,XGEN_DRAWMODE_GEOM);
bc->SetBool(XGEN_ANIMATE,true);
bc->SetFloat(XGEN_ANIMATE_SCALE,0.1);
bc->SetFloat(XGEN_ANIMATE_SCALE_VAR,0.1);
bc->SetBool(XGEN_ANIMATE_OFFSET_RANDOM,true);
bc->SetVector(XGEN_OBJECT_OFFSET, c4d.Vector(1.0,1.0,1.0);
bc->SetVector(XGEN_OBJECT_OFFSET_VAR, c4d.Vector(1.0,1.0,1.0);
bc->SetInt32(XGEN_SCALEMODE,XGEN_SCALEMODE_PSCALE);
bc->SetVector(XGEN_OBJECT_SCALE, c4d.Vector(1.0,1.0,1.0);
bc->SetVector(XGEN_OBJECT_SCALE_VAR, c4d.Vector(1.0,1.0,1.0);
bc->SetInt32(XGEN_ROTMODE,XGEN_ROTMODE_PARTICLE);
bc->SetVector(XGEN_OBJECT_ROT, c4d.Vector(1.0,1.0,1.0);
bc->SetVector(XGEN_OBJECT_ROT_VAR, c4d.Vector(1.0,1.0,1.0);
bc->SetBool(XGEN_MORPH_ENABLE,true);
bc->SetInt32(XGEN_MORPH_INDEX,1);
bc->SetFloat(XGEN_MORPH_MAX,0.1);
bc->SetFloat(XGEN_MORPH_MAX_VAR,0.1);
bc->SetInt32(XGEN_CACHEINFO_CACHEDELEMENTS,1);
pObject->Message(MSG_UPDATE);
}
Buttons
This node has buttons. Buttons can manually be executed by calling the following code
Python
c4d.CallButton(obj,c4d.XGEN_HELP_BUTTON)
c4d.CallButton(obj,c4d.XGEN_VIDMAN_BUTTON)
c4d.CallButton(obj,c4d.XGEN_BUTTON_RESET)
c4d.CallButton(obj,c4d.XGEN_BUTTON_SAVE_PRESET)
c4d.CallButton(obj,c4d.XGEN_BUTTON_LOAD_PRESET)
C++
DescriptionCommand dc;
dc.id = DescID(XGEN_HELP_BUTTON);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(XGEN_VIDMAN_BUTTON);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(XGEN_BUTTON_RESET);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(XGEN_BUTTON_SAVE_PRESET);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(XGEN_BUTTON_LOAD_PRESET);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);