public void LibraryFilesTab() { ImGui.BeginChild("##libtabinner"); { if (ImGui.Button("Add")) { librarySelector = new FileSelector(context.FlDirectory); librarySelector.Filter = FileSelector.MakeFilter(".utf", ".vms", ".mat", ".txm", ".3db", ".cmp"); librarySelector.Open(); } ImGui.Separator(); string newfile; if ((newfile = librarySelector.Draw()) != null) { resources.LibraryFiles.Add(newfile); context.LoadLibraries(); } ImGui.BeginChild("##items"); foreach (var file in resources.LibraryFiles) { ImGui.Selectable(file); } ImGui.EndChild(); } ImGui.EndChild(); }
public void ModelTab() { ImGui.BeginChild("##tabinner"); if (ImGui.Button("Add")) { modelSelector = new FileSelector(context.FlDirectory); modelSelector.Filter = FileSelector.MakeFilter(".3db", ".cmp"); modelSelector.Open(); } string newfile; if ((newfile = modelSelector.Draw()) != null) { var name = Path.GetFileName(newfile); resources.Models.Add(new InterfaceModel() { Name = name, Path = newfile }); } ImGui.Columns(2); ImGui.BeginChild("##items"); for (int i = 0; i < resources.Models.Count; i++) { if (ImGui.Selectable(ImGuiExt.IDWithExtra(resources.Models[i].Name, i.ToString()), _selModelIndex == i)) { _selModelIndex = i; drawable = context.GetModel(resources.Models[i].Path); modelName.SetText(resources.Models[i].Name); } } ImGui.EndChild(); ImGui.NextColumn(); ImGui.BeginChild("##pane"); if (_selModelIndex >= 0 && _selModelIndex < resources.Models.Count) { var mdl = resources.Models[_selModelIndex]; ImGui.SameLine(ImGui.GetColumnWidth() - 65); if (ImGui.Button("Delete")) { resources.Models.RemoveAt(_selModelIndex); _selModelIndex = -1; } ImGui.AlignTextToFramePadding(); ImGui.Text("Name: "); ImGui.SameLine(); modelName.InputText("##Name", ImGuiInputTextFlags.None); mdl.Name = modelName.GetText(); ImGui.Text($"Path: {mdl.Path}"); ImGui.InputFloat("Offset X", ref mdl.X); ImGui.InputFloat("Offset Y", ref mdl.Y); ImGui.InputFloat("Scale X", ref mdl.XScale); ImGui.InputFloat("Scale Y", ref mdl.YScale); DoViewport(mdl); } ImGui.EndChild(); ImGui.EndChild(); }