Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2006-12-27 08:48:49 +0300
committerJoshua Leung <aligorith@gmail.com>2006-12-27 08:48:49 +0300
commit65bfa3b05fb2f5b2193e6e00edd0ef5e7ce55d86 (patch)
treef2274141d96444d50cde17045560af9c204ca398 /source/blender/src/edit.c
parent20a656db1d4d96497b88fccd9d51f4ef29715bce (diff)
== PoseMode Bone Snapping ==
Bugfix for my previous snapping commit. In some cases, bones still didn't snap correctly (parentless 'root' bones). That was because those cases assumed that constraints had no effect on those bones.
Diffstat (limited to 'source/blender/src/edit.c')
-rw-r--r--source/blender/src/edit.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c
index 5e174e8fa47..cac945fd416 100644
--- a/source/blender/src/edit.c
+++ b/source/blender/src/edit.c
@@ -1109,21 +1109,7 @@ void snap_sel_to_grid()
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if(pchan->bone->flag & BONE_SELECTED) {
if(pchan->bone->layer & arm->layer) {
- if (pchan->parent==NULL) {
- float dLoc[3], oldLoc[3], nLoc[3];
-
- /* get nearest grid point to snap to */
- VECCOPY(nLoc, pchan->pose_head);
- vec[0]= gridf * (float)(floor(.5+ nLoc[0]/gridf));
- vec[1]= gridf * (float)(floor(.5+ nLoc[1]/gridf));
- vec[2]= gridf * (float)(floor(.5+ nLoc[2]/gridf));
-
- /* adjust location */
- VecSubf(dLoc, vec, nLoc);
- VECCOPY(oldLoc, pchan->loc);
- VecAddf(pchan->loc, oldLoc, dLoc);
- }
- else if((pchan->bone->flag & BONE_CONNECTED)==0) {
+ if((pchan->bone->flag & BONE_CONNECTED)==0) {
float vecN[3], nLoc[3];
float dLoc[3], oldLoc[3];
@@ -1240,14 +1226,7 @@ void snap_sel_to_curs()
for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
if(pchan->bone->flag & BONE_SELECTED) {
if(pchan->bone->layer & arm->layer) {
- if(pchan->parent==NULL) {
- float dLoc[3], oldLoc[3];
-
- VecSubf(dLoc, cursp, pchan->pose_head);
- VECCOPY(oldLoc, pchan->loc);
- VecAddf(pchan->loc, oldLoc, dLoc);
- }
- else if((pchan->bone->flag & BONE_CONNECTED)==0) {
+ if((pchan->bone->flag & BONE_CONNECTED)==0) {
float curspn[3], dLoc[3], oldLoc[3];
/* get location of cursor in bone-space */
@@ -1600,13 +1579,7 @@ void snap_to_center()
for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
if(pchan->bone->flag & BONE_SELECTED) {
if(pchan->bone->layer & arm->layer) {
- if(pchan->parent==NULL) {
- float dLoc[3], oldLoc[3];
- VecSubf(dLoc, snaploc, pchan->pose_head);
- VECCOPY(oldLoc, pchan->loc);
- VecAddf(pchan->loc, oldLoc, dLoc);
- }
- else if((pchan->bone->flag & BONE_CONNECTED)==0) {
+ if((pchan->bone->flag & BONE_CONNECTED)==0) {
float dLoc[3], oldLoc[3];
/* get location of cursor in bone-space */