Widget Horizontal Slider Bug

@Jarrett - Caught this misbehavior the other day when helping a user who is using widgets for their UI.

Looks like the slider+field widgets don’t respect the user’s decimal place setting when interacting with the panel:

This works correctly when using the custom pars, just not when interacting with the panel itself. Doing a little spelunking, I was able to help the user fix this issue with one line in the slider SliderExt:

def valueChangeSlider(self, pVal, valueIndex):
    """
    Changes value not using the knob.  This generates a value change only
    if the slider area with no knob is selected.
    """
    #print(pVal)
    if valueIndex is not None:
        valueIndex = valueIndex+self.valueGroupIndex
    else:
        valueIndex = self.valueGroupIndex
    value = remap(pVal, self.normSliderMin, self.normSliderMax, 0, 1)
    #value = max(0, min(value, 1))
    value = self.Values[valueIndex].valueClampFunc(value)

    ####### THIS IS MY ADDED LINE #######
    value = round(value, parent.Widget.par.Numericfielddecimalplaces.eval())
    #####################################

    #debug('slider', value)

    self.setValue(value, valueIndex)

This could also be user error on my part, but for the life of me this was the only way I could get parity between the panel and custom par interaction.

1 Like

I think this can also be fixed by navigating to slider/numericValue0/field and toggling on Enable Field Format Numbers on the Field tab.

1 Like

That’s another great one @markwheeler - good find!

Sorry for delayed response…

Ah yes. This discrepancy was a result in the Field COMP trashing decimal places - we opened it up instead but yes probably just as annoying the other way around. Ideally we keep the data and just display the rounded value. We have some major changes to address this longer term. Your change works well enough for me. You will loose the values but I think this is cleaner solution for now. Thanks for the help Matt! Will be in the next release.

1 Like

Yes but if you change a value inside the slider your change will be wiped out when you update. This was the parameter we deactivated cause it was trashing decimal places we wanted but just didnt want to see. A bit of a conundrum. (We have a cool new feature coming that addressed this issue properly )…

1 Like