Parameter repeat

Updated: 05/15/2025

You can use the Cubism 5 SDK R4 or later to obtain the parameter repeat ON/OFF setting made in the Cubism Editor.
See “Repeat” in the Editor Manual for the repeat settings in the Cubism Editor.
It is also possible to manipulate repeat settings from the SDK by coding as needed.

Summary

In the Cubism SDK, repeats are managed by the following flags:

  • Repeat status flag per parameter
  • Flag to overwrite repeat status flag per model
  • Repeat status flag when overwritten per model
  • Flag to overwrite repeat status flag per parameter
  • Repeat status flag when overwritten per parameter

Both of the following must be false in order for the SDK to reproduce parameter repeats set on the Cubism Editor.

  • Flag to overwrite repeat status flag per model
  • Flag to overwrite repeat status flag per parameter

However, to maintain compatibility with existing motions in the Cubism SDK, the initial value of the flag to overwrite the repeat status flag per model is set to true.

Procedure for reproducing parameter repeats set in the Cubism Editor

Overwrite flag setting for repeats per model

Set the overwrite flag for repeats per model to false. The default is true.
To reproduce the parameter repeats set in the Cubism Editor in the SDK, change the initialization settings of the member variables of the CubismModel class in the Framework.

Native

// C++
CubismModel::CubismModel(Core::csmModel* model)
    : _model(model)
...
    , _isOverriddenParameterRepeat(false)
...
{ }

Web

// TypeScript
   /**
   * Constructor
   * @param model Model
   */
  public constructor(model: Live2DCubismCore.Model) {
...
    this._isOverriddenParameterRepeat = false;
...
{ }

Java

// Java
/**
 * Model class created from Mclapoc data.
 */
public class CubismModel {
...
    private boolean isOverriddenParameterRepeat = false;
...
{ }

Unity

// C#

/// <summary>
/// Whether parameter repetition is performed for the entire model.
/// </summary>
[SerializeField]
private bool _isOverriddenParameterRepeat = false;

Unity also allows for the manipulation of the “Is Overridden Parameter Repeat” checkbox for CubismModel under Inspector.

To change the flag dynamically, use SetOverrideFlagForModelParameterRepeat(csmBool isRepeat) of the CubismModel class.

Native

// C++
model->GetModel()->SetOverrideFlagForModelParameterRepeat(false); // Overwrite flag for repeats per model

Web

// TypeScript
model.getModel().setOverrideFlagForModelParameterRepeat(false); // Overwrite flag for repeats per model

Java

// Java
model.getModel().setOverrideFlagForModelParameterRepeat(false); // Overwrite flag for repeats per model

As an example, the Cubism SDK for Native sample project defines the LAppModel class with CubismModel as the base class to manipulate models, and the model in the above code is the LAppModel class.
GetModel() is used as an intermediary to call functions of the CubismModel class from the LAppModel class.

Unity

// C#
cubismModel.SetOverrideFlagForModelParameterRepeat(false); // Overwrite flag for repeats per model

SDK for Unity uses void SetOverrideFlagForModelParameterRepeat(bool isRepeat) in the CubismModel component.

Procedure for controlling parameter repeats on a per-parameter basis with the SDK

The process is as follows.

  1. Overwrite flag setting per parameter
  2. Setting for parameter repeats per parameter

1. Overwrite flag setting per parameter

First, set the overwrite flag per parameter to true. The default is false.

Example

// C++
model->GetModel()->SetOverrideFlagForParameterRepeat(parameterIndex, true); // Set the overwrite flag for the specified parameter to true
// TypeScript
model.getModel().setOverrideFlagForParameterRepeat(parameterIndex, true); // Set the overwrite flag for the specified parameter to true
// Java
model.getModel().setOverrideFlagForParameterRepeat(parameterIndex, true); // Set the overwrite flag for the specified parameter to true

As an example, in Native the void SetOverrideFlagForParameterRepeat(csmInt32 parameterIndex, csmBool value) function is defined in the Framework’s CubismModel class.

In Unity, void SetRepeatFlagForParameterRepeat(bool value) is defined in the CubismParameter class.

// C#
cubismParameter.SetOverrideFlagForParameterRepeat(true); // Set the overwrite flag for the specified parameter to true

This also allows for the manipulation of the “Is Overridden” checkbox for CubismParameter under Inspector.

2. Parameter repeat setting per parameter

Set repeat to ON/OFF for each parameter.
This setting is enabled only when the overwrite flag per parameter is true.

Example

// C++
model->GetModel()->SetRepeatFlagForParameterRepeat(parameterIndex, true); // Set the repeating of the specified parameter to ON
// TypeScript
model.getModel().setRepeatFlagForParameterRepeat(parameterIndex, true); // Set the repeating of the specified parameter to ON
// Java
model.getModel().setRepeatFlagForParameterRepeat(parameterIndex, true); // Set the repeating of the specified parameter to ON
// C#
cubismParameter.SetRepeatFlagForParameterRepeat(true); // Set the repeating of the specified parameter to ON

SDK for Unity also allows for the manipulation of the “Is Parameter Repeated” checkbox for CubismParameter under Inspector.

Tips

If the flag for whether to overwrite the repeat status flag on a per model basis is enabled, the setting of the flag for whether to overwrite the repeat status flag on per parameter is ignored.

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