[Bf-blender-cvs] [808c6e3] input_method_editor: Cleanup: ints/shorts -> bool.

Bastien Montagne noreply at git.blender.org
Mon Nov 24 00:45:10 CET 2014


Commit: 808c6e383bb10fa1181aea1cec8d255bf2ce6a38
Author: Bastien Montagne
Date:   Thu Nov 20 20:23:13 2014 +0100
Branches: input_method_editor
https://developer.blender.org/rB808c6e383bb10fa1181aea1cec8d255bf2ce6a38

Cleanup: ints/shorts -> bool.

===================================================================

M	source/blender/editors/animation/keyframing.c
M	source/blender/editors/armature/pose_lib.c
M	source/blender/editors/include/ED_keyframing.h

===================================================================

diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 2c66d92..7e2ce4c 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -658,7 +658,7 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
 	
 	/* validate data */
 	if (ELEM(NULL, ptr, ptr->data, prop))
-		return 0;
+		return false;
 	
 	/* get first constraint and determine type of keyframe constraints to check for 
 	 *  - constraints can be on either Objects or PoseChannels, so we only check if the
@@ -880,7 +880,7 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
 	/* no F-Curve to add keyframe to? */
 	if (fcu == NULL) {
 		BKE_report(reports, RPT_ERROR, "No F-Curve to add keyframes to");
-		return 0;
+		return false;
 	}
 	/* F-Curve not editable? */
 	if (fcurve_is_keyframable(fcu) == 0) {
@@ -888,13 +888,13 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
 		            "F-Curve with path '%s[%d]' cannot be keyframed, ensure that it is not locked or sampled, "
 		            "and try removing F-Modifiers",
 		            fcu->rna_path, fcu->array_index);
-		return 0;
+		return false;
 	}
 	
 	/* if no property given yet, try to validate from F-Curve info */
 	if ((ptr.id.data == NULL) && (ptr.data == NULL)) {
 		BKE_report(reports, RPT_ERROR, "No RNA pointer available to retrieve values for keyframing from");
-		return 0;
+		return false;
 	}
 	if (prop == NULL) {
 		PointerRNA tmp_ptr;
@@ -907,7 +907,7 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
 			BKE_reportf(reports, RPT_ERROR,
 			            "Could not insert keyframe, as RNA path is invalid for the given ID (ID = %s, path = %s)",
 			            idname, fcu->rna_path);
-			return 0;
+			return false;
 		}
 		else {
 			/* property found, so overwrite 'ptr' to make later code easier */
@@ -956,18 +956,18 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
 		
 		/* only return success if keyframe added */
 		if (insert_mode)
-			return 1;
+			return true;
 	}
 	else {
 		/* just insert keyframe */
 		insert_vert_fcurve(fcu, cfra, curval, flag);
 		
 		/* return success */
-		return 1;
+		return true;
 	}
 	
 	/* failed */
-	return 0;
+	return false;
 }
 
 /* Main Keyframing API call:
@@ -1284,10 +1284,10 @@ static int modify_key_op_poll(bContext *C)
 	
 	/* if no area or active scene */
 	if (ELEM(NULL, sa, scene)) 
-		return 0;
+		return false;
 	
 	/* should be fine */
-	return 1;
+	return true;
 }
 
 /* Insert Key Operator ------------------------ */
@@ -1922,17 +1922,17 @@ void ANIM_OT_keyframe_clear_button(wmOperatorType *ot)
 /* ******************************************* */
 /* AUTO KEYFRAME */
 
-int autokeyframe_cfra_can_key(Scene *scene, ID *id)
+bool autokeyframe_cfra_can_key(Scene *scene, ID *id)
 {
 	float cfra = (float)CFRA; // XXX for now, this will do
 	
 	/* only filter if auto-key mode requires this */
 	if (IS_AUTOKEY_ON(scene) == 0)
-		return 0;
+		return false;
 		
 	if (IS_AUTOKEY_MODE(scene, NORMAL)) {
 		/* can insert anytime we like... */
-		return 1;
+		return true;
 	}
 	else { /* REPLACE */
 		/* for whole block - only key if there's a keyframe on that frame already
@@ -1952,7 +1952,7 @@ bool fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
 {
 	/* quick sanity check */
 	if (ELEM(NULL, fcu, fcu->bezt))
-		return 0;
+		return false;
 	
 	/* we either include all regardless of muting, or only non-muted  */
 	if ((filter & ANIMFILTER_KEYS_MUTED) || (fcu->flag & FCURVE_MUTED) == 0) {
@@ -1965,11 +1965,11 @@ bool fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
 		if (replace) {
 			/* sanity check: 'i' may in rare cases exceed arraylen */
 			if ((i >= 0) && (i < fcu->totvert))
-				return 1;
+				return true;
 		}
 	}
 	
-	return 0;
+	return false;
 }
 
 /* Checks whether an Action has a keyframe for a given frame 
@@ -1981,11 +1981,11 @@ static bool action_frame_has_keyframe(bAction *act, float frame, short filter)
 	
 	/* can only find if there is data */
 	if (act == NULL)
-		return 0;
+		return false;
 		
 	/* if only check non-muted, check if muted */
 	if ((filter & ANIMFILTER_KEYS_MUTED) || (act->flag & ACT_MUTED))
-		return 0;
+		return false;
 	
 	/* loop over F-Curves, using binary-search to try to find matches 
 	 *	- this assumes that keyframes are only beztriples
@@ -1994,12 +1994,12 @@ static bool action_frame_has_keyframe(bAction *act, float frame, short filter)
 		/* only check if there are keyframes (currently only of type BezTriple) */
 		if (fcu->bezt && fcu->totvert) {
 			if (fcurve_frame_has_keyframe(fcu, frame, filter))
-				return 1;
+				return true;
 		}
 	}
 	
 	/* nothing found */
