void findUMAStuff() { this.slotLibrary = GameObject.Find ("SlotLibrary").GetComponent<SlotLibrary>(); this.generator = GameObject.Find ("UMAGenerator").GetComponent<UMAGenerator>(); this.overlayLibrary = GameObject.Find("OverlayLibrary").GetComponent<OverlayLibrary>(); this.raceLibrary = GameObject.Find ("RaceLibrary").GetComponent<RaceLibrary>(); }
void Awake() { slotLibrary = GameObject.Find("SlotLibrary").GetComponent<SlotLibrary>(); overlayLibrary = GameObject.Find("OverlayLibrary").GetComponent<OverlayLibrary>(); raceLibrary = GameObject.Find("RaceLibrary").GetComponent<RaceLibrary>(); generator = GameObject.Find("UMAGenerator").GetComponent<UMAGenerator>(); }
void Awake() { slotLibrary = GameObject.Find("SlotLibrary").GetComponent <SlotLibrary>(); overlayLibrary = GameObject.Find("OverlayLibrary").GetComponent <OverlayLibrary>(); raceLibrary = GameObject.Find("RaceLibrary").GetComponent <RaceLibrary>(); generator = GameObject.Find("UMAGenerator").GetComponent <UMAGenerator>(); }
public static void Init() { UMAObject = Object.Instantiate(Resources.Load <GameObject>("UMAKit")); Generator = UMAObject.GetComponentInChildren <UMAGenerator>(); SlotLibrary = UMAObject.GetComponentInChildren <SlotLibrary>(); OverlayLibrary = UMAObject.GetComponentInChildren <OverlayLibrary>(); RaceLibrary = UMAObject.GetComponentInChildren <RaceLibrary>(); RegisterPlayerModelInternal(null, new UMAModelController()); }
// Use this for initialization void Start() { //Load relevant Libs generator = GameObject.FindObjectOfType <UMAGeneratorBase> (); slotLibrary = GameObject.FindObjectOfType <SlotLibrary> () as SlotLibrary; overlayLibrary = GameObject.FindObjectOfType <OverlayLibrary> () as OverlayLibrary; raceLibrary = GameObject.FindObjectOfType <RaceLibrary> () as RaceLibrary; GeneratUMA(); LoadAssetName(); load = true; otherLoaded = false; }
void AddToUMALib() { // to be changed for next UMA version // GameObject UMAContext = GameObject.Find("UMAContext"); if (_SlotLibrary == null) { _SlotLibrary = GameObject.Find("SlotLibrary").GetComponent <SlotLibrary>(); } if (_OverlayLibrary == null) { _OverlayLibrary = GameObject.Find("OverlayLibrary").GetComponent <OverlayLibrary>(); } List <UMA.SlotData> LibSlotsList = new List <UMA.SlotData>(); if (_SlotLibrary != null) { LibSlotsList = _SlotLibrary.GetAllSlots().ToList(); } // Slots if (_SlotLibrary != null) { for (int i = 0; i < _UMA_Variables.UMASlotsList.Count; i++) { if (LibSlotsList.Contains(_UMA_Variables.UMASlotsList[i] as UMA.SlotData) == false) { _SlotLibrary.AddSlot(_UMA_Variables.UMASlotsList[i] as UMA.SlotData); } } } List <UMA.OverlayData> LibOvsList = new List <UMA.OverlayData>(); if (_OverlayLibrary != null) { LibOvsList = _OverlayLibrary.GetAllOverlays().ToList(); } // Overlays if (_OverlayLibrary != null) { for (int i = 0; i < _UMA_Variables.UMAOverlaysList.Count; i++) { if (LibOvsList.Contains(_UMA_Variables.UMAOverlaysList[i] as UMA.OverlayData) == false) { _OverlayLibrary.AddOverlay(_UMA_Variables.UMAOverlaysList[i] as UMA.OverlayData); } } } }
void Start() { GameObject umaLib = GameObject.FindWithTag("UmaLib"); if (umaLib == null) { throw new MissingComponentException("Ensure an UmaLib is placed inside the scene with tag=UmaLib"); } slotLibrary = umaLib.GetComponentInChildren <SlotLibrary>(); overlayLibrary = umaLib.GetComponentInChildren <OverlayLibrary>(); raceLibrary = umaLib.GetComponentInChildren <RaceLibrary>(); generator = umaLib.GetComponentInChildren <UMAGenerator>(); InitializeUma(); }
public void Initialize() { umaPackRecipe = new UMAPackRecipe(); if(!slotLibrary){ slotLibrary = GameObject.Find("SlotLibrary").GetComponent("SlotLibrary") as SlotLibrary; } if(!raceLibrary){ raceLibrary = GameObject.Find("RaceLibrary").GetComponent("RaceLibrary") as RaceLibrary; } if(!overlayLibrary){ overlayLibrary = GameObject.Find("OverlayLibrary").GetComponent("OverlayLibrary") as OverlayLibrary; } if(!umaData){ umaData = gameObject.GetComponent("UMAData") as UMAData; } }
#pragma warning disable 618 public void Start() { if (!slotLibrary) { slotLibrary = GameObject.Find("SlotLibrary").GetComponent("SlotLibrary") as SlotLibrary; } if (!raceLibrary) { raceLibrary = GameObject.Find("RaceLibrary").GetComponent("RaceLibrary") as RaceLibrary; } if (!overlayLibrary) { overlayLibrary = GameObject.Find("OverlayLibrary").GetComponent("OverlayLibrary") as OverlayLibrary; } if (Instance == null) Instance = this; }
void setupFallbackObjects() { if (generator == null) { generator = GameObject.Find("UMAGenerator").GetComponent <UMAGenerator>(); } if (slotLibrary == null) { slotLibrary = GameObject.Find("SlotLibrary").GetComponent <SlotLibrary>(); } if (overlayLibrary == null) { overlayLibrary = GameObject.Find("OverlayLibrary").GetComponent <OverlayLibrary>(); } if (raceLibrary == null) { raceLibrary = GameObject.Find("RaceLibrary").GetComponent <RaceLibrary>(); } }
public void Launch(DK_RPG_UMA DKRPGUMA, DK_UMACrowd DKUMACrowd, string streamed) { // assign scripts _DK_UMACrowd = DKUMACrowd; _DK_RPG_UMA = DKRPGUMA; Gender = DKRPGUMA.Gender; // _DK_UMACrowd = GameObject.Find ("DKUMACrowd").GetComponent<DK_UMACrowd>(); // get libraries try { raceLibrary = GameObject.Find("RaceLibrary").GetComponent <RaceLibrary>(); slotLibrary = GameObject.Find("SlotLibrary").GetComponent <SlotLibrary>(); overlayLibrary = GameObject.Find("OverlayLibrary").GetComponent <OverlayLibrary>(); }catch (NullReferenceException) { Debug.LogError("UMA is missing from your scene. UMA is required to generate a UMA avatar."); } // assign recipe _StreamedUMA = streamed; // Start the creation of the avatar ConvertStreamedUMA(streamed); CreateUMAData(); }
static void InitializeUMA() {//Initialize UMA context // UMA GameObject uma = new GameObject(); uma.name = "UMA"; GameObject parent; if (parent = Selection.activeGameObject) { uma.transform.SetParent(parent.transform); } // Race Library GameObject races = new GameObject(); races.name = "RaceLibrary"; races.transform.SetParent(uma.transform); RaceLibrary raceLibrary = races.AddComponent <RaceLibrary>(); //null search in all assets folder, t means type, so we are searching Uma.RaceData string[] racesData = AssetDatabase.FindAssets("t: RaceData", null); foreach (string data in racesData) { //get the path string racePath = AssetDatabase.GUIDToAssetPath(data); RaceData raceAsset = AssetDatabase.LoadAssetAtPath <RaceData>(racePath); raceLibrary.AddRace(raceAsset); } // Slots GameObject slots = new GameObject(); slots.name = "SlotLibrary"; slots.transform.SetParent(uma.transform); SlotLibrary slotLibrary = slots.AddComponent <SlotLibrary>(); //null search in all assets folder, t means type, so we are searching Uma.RaceData string[] slotsData = AssetDatabase.FindAssets("t: SlotDataAsset", null); foreach (string data in slotsData) { //get the path string slotPath = AssetDatabase.GUIDToAssetPath(data); SlotDataAsset slotAsset = AssetDatabase.LoadAssetAtPath <SlotDataAsset>(slotPath); slotLibrary.AddSlotAsset(slotAsset); } // Overlays GameObject overlays = new GameObject(); overlays.name = "OverlayLibrary"; overlays.transform.SetParent(uma.transform); OverlayLibrary overlayLibrary = overlays.AddComponent <OverlayLibrary>(); //null search in all assets folder, t means type, so we are searching Uma.RaceData string[] overlaysData = AssetDatabase.FindAssets("t: OverlayDataAsset", null); foreach (string data in overlaysData) { //get the path string overlayPath = AssetDatabase.GUIDToAssetPath(data); OverlayDataAsset overlayAsset = AssetDatabase.LoadAssetAtPath <OverlayDataAsset>(overlayPath); overlayLibrary.AddOverlayAsset(overlayAsset); } // Context GameObject context = new GameObject(); context.name = "ContextLibrary"; context.transform.SetParent(uma.transform); UMAContext umaContext = context.AddComponent <UMAContext>(); umaContext.raceLibrary = raceLibrary; umaContext.slotLibrary = slotLibrary; umaContext.overlayLibrary = overlayLibrary; // Generators UMAGenerator generator = MonoBehaviour.Instantiate <UMAGenerator> (AssetDatabase.LoadAssetAtPath <UMAGenerator>(CommonNames.umaFolderGeneratorPrefabPath)); generator.name = "UMAGenerator"; generator.transform.SetParent(uma.transform); UMADefaultMeshCombiner meshCombiner = generator.gameObject.AddComponent <UMADefaultMeshCombiner>(); generator.meshCombiner = meshCombiner; //Mixers for random UMA creation //Male GameObject maleRecipeMixer = new GameObject(); maleRecipeMixer.name = "MaleRecipeMixer"; UMA.Examples.UMARecipeMixer maleRecipeMixerScript = maleRecipeMixer.AddComponent <UMA.Examples.UMARecipeMixer>(); maleRecipeMixerScript.raceData = raceLibrary.GetRace("HumanMale"); UMA.Examples.UMARecipeMixer.RecipeSection[] maleRecipeSection = new UMA.Examples.UMARecipeMixer.RecipeSection[3]; //Male Recipe Section : Body maleRecipeSection[0] = new UMA.Examples.UMARecipeMixer.RecipeSection(); maleRecipeSection[0].name = "Body"; maleRecipeSection[0].selectionRule = UMA.Examples.UMARecipeMixer.SelectionType.IncludeOne; maleRecipeSection[0].recipes = new UMARecipeBase[2]; string[] maleBodyRecipePath = AssetDatabase.FindAssets("MaleBase t: UMATextRecipe", null); maleRecipeSection[0].recipes[0] = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(maleBodyRecipePath[0])); string[] maleBody2RecipePath = AssetDatabase.FindAssets("MaleBase2 t: UMATextRecipe", null); maleRecipeSection[0].recipes[1] = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(maleBody2RecipePath[0])); //Male Recipe Section : Underwear maleRecipeSection[1] = new UMA.Examples.UMARecipeMixer.RecipeSection(); maleRecipeSection[1].name = "Clothing"; maleRecipeSection[1].selectionRule = UMA.Examples.UMARecipeMixer.SelectionType.IncludeOne; maleRecipeSection[1].recipes = new UMARecipeBase[1]; //string[] maleUnderwearRecipePath = AssetDatabase.FindAssets("MaleUnderwear t: UMATextRecipe", null); //maleRecipeSection[1].recipes[0] = AssetDatabase.LoadAssetAtPath<UMATextRecipe>(AssetDatabase.GUIDToAssetPath(maleUnderwearRecipePath[0])); string[] maleOutfit1RecipePath = AssetDatabase.FindAssets("MaleOutfit1 t: UMATextRecipe", null); foreach (string hairPath in maleOutfit1RecipePath) { UMATextRecipe umaTextRecipe = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(hairPath)); if (umaTextRecipe.name == "MaleOutfit1") { maleRecipeSection[1].recipes[0] = umaTextRecipe; } } //Male Recipe Section : Hair maleRecipeSection[2] = new UMA.Examples.UMARecipeMixer.RecipeSection(); maleRecipeSection[2].name = "Hair"; maleRecipeSection[2].selectionRule = UMA.Examples.UMARecipeMixer.SelectionType.IncludeSome; maleRecipeSection[2].recipes = new UMARecipeBase[2]; string[] maleBeardRecipePath = AssetDatabase.FindAssets("MaleBeard t: UMATextRecipe", null); foreach (string hairPath in maleBeardRecipePath) { UMATextRecipe umaTextRecipe = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(hairPath)); if (umaTextRecipe.name == "MaleBeard") { maleRecipeSection[2].recipes[0] = umaTextRecipe; } } string[] maleHairRecipePath = AssetDatabase.FindAssets("MaleHair t: UMATextRecipe", null); foreach (string hairPath in maleHairRecipePath) { UMATextRecipe umaTextRecipe = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(hairPath)); if (umaTextRecipe.name == "MaleHair") { maleRecipeSection[2].recipes[1] = umaTextRecipe; } } maleRecipeMixerScript.recipeSections = maleRecipeSection; maleRecipeMixer.GetComponent <Transform>().SetParent(uma.transform); //Female GameObject femaleRecipeMixer = new GameObject(); femaleRecipeMixer.name = "FemaleRecipeMixer"; UMA.Examples.UMARecipeMixer femaleRecipeMixerScript = femaleRecipeMixer.AddComponent <UMA.Examples.UMARecipeMixer>(); femaleRecipeMixerScript.raceData = raceLibrary.GetRace("HumanFemale"); UMA.Examples.UMARecipeMixer.RecipeSection[] femaleRecipeSection = new UMA.Examples.UMARecipeMixer.RecipeSection[3]; //Female Recipe Section : Body femaleRecipeSection[0] = new UMA.Examples.UMARecipeMixer.RecipeSection(); femaleRecipeSection[0].name = "Body"; femaleRecipeSection[0].selectionRule = UMA.Examples.UMARecipeMixer.SelectionType.IncludeOne; femaleRecipeSection[0].recipes = new UMARecipeBase[1]; string[] femaleBodyRecipePath = AssetDatabase.FindAssets("HumanFemale Base Recipe t: UMATextRecipe", null); femaleRecipeSection[0].recipes[0] = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(femaleBodyRecipePath[0])); //Female Recipe Section : Underwear femaleRecipeSection[1] = new UMA.Examples.UMARecipeMixer.RecipeSection(); femaleRecipeSection[1].name = "Clothing"; femaleRecipeSection[1].selectionRule = UMA.Examples.UMARecipeMixer.SelectionType.IncludeOne; femaleRecipeSection[1].recipes = new UMARecipeBase[2]; //string[] femaleUnderwearRecipePath = AssetDatabase.FindAssets("FemaleUnderwear t: UMATextRecipe", null); string[] femaleOutfit1RecipePath = AssetDatabase.FindAssets("FemaleOutfit1 t: UMATextRecipe", null); string[] femaleOutfit2RecipePath = AssetDatabase.FindAssets("FemaleOutfit2 t: UMATextRecipe", null); //femaleRecipeSection[1].recipes[0] = AssetDatabase.LoadAssetAtPath<UMATextRecipe>(AssetDatabase.GUIDToAssetPath(femaleUnderwearRecipePath[0])); femaleRecipeSection[1].recipes[0] = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(femaleOutfit1RecipePath[0])); femaleRecipeSection[1].recipes[1] = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(femaleOutfit2RecipePath[0])); //Female Recipe Section : Hair femaleRecipeSection[2] = new UMA.Examples.UMARecipeMixer.RecipeSection(); femaleRecipeSection[2].name = "Hair"; femaleRecipeSection[2].selectionRule = UMA.Examples.UMARecipeMixer.SelectionType.IncludeOne; femaleRecipeSection[2].recipes = new UMARecipeBase[3]; string[] femaleHairRecipePath = AssetDatabase.FindAssets("FemaleHair t: UMATextRecipe", null); string[] femaleHairLongRecipePath = AssetDatabase.FindAssets("FemaleHairLong t: UMATextRecipe", null); string[] femaleHairShortRecipePath = AssetDatabase.FindAssets("FemaleHairShort t: UMATextRecipe", null); foreach (string hairPath in femaleHairRecipePath) { UMATextRecipe umaTextRecipe = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(hairPath)); if (umaTextRecipe.name == "FemaleHair") { femaleRecipeSection[2].recipes[0] = umaTextRecipe; } } femaleRecipeSection[2].recipes[1] = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(femaleHairLongRecipePath[0])); femaleRecipeSection[2].recipes[2] = AssetDatabase.LoadAssetAtPath <UMATextRecipe>(AssetDatabase.GUIDToAssetPath(femaleHairShortRecipePath[0])); femaleRecipeMixerScript.recipeSections = femaleRecipeSection; femaleRecipeMixer.GetComponent <Transform>().SetParent(uma.transform); //Shared colors table GameObject recipeMixerController = new GameObject(); recipeMixerController.name = "RecipeMixerController"; RecipeMixerController recipeMixerControllerScript = recipeMixerController.AddComponent <RecipeMixerController>(); SharedColorTable[] sharedColorTable = recipeMixerControllerScript.sharedColors; string[][] sharedColorsPath = new string[5][]; sharedColorsPath[0] = AssetDatabase.FindAssets("HumanHairLinear", null); sharedColorsPath[1] = AssetDatabase.FindAssets("HumanSkinLinear", null); sharedColorsPath[2] = AssetDatabase.FindAssets("ClothingUnderwear", null); sharedColorsPath[3] = AssetDatabase.FindAssets("ClothingTops", null); sharedColorsPath[4] = AssetDatabase.FindAssets("ClothingBottoms", null); sharedColorTable[0] = AssetDatabase.LoadAssetAtPath <SharedColorTable>(AssetDatabase.GUIDToAssetPath(sharedColorsPath[0][0])); sharedColorTable[1] = AssetDatabase.LoadAssetAtPath <SharedColorTable>(AssetDatabase.GUIDToAssetPath(sharedColorsPath[1][0])); sharedColorTable[2] = AssetDatabase.LoadAssetAtPath <SharedColorTable>(AssetDatabase.GUIDToAssetPath(sharedColorsPath[2][0])); sharedColorTable[3] = AssetDatabase.LoadAssetAtPath <SharedColorTable>(AssetDatabase.GUIDToAssetPath(sharedColorsPath[3][0])); sharedColorTable[4] = AssetDatabase.LoadAssetAtPath <SharedColorTable>(AssetDatabase.GUIDToAssetPath(sharedColorsPath[4][0])); recipeMixerController.transform.SetParent(uma.transform); }
public void OnEnable() { m_Object = new SerializedObject(target); slotLibrary = m_Object.targetObject as SlotLibrary; m_SlotDataAssetCount = m_Object.FindProperty(kArraySizePath); }
void setupFallbackObjects() { if (generator == null) { generator = GameObject.Find("UMAGenerator").GetComponent<UMAGenerator>(); } if (slotLibrary == null) { slotLibrary = GameObject.Find("SlotLibrary").GetComponent<SlotLibrary>(); } if (overlayLibrary == null) { overlayLibrary = GameObject.Find("OverlayLibrary").GetComponent<OverlayLibrary>(); } if (raceLibrary == null) { raceLibrary = GameObject.Find("RaceLibrary").GetComponent<RaceLibrary>(); } }
void Awake() { //Assign instance s_Instance = this; //Find if libraries not assigned UMAContext context = UMAContext.FindInstance(); if (context != null) { _RaceLibrary = context.raceLibrary; _SlotLibrary = context.slotLibrary; _OverlayLibrary = context.overlayLibrary; } //Create first one CreateUMA(); }
void OnGUI() { this.minSize = new Vector2(355, 500); #region fonts variables var bold = new GUIStyle("label"); var boldFold = new GUIStyle("foldout"); bold.fontStyle = FontStyle.Bold; bold.fontSize = 14; boldFold.fontStyle = FontStyle.Bold; var Slim = new GUIStyle("label"); Slim.fontStyle = FontStyle.Normal; Slim.fontSize = 10; var style = new GUIStyle("label"); style.wordWrap = true; #endregion fonts variables _UMA = GameObject.Find("UMA"); if (_UMA == null) { _UMA = (GameObject)PrefabUtility.InstantiatePrefab(Resources.Load("UMA")); _UMA.name = "DK_UMA"; _UMA = GameObject.Find("UMA"); } if (_UMA_Variables == null) { _UMA_Variables = _UMA.GetComponent <UMA_Variables>(); } if (_UMA_Variables == null) { _UMA_Variables = _UMA.AddComponent <UMA_Variables>(); } #region Menu using (new Horizontal()) { GUILayout.Label("UMA Elements", "toolbarbutton", GUILayout.ExpandWidth(true)); if (showAbout == true) { GUI.color = Green; } else { GUI.color = Color.white; } if (GUILayout.Button("About", "toolbarbutton", GUILayout.ExpandWidth(false))) { if (showAbout == true) { showAbout = false; } else { showAbout = true; } } if (Helper) { GUI.color = Green; } else { GUI.color = Color.yellow; } if (GUILayout.Button("?", "toolbarbutton", GUILayout.ExpandWidth(false))) { if (Helper) { Helper = false; } else { Helper = true; } } } if (!showAbout) { // Libraries GUILayout.Space(5); using (new Horizontal()) { GUI.color = Color.white; GUILayout.Label("Libraries", "toolbarbutton", GUILayout.ExpandWidth(true)); if (ShowLibs) { GUI.color = Green; } else { GUI.color = Color.gray; } if (GUILayout.Button("Show", "toolbarbutton", GUILayout.ExpandWidth(false))) { if (ShowLibs) { ShowLibs = false; } else { ShowLibs = true; } } } // libraries variables _SlotLibrary = _UMA_Variables._SlotLibrary; if (_SlotLibrary == null) { try{ _UMA_Variables._SlotLibrary = GameObject.Find("SlotLibrary").GetComponent <SlotLibrary>(); }catch (NullReferenceException) { Debug.LogError("UMA is not installed in your scene, please install UMA."); } } _OverlayLibrary = _UMA_Variables._OverlayLibrary; if (_OverlayLibrary == null) { try{ _UMA_Variables._OverlayLibrary = GameObject.Find("OverlayLibrary").GetComponent <OverlayLibrary>(); }catch (NullReferenceException) { Debug.LogError("UMA is not installed in your scene, please install UMA."); } } if (ShowLibs) { using (new Horizontal()) { if (_SlotLibrary) { GUI.color = Color.white; GUILayout.TextField(_SlotLibrary.name, 256, style, GUILayout.Width(110)); if (GUILayout.Button("Change", GUILayout.ExpandWidth(false))) { OpenChooseLibWin(); UMAChangeLibrary.CurrentLibrary = _SlotLibrary.gameObject; } } else { GUILayout.Label("No Slots Library", GUILayout.Width(120)); if (GUILayout.Button("Find", GUILayout.ExpandWidth(false))) { _UMA_Variables._SlotLibrary = GameObject.Find("SlotLibrary").GetComponent <SlotLibrary>(); } } if (_OverlayLibrary) { GUI.color = Color.white; GUILayout.TextField(_OverlayLibrary.name, 256, style, GUILayout.Width(110)); if (GUILayout.Button("Change", GUILayout.ExpandWidth(false))) { OpenChooseLibWin(); UMAChangeLibrary.CurrentLibrary = _OverlayLibrary.gameObject; } } else { GUILayout.Label("No Overlay Library", GUILayout.Width(120)); if (GUILayout.Button("Find", GUILayout.ExpandWidth(false))) { _UMA_Variables._OverlayLibrary = GameObject.Find("OverlayLibrary").GetComponent <OverlayLibrary>(); } } } } #region Actions GUILayout.Space(5); GUI.color = Color.white; GUILayout.Label("Options to Detect assets", "toolbarbutton", GUILayout.ExpandWidth(true)); using (new Horizontal()) { GUI.color = Green; if (GUILayout.Button("Search all Elements in the project", GUILayout.ExpandWidth(true))) { // Debug.Log ("Test"); Action = "Detecting"; SearchUMASlots(); SearchUMAOverlays(); // Done = "Done"; } if (GUILayout.Button("Previews (Double clic)", GUILayout.ExpandWidth(true))) { // PreviewsList.Clear(); MakePreviews(); } } using (new Horizontal()) { try { if (_SlotLibrary && _OverlayLibrary && GUILayout.Button("Add all UMA Elements to the Libraries", GUILayout.ExpandWidth(true))) { // Done4 = "Done"; AddToUMALib(); } }catch (ArgumentException) {} } #endregion Actions #endregion Menu #region Lists GUILayout.Space(5); using (new Horizontal()) { GUI.color = Color.white; GUILayout.Label("List of Elements", "toolbarbutton", GUILayout.ExpandWidth(true)); if (Showslot) { GUI.color = Color.cyan; } else { GUI.color = Color.gray; } if (GUILayout.Button("UMA slots", "toolbarbutton", GUILayout.Width(85))) { if (Showslot) { // ShowUMA = false; Showslot = false; } else { // ShowUMA = true; Showslot = true; } } if (InfoSlots) { GUI.color = Green; } else { GUI.color = Color.gray; } if (GUILayout.Button("Info", "toolbarbutton", GUILayout.ExpandWidth(false))) { if (InfoSlots) { InfoSlots = false; } else { InfoSlots = true; } } if (Showoverlay) { GUI.color = Color.cyan; } else { GUI.color = Color.gray; } if (GUILayout.Button("UMA overlays", "toolbarbutton", GUILayout.Width(85))) { if (Showoverlay) { // ShowUMA = false; Showoverlay = false; } else { // ShowUMA = true; Showoverlay = true; } } if (InfoOverlays) { GUI.color = Green; } else { GUI.color = Color.gray; } if (GUILayout.Button("Info", "toolbarbutton", GUILayout.ExpandWidth(false))) { if (InfoOverlays) { InfoOverlays = false; } else { InfoOverlays = true; } } } #region Search using (new Horizontal()) { GUI.color = Color.white; GUILayout.Label("Search for :", GUILayout.ExpandWidth(false)); SearchString = GUILayout.TextField(SearchString, 100, GUILayout.ExpandWidth(true)); } #endregion Search using (new Horizontal()) { using (new ScrollView(ref scroll)) { if (Showslot) { using (new Horizontal()) { // UMA Slots GUI.color = Color.cyan; GUILayout.Label("UMA Slots (" + _UMA_Variables.UMASlotsList.Count.ToString() + ")", "toolbarbutton", GUILayout.ExpandWidth(true)); if (InfoSlots) { GUI.color = Green; } else { GUI.color = Color.gray; } if (Showslot) { GUI.color = Green; } else { GUI.color = Color.gray; } if (GUILayout.Button("Show", "toolbarbutton", GUILayout.ExpandWidth(false))) { if (Showslot) { Showslot = false; } else { Showslot = true; } } } } if (ShowUMA && Showslot && _UMA_Variables.UMASlotsList.Count > 0) { #region Helper // Helper GUI.color = Color.white; if (Helper) { GUILayout.TextField("Click on the name to select a Slot.", 256, style, GUILayout.ExpandWidth(true), GUILayout.ExpandWidth(true)); } #endregion Helper for (int i = 0; i < _UMA_Variables.UMASlotsList.Count; i++) { Texture2D Preview; if (_UMA_Variables.UMASlotsList[i] != null && (SearchString == "" || _UMA_Variables.UMASlotsList[i].name.ToLower().Contains(SearchString.ToLower()))) { using (new Horizontal()) { using (new Vertical()) { string path = AssetDatabase.GetAssetPath(_UMA_Variables.UMASlotsList[i]); path = path.Replace(_UMA_Variables.UMASlotsList[i].name + ".asset", ""); Preview = AssetDatabase.LoadAssetAtPath(path + "Preview-" + _UMA_Variables.UMASlotsList[i].name + ".asset", typeof(Texture2D)) as Texture2D; if (Preview == null) { path = AssetDatabase.GetAssetPath(_UMA_Variables.UMASlotsList[i]); path = path.Replace(_UMA_Variables.UMASlotsList[i].name + ".asset", ""); Preview = AssetDatabase.LoadAssetAtPath(path + "Preview-" + _UMA_Variables.UMASlotsList[i].name + ".asset", typeof(Texture2D)) as Texture2D; } if (Preview != null) { GUI.color = Color.white; } else { GUI.color = Red; } if (InfoSlots == true || Selection.activeObject == _UMA_Variables.UMASlotsList[i]) { if (GUILayout.Button(Preview, GUILayout.Width(75), GUILayout.Height(75))) { Selection.activeObject = _UMA_Variables.UMASlotsList[i]; } } } using (new Vertical()) { if (_UMA_Variables.UMASlotsList[i] != null && (SearchString == "" || _UMA_Variables.UMASlotsList[i].name.ToLower().Contains(SearchString.ToLower()))) { using (new Horizontal()) { GUILayout.Space(5); if (Selection.activeObject == _UMA_Variables.UMASlotsList[i]) { GUI.color = Color.yellow; } else { GUI.color = Color.white; } if (_UMA_Variables.UMASlotsList[i].meshRenderer == null || _UMA_Variables.UMASlotsList[i].materialSample == null) { GUI.color = Red; } if (GUILayout.Button(_UMA_Variables.UMASlotsList[i].name, "toolbarbutton", GUILayout.Width(225))) { Selection.activeObject = _UMA_Variables.UMASlotsList[i]; } GUI.color = Red; if (GUILayout.Button("X", "toolbarbutton", GUILayout.ExpandWidth(false))) { } } } if (InfoSlots == true || Selection.activeObject == _UMA_Variables.UMASlotsList[i]) { using (new Horizontal()) { // preview if (Preview != null) { GUI.color = Green; } else { GUI.color = Color.gray; } if (Preview == null && GUILayout.Button("preview (Double click)", "toolbarbutton", GUILayout.Width(240))) { if (Preview == null) { if (_UMA_Variables.UMASlotsList[i].meshRenderer.gameObject != null) { string path = AssetDatabase.GetAssetPath(_UMA_Variables.UMASlotsList[i]); path = path.Replace(_UMA_Variables.UMASlotsList[i].name + ".asset", ""); Preview = AssetPreview.GetAssetPreview(_UMA_Variables.UMASlotsList[i].meshRenderer.gameObject); // Preview.name = "preview (Double click)"; if (Preview) { AssetDatabase.CreateAsset(Preview, path + "Preview-" + _UMA_Variables.UMASlotsList[i].name + ".asset"); } } } } } } try{ if (InfoSlots == true || Selection.activeObject == _UMA_Variables.UMASlotsList[i]) { if (_SlotLibrary) { using (new Horizontal()) { string InLibText = ""; if (_SlotLibrary.GetAllSlots().ToList().Contains(_UMA_Variables.UMASlotsList[i]) == true) { GUI.color = Green; InLibText = "Remove from Library"; } else if (InfoSlots == true || Selection.activeObject == _UMA_Variables.UMASlotsList[i]) { GUI.color = Color.gray; InLibText = "Add to Library"; } if (InfoSlots == true || Selection.activeObject == _UMA_Variables.UMASlotsList[i]) { if (GUILayout.Button(InLibText, "toolbarbutton", GUILayout.Width(240))) { if (_SlotLibrary.GetAllSlots().ToList().Contains(_UMA_Variables.UMASlotsList[i]) == false) { _SlotLibrary.AddSlot(_UMA_Variables.UMASlotsList[i]); EditorUtility.SetDirty(_SlotLibrary); AssetDatabase.SaveAssets(); } else if (InfoSlots == true || Selection.activeObject == _UMA_Variables.UMASlotsList[i]) { _SlotLibrary.GetAllSlots().ToList().Remove(_UMA_Variables.UMASlotsList[i]); } } } } } } }catch (ArgumentException) {} if (InfoSlots == true || Selection.activeObject == _UMA_Variables.UMASlotsList[i]) { using (new Horizontal()) { if (_UMA_Variables.UMASlotsList[i].meshRenderer != null) { GUI.color = Green; } else { GUI.color = Red; } GUILayout.Label("Renderer OK", "toolbarbutton", GUILayout.Width(120)); if (_UMA_Variables.UMASlotsList[i].materialSample != null) { GUI.color = Green; } else { GUI.color = Red; } GUILayout.Label("Material OK", "toolbarbutton", GUILayout.Width(120)); /* if ( _UMA_Variables.UMASlotsList[i].textureNameList.Length > 0 ) GUI.color = Green ; * else GUI.color = Color.yellow ; * GUILayout.Label("Texture(s)", "toolbarbutton", GUILayout.Width (70));*/ } } } } } if (_UMA_Variables.UMASlotsList[i] == null) { _UMA_Variables.UMASlotsList.Remove(_UMA_Variables.UMASlotsList[i]); } if (_UMA_Variables.UMASlotsList[i] != null && (SearchString == "" || _UMA_Variables.UMASlotsList[i].name.ToLower().Contains(SearchString.ToLower()))) { GUILayout.Space(10); } } } // UMA Overlays if (Showoverlay) { using (new Horizontal()) { GUI.color = Color.cyan; GUILayout.Label("UMA Overlays (" + _UMA_Variables.UMAOverlaysList.Count.ToString() + ")", "toolbarbutton", GUILayout.ExpandWidth(true)); if (Showoverlay) { GUI.color = Green; } else { GUI.color = Color.gray; } if (GUILayout.Button("Show", "toolbarbutton", GUILayout.ExpandWidth(false))) { if (Showoverlay) { Showoverlay = false; } else { Showoverlay = true; } } } } if (ShowUMA && Showoverlay && _UMA_Variables.UMAOverlaysList.Count > 0) { #region Helper // Helper GUI.color = Color.white; if (Helper) { GUILayout.TextField("Click on the name to select an Overlay.", 256, style, GUILayout.ExpandWidth(true), GUILayout.ExpandWidth(true)); } #endregion Helper if (ShowUMA && Showoverlay && _UMA_Variables.UMAOverlaysList.Count > 0) { for (int i = 0; i < _UMA_Variables.UMAOverlaysList.Count; i++) { if (_UMA_Variables.UMAOverlaysList[i] != null && (SearchString == "" || _UMA_Variables.UMAOverlaysList[i].name.ToLower().Contains(SearchString.ToLower()))) { using (new Horizontal()) { GUI.color = Color.white; if (Selection.activeObject == _UMA_Variables.UMAOverlaysList[i]) { GUI.color = Color.yellow; } if (GUILayout.Button(_UMA_Variables.UMAOverlaysList[i].name, "toolbarbutton", GUILayout.Width(310))) { Selection.activeObject = _UMA_Variables.UMAOverlaysList[i]; } GUI.color = Red; if (GUILayout.Button("X", "toolbarbutton", GUILayout.ExpandWidth(false))) { } } } if ((InfoOverlays == true || Selection.activeObject == _UMA_Variables.UMAOverlaysList[i]) && _UMA_Variables.UMAOverlaysList[i] != null && (SearchString == "" || _UMA_Variables.UMAOverlaysList[i].name.ToLower().Contains(SearchString.ToLower()))) { using (new Horizontal()) { foreach (Texture2D _Texture2D in _UMA_Variables.UMAOverlaysList[i].textureList) { using (new Vertical()) { if (_Texture2D != null) { GUI.color = Color.white; } else { GUI.color = Red; } if (GUILayout.Button(_Texture2D, GUILayout.Width(75), GUILayout.Height(75))) { Selection.activeObject = _UMA_Variables.UMAOverlaysList[i]; } GUILayout.Space(5); } } using (new Vertical()) { using (new Horizontal()) { string InLibText = ""; GUI.color = Green; if (_OverlayLibrary) { using (new Horizontal()) { if (_OverlayLibrary.GetAllOverlays().ToList().Contains(_UMA_Variables.UMAOverlaysList[i]) == true) { InLibText = "Remove from Library"; GUI.color = Green; } else { GUI.color = Color.gray; InLibText = "Add to Library"; } if (GUILayout.Button(InLibText, "toolbarbutton", GUILayout.Width(120))) { if (InLibText == "Add to Library" && _OverlayLibrary.GetAllOverlays().ToList().Contains(_UMA_Variables.UMAOverlaysList[i]) == false) { _OverlayLibrary.AddOverlay(_UMA_Variables.UMAOverlaysList[i]); } else if (InLibText == "Remove from Library") { _OverlayLibrary.GetAllOverlays().ToList().Remove(_UMA_Variables.UMAOverlaysList[i]); } EditorUtility.SetDirty(_OverlayLibrary); AssetDatabase.SaveAssets(); } } } } using (new Horizontal()) { bool Ok = true; foreach (Texture2D _Texture2D in _UMA_Variables.UMAOverlaysList[i].textureList) { var importer = TextureImporter.GetAtPath(_Texture2D.name) as TextureImporter; if (importer && importer.isReadable != true) { Ok = false; } } if (Ok == true) { GUI.color = Green; } else { GUI.color = Red; } if (GUILayout.Button("Read/Write OK", "toolbarbutton", GUILayout.Width(120))) { } /* if ( _UMA_Variables.UMASlotsList[i].materialSample != null ) GUI.color = Green ; * else GUI.color = Red ; * GUILayout.Label("Material OK", "toolbarbutton", GUILayout.Width (120)); */ /* if ( _UMA_Variables.UMASlotsList[i].textureNameList.Length > 0 ) GUI.color = Green ; * else GUI.color = Color.yellow ; * GUILayout.Label("Texture(s)", "toolbarbutton", GUILayout.Width (70));*/ } if (_UMA_Variables.UMAOverlaysList[i] == null) { _UMA_Variables.UMAOverlaysList.Remove(_UMA_Variables.UMAOverlaysList[i]); } } if (_UMA_Variables.UMAOverlaysList[i] != null && (SearchString == "" || _UMA_Variables.UMAOverlaysList[i].name.ToLower().Contains(SearchString.ToLower()))) { GUILayout.Space(5); } } } } } } } } #endregion Lists } #region About if (showAbout) { using (new HorizontalCentered()) { GUI.color = Color.white; GUILayout.Label("U.M.A. Elements", bold); } using (new HorizontalCentered()) { GUI.color = Color.white; GUILayout.Label("for U.M.A. & Dynamic Kit U.M.A. Editor"); } using (new HorizontalCentered()) { GUILayout.Label("Unity version 4.5 & higher"); } GUILayout.Space(5); GUI.color = Color.yellow; GUILayout.TextField("Greetings to Fernando Ribeiro for the creation of U.M.A. and LaneFox for his models.", 256, style, GUILayout.ExpandWidth(true), GUILayout.ExpandWidth(true)); GUILayout.Space(5); using (new HorizontalCentered()) { GUI.color = Green; GUILayout.TextField("(c) 2014 Ricardo Luque Martos", 256, style, GUILayout.ExpandWidth(true), GUILayout.ExpandWidth(true)); } using (new Horizontal()) { GUI.color = Color.cyan; if (GUILayout.Button("Website")) { Application.OpenURL("http://alteredreality.wix.com/dk-uma"); } } GUI.color = Color.yellow; using (new Horizontal()){ if (GUILayout.Button("Web Video Tutorials")) { Application.OpenURL("http://www.youtube.com/playlist?list=PLz3lDsmTMvxZpbSXp79gRm3XOiZs31g5t"); } } using (new Horizontal()) { GUI.color = Color.cyan; if (GUILayout.Button("Facebook Page")) { Application.OpenURL("https://www.facebook.com/DKeditorsUnity3D"); } } // Previous Plug Ins GUILayout.Label("Previous Plug-In(s) :", GUILayout.ExpandWidth(false)); GUI.color = Color.white; using (new Horizontal()) { if (GUILayout.Button("UMA Natural Behaviour")) { Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/content/20836"); } } // Next to come GUILayout.Label("The next Plug-In(s) to come :", GUILayout.ExpandWidth(false)); using (new Horizontal()) { GUILayout.Label("'Final IK' Grounder for UMA", bold); GUILayout.Label(" (December 2014)", GUILayout.ExpandWidth(false)); } using (new Horizontal()) { GUILayout.Label("UMA Moods", bold); GUILayout.Label(" (January 2015)", GUILayout.ExpandWidth(false)); } } #endregion About }