Jump to content

John8

Newbies
  • Posts

    2
  • Joined

  • Last visited

Everything posted by John8

  1. Is there a way without IndirectUI ?
  2. Hello, I was wondering how to update controls in a plugin. The use case is to estimate some parameters and then let the user choose to adjust the values himself. I my case, I have properties like that : protected override PropertyCollection OnCreatePropertyCollection() { var propertyList = new List<Property> { StaticListChoiceProperty.CreateForEnum(PropertyNames.WhiteBalanceMethod, WhiteBalanceMethod.None, false), new DoubleProperty(PropertyNames.RedGain, 1.0, 0.0, 2.0), new DoubleProperty(PropertyNames.GreenGain, 1.0, 0.0, 2.0), new DoubleProperty(PropertyNames.BlueGain, 1.0, 0.0, 2.0) }; return new PropertyCollection(propertyList); } For those properties I set up the controles like that : protected override ControlInfo OnCreateConfigUI(PropertyCollection props) { var defaultConfigUi = CreateDefaultConfigUI(props); defaultConfigUi.SetPropertyControlValue(PropertyNames.RedGain, ControlInfoPropertyNames.DisplayName, "Red Gain"); defaultConfigUi.SetPropertyControlValue(PropertyNames.GreenGain, ControlInfoPropertyNames.DisplayName, "Green Gain"); defaultConfigUi.SetPropertyControlValue(PropertyNames.BlueGain, ControlInfoPropertyNames.DisplayName, "Blue Gain"); defaultConfigUi.SetPropertyControlValue(PropertyNames.WhiteBalanceMethod, ControlInfoPropertyNames.DisplayName, "White Balance Method"); var controlForPropertyName = defaultConfigUi.FindControlForPropertyName(PropertyNames.WhiteBalanceMethod); controlForPropertyName.SetValueDisplayName(WhiteBalanceMethod.None, "None"); controlForPropertyName.SetValueDisplayName(WhiteBalanceMethod.GrayWorld, "GrayWorld"); controlForPropertyName.SetValueDisplayName(WhiteBalanceMethod.Retinex, "Retinex"); controlForPropertyName.SetValueDisplayName(WhiteBalanceMethod.YCbCr, "YCbCr"); return defaultConfigUi; } Then, at some point, I update the properties' values with SetPropertyValue like that : private void UpdateProperties(PropertyBasedEffectConfigToken newToken, WhiteBalanceMethod whiteBalanceMethod) { var whiteBalanceFunction = GetWhiteBalanceFunction(whiteBalanceMethod); if (whiteBalanceFunction == null) return; var (redGain, greenGain, blueGain) = whiteBalanceFunction(SrcArgs.Surface); (redGain, greenGain, blueGain) = Normalize(redGain, greenGain, blueGain); newToken.SetPropertyValue(PropertyNames.RedGain, redGain); newToken.SetPropertyValue(PropertyNames.GreenGain, greenGain); newToken.SetPropertyValue(PropertyNames.BlueGain, blueGain); // XXX : How to update controls with new values ? } Updating the property values works, and I can read back the values with GetProperty. However it does not update the controls in the UI and the sliders remain to the value that was already set. How can I update the controls' value to display their properties' value ? Thanks in advance.
×
×
  • Create New...