Exemplo n.º 1
0
        private void InitializeListView()
        {
            imageListView.AllowDuplicateFileNames = true;
            imageListView.SetRenderer(new ImageListViewRenderers.DefaultRenderer());

            imageListView.Columns.Add(ColumnType.Name);
            imageListView.Columns.Add(ColumnType.FileSize);
            imageListView.ThumbnailSize = new Size(64, 64);

            imageListView.Items.Clear();
            imageListView.SuspendLayout();
            try
            {
                var directoryPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Libraries", "Style");
                var di            = new DirectoryInfo(directoryPath);
                if (!di.Exists)
                {
                    return;
                }

                foreach (var p in di.GetFiles("*.jpg"))
                {
                    if (UserConfig.ByName("Options")["Styles", p.FullName, "1"] == "1")
                    {
                        imageListView.Items.Add(p.FullName);
                    }
                }
            }
            finally
            {
                imageListView.ResumeLayout();
            }
        }
Exemplo n.º 2
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            using (var ofd = new OpenFileDialogEx("Import styles settings", "Text file(*.txt)|*.txt"))
            {
                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                using (var reader = new StreamReader(ofd.FileName, Encoding.Default))
                {
                    while (!reader.EndOfStream)
                    {
                        var path     = reader.ReadLine();
                        var size     = reader.ReadLine();
                        var position = reader.ReadLine();

                        if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(size) || string.IsNullOrEmpty(position))
                        {
                            continue;
                        }

                        UserConfig.ByName("Parts")[path, "Size"]     = size;
                        UserConfig.ByName("Parts")[path, "Position"] = position;
                    }
                }
            }
            MessageBox.Show("Styles settings imported!", "Done");
        }
Exemplo n.º 3
0
        private void btnDots_Click(object sender, EventArgs e)
        {
            if (btnDots.Tag.ToString() == "2")
            {
                btnDots.Tag     = "1";
                btnPolyLine.Tag = btnShapeTool.Tag = "2";

                btnDots.Image      = Properties.Resources.btnDotsPressed;
                btnPolyLine.Image  = Properties.Resources.btnPolyLineNormal;
                btnShapeTool.Image = Properties.Resources.btnHandNormal1;

                ProgramCore.MainForm.ctrlRenderControl.Mode = Mode.HeadShapedots;
                ProgramCore.MainForm.ctrlTemplateImage.UpdateUserCenterPositions(false, true);
                ProgramCore.MainForm.DisableRotating();

                UpdateFlipEnable(ProgramCore.Project.ShapeFlip);
                SetPanelLogic();

                if (frontTab && UserConfig.ByName("Options")["Tutorials", "Shapedots", "1"] == "1")
                {
                    ProgramCore.MainForm.frmTutShapedots.ShowDialog(this);
                }
            }
            else
            {
                btnDots.Tag   = "2";
                btnDots.Image = Properties.Resources.btnDotsNormal;
                UpdateNormals();

                ProgramCore.MainForm.ctrlRenderControl.Mode = Mode.None;
                ProgramCore.MainForm.EnableRotating();
                DisableFlip();
                SetPanelLogic();
            }
        }
Exemplo n.º 4
0
        public frmAutodotsTutorial()
        {
            InitializeComponent();
            linkLabel1.Text      = UserConfig.ByName("Tutorials")["Links", "Autodots", GetDefaultLink()];
            Text                 = ProgramCore.ProgramCaption;
            linkLabel1.BackColor = Color.FromArgb(211, 211, 211);

            var directoryPath = Path.Combine(Application.StartupPath, "Tutorials");
            var filePath      = string.Empty;

            switch (ProgramCore.CurrentProgram)
            {
            case ProgramCore.ProgramMode.HeadShop_OneClick:
                filePath = FolderEx.GetTutorialImagePath("TutAutodots_OneClick");
                break;

            default:
                filePath = FolderEx.GetTutorialImagePath("TutAutodots");
                break;
            }

            if (!string.IsNullOrEmpty(filePath))
            {
                pictureBox1.ImageLocation = filePath;
            }
        }
