Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            AnimatorData mb = target as AnimatorData;

            Dbg.Assert(mb != null, "AnimatorDataEditor.OnInspectorGUI: cannot get target: {0}", target.name);

            EditorGUILayout.HelpBox("If you want to modify the takes list, do it via the Timeline editor", MessageType.Info);

            if (EUtil.Button("Open Timeline Editor", Color.green))
            {
                AMTimeline.ResetWithAnimatorData((AnimatorData)target);
            }

            string playOnStartName = (m_spPlayOnStart.objectReferenceValue != null) ? ((AMTake)m_spPlayOnStart.objectReferenceValue).name : "None";

            EditorGUILayout.LabelField("Play On Start:  " + playOnStartName);

            EUtil.DrawSplitter();

            for (int i = 0; i < m_spTakes.arraySize; ++i)
            {
                var oneTake = m_spTakes.GetArrayElementAtIndex(i);

                GUILayout.BeginHorizontal();
                {
                    if (oneTake != null && oneTake.objectReferenceValue != null)
                    {
                        AMTake takeObj = oneTake.objectReferenceValue as AMTake;
                        EditorGUILayout.LabelField(string.Format("{0}: \"{1} fr, {2} fps\"", takeObj.name, takeObj.numFrames, takeObj.frameRate));
                        if (GUILayout.Button(new GUIContent(ms_inspectTex, "inspect this take's content"), GUILayout.Height(20f), GUILayout.Width(30f)))
                        {
                            Selection.activeObject = takeObj;
                        }
                        //EUtil.PushGUIColor(EditorUtility.IsPersistent(takeObj) ? Color.yellow : Color.green);
                        //if (GUILayout.Button(new GUIContent("S", "save asset to disk"), GUILayout.Width(30f)))
                        //{
                        //    string path = null;
                        //    if (!EditorUtility.IsPersistent(takeObj))
                        //        path = EditorUtility.SaveFilePanelInProject("Save Take", takeObj.name, "asset", "Select asset path");
                        //    else
                        //        path = AssetDatabase.GetAssetPath(takeObj);

                        //    if (!string.IsNullOrEmpty(path))
                        //    {
                        //        takeObj.SaveAsset(mb, path);
                        //        EUtil.ShowNotification("Saved Take at: " + path, 3f);
                        //    }
                        //}
                        //EUtil.PopGUIColor();
                    }
                    else
                    {
                        GUILayout.Label("This slot is null reference");
                    }
                }
                GUILayout.EndHorizontal();
            }

            serializedObject.ApplyModifiedProperties();
        }