Revision: 33838
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33838
Author:   ton
Date:     2010-12-21 19:55:49 +0100 (Tue, 21 Dec 2010)

Log Message:
-----------
Bugfix #25330

3D Window: Snap to cursor or grid, didn't respect the 'restrict location'
options for objects or bones.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_snap.c
    trunk/blender/source/blender/makesdna/DNA_screen_types.h
    trunk/blender/source/blender/makesrna/intern/rna_screen.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_snap.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_snap.c     
2010-12-21 15:10:09 UTC (rev 33837)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_snap.c     
2010-12-21 18:55:49 UTC (rev 33838)
@@ -510,7 +510,12 @@
                                                                
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 @@
                                        
                                        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 @@
                                                                /* 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 @@
                                        
                                        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);
                        }

Modified: trunk/blender/source/blender/makesdna/DNA_screen_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_screen_types.h    2010-12-21 
15:10:09 UTC (rev 33837)
+++ trunk/blender/source/blender/makesdna/DNA_screen_types.h    2010-12-21 
18:55:49 UTC (rev 33838)
@@ -189,15 +189,16 @@
 #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

Modified: trunk/blender/source/blender/makesrna/intern/rna_screen.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_screen.c   2010-12-21 
15:10:09 UTC (rev 33837)
+++ trunk/blender/source/blender/makesrna/intern/rna_screen.c   2010-12-21 
18:55:49 UTC (rev 33838)
@@ -83,7 +83,7 @@
 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)


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to