private void Init() { if (null == m_generatedObject) { return; } SkinnedMeshRenderer[] smr = m_generatedObject.GetComponentsInChildren <SkinnedMeshRenderer>(); m_skinData = GpuSkinDataProxy.CreateInstance <GpuSkinDataProxy>(); m_skinData.SkinMeshes = new GpuSkinData.CustomSkinMesh[smr.Length]; Vector4[][] boneIndex; Vector4[][] weights; MergeBone(smr, out m_bones, out m_bindposes, out boneIndex, out weights); for (int i = 0; i < smr.Length; i++) { Mesh mesh = new Mesh(); m_skinData.SkinMeshes[i] = new GpuSkinData.CustomSkinMesh(); m_skinData.SkinMeshes[i].Name = smr[i].sharedMesh.name; m_skinData.SkinMeshes[i].Vertices = smr[i].sharedMesh.vertices; m_skinData.SkinMeshes[i].Triangles = smr[i].sharedMesh.triangles; m_skinData.SkinMeshes[i].Indices = smr[i].sharedMesh.GetIndices(0); m_skinData.SkinMeshes[i].Normals = smr[i].sharedMesh.normals; m_skinData.SkinMeshes[i].Uv = smr[i].sharedMesh.uv; m_skinData.SkinMeshes[i].BoneIndex = boneIndex[i]; m_skinData.SkinMeshes[i].Weights = weights[i]; } }
void Reset() { m_clipList.Clear(); m_animationNameList.Clear(); m_bakeList.Clear(); m_fbx = null; if (null != m_generatedObject) { GameObject.DestroyImmediate(m_generatedObject); m_generatedObject = null; } m_animator = null; m_workingInfo = null; m_bones = null; m_bindposes = null; if (null != m_skinData) { m_skinData = null; } m_workingIndex = 0; }