About
The CAWeightMgr class represents the Weight Manager dialog window and its functionality. It gives access to the displayed tags (of type CAWeightTag ) and joints.
Settings
The settings presented by the Weight Manager dialog are stored with the BaseDocument . They can be safely accessed with these functions:
The setting IDs are defined in oweightmgr.h
.
Update
The CAWeightMgr class accesses an internal cache. This internal cache is automatically updated if the Weight Manger window is opened or the weight tool is active. If this is not the case the internal cache must be updated manually to handle scene changes.
if (wTag == nullptr )
if (sObject == nullptr )
const Int jointCount = joints.GetCount();
for (
Int i = 0; i < jointCount; ++i)
{
}
Weight Tags
The Weight Manager dialog displays the joints of multiple (selected) weight tags.
if (tagCount == 0)
for (
Int32 tagIndex = 0; tagIndex < tagCount; ++tagIndex)
{
if (tag == nullptr )
if (hostObject == nullptr )
}
Joints
Each CAWeightTag stores weights for joints. These joints are displayed in the Weight Manager dialog.
for (
Int32 i = 0; i < jointCount; ++i)
{
if (joint == nullptr )
}
Selection
It is possible to select joint objects in the Weight Manager. Several operations only apply to such selected objects.
The selection state of all joint objects can easily be managed with:
if (objects == nullptr )
{
if (joint == nullptr )
{
{
}
}
}
Locked
The Weight Manager can lock a joint object to prevent unintended changes.
The lock state of all joint objects can be managed with:
for (
Int32 i = 0; i < jointCount; ++i)
{
{
}
}
Functions
The weight algorithms are edited with these static functions:
Note The auto weight algorithm IDs are defined in maxon/autoweight.h , the settings in maxon/autoweight_attributes.h .
Several weight tools of the Weight Manager can be invoked with dedicated functions. These functions add an undo step.
Note The functions take the selection state of a joint object into account.
Copy and paste functions are:
const maxon::Id targetMode = maxon::AutoWeightAlgos::BoneglowClass().GetId();
data.Set(maxon::ANIMATION::AUTOWEIGHT::BONEGLOW::USEVISIBILITY,
true )
iferr_return ;
data.Set(maxon::ANIMATION::AUTOWEIGHT::BONEGLOW::VISIBILITYRATIO, 0.3_f)
iferr_return ;
Further Reading
#define Oskin
Skin deformer.
Definition: ge_prepass.h:1037
Bool GetBit(Int32 mask) const
Definition: c4d_baselist.h:2236
void InsertObject(BaseObject *op, BaseObject *parent, BaseObject *pred, Bool checknames=false)
maxon::Int Int
Definition: ge_sys_math.h:64
Int32 AddJoint(BaseObject *op)
Definition: c4d_baseobject.h:224
@ ID_CA_WEIGHT_MGR_AUTOWEIGHT_MODE
Definition: oweightmgr.h:151
static BaseObject * GetMeshObject(BaseDocument *doc, Int32 tagIdx)
int64_t Int64
64 bit signed integer datatype.
Definition: apibase.h:176
static maxon::Result< maxon::DataDictionary > GetAutoWeightDictionary(BaseDocument *doc, const maxon::Id &autoweightId)
Int32 GetCount() const
Definition: c4d_baselist.h:1648
Definition: apibaseid.h:250
#define iferr_return
Definition: resultbase.h:1465
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:66
static Bool IsJointLocked(BaseDocument *doc, Int32 tagIdx, Int32 jointIdx)
void SetActiveTag(BaseTag *tag, Int32 mode=0)
static void SelectAllJoints(BaseDocument *doc)
@ ID_CA_WEIGHT_MGR_DISPLAY_POINTS
Definition: oweightmgr.h:50
static Bool Update(BaseDocument *doc)
#define BIT_ACTIVE
Active.
Definition: ge_prepass.h:844
static Bool AutoWeight(BaseDocument *doc)
static maxon::Result< void > SetAutoWeightDictionary(BaseDocument *doc, maxon::DataDictionary dataDictionary, maxon::Id autoweightId)
static Int32 GetJointCount(BaseDocument *doc, Int32 tagIdx)
static maxon::Result< Int > GetAutoWeightAlgoIndex(BaseDocument *doc, const maxon::Id &id)
static Bool UnlockAllJoints(BaseDocument *doc)
Definition: apibasemath.h:53
static Bool SetParameter(BaseDocument *doc, Int32 id, const GeData &newValue)
static UInt64 GetJointId(BaseDocument *doc, const CAWeightTag *tag, const BaseObject *joint)
void GetActiveObjects(AtomArray &selection, GETACTIVEOBJECTFLAGS flags) const
@ ID_CA_WEIGHT_MGR_DISPLAY_ALL_WEIGHTS
Definition: oweightmgr.h:48
Definition: c4d_gedata.h:82
Definition: c4d_baselist.h:1360
maxon::Int32 Int32
Definition: ge_sys_math.h:60
static BaseObject * GetJointObject(BaseDocument *doc, Int32 tagIdx, Int32 jointIdx)
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:208
static Bool SelectJoint(BaseDocument *doc, Int32 tagIdx, Int32 jointIdx)
static void UnselectAllJoints(BaseDocument *doc)
TYPE * Release()
Definition: ge_autoptr.h:120
Definition: ge_autoptr.h:36
@ CHILDREN
Child objects are added to the selection too, provided they are selected. Otherwise only the topmost ...
void SetInt64(const Int64 &v)
Definition: c4d_gedata.h:579
Bool IsInstanceOf(Int32 id) const
Definition: c4d_baselist.h:1402
String GetName() const
Definition: c4d_baselist.h:2347
static CAWeightTag * GetWeightTag(BaseDocument *doc, Int32 tagIdx)
static Bool LockSelectedJoints(BaseDocument *doc)
@ ID_CA_WEIGHT_MGR_ENABLE_DISPLAY
Definition: oweightmgr.h:51
void InsertTag(BaseTag *tp, BaseTag *pred=nullptr)
maxon::UInt64 UInt64
Definition: ge_sys_math.h:63
#define SELECTION_NEW
Starts a new selection.
Definition: c4d_basedocument.h:382
static Int32 GetTagCount(BaseDocument *doc)
#define Ojoint
Joint.
Definition: ge_prepass.h:1036
C4DAtom * GetIndex(Int32 idx) const
Definition: c4d_baselist.h:1663