Exemplo n.º 5
0
        private void btn3DPrint_Click(object sender, EventArgs e)
        {
            switch (ProgramCore.CurrentProgram)
            {
            case ProgramCore.ProgramMode.HeadShop_v10_2:
            case ProgramCore.ProgramMode.HeadShop_v11:
            case ProgramCore.ProgramMode.FaceAge2_Partial:
            case ProgramCore.ProgramMode.HeadShop_OneClick_v2:
            case ProgramCore.ProgramMode.HeadShop_Rotator:
            case ProgramCore.ProgramMode.PrintAhead:
            case ProgramCore.ProgramMode.PrintAhead_PayPal:
            case ProgramCore.ProgramMode.PrintAhead_Online:
                if (ProgramCore.IsTutorialVisible && UserConfig.ByName("Options")["Tutorials", "3DPrinting", "1"] == "1")
                {
                    ProgramCore.MainForm.frmTut3dPrint.ShowDialog(this);
                }
                break;
            }

            if (ProgramCore.paypalHelper == null)
            {
                ProgramCore.MainForm.ExportSTL();
            }
            else
            {
                ProgramCore.paypalHelper.MakePayment("5", "STL export", PrintType.STL);
            }
        }
Exemplo n.º 6
0
 private void frmNewProject2_Load(object sender, EventArgs e)
 {
     if (UserConfig.ByName("Options")["Tutorials", "Recognize", "1"] == "1")
     {
         ProgramCore.MainForm.frmTutRecognize.ShowDialog(this);
     }
 }
Exemplo n.º 7
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (!UserConfig.ByName("Parts").HasAny())
            {
                return;
            }

            using (var sfd = new SaveFileDialogEx("Export styles settings", "Text file(*.txt)|*.txt"))
            {
                if (sfd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                using (var writer = new StreamWriter(sfd.FileName, false, Encoding.Default))
                {
                    var directoryPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Libraries", "Style");
                    var data          = UserConfig.ByName("Parts").data;
                    var result        = data.Select(x => x.s1).Distinct();
                    foreach (var d in result)
                    {
                        var dir = Path.GetDirectoryName(d);
                        if (dir != directoryPath)
                        {
                            continue;
                        }
                        writer.WriteLine(d);
                        writer.WriteLine(UserConfig.ByName("Parts")[d, "Size"]);
                        writer.WriteLine(UserConfig.ByName("Parts")[d, "Position"]);
                    }
                }
            }
            MessageBox.Show("Styles settings exported!", "Done");
        }
Exemplo n.º 8
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     foreach (var sel in imageListView.SelectedItems)
     {
         var path = Path.Combine(sel.FilePath, sel.FileName);
         UserConfig.ByName("Options")["Styles", path] = "0";     // not delete, just hide it.
     }
     InitializeListView();
 }
Exemplo n.º 9
0
        public void btnFlipRight_Click(object sender, EventArgs e)
        {
            if (btnFlipRight.Tag.ToString() == "2")
            {
                btnFlipRight.Tag = "1";
                btnFlipLeft.Tag  = "2";

                btnFlipRight.Image = Properties.Resources.btnToLeftPressed;
                btnFlipLeft.Image  = Properties.Resources.btnToRightNormal;

                switch (ProgramCore.MainForm.ctrlRenderControl.Mode)
                {
                case Mode.HeadLine:
                case Mode.HeadShapedots:
                    ProgramCore.MainForm.ctrlRenderControl.headMeshesController.Mirror(false, 0);
                    ProgramCore.Project.ShapeFlip = FlipType.RightToLeft;

                    ProgramCore.MainForm.ctrlRenderControl.headController.AutoDots.ClearSelection();
                    ProgramCore.MainForm.ctrlRenderControl.headController.ShapeDots.ClearSelection();
                    ProgramCore.MainForm.ctrlTemplateImage.RectTransformMode = false;
                    break;

                case Mode.HeadAutodotsFirstTime:
                case Mode.HeadAutodots:
                    ProgramCore.MainForm.ctrlRenderControl.FlipRight(true);
                    ProgramCore.Project.TextureFlip = FlipType.RightToLeft;
                    break;
                }

                if (frontTab && UserConfig.ByName("Options")["Tutorials", "Mirror", "1"] == "1")
                {
                    ProgramCore.MainForm.frmTutMirror.ShowDialog(this);
                }
            }
            else
            {
                btnFlipRight.Tag   = "2";
                btnFlipRight.Image = Properties.Resources.btnToLeftNormal;

                switch (ProgramCore.MainForm.ctrlRenderControl.Mode)
                {
                case Mode.HeadLine:
                case Mode.HeadShapedots:
                    ProgramCore.MainForm.ctrlRenderControl.headMeshesController.UndoMirror();
                    ProgramCore.Project.ShapeFlip = FlipType.None;
                    break;

                case Mode.HeadAutodotsFirstTime:
                case Mode.HeadAutodots:
                    ProgramCore.MainForm.ctrlRenderControl.FlipRight(false);
                    ProgramCore.Project.TextureFlip = FlipType.None;
                    break;
                }

                SetPanelLogic();
            }
        }
