[Bf-blender-cvs] [f3b85c2e6c0] temp-spreadsheet-row-filter: Address small review comments from Jacques

Hans Goudey noreply at git.blender.org
Wed Apr 14 04:44:22 CEST 2021


Commit: f3b85c2e6c0eb891be18d374fd302af0558a8231
Author: Hans Goudey
Date:   Tue Apr 13 12:00:06 2021 -0500
Branches: temp-spreadsheet-row-filter
https://developer.blender.org/rBf3b85c2e6c0eb891be18d374fd302af0558a8231

Address small review comments from Jacques

===================================================================

M	release/scripts/startup/bl_ui/space_spreadsheet.py
M	source/blender/editors/space_spreadsheet/space_spreadsheet.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh
M	source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_ops.cc
M	source/blender/makesdna/DNA_space_types.h

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_spreadsheet.py b/release/scripts/startup/bl_ui/space_spreadsheet.py
index 94b5ca2d41a..29bcc0a2a57 100644
--- a/release/scripts/startup/bl_ui/space_spreadsheet.py
+++ b/release/scripts/startup/bl_ui/space_spreadsheet.py
@@ -28,7 +28,7 @@ def get_operation_string(operation):
     if operation == 'EQUAL':
         return "=="
     elif operation == 'GREATER':
-        return  ">"
+        return ">"
     elif operation == 'LESS':
         return "<"
     return ""
