Obaseeffector
Attributes
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.Obaseeffector)
doc.InsertObject(obj)
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
#You can set parameters two different ways.
#First way
obj[c4d.ID_MG_BASEEFFECTOR_STRENGTH] = 0.1
obj[c4d.ID_MG_BASEEFFECTOR_SELECTION] = "Hello World"
obj[c4d.ID_MG_BASEEFFECTOR_MAXSTRENGTH] = 0.1
obj[c4d.ID_MG_BASEEFFECTOR_MINSTRENGTH] = 0.1
obj[c4d.ID_MG_BASEEFFECTOR_TRANSFORMMODE] = c4d.ID_MG_BASEEFFECTOR_TRANSFORMMODE_RELATIVE
obj[c4d.ID_MG_BASEEFFECTOR_SPACEMODE] = c4d.ID_MG_BASEEFFECTOR_SPACEMODE_NODE
obj[c4d.ID_MG_BASEEFFECTOR_POSITION_ACTIVE] = True
obj[c4d.ID_MG_BASEEFFECTOR_POSITION] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.ID_MG_BASEEFFECTOR_SCALE_ACTIVE] = True
obj[c4d.ID_MG_BASEEFFECTOR_USCALE] = 0.1
obj[c4d.ID_MG_BASEEFFECTOR_SCALE] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.ID_MG_BASEEFFECTOR_UNIFORMSCALE] = True
obj[c4d.ID_MG_BASEEFFECTOR_POSITIVESCALE] = True
obj[c4d.ID_MG_BASEEFFECTOR_ROTATE_ACTIVE] = True
obj[c4d.ID_MG_BASEEFFECTOR_ROTATION] = c4d.Vector(1.0,1.0,1.0)
obj[c4d.ID_MG_BASEEFFECTOR_COLOR_MODE] = c4d.ID_MG_BASEEFFECTOR_COLOR_MODE_OFF
obj[c4d.ID_MG_BASEEFFECTOR_COLOR_ALPHA] = True
obj[c4d.ID_MG_BASEEFFECTOR_COLOR_BLEND] = c4d.ID_MG_BASEEFFECTOR_COLOR_BLEND_DEFAULT
obj[c4d.ID_MG_BASEEFFECTOR_OTHERALPHA] = True
obj[c4d.ID_MG_BASEEFFECTOR_WEIGHT] = 0.1
obj[c4d.ID_MG_BASEEFFECTOR_U] = 0.1
obj[c4d.ID_MG_BASEEFFECTOR_V] = 0.1
obj[c4d.ID_MG_BASEEFFECTOR_CLONE] = 0.1
obj[c4d.ID_MG_BASEEFFECTOR_VISIBILITY] = True
#Second way, using the base container.
bc = obj.GetDataInstance()
bc.SetFloat(c4d.ID_MG_BASEEFFECTOR_STRENGTH,0.1)
bc.SetString(c4d.ID_MG_BASEEFFECTOR_SELECTION,"Hello World")
bc.SetFloat(c4d.ID_MG_BASEEFFECTOR_MAXSTRENGTH,0.1)
bc.SetFloat(c4d.ID_MG_BASEEFFECTOR_MINSTRENGTH,0.1)
bc.SetInt32(c4d.ID_MG_BASEEFFECTOR_TRANSFORMMODE,c4d.ID_MG_BASEEFFECTOR_TRANSFORMMODE_RELATIVE)
bc.SetInt32(c4d.ID_MG_BASEEFFECTOR_SPACEMODE,c4d.ID_MG_BASEEFFECTOR_SPACEMODE_NODE)
bc.SetBool(c4d.ID_MG_BASEEFFECTOR_POSITION_ACTIVE,True)
bc.SetVector(c4d.ID_MG_BASEEFFECTOR_POSITION, c4d.Vector(1.0,1.0,1.0)
bc.SetBool(c4d.ID_MG_BASEEFFECTOR_SCALE_ACTIVE,True)
bc.SetFloat(c4d.ID_MG_BASEEFFECTOR_USCALE,0.1)
bc.SetVector(c4d.ID_MG_BASEEFFECTOR_SCALE, c4d.Vector(1.0,1.0,1.0)
bc.SetBool(c4d.ID_MG_BASEEFFECTOR_UNIFORMSCALE,True)
bc.SetBool(c4d.ID_MG_BASEEFFECTOR_POSITIVESCALE,True)
bc.SetBool(c4d.ID_MG_BASEEFFECTOR_ROTATE_ACTIVE,True)
bc.SetVector(c4d.ID_MG_BASEEFFECTOR_ROTATION, c4d.Vector(1.0,1.0,1.0)
bc.SetInt32(c4d.ID_MG_BASEEFFECTOR_COLOR_MODE,c4d.ID_MG_BASEEFFECTOR_COLOR_MODE_OFF)
bc.SetBool(c4d.ID_MG_BASEEFFECTOR_COLOR_ALPHA,True)
bc.SetInt32(c4d.ID_MG_BASEEFFECTOR_COLOR_BLEND,c4d.ID_MG_BASEEFFECTOR_COLOR_BLEND_DEFAULT)
bc.SetBool(c4d.ID_MG_BASEEFFECTOR_OTHERALPHA,True)
bc.SetFloat(c4d.ID_MG_BASEEFFECTOR_WEIGHT,0.1)
bc.SetFloat(c4d.ID_MG_BASEEFFECTOR_U,0.1)
bc.SetFloat(c4d.ID_MG_BASEEFFECTOR_V,0.1)
bc.SetFloat(c4d.ID_MG_BASEEFFECTOR_CLONE,0.1)
bc.SetBool(c4d.ID_MG_BASEEFFECTOR_VISIBILITY,True)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../objects/description/obaseeffector.h"
void SampleFunction()
{
BaseDocument *pDoc = GetActiveDocument();
BaseObject *pObject = BaseObject::Alloc(Obaseeffector);
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_MG_BASEEFFECTOR_STRENGTH),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_SELECTION),GeData("Hello World"),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_MAXSTRENGTH),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_MINSTRENGTH),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_TRANSFORMMODE),GeData(ID_MG_BASEEFFECTOR_TRANSFORMMODE_RELATIVE),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_SPACEMODE),GeData(ID_MG_BASEEFFECTOR_SPACEMODE_NODE),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_POSITION_ACTIVE),GeData(true),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_POSITION),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_SCALE_ACTIVE),GeData(true),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_USCALE),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_SCALE),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_UNIFORMSCALE),GeData(true),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_POSITIVESCALE),GeData(true),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_ROTATE_ACTIVE),GeData(true),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_ROTATION),GeData(Vector(1.0,1.0,1.0)),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_COLOR_MODE),GeData(ID_MG_BASEEFFECTOR_COLOR_MODE_OFF),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_COLOR_ALPHA),GeData(true),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_COLOR_BLEND),GeData(ID_MG_BASEEFFECTOR_COLOR_BLEND_DEFAULT),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_OTHERALPHA),GeData(true),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_WEIGHT),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_U),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_V),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_CLONE),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_MG_BASEEFFECTOR_VISIBILITY),GeData(true),flags);
pObject->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pObject->GetDataInstance();
bc->SetFloat(ID_MG_BASEEFFECTOR_STRENGTH,0.1);
bc->SetString(ID_MG_BASEEFFECTOR_SELECTION,"Hello World");
bc->SetFloat(ID_MG_BASEEFFECTOR_MAXSTRENGTH,0.1);
bc->SetFloat(ID_MG_BASEEFFECTOR_MINSTRENGTH,0.1);
bc->SetInt32(ID_MG_BASEEFFECTOR_TRANSFORMMODE,ID_MG_BASEEFFECTOR_TRANSFORMMODE_RELATIVE);
bc->SetInt32(ID_MG_BASEEFFECTOR_SPACEMODE,ID_MG_BASEEFFECTOR_SPACEMODE_NODE);
bc->SetBool(ID_MG_BASEEFFECTOR_POSITION_ACTIVE,true);
bc->SetVector(ID_MG_BASEEFFECTOR_POSITION, c4d.Vector(1.0,1.0,1.0);
bc->SetBool(ID_MG_BASEEFFECTOR_SCALE_ACTIVE,true);
bc->SetFloat(ID_MG_BASEEFFECTOR_USCALE,0.1);
bc->SetVector(ID_MG_BASEEFFECTOR_SCALE, c4d.Vector(1.0,1.0,1.0);
bc->SetBool(ID_MG_BASEEFFECTOR_UNIFORMSCALE,true);
bc->SetBool(ID_MG_BASEEFFECTOR_POSITIVESCALE,true);
bc->SetBool(ID_MG_BASEEFFECTOR_ROTATE_ACTIVE,true);
bc->SetVector(ID_MG_BASEEFFECTOR_ROTATION, c4d.Vector(1.0,1.0,1.0);
bc->SetInt32(ID_MG_BASEEFFECTOR_COLOR_MODE,ID_MG_BASEEFFECTOR_COLOR_MODE_OFF);
bc->SetBool(ID_MG_BASEEFFECTOR_COLOR_ALPHA,true);
bc->SetInt32(ID_MG_BASEEFFECTOR_COLOR_BLEND,ID_MG_BASEEFFECTOR_COLOR_BLEND_DEFAULT);
bc->SetBool(ID_MG_BASEEFFECTOR_OTHERALPHA,true);
bc->SetFloat(ID_MG_BASEEFFECTOR_WEIGHT,0.1);
bc->SetFloat(ID_MG_BASEEFFECTOR_U,0.1);
bc->SetFloat(ID_MG_BASEEFFECTOR_V,0.1);
bc->SetFloat(ID_MG_BASEEFFECTOR_CLONE,0.1);
bc->SetBool(ID_MG_BASEEFFECTOR_VISIBILITY,true);
pObject->Message(MSG_UPDATE);
}