Allow for Changing Property Settings (Min/Max, Subtype, Default etc.)
Once properties are defined in blender's python API, the settings for them can't be changed, except for properties in classes that support IDProperties, which of course only ID classes do.
This means that once a property is defined, settings for it such as min/max, subtype, default etc can't be changed, which means that for things like custom nodes or panels with values that need to change their default value dynamically (not their current value, the value that gets set when the Reset to Default Value button is clicked), only the current value can be changed, and min/max values won't work properly either, unless there is a way to do it using the get/set functions. Also the subtype can't be changed.
So what I propose to fix this, is by allowing the settings to be functions, using the function's return value which can of course be changed. For example, this is how a dynamic default value could work:
default: bpy.props.FloatProperty()
value: bpy.props.FloatProperty(default = lambda self: self.default_value())
def default_value(self): return self.default
0 Comments