[Bf-blender-cvs] [7e354dc78b8] soc-2019-bevel-profiles: Resolve / delete various small TODOs, edit some comments and tooltips.

Hans Goudey noreply at git.blender.org
Fri Jul 26 23:26:45 CEST 2019


Commit: 7e354dc78b842ed22a0ecfa5bda67d7a2a06151f
Author: Hans Goudey
Date:   Fri Jul 26 16:20:10 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB7e354dc78b842ed22a0ecfa5bda67d7a2a06151f

Resolve / delete various small TODOs, edit some comments and tooltips.

No major changes to functionality.

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

M	source/blender/bmesh/intern/bmesh_operator_api.h
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/mesh/editmesh_bevel.c
M	source/blender/makesdna/DNA_profilewidget_types.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/makesrna/intern/rna_profile.c

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

diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index 91bce72a9e3..e4a96937c9e 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -238,7 +238,6 @@ typedef enum eBMOpSlotSubType_Ptr {
   BMO_OP_SLOT_SUBTYPE_PTR_OBJECT = 102,
   BMO_OP_SLOT_SUBTYPE_PTR_MESH = 103,
   BMO_OP_SLOT_SUBTYPE_PTR_STRUCT = 104,
-  /* HANS-TODO: Should I do it without adding this? */
 } eBMOpSlotSubType_Ptr;
 typedef enum eBMOpSlotSubType_Int {
   BMO_OP_SLOT_SUBTYPE_INT_ENUM = 200,
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 9206b571381..e2b28bf749b 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2423,10 +2423,8 @@ static void ui_but_paste_curvemapping(bContext *C, uiBut *but)
   }
 }
 
