Example #1
0
 private void addLibrary_Click(object sender, EventArgs e)
 {
     if (MTLBrowser.ShowDialog() == DialogResult.OK)
     {
         foreach (string file in MTLBrowser.FileNames)
         {
             MTLListBox.Items.Add(file);
         }
     }
     UpdateINIKey();
 }
        private void Button_MergeMTL_Click(object sender, EventArgs e)
        {
            if (!Panel_Main.Visible)
            {
                return;
            }

            // Version will be replaced when loaded
            MaterialLibrary matLib = new MaterialLibrary(VersionsEnumerator.V_57);

            if (MTLBrowser.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    matLib.ReadMatFile(MTLBrowser.FileName);
                }
                catch
                {
                    MessageBox.Show("Failed to load the selected .MTL!");
                }
            }
            else
            {
                return;
            }

            if (matLib.Materials.Count == 0)
            {
                MessageBox.Show("Failed to load the selected .MTL!");
                return;
            }

            MergePanel.Visible = true;
            Panel_Main.Visible = false;
            OverwriteListBox.Items.Clear();
            NewMatListBox.Items.Clear();

            for (int i = 0; i < matLib.Materials.Count; i++)
            {
                var mat = matLib.Materials.ElementAt(i).Value;
                if (mtl.Materials.ContainsKey(mat.GetMaterialHash()))
                {
                    OverwriteListBox.Items.Add(mat);
                }
                else
                {
                    NewMatListBox.Items.Add(mat);
                }
            }

            FileIsEdited();
        }
Example #3
0
        private void MergeMTLButton_Click(object sender, EventArgs e)
        {
            if (!MainPanel.Visible)
            {
                return;
            }

            MaterialLibrary matLib = new MaterialLibrary();

            if (MTLBrowser.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    matLib.ReadMatFile(MTLBrowser.FileName);
                }
                catch
                {
                    MessageBox.Show("Failed to load the selected .MTL!");
                }
            }

            if (matLib.Materials.Count == 0)
            {
                MessageBox.Show("Failed to load the selected .MTL!");
                return;
            }

            MergePanel.Visible = true;
            MainPanel.Visible  = false;
            OverwriteListBox.Items.Clear();
            NewMatListBox.Items.Clear();

            for (int i = 0; i < matLib.Materials.Count; i++)
            {
                var mat = matLib.Materials.ElementAt(i).Value;
                if (mtl.Materials.ContainsKey(mat.MaterialHash))
                {
                    OverwriteListBox.Items.Add(mat);
                }
                else
                {
                    NewMatListBox.Items.Add(mat);
                }
            }
        }