diff options
author | Hans Goudey <h.goudey@me.com> | 2021-06-19 00:33:02 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-06-19 00:33:02 +0300 |
commit | f9aea19d98908be450f228a35bb6098e7e3e4b03 (patch) | |
tree | 87e91bc56f4235a86bcd44706b0f76064131e3df /release/scripts/startup/bl_ui/space_spreadsheet.py | |
parent | d52b7dbe2695c673b3bad091b55893413e7b022b (diff) |
Spreadsheet Editor: Row Filters
This patch adds support for filtering rows based on rules and values.
Filters will work for any attribute data source, they are a property
of the spreadsheet rather than of the attribute system. The properties
displayed in the row filter can depend on data type of the currently
visible column with that name. If the name is no longer visible, the
row filter filter is grayed out, but it will remember the value until
a column with its name is visible again.
Note: The comments in `screen.c` combined with tagging the sidebar
for redraw after the main region point to a lack of understanding
or technical debt, that is a point to improve in the future.
**Future Improvements**
* T89272: A search menu for visible columns when adding a new filter.
* T89273: Possibly a "Range" operation.
Differential Revision: https://developer.blender.org/D10959
Diffstat (limited to 'release/scripts/startup/bl_ui/space_spreadsheet.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_spreadsheet.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/space_spreadsheet.py b/release/scripts/startup/bl_ui/space_spreadsheet.py index 13e435a7350..360849a0c7a 100644 --- a/release/scripts/startup/bl_ui/space_spreadsheet.py +++ b/release/scripts/startup/bl_ui/space_spreadsheet.py @@ -59,9 +59,12 @@ class SPREADSHEET_HT_header(bpy.types.Header): layout.operator("spreadsheet.toggle_pin", text="", icon=pin_icon, emboss=False) layout.separator_spacer() - - if isinstance(obj, bpy.types.Object) and obj.mode == 'EDIT': - layout.prop(space, "show_only_selected", text="Selected Only") + + row = layout.row(align=True) + sub = row.row(align=True) + sub.active = self.selection_filter_available(space) + sub.prop(space, "show_only_selected", text="") + row.prop(space, "use_filter", toggle=True, icon='FILTER', icon_only=True) def draw_without_context_path(self, layout): layout.label(text="No active context") @@ -102,6 +105,17 @@ class SPREADSHEET_HT_header(bpy.types.Header): def draw_spreadsheet_context_path_icon(self, layout, space, icon='RIGHTARROW_THIN'): layout.prop(space, "display_context_path_collapsed", icon_only=True, emboss=False, icon=icon) + def selection_filter_available(self, space): + root_context = space.context_path[0] + if root_context.type != 'OBJECT': + return False + obj = root_context.object + if obj is None: + return False + if obj.type != 'MESH' or obj.mode != 'EDIT': + return False + return True + classes = ( SPREADSHEET_HT_header, ) |