Oxgroup
Attributes
-
ENGLISH NAME : X-ParticlesGroupObject
-
NAME : Oxgroup
-
INCLUDE : Obase
-
PATH : res/description/oxgroup.res
-
PLUGIN : X-Particles
-
MAXON online help (may not exist): OXGROUP
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.Oxgroup)
doc.InsertObject(obj)
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
#You can set parameters two different ways.
#First way
obj[c4d.XGROUP_NUMBER] = 1
obj[c4d.XGROUP_MODE] = c4d.XGROUP_MODE_DISPLAY
obj[c4d.XGROUP_DISPLAY] = c4d.XGDISPLAY_DOT
obj[c4d.XGROUP_COLOR_MODE] = c4d.XGROUP_COLOR_MODE_SINGLE
obj[c4d.XGROUP_COLOR_GRADIENT_MODE] = c4d.XGROUP_COLOR_GRADIENT_MODE_AGE
obj[c4d.XGROUP_COLOR_GRADIENT_AUTO] = True
obj[c4d.XGROUP_COLOR_GRADIENT_MIN] = 0.1
obj[c4d.XGROUP_COLOR_GRADIENT_MAX] = 0.1
obj[c4d.XGROUP_EMITTER_SPEED] = 0.1
obj[c4d.XGROUP_EMITTER_SPEED_VAR] = 0.1
obj[c4d.XGROUP_EMITTER_RADIUS] = 0.1
obj[c4d.XGROUP_EMITTER_RADIUS_VAR] = 0.1
obj[c4d.XGROUP_EMITTER_SCALE] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.XGROUP_EMITTER_SCALE_UNIFORM] = True
obj[c4d.XGROUP_EMITTER_SCALE_VAR] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.XGROUP_EMITTER_SCALE_VAR_UNIFORM] = True
obj[c4d.XGROUP_EMITTER_MASS] = 0.1
obj[c4d.XGROUP_EMITTER_MASS_VAR] = 0.1
obj[c4d.XGROUP_EMITTER_TEMP] = 0.1
obj[c4d.XGROUP_EMITTER_TEMP_VAR] = 0.1
obj[c4d.XGROUP_EMITTER_DENSITY] = 0.1
obj[c4d.XGROUP_EMITTER_DENSITY_VAR] = 0.1
obj[c4d.XGROUP_EMITTER_FUEL] = 0.1
obj[c4d.XGROUP_EMITTER_FUEL_VAR] = 0.1
obj[c4d.XGROUP_EMITTER_BURN] = 0.1
obj[c4d.XGROUP_EMITTER_BURN_VAR] = 0.1
#Second way, using the base container.
bc = obj.GetDataInstance()
bc.SetInt32(c4d.XGROUP_NUMBER,1)
bc.SetInt32(c4d.XGROUP_MODE,c4d.XGROUP_MODE_DISPLAY)
bc.SetInt32(c4d.XGROUP_DISPLAY,c4d.XGDISPLAY_DOT)
bc.SetInt32(c4d.XGROUP_COLOR_MODE,c4d.XGROUP_COLOR_MODE_SINGLE)
bc.SetInt32(c4d.XGROUP_COLOR_GRADIENT_MODE,c4d.XGROUP_COLOR_GRADIENT_MODE_AGE)
bc.SetBool(c4d.XGROUP_COLOR_GRADIENT_AUTO,True)
bc.SetFloat(c4d.XGROUP_COLOR_GRADIENT_MIN,0.1)
bc.SetFloat(c4d.XGROUP_COLOR_GRADIENT_MAX,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_SPEED,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_SPEED_VAR,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_RADIUS,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_RADIUS_VAR,0.1)
bc.SetVector(c4d.XGROUP_EMITTER_SCALE, c4d.Vector(1.0,1.0,1.0)
bc.SetBool(c4d.XGROUP_EMITTER_SCALE_UNIFORM,True)
bc.SetVector(c4d.XGROUP_EMITTER_SCALE_VAR, c4d.Vector(1.0,1.0,1.0)
bc.SetBool(c4d.XGROUP_EMITTER_SCALE_VAR_UNIFORM,True)
bc.SetFloat(c4d.XGROUP_EMITTER_MASS,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_MASS_VAR,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_TEMP,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_TEMP_VAR,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_DENSITY,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_DENSITY_VAR,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_FUEL,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_FUEL_VAR,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_BURN,0.1)
bc.SetFloat(c4d.XGROUP_EMITTER_BURN_VAR,0.1)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../res/description/oxgroup.h"
void SampleFunction()
{
BaseDocument *pDoc = GetActiveDocument();
BaseObject *pObject = BaseObject::Alloc(Oxgroup);
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(XGROUP_NUMBER),GeData(1),flags);
pObject->SetParameter(DescID(XGROUP_MODE),GeData(XGROUP_MODE_DISPLAY),flags);
pObject->SetParameter(DescID(XGROUP_DISPLAY),GeData(XGDISPLAY_DOT),flags);
pObject->SetParameter(DescID(XGROUP_COLOR_MODE),GeData(XGROUP_COLOR_MODE_SINGLE),flags);
pObject->SetParameter(DescID(XGROUP_COLOR_GRADIENT_MODE),GeData(XGROUP_COLOR_GRADIENT_MODE_AGE),flags);
pObject->SetParameter(DescID(XGROUP_COLOR_GRADIENT_AUTO),GeData(true),flags);
pObject->SetParameter(DescID(XGROUP_COLOR_GRADIENT_MIN),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_COLOR_GRADIENT_MAX),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_SPEED),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_SPEED_VAR),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_RADIUS),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_RADIUS_VAR),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_SCALE),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_SCALE_UNIFORM),GeData(true),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_SCALE_VAR),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_SCALE_VAR_UNIFORM),GeData(true),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_MASS),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_MASS_VAR),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_TEMP),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_TEMP_VAR),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_DENSITY),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_DENSITY_VAR),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_FUEL),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_FUEL_VAR),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_BURN),GeData(0.1),flags);
pObject->SetParameter(DescID(XGROUP_EMITTER_BURN_VAR),GeData(0.1),flags);
pObject->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pObject->GetDataInstance();
bc->SetInt32(XGROUP_NUMBER,1);
bc->SetInt32(XGROUP_MODE,XGROUP_MODE_DISPLAY);
bc->SetInt32(XGROUP_DISPLAY,XGDISPLAY_DOT);
bc->SetInt32(XGROUP_COLOR_MODE,XGROUP_COLOR_MODE_SINGLE);
bc->SetInt32(XGROUP_COLOR_GRADIENT_MODE,XGROUP_COLOR_GRADIENT_MODE_AGE);
bc->SetBool(XGROUP_COLOR_GRADIENT_AUTO,true);
bc->SetFloat(XGROUP_COLOR_GRADIENT_MIN,0.1);
bc->SetFloat(XGROUP_COLOR_GRADIENT_MAX,0.1);
bc->SetFloat(XGROUP_EMITTER_SPEED,0.1);
bc->SetFloat(XGROUP_EMITTER_SPEED_VAR,0.1);
bc->SetFloat(XGROUP_EMITTER_RADIUS,0.1);
bc->SetFloat(XGROUP_EMITTER_RADIUS_VAR,0.1);
bc->SetVector(XGROUP_EMITTER_SCALE, c4d.Vector(1.0,1.0,1.0);
bc->SetBool(XGROUP_EMITTER_SCALE_UNIFORM,true);
bc->SetVector(XGROUP_EMITTER_SCALE_VAR, c4d.Vector(1.0,1.0,1.0);
bc->SetBool(XGROUP_EMITTER_SCALE_VAR_UNIFORM,true);
bc->SetFloat(XGROUP_EMITTER_MASS,0.1);
bc->SetFloat(XGROUP_EMITTER_MASS_VAR,0.1);
bc->SetFloat(XGROUP_EMITTER_TEMP,0.1);
bc->SetFloat(XGROUP_EMITTER_TEMP_VAR,0.1);
bc->SetFloat(XGROUP_EMITTER_DENSITY,0.1);
bc->SetFloat(XGROUP_EMITTER_DENSITY_VAR,0.1);
bc->SetFloat(XGROUP_EMITTER_FUEL,0.1);
bc->SetFloat(XGROUP_EMITTER_FUEL_VAR,0.1);
bc->SetFloat(XGROUP_EMITTER_BURN,0.1);
bc->SetFloat(XGROUP_EMITTER_BURN_VAR,0.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.XGROUP_HELP_BUTTON)
c4d.CallButton(obj,c4d.XGROUP_VIDMAN_BUTTON)
c4d.CallButton(obj,c4d.XGROUP_BUTTON_RESET)
c4d.CallButton(obj,c4d.XGROUP_BUTTON_SAVE_PRESET)
c4d.CallButton(obj,c4d.XGROUP_BUTTON_LOAD_PRESET)
C++
DescriptionCommand dc;
dc.id = DescID(XGROUP_HELP_BUTTON);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(XGROUP_VIDMAN_BUTTON);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(XGROUP_BUTTON_RESET);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(XGROUP_BUTTON_SAVE_PRESET);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(XGROUP_BUTTON_LOAD_PRESET);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
Gradients
This node has gradients. Gradients can manually be edited by calling the following code
Python
C++
#include "customgui_gradient.h"
XGROUP_COLOR_GRADIENT
GeData data;
pObject->GetParameter(DescID(XGROUP_COLOR_GRADIENT),data,DESCFLAGS_GET_PARAM_GET));
Gradient *pGradient = (Gradient*)data.GetCustomDataType(CUSTOMDATATYPE_GRADIENT);
if(pGradient)
{
//must be set before any knot is set
pGradient->SetData(GRADIENT_MODE, GeData(GRADIENTMODE_ALPHA));
GradientKnot k1, k2;
k1.col = Vector(0.0, 0.0, 1.0);
k1.pos = 0.0;
k2.col = 1.0;
k2.pos = 1.0;
pGradient->InsertKnot(k1);
pGradient->InsertKnot(k2);
}
pObject->SetParameter(DescID(XGROUP_COLOR_GRADIENT),data,DESCFLAGS_SET_PARAM_SET));