Code cleanup: use bool

This commit is contained in:
Campbell Barton 2014-03-31 23:39:08 +11:00
parent 847b7bcbea
commit 097a3756c0
25 changed files with 38 additions and 38 deletions

@ -469,7 +469,7 @@ int nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock,
struct bNodeLink *nodeFindLink(struct bNodeTree *ntree, struct bNodeSocket *from, struct bNodeSocket *to);
int nodeCountSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
void nodeSetSelected(struct bNode *node, int select);
void nodeSetSelected(struct bNode *node, bool select);
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node);
struct bNode *nodeGetActive(struct bNodeTree *ntree);
struct bNode *nodeGetActiveID(struct bNodeTree *ntree, short idtype);
@ -520,7 +520,7 @@ int BKE_node_instance_hash_size(bNodeInstanceHash *hash);
void BKE_node_instance_hash_clear_tags(bNodeInstanceHash *hash);
void BKE_node_instance_hash_tag(bNodeInstanceHash *hash, void *value);
int BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey key);
bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey key);
void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash, bNodeInstanceValueFP valfreefp);
typedef GHashIterator bNodeInstanceHashIterator;

@ -55,7 +55,7 @@ void BKE_object_workob_clear(struct Object *workob);
void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src);
struct SoftBody *copy_softbody(struct SoftBody *sb, int copy_caches);
struct SoftBody *copy_softbody(struct SoftBody *sb, bool copy_caches);
struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb);
void BKE_object_copy_particlesystems(struct Object *obn, struct Object *ob);
void BKE_object_copy_softbody(struct Object *obn, struct Object *ob);

@ -331,7 +331,7 @@ bool BKE_sequence_is_valid_check(struct Sequence *seq);
void BKE_sequencer_clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce);
struct Sequence *BKE_sequence_get_by_name(struct ListBase *seqbase, const char *name, int recursive);
struct Sequence *BKE_sequence_get_by_name(struct ListBase *seqbase, const char *name, bool recursive);
/* api for adding new sequence strips */
typedef struct SeqLoadInfo {

@ -2425,7 +2425,7 @@ void nodeClearActiveID(bNodeTree *ntree, short idtype)
node->flag &= ~NODE_ACTIVE_ID;
}
void nodeSetSelected(bNode *node, int select)
void nodeSetSelected(bNode *node, bool select)
{
if (select) {
node->flag |= NODE_SELECT;
@ -2757,7 +2757,7 @@ void BKE_node_instance_hash_tag(bNodeInstanceHash *UNUSED(hash), void *value)
entry->tag = 1;
}
int BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey key)
bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey key)
{
bNodeInstanceHashEntry *entry = BKE_node_instance_hash_lookup(hash, key);

@ -1181,7 +1181,7 @@ struct Object *BKE_object_lod_matob_get(Object *ob, Scene *scene)
return lod_ob_get(ob, scene, OB_LOD_USE_MAT);
}
SoftBody *copy_softbody(SoftBody *sb, int copy_caches)
SoftBody *copy_softbody(SoftBody *sb, bool copy_caches)
{
SoftBody *sbn;

@ -4109,7 +4109,7 @@ static void seq_free_animdata(Scene *scene, Sequence *seq)
}
}
Sequence *BKE_sequence_get_by_name(ListBase *seqbase, const char *name, int recursive)
Sequence *BKE_sequence_get_by_name(ListBase *seqbase, const char *name, bool recursive)
{
Sequence *iseq = NULL;
Sequence *rseq = NULL;

@ -41,8 +41,8 @@ typedef enum strCursorJumpDirection {
STRCUR_DIR_NEXT
} strCursorJumpDirection;
int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos);
int BLI_str_cursor_step_prev_utf8(const char *str, size_t maxlen, int *pos);
bool BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos);
bool BLI_str_cursor_step_prev_utf8(const char *str, size_t maxlen, int *pos);
void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
int *pos, strCursorJumpDirection direction,

