code cleanup: remove old/unused bmesh bevel transform mode, remove commented characte...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 28 May 2013 13:01:31 +0000 (13:01 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 28 May 2013 13:01:31 +0000 (13:01 +0000)
source/blender/blenkernel/BKE_bmesh.h
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/bmfont.c
source/blender/editors/include/ED_transform.h
source/blender/editors/interface/interface_draw.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_ops.c

index 7bd131ed704746f885ef735997a6ea0604dc24d6..0dfab26e9f0ebb6ba2a2454e1dfa7b52174e82de 100644 (file)
@@ -90,16 +90,6 @@ typedef struct BME_TransData_Head {
        int len;
 } BME_TransData_Head;
 
-/* this is no longer used */
-typedef struct BME_Glob { /* stored in Global G for Transform() purposes */
-       struct BMesh *bm;
-       BME_TransData_Head *td;
-       struct TransInfo *Trans; /* a pointer to the global Trans struct */
-       int imval[2]; /* for restoring original mouse co when initTransform() is called multiple times */
-       int options;
-       int res;
-} BME_Glob;
-
 struct BME_TransData *BME_get_transdata(struct BME_TransData_Head *td, struct BMVert *v);
 void BME_free_transdata(struct BME_TransData_Head *td);
 struct BMesh *BME_bevel(struct BMesh *bm, float value, int res, int options, int defgrp_index, float angle,
index 53964f4689fc816cb6e8b30a3e3311f1774c3468..8daec1a6bac7790a747acb1312563c8e5938596f 100644 (file)
@@ -55,18 +55,21 @@ typedef struct Global {
        /* strings: lastsaved */
        char ima[1024], lib[1024]; /* 1024 = FILE_MAX */
 
-       /* flag: if != 0 G.main->name contains valid relative base path */
-       int relbase_valid;
+       /* when set: G.main->name contains valid relative base path */
+       bool relbase_valid;
+       bool file_loaded;
+       bool save_over;
 
        /* strings of recent opened files */
        struct ListBase recent_files;
 
        /* has escape been pressed or Ctrl+C pressed in background mode, used for render quit */
-       short is_break;
+       bool is_break;
 
-       short moving, file_loaded;
-       char background;
-       char factory_startup;
+       bool background;
+       bool factory_startup;
+
+       short moving;
        short winpos, displaymode;  /* used to be in Render */
 
        /* to indicate render is busy, prevent renderwindow events etc */
@@ -82,25 +85,12 @@ typedef struct Global {
        /* debug flag, G_DEBUG, G_DEBUG_PYTHON & friends, set python or command line args */
        int debug;
 
-       /* Used for BMesh transformations */
-       struct BME_Glob *editBMesh;
-
-       /* Frank's variables */
-       int save_over;
-
-       /* Rob's variables (keep here for WM recode) */
-       int have_quicktime;
-       int ui_international;
-       int charstart;
-       int charmin;
-       int charmax;
-       struct VFont *selfont;
-       struct ListBase ttfdata;
+       bool have_quicktime;
 
        /* this variable is written to / read from FileGlobal->fileflags */
        int fileflags;
 
-       /* save the allowed windowstate of blender when using -W or -w */
+       /* save the allowed windowstate of blender when using -W or -w (GHOST_TWindowState) */
        int windowstate;
 } Global;
 
index 197f65988e64c9b46d1430bff417cf7f11659ecd..d3f4d6d06b0b72b9fbb5f50dffd34911bfb7e24c 100644 (file)
@@ -150,10 +150,6 @@ void initglobals(void)
        G.windowstate = 0;
 #endif
 
-       G.charstart = 0x0000;
-       G.charmin = 0x0000;
-       G.charmax = 0xffff;
-
 #ifndef WITH_PYTHON_SECURITY /* default */
        G.f |= G_SCRIPT_AUTOEXEC;
 #else
index a95e5bd8ed5d9b26217c86b18dc1083db9445f80..2d7249b54f54769e89d0457db509ec88915a648f 100644 (file)
 #include <stdio.h>
 
 #include "MEM_guardedalloc.h"
-#include "BKE_global.h"
 #include "IMB_imbuf_types.h"
 
 #include "BKE_bmfont.h"
 #include "BKE_bmfont_types.h"
 
+#include "BLI_utildefines.h"
+
+#include "BKE_global.h"
+
 void printfGlyph(bmGlyph *glyph)
 {
        printf("unicode: %d '%c'\n", glyph->unicode, glyph->unicode);
index e613a44b1c379aa347e08febae6dad5ff9d0b09f..dd6c4fea6a06aa6d464f7aab09cc58b152367549 100644 (file)
@@ -80,7 +80,7 @@ enum TfmMode {
        TFM_TIME_EXTEND,
        TFM_TIME_DUPLICATE,
        TFM_BAKE_TIME,
-       TFM_BEVEL,
+       TFM_DEPRECATED,  /* was BEVEL */
        TFM_BWEIGHT,
        TFM_ALIGN,
        TFM_EDGE_SLIDE,
index cd2a2161315725d154ef03ce47052ffa5aad199b..cbd1f6ccaaaf21ad2da1269120bfdec82ff203ff 100644 (file)
@@ -442,177 +442,6 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
 #endif
 }
 
-#if 0
-#ifdef WITH_INTERNATIONAL
-static void ui_draw_but_CHARTAB(uiBut *but)
-{
-       /* XXX 2.50 bad global access */
-       /* Some local variables */
-       float sx, sy, ex, ey;
-       float width, height;
-       float butw, buth;
-       int x, y, cs;
-       wchar_t wstr[2];
-       unsigned char ustr[16];
-       PackedFile *pf;
-       int result = 0;
-       int charmax = G.charmax;
-       
-       /* FO_BUILTIN_NAME font in use. There are TTF FO_BUILTIN_NAME and non-TTF FO_BUILTIN_NAME fonts */
-       if (BKE_vfont_is_builtin(G.selfont)) {
-               if (G.ui_international == TRUE) {
-                       charmax = 0xff;
-               }
-               else {
-                       charmax = 0xff;
-               }
-       }
-
-       /* Category list exited without selecting the area */
-       if (G.charmax == 0)
-               charmax = G.charmax = 0xffff;
-
-       /* Calculate the size of the button */
-       width  = abs(BLI_rcti_size_x(rect));
-       height = abs(BLI_rcti_size_y(rect));
-       
-       butw = floor(width / 12);
-       buth = floor(height / 6);
-       
-       /* Initialize variables */
-       sx = rect->xmin;
-       ex = rect->xmin + butw;
-       sy = rect->ymin + height - buth;
-       ey = rect->ymin + height;
-
-       cs = G.charstart;
-
-       /* Set the font, in case it is not FO_BUILTIN_NAME font */
-       if (G.selfont && BKE_vfont_is_builtin(G.selfont) == FALSE) {
-               /* Is the font file packed, if so then use the packed file */
-               if (G.selfont->packedfile) {
-                       pf = G.selfont->packedfile;
-                       FTF_SetFont(pf->data, pf->size, 14.0);
-               }
-               else {
-                       char tmpStr[256];
-                       int err;
-
-                       BLI_strncpy(tmpStr, G.selfont->name, sizeof(tmpStr));
-                       BLI_path_abs(tmpStr, G.main->name);
-                       err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
-               }
-       }
-       else {
-               if (G.ui_international == TRUE) {
-                       FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0);
-               }
-       }
-
-       /* Start drawing the button itself */
-       glShadeModel(GL_SMOOTH);
-
-       glColor3ub(200,  200,  200);
-       glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
-
-       glColor3ub(0,  0,  0);
-       for (y = 0; y < 6; y++) {
-               /* Do not draw more than the category allows */
-               if (cs > charmax) break;
-
-               for (x = 0; x < 12; x++)
-               {
-                       /* Do not draw more than the category allows */
-                       if (cs > charmax) break;
-
-                       /* Draw one grid cell */
-                       glBegin(GL_LINE_LOOP);
-                       glVertex2f(sx, sy);
-                       glVertex2f(ex, sy);
-                       glVertex2f(ex, ey);
-                       glVertex2f(sx, ey);
-                       glEnd();
-
-                       /* Draw character inside the cell */
-                       memset(wstr, 0, sizeof(wchar_t) * 2);
-                       memset(ustr, 0, 16);
-
-                       /* Set the font to be either unicode or FO_BUILTIN_NAME */
-                       wstr[0] = cs;
-                       if (BKE_vfont_is_builtin(G.selfont) == FALSE) {
-                               BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr));
-                       }
-                       else {
-                               if (G.ui_international == TRUE) {
-                                       BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr));
-                               }
-                               else {
-                                       ustr[0] = cs;
-                                       ustr[1] = 0;
-                               }
-                       }
-
-                       if ((G.selfont && (BKE_vfont_is_builtin(G.selfont) == FALSE)) ||
-                           (G.selfont && (BKE_vfont_is_builtin(G.selfont) == TRUE) && G.ui_international == TRUE))
-                       {
-                               float wid;
-                               float llx, lly, llz, urx, ury, urz;
-                               float dx, dy;
-                               float px, py;
-       
-                               /* Calculate the position */
-                               wid = FTF_GetStringWidth((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
-                               FTF_GetBoundingBox((char *) ustr, &llx, &lly, &llz, &urx, &ury, &urz, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
-                               dx = urx - llx;
-                               dy = ury - lly;
-
-                               /* This isn't fully functional since the but->aspect isn't working like I suspected */
-                               px = sx + ((butw / but->aspect) - dx) / 2;
-                               py = sy + ((buth / but->aspect) - dy) / 2;
-
-                               /* Set the position and draw the character */
-                               ui_rasterpos_safe(px, py, but->aspect);
-                               FTF_DrawString((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
-                       }
-                       else {
-                               ui_rasterpos_safe(sx + butw / 2, sy + buth / 2, but->aspect);
-                               UI_DrawString(but->font, (char *) ustr, 0);
-                       }
-
-                       /* Calculate the next position and character */
-                       sx += butw;
-                       ex += butw;
-                       cs++;
-               }
-               /* Add the y position and reset x position */
-               sy -= buth; 
-               ey -= buth;
-               sx = rect->xmin;
-               ex = rect->xmin + butw;
-       }
-       glShadeModel(GL_FLAT);
-
-       /* Return Font Settings to original */
-       if (U.fontsize && U.fontname[0]) {
-               result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize);
-       }
-       else if (U.fontsize) {
-               result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
-       }
-
-       if (result == 0) {
-               result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11);
-       }
-       
-       /* resets the font size */
-       if (G.ui_international == TRUE) {
-               // uiSetCurFont(but->block, UI_HELV);
-       }
-}
-
-#endif /* WITH_INTERNATIONAL */
-#endif
-
 static void draw_scope_end(const rctf *rect, GLint *scissor)
 {
        float scaler_x1, scaler_x2;
index 3f47e25dee1152a4723c9e223d34f0e027a50fa1..68b93fe6560b40f0038cf676db8151f81d3c7cd5 100644 (file)
@@ -2050,9 +2050,6 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *even
                case TFM_MIRROR:
                        initMirror(t);
                        break;
-               case TFM_BEVEL:
-                       initBevel(t);
-                       break;
                case TFM_BWEIGHT:
                        initBevelWeight(t);
                        break;
@@ -4455,121 +4452,6 @@ int PushPull(TransInfo *t, const int UNUSED(mval[2]))
        return 1;
 }
 
-/* ************************** BEVEL **************************** */
-
-void initBevel(TransInfo *t)
-{
-       t->transform = Bevel;
-       t->handleEvent = handleEventBevel;
-
-       initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_ABSOLUTE);
-
-       t->mode = TFM_BEVEL;
-       t->flag |= T_NO_CONSTRAINT;
-       t->num.flag |= NUM_NO_NEGATIVE;
-
-       t->idx_max = 0;
-       t->num.idx_max = 0;
-       t->snap[0] = 0.0f;
-       t->snap[1] = 0.1f;
-       t->snap[2] = t->snap[1] * 0.1f;
-
-       t->num.increment = t->snap[1];
-
-       /* DON'T KNOW WHY THIS IS NEEDED */
-       if (G.editBMesh->imval[0] == 0 && G.editBMesh->imval[1] == 0) {
-               /* save the initial mouse co */
-               G.editBMesh->imval[0] = t->imval[0];
-               G.editBMesh->imval[1] = t->imval[1];
-       }
-       else {
-               /* restore the mouse co from a previous call to initTransform() */
-               t->imval[0] = G.editBMesh->imval[0];
-               t->imval[1] = G.editBMesh->imval[1];
-       }
-}
-
-int handleEventBevel(TransInfo *t, const wmEvent *event)
-{
-       if (event->val == KM_PRESS) {
-               if (!G.editBMesh) return 0;
-
-               switch (event->type) {
-                       case MIDDLEMOUSE:
-                               G.editBMesh->options ^= BME_BEVEL_VERT;
-                               t->state = TRANS_CANCEL;
-                               return 1;
-                       //case PADPLUSKEY:
-                       //      G.editBMesh->options ^= BME_BEVEL_RES;
-                       //      G.editBMesh->res += 1;
-                       //      if (G.editBMesh->res > 4) {
-                       //              G.editBMesh->res = 4;
-                       //      }
-                       //      t->state = TRANS_CANCEL;
-                       //      return 1;
-                       //case PADMINUS:
-                       //      G.editBMesh->options ^= BME_BEVEL_RES;
-                       //      G.editBMesh->res -= 1;
-                       //      if (G.editBMesh->res < 0) {
-                       //              G.editBMesh->res = 0;
-                       //      }
-                       //      t->state = TRANS_CANCEL;
-                       //      return 1;
-                       default:
-                               return 0;
-               }
-       }
-       return 0;
-}
-
-int Bevel(TransInfo *t, const int UNUSED(mval[2]))
-{
-       float distance, d;
-       int i;
-       char str[MAX_INFO_LEN];
-       const char *mode;
-       TransData *td = t->data;
-
-       mode = (G.editBMesh->options & BME_BEVEL_VERT) ? IFACE_("verts only") : IFACE_("normal");
-       distance = t->values[0] / 4; /* 4 just seemed a nice value to me, nothing special */
-
-       distance = fabs(distance);
-
-       snapGrid(t, &distance);
-
-       applyNumInput(&t->num, &distance);
-
-       /* header print for NumInput */
-       if (hasNumInput(&t->num)) {
-               char c[NUM_STR_REP_LEN];
-
-               outputNumInput(&(t->num), c);
-
-               BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Bevel - Dist: %s, Mode: %s (MMB to toggle))"), c, mode);
-       }
-       else {
-               /* default header print */
-               BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Bevel - Dist: %.4f, Mode: %s (MMB to toggle))"), distance, mode);
-       }
-
-       if (distance < 0) distance = -distance;
-       for (i = 0; i < t->total; i++, td++) {
-               if (td->axismtx[1][0] > 0 && distance > td->axismtx[1][0]) {
-                       d = td->axismtx[1][0];
-               }
-               else {
-                       d = distance;
-               }
-               madd_v3_v3v3fl(td->loc, td->center, td->axismtx[0], (*td->val) * d);
-       }
-
-       recalcData(t);
-
-       ED_area_headerprint(t->sa, str);
-
-       return 1;
-}
-
 /* ************************** BEVEL WEIGHT *************************** */
 
 void initBevelWeight(TransInfo *t)
