private void DrawControlTreeItemRecursive(Control control) { var treeNodeFlags = ImGuiTreeNodeFlags.DefaultOpen | ImGuiTreeNodeFlags.OpenOnDoubleClick; if (control == _selectedControl) { treeNodeFlags |= ImGuiTreeNodeFlags.Selected; } var opened = ImGui.TreeNodeEx(control.DisplayName, treeNodeFlags); ImGuiUtility.DisplayTooltipOnHover(control.DisplayName); if (ImGuiNative.igIsItemClicked(0) > 0) { SelectControl(control); } if (opened) { foreach (var child in control.Controls) { DrawControlTreeItemRecursive(child); } ImGui.TreePop(); } }
protected override unsafe void DrawOverride(ref bool isGameViewFocused) { ImGui.PushItemWidth(-1); ImGuiUtility.InputText("##search", _searchTextBuffer, out var searchText); UpdateSearch(searchText); ImGui.PopItemWidth(); ImGui.BeginChild("files list", ImGui.GetContentRegionAvail(), true); var clipperPtr = ImGuiNative.ImGuiListClipper_ImGuiListClipper(_items.Count, ImGui.GetTextLineHeightWithSpacing()); var clipper = new ImGuiListClipperPtr(clipperPtr); while (clipper.Step()) { for (var i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) { var item = _items[i]; var name = GetObjectName(item); if (ImGui.Selectable(name, item == _currentItem)) { _currentItem = item; Context.SelectedObject = item; } ImGuiUtility.DisplayTooltipOnHover(name); } } clipper.Destroy(); ImGui.EndChild(); }
public override void Draw(ref bool isGameViewFocused) { ImGui.BeginChild("manifest sidebar", new Vector2(300, 0), false, 0); { var panelSize = ImGui.GetContentRegionAvail(); panelSize.Y /= 2; ImGui.BeginChild("manifest contents", panelSize, true, 0); foreach (var asset in _gameStream.ManifestFile.Assets) { if (ImGui.Selectable(asset.Name, asset == _selectedAsset)) { _selectedAsset = asset; } ImGuiUtility.DisplayTooltipOnHover(asset.Name); } ImGui.EndChild(); ImGui.BeginChild("asset properties", ImGui.GetContentRegionAvail(), true, 0); if (_selectedAsset != null) { ImGui.Text($"Name: {_selectedAsset.Name}"); ImGui.Text($"TypeId: {_selectedAsset.Header.TypeId}"); ImGui.Text($"AssetType: {_selectedAsset.AssetType}"); ImGui.Text($"SourceFileName: {_selectedAsset.SourceFileName}"); ImGui.Text($"TypeHash: {_selectedAsset.Header.TypeHash}"); ImGui.Text($"InstanceDataSize: {_selectedAsset.Header.InstanceDataSize}"); ImGui.Text($"ImportsDataSize: {_selectedAsset.Header.ImportsDataSize}"); if (_selectedAsset.AssetImports.Count > 0) { ImGui.Text("Asset references:"); foreach (var assetImport in _selectedAsset.AssetImports) { ImGui.BulletText(assetImport.ImportedAsset?.Name ?? "Import not found"); } } } else { ImGui.Text("Select an asset to view its properties."); } ImGui.EndChild(); } ImGui.EndChild(); //ImGui.SameLine(); //if (_selectedContentView != null) //{ // _selectedContentView.Draw(ref isGameViewFocused); //} }
protected override void DrawOverride(ref bool isGameViewFocused) { ImGui.PushItemWidth(-1); ImGuiUtility.InputText("##search", _searchTextBuffer, out var searchText); UpdateSearch(searchText); ImGui.PopItemWidth(); ImGui.BeginChild("files list", Vector2.Zero, true); foreach (var item in _items) { if (ImGui.Selectable(item.Name, item.Asset == Context.SelectedObject)) { Context.SelectedObject = item.Asset; } ImGuiUtility.DisplayTooltipOnHover(item.Name); } ImGui.EndChild(); }
protected override void DrawOverride(ref bool isGameViewFocused) { ImGui.BeginChild("asset list sidebar", new Vector2(350, 0), true, 0); ImGui.PushItemWidth(-1); ImGuiUtility.InputText("##search", _searchTextBuffer, out var searchText); UpdateSearch(searchText); ImGui.PopItemWidth(); ImGui.BeginChild("files list", Vector2.Zero, true); foreach (var item in _items) { if (ImGui.Selectable(item.Name, item == _currentItem)) { _currentItem = item; RemoveAndDispose(ref _currentAssetView); _currentAssetView = AddDisposable(item.CreateAssetView()); } ImGuiUtility.DisplayTooltipOnHover(item.Name); } ImGui.EndChild(); ImGui.EndChild(); ImGui.SameLine(); if (_currentItem != null) { ImGui.BeginChild("asset view"); _currentAssetView.Draw(); ImGui.EndChild(); } else { ImGui.Text("Select a previewable asset."); } }
private void DrawMainUi(ref bool isGameViewFocused) { if (ImGui.BeginMenuBar()) { if (ImGui.BeginMenu("Installation")) { foreach (var installation in _installations) { if (ImGui.MenuItem(installation.Game.DisplayName, null, _selectedInstallation == installation, true)) { ChangeInstallation(installation); } } ImGui.EndMenu(); } if (ImGui.BeginMenu("Preferences")) { bool isVSyncEnabled = _isVSyncEnabled; if (ImGui.MenuItem("VSync", null, ref isVSyncEnabled, true)) { SetVSync(isVSyncEnabled); } ImGui.EndMenu(); } ImGui.EndMenuBar(); } ImGui.BeginChild("sidebar", new Vector2(250, 0), true, 0); if (_launcherImage != null) { var availableSize = ImGui.GetContentRegionAvail(); var launcherImageSize = SizeF.CalculateSizeFittingAspectRatio( new SizeF(_launcherImage.Width, _launcherImage.Height), new Size((int)availableSize.X, (int)availableSize.Y)); ImGui.Image( _imGuiRenderer.GetOrCreateImGuiBinding(_gameWindow.GraphicsDevice.ResourceFactory, _launcherImage), new Vector2(launcherImageSize.Width, launcherImageSize.Height), Vector2.Zero, Vector2.One, Vector4.One, Vector4.Zero); } ImGui.PushItemWidth(-1); ImGuiUtility.InputText("##search", _searchTextBuffer, out var searchText); UpdateSearch(searchText); ImGui.PopItemWidth(); ImGui.BeginChild("files list", Vector2.Zero, true); for (var i = 0; i < _files.Count; i++) { var entry = _files[i]; if (ImGui.Selectable(entry.FilePath, i == _currentFile)) { _currentFile = i; RemoveAndDispose(ref _contentView); _game.ContentManager.Unload(); _contentView = AddDisposable(new ContentView( new Views.AssetViewContext(_game, _gamePanel, _imGuiRenderer, entry))); } ImGuiUtility.DisplayTooltipOnHover(entry.FilePath); } ImGui.EndChild(); ImGui.EndChild(); ImGui.SameLine(); if (_contentView != null) { ImGui.BeginChild("content"); ImGui.Text(_contentView.DisplayName); if (isGameViewFocused) { var message = "Press [ESC] to unfocus the 3D view."; ImGui.SameLine(ImGui.GetWindowWidth() - ImGui.CalcTextSize(message).X); ImGui.TextColored(new Vector4(1.0f, 0.0f, 0.0f, 1.0f), message); } ImGui.BeginChild("content view"); _contentView.Draw(ref isGameViewFocused); ImGui.EndChild(); ImGui.EndChild(); } }
private void DrawDisplayListRecursive(int depth, DisplayItem item) { var treeNodeFlags = ImGuiTreeNodeFlags.DefaultOpen | ImGuiTreeNodeFlags.OpenOnDoubleClick; if (_currentClipDepth.HasValue && (depth > _currentClipDepth.Value)) { _currentClipDepth = null; } if (item.ClipDepth.HasValue) { _currentClipDepth = item.ClipDepth; } if (!(item is SpriteItem)) { treeNodeFlags = ImGuiTreeNodeFlags.Leaf; } if (item == _selectedItem) { treeNodeFlags |= ImGuiTreeNodeFlags.Selected; } if (item.ClipDepth.HasValue) { ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0.5f, 1.0f, 0.5f, 1.0f)); } else if (_currentClipDepth.HasValue) { ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0.5f, 0.5f, 0.5f, 1.0f)); } bool hasRenderCallback = false; if (item is RenderItem renderItem && renderItem.RenderCallback != null) { hasRenderCallback = true; ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1.0f, 0.5f, 0.5f, 1.0f)); } var opened = ImGui.TreeNodeEx($"[{depth}] {item.Name}", treeNodeFlags); if (hasRenderCallback) { ImGui.PopStyleColor(); } if (_currentClipDepth.HasValue) { ImGui.PopStyleColor(); } ImGuiUtility.DisplayTooltipOnHover("MovieClip: " + item.Character.Container.MovieName); if (ImGuiNative.igIsItemClicked(0) > 0) { SelectDisplayItem(item); } if (opened) { if (item is SpriteItem) { var spriteItem = item as SpriteItem; foreach (var pair in spriteItem.Content.Items) { DrawDisplayListRecursive(pair.Key, pair.Value); } } ImGui.TreePop(); } }