123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using UnityEngine;
- public class CacheBoneDataArray : MonoBehaviour
- {
- public void CreateCache(Transform root)
- {
- if (CacheBoneDataArray.save_bone_path_set_ == null)
- {
- CacheBoneDataArray.save_bone_path_set_ = new HashSet<string>();
- string[] saveBonePathArray = CacheBoneDataArray.GetSaveBonePathArray();
- for (int i = 0; i < saveBonePathArray.Length; i++)
- {
- CacheBoneDataArray.save_bone_path_set_.Add(saveBonePathArray[i]);
- }
- }
- this.path_dic_ = new Dictionary<string, CacheBoneDataArray.BoneData>();
- this.bone_data = new CacheBoneDataArray.BoneData(root, null);
- this.bip_root_trans_ = this.bone_data.transform;
- this.bust_trans_ = new Transform[2];
- Action<CacheBoneDataArray.BoneData> bust_search = null;
- bust_search = delegate(CacheBoneDataArray.BoneData target_bone_data)
- {
- if (this.bust_trans_[0] != null && this.bust_trans_[1] != null)
- {
- return;
- }
- string name = target_bone_data.transform.gameObject.name;
- if (name == "Mune_L")
- {
- this.bust_trans_[0] = target_bone_data.transform;
- }
- else if (name == "Mune_R")
- {
- this.bust_trans_[1] = target_bone_data.transform;
- }
- for (int j = 0; j < target_bone_data.child_bone_array.Length; j++)
- {
- bust_search(target_bone_data.child_bone_array[j]);
- }
- };
- bust_search(this.bone_data);
- NDebug.Assert(this.bust_trans_[0] != null && this.bust_trans_[1] != null, "胸ボーンのサーチに失敗しました");
- Action<CacheBoneDataArray.BoneData> create_path_dic = null;
- create_path_dic = delegate(CacheBoneDataArray.BoneData target_bone_data)
- {
- if (!this.path_dic_.ContainsKey(target_bone_data.path))
- {
- this.path_dic_.Add(target_bone_data.path, target_bone_data);
- }
- for (int j = 0; j < target_bone_data.child_bone_array.Length; j++)
- {
- create_path_dic(target_bone_data.child_bone_array[j]);
- }
- };
- create_path_dic(this.bone_data);
- }
- public byte[] GetAnmBinary(bool use_bust_keyL, bool use_bust_keyR)
- {
- if (this.bone_data == null)
- {
- NDebug.Assert("ボーンデータがありません", false);
- return null;
- }
- Action<BinaryWriter, CacheBoneDataArray.BoneData> write_bone_data = null;
- write_bone_data = delegate(BinaryWriter w, CacheBoneDataArray.BoneData target_bone_data)
- {
- if (CacheBoneDataArray.save_bone_path_set_.Contains(target_bone_data.path))
- {
- int num = 2;
- w.Write(1);
- w.Write(target_bone_data.path);
- Vector3 localPosition = target_bone_data.transform.localPosition;
- Quaternion localRotation = target_bone_data.transform.localRotation;
- float[] array = new float[]
- {
- localRotation.x,
- localRotation.y,
- localRotation.z,
- localRotation.w
- };
- if (target_bone_data.transform == this.bip_root_trans_)
- {
- array = new float[]
- {
- localRotation.x,
- localRotation.y,
- localRotation.z,
- localRotation.w,
- localPosition.x,
- localPosition.y,
- localPosition.z
- };
- }
- for (int i = 0; i < array.Length; i++)
- {
- w.Write((byte)(100 + i));
- w.Write(num);
- for (int j = 0; j < num; j++)
- {
- w.Write((float)j);
- w.Write(array[i]);
- w.Write(0);
- w.Write(0);
- }
- }
- }
- for (int k = 0; k < target_bone_data.child_bone_array.Length; k++)
- {
- write_bone_data(w, target_bone_data.child_bone_array[k]);
- }
- };
- MemoryStream memoryStream = new MemoryStream();
- BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
- binaryWriter.Write("CM3D2_ANIM");
- binaryWriter.Write(1001);
- write_bone_data(binaryWriter, this.bone_data);
- binaryWriter.Write(0);
- binaryWriter.Write((!use_bust_keyL) ? 0 : 1);
- binaryWriter.Write((!use_bust_keyR) ? 0 : 1);
- binaryWriter.Close();
- memoryStream.Close();
- byte[] result = memoryStream.ToArray();
- memoryStream.Dispose();
- return result;
- }
- public List<KeyValuePair<string, KeyValuePair<Quaternion, Vector3>>> GetTest()
- {
- List<KeyValuePair<string, KeyValuePair<Quaternion, Vector3>>> result = new List<KeyValuePair<string, KeyValuePair<Quaternion, Vector3>>>();
- Action<List<KeyValuePair<string, KeyValuePair<Quaternion, Vector3>>>, CacheBoneDataArray.BoneData> write_bone_data = null;
- write_bone_data = delegate(List<KeyValuePair<string, KeyValuePair<Quaternion, Vector3>>> dest, CacheBoneDataArray.BoneData target_bone_data)
- {
- if (CacheBoneDataArray.save_bone_path_set_.Contains(target_bone_data.path))
- {
- string path = target_bone_data.path;
- KeyValuePair<Quaternion, Vector3> value = new KeyValuePair<Quaternion, Vector3>(target_bone_data.transform.localRotation, target_bone_data.transform.localPosition);
- KeyValuePair<string, KeyValuePair<Quaternion, Vector3>> item = new KeyValuePair<string, KeyValuePair<Quaternion, Vector3>>(path, value);
- dest.Add(item);
- }
- for (int i = 0; i < target_bone_data.child_bone_array.Length; i++)
- {
- write_bone_data(result, target_bone_data.child_bone_array[i]);
- }
- };
- write_bone_data(result, this.bone_data);
- return result;
- }
- public byte[] GetFrameBinary(bool use_bust_keyL, bool use_bust_keyR)
- {
- if (this.bone_data == null)
- {
- NDebug.Assert("ボーンデータがありません", false);
- return null;
- }
- Action<BinaryWriter, CacheBoneDataArray.BoneData> write_bone_data = null;
- write_bone_data = delegate(BinaryWriter w, CacheBoneDataArray.BoneData target_bone_data)
- {
- if (CacheBoneDataArray.save_bone_path_set_.Contains(target_bone_data.path))
- {
- w.Write(1);
- w.Write(target_bone_data.path);
- Vector3 localPosition = target_bone_data.transform.localPosition;
- Quaternion localRotation = target_bone_data.transform.localRotation;
- float[] array = new float[]
- {
- localRotation.x,
- localRotation.y,
- localRotation.z,
- localRotation.w
- };
- if (target_bone_data.transform == this.bip_root_trans_)
- {
- array = new float[]
- {
- localRotation.x,
- localRotation.y,
- localRotation.z,
- localRotation.w,
- localPosition.x,
- localPosition.y,
- localPosition.z
- };
- }
- for (int i = 0; i < array.Length; i++)
- {
- w.Write(array[i]);
- }
- }
- for (int j = 0; j < target_bone_data.child_bone_array.Length; j++)
- {
- write_bone_data(w, target_bone_data.child_bone_array[j]);
- }
- };
- MemoryStream memoryStream = new MemoryStream();
- BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
- binaryWriter.Write("CM3D2_FRAME_ANIM");
- binaryWriter.Write(1001);
- write_bone_data(binaryWriter, this.bone_data);
- binaryWriter.Write(0);
- binaryWriter.Write((!use_bust_keyL) ? 0 : 1);
- binaryWriter.Write((!use_bust_keyR) ? 0 : 1);
- binaryWriter.Close();
- memoryStream.Close();
- byte[] result = memoryStream.ToArray();
- memoryStream.Dispose();
- return result;
- }
- public KeyValuePair<bool, bool> SetFrameBinary(byte[] binary)
- {
- if (this.bone_data == null)
- {
- NDebug.Assert("ボーンデータがありません", false);
- return new KeyValuePair<bool, bool>(false, false);
- }
- MemoryStream memoryStream = new MemoryStream(binary);
- BinaryReader binaryReader = new BinaryReader(memoryStream);
- string a = binaryReader.ReadString();
- if (a != "CM3D2_FRAME_ANIM")
- {
- binaryReader.Close();
- memoryStream.Close();
- memoryStream.Dispose();
- return new KeyValuePair<bool, bool>(false, false);
- }
- int num = binaryReader.ReadInt32();
- bool flag = false;
- if (1001 <= num)
- {
- flag = true;
- }
- Dictionary<int, KeyValuePair<Transform, float[]>> dictionary = new Dictionary<int, KeyValuePair<Transform, float[]>>();
- while (binaryReader.ReadByte() != 0)
- {
- string key = binaryReader.ReadString();
- CacheBoneDataArray.BoneData boneData = this.path_dic_[key];
- float[] array = new float[4];
- if (boneData.transform == this.bip_root_trans_)
- {
- array = new float[7];
- }
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = binaryReader.ReadSingle();
- }
- if (flag && (boneData.transform == this.bust_trans_[0] || boneData.transform == this.bust_trans_[1]))
- {
- int key2 = 0;
- if (boneData.transform == this.bust_trans_[1])
- {
- key2 = 1;
- }
- KeyValuePair<Transform, float[]> value = new KeyValuePair<Transform, float[]>(boneData.transform, array);
- dictionary.Add(key2, value);
- }
- else
- {
- boneData.transform.localRotation = new Quaternion(array[0], array[1], array[2], array[3]);
- if (4 < array.Length)
- {
- boneData.transform.localPosition = new Vector3(array[4], array[5], array[6]);
- }
- }
- }
- bool flag2 = false;
- bool value2 = false;
- if (flag)
- {
- flag2 = (binaryReader.ReadByte() != 0);
- value2 = (binaryReader.ReadByte() != 0);
- List<KeyValuePair<Transform, float[]>> list = new List<KeyValuePair<Transform, float[]>>();
- if (flag2)
- {
- list.Add(dictionary[0]);
- }
- else if (flag2)
- {
- list.Add(dictionary[1]);
- }
- foreach (KeyValuePair<Transform, float[]> keyValuePair in list)
- {
- float[] value3 = keyValuePair.Value;
- keyValuePair.Key.localRotation = new Quaternion(value3[0], value3[1], value3[2], value3[3]);
- if (4 < value3.Length)
- {
- keyValuePair.Key.transform.localPosition = new Vector3(value3[4], value3[5], value3[6]);
- }
- }
- }
- binaryReader.Close();
- memoryStream.Close();
- memoryStream.Dispose();
- return new KeyValuePair<bool, bool>(flag2, value2);
- }
- public CacheBoneDataArray.BoneData bone_data { get; private set; }
- private static string[] GetSaveBonePathArray()
- {
- return new string[]
- {
- "Bip01",
- "Bip01/Bip01 Footsteps",
- "Bip01/Bip01 Pelvis",
- "Bip01/Bip01 Pelvis/Bip01 L Thigh",
- "Bip01/Bip01 Pelvis/Bip01 L Thigh/Bip01 L Calf",
- "Bip01/Bip01 Pelvis/Bip01 L Thigh/Bip01 L Calf/Bip01 L Foot",
- "Bip01/Bip01 Pelvis/Bip01 L Thigh/Bip01 L Calf/Bip01 L Foot/Bip01 L Toe0",
- "Bip01/Bip01 Pelvis/Bip01 L Thigh/Bip01 L Calf/Bip01 L Foot/Bip01 L Toe0/Bip01 L Toe01",
- "Bip01/Bip01 Pelvis/Bip01 L Thigh/Bip01 L Calf/Bip01 L Foot/Bip01 L Toe1",
- "Bip01/Bip01 Pelvis/Bip01 L Thigh/Bip01 L Calf/Bip01 L Foot/Bip01 L Toe1/Bip01 L Toe11",
- "Bip01/Bip01 Pelvis/Bip01 L Thigh/Bip01 L Calf/Bip01 L Foot/Bip01 L Toe2",
- "Bip01/Bip01 Pelvis/Bip01 L Thigh/Bip01 L Calf/Bip01 L Foot/Bip01 L Toe2/Bip01 L Toe21",
- "Bip01/Bip01 Pelvis/Bip01 R Thigh",
- "Bip01/Bip01 Pelvis/Bip01 R Thigh/Bip01 R Calf",
- "Bip01/Bip01 Pelvis/Bip01 R Thigh/Bip01 R Calf/Bip01 R Foot",
- "Bip01/Bip01 Pelvis/Bip01 R Thigh/Bip01 R Calf/Bip01 R Foot/Bip01 R Toe0",
- "Bip01/Bip01 Pelvis/Bip01 R Thigh/Bip01 R Calf/Bip01 R Foot/Bip01 R Toe0/Bip01 R Toe01",
- "Bip01/Bip01 Pelvis/Bip01 R Thigh/Bip01 R Calf/Bip01 R Foot/Bip01 R Toe1",
- "Bip01/Bip01 Pelvis/Bip01 R Thigh/Bip01 R Calf/Bip01 R Foot/Bip01 R Toe1/Bip01 R Toe11",
- "Bip01/Bip01 Pelvis/Bip01 R Thigh/Bip01 R Calf/Bip01 R Foot/Bip01 R Toe2",
- "Bip01/Bip01 Pelvis/Bip01 R Thigh/Bip01 R Calf/Bip01 R Foot/Bip01 R Toe2/Bip01 R Toe21",
- "Bip01/Bip01 Spine",
- "Bip01/Bip01 Spine/Bip01 Spine0a",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 Neck",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 Neck/Bip01 Head",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger0",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger0/Bip01 L Finger01",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger0/Bip01 L Finger01/Bip01 L Finger02",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger1",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger1/Bip01 L Finger11",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger1/Bip01 L Finger11/Bip01 L Finger12",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger2",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger2/Bip01 L Finger21",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger2/Bip01 L Finger21/Bip01 L Finger22",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger3",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger3/Bip01 L Finger31",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger3/Bip01 L Finger31/Bip01 L Finger32",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger4",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger4/Bip01 L Finger41",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand/Bip01 L Finger4/Bip01 L Finger41/Bip01 L Finger42",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger0",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger0/Bip01 R Finger01",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger0/Bip01 R Finger01/Bip01 R Finger02",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger1",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger1/Bip01 R Finger11",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger1/Bip01 R Finger11/Bip01 R Finger12",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger2",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger2/Bip01 R Finger21",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger2/Bip01 R Finger21/Bip01 R Finger22",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger3",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger3/Bip01 R Finger31",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger3/Bip01 R Finger31/Bip01 R Finger32",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger4",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger4/Bip01 R Finger41",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/Bip01 R Finger4/Bip01 R Finger41/Bip01 R Finger42",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Mune_L",
- "Bip01/Bip01 Spine/Bip01 Spine0a/Bip01 Spine1/Bip01 Spine1a/Mune_R"
- };
- }
- private Transform bip_root_trans_;
- private Transform[] bust_trans_;
- private Dictionary<string, CacheBoneDataArray.BoneData> path_dic_;
- private static HashSet<string> save_bone_path_set_;
- public class BoneData
- {
- public BoneData(Transform trans, string hierarchy_path)
- {
- this.transform = trans;
- this.path = hierarchy_path;
- if (!string.IsNullOrEmpty(this.path))
- {
- this.path += "/";
- }
- this.path += trans.gameObject.name;
- List<CacheBoneDataArray.BoneData> list = new List<CacheBoneDataArray.BoneData>();
- for (int i = 0; i < this.transform.childCount; i++)
- {
- Transform child = this.transform.GetChild(i);
- string name = child.name;
- if (0 > name.IndexOf("_IK") && 0 > name.IndexOf("_SCL") && 0 > name.IndexOf("nub"))
- {
- list.Add(new CacheBoneDataArray.BoneData(child, this.path));
- }
- }
- this.child_bone_array = list.ToArray();
- }
- public Transform transform { get; private set; }
- public CacheBoneDataArray.BoneData[] child_bone_array { get; private set; }
- public string path { get; private set; }
- }
- }
|