Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [4-r.1-beta.2] - 2023-01-26

### Added

* Add a description of type package to `README.md`.

### Changed

* Change Android SDK API level from 31 (Android 12) to 33 (Android 13).
* Change the name and package of the `CubismRectangle` class to `type/csmRect` to match SDK for Native.
* Move constants related to debugging from `CubismFramework` class to the newly created `CubismFrameworkConfig` class.
* Change implementation to hide `CubismJsonString` from shallow layers. The following functions are affcted by this change.
* `getLayoutMap` function in `ICubismModelSetting` class
* `getLayoutMap` function in `CubismModelSettingJson` class
* `setupFromLayout` function in `CubismModelMatrix` class
* Change the name and arguments of `createRenderer` function in `CubismUserModel`.
* The `RendererType` enumurator is abolished. Please generate a renderer you want to use by yourself and put it in the function as an argument.

### Fixed

* Fix JSON data parsing process to improve performance.
* Fix a problem where `setClippingMaskBufferSize` in `CubismRendererAndroid` would be thrown a `NullPointerException` if there are no clipping masks in the model.

### Removed

* Remove dependencies not to be used.
* Remove the unused method `getMotionMap` in `ICubismModelSetting` and `CubismModelSettingJson` class.

## [4-r.1-beta.1] - 2022-12-08

### Added
Expand Down Expand Up @@ -32,4 +60,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

* New released!

[4-r.1-beta.2]: https://github.com/Live2D/CubismJavaFramework/compare/4-r.1-beta.1...4-r.1-beta.2
[4-r.1-beta.1]: https://github.com/Live2D/CubismJavaFramework/compare/4-r.1-alpha.1...4-r.1-beta.1
4 changes: 4 additions & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ Cubism SDK frameworkに関連する例外クラス群を提供します。

各種プラットフォームでモデルを描画するためのグラフィックス命令を実装したレンダラを提供します。

### type

本フレームワーク内で使用する基本的な型をクラスとして定義したものを提供します。

### utils

JSON パーサーやログ出力などのユーティリティ機能を提供します。
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ Provides functions for applying transformation manipulations due to physics to t

Provides a renderer that implements graphics instructions for drawing the model on various platforms.

### type

Provides classes that are defined from the basic types used within this framework.

### utils

Provides utility functions such as JSON parser and log output.
Expand Down
9 changes: 3 additions & 6 deletions framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ plugins {
}

