mirror of
https://github.com/aelurum/AssetStudio.git
synced 2026-11-15 19:28:48 -05:00
Fix Live2D motion converting. Close #150
This commit is contained in:
@@ -101,6 +101,17 @@ namespace CubismLive2DExtractor
|
|||||||
totalSegmentCount++;
|
totalSegmentCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void FillSingleSegment(Keyframe<float> curve, SerializableCurve cubismCurve, float time, ref int totalPointCount, ref int totalSegmentCount)
|
||||||
|
{
|
||||||
|
var value = cubismCurve.Segments[1];
|
||||||
|
var id = float.IsPositiveInfinity(curve.inSlope) ? 2f : 0f;
|
||||||
|
cubismCurve.Segments.Add(id); // Segment ID
|
||||||
|
cubismCurve.Segments.Add(time);
|
||||||
|
cubismCurve.Segments.Add(value);
|
||||||
|
totalPointCount++;
|
||||||
|
totalSegmentCount++;
|
||||||
|
}
|
||||||
|
|
||||||
public CubismMotion3Json(CubismUnityClasses.CubismFadeMotionData fadeMotion, HashSet<string> paramNames, HashSet<string> partNames, bool forceBezier)
|
public CubismMotion3Json(CubismUnityClasses.CubismFadeMotionData fadeMotion, HashSet<string> paramNames, HashSet<string> partNames, bool forceBezier)
|
||||||
{
|
{
|
||||||
Version = 3;
|
Version = 3;
|
||||||
@@ -177,6 +188,10 @@ namespace CubismLive2DExtractor
|
|||||||
fadeMotion.ParameterCurves[i].m_Curve[0].value
|
fadeMotion.ParameterCurves[i].m_Curve[0].value
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (fadeMotion.ParameterCurves[i].m_Curve.Count == 1)
|
||||||
|
{
|
||||||
|
FillSingleSegment(fadeMotion.ParameterCurves[i].m_Curve[0], Curves[actualCurveCount], Meta.Duration, ref totalPointCount, ref totalSegmentCount);
|
||||||
|
}
|
||||||
for (var j = 1; j < fadeMotion.ParameterCurves[i].m_Curve.Count; j++)
|
for (var j = 1; j < fadeMotion.ParameterCurves[i].m_Curve.Count; j++)
|
||||||
{
|
{
|
||||||
var curve = fadeMotion.ParameterCurves[i].m_Curve[j];
|
var curve = fadeMotion.ParameterCurves[i].m_Curve[j];
|
||||||
@@ -232,6 +247,10 @@ namespace CubismLive2DExtractor
|
|||||||
track.Curve[0].value
|
track.Curve[0].value
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (track.Curve.Count == 1)
|
||||||
|
{
|
||||||
|
FillSingleSegment(CreateKeyFrame(track.Curve[0]), Curves[i], Meta.Duration, ref totalPointCount, ref totalSegmentCount);
|
||||||
|
}
|
||||||
for (var j = 1; j < track.Curve.Count; j++)
|
for (var j = 1; j < track.Curve.Count; j++)
|
||||||
{
|
{
|
||||||
var curve = CreateKeyFrame(track.Curve[j]);
|
var curve = CreateKeyFrame(track.Curve[j]);
|
||||||
|
|||||||
Reference in New Issue
Block a user