c4d.modules.character.CAWeightMgr
¶
New in version R19.
Represents the Weight Manager.
Note
Weight Manager data and settings are per document. Any change on a document does not affect other open documents.
c4d.modules.character.
CAWeightMgr
¶
CAWeightMgr.GetTagCount()
CAWeightMgr.GetJointCount()
CAWeightMgr.GetTagIndex()
CAWeightMgr.GetJointIndex()
CAWeightMgr.GetJointId()
CAWeightMgr.GetJointObject()
CAWeightMgr.GetWeightTag()
CAWeightMgr.GetMeshObject()
CAWeightMgr.ValidateJointIndex()
CAWeightMgr.IsJointSelected()
CAWeightMgr.SelectJoint()
CAWeightMgr.UnselectJoint()
CAWeightMgr.SelectAllJoints()
CAWeightMgr.UnselectAllJoints()
CAWeightMgr.UnselectAllJointListNodes()
CAWeightMgr.IsJointLocked()
CAWeightMgr.LockAllJoints()
CAWeightMgr.LockSelectedJoints()
CAWeightMgr.UnlockAllJoints()
CAWeightMgr.UnlockSelectedJoints()
CAWeightMgr.NormalizeWeights()
CAWeightMgr.ClearWeights()
CAWeightMgr.AutoWeight()
CAWeightMgr.MirrorWeights()
CAWeightMgr.BakeWeights()
CAWeightMgr.CopyWeights()
CAWeightMgr.PasteWeights()
CAWeightMgr.FlipWeights()
CAWeightMgr.SmoothWeights()
CAWeightMgr.ApplyWeightFunction()
CAWeightMgr.
Update
(
doc
)
¶
Note
Update has no effect if nothing dirty is detected. Call
c4d.EventAdd()
to refresh the Weight Manager UI to show the updated changes.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
CAWeightMgr.
SetDirty
(
doc
)
¶
Update()
.
SetDirty()
, then call
Update()
. Call
SetDirty()
if a Weight Manager’s parameter was directly modified in its container.
Note
Call
c4d.EventAdd()
to refresh the Weight Manager UI to show the updated changes.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
CAWeightMgr.
SetParameter
(
doc
,
id
,
newValue
)
¶
SetParameter()
allows to specify the document in which to set the parameter.
Warning
Setting parameters directly into the Weight Manager’s container is not recommended. Doing so requires to make the Weight Manager dirty and to update it manually.
Note
Call
c4d.EventAdd()
to refresh the Weight Manager UI to show the updated changes.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
CAWeightMgr.
GetParameter
(
doc
,
id
)
¶
Retrieves a parameter of the Weight Manager.
Parameters: |
|
---|---|
Return type: |
any |
Returns: |
The parameter data, otherwise None if the function failed. |
CAWeightMgr.
GetTagCount
(
doc
)
¶
Queries the number of weight tags for the passed document doc .
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | int |
Returns: | The weight tags count. |
CAWeightMgr.
GetJointCount
(
doc
,
tagIdx
)
¶
Queries the number of joints bound to a weight tag.
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The joints count. |
CAWeightMgr.
GetTagIndex
(
doc
,
tag
)
¶
Finds a tag’s index in the joint list.
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The tag’s index in the list, or NOTOK / -1 if not found. |
CAWeightMgr.
GetJointIndex
(
doc
,
tag
,
joint
)
¶
Finds a joint’s main (tag) and sub (joint) indices in the joint list.
Note
The joint index might not match the joint index on the tag. It is not recommended to keep indices over time, some operations might change the list ordering or length. Only the Ids to reference joints can be kept over time.Parameters: |
|
---|---|
Return type: |
tuple(int, int) |
Returns: |
The tag’s index in the joint list, or NOTOK / -1 if not found, and the joint’s index in the joint list, or NOTOK / -1 if not found. |
CAWeightMgr.
GetJointId
(
doc
,
tag
,
joint
)
¶
Returns the unique Id of a joint. This Id remains valid even if the joint list changes or if undo/redo is used.
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The joint unique Id, or sys.maxsize if not found. |
CAWeightMgr.
GetJointObject
(
doc
[
,
tagIdx
,
jointIdx][joinId
]
)
¶
Finds a joint object from its indices or Id in the joint list.
Parameters: |
|
---|---|
Return type: | |
Returns: |
The joint object, or None if not found. |
CAWeightMgr.
GetWeightTag
(
doc
,
tagIdx
)
¶
Finds a weight tag from its index in the joint list.
Parameters: |
|
---|---|
Return type: | |
Returns: |
The weight tag, or None if not found. |
CAWeightMgr.
GetMeshObject
(
doc
,
tagIdx
)
¶
Finds the object owning the weight tag from a tag index in the joint list.
Parameters: |
|
---|---|
Return type: | |
Returns: |
The mesh object, or None if not found. |
CAWeightMgr.
ValidateJointIndex
(
doc
,
tagIdx
,
jointIdx
)
¶
Validates tag and joint indices before access.
Warning
Call before functions that require tag and joint indices to avoid crashes.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if tag and joint indices are valid, otherwise False . |
CAWeightMgr.
IsJointSelected
(
doc
[
,
tagIdx
,
jointIdx][jointId
]
)
¶
Checks if a joint of the Weight Manager list is selected.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the joint was found and is selected, otherwise False . |
CAWeightMgr.
SelectJoint
(
doc
[
,
tagIdx
,
jointIdx][jointId
]
)
¶
Selects a joint of the Weight Manager list.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the joint was selected, otherwise False . |
CAWeightMgr.
UnselectJoint
(
doc
[
,
tagIdx
,
jointIdx][jointId
]
)
¶
Deselects a joint of the Weight Manager list.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the joint was deselected, otherwise False . |
CAWeightMgr.
SelectAllJoints
(
doc
)
¶
Selects all joints of all tags in the Weight Manager list.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|
CAWeightMgr.
UnselectAllJoints
(
doc
)
¶
Deselects all joints of all tags in the Weight Manager list.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|
CAWeightMgr.
UnselectAllJointListNodes
(
doc
)
¶
Deselects all of the nodes in the Weight Manager joint list. This includes all type of nodes (mesh/tag/folder/joint).
Note
The CAWeightMgr API does not allow selecting/deselecting mesh and tags at the moment. As a parent mesh, tag, or folder activates the child joints for painting, call this function to get rid of any mesh/tag that could have been already selected.Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|
CAWeightMgr.
IsJointLocked
(
doc
[
,
tagIdx
,
jointIdx][jointId
]
)
¶
Checks if a joint of the Weight Manager list is locked.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the joint was found and is locked, otherwise False . |
CAWeightMgr.
LockAllJoints
(
doc
)
¶
Locks all joints of all tags in the Weight Manager list.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if all joints got locked, otherwise False . |
CAWeightMgr.
LockSelectedJoints
(
doc
)
¶
Locks selected joints in the Weight Manager list.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
CAWeightMgr.
UnlockAllJoints
(
doc
)
¶
Unlocks all joints of all tags in the Weight Manager list.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
CAWeightMgr.
UnlockSelectedJoints
(
doc
)
¶
Unlocks selected joints in the Weight Manager list.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
CAWeightMgr.
NormalizeWeights
(
doc
)
¶
Applies a normalization on the selected joints. Some joints can be locked prior to normalization to avoid touching some joints.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
CAWeightMgr.
ClearWeights
(
doc
)
¶
Clears all weights on the selected joints.
Note
Adds an undo.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
CAWeightMgr.
AutoWeight
(
doc
[
,
allowNull=True
]
)
¶
Note
Adds an undo.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
CAWeightMgr.
MirrorWeights
(
doc
)
¶
Note
Adds an undo.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
CAWeightMgr.
BakeWeights
(
doc
,
normalize
)
¶
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
CAWeightMgr.
CopyWeights
(
doc
)
¶
Copies the weights of the selected joints into the weights clipboard.
Note
Document must be in either point, edge or polygon edit mode. If no selection is present on the mesh, all the point are copied, otherwise only the selected points are copied.Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
CAWeightMgr.
PasteWeights
(
doc
,
merge
)
¶
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
CAWeightMgr.
FlipWeights
(
doc
)
¶
Flips the weights of the selected joints. Each joint is flipped on itself using the local axis specified in Weight Manager container.
Note
Both zero and non zero weights are flipped.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
CAWeightMgr.
SmoothWeights
(
doc
)
¶
Parameters: | doc ( c4d.documents.BaseDocument ) – The document for the Weight Manager. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise True . |
CAWeightMgr.
ApplyWeightFunction
(
doc
[
,
allPoints=False
]
)
¶
Note
The point selection is fetched from the actual component mode or from point mode if the document is not in component mode.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |