• R/O
  • SSH
  • HTTPS

mmdx: Commit


Commit MetaInfo

Revision70 (tree)
Zeit2010-03-20 23:19:15
Autorwilfrem

Log Message

表情をベイク時に退避できてなかったので退避

Ändern Zusammenfassung

Diff

--- trunk/MikuMikuDanceXNA/Model/MMDFaceManager.cs (revision 69)
+++ trunk/MikuMikuDanceXNA/Model/MMDFaceManager.cs (revision 70)
@@ -11,7 +11,7 @@
1111 {
1212 MMDModel model;
1313 Vector4[] FaceTranslations;//頂点番号ごとの移動量
14- Dictionary<string, float> FaceRates;//適応中の表情リスト
14+ internal Dictionary<string, float> FaceRates;//適応中の表情リスト
1515 Dictionary<string, int> FaceDictionary;//表情辞書
1616 int baseIndex;
1717 //中からのみ
--- trunk/MikuMikuDanceXNA/Motion/AnimationPlayer.cs (revision 69)
+++ trunk/MikuMikuDanceXNA/Motion/AnimationPlayer.cs (revision 70)
@@ -150,7 +150,7 @@
150150 {
151151 //現在の再生フレームを更新
152152 mmdMotion[i].UpdateFrame(mmdModel.Player.FramePerSecond);
153- mmdMotion[i].ApplyMotion(mmdModel, ref BoneUpdated);
153+ mmdMotion[i].ApplyMotion(mmdModel.BoneManager, mmdModel.FaceManager, ref BoneUpdated);
154154 }
155155 }
156156
@@ -236,6 +236,8 @@
236236 {
237237 PopedBones[i] = mmdModel.BoneManager[i].BoneTransform;
238238 }
239+ Dictionary<string, float> PopedFaces = mmdModel.FaceManager.FaceRates;
240+ mmdModel.FaceManager.FaceRates = new Dictionary<string, float>();
239241 //ベイク
240242 for (int Frame = 0; Frame < NumFrame; Frame++)
241243 {
@@ -242,7 +244,7 @@
242244 Array.Clear(BoneUpdated, 0, BoneUpdated.Length);
243245 //現在の再生フレームをセットし更新
244246 normal.NowFrame = Frame;
245- normal.ApplyMotion(mmdModel, ref BoneUpdated);
247+ normal.ApplyMotion(mmdModel.BoneManager, mmdModel.FaceManager, ref BoneUpdated);
246248
247249 //IKボーンの処理前にモデルのワールド座標系更新
248250 mmdModel.BoneManager.UpdateWorldTransforms();
@@ -276,6 +278,7 @@
276278 {
277279 mmdModel.BoneManager[i].BoneTransform = PopedBones[i];
278280 }
281+ mmdModel.FaceManager.FaceRates = PopedFaces;
279282 mmdModel.BoneManager.Update();
280283 }
281284
--- trunk/MikuMikuDanceXNA/Motion/BakedMotionTrack.cs (revision 69)
+++ trunk/MikuMikuDanceXNA/Motion/BakedMotionTrack.cs (revision 70)
@@ -74,7 +74,7 @@
7474 }
7575 NowFrame = frame % (decimal)Poses.GetLength(0);
7676 }
77- public void ApplyMotion(MMDModel mmdModel, ref bool[] BoneUpdated)
77+ public void ApplyMotion(MMDBoneManager mmdBone, MMDFaceManager mmdFace, ref bool[] BoneUpdated)
7878 {
7979 int Frame = (int)Math.Round(NowFrame);
8080 if (Frame >= Poses.GetLength(0))
@@ -82,13 +82,13 @@
8282 for (int i = 0; i < Poses.GetLength(1); i++)
8383 {
8484 //計算済みトランスフォームを設定
85- mmdModel.BoneManager[Poses[Frame, i].BoneIndex].BoneTransform = Poses[Frame, i].Poses;
85+ mmdBone[Poses[Frame, i].BoneIndex].BoneTransform = Poses[Frame, i].Poses;
8686 //IK計算済みなので、BoneUpdatedはOnにしない
8787 }
8888 for (int i = 0; i < Faces.GetLength(1); i++)
8989 {
9090 //保存済みFaceを設定
91- mmdModel.FaceManager.SetFace(Faces[Frame, i].FaceName, Faces[Frame, i].Rate);
91+ mmdFace.SetFace(Faces[Frame, i].FaceName, Faces[Frame, i].Rate);
9292 }
9393 }
9494 }
--- trunk/MikuMikuDanceXNA/Motion/NormalMotionTrack.cs (revision 69)
+++ trunk/MikuMikuDanceXNA/Motion/NormalMotionTrack.cs (revision 70)
@@ -66,7 +66,7 @@
6666 NowFrame = frame % (decimal)(motion.MaxFrame + 1);
6767 }
6868
69- public void ApplyMotion(MMDModel mmdModel, ref bool[] BoneUpdated)
69+ public void ApplyMotion(MMDBoneManager mmdBone, MMDFaceManager mmdFace, ref bool[] BoneUpdated)
7070 {
7171 //モーションのボーンリストを取得
7272 List<string> motionBones = motion.GetBoneList();
@@ -73,12 +73,12 @@
7373 //リストにあるボーンの位置を順番に更新
7474 foreach (var bone in motionBones)
7575 {
76- if (mmdModel.BoneManager.ContainsBone(bone))
76+ if (mmdBone.ContainsBone(bone))
7777 {//存在しないボーンへのモーションは無視……
78- int boneIndex = mmdModel.BoneManager.IndexOf(bone);
78+ int boneIndex = mmdBone.IndexOf(bone);
7979 QuatTransform move = motion.GetBoneTransform(bone, NowFrame);
8080 //ボーン処理
81- mmdModel.BoneManager[boneIndex].BoneTransform = move * mmdModel.BoneManager[boneIndex].BoneData.BindPose;
81+ mmdBone[boneIndex].BoneTransform = move * mmdBone[boneIndex].BoneData.BindPose;
8282 //UpdateフラグをOn
8383 BoneUpdated[boneIndex] = true;
8484 }
@@ -88,7 +88,7 @@
8888 //リストにあるフェイスのデータを順番に処理
8989 foreach (var face in faces)
9090 {
91- mmdModel.FaceManager.SetFace(face, motion.GetFaceRate(face, NowFrame));
91+ mmdFace.SetFace(face, motion.GetFaceRate(face, NowFrame));
9292 }
9393 }
9494 }
--- trunk/MikuMikuDanceXNA/Motion/MotionTrack.cs (revision 69)
+++ trunk/MikuMikuDanceXNA/Motion/MotionTrack.cs (revision 70)
@@ -26,7 +26,7 @@
2626
2727 decimal NowFrame { get; set; }
2828 long MaxFrame { get; }
29- void ApplyMotion(MMDModel model, ref bool[] BoneUpdated);
29+ void ApplyMotion(MMDBoneManager mmdBone, MMDFaceManager mmdFace, ref bool[] BoneUpdated);
3030 TrackType Type { get; }
3131
3232 void UpdateFrame(decimal FramePerSecond);
Show on old repository browser