Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawableの透明度等の設定が反映されないことがあるバグを修正 #82

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions Assets/Live2D/Cubism/Core/ArrayExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ internal static void Revive(this CubismDrawable[] self, CubismUnmanagedModel mod
/// </summary>
/// <param name="self">Buffer to write to.</param>
/// <param name="unmanagedModel">Unmanaged model to read from.</param>
internal static unsafe void ReadFrom(this CubismDynamicDrawableData[] self, CubismUnmanagedModel unmanagedModel)
/// <param name="force">force DidChange</param>
internal static unsafe void ReadFrom(this CubismDynamicDrawableData[] self, CubismUnmanagedModel unmanagedModel, bool force)
{
// Get addresses.
var drawables = unmanagedModel.Drawables;
Expand All @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion Assets/Live2D/Cubism/Core/CubismDynamicDrawableData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal static CubismDynamicDrawableData[] CreateData(CubismUnmanagedModel unma
/// <summary>
/// Dirty flags.
/// </summary>
internal byte Flags { private get; set; }
internal byte Flags { get; set; }


/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions Assets/Live2D/Cubism/Core/CubismTaskableModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public bool UpdateNow()


// Run execution directly.
Execute();
Execute(true);


return true;
Expand Down Expand Up @@ -301,7 +301,7 @@ public void ReleaseUnmanaged()
/// <summary>
/// Runs the task.
/// </summary>
private void Execute()
private void Execute(bool force)
{
// Validate state.
lock (Lock)
Expand All @@ -315,7 +315,7 @@ private void Execute()


// Get results.
DynamicDrawableData.ReadFrom(UnmanagedModel);
DynamicDrawableData.ReadFrom(UnmanagedModel, force);


// Update state.
Expand Down Expand Up @@ -349,7 +349,7 @@ private void OnReleaseUnmanaged()

void ICubismTask.Execute()
{
Execute();
Execute(false);
}

#endregion
Expand Down
10 changes: 10 additions & 0 deletions Assets/Live2D/Cubism/Core/Unmanaged/ByteExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,15 @@ public static bool HasBlendColorDidChangeFlag(this byte self)
return (self & (1 << 6)) == (1 << 6);
}

/// <summary>
/// Mask DidChageFlag. without IsVisivble flag.
/// </summary>
/// <param name="self"></param>
/// <returns></returns>
public static byte MaskDidChangeFlag(this byte self)
{
return (byte)(self & ~(1 << 0));
}

}
}