-	return 0;
+	return false;
 }
 
 /* Checks whether an Object has a keyframe for a given frame */
@@ -2007,7 +2007,7 @@ static bool object_frame_has_keyframe(Object *ob, float frame, short filter)
 {
 	/* error checking */
 	if (ob == NULL)
-		return 0;
+		return false;
 	
 	/* check own animation data - specifically, the action it contains */
 	if ((ob->adt) && (ob->adt->action)) {
@@ -2018,7 +2018,7 @@ static bool object_frame_has_keyframe(Object *ob, float frame, short filter)
 		float ob_frame = BKE_nla_tweakedit_remap(ob->adt, frame, NLATIME_CONVERT_UNMAP);
 		
 		if (action_frame_has_keyframe(ob->adt->action, ob_frame, filter))
-			return 1;
+			return true;
 	}
 	
 	/* try shapekey keyframes (if available, and allowed by filter) */
@@ -2031,7 +2031,7 @@ static bool object_frame_has_keyframe(Object *ob, float frame, short filter)
 		 
 		/* 1. test for relative (with keyframes) */
 		if (id_frame_has_keyframe((ID *)key, frame, filter))
-			return 1;
+			return true;
 
 		/* 2. test for time */
 		/* TODO... yet to be implemented (this feature may evolve before then anyway) */
@@ -2045,7 +2045,7 @@ static bool object_frame_has_keyframe(Object *ob, float frame, short filter)
 			
 			/* we only retrieve the active material... */
 			if (id_frame_has_keyframe((ID *)ma, frame, filter))
-				return 1;
+				return true;
 		}
 		else {
 			int a;
@@ -2055,13 +2055,13 @@ static bool object_frame_has_keyframe(Object *ob, float frame, short filter)
 				Material *ma = give_current_material(ob, a + 1);
 				
 				if (id_frame_has_keyframe((ID *)ma, frame, filter))
-					return 1;
+					return true;
 			}
 		}
 	}
 	
 	/* nothing found */
-	return 0;
+	return false;
 }
 
 /* --------------- API ------------------- */
@@ -2071,7 +2071,7 @@ bool id_frame_has_keyframe(ID *id, float frame, short filter)
 {
 	/* sanity checks */
 	if (id == NULL)
-		return 0;
+		return false;
 	
 	/* perform special checks for 'macro' types */
 	switch (GS(id->name)) {
@@ -2095,7 +2095,7 @@ bool id_frame_has_keyframe(ID *id, float frame, short filter)
 	
 	
 	/* no keyframe found */
-	return 0;
+	return false;
 }
 
 /* ************************************************** */
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 15e7098..2e6eace 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -916,7 +916,7 @@ static void poselib_keytag_pose(bContext *C, Scene *scene, tPoseLib_PreviewData
 	
 	KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_WHOLE_CHARACTER_ID);
 	ListBase dsources = {NULL, NULL};
-	short autokey = autokeyframe_cfra_can_key(scene, &pld->ob->id);
+	bool autokey = autokeyframe_cfra_can_key(scene, &pld->ob->id);
 	
 	/* start tagging/keying */
 	for (agrp = act->groups.first; agrp; agrp = agrp->next) {
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index 5c7b3c5..e5b5e79 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -293,7 +293,7 @@ bool ANIM_paste_driver(struct ReportList *reports, struct ID *id, const char rna
 		(U.autokey_flag & AUTOKEY_FLAG_##flag))
 
 /* auto-keyframing feature - checks for whether anything should be done for the current frame */
-int autokeyframe_cfra_can_key(struct Scene *scene, struct ID *id);
+bool autokeyframe_cfra_can_key(struct Scene *scene, struct ID *id);
 
 /* ************ Keyframe Checking ******************** */




More information about the Bf-blender-cvs mailing list