protected override void Edit(bool array) { DEditorGUI.WithLabel("Compression", () => { PropertyType.CompressionEnabled = DEditorGUI.Toggle(PropertyType.CompressionEnabled); EditorGUI.BeginDisabledGroup(PropertyType.CompressionEnabled == false); PropertyType.MinValue = Mathf.Min(DEditorGUI.IntFieldOverlay(PropertyType.MinValue, "Min"), PropertyType.MaxValue - 1); PropertyType.MaxValue = Mathf.Max(DEditorGUI.IntFieldOverlay(PropertyType.MaxValue, "Max"), PropertyType.MinValue + 1); GUILayout.Label("Bits: " + PropertyType.BitsRequired, EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); EditorGUI.EndDisabledGroup(); }); //DEditorGUI.WithLabel("Min Value", () => { PropertyType.MinValue = EditorGUILayout.IntField(PropertyType.MinValue); }); //DEditorGUI.WithLabel("Max Value", () => { PropertyType.MaxValue = EditorGUILayout.IntField(PropertyType.MaxValue); }); //DEditorGUI.WithLabel("Info", () => { // EditorGUILayout.LabelField("Bits: " + BoltMath.BitsRequired(PropertyType.MaxValue - PropertyType.MinValue)); //}); //PropertyType.MinValue = Mathf.Min(PropertyType.MinValue, PropertyType.MaxValue - 1); //PropertyType.MaxValue = Mathf.Max(PropertyType.MaxValue, PropertyType.MinValue + 1); }
protected override void Edit(bool array) { DEditorGUI.EditSmoothingAlgorithm(Asset, Definition, false); DEditorGUI.WithLabel("Axes", () => { PropertyType.Selection = DEditorGUI.EditAxisSelection(PropertyType.Selection); }); if (Asset is StateDefinition) { DEditorGUI.WithLabel("Strict Comparison", () => { PropertyType.StrictEquality = EditorGUILayout.Toggle(PropertyType.StrictEquality); }); } if (PropertyType.Selection != AxisSelections.Disabled) { bool quaternion = PropertyType.Selection == AxisSelections.XYZ; DEditorGUI.WithLabel(quaternion ? "Quaternion Compression" : "Axis Compression", () => { if (quaternion) { PropertyType.QuaternionCompression = DEditorGUI.EditFloatCompression(PropertyType.QuaternionCompression); } else { DEditorGUI.EditAxes(PropertyType.EulerCompression, PropertyType.Selection); } }); } }
protected override void Edit(bool array) { DEditorGUI.EditSmoothingAlgorithm(Asset, Definition, false); DEditorGUI.WithLabel("Axes", () => { PropertyType.Selection = DEditorGUI.EditAxisSelection(PropertyType.Selection); }); PropertyCommandSettings cmdSettings = Definition.CommandAssetSettings; PropertyStateSettings stateSettings = Definition.StateAssetSettings; if (Asset is StateDefinition) { DEditorGUI.WithLabel("Strict Comparison", () => { PropertyType.StrictEquality = EditorGUILayout.Toggle(PropertyType.StrictEquality); }); DEditorGUI.WithLabel("Teleport Threshold", () => { if (cmdSettings != null) { cmdSettings.SnapMagnitude = EditorGUILayout.FloatField(cmdSettings.SnapMagnitude); } if (stateSettings != null) { stateSettings.SnapMagnitude = EditorGUILayout.FloatField(stateSettings.SnapMagnitude); } }); } DEditorGUI.WithLabel("Axis Compression", () => { DEditorGUI.EditAxes(PropertyType.Compression, PropertyType.Selection); }); }
protected override void Edit(bool array) { DEditorGUI.WithLabel("Object Type", () => { PropertyType.StructGuid = DEditorGUI.AssetPopup( AscensionWindow.Project.Structs.Cast <AssetDefinition>(), PropertyType.StructGuid, new[] { Asset.Guid }); }); }
void Header(string icon, string text) { GUILayout.BeginHorizontal(DEditorGUI.HeaderBackground, GUILayout.Height(DEditorGUI.HEADER_HEIGHT)); DEditorGUI.IconButton(icon); GUILayout.Label(text); GUILayout.EndHorizontal(); }
protected override void Edit(bool array) { DEditorGUI.WithLabel("Encoding & Length", () => { PropertyType.Encoding = (StringEncodings)EditorGUILayout.EnumPopup(PropertyType.Encoding); PropertyType.MaxLength = Mathf.Clamp(DEditorGUI.IntFieldOverlay(PropertyType.MaxLength, "Max Length (1 - 140)"), 1, 140); }); }
void DrawPrefabInfo(AscensionEntity entity) { PrefabType prefabType = PrefabUtility.GetPrefabType(entity.gameObject); #if DEBUG EditorGUILayout.LabelField("Type", prefabType.ToString()); EditorGUILayout.LabelField("Scene Id", entity.SceneGuid.ToString()); #endif switch (prefabType) { case PrefabType.Prefab: case PrefabType.PrefabInstance: EditorGUILayout.LabelField("Id", entity.prefabId.ToString()); if (entity.prefabId < 0) { EditorGUILayout.HelpBox("Prefab id not set, run the 'Ascension/Emit Code' menu option to correct", MessageType.Error); } if (prefabType == PrefabType.Prefab) { if (PrefabDatabase.Contains(entity) == false) { EditorGUILayout.HelpBox("Prefab lookup not valid, run the 'Ascension/Emit Code' menu option to correct", MessageType.Error); } } break; case PrefabType.None: if (entity.prefabId != 0) { // force 0 prefab id entity.prefabId = 0; // set dirty EditorUtility.SetDirty(this); } DEditorGUI.Disabled(() => { EditorGUILayout.IntField("Prefab Id", entity.prefabId); }); break; case PrefabType.DisconnectedPrefabInstance: entity.prefabId = EditorGUILayout.IntField("Prefab Id", entity.prefabId); if (entity.prefabId < 0) { EditorGUILayout.HelpBox("Prefab Id not set", MessageType.Error); } break; } }
void EditFilters(PropertyDefinition p) { if (Project.UseFilters) { GUIStyle s = new GUIStyle(EditorStyles.miniButton); s.alignment = TextAnchor.MiddleLeft; Rect menuRect; menuRect = GUILayoutUtility.GetLastRect(); menuRect.x += 85; if (GUILayout.Button("", s, GUILayout.MinWidth(200))) { GenericMenu menu = new GenericMenu(); foreach (FilterDefinition f in Project.EnabledFilters) { menu.AddItem(new GUIContent(f.Name), f.IsOn(p.Filters), FilterSetter(p, f)); } menu.DropDown(menuRect); EditorGUIUtility.ExitGUI(); } // rect of the button var r = GUILayoutUtility.GetLastRect(); var labelRect = r; labelRect.xMin += 3; labelRect.yMin -= 1; labelRect.xMax -= 17; //GUILayout.BeginArea(r); foreach (FilterDefinition f in Project.EnabledFilters) { if (f.IsOn(p.Filters)) { var label = DEditorGUI.MiniLabelWithColor(ToUnityColor(f.Color)); var sizex = Mathf.Min(label.CalcSize(new GUIContent(f.Name)).x, labelRect.width); GUI.Label(labelRect, f.Name, label); labelRect.xMin += sizex; labelRect.xMin = Mathf.Min(labelRect.xMin, labelRect.xMax); } } //GUILayout.EndArea(); GUI.DrawTexture(new Rect(r.xMax - 18, r.yMin, 16, 16), DEditorGUI.LoadIcon("ascen-ico-arrow-down")); } }
void OverlayIcon(string icon, int xOffset) { Rect r = GUILayoutUtility.GetLastRect(); r.xMin = (r.xMax - 19) + xOffset; r.xMax = (r.xMax - 3) + xOffset; r.yMin = r.yMin; r.yMax = r.yMax + 1; GUI.color = DEditorGUI.HighlightColor; GUI.DrawTexture(r, DEditorGUI.LoadIcon(icon)); GUI.color = Color.white; }
/*void LanServers() * { * GUIStyle s = new GUIStyle(GUIStyle.none); * s.padding = new RectOffset(5, 5, 2, 2); * GUILayout.BeginHorizontal(s); * * var sessions = AscensionNetwork.isRunning ? AscensionNetwork.GetSessions() : new UdpKit.UdpSession[0]; * * Each<UdpKit.UdpSession>(sessions, MakeHeader("mc_name", "Name"), c => StatsLabel(c.HostName)); * Each<UdpKit.UdpSession>(sessions, MakeHeader("mc_ipaddress", "End Point"), c => StatsLabel(c.WanEndPoint)); * * //Each<UdpKit.UdpSession>(sessions, MakeHeader("mc_bubble", "User Data"), c => StatsLabel(c.Data ?? "")); * * GUILayout.EndHorizontal(); * GUILayout.Space(4); * }*/ Action MakeHeader(string icon, string text) { return(() => { GUILayout.BeginHorizontal(); DEditorGUI.IconButton(icon); GUIStyle s = new GUIStyle(EditorStyles.miniLabel); s.padding = new RectOffset(); s.margin = new RectOffset(5, 0, 3, 0); GUILayout.Label(text, s); GUILayout.EndHorizontal(); }); }
void Footer() { GUILayout.BeginHorizontal(); //var version = Assembly.GetExecutingAssembly().GetName().Version; GUILayout.Label(string.Format("{0} ({1})", version, Core.IsDebugMode ? "DEBUG" : "RELEASE"), EditorStyles.miniLabel); GUILayout.FlexibleSpace(); PrefabDatabase db = PrefabDatabase.Instance; if (db.DatabaseMode == PrefabDatabaseMode.ManualScan) { if (DEditorGUI.IconButton("refresh")) { AscensionCompiler.UpdatePrefabsDatabase(); Debug.Log("Upading prefab database..."); } GUILayout.Space(8); } if (DEditorGUI.IconButton("code-emit")) { if (RuntimeSettings.Instance.compileAsDll) { AscensionDataAssemblyCompiler.Run(); } else { AscensionDataAssemblyCompiler.CodeEmit(); } Debug.Log("Compiling project... " + ProjectPath); } GUILayout.Space(8); if (DEditorGUI.IconButton("save-project")) { Save(); Debug.Log("Saving project... " + ProjectPath); } GUILayout.EndHorizontal(); }
void EditEvent(EventDefinition def) { DEditorGUI.WithLabel("Global Senders", () => { def.GlobalSenders = (GlobalEventSenders)EditorGUILayout.EnumPopup(def.GlobalSenders); DEditorGUI.SetTooltip("Who can send this as an global event?"); }); DEditorGUI.WithLabel("Entity Senders", () => { def.EntitySenders = (EntityEventSenders)EditorGUILayout.EnumPopup(def.EntitySenders); DEditorGUI.SetTooltip("Who can send this as an entity event?"); }); // add button EditPropertyList(def, def.Properties); }
protected override void Edit(bool array) { DEditorGUI.EditSmoothingAlgorithm(Asset, Definition, false); if (Asset is StateDefinition) { if (Definition.StateAssetSettings.SmoothingAlgorithm == SmoothingAlgorithms.Interpolation) { DEditorGUI.WithLabel("Interpolation Mode", () => { PropertyType.IsAngle = DEditorGUI.ToggleDropdown("As Angle", "As Float", PropertyType.IsAngle); }); } } DEditorGUI.WithLabel("Compression", () => { PropertyType.Compression = DEditorGUI.EditFloatCompression(PropertyType.Compression); }); }
protected override void Edit(bool array) { DEditorGUI.WithLabel("Element Type", () => { PropertyType.ElementType = DEditorGUI.PropertyTypePopup(PropertyType.AllowedElementTypes, PropertyType.ElementType); }); DEditorGUI.WithLabel("Element Count", () => { PropertyType.ElementCount = Mathf.Max(2, EditorGUILayout.IntField(PropertyType.ElementCount)); }); if (PropertyType.ElementType.HasSettings) { EditorGUILayout.BeginVertical(); PropertyEditorRegistry.GetEditor(PropertyType.ElementType) .EditArrayElement(Asset, Definition, PropertyType.ElementType); EditorGUILayout.EndVertical(); } }
void EditCommand(CommandDefinition def) { DEditorGUI.WithLabel("Correction Interpolation", () => { def.SmoothFrames = DEditorGUI.IntFieldOverlay(def.SmoothFrames, "Frames"); }); //DEditorGUI.WithLabel("Compress Zero Values", () => { // def.CompressZeroValues = EditorGUILayout.Toggle(def.CompressZeroValues); //}); // add button DEditorGUI.Header("Input", "commands"); GUILayout.Space(2); EditPropertyList(def, def.Input); // add button DEditorGUI.Header("Result", "position"); GUILayout.Space(2); EditPropertyList(def, def.Result); }
void Select(AssetDefinition asset, bool focusEditor) { if (asset == null) { selectedAssetGuid = null; } else { selectedAssetGuid = asset.Guid.ToString(); } Repaints = 10; Selected = asset; BeginClearFocus(); DEditorGUI.UseEvent(); if (focusEditor) { AscensionEditorWindow.Open(); } }
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; } }
public void OnInspectorGUI2() { //GUILayout.Space(4); //GUILayout.BeginHorizontal(); //GUILayout.Space(2); //GUI.DrawTexture(GUILayoutUtility.GetRect(128, 128, 64, 64, GUILayout.ExpandHeight(false), GUILayout.ExpandWidth(false)), Resources.Load("AscensionLogo") as Texture2D); //GUILayout.EndHorizontal(); GUILayout.Space(2); EditorGUI.BeginDisabledGroup(Application.isPlaying); AscensionEntity entity = (AscensionEntity)target; PrefabType prefabType = PrefabUtility.GetPrefabType(entity.gameObject); RuntimeSettings settings = RuntimeSettings.Instance; #if DEBUG EditorGUILayout.LabelField("Prefab Type", prefabType.ToString()); #endif // Prefab Id switch (prefabType) { case PrefabType.Prefab: case PrefabType.PrefabInstance: EditorGUILayout.LabelField("Prefab Id", entity.PrefabId.ToString()); if (entity.prefabId < 0) { EditorGUILayout.HelpBox("Prefab id not set, run the 'Ascension/Emit Code' menu option to correct", MessageType.Error); } if (prefabType == PrefabType.Prefab) { if (PrefabDatabase.Contains(entity) == false) { EditorGUILayout.HelpBox("Prefab lookup not valid, run the 'Ascension/Emit Code' menu option to correct", MessageType.Error); } } break; case PrefabType.None: if (entity.prefabId != 0) { // force 0 prefab id entity.prefabId = 0; // set dirty EditorUtility.SetDirty(this); } DEditorGUI.Disabled(() => { EditorGUILayout.IntField("Prefab Id", entity.prefabId); }); break; case PrefabType.DisconnectedPrefabInstance: entity.prefabId = EditorGUILayout.IntField("Prefab Id", entity.prefabId); if (entity.prefabId < 0) { EditorGUILayout.HelpBox("Prefab Id not set", MessageType.Error); } break; } EditState(entity); EditProperties(entity); EditSceneProperties(entity, prefabType); EditorGUI.EndDisabledGroup(); if (prefabType == PrefabType.Prefab) { SaveEntity(entity); } else { if (Application.isPlaying) { RuntimeInfoGUI(entity); } else { SaveEntity(entity); } } }
void EditProperty(AssetDefinition def, PropertyDefinition p, bool first, bool last) { BeginBackground(); GUILayout.BeginHorizontal(DEditorGUI.HeaderBackground, GUILayout.Height(DEditorGUI.HEADER_HEIGHT)); if ((Event.current.modifiers & EventModifiers.Control) == EventModifiers.Control) { if (DEditorGUI.IconButton("minus-editor")) { if (EditorUtility.DisplayDialog("Delete Property", string.Format("Do you want to delete '{0}' (Property)?", p.Name), "Yes", "No")) { p.Deleted = true; } } } else { if (DEditorGUI.Toggle("arrow-down", "arrow-right", p.Expanded && (p.PropertyType.HasSettings || p.PropertyType.MecanimApplicable))) { p.Expanded = !p.Expanded; } } if (def is StateDefinition || def is ObjectDefinition) { p.Name = DEditorGUI.TextFieldOverlay(p.Name, p.Priority.ToString(), GUILayout.Width(181)); switch (p.ReplicationMode) { case ReplicationMode.Everyone: DEditorGUI.Toggle("controller-plus", true); break; case ReplicationMode.EveryoneExceptController: DEditorGUI.Toggle("controller", false); break; case ReplicationMode.OnlyOwnerAndController: DEditorGUI.Toggle("controller-only", true); break; case ReplicationMode.LocalForEachPlayer: DEditorGUI.Toggle("owner-only", true); break; } } else { p.Name = EditorGUILayout.TextField(p.Name, GUILayout.Width(200)); } DEditorGUI.SetTooltip("Name. The name of this property, has to be a valid C# property name."); // edit property type DEditorGUI.PropertyTypePopup(def, p); DEditorGUI.SetTooltip("Type. The type of this property."); EditorGUI.BeginDisabledGroup(def.SortOrder != SortOrder.Manual); if (DEditorGUI.IconButton("arrow-down", !last)) { p.Adjust += 1; } if (DEditorGUI.IconButton("arrow-up", !first)) { p.Adjust -= 1; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); if (p.Controller) { p.ReplicationMode = ReplicationMode.Everyone; p.Controller = false; Save(); } if (p.Expanded) { GUILayout.Space(2); //DEditorGUI.WithLabel("Comment", () => { // p.Comment = EditorGUILayout.TextField(p.Comment); //}); if (def is StateDefinition || def is ObjectDefinition) { DEditorGUI.WithLabel("Replication", () => { p.Priority = DEditorGUI.EditPriority(p.Priority, p.PropertyType.HasPriority); p.ReplicationMode = (ReplicationMode)EditorGUILayout.EnumPopup(p.ReplicationMode); }); } if (def is CommandDefinition) { if (p.PropertyType.CanSmoothCorrections && ((CommandDefinition)def).Result.Contains(p)) { DEditorGUI.WithLabel("Smooth Corrections", () => { p.CommandAssetSettings.SmoothCorrection = EditorGUILayout.Toggle(p.CommandAssetSettings.SmoothCorrection); }); } } if (p.PropertyType.MecanimApplicable && (def is StateDefinition)) { DEditorGUI.WithLabel("Mecanim", () => { EditorGUILayout.BeginHorizontal(); if (p.PropertyType is PropertyTypeFloat) { p.StateAssetSettings.MecanimMode = (MecanimMode)EditorGUILayout.EnumPopup(p.StateAssetSettings.MecanimMode); EditorGUI.BeginDisabledGroup(p.StateAssetSettings.MecanimMode == MecanimMode.Disabled); p.StateAssetSettings.MecanimDirection = (MecanimDirection)EditorGUILayout.EnumPopup(p.StateAssetSettings.MecanimDirection); switch (p.StateAssetSettings.MecanimMode) { case MecanimMode.Parameter: if (p.StateAssetSettings.MecanimDirection == MecanimDirection.UsingAscensionProperties) { p.StateAssetSettings.MecanimDamping = DEditorGUI.FloatFieldOverlay(p.StateAssetSettings.MecanimDamping, "Damping Time"); } break; case MecanimMode.LayerWeight: p.StateAssetSettings.MecanimLayer = DEditorGUI.IntFieldOverlay(p.StateAssetSettings.MecanimLayer, "Layer Index"); break; } EditorGUI.EndDisabledGroup(); } else { p.StateAssetSettings.MecanimMode = (MecanimMode)(int)EditorGUILayout.Popup((int)p.StateAssetSettings.MecanimMode, new string[] { "Disabled", "Parameter" }); EditorGUI.BeginDisabledGroup(p.StateAssetSettings.MecanimMode == MecanimMode.Disabled); p.StateAssetSettings.MecanimDirection = (MecanimDirection)EditorGUILayout.EnumPopup(p.StateAssetSettings.MecanimDirection); if (p.PropertyType is PropertyTypeTrigger) { p.StateAssetSettings.MecanimLayer = DEditorGUI.IntFieldOverlay(p.StateAssetSettings.MecanimLayer, "Layer Index"); } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndHorizontal(); }); } if (p.PropertyType.HasSettings) { PropertyEditorRegistry.GetEditor(p.PropertyType.GetType()).Edit(def, p); } } else { GUILayout.Space(2); } EditorGUILayout.EndVertical(); }
void EditHeader(AssetDefinition def) { var stateDef = def as StateDefinition; var structDef = def as ObjectDefinition; var cmdDef = def as CommandDefinition; var eventDef = def as EventDefinition; GUILayout.BeginArea(new Rect(DEditorGUI.GLOBAL_INSET, DEditorGUI.GLOBAL_INSET, position.width - (DEditorGUI.GLOBAL_INSET * 2), DEditorGUI.HEADER_HEIGHT)); GUILayout.BeginHorizontal(DEditorGUI.HeaderBackground, GUILayout.Height(DEditorGUI.HEADER_HEIGHT)); if (def is StateDefinition) { DEditorGUI.IconButton("states"); } if (def is ObjectDefinition) { DEditorGUI.IconButton("objects"); } if (def is EventDefinition) { DEditorGUI.IconButton("events"); } if (def is CommandDefinition) { DEditorGUI.IconButton("commands"); } // edit asset name GUI.SetNextControlName("AscensionEditorName"); def.Name = EditorGUILayout.TextField(def.Name); if (cmdDef != null) { if (GUILayout.Button("New Input", EditorStyles.miniButtonLeft, GUILayout.Width(75))) { cmdDef.Input.Add(CreateProperty(new PropertyCommandSettings())); Save(); } if (GUILayout.Button("New Result", EditorStyles.miniButtonRight, GUILayout.Width(75))) { cmdDef.Result.Add(CreateProperty(new PropertyCommandSettings())); Save(); } } else { if (GUILayout.Button("New Property", EditorStyles.miniButton, GUILayout.Width(150))) { if (stateDef != null) { stateDef.Properties.Add(CreateProperty(new PropertyStateSettings())); Save(); } if (structDef != null) { structDef.Properties.Add(CreateProperty(new PropertyStateSettings())); Save(); } if (eventDef != null) { eventDef.Properties.Add(CreateProperty(new PropertyEventSettings())); Save(); } } } if (stateDef != null) { ExpandAllOrCollapseAll(stateDef.Properties); } if (structDef != null) { ExpandAllOrCollapseAll(structDef.Properties); } if (eventDef != null) { ExpandAllOrCollapseAll(eventDef.Properties); } if (cmdDef != null) { ExpandAllOrCollapseAll(cmdDef.Input, cmdDef.Result); } if (stateDef != null) { Duplicate(stateDef); } if (structDef != null) { Duplicate(structDef); } if (eventDef != null) { Duplicate(eventDef); } if (cmdDef != null) { Duplicate(cmdDef); } GUILayout.EndHorizontal(); GUILayout.EndArea(); }
protected override void Edit(bool array) { DEditorGUI.WithLabel("Space", () => { PropertyType.Space = (TransformSpaces)EditorGUILayout.EnumPopup(PropertyType.Space); }); DEditorGUI.EditSmoothingAlgorithm(Asset, Definition); DEditorGUI.Header("Position", "position"); DEditorGUI.WithLabel("Axes", () => { PropertyType.PositionSelection = DEditorGUI.EditAxisSelection(PropertyType.PositionSelection); }); if (PropertyType.PositionSelection != AxisSelections.Disabled) { if (Asset is StateDefinition) { DEditorGUI.WithLabel("Strict Comparison", () => { PropertyType.PositionStrictCompare = EditorGUILayout.Toggle(PropertyType.PositionStrictCompare); }); DEditorGUI.WithLabel("Teleport Threshold", () => { Definition.StateAssetSettings.SnapMagnitude = EditorGUILayout.FloatField(Definition.StateAssetSettings.SnapMagnitude); }); } DEditorGUI.WithLabel("Compression", () => { DEditorGUI.EditAxes(PropertyType.PositionCompression, PropertyType.PositionSelection); }); } DEditorGUI.Header("Rotation", "rotation"); DEditorGUI.WithLabel("Axes", () => { PropertyType.RotationSelection = DEditorGUI.EditAxisSelection(PropertyType.RotationSelection); }); if (PropertyType.RotationSelection != AxisSelections.Disabled) { if (Asset is StateDefinition) { DEditorGUI.WithLabel("Strict Comparison", () => { PropertyType.RotationStrictCompare = EditorGUILayout.Toggle(PropertyType.RotationStrictCompare); }); } bool quaternion = PropertyType.RotationSelection == AxisSelections.XYZ; DEditorGUI.WithLabel(quaternion ? "Compression (Quaternion)" : "Compression (Euler)", () => { if (quaternion) { PropertyType.RotationCompressionQuaternion = DEditorGUI.EditFloatCompression(PropertyType.RotationCompressionQuaternion); } else { DEditorGUI.EditAxes(PropertyType.RotationCompression, PropertyType.RotationSelection); } }); } }
void Header(string text, string icon) { DEditorGUI.Header(text, icon); }