About
A morph can use the mixing mode "Correctional PSD" (Pose Space Deformation). A CAReferencePSD object allows accessing the related data. The class is defined in the lib_ca.h header file.
Access
The CAReferencePSD object is obtained from the CAMorphNode object, see CAMorphNode Points.
    
 
    
 
    
    {
      
      CAReferencePSD* const psd = mnode->GetPSDReference();
 
      if (psd)
      {
        
        const Int32 controllerCount = psd->GetExternalControllerCount();
 
 
        for (
Int32 controllerIndex = 0; controllerIndex < controllerCount; ++controllerIndex)
 
        {
          BaseObject* const controller = psd->GetExternalController(controllerIndex);
          if (controller == nullptr)
 
        }
      }
    }
    
ALL
Filter for all types.
Definition: asset_browser.h:0
CAMORPH_MODE_FLAGS
Definition: lib_ca.h:849
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
AUTO
Definition: lib_birender.h:1
POINTS
Points morphing.
Definition: lib_ca.h:3
EXPAND
Expand data. Needs to be passed before accessing any data.
Definition: lib_ca.h:1
ABS
Absolute morph data.
Definition: lib_ca.h:0
COLLAPSE
Collapse data. Needs to be passed to collapse the expanded data, for instance after data access.
Definition: lib_ca.h:0
maxon::Int32 Int32
Definition: ge_sys_math.h:51
Interpolation
For auto-weighting an interpolation mode is used:
- CAReferencePSD::GetInterpolationMode(): Returns the interpolation mode.
- CAReferencePSD::SetInterpolationMode(): Sets the interpolation mode.
The modes are:
        
        
 
 
CAMORPH_PSDINTERPOLATION_MODE
Definition: lib_ca.h:908
JOINT
Per joint interpolation (joint axis average).
Definition: lib_ca.h:1
AXIS
Per joint axis.
Definition: lib_ca.h:0
Driver
The joints referenced in the used weight tag can be forced to work as drivers for the PSD.
- CAReferencePSD::IsJointForcedAsDriver(): Checks if the joint with the given index is forced as a driver.
- CAReferencePSD::ForceJointAsDriver(): Forces the joint with the given index as a driver.
- CAReferencePSD::ClearAllForcedDrivers(): Clears all forced drivers.
        
        
 
        GeData data;
 
        C4DAtom* 
const wTag = data.GetLinkAtom(doc, 
Tweights);
        if (wTag)
        {
          CAWeightTag* const weightTag = static_cast<CAWeightTag*>(wTag);
 
          const Int32 jointCount = weightTag->GetJointCount();
 
 
          for (
Int32 jointIndex = 0; jointIndex < jointCount; ++jointIndex)
 
          {
            psd->ForceJointAsDriver(jointIndex, true);
          }
        }
NONE
Definition: asset_browser.h:1
#define Tweights
Weights.
Definition: ge_prepass.h:1463
#define ConstDescID(...)
Definition: lib_description.h:596
@ ID_CA_POSE_WEIGHTTAG_UI_ONLY
Definition: tcaposemorph.h:54
Pose
The PSD is based on a skeleton reference pose.
- CAReferencePSD::RestoreReferencePose(): Restores the reference pose.
- CAReferencePSD::UpdateReferencePose(): Uses the current pose as the reference.
      
 
      
      CAReferencePSD* const psd = mnode->GetPSDReference();
 
      if (psd)
      {
        psd->RestoreReferencePose();
      }
Controllers
Non-joint objects can also be used as controllers.
- CAReferencePSD::GetExternalControllerCount(): Returns the number of external controllers.
- CAReferencePSD::GetExternalController(): Returns the external controller for the given index.
- CAReferencePSD::GetExternalControllerMatrix(): Returns the matrix stored for the controller of the given index.
- CAReferencePSD::SetExternalControllerMatrix(): Sets the matrix stored for the controller of the given index.
- CAReferencePSD::RemoveExternalController(): Removes the external controller at the given index.
- CAReferencePSD::ClearAllExternalControllers(): Removes all external controllers.
      
      
 
      
      CAReferencePSD* const psd = mnode->GetPSDReference();
 
      if (psd)
      {
        AutoAlloc<AtomArray> objects;
        if (objects)
        {
          
 
          
          const Int32 objectCount = objects->GetCount();
 
          for (
Int32 i = 0; i < objectCount; ++i)
 
          {
            C4DAtom* const    atom = objects->GetIndex(i);
            BaseObject* const baseObject = static_cast<BaseObject*>(atom);
 
            
            if (baseObject && !baseObject->IsInstanceOf(
Ojoint))
 
            {
              
              const Matrix mg = baseObject->GetMg();
 
              psd->SetExternalControllerMatrix(baseObject, mg);
            }
          }
        }
      }
#define Ojoint
Joint.
Definition: ge_prepass.h:1098
maxon::Mat3< maxon::Vector64 > Matrix
Definition: ge_math.h:159
Further Reading