diff options
author | Ton Roosendaal <ton@blender.org> | 2010-12-21 21:55:49 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2010-12-21 21:55:49 +0300 |
commit | aeba7032e6fe3f70ede89b24cd9e6d098adb993b (patch) | |
tree | 4dcc22d408993c0e2933deeae8b50ac27f5d16da /source | |
parent | fae8dc5a735d6e47d96d5757fbc51a33b45a4cea (diff) |
Bugfix #25330
3D Window: Snap to cursor or grid, didn't respect the 'restrict location'
options for objects or bones.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 35 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_screen_types.h | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 2 |
3 files changed, 26 insertions, 18 deletions
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index beb6170e0dc..64aa21d6ad8 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -510,7 +510,12 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) armature_loc_pose_to_bone(pchan, vec, vecN); /* adjust location */ - VECCOPY(pchan->loc, vecN); + if ((pchan->protectflag & OB_LOCK_LOCX)==0) + pchan->loc[0]= vecN[0]; + if ((pchan->protectflag & OB_LOCK_LOCY)==0) + pchan->loc[0]= vecN[1]; + if ((pchan->protectflag & OB_LOCK_LOCZ)==0) + pchan->loc[0]= vecN[2]; } /* if the bone has a parent and is connected to the parent, * don't do anything - will break chain unless we do auto-ik. @@ -536,16 +541,14 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) invert_m3_m3(imat, originmat); mul_m3_v3(imat, vec); - ob->loc[0]+= vec[0]; - ob->loc[1]+= vec[1]; - ob->loc[2]+= vec[2]; } - else { + if ((ob->protectflag & OB_LOCK_LOCX)==0) ob->loc[0]+= vec[0]; + if ((ob->protectflag & OB_LOCK_LOCY)==0) ob->loc[1]+= vec[1]; + if ((ob->protectflag & OB_LOCK_LOCZ)==0) ob->loc[2]+= vec[2]; - } - + /* auto-keyframing */ // XXX autokeyframe_ob_cb_func(ob, TFM_TRANSLATION); } @@ -633,8 +636,13 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) /* get location of cursor in bone-space */ armature_loc_pose_to_bone(pchan, cursp, curspn); - /* calculate new position */ - VECCOPY(pchan->loc, curspn); + /* copy new position */ + if ((pchan->protectflag & OB_LOCK_LOCX)==0) + pchan->loc[0]= curspn[0]; + if ((pchan->protectflag & OB_LOCK_LOCY)==0) + pchan->loc[1]= curspn[1]; + if ((pchan->protectflag & OB_LOCK_LOCZ)==0) + pchan->loc[2]= curspn[2]; } /* if the bone has a parent and is connected to the parent, * don't do anything - will break chain unless we do auto-ik. @@ -660,15 +668,14 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) invert_m3_m3(imat, originmat); mul_m3_v3(imat, vec); - ob->loc[0]+= vec[0]; - ob->loc[1]+= vec[1]; - ob->loc[2]+= vec[2]; } - else { + if ((ob->protectflag & OB_LOCK_LOCX)==0) ob->loc[0]+= vec[0]; + if ((ob->protectflag & OB_LOCK_LOCY)==0) ob->loc[1]+= vec[1]; + if ((ob->protectflag & OB_LOCK_LOCZ)==0) ob->loc[2]+= vec[2]; - } + /* auto-keyframing */ // XXX autokeyframe_ob_cb_func(ob, TFM_TRANSLATION); } diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 132dd21913d..2d3af55ca78 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -189,15 +189,16 @@ typedef struct ARegion { #define HEADERTOP 2 /* screen->full */ -#define SCREENNORMAL 0 -#define SCREENFULL 1 +#define SCREENNORMAL 0 +#define SCREENFULL 1 +#define SCREENFULLTEMP 2 /* Panel->snap - for snapping to screen edges */ #define PNL_SNAP_NONE 0 #define PNL_SNAP_TOP 1 #define PNL_SNAP_RIGHT 2 -#define PNL_SNAP_BOTTOM 4 +#define PNL_SNAP_BOTTOM 4 #define PNL_SNAP_LEFT 8 #define PNL_SNAP_DIST 9.0 diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index a8c96e93448..a9e43d35f32 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -83,7 +83,7 @@ static int rna_Screen_is_animation_playing_get(PointerRNA *ptr) static int rna_Screen_fullscreen_get(PointerRNA *ptr) { bScreen *sc= (bScreen*)ptr->data; - return (sc->full == SCREENFULL); + return (sc->full != 0); } static void rna_Area_type_set(PointerRNA *ptr, int value) |