This commit is contained in:
2026-09-10 10:59:37 +03:00
commit 5408d711b1
32 changed files with 5116 additions and 0 deletions
@@ -0,0 +1,43 @@
namespace Cthangover.Live2D.Cubism.Framework
{
/// <summary>
/// Cubism model part opacity.
/// Each part has a string ID, a numeric index into the native part arrays,
/// and a current opacity value (0 = hidden, 1 = fully visible).
///
/// Parts are created during <see cref="CubismModelNode.SetupParts"/>
/// and exposed via <see cref="CubismModelNode.PartOpacities"/>.
/// External code can set <see cref="Value"/> and call
/// <see cref="ApplyToModel"/> to push the change to CubismCore.
/// </summary>
public class CubismPartOpacity
{
public CubismNativeModel Model { get; }
public CubismPartOpacity(CubismNativeModel model)
{
Model = model;
}
/// <summary>Cubism part ID string (e.g. "PartArmL", "PartHairBack").</summary>
public string Id { get; set; }
/// <summary>Zero-based index into the native part arrays.</summary>
public int Index { get; set; }
/// <summary>
/// Current opacity value for this part. 0 = hidden, 1 = fully visible.
/// Written to native model when <see cref="ApplyToModel"/> is called.
/// </summary>
public float Value { get; set; }
/// <summary>
/// Writes <see cref="Value"/> directly to the native model's part opacities array.
/// </summary>
public unsafe void ApplyToModel()
{
var opacities = Model.GetPartOpacities();
opacities[Index] = Value;
}
}
}