VisualElement CreateAlbedoContent() { var root = new VisualElement() { name = "Albedo and Metals" }; var validateTrueMetals = new Toggle("Check Pure Metals"); validateTrueMetals.SetValueWithoutNotify(sceneView.validateTrueMetals); validateTrueMetals.RegisterValueChangedCallback(ValidateTrueMetalsChanged); validateTrueMetals.tooltip = "Check if albedo is black for materials with an average specular color above 0.45"; root.Add(validateTrueMetals); var albedoSpecificContent = new VisualElement() { name = "Albedo" }; if (PlayerSettings.colorSpace == ColorSpace.Gamma) { albedoSpecificContent.Add(new HelpBox("Albedo Validation doesn't work when Color Space is set to gamma space", HelpBoxMessageType.Warning)); } m_SelectedAlbedoSwatch = m_AlbedoSwatchInfos[0]; m_SelectedAlbedoPopup = new PopupField <AlbedoSwatchInfo>("Luminance Validation", m_AlbedoSwatchInfos, m_SelectedAlbedoSwatch); m_SelectedAlbedoPopup.tooltip = "Select default luminance validation or validate against a configured albedo swatch"; m_SelectedAlbedoPopup.formatListItemCallback = swatch => swatch.name; m_SelectedAlbedoPopup.formatSelectedValueCallback = swatch => swatch.name; m_SelectedAlbedoPopup.RegisterValueChangedCallback(SetSelectedAlbedoSwatch); albedoSpecificContent.Add(m_SelectedAlbedoPopup); albedoSpecificContent.Add(m_AlbedoContent = CreateColorSwatch("magenta", Color.magenta)); var hue = EditorGUIUtility.TrTextContent("Hue Tolerance:", "Check that the hue of the albedo value of a " + "material is within the tolerance of the hue of the albedo swatch being validated against"); var sat = EditorGUIUtility.TrTextContent("Saturation Tolerance:", "Check that the saturation of the albedo " + "value of a material is within the tolerance of the saturation of the albedo swatch being validated against"); m_AlbedoHueTolerance = CreateSliderWithField(hue, m_AlbedoSwatchHueTolerance, k_AlbedoHueToleranceMin, k_AlbedoHueToleranceMax, SetAlbedoHueTolerance); albedoSpecificContent.Add(m_AlbedoHueTolerance); m_AlbedoSaturationTolerance = CreateSliderWithField(sat, m_AlbedoSwatchSaturationTolerance, k_AlbedoHueToleranceMin, k_AlbedoHueToleranceMax, SetSaturationTolerance); albedoSpecificContent.Add(m_AlbedoSaturationTolerance); root.Add(albedoSpecificContent); root.Add(CreateColorLegend()); return(root); }
void SetSelectedAlbedoSwatch(ChangeEvent <AlbedoSwatchInfo> evt) { m_SelectedAlbedoSwatch = evt.newValue; SelectedAlbedoSwatchChanged(); }