Orange: More fixes in bone-layers (#$@%!).
authorTon Roosendaal <ton@blender.org>
Thu, 8 Dec 2005 15:05:14 +0000 (15:05 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 8 Dec 2005 15:05:14 +0000 (15:05 +0000)
- constraint buttons were drawing the hidden bone settings
- ctrl+I or 'Add constraint' didn't respect layers yet

source/blender/src/editconstraint.c
source/blender/src/poseobject.c

index dfca6144e625d488605662096b124b923e9db98e..ffa53cab4ce2f21f76e55c6db09f8a79de13ec14 100644 (file)
@@ -587,18 +587,20 @@ void add_constraint(int only_IK)
        
        /* paranoia checks */
        if(ob==NULL || ob==G.obedit) return;
-       
+
        if(ob->pose && (ob->flag & OB_POSEMODE)) {
-       
+               bArmature *arm= ob->data;
+               
                /* find active channel */
-               for(pchanact= ob->pose->chanbase.first; pchanact; pchanact= pchanact->next)
-                       if(pchanact->bone->flag & BONE_ACTIVE) break;
+               pchanact= get_active_posechannel(ob);
                if(pchanact==NULL) return;
        
                /* find selected bone */
                for(pchansel= ob->pose->chanbase.first; pchansel; pchansel= pchansel->next) {
                        if(pchansel!=pchanact)
-                               if(pchansel->bone->flag & BONE_SELECTED) break;
+                               if(pchansel->bone->flag & BONE_SELECTED) 
+                                       if(pchansel->bone->layer & arm->layer)
+                                               break;
                }
        }
        
index 45cfe9c6ebab210e90304570c52b21f9912f6dde..8b749b809c0b218bc77d34b2115416cfa0397877 100644 (file)
@@ -158,11 +158,12 @@ void exit_posemode(void)
 /* called by buttons to find a bone to display/edit values for */
 bPoseChannel *get_active_posechannel (Object *ob)
 {
+       bArmature *arm= ob->data;
        bPoseChannel *pchan;
        
        /* find active */
        for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-               if(pchan->bone && (pchan->bone->flag & BONE_ACTIVE))
+               if(pchan->bone && (pchan->bone->flag & BONE_ACTIVE) && (pchan->bone->layer & arm->layer))
                        return pchan;
        }