diff options
-rw-r--r-- | source/blender/blenkernel/BKE_bmesh.h | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_global.h | 32 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/bmfont.c | 5 | ||||
-rw-r--r-- | source/blender/editors/include/ED_transform.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 171 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 118 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.h | 4 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 1 |
9 files changed, 16 insertions, 331 deletions
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h index 7bd131ed704..0dfab26e9f0 100644 --- a/source/blender/blenkernel/BKE_bmesh.h +++ b/source/blender/blenkernel/BKE_bmesh.h @@ -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, diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 53964f4689f..8daec1a6bac 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -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; diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 197f65988e6..d3f4d6d06b0 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -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 diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c index a95e5bd8ed5..2d7249b54f5 100644 --- a/source/blender/blenkernel/intern/bmfont.c +++ b/source/blender/blenkernel/intern/bmfont.c @@ -50,12 +50,15 @@ #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); diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index e613a44b1c3..dd6c4fea6a0 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -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, diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index cd2a2161315..cbd1f6ccaaa 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -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; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 3f47e25dee1..68b93fe6560 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -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) diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 583a6a47036..987180d4efd 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -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]); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index b6d8507fe8a..148cc638048 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -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", ""}, |