Two in one:
[blender.git] / source / blender / src / editconstraint.c
index 10a930b9ebc457bc2021761f42a8ce51b466cc21..bb921906d55bfe28541746a5ad9fb34eb5a34eb5 100644 (file)
@@ -619,6 +619,12 @@ void add_constraint(int only_IK)
                pchanact= get_active_posechannel(ob);
                if(pchanact==NULL) return;
        
+               /* check protection */
+               if(ob->proxy && (pchanact->bone->layer & arm->layer_protected)) {
+                       error("Bone is Proxy protected");
+                       return;
+               }
+               
                /* find selected bone */
                for(pchansel= ob->pose->chanbase.first; pchansel; pchansel= pchansel->next) {
                        if(pchansel!=pchanact)
@@ -653,11 +659,11 @@ void add_constraint(int only_IK)
        else {
                if(pchanact) {
                        if(pchansel)
-                               nr= pupmenu("Add Constraint to Active Bone%t|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7");
+                               nr= pupmenu("Add Constraint to Active Bone%t|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7|Action%x16");
                        else if(obsel && obsel->type==OB_CURVE)
-                               nr= pupmenu("Add Constraint to Active Object%t|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Track To%x3|Floor%x4|Locked Track%x5|Follow Path%x6|Stretch To%x7");
+                               nr= pupmenu("Add Constraint to Active Object%t|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Track To%x3|Floor%x4|Locked Track%x5|Follow Path%x6|Stretch To%x7|Action%x16");
                        else if(obsel)
-                               nr= pupmenu("Add Constraint to Active Object%t|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7");
+                               nr= pupmenu("Add Constraint to Active Object%t|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7|Action%x16");
                        else
                                nr= pupmenu("Add Constraint to New Empty Object%t|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7");
                }
@@ -721,6 +727,7 @@ void add_constraint(int only_IK)
                else if(nr==13) con = add_new_constraint(CONSTRAINT_TYPE_LOCLIMIT);
                else if(nr==14) con = add_new_constraint(CONSTRAINT_TYPE_ROTLIMIT);
                else if(nr==15) con = add_new_constraint(CONSTRAINT_TYPE_SIZELIMIT);
+               else if(nr==16) con = add_new_constraint(CONSTRAINT_TYPE_ACTION);
                
                if(con==NULL) return;   /* paranoia */
                
@@ -742,7 +749,7 @@ void add_constraint(int only_IK)
        else if(obsel) {
                set_constraint_target(con, obsel, NULL);
        }
-       else if(nr!=11) {       /* add new empty as target */
+       else if(ELEM4(nr, 11, 13, 14, 15)==0) { /* add new empty as target */
                Base *base= BASACT, *newbase;
                Object *obt;
                
@@ -824,7 +831,7 @@ void rename_constraint(Object *ob, bConstraint *con, char *oldname)
        bConstraintChannel *conchan;
        ListBase *conlist= NULL;
        int from_object= 0;
-       char *channame;
+       char *channame="";
        
        /* get context by searching for con (primitive...) */
        for(tcon= ob->constraints.first; tcon; tcon= tcon->next)