About supplementary view files

Updated: 10/06/2022

This page is for Cubism version 4.2 or earlier. Click here for the latest version.

Summary

Starting with Cubism Editor 3.3.02 (released 04/23/2019), .cdi3.json can be exported when exporting models from the Cubism Editor.
.cdi3.json is a supplementary view file that contains information linking parameters, parameter groups, and part IDs and names.

Parameter names, parameter group names, and part names set in the Editor are not exported to moc3 because they are unnecessary items when handling models in the SDK.
However, if you want to display the names of the parameters, as in an application that allows users to directly manipulate model parameters, you can use .cdi3.json to obtain the names.

Contents Included in .cdi3.json

• Parameters
 • Parameter ID, parameter name (name displayed in the Editor), and ID of parameter group to which the parameter belongs
• ParameterGroups
 • Group ID, group name (name displayed in Editor), and ID of parameter group to which the group belongs
• Parts
 • Part ID, part name (name displayed in Editor)

Note: ID of the parameter group to which the parameter or group belongs:
 Parameter groups are represented as a tree structure in the Editor, but the structure in cdi stores data in a List structure.
 When working with parameter group tree structures in the SDK, this information must be used to restore the proper placement.
 If there is no parameter group to which the parameter or group belongs (the root of the tree structure in the Editor), this field will be left blank.

See CubismSpecs on GitHub for more information on the .cdi3.json specification.

Parsing of .cdi3.json uses CubismCdiJson class from Native’s CubismCdiJson.hpp or Java’s CubismCdiJson.java.
The Cubism SDK for Web has its own JSON parser, so users can use it to handle .cdi3.json implementations.

CubismCdiJson

Creating an instance

    CubismCdiJson* cdiJson = new CubismCdiJson(cdi3Json, size);
    CubismCdiJson cdiJson = CubismCdiJson.create();

Parameters

The API to obtain parameter-related information is as follows.

  • Native
    • Number of parameters: CubismCdiJson::GetParametersCount()
    • Parameter ID: CubismCdiJson::GetParametersId()
    • ID of the parameter group to which the parameter or group belongs: CubismCdiJson::GetParametersGroupId()
    • Parameter name: csmChar* CubismCdiJson::GetParametersName()
    // Total number of parameters
    csmInt32 parametersCount = cdiJson->GetParametersCount();
    
    for(int i = 0; i < parametersCount; i++)
    {
        // Parameter ID
        csmChar* parameterId = cdiJson->GetParametersId(i);
 
        // ID of the parameter group to which the parameter or group belongs
        csmChar* parentParameterGroupId = cdiJson->GetParametersGroupId(i);
 
        // Parameter name
        csmChar* parameterName = cdiJson->GetParametersName(i);
    }
  • Java
    • Number of parameters: CubismCdiJson.getParametersCount()
    • Parameter ID: CubismCdiJson.getParametersId()
    • ID of the parameter group to which the parameter belongs: CubismCdiJson.getParametersGroupId()
    • Parameter name: String CubismCdiJson.getParametersName()
    // Total number of parameters
    int parametersCount = cdiJson.getParametersCount();
 
    for (int i = 0; i < parametersCount; i++) {
        // Parameter ID
        String parameterId = cdiJson.getParametersId(i);
        // ID of the parameter group to which the parameter or group belongs
        String parentParameterGroupId = cdiJson.getParametersGroupId(i);
        // Parameter name
        String parameterName = cdiJson.getParametersName(i);
    }

ParameterGroups

The API to obtain parameter group-related information is as follows.

  • Native
    • Number of parameter groups: CubismCdiJson::GetParameterGroupsCount()
    • Parameter group ID: CubismCdiJson::GetParameterGroupsId()
    • Parameter group ID of the parent of the parameter group: CubismCdiJson::GetParameterGroupsGroupId()
    • Parameter group name: CubismCdiJson::GetParameterGroupsName()
    // Total number of parameter groups
    csmInt32 parameterGroupsCount = cdiJson->GetParameterGroupsCount();
    
    for(int i = 0; i < parameterGroupsCount; i++)
    {
        // Parameter group ID
        csmChar* parameterGroupId = cdiJson->GetParameterGroupsId(i);
 
        // ID of the parameter group to which the parameter or group belongs
        csmChar* parentParameterGroupId = cdiJson->GetParameterGroupsGroupId(i);
 
        // Parameter group name
        csmChar* parameterGroupName = cdiJson->GetParameterGroupsName(i);
    }
  • Java
    • Number of parameter groups: CubismCdiJson.getParameterGroupsCount()
    • Parameter group ID: CubismCdiJson.getParameterGroupsId()
    • Parameter group ID of the parent of the parameter group: CubismCdiJson.getParameterGroupsGroupId()
    • Parameter group name: CubismCdiJson.getParameterGroupsName()
    int parameterGroupsCount = cdiJson.getParameterGroupsCount();
 
    for (int i = 0; i < parameterGroupsCount; i++) {
        // Parameter group ID
        String parameterGroupId = cdiJson.getParameterGroupsId(i);
        // ID of the parameter group to which the parameter or group belongs
        String parentParameterGroupId = cdiJson.getParameterGroupsGroupId(i);
        // Parameter group name
        String parameterGroupName = cdiJson.getParameterGroupsName(i);
    }

Parts

The API to obtain parts-related information is as follows.

  • Native
    • Number of parts: CubismCdiJson::GetPartsCount()
    • Part ID: CubismCdiJson::GetPartsId()
    • Part name: CubismCdiJson::GetPartsName()
    // Total number of parts
    csmInt32 partsCount = cdiJson->GetPartsCount();
    
    for(int i = 0; i < partsCount; i++)
    {
        // Part ID
        csmChar* partId = cdiJson->GetPartsId(i);
 
        // Part name
        csmChar* partName = cdiJson->GetPartsName(i);
    }
  • Java
    • Number of parts: CubismCdiJson.getPartsCount()
    • Part ID: CubismCdiJson.getPartsId()
    • Part name: CubismCdiJson.getPartsName()
    // Total number of parts
    int partsCount = cdiJson.getPartsCount();
 
    for (int i = 0; i < partsCount; i++) {
        // Part ID
        String partId = cdiJson.getPartsId(i);
        // Part name
        String partName = cdiJson.getPartsName(i);
    }

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