public void Display(object editObject, ObjectAccessor objectAccessor) { if (ImGui.BeginCombo(_label, _value, ComboFlags.HeightRegular)) { foreach (var enumValue in _type.GetEnumNames()) { var isSelected = _value == enumValue; if (ImGui.Selectable(enumValue, isSelected)) { if (Enum.TryParse(_type, enumValue, out var underlyingValue)) { objectAccessor[_info.Name] = underlyingValue; _value = enumValue; } else { _value = _type.GetEnumName(objectAccessor[_info.Name]); } } if (isSelected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } }
public override void DrawEditor() { ImGui.PushItemWidth(-1); if (ImGui.BeginCombo("##ItemUiCategorySearchFilterBox", uiCategoriesArray[this.selectedCategory])) { ImGui.SetNextItemWidth(-1); ImGui.InputTextWithHint("###ItemUiCategorySearchFilterFilter", "Filter", ref categorySearchInput, 60); var isFocused = ImGui.IsItemActive(); if (!focused) { ImGui.SetKeyboardFocusHere(); } ImGui.BeginChild("###ItemUiCategorySearchFilterDisplay", popupSize, true); if (!focused) { ImGui.SetScrollY(0); focused = true; } var c = 0; var l = 0; for (var i = 0; i < uiCategoriesArray.Length; i++) { if (i > 0 && categorySearchInput.Length > 0 && !uiCategoriesArray[i].ToLowerInvariant().Contains(categorySearchInput.ToLowerInvariant())) { continue; } if (i != 0) { c++; l = i; } if (!ImGui.Selectable(uiCategoriesArray[i], selectedCategory == i)) { continue; } selectedCategory = i; ImGui.CloseCurrentPopup(); } ImGui.EndChild(); if (!isFocused && c <= 1) { selectedCategory = l; ImGui.CloseCurrentPopup(); } ImGui.EndCombo(); } else if (focused) { focused = false; categorySearchInput = string.Empty; } ImGui.PopItemWidth(); }
private static void DrawRaceOptions(string target, ref bool doChange, ref Race selectedRace) { ImGui.Checkbox("Change " + target, ref doChange); if (doChange) { if (ImGui.BeginCombo(target + " Race", selectedRace.GetAttribute <Display>().Value)) { foreach (Race race in Enum.GetValues(typeof(Race))) { ImGui.PushID((byte)race); if (ImGui.Selectable(race.GetAttribute <Display>().Value, race == selectedRace)) { selectedRace = race; } if (race == selectedRace) { ImGui.SetItemDefaultFocus(); } ImGui.PopID(); } ImGui.EndCombo(); } } }
public override void DrawEditor(double delta) { _selectedSystem = _selectedSystem ?? _scene.LogicSystems.First(); if (ImGui.BeginCombo("System", _selectedSystem.ToString())) // The second parameter is the label previewed before opening the combo. { foreach (var system in _scene.LogicSystems) { bool is_selected = system == _selectedSystem; if (ImGui.Selectable(system.ToString(), is_selected)) { _selectedSystem = system; } if (is_selected) { ImGui.SetItemDefaultFocus(); } } foreach (var system in _scene.RendererSystems) { bool is_selected = system == _selectedSystem; if (ImGui.Selectable(system.ToString(), is_selected)) { _selectedSystem = system; } if (is_selected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } _propertyGrid.Draw(_selectedSystem); }
public override void DrawEditor(double delta) { var metricNames = Utilties.Logging.Metrics.ListMetrics(); if (ImGui.BeginCombo("Metrics", _selectedMetric)) // The second parameter is the label previewed before opening the combo. { foreach (var metric in metricNames) { bool is_selected = metric == _selectedMetric; if (ImGui.Selectable(metric, is_selected)) { _selectedMetric = metric; } if (is_selected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } if (_selectedMetric != null) { var metrics = Utilties.Logging.Metrics.GetMetrics(_selectedMetric); var values = metrics.Select(t => (float)t.Item2).ToArray(); ImGui.PlotLines("Values", ref values[0], values.Length); ImGui.Text($"Max: {values.Max()}"); ImGui.Text($"Min: {values.Min()}"); ImGui.Text($"Avg: {values.Average()}"); } }
public void Render(List <IRenderableFile> files) { if (string.IsNullOrEmpty(selectedFile) && files.Count > 0) { var file = files.FirstOrDefault(); Update(file); } if (ImGui.BeginCombo("Files", selectedFile)) { foreach (var file in files) { string name = $"{file.Renderer.Name}_{file.Renderer.ID}"; bool isSelected = selectedFile == name; if (ImGui.Selectable(name, isSelected)) { selectedFile = name; } if (isSelected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } }
public static bool ComboFromEnum <T>(string label, object obj, string properyName, ImGuiComboFlags flags = ImGuiComboFlags.None) { var input = obj.GetType().GetProperty(properyName); var inputValue = input.GetValue(obj); bool edited = false; if (ImGui.BeginCombo(label, inputValue.ToString(), flags)) { var values = Enum.GetValues(typeof(T)); foreach (var val in values) { bool isSelected = inputValue == val; if (ImGui.Selectable(val.ToString(), isSelected)) { input.SetValue(obj, val); edited = true; } if (isSelected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } return(edited); }
public override void OnGUI() { if (ImGui.Begin("HUD")) { if (ImGui.BeginCombo("Material", materialDatas[materialIndex].name)) { foreach (var mat in materialDatas) { bool selected = false; if (ImGui.Selectable(mat.name, ref selected)) { SetActiveMaterial(mat); } } ImGui.EndCombo(); } if (ImGui.Button("Randomize")) { foreach (var mat in materials) { SetRandomMaterial(mat); } } } ImGui.End(); }
public static bool FancyComboBox(string disp, ref int curIndex, string[] items) { int idx = curIndex; bool res = ImGui.BeginCombo(disp, (idx >= 0 && idx < items.Length) ? items[idx] : ""); if (res) { for (int i = 0; i < items.Length; i++) { bool selected = i == idx; ImGui.Selectable(items[i], ref selected); if (selected && ImGui.IsWindowAppearing()) { ImGui.SetItemDefaultFocus(); ImGui.SetScrollHereY(); } if (selected) { idx = i; } } ImGui.EndCombo(); } curIndex = idx; return(res); }
public static string ComboBox(string sideLabel, string currentSelectedItem, List <string> objectList, out bool didChange, ImGuiComboFlags ImGuiComboFlags = ImGuiComboFlags.HeightRegular) { if (ImGui.BeginCombo(sideLabel, currentSelectedItem, ImGuiComboFlags)) { var refObject = currentSelectedItem; for (var n = 0; n < objectList.Count; n++) { var isSelected = refObject == objectList[n]; if (ImGui.Selectable(objectList[n], isSelected)) { didChange = true; ImGui.EndCombo(); return(objectList[n]); } if (isSelected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } didChange = false; return(currentSelectedItem); }
public override bool RenderGUI(Entity mainEntity, List <Entity> entities) { bool changed = false; string outString = mainEntity.GetString(Name, DefaultValue.ToString()); if (ImGui.BeginCombo(MiscHelper.CleanCamelCase(Name), outString)) { if (AllowManualInput && ImGui.InputText("", ref outString, 4096)) { ImGui.SetItemDefaultFocus(); changed = true; foreach (var entity in entities) { entity.Attributes[Name] = outString; } } foreach (DictionaryEntry pair in Values) { if (ImGui.Selectable(pair.Key.ToString(), outString == pair.Value.ToString())) { foreach (var entity in entities) { entity.Attributes[Name] = pair.Value; } } } ImGui.EndCombo(); } return(changed); }
static void OnGUI_SelectShader(Material mat) { string shaderName = mat.shader.name; int idx = shaderName.LastIndexOf('/'); if (idx >= 0) { shaderName = shaderName.Substring(idx + 1); } string nameList = ShaderNative.ShaderGetNameList(); string[] arr = nameList.Split(','); List <ShaderNameNode> nameNode = new List <ShaderNameNode>(); if (ImGui.BeginCombo($"Shader##Combo#ShaderName#ImporterMaterial#{s_mat_count++}", shaderName)) { for (int i = 0; i < arr.Length; ++i) { string ele = arr[i]; ShaderNameNode root = new ShaderNameNode(); DeepSplitName(ref root, ele); nameNode.Add(root); } foreach (var node in nameNode) { IterNode(node, mat.shader.name, ref mat); } ImGui.EndCombo(); } }
public override void Draw() { DebugManager.ClickToCopyText($"{Common.InventoryManagerAddress.ToInt64():X}"); if (ImGui.BeginTabBar("inventoryDebuggingTabs")) { if (ImGui.BeginTabItem("Container/Slot")) { ImGui.PushItemWidth(200); if (ImGui.BeginCombo("###containerSelect", $"{inventoryType} [{(int)inventoryType}]")) { foreach (var i in (InventoryType[])Enum.GetValues(typeof(InventoryType))) { if (ImGui.Selectable($"{i} [{(int) i}]##inventoryTypeSelect", i == inventoryType)) { inventoryType = i; } } ImGui.EndCombo(); } var container = Common.GetContainer(inventoryType); ImGui.PopItemWidth(); if (container != null) { ImGui.Text($"Container Address:"); ImGui.SameLine(); DebugManager.ClickToCopyText($"{(ulong)container:X}"); ImGui.SameLine(); DebugManager.PrintOutObject(*container, (ulong)container, new List <string>()); if (ImGui.TreeNode("Items##containerItems")) { for (var i = 0; i < container->SlotCount; i++) { var item = container->Items[i]; var itemAddr = ((ulong)container->Items) + (ulong)sizeof(InventoryItem) * (ulong)i; DebugManager.ClickToCopyText($"{itemAddr:X}"); ImGui.SameLine(); DebugManager.PrintOutObject(item, (ulong)&item, new List <string> { $"Items[{i}]" }, false, $"[{i:00}] {item.Item?.Name ?? "<Not Found>"}"); } ImGui.TreePop(); } } else { ImGui.Text("Container not found."); } ImGui.EndTabItem(); } ImGui.EndTabBar(); } }
public override void DrawEditor() { if (error) { ImGui.Text("Error"); return; } if (!ready) { ImGui.Text("Loading..."); return; } ImGui.BeginChild($"###{NameLocalizationKey}Child", new Vector2(-1, 23 * ImGui.GetIO().FontGlobalScale), false, usingTags ? ImGuiWindowFlags.NoInputs : ImGuiWindowFlags.None); if (selectedCurrencyOption != null && selectedCurrencyOption.SubOptions.Count > 0) { ImGui.SetNextItemWidth(ImGui.GetWindowContentRegionWidth() / 2); } else { ImGui.SetNextItemWidth(-1); } if (ImGui.BeginCombo("###SoldbyNPCSearchFilter_selection", selectedCurrencyOption?.Name ?? "Not Selected")) { foreach (var option in availableOptions) { if (ImGui.Selectable(option?.Name ?? "Not Selected", selectedCurrencyOption == option)) { selectedCurrencyOption = option; selectedSubOption = null; Modified = true; } } ImGui.EndCombo(); } if (selectedCurrencyOption != null && selectedCurrencyOption.SubOptions.Count > 0) { ImGui.SameLine(); ImGui.SetNextItemWidth(-1); if (ImGui.BeginCombo("###SoldbyNPCSearchFilter_subselection", selectedSubOption?.Name ?? "Any")) { foreach (var option in selectedCurrencyOption.SubOptions) { if (ImGui.Selectable(option?.Name ?? "Any", selectedCurrencyOption == option)) { selectedSubOption = option; Modified = true; } } ImGui.EndCombo(); } } ImGui.EndChild(); }
public static void SerializeAudioSource(Component obj) { AudioSource source = (AudioSource)obj; float gain = source.Gain; ImGui.DragFloat("Gain", ref gain, 0.1f); source.Gain = gain; float pitch = source.Pitch; ImGui.DragFloat("Pitch", ref pitch, 0.1f); source.Pitch = pitch; bool loop = source.Looping; ImGui.Checkbox("Looping", ref loop); source.Looping = loop; if (ImGui.BeginCombo("Clip", source.Clip != null ? source.Clip.Name : "[None]")) { if (ImGui.Selectable("[None]", source.Clip == null)) { source.Clip = null; } foreach (var clip in DataManager.AudioClips) { if (ImGui.Selectable(clip.Value.Name, source.Clip == clip.Value)) { source.Clip = clip.Value; } } ImGui.EndCombo(); } if (ImGui.Button("Play")) { source.Play(); } ImGui.SameLine(); if (ImGui.Button("Pause")) { source.Pause(); } ImGui.SameLine(); if (ImGui.Button("Stop")) { source.Stop(); } }
private static void Run(SpawnPoint.Entity entity, int index) { var objs = _ctrl.CurrentSpawnPoint.ObjEntryCtrl; if (ImGui.BeginCombo($"Object##{index}", objs.GetName(entity.ObjectId))) { var filter = ObjectFilter; if (ImGui.InputText($"Filter##{index}", ref filter, 16)) { ObjectFilter = filter; } foreach (var obj in objs.ObjectEntries.Where(x => filter.Length == 0 || x.ModelName.Contains(filter))) { if (ImGui.Selectable(obj.ModelName, obj.ObjectId == entity.ObjectId)) { entity.ObjectId = (int)obj.ObjectId; } } ImGui.EndCombo(); } ForEdit3($"Position##{index}", () => new Vector3(entity.PositionX, entity.PositionY, entity.PositionZ), x => { entity.PositionX = x.X; entity.PositionY = x.Y; entity.PositionZ = x.Z; }); ForEdit3($"Rotation##{index}", () => new Vector3( (float)(entity.RotationX * 180f / Math.PI), (float)(entity.RotationY * 180f / Math.PI), (float)(entity.RotationZ * 180f / Math.PI)), x => { entity.RotationX = (float)(x.X / 180f * Math.PI); entity.RotationY = (float)(x.Y / 180f * Math.PI); entity.RotationZ = (float)(x.Z / 180f * Math.PI); }); ForEdit($"Spawn type##{index}", () => entity.SpawnType, x => entity.SpawnType = x); ForEdit($"Spawn arg##{index}", () => entity.SpawnArgument, x => entity.SpawnArgument = x); ForEdit($"Serial##{index}", () => entity.Serial, x => entity.Serial = x); ForEdit($"Argument 1##{index}", () => entity.Argument1, x => entity.Argument1 = x); ForEdit($"Argument 2##{index}", () => entity.Argument2, x => entity.Argument2 = x); ForEdit($"Reaction command##{index}", () => entity.ReactionCommand, x => entity.ReactionCommand = x); ForEdit($"Spawn delay##{index}", () => entity.SpawnDelay, x => entity.SpawnDelay = x); ForEdit($"Command##{index}", () => entity.Command, x => entity.Command = x); ForEdit($"Spawn range##{index}", () => entity.SpawnRange, x => entity.SpawnRange = x); ForEdit($"Level##{index}", () => entity.Level, x => entity.Level = x); ForEdit($"Medal##{index}", () => entity.Medal, x => entity.Medal = x); }
public static void Render(FMAT material) { var renderer = material.MaterialAsset as SharcFBRenderer; if (renderer.GLShaderInfo == null) { return; } if (ImGui.BeginCombo("Stage", selectedStage)) { if (ImGui.Selectable("Vertex")) { selectedStage = "Vertex"; } if (ImGui.Selectable("Pixel")) { selectedStage = "Pixel"; } ImGui.EndCombo(); } ImGui.BeginTabBar("menu_shader1"); if (ImguiCustomWidgets.BeginTab("menu_shader1", $"Shader Code")) { LoadShaderStageCode(material); ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("menu_shader1", "Shader Info")) { if (ImGui.BeginChild("ShaderInfoC")) { LoadShaderInfo(material); } ImGui.EndChild(); ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("menu_shader1", "GX2 Shader Data")) { var shader = material.MaterialAsset as SharcFBRenderer; var program = shader.ShaderModel; if (selectedStage == "Vertex") { var gx2Shader = program.GetRawVertexShader(shader.BinaryIndex).ToArray(); MemoryEditor.Draw(gx2Shader, gx2Shader.Length); } if (selectedStage == "Pixel") { var gx2Shader = program.GetRawPixelShader(shader.BinaryIndex).ToArray(); MemoryEditor.Draw(gx2Shader, gx2Shader.Length); } ImGui.EndTabItem(); } }
public static bool Render(string input, ref bool dialogOpened) { if (string.IsNullOrEmpty(OutputName)) { OutputName = input; } bool hasInput = false; if (ImGui.BeginCombo("Selected", OutputName)) { popupOpened = true; byte[] data = Encoding.UTF8.GetBytes(OutputName); if (ImGui.InputText("Name", data, 200)) { OutputName = Encoding.UTF8.GetString(data); hasInput = true; } foreach (var model in GLFrameworkEngine.DataCache.ModelCache.Values) { if (model is BfresRender) { var bfres = model as BfresRender; foreach (var tex in bfres.Textures.Values) { bool isSelected = OutputName == tex.Name; IconManager.LoadTexture(tex.Name, tex); ImGui.SameLine(); if (ImGui.Selectable(tex.Name, isSelected)) { OutputName = tex.Name; hasInput = true; } if (isSelected) { ImGui.SetItemDefaultFocus(); } } } } ImGui.EndCombo(); } else if (popupOpened) { dialogOpened = false; popupOpened = false; } return(hasInput); }
private static void Run(SpawnPoint.Entity entity, int index) { var objs = _ctrl.CurrentSpawnPoint.ObjEntryCtrl; if (ImGui.BeginCombo($"Object#{index}", objs.GetName(entity.ObjectId))) { var filter = ObjectFilter; if (ImGui.InputText($"Filter#{index}", ref filter, 16)) { ObjectFilter = filter; } foreach (var obj in objs.ObjectEntries.Where(x => filter.Length == 0 || x.ModelName.Contains(filter))) { if (ImGui.Selectable(obj.ModelName, obj.ObjectId == entity.ObjectId)) { entity.ObjectId = obj.ObjectId; } } ImGui.EndCombo(); } ForEdit3($"Position#{index}", () => new Vector3(entity.PositionX, entity.PositionY, entity.PositionZ), x => { entity.PositionX = x.X; entity.PositionY = x.Y; entity.PositionZ = x.Z; }); ForEdit3($"Rotation#{index}", () => new Vector3( (float)(entity.RotationX * 180f / Math.PI), (float)(entity.RotationY * 180f / Math.PI), (float)(entity.RotationZ * 180f / Math.PI)), x => { entity.RotationX = (float)(x.X / 180f * Math.PI); entity.RotationY = (float)(x.Y / 180f * Math.PI); entity.RotationZ = (float)(x.Z / 180f * Math.PI); }); ForEdit($"Use entrance#{index}", () => entity.UseEntrance, x => entity.UseEntrance = x); ForEdit($"Entrance ID#{index}", () => entity.Entrance, x => entity.Entrance = x); ForEdit($"Unk1e#{index}", () => entity.Unk1e, x => entity.Unk1e = x); ForEdit($"Unk20#{index}", () => entity.Unk20, x => entity.Unk20 = x); ForEdit($"Ai Parameter#{index}", () => entity.AiParameter, x => entity.AiParameter = x); ForEdit($"TalkMessage#{index}", () => entity.TalkMessage, x => entity.TalkMessage = x); ForEdit($"ReactionCommand#{index}", () => entity.ReactionCommand, x => entity.ReactionCommand = x); ForEdit($"Unk30#{index}", () => entity.Unk30, x => entity.Unk30 = x); }
private void LoadArchiveProperties(NodeBase node, bool onLoad) { var archiveFileWrapper = node as ArchiveHiearchy; //Wrapper is a folder, skip if (!archiveFileWrapper.IsFile) { return; } if (ImGui.BeginChild("##editor_menu", new System.Numerics.Vector2(200, 22))) { if (ImGui.BeginCombo("Editor", archiveFileWrapper.ArchiveEditor)) { if (ImGui.Selectable("Hex Preview")) { archiveFileWrapper.ArchiveEditor = "Hex Preview"; } if (ImGui.Selectable("File Editor")) { archiveFileWrapper.ArchiveEditor = "File Editor"; } if (ImGui.Selectable("Text Preview")) { archiveFileWrapper.ArchiveEditor = "Text Preview"; } ImGui.EndCombo(); } } ImGui.EndChild(); if (archiveFileWrapper.ArchiveEditor == "Hex Preview") { if (ActiveEditor == null || ActiveEditor.GetType() != typeof(MemoryEditor)) { ActiveEditor = new MemoryEditor(); } var data = archiveFileWrapper.ArchiveFileInfo.FileData; if (memPool.Length != data.Length) { memPool = data.ToArray(); } ((MemoryEditor)ActiveEditor).Draw(memPool, memPool.Length); } if (archiveFileWrapper.ArchiveEditor == "File Editor") { LoadProperties(node, onLoad); } }
public void DrawAccessSpecifier() { if (ImGui.BeginCombo("Access Specifier", m_Function.m_eAccessSpecifier.ToString())) { foreach (EAccessSpecifier type in System.Enum.GetValues(typeof(EAccessSpecifier))) { if (ImGui.Selectable(type.ToString())) { m_Function.m_eAccessSpecifier = type; } } ImGui.EndCombo(); } }
public static bool RenameableCombo(string label, ref int currentItem, out string newName, string[] items, int numItems) { var ret = false; newName = ""; var newOption = ""; if (!ImGui.BeginCombo(label, numItems > 0 ? items[currentItem] : newOption)) { return(false); } for (var i = 0; i < numItems; ++i) { var isSelected = i == currentItem; ImGui.SetNextItemWidth(-1); if (ImGui.InputText($"##{label}_{i}", ref items[i], 64, ImGuiInputTextFlags.EnterReturnsTrue)) { currentItem = i; newName = items[i]; ret = true; ImGui.CloseCurrentPopup(); } if (isSelected) { ImGui.SetItemDefaultFocus(); } } ImGui.SetNextItemWidth(-1); if (ImGui.InputTextWithHint($"##{label}_new", "Add new item...", ref newOption, 64, ImGuiInputTextFlags.EnterReturnsTrue)) { currentItem = numItems; newName = newOption; ret = true; ImGui.CloseCurrentPopup(); } if (numItems == 0) { ImGui.SetItemDefaultFocus(); } ImGui.EndCombo(); return(ret); }
internal static void SerializeTextRenderer(Component obj) { TextRenderer textRenderer = (TextRenderer)obj; textRenderer.Text = (string)DefaultString("Text", textRenderer.Text); textRenderer.Font = (Font)SerializeGameAsset("Font", textRenderer.Font, typeof(Font)); ImGui.Text("Alignment"); if (ImGui.BeginCombo("Horizontal", textRenderer.HorizontalAlignment.ToString())) { if (ImGui.Selectable("Left", textRenderer.HorizontalAlignment == HorizontalAlignment.Left)) { textRenderer.HorizontalAlignment = HorizontalAlignment.Left; } if (ImGui.Selectable("Center", textRenderer.HorizontalAlignment == HorizontalAlignment.Center)) { textRenderer.HorizontalAlignment = HorizontalAlignment.Center; } if (ImGui.Selectable("Right", textRenderer.HorizontalAlignment == HorizontalAlignment.Right)) { textRenderer.HorizontalAlignment = HorizontalAlignment.Right; } ImGui.EndCombo(); } if (ImGui.BeginCombo("Vertical", textRenderer.VerticalAlignment.ToString())) { if (ImGui.Selectable("Top", textRenderer.VerticalAlignment == VerticalAlignment.Top)) { textRenderer.VerticalAlignment = VerticalAlignment.Top; } if (ImGui.Selectable("Center", textRenderer.VerticalAlignment == VerticalAlignment.Center)) { textRenderer.VerticalAlignment = VerticalAlignment.Center; } if (ImGui.Selectable("Bottom", textRenderer.VerticalAlignment == VerticalAlignment.Bottom)) { textRenderer.VerticalAlignment = VerticalAlignment.Bottom; } ImGui.EndCombo(); } }
public void Render(GLContext context) { var lightMapList = LightingEngine.LightSettings.Resources.LightMapFiles; if (string.IsNullOrEmpty(ActiveFile) && lightMapList.Count > 0) { ActiveFile = lightMapList.Keys.FirstOrDefault(); } if (ImGui.BeginCombo("Change File", ActiveFile)) { foreach (var file in lightMapList) { bool selected = ActiveFile == file.Key; if (ImGui.Selectable(file.Key, selected)) { ActiveFile = file.Key; } if (selected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } ImGui.SameLine(); bool add = ImGui.Button("+"); ImGui.SameLine(); bool remove = ImGui.Button("-"); if (add) { } if (remove) { } if (string.IsNullOrEmpty(ActiveFile)) { ImGui.Text("Select a light map .bagllmap to edit."); return; } ShowPropertyUI(context, lightMapList[ActiveFile]); }
private void DrawProperties() { if (ImGui.BeginChild("##texture_dlg_properties")) { var size = ImGui.GetWindowSize(); if (Textures.Count != 0) { //There is always a selected texture var selectedIndex = SelectedIndices.FirstOrDefault(); var texture = Textures[selectedIndex]; if (ImGui.BeginCombo("Format", texture.TargetOutput.ToString())) { foreach (var format in SupportedFormats) { bool isSelected = format == texture.TargetOutput; if (ImGui.Selectable(format.ToString())) { texture.TargetOutput = format; ReloadImageDisplay(); } if (isSelected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } } var buttonSize = new Vector2(70, 30); ImGui.SetCursorPos(new Vector2(size.X - 160, size.Y - 35)); if (ImGui.Button("Ok", buttonSize)) { } ImGui.SameLine(); if (ImGui.Button("Cancel", buttonSize)) { } } ImGui.EndChild(); }
private static void DrawTraceCombo(TraceRecord trace, bool abbreviate) { var tracelist = trace.Target.GetTracesUIList(); string selString = (abbreviate ? "PID " : "Process ") + trace.PID; if (ImGui.TableNextColumn()) { ImGui.AlignTextToFramePadding(); ImGuiUtils.DrawHorizCenteredText($"{tracelist.Length}x"); SmallWidgets.MouseoverText($"This target binary has {tracelist.Length} loaded trace{(tracelist.Length != 1 ? 's' : "")} associated with it"); } if (ImGui.TableNextColumn()) { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 35); if (ImGui.BeginCombo("##ProcessTraceCombo", selString)) { foreach (var selectableTrace in tracelist) { bool current = trace.PID == selectableTrace.PID && trace.randID == selectableTrace.randID; string label = "PID " + selectableTrace.PID; if (current is false) { //label = "Parent: " + label + $" ({selectableTrace.Target.FileName})"; label = label + $" ({selectableTrace.Target.FileName})"; } if (selectableTrace.GraphCount == 0) { label = label + "[0 graphs]"; } if (ImGui.Selectable(label, current)) { rgatState.SelectActiveTrace(selectableTrace); } if (selectableTrace.Children.Length > 0) { CreateTracesDropdown(selectableTrace, 1); } } ImGui.EndCombo(); } ImGui.SameLine(); ImGui.Text($"{ImGuiController.FA_ICON_COGS}"); } }
private bool DrawModeSelector(string label, ref Mode selectedMode) { var changed = false; ImGui.SetNextItemWidth(200); if (ImGui.BeginCombo(label, GetModeLabel(selectedMode))) { foreach (var mode in Enum.GetValues <Mode>()) { if (ImGui.Selectable(GetModeLabel(mode), mode == selectedMode)) { selectedMode = mode; changed = true; } } ImGui.EndCombo(); } return(changed); }
private static bool DrawActionCombo(IEnumerable <FFXIVAction> actions, CooldownTrigger trigger) { if (!ImGui.BeginCombo($"##Action{trigger.Priority}", #if DEBUG trigger.ActionCooldownGroup == CooldownTrigger.GCDCooldownGroup ? $"{trigger.ActionName} (GCD)" : trigger.ActionName #else trigger.ActionCooldownGroup == CooldownTrigger.GCDCooldownGroup ? "GCD" : trigger.ActionName #endif ) ) { return(false); } var changed = false; foreach (var a in actions) { var isSelected = a.RowId == trigger.ActionId; if (ImGui.Selectable( #if DEBUG a.CooldownGroup == CooldownTrigger.GCDCooldownGroup ? $"{a.Name} (GCD)" : a.Name, #else a.CooldownGroup == CooldownTrigger.GCDCooldownGroup ? "GCD" : a.Name, #endif isSelected)) { trigger.ActionId = a.RowId; trigger.ActionName = a.Name; trigger.ActionCooldownGroup = a.CooldownGroup; changed = true; } if (isSelected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); return(changed); }
public override void ReTree() { ImGui.PushID(this.UUID); if (ImGui.BeginCombo("Job / Class", this.Title)) { foreach (var cjb in cljb.Where(x => x.Name != "adventurer").OrderBy(x => x.Role).ThenBy(x => x.ClassJobParent.Row).ThenBy(x => x.RowId)) { if (ImGui.Selectable(cjb.NameEnglish.ToString())) { Title = cjb.NameEnglish.ToString(); } if (Title.Equals(cjb.NameEnglish.ToString())) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } ImGui.PopID(); }
public void LoadEditor(BfresMaterialAnim anim) { if (string.IsNullOrEmpty(SelectedMaterial)) { SelectedMaterial = anim.AnimGroups.FirstOrDefault().Name; } if (ImGui.CollapsingHeader("Header")) { ImGuiHelper.InputFromText("Name", anim, "Name", 200); ImGuiHelper.InputFromFloat("FrameCount", anim, "FrameCount"); ImGuiHelper.InputFromBoolean("Loop", anim, "Loop"); } if (ImGui.BeginCombo("Material", SelectedMaterial)) { foreach (var group in anim.AnimGroups) { bool isSelected = group.Name == SelectedMaterial; if (ImGui.Selectable(group.Name) || isSelected) { SelectedMaterial = group.Name; } if (isSelected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } foreach (var group in anim.AnimGroups) { bool isSelected = group.Name == SelectedMaterial; if (isSelected) { RenderMaterial(anim, (BfresMaterialAnim.MaterialAnimGroup)group); } } }