Code cleanup: use r_ prefix for return args
[blender.git] / source / blender / editors / object / object_constraint.c
index 23a17f2656911ba823f5e7feb9ef0030ac8c64c2..1e7e543ccb8c44cce72168a3955358098046a148 100644 (file)
@@ -105,10 +105,10 @@ ListBase *get_active_constraints(Object *ob)
 }
 
 /* Find the list that a given constraint belongs to, and/or also get the posechannel this is from (if applicable) */
-ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **pchan_r)
+ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **r_pchan)
 {
-       if (pchan_r)
-               *pchan_r = NULL;
+       if (r_pchan)
+               *r_pchan = NULL;
        
        if (ELEM(NULL, ob, con))
                return NULL;
@@ -128,8 +128,8 @@ ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **pchan_r
                for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
                        if ((BLI_findindex(&pchan->constraints, con) != -1)) {
                                
-                               if (pchan_r)
-                                       *pchan_r = pchan;
+                               if (r_pchan)
+                                       *r_pchan = pchan;
                                
                                return &pchan->constraints;
                        }
@@ -542,7 +542,7 @@ static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type)
        PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", rna_type);
        Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
 
-       if (!ob || ob->id.lib) return 0;
+       if (!ptr.data || !ob || ob->id.lib) return 0;
        if (ptr.id.data && ((ID *)ptr.id.data)->lib) return 0;
 
        return 1;
@@ -1171,7 +1171,7 @@ static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op))
        Object *ob = ptr.id.data;
        bConstraint *con = ptr.data;
        ListBase *lb = get_constraint_lb(ob, con, NULL);
-       const short is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
+       const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
 
        /* free the constraint */
        if (BKE_remove_constraint(lb, con)) {
@@ -1613,7 +1613,7 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
 }
 
 /* used by add constraint operators to add the constraint required */
-static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, short setTarget)
+static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, const bool setTarget)
 {
        Main *bmain = CTX_data_main(C);
        bPoseChannel *pchan;
@@ -1907,7 +1907,7 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED
 static int pose_ik_add_exec(bContext *C, wmOperator *op)
 {
        Object *ob = CTX_data_active_object(C);
-       int with_targets = RNA_boolean_get(op->ptr, "with_targets");
+       const bool with_targets = RNA_boolean_get(op->ptr, "with_targets");
        
        /* add the constraint - all necessary checks should have been done by the invoke() callback already... */
        return constraint_add_exec(C, op, ob, get_active_constraints(ob), CONSTRAINT_TYPE_KINEMATIC, with_targets);