-
首页
-
C4D R23.110 C++ SDK
CAWeightMgr Class Reference
Library
»
Character Animation
#include <lib_ca.h>
详细描述
Represents the Weight Manager.
-
由于
-
R19
-
注意
-
Weight manager data and settings are per document. Any change on a document does not affect other opened documents.
Manager Update
|
static
Bool
|
更新
(
BaseDocument
*doc)
|
static
Bool
|
SetDirty
(
BaseDocument
*doc)
|
static
maxon::Result
<
Int
>
|
GetAutoWeightAlgoIndex
(
BaseDocument
*doc, const
maxon::Id
&id)
|
static
maxon::Result
<
maxon::Id
>
|
GetAutoWeightAlgoId
(
BaseDocument
*doc,
Int
index)
|
static
maxon::Result
< void >
|
GetAutoWeightRef
(
BaseDocument
*doc, const
maxon::Id
&autoweightId, maxon::AutoWeightRef &autoWeightRef)
|
static
maxon::Result
< maxon::DataDictionary >
|
GetAutoWeightDictionary
(
BaseDocument
*doc, const
maxon::Id
&autoweightId)
|
static
maxon::Result
< void >
|
SetAutoWeightDictionary
(
BaseDocument
*doc, maxon::DataDictionary dataDictionary,
maxon::Id
autoweightId)
|
static
Bool
|
SetParameter
(
BaseDocument
*doc,
Int32
id, const
GeData
&newValue)
|
static
Bool
|
GetParameter
(
BaseDocument
*doc,
Int32
id,
GeData
&value)
|
List Access
|
static
Int32
|
GetTagCount
(
BaseDocument
*doc)
|
static
Int32
|
GetJointCount
(
BaseDocument
*doc,
Int32
tagIdx)
|
static
Int32
|
GetTagIndex
(
BaseDocument
*doc, const
CAWeightTag
*tag)
|
static
Bool
|
GetJointIndex
(
BaseDocument
*doc, const
CAWeightTag
*tag, const
BaseObject
*joint,
Int32
&tagIdx,
Int32
&jointIdx)
|
static
UInt64
|
GetJointId
(
BaseDocument
*doc, const
CAWeightTag
*tag, const
BaseObject
*joint)
|
static
BaseObject
*
|
GetJointObject
(
BaseDocument
*doc,
Int32
tagIdx,
Int32
jointIdx)
|
static
BaseObject
*
|
GetJointObject
(
BaseDocument
*doc,
UInt64
id)
|
static
CAWeightTag
*
|
GetWeightTag
(
BaseDocument
*doc,
Int32
tagIdx)
|
static
BaseObject
*
|
GetMeshObject
(
BaseDocument
*doc,
Int32
tagIdx)
|
static
Bool
|
ValidateJointIndex
(
BaseDocument
*doc,
Int32
tagIdx,
Int32
jointIdx)
|
构造函数 & 析构函数文档编制
◆
CAWeightMgr()
◆
~CAWeightMgr()
成员函数文档编制
◆
Update()
Updates the internal weighted object list.
Call before using other methods of
CAWeightMgr
if the Weight Manager dialog is closed and if the weight tool is inactive. Any of the two condition is enough to have the update run automatically each frame.
Also call if the weighted object list was changed programmatically. For instance after adding a new tag, performing undo redo, or any reason where an update is needed immediately.
-
注意
-
Update has no effect if nothing dirty is detected. Call
EventAdd()
to refresh the Weight Manager UI to show the updated changes.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
SetDirty()
Sets the Weight Manager dirty to force an update on the next call to
Update()
.
If the Weight Manager dialog is opened or if the Weight Manager is active, the update happens automatically at the next frame.
To force an update after a parameter change, use
SetDirty()
, then call
Update()
. Call
SetDirty()
if a Weight Manager's parameter was directly modified in its container.
-
注意
-
Call
EventAdd()
to refresh the Weight Manager UI to show the updated changes.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetAutoWeightAlgoIndex()
Get the AutoWeightRef algorithm's index associated with the given id.
-
参数
-
[in]
|
doc
|
The active document.
|
[in]
|
id
|
The autoweight id.
|
-
返回
-
The index of the autoweight id.
◆
GetAutoWeightAlgoId()
Get the AutoWeightRef algorithm's id associated with the given index.
-
参数
-
[in]
|
doc
|
The active document.
|
[in]
|
index
|
The autoweight int.
|
-
返回
-
The index of the autoweight id.
◆
GetAutoWeightRef()
Get the AutoWeightRef from the given id.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
..
|
[in]
|
autoweightId
|
The maxon id of the autoweight algorithm.
|
-
返回
-
OK on success.
◆
GetAutoWeightDictionary()
Get autoweight dictionary of the Weight Manager.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
..
|
[in]
|
autoweightId
|
The maxon id of the autoweight algorithm.
|
-
返回
-
The data dictionary with the autoweight parameters inside.
◆
SetAutoWeightDictionary()
Set autoweight dictionary of the Weight Manager.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
..
|
[in]
|
dataDictionary
|
The data dictionary with the autoweight parameters inside.
|
[in]
|
autoweightId
|
The maxon id of the autoweight algorithm.
|
-
返回
-
OK on success.
◆
SetParameter()
Sets a parameters of the Weight Manager.
Result is the same as setting a parameter on the Weight Manager's container directly except that
SetParameter()
allows to specify the document in which to set the parameter.
-
警告
-
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.
-
注意
-
Call
EventAdd()
to refresh the Weight Manager UI to show the updated changes.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
id
|
The ID of the parameter to set.
|
[in]
|
newValue
|
The parameter data to set.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetParameter()
Retrieves a parameter of the Weight Manager.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
id
|
The ID of the parameter to set.
|
[out]
|
value
|
The parameter data.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetTagCount()
Queries the number of weight tags in the scene.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
The weight tags count.
◆
GetJointCount()
Queries the number of joints bound to a weight tag.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
tagIdx
|
The tag index in the list:
0
<=
tagIdx
<
GetTagCount()
.
|
-
返回
-
The joints count.
◆
GetTagIndex()
Finds a tag's index in the joint list.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
tag
|
The weight tag to search for. The caller owns the pointed
CAWeightTag
.
|
-
返回
-
The tag's index in the list, or
NOTOK
if not found.
◆
GetJointIndex()
Finds a joint's main (tag) and sub (joint) indices in the joint list.
-
注意
-
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 IDs to reference joints can be kept over time.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
tag
|
The tag's address. The caller owns the pointed
CAWeightTag
.
|
[in]
|
joint
|
The joints's address. The caller owns the pointed
BaseObject
.
|
[out]
|
tagIdx
|
The tag's index in the joint list, or
NOTOK
if not found.
|
[out]
|
jointIdx
|
The joint's index in the joint list, or
NOTOK
if not found.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetJointId()
Returns the unique Id of a joint. This Id remains valid even if the joint list changes or if undo/redo is used.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
tag
|
The tag's address. The caller owns the pointed
CAWeightTag
.
|
[in]
|
joint
|
The joint's address. The caller owns the pointed
BaseObject
.
|
-
返回
-
The joint unique Id, or
maxon::LIMIT<UInt64>::MAX
if not found.
◆
GetJointObject()
[1/2]
Finds a joint object from its indices.
-
参数
-
[in]
|
doc
|
The doc containing the tag and joint. The caller owns the pointed
BaseDocument
.
|
[in]
|
tagIdx
|
The tag's index in the joint list.
|
[in]
|
jointIdx
|
The joint's index in the joint list.
|
-
返回
-
The joint object, or
nullptr
if not found. The
CAWeightMgr
owns the pointed
BaseObject
.
◆
GetJointObject()
[2/2]
Finds a joint object from its unique Id in the joint list.
-
参数
-
[in]
|
doc
|
The doc that contains the tag and joint. The caller owns the pointed
BaseDocument
.
|
[in]
|
id
|
The Id of the joint in the Weight Manager joint list.
|
-
返回
-
The joint object, or
nullptr
if not found. The
CAWeightMgr
owns the pointed
BaseObject
.
◆
GetWeightTag()
Finds a weight tag from its index in the joint list.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
tagIdx
|
The tag's index in the joint list.
|
-
返回
-
The weight tag, or
nullptr
if not found. The
CAWeightMgr
owns the pointed
CAWeightTag
.
◆
GetMeshObject()
Finds the object owning the weight tag from a tag index in the joint list.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
tagIdx
|
The tag's index in the joint list.
|
-
返回
-
The mesh object, or
nullptr
if not found. The
CAWeightMgr
owns the pointed
BaseObject
.
◆
ValidateJointIndex()
Validates tag/joint indices before access.
-
注意
-
Call before using functions that require tag/joint indices to avoid crashes.
-
参数
-
[in]
|
doc
|
The doc that contains the tags and joints. The caller owns the pointed
BaseDocument
.
|
[in]
|
tagIdx
|
The tag's index in the joint list.
|
[in]
|
jointIdx
|
The joint's index in the joint list.
|
-
返回
-
true
if tag and joint indices are valid, otherwise
false
.
◆
IsJointSelected()
[1/2]
Checks if a joint of the Weight Manager list is selected. Joint is identified by tag-joint index pair.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
tagIdx
|
The tag's index in the joint list.
|
[in]
|
jointIdx
|
The joint's index in the weight tag.
|
-
返回
-
true
if the joint was found and is selected, otherwise
false
.
◆
IsJointSelected()
[2/2]
Checks if a joint of the Weight Manager list is selected. Joint is identified by Id.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
id
|
The joint's Id.
|
-
返回
-
true
if the joint was found and is selected, otherwise
false
.
◆
SelectJoint()
[1/2]
Selects a joint of the Weight Manager list. Joint is identified by tag-joint index pair.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
tagIdx
|
The tag's index in the joint list.
|
[in]
|
jointIdx
|
The joint's index in the weight tag.
|
-
返回
-
true
if the joint was selected, otherwise
false
.
◆
SelectJoint()
[2/2]
Selects a joint of the Weight Manager list. Joint is identified by Id.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
id
|
The joint's Id.
|
-
返回
-
true
if the joint was selected, otherwise
false
.
◆
UnselectJoint()
[1/2]
Deselects a joint of the Weight Manager list. Joint is identified by tag-joint index pair.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
tagIdx
|
The tag's index in the joint list.
|
[in]
|
jointIdx
|
The joint's index in this tag.
|
-
返回
-
true
if the joint was deselected, otherwise
false
.
◆
UnselectJoint()
[2/2]
Deselects a joint of the Weight Manager list. Joint is identified by Id.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
id
|
The joint's Id.
|
-
返回
-
true
if the joint was deselected, otherwise
false
.
◆
SelectAllJoints()
Selects all joints of all tags in the Weight Manager list.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
◆
UnselectAllJoints()
Deselects all joints of all tags in the Weight Manager list.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
◆
UnselectAllJointListNodes()
Deselects all of the nodes in the Weight Manager joint list. This includes all type of nodes (mesh/tag/folder/joint).
-
注意
-
The API does not allow selecting/deselecting mesh and tags at the moment, so use this function to get rid of any mesh/tag that could have been already selected. Because a parent mesh, tag, or folder activates the child joints for painting.
-
参数
-
[in]
|
doc
|
The document in which to deselect all nodes. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
IsJointLocked()
[1/2]
Checks if a joint of the Weight Manager list is locked. Joint is identified by tag-joint index pair.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
tagIdx
|
The tag's index in the joint list.
|
[in]
|
jointIdx
|
The joint's index in the weight tag.
|
-
返回
-
true
if the joint was found and is locked, otherwise
false
.
◆
IsJointLocked()
[2/2]
Checks if a joint of the Weight Manager list is locked. Joint is identified by Id.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
id
|
The joint's id.
|
-
返回
-
true
if the joint was found and is locked, otherwise
false
.
◆
LockAllJoints()
Locks all joints of all tags in the Weight Manager list.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if all joints got locked, otherwise
false
.
◆
LockSelectedJoints()
Locks selected joints in the Weight Manager list.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
UnlockAllJoints()
Unlocks all joints of all tags in the Weight Manager list.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
UnlockSelectedJoints()
Unlocks selected joints in the Weight Manager list.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
NormalizeWeights()
Applies a normalization on the selected joints. Some joints can be locked prior to normalization to avoid touching some joints.
-
注意
-
Adds an undo.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
ClearWeights()
Clears all weights on the selected joints.
-
注意
-
Adds an undo.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
AutoWeight()
Runs an auto weight algorithm on the selected joints. Uses the parameters currently set in the Weight Manager's container for the document.
-
注意
-
Adds an undo.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
MirrorWeights()
Mirrors the weights for the selected joints. Uses the parameters currently set in the Weight Manager's container for the document.
-
注意
-
Adds an undo.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
BakeWeights()
Bakes the effector weights. Uses the parameters currently set in the Weight Manager's container for the document.
-
注意
-
Adds an undo.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
normalize
|
true
to normalize after bake operation, otherwise
false
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
CopyWeights()
Copies the weights of the selected joints into the weights clipboard.
-
注意
-
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.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
PasteWeights()
Pastes the copied weights on the selected joints. Uses the parameters currently set in the Weight Manager's container for the document.
-
注意
-
Adds an undo.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
merge
|
true
to merge with target weights,
false
to replace target weights:
-
true
adds the source weights to the target weights. For instance, source point with null weight does not affect the final result.
-
false
replaces all the target weights with the source weights including null source weights. For instance, all target weights are lost and replaced with source weights.
|
-
返回
-
true
if successful, otherwise
false
.
◆
FlipWeights()
Flips the weights of the selected joints. Each joint is flipped on itself using the local axis specified in Weight Manager container.
-
注意
-
Both zero and non zero weights are flipped.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
SmoothWeights()
Smooths the weights of the selected joints. Uses the parameters currently set in the Weight Manager's container for the document.
-
注意
-
Does not support use of the interactive mode smooth. Smooth always acts on all the points of the mesh.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
ApplyWeightFunction()
Applies the currently selected weighting function to the selected joints (add, smooth, remap etc.). Uses the parameters currently set in the Weight Manager's container for the document.
-
注意
-
The point selection is fetched from the actual component mode or from point mode if the document is not in component mode.
-
参数
-
[in]
|
doc
|
The document for the Weight Manager. The caller owns the pointed
BaseDocument
.
|
[in]
|
allPoints
|
true
to apply on all the points of the mesh,
false
to apply on point selection.
|
-
返回
-
true
if successful, otherwise
false
.