Exemplo n.º 10
0
        public void btnFlipLeft_Click(object sender, EventArgs e)
        {
            if (btnFlipLeft.Tag.ToString() == "2")
            {
                btnFlipLeft.Tag  = "1";
                btnFlipRight.Tag = "2";

                btnFlipLeft.Image  = Properties.Resources.btnToRightPressed;
                btnFlipRight.Image = Properties.Resources.btnToLeftNormal;

                switch (ProgramCore.MainForm.ctrlRenderControl.Mode)
                {
                case Mode.HeadLine:
                    ProgramCore.Project.RenderMainHelper.headMeshesController.Mirror(true, 0);
                    ProgramCore.Project.ShapeFlip = FlipType.LeftToRight;

                    ProgramCore.Project.RenderMainHelper.headController.AutoDotsv2.ClearSelection();
                    ProgramCore.Project.RenderMainHelper.headController.ShapeDots.ClearSelection();
                    ProgramCore.MainForm.ctrlTemplateImage.RectTransformMode = false;
                    break;

                case Mode.None:
                    ProgramCore.MainForm.ctrlRenderControl.LeftToRightReflection = true;
                    ProgramCore.MainForm.ctrlRenderControl.ApplySmoothedTextures();
                    break;
                }

                SetPanelLogic();

                if (frontTab && ProgramCore.IsTutorialVisible && UserConfig.ByName("Options")["Tutorials", "Mirror", "1"] == "1")
                {
                    ProgramCore.MainForm.frmTutMirror.ShowDialog(this);
                }
            }
            else
            {
                btnFlipLeft.Tag   = "2";
                btnFlipLeft.Image = Properties.Resources.btnToRightNormal;

                switch (ProgramCore.MainForm.ctrlRenderControl.Mode)
                {
                case Mode.HeadLine:
                    ProgramCore.Project.RenderMainHelper.headMeshesController.UndoMirror();
                    ProgramCore.Project.ShapeFlip = FlipType.None;
                    break;

                case Mode.None:
                    ProgramCore.MainForm.ctrlRenderControl.LeftToRightReflection = null;
                    ProgramCore.MainForm.ctrlRenderControl.ApplySmoothedTextures();
                    break;
                }
            }
        }
Exemplo n.º 11
0
        public void btnShapeTool_Click(object sender, EventArgs e)
        {
            if (btnShapeTool.Tag.ToString() == "2")
            {
                btnShapeTool.Tag   = "1";
                btnShapeTool.Image = Properties.Resources.btnHandPressed1;

                ProgramCore.MainForm.ctrlRenderControl.Mode = Mode.HeadShapeFirstTime;
                ProgramCore.MainForm.EnableRotating();

                ProgramCore.MainForm.frmFreeHand.cbMirror.Enabled = false;
                ProgramCore.MainForm.ctrlTemplateImage.UpdateUserCenterPositions(false, true);

                UpdateFlipEnable(ProgramCore.Project.ShapeFlip);
                SetPanelLogic();

                if (OnShapeTool != null && sender != null)
                {
                    OnShapeTool(this, EventArgs.Empty);
                }

                if (frontTab && UserConfig.ByName("Options")["Tutorials", "Freehand", "1"] == "1")
                {
                    ProgramCore.MainForm.frmTutFreehand.ShowDialog(this);
                }
            }
            else
            {
                btnShapeTool.Tag   = "2";
                btnShapeTool.Image = Properties.Resources.btnHandNormal1;

                btnDots.Enabled = btnPolyLine.Enabled = btnShapeTool.Enabled = false;
                ProgramCore.MainForm.ctrlRenderControl.Mode = Mode.None;
                ProgramCore.MainForm.DisableRotating();
                ProgramCore.MainForm.ctrlRenderControl.HeadShapeController.EndShape();

                ProgramCore.MainForm.frmFreeHand.BeginUpdate();
                ProgramCore.MainForm.frmFreeHand.cbMirror.Enabled = false;
                ProgramCore.MainForm.frmFreeHand.cbMirror.Checked = false;
                ProgramCore.MainForm.frmFreeHand.EndUpdate();

                SetPanelLogic();
                SetDefaultHeadRotation();
                UpdateNormals();

                if (OnShapeTool != null && sender != null)
                {
                    OnShapeTool(this, EventArgs.Empty);
                }
            }
        }
