AutoWeightInterface Implementation

About

maxon::AutoWeightInterface is the base interface for custom auto-weight algorithms. These algorithms are displayed in the Weight Manager an can be used with the CAWeightMgr class (see CAWeightMgr Manual).

AutoWeightInterface

The maxon::AutoWeightInterface allows to implement these methods:

Existing functionality (normalizing and smoothing) can be included by using the existing component maxon::AutoWeightComponents::BaseClass.

// This example shows an implementation of AutoWeightInterface.
class ExampleAutoWeightImpl : public maxon::Component<ExampleAutoWeightImpl, maxon::AutoWeightInterface>
{
MAXON_COMPONENT(NORMAL, maxon::AutoWeightComponents::BaseClass);
public:
{
// get parameters
const maxon::Bool boolValue = self.GetOrDefault(maxonexample::ANIMATION::AUTOWEIGHT::EXAMPLE::ATTRIBUTE);
const maxon::Float floatvalue = self.GetOrDefault(maxonexample::ANIMATION::AUTOWEIGHT::EXAMPLE::OTHER_ATTRIBUTE);
DiagnosticOutput("Values: @, @", boolValue, floatvalue);
// resize weights array
const maxon::Int jointCnt = autoWeightPointJointSelections._jointCount;
weights.Resize(jointCnt) iferr_return;
for (maxon::Int jointIndex = 0; jointIndex < jointCnt; ++jointIndex)
{
weights[jointIndex].Resize(autoWeightPointJointSelections._pointCount) iferr_return;
}
// calculate weights
return maxon::OK;
}
};
MAXON_COMPONENT_CLASS_REGISTER(ExampleAutoWeightImpl, maxon::AutoWeightAlgos, "net.maxonexample.animation.autoweight.example");

Description

The custom description of the implementation must include "net.maxon.animation.autoweight.base". The name of the implementation is set using "net.maxon.object.base.name".

Further Reading

maxon::ComponentWithBase
Definition: objectbase.h:2439
maxon::AutoWeightPointJointSelections::_pointCount
Int32 _pointCount
The lock joint selection.
Definition: autoweight.h:31
MAXON_COMPONENT
#define MAXON_COMPONENT(KIND,...)
Definition: objectbase.h:2014
maxon::OK
return OK
Definition: apibase.h:2490
maxon::Bool
bool Bool
boolean type, possible values are only false/true, 8 bit
Definition: apibase.h:177
iferr_return
#define iferr_return
Definition: resultbase.h:1434
MAXON_COMPONENT_CLASS_REGISTER
#define MAXON_COMPONENT_CLASS_REGISTER(C,...)
Definition: objectbase.h:2208
maxon::Float
Float64 Float
Definition: apibase.h:193
maxon::BaseArray
Definition: basearray.h:366
maxon::AutoWeightAlgos
Definition: autoweight.h:105
DiagnosticOutput
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:168
maxon::Result< void >
MAXON_METHOD
#define MAXON_METHOD
Definition: interfacebase.h:845
maxon::Int
Int64 Int
signed 32/64 bit int, size depends on the platform
Definition: apibase.h:184
iferr_scope
#define iferr_scope
Definition: resultbase.h:1343
maxon::AutoWeightPointJointSelections
Definition: autoweight.h:25
SCULPTBRUSHMODE::NORMAL
@ NORMAL
Samples the surface as the user moves over it the SculptObject and returns a new hit point and normal...
PolygonObject
Definition: c4d_baseobject.h:1581
BaseDocument
Definition: c4d_basedocument.h:479
maxon::AutoWeightPointJointSelections::_jointCount
Int32 _jointCount
The amount of points in the mesh.
Definition: autoweight.h:32