@ -116,7 +116,7 @@ static strCursorDelimType cursor_delim_type_utf8(const char *ch_utf8)
return cursor_delim_type_unicode(uch);
}
int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
bool BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
{
const char *str_end = str + (maxlen + 1);
const char *str_pos = str + (*pos);
@ -132,7 +132,7 @@ int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
return FALSE;
}
int BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int *pos)
bool BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int *pos)
{
if ((*pos) > 0) {
const char *str_pos = str + (*pos);

@ -843,7 +843,7 @@ static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_i
* the keyframe insertion. These include the 'visual' keyframing modes, quick refresh,
* and extra keyframe filtering.
*/
short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float cfra, short flag)
bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float cfra, short flag)
{
float curval = 0.0f;
@ -2049,7 +2049,7 @@ short id_frame_has_keyframe(ID *id, float frame, short filter)
/* ************************************************** */
int ED_autokeyframe_object(bContext *C, Scene *scene, Object *ob, KeyingSet *ks)
bool ED_autokeyframe_object(bContext *C, Scene *scene, Object *ob, KeyingSet *ks)
{
/* auto keyframing */
if (autokeyframe_cfra_can_key(scene, &ob->id)) {
@ -2071,7 +2071,7 @@ int ED_autokeyframe_object(bContext *C, Scene *scene, Object *ob, KeyingSet *ks)
}
}
int ED_autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks)
bool ED_autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks)
{
if (autokeyframe_cfra_can_key(scene, &ob->id)) {
ListBase dsources = {NULL, NULL};

@ -200,7 +200,7 @@ void ED_armature_origin_set(Scene *scene, Object *ob, float cursor[3], int cente
/* adjust bone roll to align Z axis with vector
* vec is in local space and is normalized
*/
float ED_rollBoneToVector(EditBone *bone, const float align_axis[3], const short axis_only)
float ED_rollBoneToVector(EditBone *bone, const float align_axis[3], const bool axis_only)
{
float mat[3][3], nor[3];

@ -235,7 +235,7 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i
}
}
static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, int mirror)
static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, bool mirror)
{
/* This functions implements the automatic computation of vertex group
* weights, either through envelopes or using a heat equilibrium.
@ -415,7 +415,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob,
MEM_freeN(verts);
}
void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par, int mode, int mirror)
void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par, int mode, bool mirror)
{
/* Lets try to create some vertex groups
* based on the bones of the parent armature.

@ -741,7 +741,7 @@ void draw_gpencil_2dimage(const bContext *C)
/* draw grease-pencil sketches to specified 2d-view assuming that matrices are already set correctly
* Note: this gets called twice - first time with onlyv2d=1 to draw 'canvas' strokes,
* second time with onlyv2d=0 for screen-aligned strokes */
void draw_gpencil_view2d(const bContext *C, short onlyv2d)
void draw_gpencil_view2d(const bContext *C, bool onlyv2d)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);

@ -127,7 +127,7 @@ int ED_do_pose_selectbuffer(struct Scene *scene, struct Base *base, unsigned int
bool mouse_armature(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
int join_armature_exec(struct bContext *C, struct wmOperator *op);
struct Bone *get_indexed_bone(struct Object *ob, int index);
float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const short axis_only);
float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const bool axis_only);
EditBone *ED_armature_bone_find_name(const ListBase *edbo, const char *name);
EditBone *ED_armature_bone_get_mirrored(const struct ListBase *edbo, EditBone *ebo);
void ED_armature_sync_selection(struct ListBase *edbo);
@ -154,7 +154,7 @@ void ED_armature_transform(struct bArmature *arm, float mat[4][4]);
#define ARM_GROUPS_ENVELOPE 2
#define ARM_GROUPS_AUTO 3
void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror);
void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct Object *par, int mode, bool mirror);
void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone); /* if bone is already in list, pass it as param to ignore it */
void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const char *newnamep);

@ -78,7 +78,7 @@ void ED_operatortypes_gpencil(void);
/* drawgpencil.c */
void draw_gpencil_2dimage(const struct bContext *C);
void draw_gpencil_view2d(const struct bContext *C, short onlyv2d);
void draw_gpencil_view2d(const struct bContext *C, bool onlyv2d);
void draw_gpencil_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, bool only3d);
void gpencil_panel_standard_header(const struct bContext *C, struct Panel *pa);

@ -75,7 +75,7 @@ bool ED_space_image_check_show_maskedit(struct Scene *scene, struct SpaceImage *
int ED_space_image_maskedit_poll(struct bContext *C);
int ED_space_image_maskedit_mask_poll(struct bContext *C);
void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, int color_manage, int use_default_view, int channels, int x, int y,
void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, bool color_manage, bool use_default_view, int channels, int x, int y,
const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf);
#endif /* __ED_IMAGE_H__ */

@ -108,7 +108,7 @@ int insert_vert_fcurve(struct FCurve *fcu, float x, float y, short flag);
* Use this to insert a keyframe using the current value being keyframed, in the
* nominated F-Curve (no creation of animation data performed). Returns success.
*/
short insert_keyframe_direct(struct ReportList *reports, struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float cfra, short flag);
bool insert_keyframe_direct(struct ReportList *reports, struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float cfra, short flag);
/* -------- */
@ -324,8 +324,8 @@ typedef enum eAnimFilterFlags {
} eAnimFilterFlags;
/* utility funcs for auto keyframe */
int ED_autokeyframe_object(struct bContext *C, struct Scene *scene, struct Object *ob, struct KeyingSet *ks);
int ED_autokeyframe_pchan(struct bContext *C, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct KeyingSet *ks);
bool ED_autokeyframe_object(struct bContext *C, struct Scene *scene, struct Object *ob, struct KeyingSet *ks);
bool ED_autokeyframe_pchan(struct bContext *C, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct KeyingSet *ks);
/* Names for builtin keying sets so we don't confuse these with labels/text,
* defined in python script: keyingsets_builtins.py */

