public override void DrawMutable()
        {
            bool isOpen = ImGui.CollapsingHeader($"{_name}", ImGuiTreeNodeFlags.FramePadding);

            if (AllowsEffectRemoval)
            {
                NezImGui.ShowContextMenuTooltip();
            }

            if (AllowsEffectRemoval && ImGui.BeginPopupContextItem())
            {
                if (ImGui.Selectable("Remove Effect"))
                {
                    SetValue(null);
                    _isTargetDestroyed = true;
                }

                ImGui.EndPopup();
            }

            if (isOpen && !_isTargetDestroyed)
            {
                foreach (AbstractTypeInspector i in _inspectors)
                {
                    i.Draw();
                }
            }
        }
Esempio n. 2
0
        public void Draw()
        {
            ImGui.PushID(_scopeId);
            var isOpen = ImGui.CollapsingHeader(_postProcessor.GetType().Name.Replace("PostProcessor", string.Empty));

            NezImGui.ShowContextMenuTooltip();

            if (ImGui.BeginPopupContextItem())
            {
                if (ImGui.Selectable("Remove PostProcessor"))
                {
                    isOpen = false;
                    Core.Scene.RemovePostProcessor(_postProcessor);
                    ImGui.CloseCurrentPopup();
                }

                ImGui.EndPopup();
            }

            if (isOpen)
            {
                ImGui.Indent();
                foreach (var inspector in _inspectors)
                {
                    inspector.Draw();
                }
                ImGui.Unindent();
            }

            ImGui.PopID();
        }
Esempio n. 3
0
        public void Draw()
        {
            ImGui.PushID(_scopeId);
            var isOpen = ImGui.CollapsingHeader(_name);

            NezImGui.ShowContextMenuTooltip();

            if (ImGui.BeginPopupContextItem())
            {
                if (ImGui.Selectable("Remove Renderer"))
                {
                    if (Core.Scene is ECScene s)
                    {
                        isOpen = false;
                        s.RemoveRenderer(_renderer);
                        ImGui.CloseCurrentPopup();
                    }
                }

                ImGui.EndPopup();
            }

            if (isOpen)
            {
                ImGui.Indent();

                _materialInspector.Draw();

                ImGui.Checkbox("shouldDebugRender", ref Renderer.ShouldDebugRender);

                var value = Renderer.RenderTargetClearColor.ToNumerics();
                if (ImGui.ColorEdit4("renderTargetClearColor", ref value))
                {
                    Renderer.RenderTargetClearColor = value.ToXNAColor();
                }

                if (Renderer.Camera != null)
                {
                    if (NezImGui.LabelButton("Camera", Renderer.Camera.Entity.Name))
                    {
                        Core.GetGlobalManager <ImGuiManager>().StartInspectingEntity(Renderer.Camera.Entity);
                    }
                }

                ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * 0.5f);
                NezImGui.DisableNextWidget();
                var tempBool = Renderer.WantsToRenderToSceneRenderTarget;
                ImGui.Checkbox("wantsToRenderToSceneRenderTarget", ref tempBool);

                NezImGui.DisableNextWidget();
                tempBool = Renderer.WantsToRenderAfterPostProcessors;
                ImGui.Checkbox("wantsToRenderAfterPostProcessors", ref tempBool);
                ImGui.PopStyleVar();

                ImGui.Unindent();
            }

            ImGui.PopID();
        }
Esempio n. 4
0
        void DrawEntity(Entity entity, bool onlyDrawRoots = true)
        {
            if (onlyDrawRoots && entity.Transform.Parent != null)
            {
                return;
            }

            ImGui.PushID((int)entity.Id);
            bool treeNodeOpened;

            if (entity.Transform.ChildCount > 0)
            {
                treeNodeOpened = ImGui.TreeNodeEx($"{entity.Name} ({entity.Transform.ChildCount})###{entity.Id}",
                                                  ImGuiTreeNodeFlags.OpenOnArrow);
            }
            else
            {
                treeNodeOpened = ImGui.TreeNodeEx($"{entity.Name} ({entity.Transform.ChildCount})###{entity.Id}",
                                                  ImGuiTreeNodeFlags.Leaf | ImGuiTreeNodeFlags.OpenOnArrow);
            }

            NezImGui.ShowContextMenuTooltip();

            // context menu for entity commands
            //ImGui.OpenPopupOnItemClick("entityContextMenu", 1);
            ImGui.OpenPopup("entityContextMenu", ImGuiPopupFlags.MouseButtonDefault);
            DrawEntityContextMenuPopup(entity);

            // we are looking for a double-click that is not on the arrow
            if (ImGui.IsMouseDoubleClicked(0) && ImGui.IsItemClicked() &&
                (ImGui.GetMousePos().X - ImGui.GetItemRectMin().X) > ImGui.GetTreeNodeToLabelSpacing())
            {
                Core.GetGlobalManager <ImGuiManager>().StartInspectingEntity(entity);
            }

            if (treeNodeOpened)
            {
                for (var i = 0; i < entity.Transform.ChildCount; i++)
                {
                    DrawEntity(entity.Transform.GetChild(i).Entity, false);
                }

                ImGui.TreePop();
            }

            ImGui.PopID();
        }
        public override void DrawMutable()
        {
            bool isOpen = ImGui.CollapsingHeader($"{_name}", ImGuiTreeNodeFlags.FramePadding);

            if (GetValue() == null)
            {
                if (isOpen)
                {
                    DrawNullMaterial();
                }

                return;
            }

            NezImGui.ShowContextMenuTooltip();

            if (ImGui.BeginPopupContextItem())
            {
                if (AllowsMaterialRemoval && ImGui.Selectable("Remove Material"))
                {
                    SetValue(null);
                    _inspectors.Clear();
                    ImGui.CloseCurrentPopup();
                }

                if (ImGui.Selectable("Set Effect", false, ImGuiSelectableFlags.DontClosePopups))
                {
                    ImGui.OpenPopup("effect-chooser");
                }

                ImGui.EndPopup();
            }

            if (isOpen)
            {
                ImGui.Indent();

                if (_inspectors.Count == 0)
                {
                    if (NezImGui.CenteredButton("Set Effect", 0.6f))
                    {
                        ImGui.OpenPopup("effect-chooser");
                    }
                }

                for (int i = _inspectors.Count - 1; i >= 0; i--)
                {
                    if (_inspectors[i].IsTargetDestroyed)
                    {
                        _inspectors.RemoveAt(i);
                        continue;
                    }

                    _inspectors[i].Draw();
                }

                ImGui.Unindent();
            }

            if (DrawEffectChooserPopup())
            {
                ImGui.CloseCurrentPopup();
            }
        }