Exemple #1
0
        void OnGUI()
        {
            EditorGUILayout.LabelField("UMA Prefab Saver", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("This will convert an UMA avatar into a non-UMA prefab. Once converted, it can be reused with little overhead, but all UMA functionality will be lost.", MessageType.None, false);
            baseObject          = (UMAAvatarBase)EditorGUILayout.ObjectField("UMA Avatar", baseObject, typeof(UMAAvatarBase), true);
            UnswizzleNormalMaps = EditorGUILayout.Toggle("Unswizzle Normals", UnswizzleNormalMaps);
            CharacterName       = EditorGUILayout.TextField("Prefab Name", CharacterName);
            prefabFolder        = EditorGUILayout.ObjectField("Prefab Base Folder", prefabFolder, typeof(UnityEngine.Object), false) as UnityEngine.Object;

            string folder = CheckFolder(ref prefabFolder);

            if (prefabFolder != null && baseObject != null && !string.IsNullOrEmpty(CharacterName))
            {
                if (GUILayout.Button("Make Prefab") && prefabFolder != null)
                {
                    UMAAvatarLoadSaveMenuItems.ConvertToNonUMA(baseObject.gameObject, baseObject, folder, UnswizzleNormalMaps, CharacterName);
                    EditorUtility.DisplayDialog("UMA Prefab Saver", "Conversion complete", "OK");
                }
            }
            else
            {
                if (baseObject == null)
                {
                    EditorGUILayout.HelpBox("A valid character with DynamicCharacterAvatar or DynamicAvatar must be supplied", MessageType.Error);
                }
                if (string.IsNullOrEmpty(CharacterName))
                {
                    EditorGUILayout.HelpBox("Prefab Name cannot be empty", MessageType.Error);
                }
                if (prefabFolder == null)
                {
                    EditorGUILayout.HelpBox("A valid base folder must be supplied", MessageType.Error);
                }
            }
        }
Exemple #2
0
        void OnGUI()
        {
            EditorGUILayout.LabelField("UMA Prefab Saver", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("This will convert an UMA avatar into a non-UMA prefab. Once converted, it can be reused with little overhead, but all UMA functionality will be lost.", MessageType.None, false);
            baseObject = (UMAAvatarBase)EditorGUILayout.ObjectField("UMA Avatar", baseObject, typeof(UMAAvatarBase), true);
            EditorGUILayout.HelpBox("If you unswizzle normals (recommended) then they can be used in other applications, and UMA will automatically mark them as normal maps in the import settings.", MessageType.None);
            UnswizzleNormalMaps = EditorGUILayout.Toggle("Unswizzle Normals", UnswizzleNormalMaps);
            EditorGUILayout.HelpBox("Adding Standalone DNA will allow you to adjust most DNA of the character, without it being an UMA. However, it will require that you have the UMA system in the project.", MessageType.None);
            AddStandaloneDNA = EditorGUILayout.Toggle("Add Standalone DNA", AddStandaloneDNA);
            CharacterName    = EditorGUILayout.TextField("Prefab Name", CharacterName);
            prefabFolder     = EditorGUILayout.ObjectField("Prefab Base Folder", prefabFolder, typeof(UnityEngine.Object), false) as UnityEngine.Object;

            string folder = CheckFolder(ref prefabFolder);

            if (prefabFolder != null && baseObject != null && !string.IsNullOrEmpty(CharacterName))
            {
                if (GUILayout.Button("Make Prefab") && prefabFolder != null)
                {
                    UMAAvatarLoadSaveMenuItems.ConvertToNonUMA(baseObject.gameObject, baseObject, folder, UnswizzleNormalMaps, CharacterName, AddStandaloneDNA);
                    EditorUtility.DisplayDialog("UMA Prefab Saver", "Conversion complete", "OK");
                }
            }
            else
            {
                if (baseObject == null)
                {
                    EditorGUILayout.HelpBox("A valid character with DynamicCharacterAvatar or DynamicAvatar must be supplied", MessageType.Error);
                }
                if (string.IsNullOrEmpty(CharacterName))
                {
                    EditorGUILayout.HelpBox("Prefab Name cannot be empty", MessageType.Error);
                }
                if (prefabFolder == null)
                {
                    EditorGUILayout.HelpBox("A valid base folder must be supplied", MessageType.Error);
                }
            }
        }