Skip to content

Commit

Permalink
Merge pull request #70 from Live2D/develop
Browse files Browse the repository at this point in the history
Update to Cubism 4 SDK for Unity R6_1
  • Loading branch information
itoh-at-live2d-com authored Mar 10, 2023
2 parents 072e2f1 + 78c9f8a commit 70ec5dd
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Assets/Live2D/Cubism/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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.6.1] - 2023-03-10

### Added

* Add function to validate MOC3 files.


## [4-r.6] - 2023-01-26

### Added
Expand Down Expand Up @@ -267,6 +274,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Fix issue where Priority value was not reset after playing motion with CubismMotionController.


[4-r.6.1]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.6...4-r.6.1
[4-r.6]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5...4-r.6
[4-r.5]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5-beta.5...4-r.5
[4-r.5-beta.5]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5-beta.4...4-r.5-beta.5
Expand Down
8 changes: 8 additions & 0 deletions Assets/Live2D/Cubism/Core/CubismMoc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public sealed class CubismMoc : ScriptableObject
{
#region Factory Methods

/// <summary>
/// Checks consistency of a moc.
/// </summary>
public static bool HasMocConsistency(byte[] moc3)
{
return CubismUnmanagedMoc.HasMocConsistency(moc3);
}

/// <summary>
/// Creates a <see cref="CubismMoc"/> asset from raw bytes.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Assets/Live2D/Cubism/Core/Unmanaged/CubismCoreDll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ public static class CubismCoreDll
[DllImport(DllName, EntryPoint = "csmInitializeModelInPlace")]
public static extern IntPtr InitializeModelInPlace(IntPtr moc, IntPtr memory, uint modelSize);
/// <summary>
/// Checks consistency of a moc.
/// </summary>
[DllImport(DllName, EntryPoint = "csmHasMocConsistency")]
public static extern int HasMocConsistency(IntPtr memory, uint mocSize);
/// <summary>
/// Updates model.
/// </summary>
[DllImport(DllName, EntryPoint = "csmUpdateModel")]
Expand Down
19 changes: 19 additions & 0 deletions Assets/Live2D/Cubism/Core/Unmanaged/CubismUnmanagedMoc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ public static CubismUnmanagedMoc FromBytes(byte[] bytes)
/// </summary>
public uint MocVersion { get; private set; }

/// <summary>
/// Checks consistency of a moc.
/// </summary>
public static bool HasMocConsistency(byte[] bytes)
{
// Allocate and initialize memory (returning on fail).
var memory = CubismUnmanagedMemory.Allocate(bytes.Length, CubismCoreDll.AlignofMoc);

CubismUnmanagedMemory.Write(bytes, memory);

// '1' if Moc is valid; '0' otherwise.
var mocConsistencyNum = CubismCoreDll.HasMocConsistency(memory, (uint)bytes.Length);
var hasMocConsistency = (mocConsistencyNum == 1);

CubismUnmanagedMemory.Deallocate(memory);

return hasMocConsistency;
}

/// <summary>
/// Releases instance.
/// </summary>
Expand Down
33 changes: 33 additions & 0 deletions Assets/Live2D/Cubism/Plugins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,39 @@ 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/).

## 2023-03-10

### Added

* Add the function `csmHasMocConsistency`.
* This function verifies that the `MOC3` file is valid.

### Changed

* Upgrade Core version to 04.02.0003.


## 2023-02-21

### Added

* [Web] Added classes related to `Memory`.
* Add the funciton `initializeAmountOfMemory()` to adjust the amount of memory at initialization.


## 2022-10-28

### Fixed

* [Java] Remove unnecessary methods.


## 2022-10-06

### Added

* [Java] Add AAR file for Android.


## 2022-09-08

Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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.6.1] - 2023-03-10

### Added

* Add function to validate MOC3 files.


## [4-r.6] - 2023-01-26

### Added
Expand Down Expand Up @@ -267,7 +274,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Fix issue where Priority value was not reset after playing motion with CubismMotionController.


[4-r.5]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5...4-r.6
[4-r.6.1]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.6...4-r.6.1
[4-r.6]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5...4-r.6
[4-r.5]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5-beta.5...4-r.5
[4-r.5-beta.5]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5-beta.4...4-r.5-beta.5
[4-r.5-beta.4]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5-beta.3...4-r.5-beta.4
Expand Down

0 comments on commit 70ec5dd

Please sign in to comment.