android {
compileSdkVersion 31
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()

defaultConfig {
minSdkVersion 16
targetSdk 31
minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION
versionCode 1
versionName "1.0"

Expand All @@ -32,7 +32,4 @@ dependencies {

testImplementation 'junit:junit:4.13.2'
testImplementation 'commons-io:commons-io:2.11.0'

androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import com.live2d.sdk.cubism.core.CubismCoreVersion;
import com.live2d.sdk.cubism.core.ICubismLogger;
import com.live2d.sdk.cubism.core.Live2DCubismCore;
import com.live2d.sdk.cubism.framework.CubismFrameworkConfig.LogLevel;
import com.live2d.sdk.cubism.framework.id.CubismIdManager;
import com.live2d.sdk.cubism.framework.rendering.android.CubismRendererAndroid;
import com.live2d.sdk.cubism.framework.utils.CubismDebug;

import java.util.Locale;

Expand All @@ -29,46 +29,6 @@ public class CubismFramework {
* Inner class that define optional elements to be set in CubismFramework.
*/
public static class Option {
/**
* Log output level
*/
public enum LogLevel {
/**
* Detailed log
*/
VERBOSE(0),
/**
* Debug log
*/
DEBUG(1),
/**
* Info log
*/
INFO(2),
/**
* Warning log
*/
WARNING(3),
/**
* Error log
*/
ERROR(4),
/**
* Log output disabled.
*/
OFF(5);

private final int id;

LogLevel(final int id) {
this.id = id;
}

public int getId() {
return id;
}
}

/**
* Set the log output function.
*
Expand Down Expand Up @@ -101,20 +61,6 @@ public void setLogFunction(ICubismLogger logger) {
*/
public static final int VERTEX_STEP = 2;

/**
* The default logging level used in CubismFramework.
* <p>
* Activate this constant when forcibly changing the log output level.
* Select LogLevel.VERBOSE to LogLevel.OFF in this CubismFramework class's internal class "Option".
* </p>
*/
public static final Option.LogLevel CSM_LOG_LEVEL = Option.LogLevel.VERBOSE;

/**
* Enable/Disable debugging in this Framework.
*/
public static final boolean CSM_DEBUG = true;


/**
* Enable Cubism Framework API.
Expand Down Expand Up @@ -142,7 +88,7 @@ public static boolean startUp(final Option option) {
// Display the version information of Live2D Cubism Core.
final CubismCoreVersion version = Live2DCubismCore.getVersion();

CubismDebug.cubismLogInfo(String.format(Locale.US, "Live2D Cubism Core version: %02d.%02d.%04d (%d)", version.getMajor(), version.getMinor(), version.getPatch(), version.getVersionNumber()));
cubismLogInfo(String.format(Locale.US, "Live2D Cubism Core version: %02d.%02d.%04d (%d)", version.getMajor(), version.getMinor(), version.getPatch(), version.getVersionNumber()));

cubismLogInfo("CubismFramework.startUp() is complete.");

Expand Down Expand Up @@ -246,11 +192,11 @@ public static void coreLogFunction(final String message) {
*
* @return the current value of log output level setting
*/
public static Option.LogLevel getLoggingLevel() {
public static LogLevel getLoggingLevel() {
if (s_option != null) {
return s_option.loggingLevel;
}
return Option.LogLevel.OFF;
return LogLevel.OFF;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.live2d.sdk.cubism.framework;

/**
* CubismFrameworkで使用される定数の定義クラス。<br>
* デバッグやログに関わる設定をデフォルトから変更したい場合は、このクラスの定数の値を書き換えること。
*/
public class CubismFrameworkConfig {
/**
* ログ出力レベルを定義する列挙体。
*/
public enum LogLevel {
/**
* 詳細ログ出力設定
*/
VERBOSE(0),
/**
* デバッグログ出力設定
*/
DEBUG(1),
/**
* Infoログ出力設定
*/
INFO(2),
/**
* 警告ログ出力設定
*/
WARNING(3),
/**
* エラーログ出力設定
*/
ERROR(4),
/**
* ログ出力オフ設定
*/
OFF(5);

private final int id;

LogLevel(final int id) {
this.id = id;
}

public int getId() {
return id;
}
}

/**
* Cubism SDKにおけるデバッグ機能の有効状態。trueなら有効。
*/
public static final boolean CSM_DEBUG = true;

/**
* ログ出力設定。<br>
* 強制的にログ出力レベルを変える時に定義を有効にする。
*
* @note LogLevel.VERBOSE ~ LogLevel.OFF のいずれかを指定する。
*/
public static final LogLevel CSM_LOG_LEVEL = LogLevel.VERBOSE;

/**
* privateコンストラクタ。
*
* @note 定数クラスのためインスタンス化させない
*/
private CubismFrameworkConfig() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public int getHitAreasCount() {
return 0;
}
return jsonFrequencyValue.get(FrequentNode.HIT_AREAS.id).size();

}

@Override
Expand Down Expand Up @@ -165,15 +164,6 @@ public String getMotionGroupName(int index) {
return jsonFrequencyValue.get(FrequentNode.MOTIONS.id).getKeys().get(index).getString();
}

@Override
public Map<CubismJsonString, ACubismJsonValue> getMotionMap() {
ACubismJsonValue jsonValue = jsonFrequencyValue.get(FrequentNode.MOTIONS.id);
if (jsonValue == null) {
return Collections.emptyMap();
}
return jsonValue.getMap();
}

@Override
public int getMotionCount(final String groupName) {
if (!existsMotionGroupName(groupName)) {
Expand Down Expand Up @@ -228,7 +218,7 @@ public String getUserDataFile() {
}

@Override
public boolean getLayoutMap(Map<CubismJsonString, Float> outLayoutMap) {
public boolean getLayoutMap(Map<String, Float> outLayoutMap) {
Map<CubismJsonString, ACubismJsonValue> map = json.getRoot().get(JsonKey.LAYOUT.key).getMap();

if (map == null) {
Expand All @@ -237,7 +227,7 @@ public boolean getLayoutMap(Map<CubismJsonString, Float> outLayoutMap) {

boolean result = false;
for (Map.Entry<CubismJsonString, ACubismJsonValue> entry : map.entrySet()) {
outLayoutMap.put(entry.getKey(), entry.getValue().toFloat());
outLayoutMap.put(entry.getKey().getString(), entry.getValue().toFloat());
result = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ public interface ICubismModelSetting {
*/
int getMotionCount(final String groupName);

Map<CubismJsonString, ACubismJsonValue> getMotionMap();

/**
* Get the name of the motion file from group name and index value.
*
Expand Down Expand Up @@ -190,7 +188,7 @@ public interface ICubismModelSetting {
*
* @return if layout information exists, return true
*/
boolean getLayoutMap(Map<CubismJsonString, Float> outLayoutMap);
boolean getLayoutMap(Map<String, Float> outLayoutMap);

/**
* Get the number of parameters associated to eye blink.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

package com.live2d.sdk.cubism.framework.math;

import com.live2d.sdk.cubism.framework.utils.jsonparser.CubismJsonString;

import java.util.Map;

/**
Expand Down Expand Up @@ -166,7 +164,7 @@ public void setY(float y) {
*
* @param layout layout information
*/
public void setupFromLayout(Map<CubismJsonString, Float> layout) {
public void setupFromLayout(Map<String, Float> layout) {
final String keyWidth = "width";
final String keyHeight = "height";
final String keyX = "x";
Expand All @@ -178,17 +176,17 @@ public void setupFromLayout(Map<CubismJsonString, Float> layout) {
final String keyLeft = "left";
final String keyRight = "right";

for (Map.Entry<CubismJsonString, Float> entry : layout.entrySet()) {
String key = entry.getKey().getString();
for (Map.Entry<String, Float> entry : layout.entrySet()) {
String key = entry.getKey();
if (key.equals(keyWidth)) {
setWidth(entry.getValue());
} else if (key.equals(keyHeight)) {
setHeight(entry.getValue());
}
}

for (Map.Entry<CubismJsonString, Float> entry : layout.entrySet()) {
String key = entry.getKey().getString();
for (Map.Entry<String, Float> entry : layout.entrySet()) {
String key = entry.getKey();
float value = entry.getValue();

if (key.equals(keyX)) {
Expand Down
Loading