diff --git a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
index 7d3ddc1e365..0685b11f8f5 100644
--- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
+++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
@@ -269,7 +269,7 @@ static void spreadsheet_main_region_draw(const bContext *C, ARegion *region)
   const int tot_rows = data_source->tot_rows();
   spreadsheet_layout.index_column_width = get_index_column_width(tot_rows);
   spreadsheet_layout.row_indices = spreadsheet_filter_rows(
-      *sspreadsheet, spreadsheet_layout, *data_source.get(), scope);
+      *sspreadsheet, spreadsheet_layout, *data_source, scope);
 
   sspreadsheet->runtime->tot_columns = spreadsheet_layout.columns.size();
   sspreadsheet->runtime->tot_rows = tot_rows;
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh b/source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh
index 6e9dfcad81e..722033884f5 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh
@@ -30,12 +30,12 @@ namespace blender::ed::spreadsheet {
  */
 class ColumnValues {
  protected:
-  SpreadSheetColumnValueType type_;
+  SpreadsheetColumnValueType type_;
   std::string name_;
   int size_;
 
  public:
-  ColumnValues(const SpreadSheetColumnValueType type, std::string name, const int size)
+  ColumnValues(const SpreadsheetColumnValueType type, std::string name, const int size)
       : type_(type), name_(std::move(name)), size_(size)
   {
   }
@@ -44,7 +44,7 @@ class ColumnValues {
 
   virtual void get_value(int index, CellValue &r_cell_value) const = 0;
 
-  SpreadSheetColumnValueType type() const
+  SpreadsheetColumnValueType type() const
   {
     return type_;
   }
@@ -69,7 +69,7 @@ template<typename GetValueF> class LambdaColumnValues : public ColumnValues {
   GetValueF get_value_;
 
  public:
-  LambdaColumnValues(const SpreadSheetColumnValueType type,
+  LambdaColumnValues(const SpreadsheetColumnValueType type,
                      std::string name,
                      int size,
                      GetValueF get_value)
@@ -85,7 +85,7 @@ template<typename GetValueF> class LambdaColumnValues : public ColumnValues {
 
 /* Utility function that simplifies creating a spreadsheet column from a lambda function. */
 template<typename GetValueF>
-std::unique_ptr<ColumnValues> column_values_from_function(const SpreadSheetColumnValueType type,
+std::unique_ptr<ColumnValues> column_values_from_function(const SpreadsheetColumnValueType type,
                                                           std::string name,
                                                           int size,
                                                           GetValueF get_value)
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
index 84e3350f8e9..be440c969e9 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
@@ -176,7 +176,7 @@ using IsVertexSelectedFn = FunctionRef<bool(int vertex_index)>;
 
 static void get_selected_vertex_indices(const Mesh &mesh,
                                         const IsVertexSelectedFn is_vertex_selected_fn,
-                                        MutableSpan<bool> &selection)
+                                        MutableSpan<bool> selection)
 {
   for (const int i : IndexRange(mesh.totvert)) {
     if (!selection[i]) {
@@ -190,7 +190,7 @@ static void get_selected_vertex_indices(const Mesh &mesh,
 
 static void get_selected_corner_indices(const Mesh &mesh,
                                         const IsVertexSelectedFn is_vertex_selected_fn,
-                                        MutableSpan<bool> &selection)
+                                        MutableSpan<bool> selection)
 {
   for (const int i : IndexRange(mesh.totloop)) {
     const MLoop &loop = mesh.mloop[i];
@@ -205,7 +205,7 @@ static void get_selected_corner_indices(const Mesh &mesh,
 
 static void get_selected_face_indices(const Mesh &mesh,
                                       const IsVertexSelectedFn is_vertex_selected_fn,
-                                      MutableSpan<bool> &selection)
+                                      MutableSpan<bool> selection)
 {
   for (const int poly_index : IndexRange(mesh.totpoly)) {
     if (!selection[poly_index]) {
@@ -224,7 +224,7 @@ static void get_selected_face_indices(const Mesh &mesh,
 
 static void get_selected_edge_indices(const Mesh &mesh,
                                       const IsVertexSelectedFn is_vertex_selected_fn,
-                                      MutableSpan<bool> &selection)
+                                      MutableSpan<bool> selection)
 {
   for (const int i : IndexRange(mesh.totedge)) {
     if (!selection[i]) {
@@ -240,7 +240,7 @@ static void get_selected_edge_indices(const Mesh &mesh,
 static void get_selected_indices_on_domain(const Mesh &mesh,
                                            const AttributeDomain domain,
                                            const IsVertexSelectedFn is_vertex_selected_fn,
-                                           MutableSpan<bool> &selection)
+                                           MutableSpan<bool> selection)
 {
   switch (domain) {
     case ATTR_DOMAIN_POINT:
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc b/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc
index 3c46fb30b5e..4f6fd60c847 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc
@@ -37,7 +37,7 @@ static int row_filter_add_exec(bContext *C, wmOperator *UNUSED(op))
   SpreadsheetRowFilter *row_filter = (SpreadsheetRowFilter *)MEM_callocN(
       sizeof(SpreadsheetRowFilter), __func__);
   row_filter->threshold = 0.01f;
-
+  row_filter->operation = SPREADSHEET_ROW_FILTER_LESS;
   row_filter->flag = (SPREADSHEET_ROW_FILTER_UI_EXPAND | SPREADSHEET_ROW_FILTER_ENABLED);
 
   BLI_addtail(&sspreadsheet->row_filters, row_filter);
@@ -63,10 +63,8 @@ static int row_filter_remove_exec(bContext *C, wmOperator *op)
 {
   SpaceSpreadsheet *sspreadsheet = CTX_wm_space_spreadsheet(C);
 
-  const int index = RNA_int_get(op->ptr, "index");
-
   SpreadsheetRowFilter *row_filter = (SpreadsheetRowFilter *)BLI_findlink(
-      &sspreadsheet->row_filters, index);
+      &sspreadsheet->row_filters, RNA_int_get(op->ptr, "index"));
   if (row_filter == nullptr) {
     return OPERATOR_CANCELLED;
   }
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index b9bc5fe2650..466e724953e 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1871,18 +1871,18 @@ typedef struct SpreadsheetColumn {
 
   /**
    * An indicator of the type of values in the column, set at runtime.
-   * #SpreadSheetColumnValueType.
+   * #SpreadsheetColumnValueType.
    */
   uint8_t data_type;
   char _pad0[7];
 } SpreadsheetColumn;
 
-typedef enum SpreadSheetColumnValueType {
+typedef enum SpreadsheetColumnValueType {
   SPREADSHEET_VALUE_TYPE_INT32 = 0,
   SPREADSHEET_VALUE_TYPE_FLOAT = 1,
   SPREADSHEET_VALUE_TYPE_BOOL = 2,
   SPREADSHEET_VALUE_TYPE_INSTANCES = 3,
-} SpreadSheetColumnValueType;
+} SpreadsheetColumnValueType;
 
 typedef struct SpaceSpreadsheet {
   SpaceLink *next, *prev;



More information about the Bf-blender-cvs mailing list