Skip to content

Commit 52389ca

Browse files
Merge pull request #12 from Live2D/develop
Update to Cubism 5 SDK for Java R3
2 parents cddc0d3 + cd5af77 commit 52389ca

8 files changed

Lines changed: 337 additions & 132 deletions

File tree

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,44 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77

8+
## [5-r.3] - 2025-02-18
9+
10+
### Added
11+
12+
* Add new motion loop processing that seamlessly connects the start and end points of the loop.
13+
* The `isLooped` variable has been moved from the `CubismMotion` class to the `ACubismMotion` class as `isLoop`.
14+
* Add the setter for `isLoop`, `setLoop(boolean loop)`, to class `ACubismMotion`.
15+
* Add the getter for `isLoop`, `getLoop()`, to class `ACubismMotion`.
16+
* The `isLoopFadeIn` variable was moved from class `CubismMotion` to class `ACubismMotion`.
17+
* Add the setter for `isLoopFadeIn`, `setLoopFadeIn(boolean loopFadeIn)`, to class `ACubismMotion`.
18+
* Add the getter for `isLoopFadeIn`, `getLoopFadeIn()`, to class `ACubismMotion`.
19+
* Add a variable `motionBehavior` for version control to the `CubismMotion` class.
20+
21+
### Changed
22+
23+
* Change the compile and target SDK version of Android OS to 15.0 (API 35).
24+
* Upgrade the version of Android Gradle Plugin from 8.1.1 to 8.6.1.
25+
* Upgrade the version of Gradle from 8.2 to 8.7.
26+
* Change the minimum version of Android Studio to Ladybug(2024.2.1).
27+
* Change the arguments of `CsmMotionSegmentEvaluationFunction.evaluate` from `(float time, int basePointIndex)` to `(final List<CubismMotionPoint> points, final float time)` to align with the Cubism SDK for Native codebase.
28+
* Accordingly, change the implementation of the following methods.
29+
* CubismMotion.LinearEvaluator.evaluate()
30+
* CubismMotion.BezierEvaluator.evaluate()
31+
* CubismMotion.BezierEvaluatorCardanoInterpretation.evaluate()
32+
* CubismMotion.SteppedEvaluator.evaluate()
33+
* CubismMotion.InverseSteppedEvaluator.evaluate()
34+
* CubismMotion.bezierEvaluateBinarySearch()
35+
* Change the access level of `CubismMotionQueueEntry` class to public.
36+
37+
### Deprecated
38+
39+
* Deprecate the following elements due to the change in the variable declaration location.
40+
* `CubismMotion.isLoop(boolean loop)`
41+
* `CubismMotion.isLoop()`
42+
* `CubismMotion.isLoopFadeIn(boolean loopFadeIn)`
43+
* `CubismMotion.isLoopFadeIn()`
44+
45+
846
## [5-r.2] - 2024-11-07
947

1048
### Added
@@ -200,6 +238,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
200238

201239
* New released!
202240

241+
242+
[5-r.3]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.2...5-r.3
203243
[5-r.2]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.1...5-r.2
204244
[5-r.1]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.1-beta.3...5-r.1
205245
[5-r.1-beta.3]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.1-beta.2...5-r.1-beta.3

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
mavenCentral()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:8.1.1'
8+
classpath 'com.android.tools.build:gradle:8.6.1'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files

framework/src/main/java/com/live2d/sdk/cubism/framework/motion/ACubismMotion.java

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,9 @@ public void setupMotionQueueEntry(
7676
// Record the start time of fade-in
7777
motionQueueEntry.setFadeInStartTime(userTimeSeconds);
7878

79-
final float duration = getDuration();
80-
8179
// Deal with the case where the status is set "end" before it has started.
8280
if (motionQueueEntry.getEndTime() < 0) {
83-
// If duration == -1, loop motion.
84-
float endTime = (duration <= 0)
85-
? -1
86-
: motionQueueEntry.getStartTime() + duration;
87-
motionQueueEntry.setEndTime(endTime);
81+
adjustEndTime(motionQueueEntry);
8882
}
8983
}
9084

@@ -207,6 +201,42 @@ public void setOffsetTime(float offsetSeconds) {
207201
this.offsetSeconds = offsetSeconds;
208202
}
209203

204+
/**
205+
* Sets whether the motion should loop.
206+
*
207+
* @param loop true to set the motion to loop
208+
*/
209+
public void setLoop(boolean loop) {
210+
isLoop = loop;
211+
}
212+
213+
/**
214+
* Checks whether the motion is set to loop.
215+
*
216+
* @return true if the motion is set to loop; otherwise false.
217+
*/
218+
public boolean getLoop() {
219+
return isLoop;
220+
}
221+
222+
/**
223+
* Sets whether to perform fade-in for looping motion.
224+
*
225+
* @param loopFadeIn true to perform fade-in for looping motion
226+
*/
227+
public void setLoopFadeIn(boolean loopFadeIn) {
228+
isLoopFadeIn = loopFadeIn;
229+
}
230+
231+
/**
232+
* Checks the setting for fade-in of looping motion.
233+
*
234+
* @return true if fade-in for looping motion is set; otherwise false.
235+
*/
236+
public boolean getLoopFadeIn() {
237+
return isLoopFadeIn;
238+
}
239+
210240
/**
211241
* Check for event firing.
212242
* The input time reference is set to zero at the called motion timing.
@@ -305,6 +335,17 @@ protected abstract void doUpdateParameters(
305335
CubismMotionQueueEntry motionQueueEntry
306336
);
307337

338+
protected void adjustEndTime(CubismMotionQueueEntry motionQueueEntry) {
339+
final float duration = getDuration();
340+
341+
// duration == -1 の場合はループする
342+
final float endTime = (duration <= 0)
343+
? -1
344+
: motionQueueEntry.getStartTime() + duration;
345+
346+
motionQueueEntry.setEndTime(endTime);
347+
}
348+
308349
/**
309350
* 指定時間の透明度の値を返す。
310351
* NOTE: 更新後の値を取るには`updateParameters()` の後に呼び出す。
@@ -331,6 +372,20 @@ protected float getModelOpacityValue() {
331372
* Start time for motion playback[s]
332373
*/
333374
protected float offsetSeconds;
375+
376+
/**
377+
* Enable/Disable loop
378+
*/
379+
protected boolean isLoop;
380+
/**
381+
* flag whether fade-in is enabled at looping. Default value is true.
382+
*/
383+
protected boolean isLoopFadeIn = true;
384+
385+
/**
386+
* The previous state of `_isLoop`.
387+
*/
388+
protected boolean previousLoopState = isLoop;
334389
/**
335390
* List of events that have fired
336391
*/

0 commit comments

Comments
 (0)