Ocamuscle
Attributes
-
ENGLISH NAME : Muscle
-
NAME : Ocamuscle
-
INCLUDE : Obase
-
PATH : ca/description/ocamuscle.res
-
PLUGIN : ca
-
MAXON online help (may not exist): OCAMUSCLE
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.Ocamuscle)
doc.InsertObject(obj)
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
#You can set parameters two different ways.
#First way
obj[c4d.ID_CA_MUSCLE_OBJECT_MODE] = c4d.ID_CA_MUSCLE_OBJECT_MODE_EDIT
obj[c4d.ID_CA_MUSCLE_OBJECT_STATE] = c4d.ID_CA_MUSCLE_OBJECT_STATE_RELAX
obj[c4d.ID_CA_MUSCLE_OBJECT_AUTO_COMPRESS] = True
obj[c4d.ID_CA_MUSCLE_OBJECT_AUTO_EXTEND] = True
obj[c4d.ID_CA_MUSCLE_OBJECT_RELAX_LENGTH] = 0.1
obj[c4d.ID_CA_MUSCLE_OBJECT_COMPRESS_LENGTH] = 0.1
obj[c4d.ID_CA_MUSCLE_OBJECT_EXTEND_LENGTH] = 0.1
obj[c4d.ID_CA_MUSCLE_OBJECT_AUTO_ALIGN] = True
obj[c4d.ID_CA_MUSCLE_OBJECT_TYPE] = c4d.ID_CA_MUSCLE_OBJECT_TYPE_LINEAR
obj[c4d.ID_CA_MUSCLE_OBJECT_SEGMENTS_COUNT] = 1
obj[c4d.ID_CA_MUSCLE_OBJECT_RADIAL_COUNT] = 1
obj[c4d.ID_CA_MUSCLE_OBJECT_SUBD] = 1
obj[c4d.ID_CA_MUSCLE_OBJECT_SEGMENTS_RES] = 1
obj[c4d.ID_CA_MUSCLE_OBJECT_RADIAL_RES] = 1
obj[c4d.ID_CA_MUSCLE_OBJECT_SUBD_CALC] = 1
obj[c4d.ID_CA_MUSCLE_OBJECT_DEFORM] = c4d.ID_CA_MUSCLE_OBJECT_DEFORM_RADIAL
obj[c4d.ID_CA_MUSCLE_OBJECT_FATOFFSET] = 0.1
obj[c4d.ID_CA_MUSCLE_OBJECT_DYNAMICS] = True
obj[c4d.ID_CA_MUSCLE_OBJECT_DYNAMICS_FRAME] = True
obj[c4d.ID_CA_MUSCLE_OBJECT_STRENGTH] = 0.1
obj[c4d.ID_CA_MUSCLE_OBJECT_STIFFNESS] = 0.1
obj[c4d.ID_CA_MUSCLE_OBJECT_STRUCTUAL_STIFFNESS] = 0.1
obj[c4d.ID_CA_MUSCLE_OBJECT_VOLUME_STIFFNESS] = 0.1
obj[c4d.ID_CA_MUSCLE_OBJECT_DRAG] = 0.1
obj[c4d.ID_CA_MUSCLE_OBJECT_GRAVITY] = 0.1
obj[c4d.ID_CA_MUSCLE_OBJECT_SPRINGS] = 1
obj[c4d.ID_CA_MUSCLE_OBJECT_ITERATIONS] = 1
#Second way, using the base container.
bc = obj.GetDataInstance()
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_MODE,c4d.ID_CA_MUSCLE_OBJECT_MODE_EDIT)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_STATE,c4d.ID_CA_MUSCLE_OBJECT_STATE_RELAX)
bc.SetBool(c4d.ID_CA_MUSCLE_OBJECT_AUTO_COMPRESS,True)
bc.SetBool(c4d.ID_CA_MUSCLE_OBJECT_AUTO_EXTEND,True)
bc.SetFloat(c4d.ID_CA_MUSCLE_OBJECT_RELAX_LENGTH,0.1)
bc.SetFloat(c4d.ID_CA_MUSCLE_OBJECT_COMPRESS_LENGTH,0.1)
bc.SetFloat(c4d.ID_CA_MUSCLE_OBJECT_EXTEND_LENGTH,0.1)
bc.SetBool(c4d.ID_CA_MUSCLE_OBJECT_AUTO_ALIGN,True)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_TYPE,c4d.ID_CA_MUSCLE_OBJECT_TYPE_LINEAR)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_SEGMENTS_COUNT,1)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_RADIAL_COUNT,1)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_SUBD,1)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_SEGMENTS_RES,1)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_RADIAL_RES,1)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_SUBD_CALC,1)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_DEFORM,c4d.ID_CA_MUSCLE_OBJECT_DEFORM_RADIAL)
bc.SetFloat(c4d.ID_CA_MUSCLE_OBJECT_FATOFFSET,0.1)
bc.SetBool(c4d.ID_CA_MUSCLE_OBJECT_DYNAMICS,True)
bc.SetBool(c4d.ID_CA_MUSCLE_OBJECT_DYNAMICS_FRAME,True)
bc.SetFloat(c4d.ID_CA_MUSCLE_OBJECT_STRENGTH,0.1)
bc.SetFloat(c4d.ID_CA_MUSCLE_OBJECT_STIFFNESS,0.1)
bc.SetFloat(c4d.ID_CA_MUSCLE_OBJECT_STRUCTUAL_STIFFNESS,0.1)
bc.SetFloat(c4d.ID_CA_MUSCLE_OBJECT_VOLUME_STIFFNESS,0.1)
bc.SetFloat(c4d.ID_CA_MUSCLE_OBJECT_DRAG,0.1)
bc.SetFloat(c4d.ID_CA_MUSCLE_OBJECT_GRAVITY,0.1)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_SPRINGS,1)
bc.SetInt32(c4d.ID_CA_MUSCLE_OBJECT_ITERATIONS,1)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../ca/description/ocamuscle.h"
void SampleFunction()
{
BaseDocument *pDoc = GetActiveDocument();
BaseObject *pObject = BaseObject::Alloc(Ocamuscle);
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_MUSCLE_OBJECT_MODE),GeData(ID_CA_MUSCLE_OBJECT_MODE_EDIT),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_STATE),GeData(ID_CA_MUSCLE_OBJECT_STATE_RELAX),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_AUTO_COMPRESS),GeData(true),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_AUTO_EXTEND),GeData(true),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_RELAX_LENGTH),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_COMPRESS_LENGTH),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_EXTEND_LENGTH),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_AUTO_ALIGN),GeData(true),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_TYPE),GeData(ID_CA_MUSCLE_OBJECT_TYPE_LINEAR),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_SEGMENTS_COUNT),GeData(1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_RADIAL_COUNT),GeData(1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_SUBD),GeData(1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_SEGMENTS_RES),GeData(1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_RADIAL_RES),GeData(1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_SUBD_CALC),GeData(1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_DEFORM),GeData(ID_CA_MUSCLE_OBJECT_DEFORM_RADIAL),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_FATOFFSET),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_DYNAMICS),GeData(true),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_DYNAMICS_FRAME),GeData(true),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_STRENGTH),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_STIFFNESS),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_STRUCTUAL_STIFFNESS),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_VOLUME_STIFFNESS),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_DRAG),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_GRAVITY),GeData(0.1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_SPRINGS),GeData(1),flags);
pObject->SetParameter(DescID(ID_CA_MUSCLE_OBJECT_ITERATIONS),GeData(1),flags);
pObject->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pObject->GetDataInstance();
bc->SetInt32(ID_CA_MUSCLE_OBJECT_MODE,ID_CA_MUSCLE_OBJECT_MODE_EDIT);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_STATE,ID_CA_MUSCLE_OBJECT_STATE_RELAX);
bc->SetBool(ID_CA_MUSCLE_OBJECT_AUTO_COMPRESS,true);
bc->SetBool(ID_CA_MUSCLE_OBJECT_AUTO_EXTEND,true);
bc->SetFloat(ID_CA_MUSCLE_OBJECT_RELAX_LENGTH,0.1);
bc->SetFloat(ID_CA_MUSCLE_OBJECT_COMPRESS_LENGTH,0.1);
bc->SetFloat(ID_CA_MUSCLE_OBJECT_EXTEND_LENGTH,0.1);
bc->SetBool(ID_CA_MUSCLE_OBJECT_AUTO_ALIGN,true);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_TYPE,ID_CA_MUSCLE_OBJECT_TYPE_LINEAR);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_SEGMENTS_COUNT,1);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_RADIAL_COUNT,1);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_SUBD,1);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_SEGMENTS_RES,1);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_RADIAL_RES,1);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_SUBD_CALC,1);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_DEFORM,ID_CA_MUSCLE_OBJECT_DEFORM_RADIAL);
bc->SetFloat(ID_CA_MUSCLE_OBJECT_FATOFFSET,0.1);
bc->SetBool(ID_CA_MUSCLE_OBJECT_DYNAMICS,true);
bc->SetBool(ID_CA_MUSCLE_OBJECT_DYNAMICS_FRAME,true);
bc->SetFloat(ID_CA_MUSCLE_OBJECT_STRENGTH,0.1);
bc->SetFloat(ID_CA_MUSCLE_OBJECT_STIFFNESS,0.1);
bc->SetFloat(ID_CA_MUSCLE_OBJECT_STRUCTUAL_STIFFNESS,0.1);
bc->SetFloat(ID_CA_MUSCLE_OBJECT_VOLUME_STIFFNESS,0.1);
bc->SetFloat(ID_CA_MUSCLE_OBJECT_DRAG,0.1);
bc->SetFloat(ID_CA_MUSCLE_OBJECT_GRAVITY,0.1);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_SPRINGS,1);
bc->SetInt32(ID_CA_MUSCLE_OBJECT_ITERATIONS,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_MUSCLE_OBJECT_STATE_SET)
c4d.CallButton(obj,c4d.ID_CA_MUSCLE_OBJECT_ANCHORS_ADD)
c4d.CallButton(obj,c4d.ID_CA_MUSCLE_OBJECT_ANCHORS_REMOVE)
C++
DescriptionCommand dc;
dc.id = DescID(ID_CA_MUSCLE_OBJECT_STATE_SET);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(ID_CA_MUSCLE_OBJECT_ANCHORS_ADD);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(ID_CA_MUSCLE_OBJECT_ANCHORS_REMOVE);
pObject->Message(MSG_DESCRIPTION_COMMAND, &dc);