@ -108,7 +108,7 @@ void ED_node_composite_job(const struct bContext *C, struct bNodeTree *nodetree,
void ED_operatormacros_node(void);
/* node_view.c */
int ED_space_node_color_sample(struct SpaceNode *snode, struct ARegion *ar, int mval[2], float r_col[3]);
bool ED_space_node_color_sample(struct SpaceNode *snode, struct ARegion *ar, int mval[2], float r_col[3]);
#endif /* __ED_NODE_H__ */

@ -110,7 +110,7 @@ void ED_keymap_proportional_cycle(struct wmKeyConfig *keyconf, struct wmKeyMap *
void ED_keymap_proportional_obmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
void ED_keymap_proportional_maskmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
void ED_keymap_proportional_editmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap,
const short do_connected);
const bool do_connected);
/* send your own notifier for select! */
void ED_base_object_select(struct Base *base, short mode);

@ -473,7 +473,7 @@ void ED_keymap_proportional_maskmode(struct wmKeyConfig *UNUSED(keyconf), struct
}
void ED_keymap_proportional_editmode(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap,
const short do_connected)
const bool do_connected)
{
wmKeyMapItem *kmi;

@ -3558,7 +3558,7 @@ static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss)
* \param need_mask So the DerivedMesh thats returned has mask data
*/
void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
int need_pmap, int need_mask)
bool need_pmap, bool need_mask)
{
DerivedMesh *dm;
SculptSession *ss = ob->sculpt;

@ -60,7 +60,7 @@ int sculpt_mode_poll_view3d(struct bContext *C);
int sculpt_poll(struct bContext *C);
int sculpt_poll_view3d(struct bContext *C);
void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob,
int need_pmap, int need_mask);
bool need_pmap, bool need_mask);
/* Stroke */
bool sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2]);
@ -111,7 +111,7 @@ typedef struct SculptUndoNode {
/* bmesh */
struct BMLogEntry *bm_entry;
int applied;
bool applied;
CustomData bm_enter_vdata;
CustomData bm_enter_edata;
CustomData bm_enter_ldata;

@ -162,7 +162,7 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar, float zoomx,
}
/* used by node view too */
void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_default_view, int channels, int x, int y,
void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_default_view, int channels, int x, int y,
const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf)
{
rcti color_rect;
@ -639,7 +639,7 @@ static void draw_image_buffer_repeated(const bContext *C, SpaceImage *sima, AReg
/* draw uv edit */
/* draw grease pencil */
void draw_image_grease_pencil(bContext *C, short onlyv2d)
void draw_image_grease_pencil(bContext *C, bool onlyv2d)
{
/* draw in View2D space? */
if (onlyv2d) {

@ -53,7 +53,7 @@ extern const char *image_context_dir[]; /* doc access */
/* image_draw.c */
void draw_image_main(const struct bContext *C, struct ARegion *ar);
void draw_image_grease_pencil(struct bContext *C, short onlyv2d);
void draw_image_grease_pencil(struct bContext *C, bool onlyv2d);
void draw_image_sample_line(struct SpaceImage *sima);
/* image_ops.c */

@ -419,7 +419,7 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
/* returns color in SRGB */
/* matching ED_space_image_color_sample() */
int ED_space_node_color_sample(SpaceNode *snode, ARegion *ar, int mval[2], float r_col[3])
bool ED_space_node_color_sample(SpaceNode *snode, ARegion *ar, int mval[2], float r_col[3])
{
void *lock;
Image *ima;

@ -312,8 +312,8 @@ enum {
#define ISHOTKEY(event_type) \
((ISKEYBOARD(event_type) || ISMOUSE(event_type) || ISNDOF(event_type)) && \
(event_type != ESCKEY) && \
(event_type >= LEFTCTRLKEY && event_type <= LEFTSHIFTKEY) == FALSE && \
(event_type >= UNKNOWNKEY && event_type <= GRLESSKEY) == FALSE)
(event_type >= LEFTCTRLKEY && event_type <= LEFTSHIFTKEY) == false && \
(event_type >= UNKNOWNKEY && event_type <= GRLESSKEY) == false)
/* **************** BLENDER GESTURE EVENTS (0x5000) **************** */