Esempio n. 1
0
 void ConstructContext(RigidModelPart con, bool mdlVisible)
 {
     if (ImGui.IsItemClicked(1))
     {
         ImGui.OpenPopup(con.Construct.ChildName + "_context");
     }
     if (ImGui.BeginPopupContextItem(con.Construct.ChildName + "_context"))
     {
         if (con.Mesh != null)
         {
             //Visibility of model (this is bad)
             bool visibleVar = mdlVisible;
             Theme.IconMenuToggle("Visible", "eye", Color4.White, ref visibleVar, true);
             if (visibleVar != mdlVisible)
             {
                 con.Active = visibleVar;
             }
         }
         if (Theme.BeginIconMenu("Change To", "change", Color4.White))
         {
             var cmp = (CmpFile)drawable;
             if (!(con.Construct is FixConstruct) && Theme.IconMenuItem("Fix", "fix", Color4.LightYellow, true))
             {
                 var fix = new FixConstruct(cmp.Constructs)
                 {
                     ParentName = con.Construct.ParentName,
                     ChildName  = con.Construct.ChildName,
                     Origin     = con.Construct.Origin,
                     Rotation   = con.Construct.Rotation
                 };
                 fix.Reset();
                 con.Construct = fix;
                 OnDirtyPart();
             }
             if (!(con.Construct is RevConstruct) && Theme.IconMenuItem("Rev", "rev", Color4.LightCoral, true))
             {
                 var rev = new RevConstruct()
                 {
                     ParentName = con.Construct.ParentName,
                     ChildName  = con.Construct.ChildName,
                     Origin     = con.Construct.Origin,
                     Rotation   = con.Construct.Rotation
                 };
                 con.Construct = rev;
                 OnDirtyPart();
             }
             if (!(con.Construct is PrisConstruct) && Theme.IconMenuItem("Pris", "pris", Color4.LightPink, true))
             {
                 var pris = new PrisConstruct()
                 {
                     ParentName = con.Construct.ParentName,
                     ChildName  = con.Construct.ChildName,
                     Origin     = con.Construct.Origin,
                     Rotation   = con.Construct.Rotation
                 };
                 con.Construct = pris;
                 OnDirtyPart();
             }
             if (!(con.Construct is SphereConstruct) && Theme.IconMenuItem("Sphere", "sphere", Color4.LightGreen, true))
             {
                 var sphere = new SphereConstruct()
                 {
                     ParentName = con.Construct.ParentName,
                     ChildName  = con.Construct.ChildName,
                     Origin     = con.Construct.Origin,
                     Rotation   = con.Construct.Rotation
                 };
                 con.Construct = sphere;
                 OnDirtyPart();
             }
             ImGui.EndMenu();
         }
         if (Theme.IconMenuItem("Edit", "edit", Color4.White, true))
         {
             AddPartEditor(con.Construct);
         }
         ImGui.EndPopup();
     }
 }
Esempio n. 2
0
 void ConstructContext(RigidModelPart con, bool mdlVisible)
 {
     if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
     {
         ImGui.OpenPopup(con.Construct.ChildName + "_context");
     }
     if (ImGui.BeginPopupContextItem(con.Construct.ChildName + "_context"))
     {
         if (con.Mesh != null)
         {
             //Visibility of model (this is bad)
             bool visibleVar = mdlVisible;
             Theme.IconMenuToggle(Icons.Eye, "Visible", ref visibleVar, true);
             if (visibleVar != mdlVisible)
             {
                 con.Active = visibleVar;
             }
         }
         if (Theme.BeginIconMenu(Icons.Exchange, "Change To"))
         {
             var cmp = (CmpFile)drawable;
             if (!(con.Construct is FixConstruct) && Theme.IconMenuItem(Icons.Cube_LightYellow, "Fix", true))
             {
                 var fix = new FixConstruct(cmp.Constructs)
                 {
                     ParentName = con.Construct.ParentName,
                     ChildName  = con.Construct.ChildName,
                     Origin     = con.Construct.Origin,
                     Rotation   = con.Construct.Rotation
                 };
                 fix.Reset();
                 con.Construct = fix;
                 OnDirtyPart();
             }
             if (!(con.Construct is RevConstruct) && Theme.IconMenuItem(Icons.Rev_LightCoral, "Rev", true))
             {
                 var rev = new RevConstruct()
                 {
                     ParentName = con.Construct.ParentName,
                     ChildName  = con.Construct.ChildName,
                     Origin     = con.Construct.Origin,
                     Rotation   = con.Construct.Rotation
                 };
                 con.Construct = rev;
                 OnDirtyPart();
             }
             if (!(con.Construct is PrisConstruct) && Theme.IconMenuItem(Icons.Con_Pris, "Pris", true))
             {
                 var pris = new PrisConstruct()
                 {
                     ParentName = con.Construct.ParentName,
                     ChildName  = con.Construct.ChildName,
                     Origin     = con.Construct.Origin,
                     Rotation   = con.Construct.Rotation
                 };
                 con.Construct = pris;
                 OnDirtyPart();
             }
             if (!(con.Construct is SphereConstruct) && Theme.IconMenuItem(Icons.Con_Sph, "Sphere", true))
             {
                 var sphere = new SphereConstruct()
                 {
                     ParentName = con.Construct.ParentName,
                     ChildName  = con.Construct.ChildName,
                     Origin     = con.Construct.Origin,
                     Rotation   = con.Construct.Rotation
                 };
                 con.Construct = sphere;
                 OnDirtyPart();
             }
             ImGui.EndMenu();
         }
         if (Theme.IconMenuItem(Icons.Edit, "Edit", true))
         {
             AddPartEditor(con.Construct);
         }
         ImGui.EndPopup();
     }
 }
