Пример #1
0
    static Dictionary <string, int> CreateSkeletonNameToIndexMap(Unity.Animation.Hybrid.RigComponent rig)
    {
        Dictionary <string, int> nameToIndex = new Dictionary <string, int>(rig.Bones.Length);

        for (int i = 0; i < rig.Bones.Length; ++i)
        {
            nameToIndex.Add(rig.Bones[i].name, i);
        }

        return(nameToIndex);
    }
Пример #2
0
        public static IAnimationChannel[] ExtractAnimationChannelFromRigComponent(RigComponent rigComponent)
        {
            var channels = new List <IAnimationChannel>();

            for (int i = 0; i < rigComponent.TranslationChannels.Length; i++)
            {
                var channel = new LocalTranslationChannel {
                    Id = rigComponent.TranslationChannels[i].Id, DefaultValue = rigComponent.TranslationChannels[i].DefaultValue
                };
                channels.Add(channel);
            }

            for (int i = 0; i < rigComponent.RotationChannels.Length; i++)
            {
                var channel = new LocalRotationChannel {
                    Id = rigComponent.RotationChannels[i].Id, DefaultValue = rigComponent.RotationChannels[i].DefaultValue
                };
                channels.Add(channel);
            }

            for (int i = 0; i < rigComponent.ScaleChannels.Length; i++)
            {
                var channel = new LocalScaleChannel {
                    Id = rigComponent.ScaleChannels[i].Id, DefaultValue = rigComponent.ScaleChannels[i].DefaultValue
                };
                channels.Add(channel);
            }

            for (int i = 0; i < rigComponent.FloatChannels.Length; i++)
            {
                var channel = new Unity.Animation.FloatChannel {
                    Id = rigComponent.FloatChannels[i].Id, DefaultValue = rigComponent.FloatChannels[i].DefaultValue
                };
                channels.Add(channel);
            }

            for (int i = 0; i < rigComponent.IntChannels.Length; i++)
            {
                var channel = new Unity.Animation.IntChannel {
                    Id = rigComponent.IntChannels[i].Id, DefaultValue = rigComponent.IntChannels[i].DefaultValue
                };
                channels.Add(channel);
            }

            return(channels.ToArray());
        }
Пример #3
0
 public static SkeletonNode[] ExtractSkeletonNodesFromRigComponent(RigComponent rigComponent)
 {
     return(ExtractSkeletonNodesFromTransforms(rigComponent.transform, rigComponent.Bones));
 }