private bool DrawWardrobeSetUI()
            {
                bool changed = false;

                if (_recipe.raceData != null)
                {
                    if (_recipe.raceData.wardrobeSlots.Count > 0)
                    {
                        GUILayout.BeginHorizontal(EditorStyles.toolbarButton);
                        GUILayout.Space(10);
                        bool wsfoldoutOpen = OpenSlots["wardrobeSet"];
                        wsfoldoutOpen            = EditorGUILayout.Foldout(OpenSlots["wardrobeSet"], "Wardrobe Set");
                        OpenSlots["wardrobeSet"] = wsfoldoutOpen;
                        GUILayout.EndHorizontal();
                        if (wsfoldoutOpen)
                        {
                            if (_wardrobeSet == null)
                            {
                                return(false);
                            }
                            //if this is a 'backwards compatible' recipe dont show the 'wardrobeCollections' bit since old avatars cannot wear collections
                            bool showWardrobeCollections = _recipe.slotDataList.Length > 0 ? false : true;
                            var  thisWardrobeSetEditor   = new WardrobeSetEditor(_recipe.raceData, _wardrobeSet, _recipe, showWardrobeCollections);
                            if (thisWardrobeSetEditor.OnGUI())
                            {
                                _wardrobeSet = thisWardrobeSetEditor.WardrobeSet;
                                changed      = true;
                            }
                        }
                    }
                }
                return(changed);
            }
Example #2
0
            private bool DrawWardrobeSetUI()
            {
                bool changed = false;

                if (_recipe.raceData != null)
                {
                    if (_recipe.raceData.wardrobeSlots.Count > 0)
                    {
                        GUILayout.BeginHorizontal(EditorStyles.toolbarButton);
                        GUILayout.Space(10);
                        bool wsfoldoutOpen = OpenSlots["wardrobeSet"];
                        wsfoldoutOpen            = EditorGUILayout.Foldout(OpenSlots["wardrobeSet"], "Wardrobe Set");
                        OpenSlots["wardrobeSet"] = wsfoldoutOpen;
                        GUILayout.EndHorizontal();
                        if (wsfoldoutOpen)
                        {
                            if (_wardrobeSet == null)
                            {
                                return(false);
                            }
                            var thisWardrobeSetEditor = new WardrobeSetEditor(_recipe.raceData, _wardrobeSet, _recipe, true);
                            if (thisWardrobeSetEditor.OnGUI())
                            {
                                _wardrobeSet = thisWardrobeSetEditor.WardrobeSet;
                                changed      = true;
                            }
                        }
                    }
                }
                return(changed);
            }
