void DrawUnityTools()
    {
        bool pre = showUnity;

        showUnity = EditorGUILayout.Foldout(showUnity, new GUIContent("Unity Tools", SpineEditorUtilities.Icons.unityIcon));
        if (pre != showUnity)
        {
            EditorPrefs.SetBool("SkeletonDataAssetInspector_showUnity", showUnity);
        }

        if (showUnity)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.LabelField("SkeletonAnimator", EditorStyles.boldLabel);
            EditorGUI.indentLevel++;
            DrawMecanim();
            EditorGUI.indentLevel--;
            GUILayout.Space(32);
            EditorGUILayout.LabelField("Baking", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("WARNING!\n\nBaking is NOT the same as SkeletonAnimator!\nDoes not support the following:\n\tFlipX or Y\n\tInheritScale\n\tColor Keys\n\tDraw Order Keys\n\tIK and Curves are sampled at 60fps and are not realtime.\n\tPlease read SkeletonBaker.cs comments for full details.\n\nThe main use of Baking is to export Spine projects to be used without the Spine Runtime (ie: for sale on the Asset Store, or background objects that are animated only with a wind noise generator)", MessageType.Warning, true);
            EditorGUI.indentLevel++;
            bakeAnimations = EditorGUILayout.Toggle("Bake Animations", bakeAnimations);
            EditorGUI.BeginDisabledGroup(!bakeAnimations);
            {
                EditorGUI.indentLevel++;
                bakeIK           = EditorGUILayout.Toggle("Bake IK", bakeIK);
                bakeEventOptions = (SendMessageOptions)EditorGUILayout.EnumPopup("Event Options", bakeEventOptions);
                EditorGUI.indentLevel--;
            }
            EditorGUI.EndDisabledGroup();

            EditorGUI.indentLevel++;
            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button(new GUIContent("Bake All Skins", SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(150)))
                {
                    SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, m_skeletonData.Skins, "", bakeAnimations, bakeIK, bakeEventOptions);
                }

                string skinName = "<No Skin>";

                if (m_skeletonAnimation != null && m_skeletonAnimation.skeleton != null)
                {
                    Skin bakeSkin = m_skeletonAnimation.skeleton.Skin;
                    if (bakeSkin == null)
                    {
                        skinName = "Default";
                        bakeSkin = m_skeletonData.Skins.Items[0];
                    }
                    else
                    {
                        skinName = m_skeletonAnimation.skeleton.Skin.Name;
                    }

                    bool oops = false;

                    try {
                        GUILayout.BeginVertical();
                        if (GUILayout.Button(new GUIContent("Bake " + skinName, SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(250)))
                        {
                            SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, new ExposedList <Skin>(new [] { bakeSkin }), "", bakeAnimations, bakeIK, bakeEventOptions);
                        }

                        GUILayout.BeginHorizontal();
                        GUILayout.Label(new GUIContent("Skins", SpineEditorUtilities.Icons.skinsRoot), GUILayout.Width(50));
                        if (GUILayout.Button(skinName, EditorStyles.popup, GUILayout.Width(196)))
                        {
                            SelectSkinContext();
                        }
                        GUILayout.EndHorizontal();
                    } catch {
                        oops = true;
                        //GUILayout.BeginVertical();
                    }



                    if (!oops)
                    {
                        GUILayout.EndVertical();
                    }
                }
            }
            GUILayout.EndHorizontal();
            EditorGUI.indentLevel--;
            EditorGUI.indentLevel--;
        }
    }
Exemple #2
0
    void DrawBaking()
    {
        bool pre = showBaking;

        showBaking = EditorGUILayout.Foldout(showBaking, new GUIContent("Baking", SpineEditorUtilities.Icons.unityIcon));
        if (pre != showBaking)
        {
            EditorPrefs.SetBool("SkeletonDataAssetInspector_showBaking", showBaking);
        }

        if (showBaking)
        {
            EditorGUI.indentLevel++;
            bakeAnimations = EditorGUILayout.Toggle("Bake Animations", bakeAnimations);
            EditorGUI.BeginDisabledGroup(bakeAnimations == false);
            {
                EditorGUI.indentLevel++;
                bakeIK           = EditorGUILayout.Toggle("Bake IK", bakeIK);
                bakeEventOptions = (SendMessageOptions)EditorGUILayout.EnumPopup("Event Options", bakeEventOptions);
                EditorGUI.indentLevel--;
            }
            EditorGUI.EndDisabledGroup();

            EditorGUI.indentLevel++;
            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button(new GUIContent("Bake All Skins", SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(150)))
                {
                    SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, m_skeletonData.Skins, "", bakeAnimations, bakeIK, bakeEventOptions);
                }

                string skinName = "<No Skin>";

                if (m_skeletonAnimation != null && m_skeletonAnimation.skeleton != null)
                {
                    Skin bakeSkin = m_skeletonAnimation.skeleton.Skin;
                    if (bakeSkin == null)
                    {
                        skinName = "Default";
                        bakeSkin = m_skeletonData.Skins[0];
                    }
                    else
                    {
                        skinName = m_skeletonAnimation.skeleton.Skin.Name;
                    }

                    bool oops = false;

                    try {
                        GUILayout.BeginVertical();
                        if (GUILayout.Button(new GUIContent("Bake " + skinName, SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(250)))
                        {
                            SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, new List <Skin>(new Skin[] { bakeSkin }), "", bakeAnimations, bakeIK, bakeEventOptions);
                        }

                        GUILayout.BeginHorizontal();
                        GUILayout.Label(new GUIContent("Skins", SpineEditorUtilities.Icons.skinsRoot), GUILayout.Width(50));
                        if (GUILayout.Button(skinName, EditorStyles.popup, GUILayout.Width(196)))
                        {
                            SelectSkinContext();
                        }
                        GUILayout.EndHorizontal();
                    } catch {
                        oops = true;
                        //GUILayout.BeginVertical();
                    }



                    if (!oops)
                    {
                        GUILayout.EndVertical();
                    }
                }
            }
            GUILayout.EndHorizontal();
            EditorGUI.indentLevel--;
            EditorGUI.indentLevel--;
        }
    }