Blender Git Loki

Git Commits -> Revision a80c1e5

Revision a80c1e5 by Bastien Montagne (master)
May 25, 2015, 12:24 (GMT)
Fix T44822: python enums' itemf callback did not handle 'NULL' context case.

Enum's itemf callback can be called without context in some cases (UI, doc generation...).
Python's enum properties did not handle this at all - it's kind of odd this did not cause
more trouble and wasn't notice earlier... Probably dynamic enums using context are not
much used in py code.

Note about nodes: those are heavy users of dynamic enum with context. Now,
we expect `NodeCategory.poll()` and `NodeItem.poll()` to always be called with
a valid context (since when there is no context available, we can assume `poll()`
is always True). `NodeCategory.items()`, however, must accept NULL context, so if
you use custom `items` callable for your custom node categories, you may need
to update it (as was done here for builtin `node_group_items()`).

Commit Details:

Full Hash: a80c1e50bc7f57bc4d4c41bc51ac92d1d4c39030
Parent Commit: 39b85e4
Lines Changed: +30, -9

4 Modified Paths:

/release/scripts/modules/nodeitems_utils.py (+2, -2) (Diff)
/release/scripts/startup/nodeitems_builtins.py (+2, -0) (Diff)
/release/scripts/templates_py/ui_previews_dynamic_enum.py (+5, -2) (Diff)
/source/blender/python/intern/bpy_props.c (+21, -5) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021