/// <summary> /// /// </summary> /// <param name="material"></param> private void SetMaterial(ISBMaterial material) { ClearMaterial(); CurrentMaterial = material; //applyToMesh.Enabled = true; materialLabel.Bind(material, "Label"); materialName.Bind(material, "Name"); foreach (var prop in material.GetType().GetProperties()) { CreateControl(prop, material); } }
/// <summary> /// Creates a specified control based on the SBMatAttrb in the Material File /// </summary> /// <param name="property"></param> /// <param name="Object"></param> /// <returns></returns> private Control CreateControl(PropertyInfo property, object Object) { if (property.PropertyType == typeof(SBMatAttrib <Vector4>)) { SBMatAttrib <Vector4> matinfo = (SBMatAttrib <Vector4>)property.GetValue(Object); GenericBindingVector4Editor editor = new GenericBindingVector4Editor(matinfo.Name, matinfo.IsColor); editor.Dock = DockStyle.Top; editor.Bind(matinfo, "Value"); toolTips.SetToolTip(editor.Controls[0], matinfo.Description); vectorSection.Contents.Add(editor); } if (property.PropertyType == typeof(SBMatAttrib <bool>)) { SBMatAttrib <bool> matinfo = (SBMatAttrib <bool>)property.GetValue(Object); GenericBindingCheckBox editor = new GenericBindingCheckBox(matinfo.Name); editor.Dock = DockStyle.Top; editor.Bind(matinfo, "Value"); toolTips.SetToolTip(editor, matinfo.Description); boolSection.Contents.Add(editor); } if (property.PropertyType == typeof(SBMatAttrib <float>)) { SBMatAttrib <float> matinfo = (SBMatAttrib <float>)property.GetValue(Object); GenericBindingTextBox <float> editor = new GenericBindingTextBox <float>(); editor.Bind(matinfo, "Value"); SBHBox hungrybox = new SBHBox(); hungrybox.AddControl(new Label() { Text = matinfo.Name }); hungrybox.AddControl(editor); hungrybox.Dock = DockStyle.Top; toolTips.SetToolTip(hungrybox, matinfo.Description); floatSection.Contents.Add(hungrybox); } return(null); }