コード例 #1
0
ファイル: FaceBone.cs プロジェクト: bmjoy/face-nn
 public void SyncData(BoneData other)
 {
     Position = other.Position;
     Rotation = other.Rotation;
     Scale    = other.Scale;
 }
コード例 #2
0
ファイル: FaceBone.cs プロジェクト: bmjoy/face-nn
 private void MakeControlGroups()
 {
     if (controlGroups == null)
     {
         int len   = fbData.BoneDatas.Length;
         var bones = new BaseTransform[len];
         for (var i = 0; i < len; i++)
         {
             string         name = fbData.BoneDatas[i].name;
             FaceModifyType type = fbData.BoneDatas[i].type;
             BoneData       data = new BoneData(name);
             BaseTransform  bt;
             if (type == FaceModifyType.Rotation)
             {
                 bt = new BoneRotationTransform()
                 {
                     Bone = data, Type = type
                 };
                 (bt as BoneRotationTransform).LoadData(ref fbData.BoneDatas[i].minRot, ref fbData.BoneDatas[i].maxRot);
             }
             else
             {
                 bt = new BoneTransform()
                 {
                     Bone = data, Type = type
                 };
                 (bt as BoneTransform).LoadData(fbData.BoneDatas[i].minValue, fbData.BoneDatas[i].maxValue);
             }
             int find = SearchKnead(name);
             if (find >= 0)
             {
                 Transform tf = RoleParts.knead[find];
                 if (tf == null)
                 {
                     Debug.LogError("face bone is null " + name);
                 }
                 bt.LoadData(tf);
                 if (tfKneadFace.ContainsKey(tf))
                 {
                     tfKneadFace[tf].Add(bt.Bone);
                 }
                 else
                 {
                     List <BoneData> list = new List <BoneData>();
                     list.Add(bt.Bone);
                     tfKneadFace[tf] = list;
                 }
             }
             else
             {
                 Debug.LogError("not found tranf: " + name);
             }
             bones[i] = bt;
         }
         var groupCount = fbData.Groups.Length;
         controlGroups = new List <List <BaseTransform> >(groupCount);
         for (var k = 0; k < groupCount; k++)
         {
             var controlCount = fbData.Groups[k].controlCount;
             var controls     = new List <BaseTransform>(controlCount);
             for (var i = 0; i < controlCount; i++)
             {
                 short controlId = fbData.Groups[k].controlIds[i];
                 controls.Add(bones[controlId]);
             }
             controlGroups.Add(controls);
         }
     }
 }