Exemplo n.º 12
0
        public frmChildTutorial()
        {
            InitializeComponent();
            linkLabel1.Text      = UserConfig.ByName("Tutorials")["Links", "Profile", "http://youtu.be/Olc7oeQUmWk"];
            Text                 = ProgramCore.ProgramCaption;
            linkLabel1.BackColor = Color.FromArgb(211, 211, 211);

            var filePath = FolderEx.GetTutorialImagePath("TutChild_OneClick");

            if (!string.IsNullOrEmpty(filePath))
            {
                pictureBox1.ImageLocation = filePath;
            }
        }
Exemplo n.º 13
0
        public frmFreehandTutorial()
        {
            InitializeComponent();
            linkLabel1.Text      = UserConfig.ByName("Tutorials")["Links", "Freehand", "http://youtu.be/c2Yvd2DaiDg"];
            Text                 = ProgramCore.ProgramCaption;
            linkLabel1.BackColor = Color.FromArgb(211, 211, 211);

            var filePath = FolderEx.GetTutorialImagePath("TutFreehand");

            if (!string.IsNullOrEmpty(filePath))
            {
                pictureBox1.ImageLocation = filePath;
            }
        }
Exemplo n.º 14
0
        public frmStageTutorial()
        {
            InitializeComponent();
            linkLabel1.Text      = UserConfig.ByName("Tutorials")["Links", "Stage", "https://www.youtube.com/watch?v=AjG09RGgHvw"];
            Text                 = ProgramCore.ProgramCaption;
            linkLabel1.BackColor = Color.FromArgb(211, 211, 211);

            var filePath = FolderEx.GetTutorialImagePath("StageTutorial");

            if (!string.IsNullOrEmpty(filePath))
            {
                pictureBox1.ImageLocation = filePath;
            }
        }
Exemplo n.º 15
0
        public frm3dPrintTutorial()
        {
            InitializeComponent();
            linkLabel1.Text      = UserConfig.ByName("Tutorials")["Links", "3DPrinting", "https://youtu.be/A_MQCNI4E8U"];
            Text                 = ProgramCore.ProgramCaption;
            linkLabel1.BackColor = Color.FromArgb(211, 211, 211);

            var filePath = FolderEx.GetTutorialImagePath("Tut3DPrint");

            if (!string.IsNullOrEmpty(filePath))
            {
                pictureBox1.ImageLocation = filePath;
            }
        }
Exemplo n.º 16
0
        public frmAccessoryTutorial()
        {
            InitializeComponent();
            linkLabel1.Text      = UserConfig.ByName("Tutorials")["Links", "Accessory", GetDefaultLink()];
            Text                 = ProgramCore.ProgramCaption;
            linkLabel1.BackColor = Color.FromArgb(211, 211, 211);

            var filePath = FolderEx.GetTutorialImagePath("AccessoryTutorial");

            if (!string.IsNullOrEmpty(filePath))
            {
                pictureBox1.ImageLocation = filePath;
            }
        }
Exemplo n.º 17
0
        private void btnUseAsBackgroundColor_Click(object sender, EventArgs e)
        {
            if (ProgramCore.IsTutorialVisible && UserConfig.ByName("Options")["Tutorials", "Retouch", "1"] == "1")
            {
                ProgramCore.MainForm.frmTutRetouch.ShowDialog(this);
            }

            ProgramCore.Project.FaceColor = new Vector4(panelColor.BackColor.R / 255f, panelColor.BackColor.G / 255f, panelColor.BackColor.B / 255f, StringConverter.ToFloat(teAlpha.Text, 255) / 255f);
            ProgramCore.MainForm.ctrlRenderControl.ApplySmoothedTextures();

            foreach (var mesh in ProgramCore.MainForm.ctrlRenderControl.pickingController.AccesoryMeshes)
            {
                mesh.Material.DiffuseColor = ProgramCore.Project.FaceColor;
            }
        }
