示例#1
0
        private void EditButtonGUI()
        {
            if (this.avatar == null || !this.avatar.isHuman)
            {
                return;
            }
            string        assetPath = AssetDatabase.GetAssetPath(this.avatar);
            ModelImporter x         = AssetImporter.GetAtPath(assetPath) as ModelImporter;

            if (x == null)
            {
                return;
            }
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(AvatarEditor.styles.editCharacter, new GUILayoutOption[]
            {
                GUILayout.Width(120f)
            }) && EditorApplication.SaveCurrentSceneIfUserWantsTo())
            {
                this.SwitchToEditMode();
                GUIUtility.ExitGUI();
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
        }
示例#2
0
 private void ConfigureAvatarGUI()
 {
     if (base.targets.Length > 1)
     {
         GUILayout.Label("Can't configure avatar in multi-editing mode", EditorStyles.helpBox, new GUILayoutOption[0]);
     }
     else if (this.singleImporter.transformPaths.Length <= HumanTrait.RequiredBoneCount)
     {
         GUILayout.Label("Not enough bones to create human avatar (requires " + HumanTrait.RequiredBoneCount + ")", EditorStyles.helpBox, new GUILayoutOption[0]);
     }
     else
     {
         GUIContent avatarValid;
         if ((this.m_Avatar != null) && !this.HasModified())
         {
             if (this.m_Avatar.isHuman)
             {
                 avatarValid = styles.avatarValid;
             }
             else
             {
                 avatarValid = styles.avatarInvalid;
             }
         }
         else
         {
             avatarValid = styles.avatarPending;
             GUILayout.Label("The avatar can be configured after settings have been applied.", EditorStyles.helpBox, new GUILayoutOption[0]);
         }
         Rect controlRect = EditorGUILayout.GetControlRect(new GUILayoutOption[0]);
         GUI.Label(new Rect((controlRect.xMax - 75f) - 18f, controlRect.y, 18f, controlRect.height), avatarValid, EditorStyles.label);
         EditorGUI.BeginDisabledGroup(this.m_Avatar == null);
         if (GUI.Button(new Rect(controlRect.xMax - 75f, controlRect.y + 1f, 75f, controlRect.height - 1f), styles.configureAvatar, EditorStyles.miniButton))
         {
             if (!this.isLocked)
             {
                 if (EditorApplication.SaveCurrentSceneIfUserWantsTo())
                 {
                     Selection.activeObject = this.m_Avatar;
                     AvatarEditor.s_EditImmediatelyOnNextOpen = true;
                 }
                 GUIUtility.ExitGUI();
             }
             else
             {
                 Debug.Log("Cannot configure avatar, inspector is locked");
             }
         }
         EditorGUI.EndDisabledGroup();
     }
 }
示例#3
0
 private void EditButtonGUI()
 {
     if ((this.avatar != null) && this.avatar.isHuman)
     {
         ModelImporter atPath = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(this.avatar)) as ModelImporter;
         if (atPath != null)
         {
             EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
             GUILayout.FlexibleSpace();
             GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(120f) };
             if (GUILayout.Button(styles.editCharacter, options) && EditorApplication.SaveCurrentSceneIfUserWantsTo())
             {
                 this.SwitchToEditMode();
                 GUIUtility.ExitGUI();
             }
             GUILayout.FlexibleSpace();
             EditorGUILayout.EndHorizontal();
         }
     }
 }