Hi @datamilch sadly, there is nothing built-in for your use case, if you have the same value for the format/min/max/step the best way would be to override SetFloat, and call the SetFloat from GeDialog with this value. If you have multiple possible values, you will need then to store this data somewhere, find an example bellow.
import c4d
class MyDialog(c4d.gui.GeDialog):
def __init__(self):
self.cachedData = {} #Key = GadgetId, Value = list[format, min, max, step]
self.cachedData["10005"] = [c4d.FORMAT_METER, 0, 10, 0.1]
self.cachedData["10006"] = [c4d.FORMAT_METER, 1, 3, 0.5]
def CreateLayout(self):
self.AddEditSlider(id=10005, flags=c4d.BFH_SCALEFIT, initw=0, inith=0)
self.AddEditSlider(id=10006, flags=c4d.BFH_SCALEFIT, initw=0, inith=0)
self.SetFloat(10005, 1)
self.SetFloat(10006, 2)
return True
def SetFloat(self, gadgetId, value, floatFormat=c4d.FORMAT_METER, minValue=0, maxValue=10, step=0.1):
# Check if we have some cached data, if not then use what was passed as argument.
# The other way can also be done here it's just an example
if str(gadgetId) in self.cachedData:
floatFormat = self.cachedData[str(gadgetId)][0]
minValue = self.cachedData[str(gadgetId)][1]
maxValue = self.cachedData[str(gadgetId)][2]
step = self.cachedData[str(gadgetId)][3]
return super(MyDialog, self).SetFloat(id=gadgetId, format=floatFormat, min=minValue, max=maxValue, step=step, value=value)
# Main function
def main():
diag = MyDialog()
diag.Open(dlgtype=c4d.DLG_TYPE_MODAL_RESIZEABLE, defaultw=960, defaulth=600)
# Execute main()
if __name__ == '__main__':
main()
Cheers,
Maxime.