index 583a6a47036f247f7c3ae2dca5e4b083de10d717..987180d4efdfbe0646992443379ef2de511a9b1c 100644 (file)
@@ -531,10 +531,6 @@ int Trackball(TransInfo *t, const int mval[2]);
 void initPushPull(TransInfo *t);
 int PushPull(TransInfo *t, const int mval[2]);
 
-void initBevel(TransInfo *t);
-int handleEventBevel(TransInfo *t, const struct wmEvent *event);
-int Bevel(TransInfo *t, const int mval[2]);
-
 void initBevelWeight(TransInfo *t);
 int BevelWeight(TransInfo *t, const int mval[2]);
 
index b6d8507fe8a191871288fd1b932d91495b1acfdd..148cc6380481aba627a86b97580dae0849cc2233 100644 (file)
@@ -147,7 +147,6 @@ EnumPropertyItem transform_mode_types[] =
        {TFM_TIME_SCALE, "TIME_SCALE", 0, "Time_Scale", ""},
        {TFM_TIME_EXTEND, "TIME_EXTEND", 0, "Time_Extend", ""},
        {TFM_BAKE_TIME, "BAKE_TIME", 0, "Bake_Time", ""},
-       {TFM_BEVEL, "BEVEL", 0, "Bevel", ""},
        {TFM_BWEIGHT, "BWEIGHT", 0, "Bweight", ""},
        {TFM_ALIGN, "ALIGN", 0, "Align", ""},
        {TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},