예제 #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);
         }
     }
 }