diff --git a/Assets/Live2D/Cubism/Core/ArrayExtensionMethods.cs b/Assets/Live2D/Cubism/Core/ArrayExtensionMethods.cs index 56ac6b2..0273558 100644 --- a/Assets/Live2D/Cubism/Core/ArrayExtensionMethods.cs +++ b/Assets/Live2D/Cubism/Core/ArrayExtensionMethods.cs @@ -220,7 +220,8 @@ internal static void Revive(this CubismDrawable[] self, CubismUnmanagedModel mod /// /// Buffer to write to. /// Unmanaged model to read from. - internal static unsafe void ReadFrom(this CubismDynamicDrawableData[] self, CubismUnmanagedModel unmanagedModel) + /// force DidChange + internal static unsafe void ReadFrom(this CubismDynamicDrawableData[] self, CubismUnmanagedModel unmanagedModel, bool force) { // Get addresses. var drawables = unmanagedModel.Drawables; @@ -238,7 +239,8 @@ internal static unsafe void ReadFrom(this CubismDynamicDrawableData[] self, Cubi var data = self[i]; - data.Flags = flags[i]; + var newFlags = force ? (byte)(data.Flags.MaskDidChangeFlag() | flags[i]) : flags[i]; + data.Flags = newFlags; data.Opacity = opacities[i]; data.DrawOrder = drawOrders[i]; data.RenderOrder = renderOrders[i]; diff --git a/Assets/Live2D/Cubism/Core/CubismDynamicDrawableData.cs b/Assets/Live2D/Cubism/Core/CubismDynamicDrawableData.cs index 7247831..15d094f 100644 --- a/Assets/Live2D/Cubism/Core/CubismDynamicDrawableData.cs +++ b/Assets/Live2D/Cubism/Core/CubismDynamicDrawableData.cs @@ -51,7 +51,7 @@ internal static CubismDynamicDrawableData[] CreateData(CubismUnmanagedModel unma /// /// Dirty flags. /// - internal byte Flags { private get; set; } + internal byte Flags { get; set; } /// diff --git a/Assets/Live2D/Cubism/Core/CubismTaskableModel.cs b/Assets/Live2D/Cubism/Core/CubismTaskableModel.cs index 38ddbe9..b74ef78 100644 --- a/Assets/Live2D/Cubism/Core/CubismTaskableModel.cs +++ b/Assets/Live2D/Cubism/Core/CubismTaskableModel.cs @@ -266,7 +266,7 @@ public bool UpdateNow() // Run execution directly. - Execute(); + Execute(true); return true; @@ -301,7 +301,7 @@ public void ReleaseUnmanaged() /// /// Runs the task. /// - private void Execute() + private void Execute(bool force) { // Validate state. lock (Lock) @@ -315,7 +315,7 @@ private void Execute() // Get results. - DynamicDrawableData.ReadFrom(UnmanagedModel); + DynamicDrawableData.ReadFrom(UnmanagedModel, force); // Update state. @@ -349,7 +349,7 @@ private void OnReleaseUnmanaged() void ICubismTask.Execute() { - Execute(); + Execute(false); } #endregion diff --git a/Assets/Live2D/Cubism/Core/Unmanaged/ByteExtensionMethods.cs b/Assets/Live2D/Cubism/Core/Unmanaged/ByteExtensionMethods.cs index 73a8dd7..68aabd6 100644 --- a/Assets/Live2D/Cubism/Core/Unmanaged/ByteExtensionMethods.cs +++ b/Assets/Live2D/Cubism/Core/Unmanaged/ByteExtensionMethods.cs @@ -125,5 +125,15 @@ public static bool HasBlendColorDidChangeFlag(this byte self) return (self & (1 << 6)) == (1 << 6); } + /// + /// Mask DidChageFlag. without IsVisivble flag. + /// + /// + /// + public static byte MaskDidChangeFlag(this byte self) + { + return (byte)(self & ~(1 << 0)); + } + } }