Esempio n. 1
0
 /// <summary>
 /// 骨骼与蒙皮操作完成
 /// </summary>
 private void DoneGUI()
 {
     SetGUIColor(Color.white, Color.white);
     EditorGUILayout.BeginHorizontal();
     if (GUILayout.Button("Open In Editor Window"))
     {
         MorphAnimationWindow maw = EditorWindow.GetWindow <MorphAnimationWindow>();
         maw.titleContent             = new GUIContent(EditorGUIUtility.IconContent("Animation Icon"));
         maw.titleContent.text        = "Morph Editor";
         maw.autoRepaintOnSceneChange = true;
         maw.Init(_morphAnimation);
         maw.Show();
     }
     EditorGUILayout.EndHorizontal();
 }
Esempio n. 2
0
    private void Done()
    {
        SaveMorphMesh();

        _morphAnimation.IsDone            = true;
        _morphAnimation.Bones             = _skinnedMeshRenderer.bones.ToList();
        _morphAnimation.BindPosesPosition = new List <Vector3>();
        _morphAnimation.BindPosesRotation = new List <Quaternion>();
        _morphAnimation.BindPosesScale    = new List <Vector3>();
        for (int i = 0; i < _morphAnimation.Bones.Count; i++)
        {
            _morphAnimation.BindPosesPosition.Add(_morphAnimation.Bones[i].localPosition);
            _morphAnimation.BindPosesRotation.Add(_morphAnimation.Bones[i].localRotation);
            _morphAnimation.BindPosesScale.Add(_morphAnimation.Bones[i].localScale);
        }
        _morphAnimation.AnimationFrames = new List <MorphAnimationFrame>();
        _morphAnimation.TimeLine        = new List <MorphAnimationFrame>();

        _morphAnimation.Triangles = null;
        _morphAnimation.Vertexs   = null;
        for (int i = 0; i < _morphAnimation.Bones.Count; i++)
        {
            MorphBone mb = _morphAnimation.Bones[i].GetComponent <MorphBone>();
            if (mb)
            {
                DestroyImmediate(mb);
            }
        }

        MorphAnimationWindow maw = EditorWindow.GetWindow <MorphAnimationWindow>();

        maw.titleContent             = new GUIContent(EditorGUIUtility.IconContent("Animation Icon"));
        maw.titleContent.text        = "Morph Editor";
        maw.autoRepaintOnSceneChange = true;
        maw.Init(_morphAnimation);
        maw.Show();
    }