Blender Git Commit Log

Git Commits -> Revision 8b9a3b9

Revision 8b9a3b9 by Hans Goudey (master)
August 27, 2021, 13:27 (GMT)
Refactor IDProperty UI data storage

The storage of IDProperty UI data (min, max, default value, etc) is
quite complicated. For every property, retrieving a single one of these
values involves three string lookups. First for the "_RNA_UI" group
property, then another for a group with the property's name, then for
the data value name. Not only is this inefficient, it's hard to reason
about, unintuitive, and not at all self-explanatory.

This commit replaces that system with a UI data struct directly in the
IDProperty. If it's not used, the only cost is of a NULL pointer. Beyond
storing the description, name, and RNA subtype, derived structs are used
to store type specific UI data like min and max.

Note that this means that addons using (abusing) the `_RNA_UI` custom
property will have to be changed. A few places in the addons repository
will be changed after this commit with D9919.

**Before**
Before, first the _RNA_UI subgroup is retrieved the _RNA_UI group,
then the subgroup for the original property, then specific UI data
is accessed like any other IDProperty.
```
prop = rna_idprop_ui_prop_get(idproperties_owner, "prop_name", create=True)
prop["min"] = 1.0
```

**After**
After, the `id_properties_ui` function for RNA structs returns a python
object specifically for managing an IDProperty's UI data.
```
ui_data = idproperties_owner.id_properties_ui("prop_name")
ui_data.update(min=1.0)
```
In addition to `update`, there are now other functions:
- `as_dict`: Returns a dictionary of the property's UI data.
- `clear`: Removes the property's UI data.
- `update_from`: Copy UI data between properties,
even if they have different owners.

Differential Revision: https://developer.blender.org/D9697

Commit Details:

Full Hash: 8b9a3b94fc148d197b137aa892855c60db2783e6
Parent Commit: 3f5e0f7
Lines Changed: +1925, -799

2 Added Paths:

/source/blender/python/generic/idprop_py_ui_api.c (+734, -0) (View)
/source/blender/python/generic/idprop_py_ui_api.h (+33, -0) (View)

18 Modified Paths:

/release/scripts/modules/rna_prop_ui.py (+18, -100) (Diff)
/release/scripts/startup/bl_operators/object.py (+1, -1) (Diff)
/release/scripts/startup/bl_operators/wm.py (+40, -43) (Diff)
/release/scripts/startup/keyingsets_builtins.py (+0, -4) (Diff)
/source/blender/blenkernel/BKE_idprop.h (+27, -0) (Diff)
/source/blender/blenkernel/intern/idprop.c (+336, -0) (Diff)
/source/blender/blenloader/intern/versioning_300.c (+241, -0) (Diff)
/source/blender/io/alembic/exporter/abc_custom_props.cc (+0, -3) (Diff)
/source/blender/makesdna/DNA_ID.h (+54, -0) (Diff)
/source/blender/makesrna/intern/rna_access.c (+146, -297) (Diff)
/source/blender/makesrna/intern/rna_internal_types.h (+0, -3) (Diff)
/source/blender/makesrna/RNA_access.h (+3, -3) (Diff)
/source/blender/modifiers/intern/MOD_nodes.cc (+172, -345) (Diff)
/source/blender/python/generic/CMakeLists.txt (+3, -0) (Diff)
/source/blender/python/generic/idprop_py_api.c (+2, -0) (Diff)
/source/blender/python/intern/bpy.c (+2, -0) (Diff)
/source/blender/python/intern/bpy_rna.c (+50, -0) (Diff)
/tests/python/bl_pyapi_idprop.py (+63, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021