Handling units in addons defaults
Current situation
Default values for python properties simply ignore units settings.
What’s the point ?
Creating real-wold asset like landscape / nuts and bolts require to handle real units in defaults.
Imagine a landscape having default set say to 1000 (units) where the dev expect unit setup to be meters while user hope km result in a landscape of 1000 km.
Proposed solution
Defer responsability to addon devs by using an optional “preprocess_default” method on bpy.Properties.
Implementation detail
preprocess_default signature:
preprocess_default(rna_property_definition or self, value)
Must be called to transform default value before applying any bounds checks as currently done in regular default handler.
So addon devs may properly handle units setup and return the value to actual default handler.
0 Comments