2

I am writing an add-on. There are UI elements using FloatProperty. Some of them should have minimum, maximum and default values in absolute terms. This requires the knowledge of the user's scale_length.

These values have to be defined when the add-on is registered. The register() method does not receive a context. bpy.context and bpy.data.scenes are not available yet at this point.

Is there a way to access the user's scale_length?

bogl
  • 181
  • 5
  • 2
    I think one good approach is adding a checkbox to the panel header and when checked/updated call a function to set or init the limits based on another property. Another approach is using a handler per file load, which always feels a bit crappy. – brockmann Apr 06 '20 at 18:37
  • @brockmann Thanks, that looks awesome! But then I run into the problem of re-registering the FloatProperty. This was discussed here: https://blender.stackexchange.com/q/18686/66651 . I managed to re-register in the console, still struggle to put it in the source properly. But even if I manage that, can I expect stable behaviour? – bogl Apr 07 '20 at 10:46
  • Pedestrian solution would be to check the limits in the update functions. – bogl Apr 07 '20 at 10:47

0 Answers0