-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,217 additions
and
986 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Linearstar.MikuMikuMoving.Framework; | ||
using MikuMikuPlugin; | ||
|
||
namespace Linearstar.MikuMikuMoving.ApplyNoisePlugin.Transform; | ||
|
||
public class MorphTransformer : KeyFrameTransformer<MorphFrameData> | ||
{ | ||
readonly Morph morph; | ||
|
||
public override bool CanApplyTranslation => false; | ||
|
||
public override bool CanTranslateByLocal => false; | ||
|
||
public override bool CanApplyRotation => false; | ||
|
||
public override bool CanRotateByLocal => false; | ||
|
||
public override bool CanApplyWeight => true; | ||
|
||
MorphTransformer(Morph morph) | ||
: base(morph.Frames.GetKeyFrames()) => | ||
this.morph = morph; | ||
|
||
public static IEnumerable<MorphTransformer> FromModel(Model model) => | ||
model.Morphs | ||
.Where(morph => morph.SelectedFrames.Any()) | ||
.Select(morph => new MorphTransformer(morph)); | ||
|
||
protected override void ReplaceAllKeyFrames(IEnumerable<MorphFrameData> keyFrames) => | ||
morph.Frames.ReplaceAllKeyFrames(keyFrames.ToList()); | ||
|
||
protected override MorphFrameData GetFrame(long frameNumber) => | ||
morph.Frames.GetFrame(frameNumber); | ||
|
||
protected override void ApplyNoiseToKeyFrame(MorphFrameData keyFrame, NoiseValue value, bool translateByLocal, bool rotateByLocal, bool normalizeWeight) | ||
{ | ||
var newWeight = keyFrame.Weight + value.Weight; | ||
|
||
keyFrame.Weight = normalizeWeight ? MathHelper.Clamp(newWeight, 0, 1) : newWeight; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters