Reordering function for the calculation order of models

Updated: 04/02/2026

Starting with the Cubism 5.3 SDK for Native R5 official version and for Web R5 official version, it is now possible to easily change the calculation order of models.

The main modifications include transferring the processing performed by the SetupModel() and Update() functions in the LAppModel class in the Sample to the Motion hierarchy in the Framework for each class.

The SetupModel() function in the LAppModel class in the Sample calls each class in the Framework/Motion, and the Update() function calls the update process in a batch to execute the conventional process.

The processing order is defined in CubismUpdateOrder of the Framework/Motion/ICubismUpdater class.

In addition, with the transfer to the Framework, input values and target parameters are now variable when used in the function for updating parameters via drag operations and its name was changed from Drag to Look.

Internal processing of Cubism Framework

This is the Framework’s internal process for determining the order of model calculations.
The process is as follows.

At model initialization, an instance of the ICybismUpdater derived class corresponding to each function (EyeBlink, Expression, Breath, Physics, LipSync, Pose, and Look) is created and registered with CubismUpdateScheduler::AddUpdatableList().
After registration is complete, CubismUpdateScheduler::SortUpdatableList() is called to reorder the list in order of execution.

void CubismUpdateScheduler::AddUpdatableList(ICubismUpdater* updatable)
{
    _cubismUpdatableList.PushBack(updatable);
    _needsSort = true;
}

void CubismUpdateScheduler::SortUpdatableList()
{
    csmVectorSort::MergeSort(_cubismUpdatableList.Begin(), _cubismUpdatableList.End(), ICubismUpdater::SortFunction);
    _needsSort = false;
}

CubismUpdateScheduler::OnLateUpdate() is called at frame update. The scheduler sorts the registered update classes in ascending order of the registered calculation order and executes each OnLateUpdate() sequentially to update the model parameters.

void CubismUpdateScheduler::OnLateUpdate(CubismModel* model, const csmFloat32 deltaTimeSeconds)
{
    if (_needsSort)
    {
        SortUpdatableList();
    }


    for (csmUint32 i = 0; i < _cubismUpdatableList.GetSize(); ++i)
    {
        _cubismUpdatableList[i]->OnLateUpdate(model, deltaTimeSeconds);
    }
}

The order of calculation is defined by the CubismUpdateOrder enumerator. The smaller the number, the earlier the calculation is executed.

enum CubismUpdateOrder
{
    CubismUpdateOrder_EyeBlink = 200,
    CubismUpdateOrder_Expression = 300,
    CubismUpdateOrder_Look = 400,
    CubismUpdateOrder_Breath = 500,
    CubismUpdateOrder_Physics = 600,
    CubismUpdateOrder_LipSync = 700,
    CubismUpdateOrder_Pose = 800,
    CubismUpdateOrder_Max = INT_MAX
};

You can also set the desired numbers in the constructor of the ICybismUpdater derived class.

Was this article helpful?
YesNo
Please let us know what you think about this article.