void AddClip(TakeInfo takeInfo)
        {
            string uniqueName = MakeUniqueClipName(takeInfo.defaultClipName);

            m_ClipAnimations.InsertArrayElementAtIndex(m_ClipAnimations.arraySize);
            AnimationClipInfoProperties info = GetAnimationClipInfoAtIndex(m_ClipAnimations.arraySize - 1);

            info.name = uniqueName;
            SetupTakeNameAndFrames(info, takeInfo);
            info.wrapMode                = (int)WrapMode.Default;
            info.loop                    = false;
            info.orientationOffsetY      = 0;
            info.level                   = 0;
            info.cycleOffset             = 0;
            info.loopTime                = false;
            info.loopBlend               = false;
            info.loopBlendOrientation    = false;
            info.loopBlendPositionY      = false;
            info.loopBlendPositionXZ     = false;
            info.keepOriginalOrientation = false;
            info.keepOriginalPositionY   = true;
            info.keepOriginalPositionXZ  = false;
            info.heightFromFeet          = false;
            info.mirror                  = false;
            info.maskType                = ClipAnimationMaskType.None;

            SetBodyMaskDefaultValues(info);


            info.ClearEvents();
            info.ClearCurves();
        }
        private void AddClip(TakeInfo takeInfo)
        {
            this.m_ClipAnimations.InsertArrayElementAtIndex(this.m_ClipAnimations.arraySize);
            AnimationClipInfoProperties animationClipInfoAtIndex = this.GetAnimationClipInfoAtIndex(this.m_ClipAnimations.arraySize - 1);

            animationClipInfoAtIndex.name = this.MakeUniqueClipName(takeInfo.defaultClipName, -1);
            this.SetupTakeNameAndFrames(animationClipInfoAtIndex, takeInfo);
            animationClipInfoAtIndex.wrapMode                = 0;
            animationClipInfoAtIndex.loop                    = false;
            animationClipInfoAtIndex.orientationOffsetY      = 0f;
            animationClipInfoAtIndex.level                   = 0f;
            animationClipInfoAtIndex.cycleOffset             = 0f;
            animationClipInfoAtIndex.loopTime                = false;
            animationClipInfoAtIndex.loopBlend               = false;
            animationClipInfoAtIndex.loopBlendOrientation    = false;
            animationClipInfoAtIndex.loopBlendPositionY      = false;
            animationClipInfoAtIndex.loopBlendPositionXZ     = false;
            animationClipInfoAtIndex.keepOriginalOrientation = false;
            animationClipInfoAtIndex.keepOriginalPositionY   = true;
            animationClipInfoAtIndex.keepOriginalPositionXZ  = false;
            animationClipInfoAtIndex.heightFromFeet          = false;
            animationClipInfoAtIndex.mirror                  = false;
            animationClipInfoAtIndex.maskType                = ClipAnimationMaskType.None;
            this.SetBodyMaskDefaultValues(animationClipInfoAtIndex);
            this.SetTransformMaskFromReference(animationClipInfoAtIndex);
            animationClipInfoAtIndex.ClearEvents();
            animationClipInfoAtIndex.ClearCurves();
        }
 private void PatchDefaultClipTakeNamesToSplitClipNames()
 {
     TakeInfo[] importedTakeInfos = this.singleImporter.importedTakeInfos;
     for (int i = 0; i < importedTakeInfos.Length; i++)
     {
         TakeInfo takeInfo = importedTakeInfos[i];
         PatchImportSettingRecycleID.Patch(base.serializedObject, 74, takeInfo.name, takeInfo.defaultClipName);
     }
 }
 private void SetupDefaultClips()
 {
     this.m_DefaultClipsSerializedObject = new SerializedObject(base.target);
     this.m_ClipAnimations           = this.m_DefaultClipsSerializedObject.FindProperty("m_ClipAnimations");
     this.m_AnimationType            = this.m_DefaultClipsSerializedObject.FindProperty("m_AnimationType");
     this.m_ClipAnimations.arraySize = 0;
     TakeInfo[] importedTakeInfos = this.singleImporter.importedTakeInfos;
     for (int i = 0; i < importedTakeInfos.Length; i++)
     {
         TakeInfo takeInfo = importedTakeInfos[i];
         this.AddClip(takeInfo);
     }
 }
        private void AddClip(TakeInfo takeInfo)
        {
            this.m_ClipAnimations.InsertArrayElementAtIndex(this.m_ClipAnimations.arraySize);
            AnimationClipInfoProperties animationClipInfoAtIndex = this.GetAnimationClipInfoAtIndex(this.m_ClipAnimations.arraySize - 1);

            animationClipInfoAtIndex.name = this.MakeUniqueClipName(takeInfo.defaultClipName, -1);
            this.SetupTakeNameAndFrames(animationClipInfoAtIndex, takeInfo);
            animationClipInfoAtIndex.wrapMode                = 0;
            animationClipInfoAtIndex.loop                    = false;
            animationClipInfoAtIndex.orientationOffsetY      = 0f;
            animationClipInfoAtIndex.level                   = 0f;
            animationClipInfoAtIndex.cycleOffset             = 0f;
            animationClipInfoAtIndex.loopTime                = false;
            animationClipInfoAtIndex.loopBlend               = false;
            animationClipInfoAtIndex.loopBlendOrientation    = false;
            animationClipInfoAtIndex.loopBlendPositionY      = false;
            animationClipInfoAtIndex.loopBlendPositionXZ     = false;
            animationClipInfoAtIndex.keepOriginalOrientation = false;
            animationClipInfoAtIndex.keepOriginalPositionY   = true;
            animationClipInfoAtIndex.keepOriginalPositionXZ  = false;
            animationClipInfoAtIndex.heightFromFeet          = false;
            animationClipInfoAtIndex.mirror                  = false;
            animationClipInfoAtIndex.maskType                = ClipAnimationMaskType.CreateFromThisModel;
            AvatarMask mask = new AvatarMask();

            string[]         humanTransforms  = null;
            SerializedObject serializedObject = animationClipInfoAtIndex.maskTypeProperty.serializedObject;
            ModelImporter    targetObject     = serializedObject.targetObject as ModelImporter;

            if ((this.animationType == ModelImporterAnimationType.Human) && !targetObject.isAssetOlderOr42)
            {
                humanTransforms = AvatarMaskUtility.GetAvatarHumanTransform(serializedObject, targetObject.transformPaths);
                if (humanTransforms == null)
                {
                    return;
                }
            }
            AvatarMaskUtility.UpdateTransformMask(mask, targetObject.transformPaths, humanTransforms);
            animationClipInfoAtIndex.MaskToClip(mask);
            animationClipInfoAtIndex.ClearEvents();
            animationClipInfoAtIndex.ClearCurves();
            UnityEngine.Object.DestroyImmediate(mask);
        }
 private void AddClip(TakeInfo takeInfo)
 {
     this.m_ClipAnimations.InsertArrayElementAtIndex(this.m_ClipAnimations.arraySize);
     AnimationClipInfoProperties animationClipInfoAtIndex = this.GetAnimationClipInfoAtIndex(this.m_ClipAnimations.arraySize - 1);
     animationClipInfoAtIndex.name = this.MakeUniqueClipName(takeInfo.defaultClipName, -1);
     this.SetupTakeNameAndFrames(animationClipInfoAtIndex, takeInfo);
     animationClipInfoAtIndex.wrapMode = 0;
     animationClipInfoAtIndex.loop = false;
     animationClipInfoAtIndex.orientationOffsetY = 0f;
     animationClipInfoAtIndex.level = 0f;
     animationClipInfoAtIndex.cycleOffset = 0f;
     animationClipInfoAtIndex.loopTime = false;
     animationClipInfoAtIndex.loopBlend = false;
     animationClipInfoAtIndex.loopBlendOrientation = false;
     animationClipInfoAtIndex.loopBlendPositionY = false;
     animationClipInfoAtIndex.loopBlendPositionXZ = false;
     animationClipInfoAtIndex.keepOriginalOrientation = false;
     animationClipInfoAtIndex.keepOriginalPositionY = true;
     animationClipInfoAtIndex.keepOriginalPositionXZ = false;
     animationClipInfoAtIndex.heightFromFeet = false;
     animationClipInfoAtIndex.mirror = false;
     animationClipInfoAtIndex.maskType = ClipAnimationMaskType.CreateFromThisModel;
     AvatarMask mask = new AvatarMask();
     string[] humanTransforms = null;
     SerializedObject serializedObject = animationClipInfoAtIndex.maskTypeProperty.serializedObject;
     ModelImporter targetObject = serializedObject.targetObject as ModelImporter;
     if ((this.animationType == ModelImporterAnimationType.Human) && !targetObject.isAssetOlderOr42)
     {
         humanTransforms = AvatarMaskUtility.GetAvatarHumanTransform(serializedObject, targetObject.transformPaths);
         if (humanTransforms == null)
         {
             return;
         }
     }
     AvatarMaskUtility.UpdateTransformMask(mask, targetObject.transformPaths, humanTransforms);
     animationClipInfoAtIndex.MaskToClip(mask);
     animationClipInfoAtIndex.ClearEvents();
     animationClipInfoAtIndex.ClearCurves();
     UnityEngine.Object.DestroyImmediate(mask);
 }
 private void SetupTakeNameAndFrames(AnimationClipInfoProperties info, TakeInfo takeInfo)
 {
     info.takeName   = takeInfo.name;
     info.firstFrame = (int)Mathf.Round(takeInfo.bakeStartTime * takeInfo.sampleRate);
     info.lastFrame  = (int)Mathf.Round(takeInfo.bakeStopTime * takeInfo.sampleRate);
 }
 private void SetupTakeNameAndFrames(AnimationClipInfoProperties info, TakeInfo takeInfo)
 {
     info.takeName = takeInfo.name;
     info.firstFrame = (int) Mathf.Round(takeInfo.bakeStartTime * takeInfo.sampleRate);
     info.lastFrame = (int) Mathf.Round(takeInfo.bakeStopTime * takeInfo.sampleRate);
 }
 private void AddClip(TakeInfo takeInfo)
 {
   this.m_ClipAnimations.InsertArrayElementAtIndex(this.m_ClipAnimations.arraySize);
   AnimationClipInfoProperties animationClipInfoAtIndex = this.GetAnimationClipInfoAtIndex(this.m_ClipAnimations.arraySize - 1);
   animationClipInfoAtIndex.name = this.MakeUniqueClipName(takeInfo.defaultClipName, -1);
   this.SetupTakeNameAndFrames(animationClipInfoAtIndex, takeInfo);
   animationClipInfoAtIndex.wrapMode = 0;
   animationClipInfoAtIndex.loop = false;
   animationClipInfoAtIndex.orientationOffsetY = 0.0f;
   animationClipInfoAtIndex.level = 0.0f;
   animationClipInfoAtIndex.cycleOffset = 0.0f;
   animationClipInfoAtIndex.loopTime = false;
   animationClipInfoAtIndex.loopBlend = false;
   animationClipInfoAtIndex.loopBlendOrientation = false;
   animationClipInfoAtIndex.loopBlendPositionY = false;
   animationClipInfoAtIndex.loopBlendPositionXZ = false;
   animationClipInfoAtIndex.keepOriginalOrientation = false;
   animationClipInfoAtIndex.keepOriginalPositionY = true;
   animationClipInfoAtIndex.keepOriginalPositionXZ = false;
   animationClipInfoAtIndex.heightFromFeet = false;
   animationClipInfoAtIndex.mirror = false;
   animationClipInfoAtIndex.maskType = ClipAnimationMaskType.CreateFromThisModel;
   this.SetBodyMaskDefaultValues(animationClipInfoAtIndex);
   this.SetTransformMaskFromReference(animationClipInfoAtIndex);
   animationClipInfoAtIndex.ClearEvents();
   animationClipInfoAtIndex.ClearCurves();
 }