Example #3
0
            public override bool OnGUI(string targetName, ref bool _dnaDirty, ref bool _textureDirty, ref bool _meshDirty)
            {
                var context = UMAContext.FindInstance();

                if (context == null)
                {
                    var _errorMessage = "Editing a recipe requires a loaded scene with a valid UMAContext.";
                    Debug.LogWarning(_errorMessage);
                    return(false);
                }
                bool changed = forceGUIUpdate;

                //Make a foldout for WardrobeSets - the UI for an individual WardrobeSet is added for each compatible race in the collection
                GUILayout.BeginHorizontal(EditorStyles.toolbarButton);
                GUILayout.Space(10);
                bool wsfoldoutOpen = OpenSlots["wardrobeSets"];

                wsfoldoutOpen             = EditorGUILayout.Foldout(OpenSlots["wardrobeSets"], "Wardrobe Sets");
                OpenSlots["wardrobeSets"] = wsfoldoutOpen;
                GUILayout.EndHorizontal();
                if (wsfoldoutOpen)
                {
                    GUIHelper.BeginVerticalPadded(10, new Color(0.75f, 0.875f, 1f));

                    EditorGUILayout.HelpBox("Wardrobe Sets are added for each 'Compatible Race' assigned above. They can be assigned to an avatar of that race in its 'FullOutfit' slot. 'SharedColors' in this section will be applied to the Avatar when the 'FullOutfit' recipe is applied to the character", MessageType.Info);
                    if (_compatibleRaces.Count > 0)
                    {
                        //dont show shared colors unless there are 'FullOutfits' to apply them to
                        if (_sharedColorsEditor.OnGUI(_recipe))
                        {
                            changed       = true;
                            _textureDirty = true;
                        }
                        for (int i = 0; i < _compatibleRaces.Count; i++)
                        {
                            var thisRace = context.raceLibrary.GetRace(_compatibleRaces[i]);
                            if (thisRace != null)
                            {
                                GUILayout.BeginHorizontal(EditorStyles.toolbarButton);
                                GUILayout.Space(10);
                                bool foldoutOpen = OpenSlots[_compatibleRaces[i]];
                                foldoutOpen = EditorGUILayout.Foldout(OpenSlots[_compatibleRaces[i]], " Wardrobe Set: " + _compatibleRaces[i]);
                                OpenSlots[_compatibleRaces[i]] = foldoutOpen;
                                GUILayout.EndHorizontal();
                                if (foldoutOpen)
                                {
                                    var thisSetEditor = new WardrobeSetEditor(thisRace, _wardrobeCollection[thisRace.raceName], _recipe, false);
                                    if (thisSetEditor.OnGUI())
                                    {
                                        _wardrobeCollection[thisRace.raceName] = thisSetEditor.WardrobeSet;
                                        changed = true;
                                    }
                                }
                            }
                            else
                            {
                                //Do the foldout thing but show as 'missing'
                                GUILayout.BeginHorizontal(EditorStyles.toolbarButton);
                                GUILayout.Space(10);
                                bool foldoutOpen = OpenSlots[_compatibleRaces[i]];
                                foldoutOpen = EditorGUILayout.Foldout(OpenSlots[_compatibleRaces[i]], _compatibleRaces[i] + " Wardrobe Set (Missing)");
                                OpenSlots[_compatibleRaces[i]] = foldoutOpen;
                                GUILayout.EndHorizontal();
                                if (foldoutOpen)
                                {
                                    GUIHelper.BeginVerticalPadded(10, new Color(0.75f, 0.875f, 1f));
                                    EditorGUILayout.HelpBox("_compatibleRaces[i] could not be located by the Dynamic Race Library", MessageType.Warning);
                                    GUIHelper.EndVerticalPadded(10);
                                }
                            }
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("Drag in compatible races at the top of this recipe and WardrobeSets for those races will show here", MessageType.Info);
                    }
                    GUIHelper.EndVerticalPadded(10);
                }
                GUILayout.Space(10);
                //the Arbitrary Recipes section
                GUILayout.BeginHorizontal(EditorStyles.toolbarButton);
                GUILayout.Space(10);
                bool arbiOpen = OpenSlots["arbitraryRecipes"];

                arbiOpen = EditorGUILayout.Foldout(OpenSlots["arbitraryRecipes"], "Arbitrary Recipes");
                OpenSlots["arbitraryRecipes"] = arbiOpen;
                Rect dropArea = new Rect();

                GUILayout.EndHorizontal();
                if (arbiOpen)
                {
                    GUIHelper.BeginVerticalPadded(10, new Color(0.75f, 0.875f, 1f));
                    EditorGUILayout.HelpBox("Drop recipes in to this area to create a collection that is not a full outfit or connected to any given race, for example a 'Hair Styles' pack or 'Tattoos' pack.", MessageType.Info);
                    dropArea = GUILayoutUtility.GetRect(0.0f, 50.0f, GUILayout.ExpandWidth(true));
                    GUI.Box(dropArea, "Drag WardrobeRecipes here. " + recipesAddErrMsg);
                    if (_arbitraryRecipes.Count > 0)
                    {
                        for (int i = 0; i < _arbitraryRecipes.Count; i++)
                        {
                            GUILayout.Space(2f);
                            GUI.enabled = false;                             //we readonly to prevent typos
                            Rect crfRect    = GUILayoutUtility.GetRect(0.0f, EditorGUIUtility.singleLineHeight, GUILayout.ExpandWidth(true));
                            Rect crfDelRect = crfRect;
                            crfRect.width    = crfRect.width - 20f - 5f;
                            crfDelRect.width = 20f + 2f;
                            crfDelRect.x     = crfRect.width + 20f + 10f;
                            EditorGUI.TextField(crfRect, _arbitraryRecipes[i]);
                            GUI.enabled = true;
                            if (GUI.Button(crfDelRect, "X"))
                            {
                                _arbitraryRecipes.RemoveAt(i);
                                changed = true;
                            }
                        }
                    }
                    GUIHelper.EndVerticalPadded(10);
                    if (AddRecipesDropAreaGUI(ref recipesAddErrMsg, dropArea, _arbitraryRecipes))
                    {
                        changed = true;
                    }
                }
                return(changed);
            }