Bugfixes:
authorJoshua Leung <aligorith@gmail.com>
Tue, 21 Oct 2008 08:00:19 +0000 (08:00 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 21 Oct 2008 08:00:19 +0000 (08:00 +0000)
- Adding constraint using button in panel still didn't update Armature Editing buttons properly.
- Minor code tidying of earlier bugfix for armatures
- 'For Transform' option for Limit constraints is now only taken into account for constraints that are enabled.

source/blender/src/buttons_object.c
source/blender/src/editarmature.c
source/blender/src/transform.c

index 841a55d7ae185bd366363144aa34ba2e80cc4455..a8ce9da8780f56460d57a1eda976996a34c27e1f 100644 (file)
@@ -2056,8 +2056,9 @@ void do_constraintbuts(unsigned short event)
        if(ob->type==OB_ARMATURE) DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA|OB_RECALC_OB);
        else DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
        
-       allqueue (REDRAWVIEW3D, 0);
-       allqueue (REDRAWBUTSOBJECT, 0);
+       allqueue(REDRAWVIEW3D, 0);
+       allqueue(REDRAWBUTSOBJECT, 0);
+       allqueue(REDRAWBUTSEDIT, 0);
 }
 
 void pointcache_bake(PTCacheID *pid, int startframe)
index 61ca5c098771daa5296461ac01cb622a74b51862..18f4bc3f8dd403b4920a8f8ff99ecf539a3ac472 100644 (file)
@@ -3277,8 +3277,11 @@ void switch_direction_armature (void)
                EditBone *ebo, *child=NULL, *parent=NULL;
                
                /* loop over bones in chain */
-               for (ebo= chain->data; ebo;) {
-                       /* parent is this bone's original parent (to go to next if we swap) */
+               for (ebo= chain->data; ebo; ebo= parent) {
+                       /* parent is this bone's original parent
+                        *      - we store this, as the next bone that is checked is this one
+                        *        but the value of ebo->parent may change here...
+                        */
                        parent= ebo->parent;
                        
                        /* only if selected and editable */
@@ -3300,10 +3303,8 @@ void switch_direction_armature (void)
                                
                                /* get next bones 
                                 *      - child will become the new parent of next bone
-                                *      - next bone to go to will be the original parent
                                 */
                                child= ebo;
-                               ebo= parent;
                        }
                        else {
                                /* not swapping this bone, however, if its 'parent' got swapped, unparent us from it 
@@ -3315,11 +3316,10 @@ void switch_direction_armature (void)
                                }
                                
                                /* get next bones
-                                *      - child will become new parent of next bone (not swapping occurred, so set to NULL to prevent infinite-loop)
-                                *      - next bone to go to will be the original parent (no change)
+                                *      - child will become new parent of next bone (not swapping occurred, 
+                                *        so set to NULL to prevent infinite-loop)
                                 */
                                child= NULL;
-                               ebo= parent;
                        }
                }
        }
index e21d543d34e77c75d4a366c09d490c0e3713d162..b9b8a4a21a9cff0ac97eb6de84d96565eb8305fd 100644 (file)
@@ -1502,6 +1502,10 @@ static void constraintTransLim(TransInfo *t, TransData *td)
                for (con= td->con; con; con= con->next) {
                        float tmat[4][4];
                        
+                       /* only consider constraint if enabled */
+                       if (con->flag & CONSTRAINT_DISABLE) continue;
+                       if (con->enforce == 0.0f) continue;
+                       
                        /* only use it if it's tagged for this purpose (and the right type) */
                        if (con->type == CONSTRAINT_TYPE_LOCLIMIT) {
                                bLocLimitConstraint *data= con->data;
@@ -1585,7 +1589,11 @@ static void constraintRotLim(TransInfo *t, TransData *td)
                        
                /* Evaluate valid constraints */
                for (con= td->con; con; con= con->next) {
-                       /* we're only interested in Limit-Scale constraints */
+                       /* only consider constraint if enabled */
+                       if (con->flag & CONSTRAINT_DISABLE) continue;
+                       if (con->enforce == 0.0f) continue;
+                       
+                       /* we're only interested in Limit-Rotation constraints */
                        if (con->type == CONSTRAINT_TYPE_ROTLIMIT) {
                                bRotLimitConstraint *data= con->data;
                                float tmat[4][4];
@@ -1675,6 +1683,10 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
                        
                /* Evaluate valid constraints */
                for (con= td->con; con; con= con->next) {
+                       /* only consider constraint if enabled */
+                       if (con->flag & CONSTRAINT_DISABLE) continue;
+                       if (con->enforce == 0.0f) continue;
+                       
                        /* we're only interested in Limit-Scale constraints */
                        if (con->type == CONSTRAINT_TYPE_SIZELIMIT) {
                                bSizeLimitConstraint *data= con->data;