diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-21 16:07:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-21 16:07:06 +0300 |
commit | dd1132416e5bcbad5d4f80631b1a9f3152a514ee (patch) | |
tree | c3ccf1d18376d42a818dc22c962bcdefc370f0f4 /doc/python_api/examples/bpy.types.UIList.2.py | |
parent | bd1299f6a4398e06db00d77f9ea7382f9e7bcf53 (diff) |
Docs: update examples for 2.8x
Use fields for properties
Diffstat (limited to 'doc/python_api/examples/bpy.types.UIList.2.py')
-rw-r--r-- | doc/python_api/examples/bpy.types.UIList.2.py | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/doc/python_api/examples/bpy.types.UIList.2.py b/doc/python_api/examples/bpy.types.UIList.2.py index 81bbec11d9a..582e89af75a 100644 --- a/doc/python_api/examples/bpy.types.UIList.2.py +++ b/doc/python_api/examples/bpy.types.UIList.2.py @@ -15,12 +15,24 @@ class MESH_UL_vgroups_slow(bpy.types.UIList): VGROUP_EMPTY = 1 << 0 # Custom properties, saved with .blend file. - use_filter_empty = bpy.props.BoolProperty(name="Filter Empty", default=False, options=set(), - description="Whether to filter empty vertex groups") - use_filter_empty_reverse = bpy.props.BoolProperty(name="Reverse Empty", default=False, options=set(), - description="Reverse empty filtering") - use_filter_name_reverse = bpy.props.BoolProperty(name="Reverse Name", default=False, options=set(), - description="Reverse name filtering") + use_filter_empty: bpy.props.BoolProperty( + name="Filter Empty", + default=False, + options=set(), + description="Whether to filter empty vertex groups", + ) + use_filter_empty_reverse: bpy.props.BoolProperty( + name="Reverse Empty", + default=False, + options=set(), + description="Reverse empty filtering", + ) + use_filter_name_reverse: bpy.props.BoolProperty( + name="Reverse Name", + default=False, + options=set(), + description="Reverse name filtering", + ) # This allows us to have mutually exclusive options, which are also all disable-able! def _gen_order_update(name1, name2): @@ -28,12 +40,18 @@ class MESH_UL_vgroups_slow(bpy.types.UIList): if (getattr(self, name1)): setattr(self, name2, False) return _u - use_order_name = bpy.props.BoolProperty(name="Name", default=False, options=set(), - description="Sort groups by their name (case-insensitive)", - update=_gen_order_update("use_order_name", "use_order_importance")) - use_order_importance = bpy.props.BoolProperty(name="Importance", default=False, options=set(), - description="Sort groups by their average weight in the mesh", - update=_gen_order_update("use_order_importance", "use_order_name")) + use_order_name: bpy.props.BoolProperty( + name="Name", default=False, options=set(), + description="Sort groups by their name (case-insensitive)", + update=_gen_order_update("use_order_name", "use_order_importance"), + ) + use_order_importance: bpy.props.BoolProperty( + name="Importance", + default=False, + options=set(), + description="Sort groups by their average weight in the mesh", + update=_gen_order_update("use_order_importance", "use_order_name"), + ) # Usual draw item function. def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag): |