Esempio n. 3
0
        void ConstructContext(ConstructNode con, bool mdlVisible)
        {
            if (ImGui.IsItemClicked(1))
            {
                ImGui.OpenPopup(con.Con.ChildName + "_context");
            }
            if (ImGui.BeginPopupContextItem(con.Con.ChildName + "_context"))
            {
                if (con.Model != null)
                {
                    //Visibility of model (this is bad)
                    bool visibleVar = mdlVisible;
                    Theme.IconMenuToggle("Visible", "eye", Color4.White, ref visibleVar, true);
                    if (visibleVar != mdlVisible)
                    {
                        if (visibleVar)
                        {
                            hiddenModels.Remove(con.Model);
                        }
                        else
                        {
                            hiddenModels.Add(con.Model);
                        }
                    }
                }

                if (Theme.BeginIconMenu("Change To", "change", Color4.White))
                {
                    var cmp = (CmpFile)drawable;
                    if (!(con.Con is FixConstruct) && Theme.IconMenuItem("Fix", "fix", Color4.LightYellow, true))
                    {
                        var fix = new FixConstruct(cmp.Constructs)
                        {
                            ParentName = con.Con.ParentName,
                            ChildName  = con.Con.ChildName,
                            Origin     = con.Con.Origin,
                            Rotation   = con.Con.Rotation
                        };
                        fix.Reset();
                        ReplaceConstruct(con, fix);
                        OnDirtyPart();
                    }
                    if (!(con.Con is RevConstruct) && Theme.IconMenuItem("Rev", "rev", Color4.LightCoral, true))
                    {
                        var rev = new RevConstruct(cmp.Constructs)
                        {
                            ParentName = con.Con.ParentName,
                            ChildName  = con.Con.ChildName,
                            Origin     = con.Con.Origin,
                            Rotation   = con.Con.Rotation
                        };
                        ReplaceConstruct(con, rev);
                        OnDirtyPart();
                    }
                    if (!(con.Con is PrisConstruct) && Theme.IconMenuItem("Pris", "pris", Color4.LightPink, true))
                    {
                        var pris = new PrisConstruct(cmp.Constructs)
                        {
                            ParentName = con.Con.ParentName,
                            ChildName  = con.Con.ChildName,
                            Origin     = con.Con.Origin,
                            Rotation   = con.Con.Rotation
                        };
                        ReplaceConstruct(con, pris);
                        OnDirtyPart();
                    }
                    if (!(con.Con is SphereConstruct) && Theme.IconMenuItem("Sphere", "sphere", Color4.LightGreen, true))
                    {
                        var sphere = new SphereConstruct(cmp.Constructs)
                        {
                            ParentName = con.Con.ParentName,
                            ChildName  = con.Con.ChildName,
                            Origin     = con.Con.Origin,
                            Rotation   = con.Con.Rotation
                        };
                        ReplaceConstruct(con, sphere);
                        OnDirtyPart();
                    }
                    ImGui.EndMenu();
                }
                if (Theme.IconMenuItem("Edit", "edit", Color4.White, true))
                {
                    AddPartEditor(con.Con);
                }
                ImGui.EndPopup();
            }
        }
Esempio n. 4
0
 void ConstructContext(ConstructNode con)
 {
     if (ImGui.IsItemClicked(1))
     {
         ImGui.OpenPopup(con.Con.ChildName + "_context");
     }
     if (ImGui.BeginPopupContextItem(con.Con.ChildName + "_context"))
     {
         if (Theme.BeginIconMenu("Change To", "change", Color4.White))
         {
             var cmp = (CmpFile)drawable;
             if (!(con.Con is FixConstruct) && Theme.IconMenuItem("Fix", "fix", Color4.LightYellow, true))
             {
                 var fix = new FixConstruct(cmp.Constructs)
                 {
                     ParentName = con.Con.ParentName,
                     ChildName  = con.Con.ChildName,
                     Origin     = con.Con.Origin,
                     Rotation   = con.Con.Rotation
                 };
                 fix.Reset();
                 ReplaceConstruct(con, fix);
             }
             if (!(con.Con is RevConstruct) && Theme.IconMenuItem("Rev", "rev", Color4.LightCoral, true))
             {
                 var rev = new RevConstruct(cmp.Constructs)
                 {
                     ParentName = con.Con.ParentName,
                     ChildName  = con.Con.ChildName,
                     Origin     = con.Con.Origin,
                     Rotation   = con.Con.Rotation
                 };
                 ReplaceConstruct(con, rev);
             }
             if (!(con.Con is PrisConstruct) && Theme.IconMenuItem("Pris", "pris", Color4.LightPink, true))
             {
                 var pris = new PrisConstruct(cmp.Constructs)
                 {
                     ParentName = con.Con.ParentName,
                     ChildName  = con.Con.ChildName,
                     Origin     = con.Con.Origin,
                     Rotation   = con.Con.Rotation
                 };
                 ReplaceConstruct(con, pris);
             }
             if (!(con.Con is SphereConstruct) && Theme.IconMenuItem("Sphere", "sphere", Color4.LightGreen, true))
             {
                 var sphere = new SphereConstruct(cmp.Constructs)
                 {
                     ParentName = con.Con.ParentName,
                     ChildName  = con.Con.ChildName,
                     Origin     = con.Con.Origin,
                     Rotation   = con.Con.Rotation
                 };
                 ReplaceConstruct(con, sphere);
             }
             ImGui.EndMenu();
         }
         if (Theme.IconMenuItem("Edit", "edit", Color4.White, true))
         {
             AddPartEditor(con.Con);
         }
         ImGui.EndPopup();
     }
 }