Exemplo n.º 18
0
        private void btnClearProperties_Click(object sender, EventArgs e)
        {
            if (ProgramCore.MainForm.ctrlRenderControl.pickingController.HairMeshes.Count == 0)
            {
                return;
            }

            var mesh = ProgramCore.MainForm.ctrlRenderControl.pickingController.HairMeshes[0];

            if (string.IsNullOrEmpty(mesh.Path))
            {
                return;
            }

            UserConfig.ByName("Parts").Remove(mesh.Path);
        }
Exemplo n.º 19
0
        private void btnSavePositionAndSize_Click(object sender, EventArgs e)
        {
            if (ProgramCore.MainForm.ctrlRenderControl.pickingController.HairMeshes.Count == 0)
            {
                return;
            }

            var mesh = ProgramCore.MainForm.ctrlRenderControl.pickingController.HairMeshes[0];

            if (string.IsNullOrEmpty(mesh.Path))
            {
                return;
            }

            UserConfig.ByName("Parts")[mesh.Path, "Size"]     = ((trackBarSize.Value - trackBarSize.Minimum) * 1f / (trackBarSize.Maximum - trackBarSize.Minimum)).ToString();
            UserConfig.ByName("Parts")[mesh.Path, "Position"] = mesh.Position.X + "/" + mesh.Position.Y + "/" + mesh.Position.Z;
        }
Exemplo n.º 20
0
        private void btnSavePositionAndSize_Click(object sender, EventArgs e)
        {
            if (ProgramCore.MainForm.ctrlRenderControl.pickingController.SelectedMeshes.Count != 1 || ProgramCore.MainForm.ctrlRenderControl.pickingController.SelectedMeshes[0].meshType != MeshType.Accessory)
            {
                return;
            }

            var mesh = ProgramCore.MainForm.ctrlRenderControl.pickingController.SelectedMeshes[0];

            if (string.IsNullOrEmpty(mesh.Path))
            {
                return;
            }

            UserConfig.ByName("Parts")[mesh.Path, "Size"]     = mesh.MeshSize.ToString();
            UserConfig.ByName("Parts")[mesh.Path, "Position"] = mesh.Position.X + "/" + mesh.Position.Y + "/" + mesh.Position.Z;
        }
Exemplo n.º 21
0
        public void btnPolyLine_Click(object sender, EventArgs e)
        {
            if (ProgramCore.IsTutorialVisible && UserConfig.ByName("Options")["Tutorials", "LineTool", "1"] == "1")
            {
                frmTutLineTool.ShowDialog(this);
            }

            if (btnPolyLine.Tag.ToString() == "2")
            {
                btnPolyLine.Tag = "1";
                btnLine.Tag     = btnArc.Tag = "2";

                btnPolyLine.Image = Resources.btnPolyLinePressed;
                btnLine.Image     = Resources.btnLineNormal;
                btnArc.Image      = Resources.btnArcNormal;

                ProgramCore.MainForm.ctrlRenderControl.ToolsMode = ToolsMode.HairPolyLine;
            }
            ProgramCore.MainForm.ctrlRenderControl.sliceController.BeginSlice();            //  if was selected - reset.
        }
Exemplo n.º 22
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            foreach (var sel in imageListView.SelectedItems)
            {
                var path = Path.Combine(sel.FilePath, sel.FileName);
                UserConfig.ByName("Options")["Styles", path] = "0";     // not delete, just hide it.

                /*     var mtlPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + ".mtl");
                 *   var objPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + ".obj");
                 *   var objNullPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + "_null.obj");
                 *
                 *   var fi = new FileInfo(path);
                 *   if (fi.Exists)
                 *   {
                 *       fi.Attributes = FileAttributes.Normal;
                 *       fi.Delete();
                 *   }
                 *
                 *   var mtlFi = new FileInfo(mtlPath);
                 *   if (mtlFi.Exists)
                 *   {
                 *       mtlFi.Attributes = FileAttributes.Normal;
                 *       mtlFi.Delete();
                 *   }
                 *
                 *   var objFi = new FileInfo(objPath);
                 *   if (objFi.Exists)
                 *   {
                 *       objFi.Attributes = FileAttributes.Normal;
                 *       objFi.Delete();
                 *   }
                 *
                 *   var objNullFi = new FileInfo(objNullPath);
                 *   if (objNullFi.Exists)
                 *   {
                 *       objNullFi.Attributes = FileAttributes.Normal;
                 *       objNullFi.Delete();
                 *   }*/
            }
            InitializeListView();
        }
