Skip to content

Commit 1038a3a

Browse files
Merge pull request #6 from Live2D/develop
Update to Cubism 4 SDK for Java R1
2 parents d583c92 + 0163379 commit 1038a3a

14 files changed

+767
-529
lines changed

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.
44

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

7+
## [4-r.1] - 2023-05-25
8+
9+
### Added
10+
11+
* Add some functions for checking consistency of MOC3 files.
12+
* Add the function of checking consistency in `CubismMoc.create()`.
13+
* Add the function of checking consistency before loading a model. (`CubismUserModel.loadModel()`)
14+
* Add some functions to change Multiply and Screen colors on a per part basis.
15+
16+
### Changed
17+
18+
* Change access modifiers for methods in `CubismExpressionMotion`. And also chenge it to non-final class, allowing it to be extended by inheritance.
19+
* Change to get opacity according to the current time of the motion.
20+
21+
### Fixed
22+
* Refactor codes of cacheing vertex information in renderer.
23+
* This change does not affect the behavior of this SDK.
24+
* Fix a crash when specifying the number of mask buffers as an integer less than or equal to 0 in the second argument of `setupRenderer` function in `CubismUserModel`.
25+
* Fix the redundant process regarding the renderer to make the code more concise.
26+
* Optimize a drawing process of clipping masks.
27+
* `CubismClippingManagerAndroid` class has a flag to indicate whether mask textures have been cleared or not, and the texture clearing process is only called if they have not been cleared.
28+
729
## [4-r.1-beta.4] - 2023-03-16
830

931
### Fixed
@@ -73,7 +95,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
7395

7496
* New released!
7597

76-
98+
[4-r.1]: https://github.com/Live2D/CubismJavaFramework/compare/4-r.1-beta.4...4-r.1
7799
[4-r.1-beta.4]: https://github.com/Live2D/CubismJavaFramework/compare/4-r.1-beta.3...4-r.1-beta.4
78100
[4-r.1-beta.3]: https://github.com/Live2D/CubismJavaFramework/compare/4-r.1-beta.2...4-r.1-beta.3
79101
[4-r.1-beta.2]: https://github.com/Live2D/CubismJavaFramework/compare/4-r.1-beta.1...4-r.1-beta.2

framework/src/main/java/com/live2d/sdk/cubism/framework/model/CubismMoc.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,40 @@
1818
*/
1919
public class CubismMoc {
2020
/**
21-
* Read Moc file from buffer, and create Moc data.
21+
* バッファからMocファイルを読み取り、Mocデータを作成する。
22+
* NOTE: デフォルトではMOC3の整合性をチェックしない。
2223
*
23-
* @param mocBytes A buffer of Moc file
24+
* @param mocBytes MOC3ファイルのバイト配列バッファ
25+
* @return MOC3ファイルのインスタンス
2426
*/
2527
public static CubismMoc create(byte[] mocBytes) {
28+
return create(mocBytes, false);
29+
}
30+
31+
/**
32+
* バッファからMocファイルを読み取り、Mocデータを作成する。
33+
*
34+
* @param mocBytes MOC3ファイルのバイト配列バッファ
35+
* @param shouldCheckMocConsistency MOC3の整合性をチェックするか。trueならチェックする。
36+
* @return MOC3ファイルのインスタンス
37+
*/
38+
public static CubismMoc create(byte[] mocBytes, boolean shouldCheckMocConsistency) {
2639
com.live2d.sdk.cubism.core.CubismMoc moc;
2740

2841
if (mocBytes == null) {
2942
return null;
3043
}
3144

45+
if (shouldCheckMocConsistency) {
46+
// .moc3の整合性を確認する。
47+
boolean consistency = hasMocConsistency(mocBytes);
48+
49+
if (!consistency) {
50+
CubismDebug.cubismLogError("Inconsistent MOC3.");
51+
return null;
52+
}
53+
}
54+
3255
try {
3356
moc = com.live2d.sdk.cubism.core.CubismMoc.instantiate(mocBytes);
3457
} catch (ParseException e) {

0 commit comments

Comments
 (0)