Example #1
0
        /// <summary>
        /// Draw the Profile selection controls within the Profile section UI
        /// </summary>
        private void DrawProfileSelect()
        {
            if (ActiveProfile != null && ActiveProfile.ReadOnly)
            {
                EditorHelper.DrawInspectorDescription("The selected profile does not allow editing. Press the 'Copy' button" +
                                                      " to make a duplicate for editing");
            }

            if (ActiveProfile != null && !ActiveProfile.HasRequiredPacks)
            {
                EditorHelper.DrawInspectorDescription("One or more of the Motion Packs used by this profile are missing. " +
                                                      "Select the profile's asset directly in the Project View to edit these requirements.\n\n" +
                                                      "You may still proceed with setting up a character without the missing Motion Packs.", MessageType.Warning);
            }

            try
            {
                EditorGUILayout.BeginHorizontal();

                if (EditorHelper.ScriptableObjectField("Profile",
                                                       "The Character Wizard Profile to use for creating this character.", ActiveProfile,
                                                       typeof(CharacterWizardProfile), this))
                {
                    ActiveProfile = (CharacterWizardProfile)EditorHelper.FieldObjectValue;
                    OnActiveProfileChanged(true);
                }

                GUILayout.Space(10);

                EditorGUI.BeginDisabledGroup(ActiveProfile == null);
                if (GUILayout.Button("Copy", SmallButtonStyle, GUILayout.Width(60)))
                {
                    // Create a copy of the current profile
                    if (ActiveProfile != null)
                    {
                        ActiveProfile = (ActiveProfile.Priority == CharacterWizardProfile.PriorityStatus.User)
                            ? ActiveProfile.Copy()
                            : ActiveProfile.Copy(DefaultCustomProfileFolder + ActiveProfile.FileName);
                        OnActiveProfileChanged(true);
                    }
                }
                EditorGUI.EndDisabledGroup();

                GUILayout.Space(10);

                if (GUILayout.Button("New", SmallButtonStyle, GUILayout.Width(60)))
                {
                    // Create a new profile
                    ActiveProfile = CharacterWizardProfile.Create(DefaultCustomProfileFolder + NewProfileName);
                    OnActiveProfileChanged(true);
                }
                GUILayout.Space(10);
            }
            finally
            {
                EditorGUILayout.EndHorizontal();
            }


            if (ActiveProfile != null && !ActiveProfile.ReadOnly)
            {
                EditorGUILayout.HelpBox(
                    "Changing the profile name will also rename the asset file in your project. " +
                    "The change will not take effect until you press Enter or focus on another input field.",
                    MessageType.Info);
                GUILayout.Space(5);
                if (EditorHelper.DelayedTextField("Profile Name",
                                                  "Enter a new name for the profile. This will rename the profile's .asset file.",
                                                  ActiveProfile.name, this))
                {
                    if (!string.IsNullOrEmpty(EditorHelper.FieldStringValue))
                    {
                        ActiveProfile.Rename(EditorHelper.FieldStringValue, true);
                        OnActiveProfileChanged(true);
                    }
                }
            }
        }