Exemplo n.º 23
0
        private void btnColor3DPrint_Click(object sender, EventArgs e)
        {
            switch (ProgramCore.CurrentProgram)
            {
            case ProgramCore.ProgramMode.HeadShop_v10_2:
            case ProgramCore.ProgramMode.HeadShop_v11:
            case ProgramCore.ProgramMode.FaceAge2_Partial:
            case ProgramCore.ProgramMode.HeadShop_OneClick_v2:
            case ProgramCore.ProgramMode.HeadShop_Rotator:
            case ProgramCore.ProgramMode.PrintAhead:
            case ProgramCore.ProgramMode.PrintAhead_PayPal:
            case ProgramCore.ProgramMode.PrintAhead_Online:
                if (ProgramCore.IsTutorialVisible && UserConfig.ByName("Options")["Tutorials", "Export", "1"] == "1")
                {
                    ProgramCore.MainForm.frmTut3dPrint.ShowDialog(this);
                }
                break;
            }

            ProgramCore.MainForm.ExportDAE();       // color 8$
        }
Exemplo n.º 24
0
 private void cbShow_CheckedChanged(object sender, System.EventArgs e)
 {
     UserConfig.ByName("Options")["Tutorials", "CustomHeads"] = cbShow.Checked ? "0" : "1";
 }
Exemplo n.º 25
0
        public void btnAutodots_Click(object sender, EventArgs e)
        {
            if (IsUpdating)
            {
                return;
            }

            BeginUpdate();
            if (btnAutodots.Tag.ToString() == "2")
            {
                btnAutodots.Tag = "1";

                SetDefaultHeadRotation();
                ProgramCore.MainForm.DisableRotating();

                btnAutodots.BackColor = SystemColors.ControlDarkDark;
                btnAutodots.ForeColor = Color.White;

                if (ProgramCore.Project.AutodotsUsed)
                {
                    ProgramCore.MainForm.ctrlRenderControl.Mode = Mode.HeadAutodots;
                }
                else
                {
                    ProgramCore.MainForm.ctrlRenderControl.autodotsShapeHelper.TransformRects();
                    ProgramCore.MainForm.ctrlRenderControl.autodotsShapeHelper.InitializeShaping();
                    ProgramCore.MainForm.ctrlRenderControl.headMeshesController.InitializeTexturing(ProgramCore.MainForm.ctrlRenderControl.autodotsShapeHelper.GetBaseDots(), HeadController.GetIndices());

                    ProgramCore.MainForm.ctrlRenderControl.headMeshesController.TexturingInfo.UpdatePointsInfo(ProgramCore.MainForm.ctrlRenderControl.headMeshesController.RenderMesh.Scale,
                                                                                                               ProgramCore.MainForm.ctrlRenderControl.headMeshesController.RenderMesh.AABB.Center.Xy);
                    ProgramCore.MainForm.ctrlRenderControl.autodotsShapeHelper.Transform(ProgramCore.MainForm.ctrlRenderControl.headMeshesController.TexturingInfo.Points.ToArray());
                    ProgramCore.MainForm.ctrlRenderControl.headController.StartAutodots();

                    ProgramCore.MainForm.ctrlRenderControl.Mode = Mode.HeadAutodotsFirstTime;
                }
                ProgramCore.MainForm.ctrlTemplateImage.UpdateUserCenterPositions(false, true);

                btnFlipLeft.Visible  = true;
                btnFlipRight.Visible = true;
                UpdateFlipEnable(ProgramCore.Project.TextureFlip);
                SetPanelLogic();

                if (frontTab && UserConfig.ByName("Options")["Tutorials", "Autodots", "1"] == "1")
                {
                    ProgramCore.MainForm.frmTutAutodots.ShowDialog(this);
                }
            }
            else
            {
                btnAutodots.Tag = "2";

                btnAutodots.BackColor = SystemColors.Control;
                btnAutodots.ForeColor = Color.Black;

                if (!ProgramCore.Project.AutodotsUsed)
                {
                    for (var i = 0; i < ProgramCore.MainForm.ctrlRenderControl.headMeshesController.RenderMesh.Parts.Count; i++)
                    {
                        var part = ProgramCore.MainForm.ctrlRenderControl.headMeshesController.RenderMesh.Parts[i];
                        if (part.Texture == 0)
                        {
                            part.Texture     = ProgramCore.MainForm.ctrlRenderControl.HeadTextureId;
                            part.TextureName = ProgramCore.MainForm.ctrlRenderControl.GetTexturePath(part.Texture);
                        }
                    }

                    ProgramCore.Project.AutodotsUsed = true;
                    ProgramCore.MainForm.ctrlRenderControl.headController.EndAutodots();
                    ProgramCore.MainForm.ctrlRenderControl.ApplySmoothedTextures();
                }

                btnFlipLeft.Visible  = false;
                btnFlipRight.Visible = false;
                ProgramCore.MainForm.ctrlRenderControl.CalcReflectedBitmaps();
                ProgramCore.MainForm.ctrlTemplateImage.RectTransformMode = false;
                ProgramCore.MainForm.EnableRotating();
                ProgramCore.MainForm.ctrlRenderControl.Mode = Mode.None;
                SetPanelLogic();
                DisableFlip();
            }
            EndUpdate();
        }
