diff options
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 12 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 10 | ||||
-rw-r--r-- | source/blender/src/drawmesh.c | 2 | ||||
-rw-r--r-- | source/blender/src/header_view3d.c | 35 | ||||
-rw-r--r-- | source/blender/src/space.c | 2 | ||||
-rw-r--r-- | source/blender/src/transform_snap.c | 12 |
6 files changed, 34 insertions, 39 deletions
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index b1e295d835a..51ec3a9e133 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -438,8 +438,8 @@ typedef struct Scene { ListBase markers; - short jumpframe; - short pad1, pad2, pad3; + short jumpframe, pad1; + short snap_flag, snap_target; /* none of the dependancy graph vars is mean to be saved */ struct DagForest *theDag; @@ -568,8 +568,12 @@ typedef struct Scene { /* base->flag is in DNA_object_types.h */ -/* sce->flag */ -#define SCE_ADDSCENAME 1 +/* scene->snap_flag */ +#define SCE_SNAP 1 +/* scene->snap_target */ +#define SCE_SNAP_TARGET_CLOSEST 0 +#define SCE_SNAP_TARGET_CENTER 1 +#define SCE_SNAP_TARGET_MEDIAN 2 /* sce->selectmode */ #define SCE_SELECT_VERTEX 1 diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 53f2a5aceeb..ee75d7b8f0f 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -137,7 +137,7 @@ typedef struct View3D { short gridsubdiv; /* Number of subdivisions in the grid between each highlighted grid line */ - short snap_target; + short pad3; short pad2; @@ -168,15 +168,9 @@ typedef struct View3D { /* View3d->flag2 (short) */ #define V3D_OPP_DIRECTION_NAME 1 #define V3D_FLYMODE 2 -#define V3D_TRANSFORM_SNAP 4 +#define V3D_DEPRECATED 4 /* V3D_TRANSFORM_SNAP, moved to a scene setting */ #define V3D_SOLID_TEX 8 -/* View3d->snap_target */ -#define V3D_SNAP_TARGET_CLOSEST 0 -#define V3D_SNAP_TARGET_CENTER 1 -#define V3D_SNAP_TARGET_MEDIAN 2 - - /* View3D->around */ #define V3D_CENTER 0 #define V3D_CENTROID 3 diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c index 7fe53e3c19a..32ed6be0f6b 100644 --- a/source/blender/src/drawmesh.c +++ b/source/blender/src/drawmesh.c @@ -1017,7 +1017,7 @@ static int draw_tface_mapped__set_draw(void *userData, int index) static int draw_em_tf_mapped__set_draw(void *userData, int index) { EditMesh *em = userData; - EditFace *efa = EM_get_face_for_index(index), *efa_act = userData; + EditFace *efa = EM_get_face_for_index(index); MTFace *tface; MCol *mcol; int matnr; diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index d83509f09f8..3f27fe1a5ad 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -1743,19 +1743,19 @@ static void do_view3d_transformmenu(void *arg, int event) Transform(); break; case 15: - G.vd->flag2 &= ~V3D_TRANSFORM_SNAP; + G.scene->snap_flag &= ~SCE_SNAP; break; case 16: - G.vd->flag2 |= V3D_TRANSFORM_SNAP; + G.scene->snap_flag |= SCE_SNAP; break; case 17: - G.vd->snap_target = V3D_SNAP_TARGET_CLOSEST; + G.scene->snap_target = SCE_SNAP_TARGET_CLOSEST; break; case 18: - G.vd->snap_target = V3D_SNAP_TARGET_CENTER; + G.scene->snap_target = SCE_SNAP_TARGET_CENTER; break; case 19: - G.vd->snap_target = V3D_SNAP_TARGET_MEDIAN; + G.scene->snap_target = SCE_SNAP_TARGET_MEDIAN; break; } allqueue(REDRAWVIEW3D, 0); @@ -1812,7 +1812,7 @@ static uiBlock *view3d_transformmenu(void *arg_unused) { uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - if (G.vd->flag2 & V3D_TRANSFORM_SNAP) + if (G.scene->snap_flag & SCE_SNAP) { uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Grid", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, ""); uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, ""); @@ -1825,19 +1825,19 @@ static uiBlock *view3d_transformmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - switch(G.vd->snap_target) + switch(G.scene->snap_target) { - case V3D_SNAP_TARGET_CLOSEST: + case SCE_SNAP_TARGET_CLOSEST: uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap Closest", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, ""); uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Center", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, ""); uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Median", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, ""); break; - case V3D_SNAP_TARGET_CENTER: + case SCE_SNAP_TARGET_CENTER: uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Closest", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, ""); uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap Center", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, ""); uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Median", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, ""); break; - case V3D_SNAP_TARGET_MEDIAN: + case SCE_SNAP_TARGET_MEDIAN: uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Closest", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, ""); uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Center", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, ""); uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap Median", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, ""); @@ -5106,18 +5106,15 @@ void view3d_buttons(void) if(G.obedit && (G.obedit->type == OB_MESH)) { // Only Mesh for now uiBlockBeginAlign(block); - if (G.vd->flag2 & V3D_TRANSFORM_SNAP) - { - uiDefIconButBitS(block, TOG, V3D_TRANSFORM_SNAP, B_REDR, ICON_SNAP_GEO,xco,0,XIC,YIC, &G.vd->flag2, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab)"); + if (G.scene->snap_flag & SCE_SNAP) { + uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,0,XIC,YIC, &G.scene->snap_flag, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab)"); xco+= XIC; - uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,0,70,YIC, &G.vd->snap_target, 0, 0, 0, 0, "Snap Target Mode"); + uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,0,70,YIC, &G.scene->snap_target, 0, 0, 0, 0, "Snap Target Mode"); xco+= 70; - } - else - { - uiDefIconButBitS(block, TOG, V3D_TRANSFORM_SNAP, B_REDR, ICON_SNAP_GEAR,xco,0,XIC,YIC, &G.vd->flag2, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)"); + } else { + uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,0,XIC,YIC, &G.scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)"); xco+= XIC; - } + } uiBlockEndAlign(block); xco+= 10; diff --git a/source/blender/src/space.c b/source/blender/src/space.c index d4433e7d2fe..82807c0382f 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1524,7 +1524,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) /* Snap toggle (only edit mesh right now) */ if (G.obedit && G.obedit->type==OB_MESH) { - G.vd->flag2 ^= V3D_TRANSFORM_SNAP; + G.scene->snap_flag ^= SCE_SNAP; allqueue(REDRAWHEADERS, 0); } } diff --git a/source/blender/src/transform_snap.c b/source/blender/src/transform_snap.c index 5b4ead1f519..ce3212c63fa 100644 --- a/source/blender/src/transform_snap.c +++ b/source/blender/src/transform_snap.c @@ -174,7 +174,7 @@ void initSnapping(TransInfo *t) if (t->tsnap.applySnap != NULL && // A snapping function actually exist (G.obedit != NULL && G.obedit->type==OB_MESH) && // Temporary limited to edit mode meshes - (G.vd->flag2 & V3D_TRANSFORM_SNAP) && // Only if the snap flag is on + (G.scene->snap_flag & SCE_SNAP) && // Only if the snap flag is on (t->flag & T_PROP_EDIT) == 0) // No PET, obviously { t->tsnap.status |= SNAP_ON; @@ -197,17 +197,17 @@ void setSnappingCallback(TransInfo *t) { t->tsnap.calcSnap = CalcSnapGeometry; - switch(G.vd->snap_target) + switch(G.scene->snap_target) { - case V3D_SNAP_TARGET_CLOSEST: + case SCE_SNAP_TARGET_CLOSEST: t->tsnap.modeTarget = SNAP_CLOSEST; t->tsnap.targetSnap = TargetSnapClosest; break; - case V3D_SNAP_TARGET_CENTER: + case SCE_SNAP_TARGET_CENTER: t->tsnap.modeTarget = SNAP_CENTER; t->tsnap.targetSnap = TargetSnapCenter; break; - case V3D_SNAP_TARGET_MEDIAN: + case SCE_SNAP_TARGET_MEDIAN: t->tsnap.modeTarget = SNAP_MEDIAN; t->tsnap.targetSnap = TargetSnapMedian; break; @@ -224,7 +224,7 @@ void setSnappingCallback(TransInfo *t) t->tsnap.distance = RotationBetween; // Can't do TARGET_CENTER with rotation, use TARGET_MEDIAN instead - if (G.vd->snap_target == V3D_SNAP_TARGET_CENTER) { + if (G.scene->snap_target == SCE_SNAP_TARGET_CENTER) { t->tsnap.modeTarget = SNAP_MEDIAN; t->tsnap.targetSnap = TargetSnapMedian; } |