c4d.modules.character.CAWeightTag

class c4d.modules.character.CAWeightTag

Methods Signatures

CAWeightTag.__init__(self)

CAWeightTag.GetJoint(self, index[, doc])

Get joint object at index.

CAWeightTag.GetJointCount(self)

Get total joint count.

CAWeightTag.FindJoint(self, op[, doc])

Return the index of this object or NOTOK if not found.

CAWeightTag.GetJointRestState(self, index)

Get the rest state for the joint at index.

CAWeightTag.SetJointRestState(self, index, m_bMg, ...)

Set the rest state for the joint at index.

CAWeightTag.GetWeightCount(self, index)

Gets the total number of stored weights for the given joint index.

CAWeightTag.GetIndexWeight(self, index, windex)

Get the windex weight and which point index pntindex it is as well as the weight

CAWeightTag.GetWeightMap(self, index, cnt[, ...])

Returns all the weights.

CAWeightTag.SetWeightMap(self, index, map)

Sets the weights with map.

CAWeightTag.GetWeight(self, index, pntindex)

Return the weight for the point pntindex.

CAWeightTag.SetWeight(self, index, pntindex, ...)

Set the weight for pntindex.

CAWeightTag.GetWeightDirty(self)

Get the dirty state of the weights.

CAWeightTag.WeightDirty(self)

Marks the weights dirty.

CAWeightTag.GetGeomMg(self)

Get the global matrix for the bind geometry.

CAWeightTag.SetGeomMg(self, mg)

Set the global matrix for the bind geometry.

CAWeightTag.AddJoint(self, op)

Add a Joint object to the Weight tag’s “Joints” list.

CAWeightTag.RemoveJoint(self, op)

Remove Joint object from the Weight tag’s “Joints” list.

CAWeightTag.CalculateBoneStates(self, index)

Helper function to initialize the Joint at index.

CAWeightTag.TransferWeightMap(self, doc, dst, sindex, ...)

Transfer the weights from one Weight tag to another.

Inheritance

Parent Class:

Methods Documentation

CAWeightTag.__init__(self)
CAWeightTag.GetJoint(self, index, doc=None)

Get joint object at index.

Parameters
Returns

The joint object.

Return type

Optional[c4d.modules.character.CAJointObject]

CAWeightTag.GetJointCount(self)

Get total joint count.

Return type

int

Returns

Total joint count.

CAWeightTag.FindJoint(self, op, doc=None)

Return the index of this object or NOTOK if not found.

Parameters
CAWeightTag.GetJointRestState(self, index)

Get the rest state for the joint at index.

Parameters

index (int) – The index of the joint.

Raises

IndexError – If the joint index is out of range : 0<=index<GetJointCount().

Return type

dict{m_bMg: c4d.Matrix, m_bMi: c4d.Matrix, m_oMg: c4d.Matrix, m_oMi: c4d.Matrix}

Returns

The state.

CAWeightTag.SetJointRestState(self, index, m_bMg, m_bMi, m_oMg, m_oMi, m_Len)

Set the rest state for the joint at index.

Parameters
  • index (int) – The index of the joint.

  • m_bMg (c4d.Matrix) – Joint global matrix.

  • m_bMi (c4d.Matrix) – Joint inverse matrix.

  • m_oMg (c4d.Matrix) – Object global matrix.

  • m_oMi (c4d.Matrix) – Object inverse matrix.

  • m_Len (float) – Length.

CAWeightTag.GetWeightCount(self, index)

Gets the total number of stored weights for the given joint index.

Parameters

index (int) – Joint index.

Return type

int

Returns

The number of weights. 0 means weights are not stored.

CAWeightTag.GetIndexWeight(self, index, windex)

Get the windex weight and which point index pntindex it is as well as the weight

pntindex, weight = caweighttag.GetIndexWeight(0, 0)
Parameters
  • index (int) – Joint index.

  • windex (int) – Weight index.

Return type

Tuple[int, int]

Returns

Returns the point index, and the corresponding weight.

CAWeightTag.GetWeightMap(self, index, cnt, includeEffectors=False)

Returns all the weights.

New in version R21.

Parameters
  • index (int) – The joint index: <= index < CAWeightTag.GetJointCount().

  • cnt (int) – The point count. Size of map. (Normally same as the point count).

  • includeEffectors (bool) – If True the effectors weights are added to the map.

Return type

List[float]

Returns

A list of float filled with the weight data.

CAWeightTag.SetWeightMap(self, index, map)

Sets the weights with map.

New in version R21.

Parameters
  • index (int) – The joint index: <= index < CAWeightTag.GetJointCount().

  • map (List[float]) – A list of float to set the new weight map.

Return type

bool

Returns

True if successful, otherwise False.

CAWeightTag.GetWeight(self, index, pntindex)

Return the weight for the point pntindex.

Parameters
  • index (int) – Joint index.

  • pntindex (int) – Point index.

Return type

float

Returns

Weight.

CAWeightTag.SetWeight(self, index, pntindex, weight)

Set the weight for pntindex.

Parameters
  • index (int) – Joint index.

  • pntindex (int) – Point index.

  • weight (float) – New weight.

Return type

bool

Returns

True if successful, otherwise False.

CAWeightTag.GetWeightDirty(self)

Get the dirty state of the weights.

Return type

int

Returns

The weight’s dirty state.

CAWeightTag.WeightDirty(self)

Marks the weights dirty.

CAWeightTag.GetGeomMg(self)
Get the global matrix for the bind geometry.
Use this with the global matrices of the joints to get the local transforms.
Return type

c4d.Matrix

Returns

The global matrix for the bind geometry.

CAWeightTag.SetGeomMg(self, mg)

Set the global matrix for the bind geometry.

Parameters

mg (c4d.Matrix) – The global matrix for the bind geometry.

CAWeightTag.AddJoint(self, op)

Add a Joint object to the Weight tag’s “Joints” list.

Parameters

op (c4d.BaseObject) – The Joint object to add to the Weight tag’s “Joints” list.

Return type

int

Returns

Joint object’s index in the “Joints” list.

CAWeightTag.RemoveJoint(self, op)

Remove Joint object from the Weight tag’s “Joints” list.

Parameters

op (c4d.BaseObject) – The Joint object to remove from the Weight tag’s “Joint” list.

CAWeightTag.CalculateBoneStates(self, index)

Helper function to initialize the Joint at index.

Note

The Joints must be in the document.

Parameters

index (int) –

The Joint index. .. note:

Set to *NOTOK* to process all joints.

CAWeightTag.TransferWeightMap(self, doc, dst, sindex, dindex, offset, cnt)

Transfer the weights from one Weight tag to another.

Note

Pass NOTOK for sindex, dindex and cnt if they shouldn’t be evaluated.

Parameters
  • doc (c4d.documents.BaseDocument) – The document containing the Weight tags.

  • dst (c4d.modules.character.CAWeightTag) – The destination Weight tag.

  • sindex (int) – Index of the source Joint.

  • dindex (int) – Index of the destination Joint.

  • offset (int) – Offset to move the weight indices when they are copied to the destination.

  • cnt (int) – Number of weights to be transferred.