Exemplo n.º 26
0
        private void btnAddNewMaterial_Click(object sender, EventArgs e)
        {
            string hairPath;
            string sampleImagePath;

            using (var ofd = new OpenFileDialogEx("Select new style..", "OBJ files|*.obj"))
            {
                ofd.Multiselect = false;
                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                hairPath = ofd.FileName;
            }
            using (var ofd = new OpenFileDialogEx("Select style image..", "Image files|*.jpg"))
            {
                ofd.Multiselect = false;
                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                sampleImagePath = ofd.FileName;
            }

            var directoryPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Libraries", "Style");
            var oldFileName   = Path.GetFileNameWithoutExtension(hairPath);
            var newFileName   = oldFileName;
            var filePath      = Path.Combine(directoryPath, newFileName + ".obj");

            if (hairPath != filePath)
            {
                File.Copy(hairPath, filePath, true);
            }

            var mtl        = oldFileName + ".mtl";
            var newMtlName = newFileName + ".mtl";

            if (mtl != newMtlName)
            {
                ObjLoader.CopyMtl(mtl, newMtlName, Path.GetDirectoryName(hairPath), "", directoryPath, ProgramCore.Project.TextureSize);
            }

            if (mtl != newMtlName)      // situation, when copy attribute and can change mtl filename. so, we need to rename link to this mtl in main obj file
            {
                string lines;
                using (var sd = new StreamReader(filePath, Encoding.Default))
                {
                    lines = sd.ReadToEnd();
                    lines = lines.Replace(mtl, newMtlName);
                }
                using (var sw = new StreamWriter(filePath, false, Encoding.Default))
                    sw.Write(lines);
            }

            var samplePath = Path.Combine(directoryPath, newFileName + ".jpg");

            if (sampleImagePath != samplePath)
            {
                File.Copy(sampleImagePath, samplePath, true);
            }
            UserConfig.ByName("Options")["Styles", samplePath] = "1";

            InitializeListView();
        }
Exemplo n.º 27
0
 private void cbShow_CheckedChanged(object sender, EventArgs e)
 {
     UserConfig.ByName("Options")["Tutorials", "3DPrinting"] = cbShow.Checked ? "0" : "1";
 }
Exemplo n.º 28
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var link = UserConfig.ByName("Tutorials")["Links", "3DPrinting", "https://youtu.be/A_MQCNI4E8U"];

            Process.Start(link);
        }
Exemplo n.º 29
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var link = UserConfig.ByName("Tutorials")["Links", "Child", "http://youtu.be/Olc7oeQUmWk"];

            Process.Start(link);
        }
Exemplo n.º 30
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var link = UserConfig.ByName("Tutorials")["Links", "Accessory", GetDefaultLink()];

            Process.Start(link);
        }