コード例 #1
0
        protected override Dictionary <string, TransformModel> GetBonesBindPoseTransforms(ExportableModel r3AnimatedMesh)
        {
            var result = new Dictionary <string, TransformModel>();

            Transform[] bones     = r3AnimatedMesh.GetComponent <SkinnedMeshRenderer>().bones;
            Matrix4x4[] bindposes = r3AnimatedMesh.GetComponent <SkinnedMeshRenderer>().sharedMesh.bindposes;
            for (int i = 0; i < bones.Length; i++)
            {
                var          boneTransform         = bones[i];
                var          channelGameObject     = ObjectsHierarchyHelper.GetProperChannelForTransform(boneTransform).gameObject;
                BoneBindPose boneBindPoseTransform = BoneBindPoseHelper.GetBindPoseBoneTransformForBindPoseMatrix(bones[i], bindposes[i]);
                boneBindPoseTransform.boneName = channelGameObject.name;
                result.Add(
                    boneBindPoseTransform.boneName,
                    new TransformModel(
                        boneBindPoseTransform.position,
                        boneBindPoseTransform.rotation,
                        boneBindPoseTransform.scale,
                        new Vector3d(0.0f, 0.0f, 0.0f),
                        new MathDescription.Quaternion(1.0f, 0.0f, 0.0f, 0.0f),
                        new Vector3d(1.0f, 1.0f, 1.0f)
                        )
                    );
            }
            return(result);
        }
コード例 #2
0
        private List <BoneWeightsInfo> GetBoneWeightsInfos(Transform[] bones)
        {
            var result = new List <BoneWeightsInfo>();

            for (int i = 0; i < bones.Length; i++)
            {
                var channelName = ObjectsHierarchyHelper.GetProperChannelForTransform(bones[i]).gameObject.name;
                result.Add(new BoneWeightsInfo(bones[i].gameObject.name, channelName, i));
            }
            return(result);
        }
コード例 #3
0
 public static GameObject GetParentChannel(this ExportableModel m)
 {
     return(ObjectsHierarchyHelper.GetProperChannelForTransform(m.transform).gameObject);
 }