Exemplo n.º 1
0
        private void SetParamLabelsAndToolTips(Params.MatParam matParam)
        {
            if (matParam != null)
            {
                toolTip1.SetToolTip(propertyNameLabel, matParam.generalDescription);
                toolTip1.SetToolTip(param1Label, matParam.param1Description);
                toolTip1.SetToolTip(param2Label, matParam.param2Description);
                toolTip1.SetToolTip(param3Label, matParam.param3Description);
                toolTip1.SetToolTip(param4Label, matParam.param4Description);

                param1Label.Text = matParam.paramLabels[0].Equals("") ? "Param1" : matParam.paramLabels[0];
                param2Label.Text = matParam.paramLabels[1].Equals("") ? "Param2" : matParam.paramLabels[1];
                param3Label.Text = matParam.paramLabels[2].Equals("") ? "Param3" : matParam.paramLabels[2];
                param4Label.Text = matParam.paramLabels[3].Equals("") ? "Param4" : matParam.paramLabels[3];

                // Not all material properties need a trackbar (Ex: NU_materialHash).
                param1TrackBar.Enabled = matParam.useTrackBar;
                param2TrackBar.Enabled = matParam.useTrackBar;
                param3TrackBar.Enabled = matParam.useTrackBar;
                param4TrackBar.Enabled = matParam.useTrackBar;
            }
            else
            {
                param1Label.Text = "Param1";
                param2Label.Text = "Param2";
                param3Label.Text = "Param3";
                param4Label.Text = "Param4";
            }
        }
Exemplo n.º 2
0
        private void param4TrackBar_Scroll(object sender, EventArgs e)
        {
            Params.MatParam labels = null;
            materialParamList.TryGetValue(currentPropertyName, out labels);

            if (labels != null)
            {
                enableParam4SliderUpdates = false;
                param4TB.Text             = GuiTools.GetTrackBarValue(param4TrackBar, 0, labels.max4).ToString();
            }
        }
Exemplo n.º 3
0
        private static float GetMatParamMax(string propertyName)
        {
            Params.MatParam labels = null;
            materialParamList.TryGetValue(propertyName, out labels);
            if (labels != null)
            {
                return(labels.max1);
            }

            return(1);
        }
Exemplo n.º 4
0
        // property change
        private void matPropertyTB_TextChanged(object sender, EventArgs e)
        {
            Params.MatParam matParam = null;

            // Try and find the name of the property that is selected in the listview.
            string propertyName = "";

            if (propertiesListView.SelectedIndices.Count > 0)
            {
                propertyName = currentMaterialList[currentMatIndex].entries.Keys.ElementAt(propertiesListView.SelectedIndices[0]);
            }

            materialParamList.TryGetValue(propertyName, out matParam);

            tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(2, 0));
            tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(2, 1));
            tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(2, 2));
            tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(2, 3));
        }
        public static Dictionary <string, MatParam> GetMatParamsFromFile()
        {
            Dictionary <string, MatParam> propList = new Dictionary <string, MatParam>();

            if (File.Exists("param_labels\\material_params.ini"))
            {
                try
                {
                    MatParam matParam = new MatParam();
                    using (StreamReader sr = new StreamReader("param_labels\\material_params.ini"))
                    {
                        while (!sr.EndOfStream)
                        {
                            string[] args = sr.ReadLine().Split('=');
                            string   line = args[0];
                            switch (line)
                            {
                            case "[Param]":
                                if (!matParam.name.Equals("") && !propList.ContainsKey(matParam.name))
                                {
                                    propList.Add(matParam.name, matParam);
                                }
                                matParam = new MatParam();
                                break;

                            case "name":
                                matParam.name = args[1]; Console.WriteLine(matParam.name);
                                break;

                            case "description":
                                matParam.generalDescription = args[1];
                                break;

                            case "descriptionX":
                                matParam.param1Description = args[1];
                                break;

                            case "descriptionY":
                                matParam.param2Description = args[1];
                                break;

                            case "descriptionZ":
                                matParam.param3Description = args[1];
                                break;

                            case "descriptionW":
                                matParam.param4Description = args[1];
                                break;

                            case "param1":
                                matParam.paramLabels[0] = args[1];
                                break;

                            case "param2":
                                matParam.paramLabels[1] = args[1];
                                break;

                            case "param3":
                                matParam.paramLabels[2] = args[1];
                                break;

                            case "param4":
                                matParam.paramLabels[3] = args[1];
                                break;

                            case "max1":
                                float.TryParse(args[1], out matParam.maxValues[0]);
                                break;

                            case "max2":
                                float.TryParse(args[1], out matParam.maxValues[1]); break;

                            case "max3":
                                float.TryParse(args[1], out matParam.maxValues[2]);
                                break;

                            case "max4": float.TryParse(args[1],
                                                        out matParam.maxValues[3]);
                                break;

                            case "useTrackBar":
                                bool.TryParse(args[1], out matParam.useTrackBar);
                                break;
                            }
                        }
                    }
                    if (!matParam.name.Equals("") && !propList.ContainsKey(matParam.name))
                    {
                        propList.Add(matParam.name, matParam);
                    }
                }
                catch (Exception)
                {
                    // Who knows what actually went wrong. Pros don't need labels anyway...
                }
            }

            return(propList);
        }