-/* HANS-TODO: Test these */
 static void ui_but_copy_profilewidget(uiBut *but)
 {
-  printf("UI BUT COPY PROFILEWIDGET\n");
   if (but->poin != NULL) {
     but_copypaste_profile_alive = true;
     profilewidget_free_data(&but_copypaste_profile);
@@ -2436,7 +2434,6 @@ static void ui_but_copy_profilewidget(uiBut *but)
 
 static void ui_but_paste_profilewidget(bContext *C, uiBut *but)
 {
-  printf("UI BUT PASTE PROFILEWIDGET\n");
   if (but_copypaste_profile_alive) {
     if (!but->poin) {
       but->poin = MEM_callocN(sizeof(ProfileWidget), "profilewidget");
@@ -6746,7 +6743,8 @@ static int ui_do_but_CURVE(
   return WM_UI_HANDLER_CONTINUE;
 }
 
-/* Same as ui_numedit_but_PROFILE with some smaller changes */
+/* Same as ui_numedit_but_CURVE with some smaller changes */
+/* HANS-TODO: Dragging control point doesn't update modifier */
 static bool ui_numedit_but_PROFILE(uiBlock *block,
                                    uiBut *but,
                                    uiHandleButtonData *data,
@@ -6792,7 +6790,6 @@ static bool ui_numedit_but_PROFILE(uiBlock *block,
     ProfilePoint *point_last = NULL;
     const float mval_factor = ui_mouse_scale_warp_factor(shift);
     bool moved_point = false; /* for ctrl grid, can't use orig coords because of sorting */
-    /* HANS-TODO: Well enable using original coords then? */
 
     fx *= mval_factor;
     fy *= mval_factor;
@@ -6865,6 +6862,7 @@ static bool ui_numedit_but_PROFILE(uiBlock *block,
   return changed;
 }
 
+/* HANS-TODO: Add move (G) and delete (X) shortcuts for the widget if it's possible */
 static int ui_do_but_PROFILE(bContext *C,
                              uiBlock *block,
                              uiBut *but,
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 95aecabd2f0..7d0dc74cfdf 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -4316,24 +4316,10 @@ static void profilewidget_presets_dofunc(bContext *C, void *prwdgt_v, int event)
 {
   ProfileWidget *prwdgt = prwdgt_v;
 
-  /* HANS-TODO: Could be condensed */
-  switch (event) {
-    case PROF_PRESET_LINE:
-      prwdgt->preset = PROF_PRESET_LINE;
-      profilewidget_reset(prwdgt);
-      profilewidget_changed(prwdgt, false);
-      break;
-    case PROF_PRESET_SUPPORTS:
-      prwdgt->preset = PROF_PRESET_SUPPORTS;
-      profilewidget_reset(prwdgt);
-      profilewidget_changed(prwdgt, false);
-      break;
-  case PROF_PRESET_EXAMPLE1:
-    prwdgt->preset = PROF_PRESET_EXAMPLE1;
-    profilewidget_reset(prwdgt);
-    profilewidget_changed(prwdgt, false);
-    break;
-  }
+  prwdgt->preset = event;
+  profilewidget_reset(prwdgt);
+  profilewidget_changed(prwdgt, false);
+
   ED_undo_push(C, "ProfileWidget tools");
   ED_region_tag_redraw(CTX_wm_region(C));
 }
@@ -4544,8 +4530,8 @@ static void profilewidget_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAU
   uiLayout *row, *sub;
   uiBlock *block;
   uiBut *bt;
-  int icon, path_width, path_height;
-  int i;
+  int i, icon, path_width, path_height;
+  bool point_is_end;
   rctf bounds;
 
   block = uiLayoutGetBlock(layout);
@@ -4555,11 +4541,15 @@ static void profilewidget_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAU
   uiLayoutRow(layout, false);
 
   /* Preset selector */
-  /* HANS-TODO: This isn't the proper way to do this, but it should work for now */
   bt = uiDefBlockBut(block, profilewidget_buttons_presets, prwdgt, "Preset", 0, 0,
                              UI_UNIT_X, UI_UNIT_X, "");
   UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
+  /* HANS-QUESTION: I'm guessing this is the newer way to do this. I'd be happy to switch
+   * everythingn here to this method, as it seems simpler, more elegant, and more linked to the RNA
+   * system anyway, but this doesn't redraw the widget */
+  uiItemR(layout, ptr, "preset", 0, "Preset", ICON_NONE);
+
   row = uiLayoutRow(layout, false);
 
   /* (Left aligned) */
@@ -4586,8 +4576,7 @@ static void profilewidget_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAU
   UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
   /* Flip path */
-  /* HANS-TODO: Get a proper icon for this */
-  bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_UV_SYNC_SELECT, 0, 0, UI_UNIT_X, UI_UNIT_X, NULL,
+  bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_ARROW_LEFTRIGHT, 0, 0, UI_UNIT_X, UI_UNIT_X, NULL,
                     0.0, 0.0, 0.0, 0.0, TIP_("Reverse Path"));
   UI_but_funcN_set(bt, profilewidget_buttons_reverse, MEM_dupallocN(cb), prwdgt);
 
@@ -4600,22 +4589,21 @@ static void profilewidget_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAU
   /* The path itself */
   path_width = max_ii(uiLayoutGetWidth(layout), UI_UNIT_X);
   path_width = min_ii(path_width, (int)(16.0f * UI_UNIT_X));
-  /* HANS-TODO: Capping the width doesn't work, probably reassigned somwhere down the line */
-//  path_height = (8.0f * UI_UNIT_X);
   path_height = path_width;
   uiLayoutRow(layout, false);
   uiDefBut(block, UI_BTYPE_PROFILE, 0, "", 0, 0, (short)path_width, (short)path_height,
            prwdgt, 0.0f, 1.0f, -1, 0, "");
 
   /* Position sliders for (first) selected point */
-  if (prwdgt->path) { /* HANS-TODO: This check shouldn't be necessary */
-    for (i = 0; i < prwdgt->totpoint; i++) {
-      if (prwdgt->path[i].flag & PROF_SELECT) {
-        point = &prwdgt->path[i];
-        break;
-      }
+  for (i = 0; i < prwdgt->totpoint; i++) {
+    if (prwdgt->path[i].flag & PROF_SELECT) {
+      point = &prwdgt->path[i];
+      break;
     }
   }
+  if (i == 0 || i == prwdgt->totpoint - 1) {
+    point_is_end = true;
+  }
 
   /* Selected point data */
   if (point) {
@@ -4639,17 +4627,20 @@ static void profilewidget_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAU
 
     /* Position */
     UI_block_funcN_set(block, profilewidget_buttons_update, MEM_dupallocN(cb), prwdgt);
-    uiDefButF(block, UI_BTYPE_NUM, 0, "X:", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &point->x,
-              bounds.xmin, bounds.xmax, 1, 5, "");
-    uiDefButF(block, UI_BTYPE_NUM, 0, "Y:", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &point->y,
-              bounds.ymin, bounds.ymax, 1, 5, "");
+    /* HANS-TODO: These sliders shouldn't move the first or last point */
+    if (!point_is_end) {
+      uiDefButF(block, UI_BTYPE_NUM, 0, "X:", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y,
+                &point->x, bounds.xmin, bounds.xmax, 1, 5, "");
+      uiDefButF(block, UI_BTYPE_NUM, 0, "Y:", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y,
+                &point->y, bounds.ymin, bounds.ymax, 1, 5, "");
+    }
 
     /* Delete points */
     bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_X, NULL, 0.0, 0.0,
                       0.0, 0.0, TIP_("Delete points"));
     UI_but_funcN_set(bt, profilewidget_buttons_delete, MEM_dupallocN(cb), prwdgt);
 
-    UI_block_emboss_set(block, UI_EMBOSS);
+//    UI_block_emboss_set(block, UI_EMBOSS);
     UI_block_funcN_set(block, rna_update_cb, MEM_dupallocN(cb), NULL);
   }
 
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index be6da713507..9b6869b8353 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -892,13 +892,10 @@ static void edbm_bevel_ui(bContext *C, wmOperator *op)
   }
   uiItemR(layout, &ptr, "vmesh_method", 0, NULL, ICON_NONE);
   uiItemR(layout, &ptr, "use_custom_profile", 0, NULL, ICON_NONE);
-//  uiLayoutRow(layout, false); /* HANS-TODO: Need this? */
   if (RNA_boolean_get(&ptr, "use_custom_profile")) {
     uiTemplateProfileWidget(layout, &toolsettings_ptr, "prwdgt");
 
   }
-  /* HANS-TODO: Figure out why there's a double of the use_custom_profile prop at the end when it's
-   * enabled */
 }
 
 void MESH_OT_bevel(wmOperatorType *ot)
diff --git a/source/blender/makesdna/DNA_profilewidget_types.h b/source/blender/makesdna/DNA_profilewidget_types.h
index c42a389511f..dbddeca89a6 100644
--- a/source/blender/makesdna/DNA_profilewidget_types.h
+++ b/source/blender/makesdna/DNA_profilewidget_types.h
@@ -27,9 +27,10 @@
 #include "DNA_vec_types.h"
 
 #define PROF_TABLE_SIZE 256
-/* HANS-TODO: Switch to variable table size based on resolution and number of points
-#define PROF_N_TABLE(n_pts) (((n_pts) - 1) * PROF_RESOL)
-#define PROF_RESOL 2 */
+/* HANS-TODO: Switch to variable table size based on resolution and number of points, mostly for a
+ * speedup in the drawing and evaluation code if it's needed */
+//#define PROF_N_TABLE(n_pts) min_ff(512, (((n_pts) - 1) * PROF_RESOL)) /* n_pts is prwdgt->totpoint */
+//#define PROF_RESOL 16
 
 typedef struct ProfilePoint {
   /** Location of the point */
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index eccb3d6a3d1..3f95fb6c880 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -3650,7 +3650,6 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
   RNA_def_property_pointer_sdna(prop, NULL, "prwdgt");
   RNA_def_property_ui_text(prop, "Custom Profile 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list