private void ShowDetails() { GUILayout.Label("ID: " + selectedRecord.ToString()); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Label("Skin name:"); skinName = GUILayout.TextField(skinName, GUILayout.Width(250)); GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Label("Eye:"); eyeIndex = EditorGUILayout.Popup(eyeSelected, eyesOptions); if (eyeIndex != eyeSelected) { FilterObjects(eyeIndex); eyeSelected = eyeIndex; } GUILayout.EndHorizontal(); GUILayout.Space(5); scrollObjects = GUILayout.BeginScrollView(scrollObjects); for (int iMats = 0; iMats < materialList.Count; iMats++) { GUILayout.BeginHorizontal(); GUILayout.Label(materialList[iMats].objectName); materialList [iMats].PrefabName = GUILayout.TextField(materialList [iMats].PrefabName, GUILayout.Width(150)); materialList[iMats].Prefab = (Material)EditorGUILayout.ObjectField(materialList[iMats].Prefab, typeof(Material), false, GUILayout.Width(150)); if (materialList[iMats].Prefab != null && materialList[iMats].Prefab != materialList[iMats].PrefabSelected) { materialList[iMats].PrefabName = _config.GetPrefabPath(CSConfig.PathTypeEnum.SkinsPath, AssetDatabase.GetAssetPath(materialList[iMats].Prefab)); materialList[iMats].PrefabSelected = materialList[iMats].Prefab; materialList[iMats].PrefabError = false; } GUILayout.EndHorizontal(); if (materialList[iMats].PrefabError) { EditorGUILayout.HelpBox("Material cannot be found. Load it again to update the [Material name] field.", MessageType.Error); } GUILayout.Space(10); } GUILayout.EndScrollView(); GUILayout.Space(15); if (GUILayout.Button("Save Eye Skin")) { SaveRecord(); } }
private void ShowDetails() { GUILayout.Label("ID: " + selectedRecord.ToString()); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Label("Skin name:"); skinName = GUILayout.TextField(skinName, GUILayout.Width(250)); GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Label("Body Model:"); bodyModelIndex = EditorGUILayout.Popup(bodyModelSelected, bodyModelOptions); if (bodyModelIndex != bodyModelSelected) { FilterSlots(bodyModelIndex); bodyModelSelected = bodyModelIndex; } GUILayout.EndHorizontal(); defSkin = GUILayout.Toggle(defSkin, "Default model's skin"); if (bodyModelSelected > -1) { scrollMaterial = GUILayout.BeginScrollView(scrollMaterial); for (int iMats = 0; iMats < materialList.Count; iMats++) { GUILayout.Label(materialList [iMats].SlotName, EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Label("Material name:"); materialList [iMats].PrefabName = GUILayout.TextField(materialList [iMats].PrefabName, GUILayout.Width(150)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Material:"); materialList[iMats].Prefab = (Material)EditorGUILayout.ObjectField(materialList[iMats].Prefab, typeof(Material), false, GUILayout.Width(150)); if (materialList[iMats].Prefab != null && materialList[iMats].Prefab != materialList[iMats].PrefabSelected) { materialList[iMats].PrefabName = _config.GetPrefabPath(CSConfig.PathTypeEnum.SkinsPath, AssetDatabase.GetAssetPath(materialList[iMats].Prefab)); materialList[iMats].PrefabSelected = materialList[iMats].Prefab; materialList[iMats].PrefabError = false; } GUILayout.EndHorizontal(); if (materialList[iMats].PrefabError) { EditorGUILayout.HelpBox("Material cannot be found. Load it again to update the [Material name] field.", MessageType.Error); } GUILayout.Space(10); } GUILayout.EndScrollView(); } GUILayout.Space(15); if (GUILayout.Button("Save Skin")) { SaveRecord(); } }
private void ShowDetails() { GUILayout.Label("ID: " + selectedRecord.ToString()); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Label("Cloth name:"); clothRecord.Name = GUILayout.TextField(clothRecord.Name, GUILayout.Width(250)); GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Label("Body structure:"); bodyStructIndex = EditorGUILayout.Popup(bodyStrucSelected, bodyStructOptions); if (bodyStructIndex != bodyStrucSelected) { FilterSlots(bodyStructIndex); bodyStrucSelected = bodyStructIndex; } GUILayout.EndHorizontal(); GUILayout.Space(15); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Label("Cloth Meshes", EditorStyles.boldLabel); if (bodyStrucSelected > -1) { scrollModels = GUILayout.BeginScrollView(scrollModels, GUILayout.Width(250)); for (int iModels = 0; iModels < modelsList.Count; iModels++) { GUILayout.Label(modelsList [iModels].SubtypeName, EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Label("Prefab name:"); modelsList [iModels].PrefabName = GUILayout.TextField(modelsList [iModels].PrefabName, GUILayout.Width(150)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Prefab object:"); modelsList[iModels].Prefab = (GameObject)EditorGUILayout.ObjectField(modelsList[iModels].Prefab, typeof(GameObject), false, GUILayout.Width(150)); if (modelsList[iModels].Prefab != null && modelsList[iModels].Prefab != modelsList[iModels].PrefabSelected) { modelsList[iModels].PrefabName = _config.GetPrefabPath(CSConfig.PathTypeEnum.ClothPath, AssetDatabase.GetAssetPath(modelsList[iModels].Prefab)); modelsList[iModels].PrefabSelected = modelsList[iModels].Prefab; modelsList[iModels].PrefabError = false; } GUILayout.EndHorizontal(); if (modelsList[iModels].PrefabError) { EditorGUILayout.HelpBox("Prefab cannot be found. Load it again to update the [Prefab name] field.", MessageType.Error); } GUILayout.Space(10); } GUILayout.EndScrollView(); } GUILayout.EndVertical(); GUILayout.Space(15); GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Label("Slots occupied by the cloth", EditorStyles.boldLabel); if (bodyStrucSelected > -1) { scrollSlots = GUILayout.BeginScrollView(scrollSlots, GUILayout.Width(150)); for (int iSlots = 0; iSlots < bodyStrucSlots.Count; iSlots++) { selectedSlots [iSlots] = GUILayout.Toggle(selectedSlots [iSlots], bodyStrucSlots [iSlots].SlotName); } GUILayout.EndScrollView(); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(15); if (GUILayout.Button("Save Cloth")) { SaveRecord(); } }
private void ShowItems() { int contItems = 0; GUILayout.Label("Table of Body Models", EditorStyles.boldLabel); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.Width(25)); GUILayout.Label("Model name", GUILayout.Width(200)); GUILayout.Label("Body Structure", GUILayout.Width(150)); GUILayout.Label("Body Subtype", GUILayout.Width(150)); GUILayout.Label("Prefab status", GUILayout.Width(100)); GUILayout.EndHorizontal(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); for (int iLoopItems = 0; iLoopItems < modelsList.Count; iLoopItems++) { EditorGUILayout.BeginHorizontal(); GUILayout.Label(modelsList[iLoopItems].IDModel.ToString(), GUILayout.Width(25)); if (GUILayout.Button(modelsList[iLoopItems].Name, GUILayout.Width(200))) { SelectRecord(modelsList[iLoopItems].IDModel); } GUILayout.Label(modelsList [iLoopItems].Structure, GUILayout.Width(150)); GUILayout.Label(modelsList [iLoopItems].BodySubtype, GUILayout.Width(150)); Color oldColor = GUI.contentColor; if (modelsList [iLoopItems].PrefabError) { GUI.contentColor = Color.red; GUILayout.Label("Not found", GUILayout.Width(100)); } else { GUI.contentColor = Color.blue; GUILayout.Label("OK", GUILayout.Width(100)); } GUI.contentColor = oldColor; if (GUILayout.Button("-", GUILayout.Width(25))) { int canDelete = bodyModelTable.DeleteModel(bodyModelList [iLoopItems].ID); if (canDelete > 0) { this.ShowNotification(new GUIContent(EditorGUILayout.TextField("Cannot delete model. There is a skin attached to it."))); } } EditorGUILayout.EndHorizontal(); GUILayout.Space(5); contItems++; } EditorGUILayout.EndScrollView(); if (contItems == 0) { EditorGUILayout.HelpBox("This table is empty", MessageType.Info); } GUILayout.Space(15); if (flagEdit > 0) { GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.BeginHorizontal(); GUILayout.Label("Model name:", GUILayout.Width(150)); record.Name = GUILayout.TextField(record.Name, GUILayout.Width(250)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Model prefab:", GUILayout.Width(150)); record.ModelName = GUILayout.TextField(record.ModelName, GUILayout.Width(150)); prefab = (GameObject)EditorGUILayout.ObjectField(prefab, typeof(GameObject), false, GUILayout.Width(150)); if (prefab != null && prefab != prefabSelected) { record.ModelName = _config.GetPrefabPath(CSConfig.PathTypeEnum.BodyModelsPath, AssetDatabase.GetAssetPath(prefab)); prefabSelected = prefab; prefabError = false; } GUILayout.EndHorizontal(); if (prefabError) { EditorGUILayout.HelpBox("Prefab cannot be found. Load it again to update the [Prefab name] field.", MessageType.Error); } GUILayout.BeginHorizontal(); GUILayout.Label("Bone Structure name:", GUILayout.Width(150)); record.ArmatureName = GUILayout.TextField(record.ArmatureName, GUILayout.Width(250)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Body structure:", GUILayout.Width(150)); bodyStructIndex = EditorGUILayout.Popup(bodyStrucSelected, bodyStructOptions, GUILayout.Width(150)); if (bodyStructIndex != bodyStrucSelected) { FilterSlots(bodyStructIndex); bodyStrucSelected = bodyStructIndex; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Body subtype:", GUILayout.Width(150)); bodySubtypeSelected = EditorGUILayout.Popup(bodySubtypeSelected, bodySubtypeOptions, GUILayout.Width(150)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Eyes:", GUILayout.Width(150)); eyeSelected = EditorGUILayout.Popup(eyeSelected, optEyes, GUILayout.Width(150)); if (GUILayout.Button("Save", GUILayout.Width(55))) { SaveRecord(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.Space(10); GUILayout.BeginHorizontal(); if (GUILayout.Button("Add model", GUILayout.Width(155))) { flagEdit = 1; record = new BodyModelTable.BodyModel(); } //Add button to save the table if (GUILayout.Button("Save table", GUILayout.Width(155))) { bodyModelTable.SaveList(); } GUILayout.EndHorizontal(); }