void EditState(StateDefinition def) { DEditorGUI.WithLabel("Inheritance", () => { def.IsAbstract = DEditorGUI.ToggleDropdown("Is Abstract", "Is Concrete", def.IsAbstract); def.ParentGuid = DEditorGUI.AssetPopup("Parent: ", Project.States.Cast <AssetDefinition>(), def.ParentGuid, Project.GetInheritanceTree(def)); }); EditorGUI.BeginDisabledGroup(def.IsAbstract); DEditorGUI.WithLabel("Bandwidth", () => { GUILayout.BeginHorizontal(); def.PacketMaxBits = Mathf.Clamp(DEditorGUI.IntFieldOverlay(def.PacketMaxBits, "Bits/Packet"), 128, 4096); def.PacketMaxProperties = Mathf.Clamp(DEditorGUI.IntFieldOverlay(def.PacketMaxProperties, "Properties/Packet"), 1, 255); GUILayout.EndHorizontal(); }); EditorGUI.EndDisabledGroup(); DEditorGUI.WithLabel("Import Mecanim Modes", () => { replicationMode = (ReplicationMode)EditorGUILayout.EnumPopup("Replication Mode", replicationMode); mecanimDirection = (MecanimDirection)EditorGUILayout.EnumPopup("Mecanim Mode", mecanimDirection); }); DEditorGUI.WithLabel("Import Mecanim Parameters", () => { mecanimController = EditorGUILayout.ObjectField(mecanimController, typeof(RuntimeAnimatorController), true) as RuntimeAnimatorController; if (mecanimController) { if (GUILayout.Button("Import", EditorStyles.miniButton)) { try { AC ac = (AC)mecanimController; #if UNITY_5 for (int i = 0; i < ac.parameters.Length; ++i) { ImportMecanimParameter(def, ac.parameters[i]); } #else for (int i = 0; i < ac.parameterCount; ++i) { ImportMecanimParameter(def, ac.GetParameter(i)); } for (int i = 0; i < ac.layerCount; ++i) { ImportMecanimLayer(def, ac, i); } #endif Save(); } finally { mecanimController = null; } } } }); var groups = def.Properties .Where(x => x.PropertyType.MecanimApplicable) .Where(x => x.StateAssetSettings.MecanimMode != MecanimMode.Disabled) .GroupBy(x => x.StateAssetSettings.MecanimDirection); if (groups.Count() == 1) { var currentDirection = groups.First().Key; DEditorGUI.WithLabel("Mecanim (State Wide)", () => { var selectedDirection = (MecanimDirection)EditorGUILayout.EnumPopup(currentDirection); if (currentDirection != selectedDirection) { foreach (var property in def.Properties.Where(x => x.PropertyType.MecanimApplicable)) { property.StateAssetSettings.MecanimDirection = selectedDirection; } Save(); } }); } else if (groups.Count() > 1) { DEditorGUI.WithLabel("Mecanim (State Wide)", () => { string[] options = new string[] { "Using Animator Methods", "Using Bolt Properties", "Mixed (WARNING)" }; int index = EditorGUILayout.Popup(2, options); if (index != 2) { foreach (var property in def.Properties.Where(x => x.PropertyType.MecanimApplicable)) { property.StateAssetSettings.MecanimDirection = (MecanimDirection)index; } Save(); } }); } EditPropertyList(def, def.Properties); Guid guid = def.ParentGuid; while (guid != Guid.Empty) { var parent = Project.FindState(guid); GUILayout.Label(string.Format("Inherited from {0}", parent.Name), DEditorGUI.MiniLabelButtonStyle); EditorGUI.BeginDisabledGroup(true); EditPropertyList(parent, parent.Properties); EditorGUI.EndDisabledGroup(); guid = parent.ParentGuid; } }