Ocacluster
Attributes
-
ENGLISH NAME : Cluster
-
NAME : Ocacluster
-
INCLUDE : Obase
-
PATH : ca/description/ocacluster.res
-
PLUGIN : ca
-
MAXON online help (may not exist): OCACLUSTER
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.Ocacluster)
doc.InsertObject(obj)
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
#You can set parameters two different ways.
#First way
obj[c4d.ID_CA_CLUSTER_OBJECT_STRENGTH] = 0.1
obj[c4d.ID_CA_CLUSTER_OBJECT_TRANSFORM] = c4d.ID_CA_CLUSTER_OBJECT_TRANSFORM_LOCAL
obj[c4d.ID_CA_CLUSTER_OBJECT_MATRIX] = c4d.ID_CA_CLUSTER_OBJECT_MATRIX_OBJECT
obj[c4d.ID_CA_CLUSTER_OBJECT_ALIGN_AXIS] = c4d.ID_CA_CLUSTER_OBJECT_ALIGN_AXIS_X
obj[c4d.ID_CA_CLUSTER_FALLOFF_MODE] = c4d.ID_CA_CLUSTER_FALLOFF_MODE_NONE
obj[c4d.ID_CA_CLUSTER_FALLOFF] = c4d.ID_CA_CLUSTER_FALLOFF_SIMPLE
obj[c4d.ID_CA_CLUSTER_FALLOFF_RADIUS] = 0.1
obj[c4d.ID_CA_CLUSTER_WIDTH] = 0.1
obj[c4d.ID_CA_CLUSTER_HARDNESS] = 0.1
obj[c4d.ID_CA_CLUSTER_OBJECT_MAINTAIN_OFFSET] = True
obj[c4d.ID_CA_CLUSTER_OBJECT_MAINTAIN_P_OFFSET] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.ID_CA_CLUSTER_OBJECT_MAINTAIN_S_OFFSET] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.ID_CA_CLUSTER_OBJECT_MAINTAIN_R_OFFSET] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.ID_CA_CLUSTER_OBJECT_P_WEIGHT] = 0.1
obj[c4d.ID_CA_CLUSTER_OBJECT_S_WEIGHT] = 0.1
obj[c4d.ID_CA_CLUSTER_OBJECT_R_WEIGHT] = 0.1
#Second way, using the base container.
bc = obj.GetDataInstance()
bc.SetFloat(c4d.ID_CA_CLUSTER_OBJECT_STRENGTH,0.1)
bc.SetInt32(c4d.ID_CA_CLUSTER_OBJECT_TRANSFORM,c4d.ID_CA_CLUSTER_OBJECT_TRANSFORM_LOCAL)
bc.SetInt32(c4d.ID_CA_CLUSTER_OBJECT_MATRIX,c4d.ID_CA_CLUSTER_OBJECT_MATRIX_OBJECT)
bc.SetInt32(c4d.ID_CA_CLUSTER_OBJECT_ALIGN_AXIS,c4d.ID_CA_CLUSTER_OBJECT_ALIGN_AXIS_X)
bc.SetInt32(c4d.ID_CA_CLUSTER_FALLOFF_MODE,c4d.ID_CA_CLUSTER_FALLOFF_MODE_NONE)
bc.SetInt32(c4d.ID_CA_CLUSTER_FALLOFF,c4d.ID_CA_CLUSTER_FALLOFF_SIMPLE)
bc.SetFloat(c4d.ID_CA_CLUSTER_FALLOFF_RADIUS,0.1)
bc.SetFloat(c4d.ID_CA_CLUSTER_WIDTH,0.1)
bc.SetFloat(c4d.ID_CA_CLUSTER_HARDNESS,0.1)
bc.SetBool(c4d.ID_CA_CLUSTER_OBJECT_MAINTAIN_OFFSET,True)
bc.SetVector(c4d.ID_CA_CLUSTER_OBJECT_MAINTAIN_P_OFFSET, c4d.Vector(1.0,1.0,1.0)
bc.SetVector(c4d.ID_CA_CLUSTER_OBJECT_MAINTAIN_S_OFFSET, c4d.Vector(1.0,1.0,1.0)
bc.SetVector(c4d.ID_CA_CLUSTER_OBJECT_MAINTAIN_R_OFFSET, c4d.Vector(1.0,1.0,1.0)
bc.SetFloat(c4d.ID_CA_CLUSTER_OBJECT_P_WEIGHT,0.1)
bc.SetFloat(c4d.ID_CA_CLUSTER_OBJECT_S_WEIGHT,0.1)
bc.SetFloat(c4d.ID_CA_CLUSTER_OBJECT_R_WEIGHT,0.1)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../ca/description/ocacluster.h"
void SampleFunction()
{
BaseDocument *pDoc = GetActiveDocument();
BaseObject *pObject = BaseObject::Alloc(Ocacluster);
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(ID_CA_CLUSTER_OBJECT_STRENGTH),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_OBJECT_TRANSFORM),GeData(ID_CA_CLUSTER_OBJECT_TRANSFORM_LOCAL),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_OBJECT_MATRIX),GeData(ID_CA_CLUSTER_OBJECT_MATRIX_OBJECT),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_OBJECT_ALIGN_AXIS),GeData(ID_CA_CLUSTER_OBJECT_ALIGN_AXIS_X),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_FALLOFF_MODE),GeData(ID_CA_CLUSTER_FALLOFF_MODE_NONE),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_FALLOFF),GeData(ID_CA_CLUSTER_FALLOFF_SIMPLE),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_FALLOFF_RADIUS),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_WIDTH),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_HARDNESS),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_OBJECT_MAINTAIN_OFFSET),GeData(true),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_OBJECT_MAINTAIN_P_OFFSET),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_OBJECT_MAINTAIN_S_OFFSET),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_OBJECT_MAINTAIN_R_OFFSET),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_OBJECT_P_WEIGHT),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_OBJECT_S_WEIGHT),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_CLUSTER_OBJECT_R_WEIGHT),GeData(0.1),flags);
pObject->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pObject->GetDataInstance();
bc->SetFloat(ID_CA_CLUSTER_OBJECT_STRENGTH,0.1);
bc->SetInt32(ID_CA_CLUSTER_OBJECT_TRANSFORM,ID_CA_CLUSTER_OBJECT_TRANSFORM_LOCAL);
bc->SetInt32(ID_CA_CLUSTER_OBJECT_MATRIX,ID_CA_CLUSTER_OBJECT_MATRIX_OBJECT);
bc->SetInt32(ID_CA_CLUSTER_OBJECT_ALIGN_AXIS,ID_CA_CLUSTER_OBJECT_ALIGN_AXIS_X);
bc->SetInt32(ID_CA_CLUSTER_FALLOFF_MODE,ID_CA_CLUSTER_FALLOFF_MODE_NONE);
bc->SetInt32(ID_CA_CLUSTER_FALLOFF,ID_CA_CLUSTER_FALLOFF_SIMPLE);
bc->SetFloat(ID_CA_CLUSTER_FALLOFF_RADIUS,0.1);
bc->SetFloat(ID_CA_CLUSTER_WIDTH,0.1);
bc->SetFloat(ID_CA_CLUSTER_HARDNESS,0.1);
bc->SetBool(ID_CA_CLUSTER_OBJECT_MAINTAIN_OFFSET,true);
bc->SetVector(ID_CA_CLUSTER_OBJECT_MAINTAIN_P_OFFSET, c4d.Vector(1.0,1.0,1.0);
bc->SetVector(ID_CA_CLUSTER_OBJECT_MAINTAIN_S_OFFSET, c4d.Vector(1.0,1.0,1.0);
bc->SetVector(ID_CA_CLUSTER_OBJECT_MAINTAIN_R_OFFSET, c4d.Vector(1.0,1.0,1.0);
bc->SetFloat(ID_CA_CLUSTER_OBJECT_P_WEIGHT,0.1);
bc->SetFloat(ID_CA_CLUSTER_OBJECT_S_WEIGHT,0.1);
bc->SetFloat(ID_CA_CLUSTER_OBJECT_R_WEIGHT,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.ID_CA_CLUSTER_OBJECT_TARGET_ADD)
C++
DescriptionCommand dc;
dc.id = DescID(ID_CA_CLUSTER_OBJECT_TARGET_ADD);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);