public bool OnGUI(ref bool _dnaDirty, ref bool _textureDirty, ref bool _meshDirty) { GUILayout.BeginHorizontal(); var newToolBarIndex = EditorGUILayout.Popup("DNA", viewDna, _dnaTypeNames); if (newToolBarIndex != viewDna) { viewDna = newToolBarIndex; } GUI.enabled = viewDna >= 0; if (GUILayout.Button("X", EditorStyles.miniButton, GUILayout.Width(24))) { if (viewDna >= 0) { recipe.RemoveDna(_dnaTypes[viewDna]); if (viewDna >= _dnaTypes.Length - 1) { viewDna--; } GUI.enabled = true; GUILayout.EndHorizontal(); _dnaDirty = true; return(true); } } GUI.enabled = true; GUILayout.EndHorizontal(); if (viewDna >= 0) { Type dnaType = _dnaTypes[viewDna]; if (_dnaValues[dnaType].OnGUI()) { _dnaDirty = true; return(true); } } return(false); }
public static void FixUpUMADnaToDynamicUMADna(UMAData.UMARecipe _recipe) { var recipeDNA = _recipe.GetAllDna(); for (int i = 0; i < recipeDNA.Length; i++) { //if (!_recipe.raceData.raceDictionary.ContainsKey(recipeDNA[i].GetType())) //A RaceData may contain multiple DynamicDnaConverters use GetConverter instead and use the hash if (_recipe.raceData.GetConverter(recipeDNA[i]) == null) { int dnaToImport = recipeDNA[i].Count; int dnaImported = 0; for (int j = 0; j < recipeDNA.Length; j++) { if (recipeDNA[j] is DynamicUMADnaBase) { // Keep trying to find a new home for DNA values until they have all been set dnaImported += ((DynamicUMADnaBase)recipeDNA[j]).ImportUMADnaValues(recipeDNA[i]); if (dnaImported >= dnaToImport) { break; } } } if (dnaImported > 0) { if (_recipe.GetDna(recipeDNA[i].DNATypeHash) != null) { _recipe.RemoveDna(recipeDNA[i].DNATypeHash); } } } } }