#define BLF_KERNING_VARS(_font, _has_kerning, _kern_mode) \
- const short _has_kerning = FT_HAS_KERNING((_font)->face); \
+ const bool _has_kerning = FT_HAS_KERNING((_font)->face); \
const FT_UInt _kern_mode = (_has_kerning == 0) ? 0 : \
(((_font)->flags & BLF_KERNING_DEFAULT) ? \
ft_kerning_default : FT_KERNING_UNFITTED) \
/* AnimData API */
/* Check if the given ID-block can have AnimData */
-short id_type_can_have_animdata(struct ID *id);
+bool id_type_can_have_animdata(struct ID *id);
/* Get AnimData from the given ID-block */
struct AnimData *BKE_animdata_from_id(struct ID *id);
struct AnimData *BKE_id_add_animdata(struct ID *id);
/* Set active action used by AnimData from the given ID-block */
-short BKE_animdata_set_action(struct ReportList *reports, struct ID *id, struct bAction *act);
+bool BKE_animdata_set_action(struct ReportList *reports, struct ID *id, struct bAction *act);
/* Free AnimData */
void BKE_free_animdata(struct ID *id);
struct AnimData *BKE_copy_animdata(struct AnimData *adt, const bool do_action);
/* Copy AnimData */
-int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const bool do_action);
+bool BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const bool do_action);
/* Copy AnimData Actions */
void BKE_copy_animdata_id_action(struct ID *id);
/* Fix all the paths for the the given ID + Action */
void BKE_action_fix_paths_rename(struct ID *owner_id, struct bAction *act, const char *prefix, const char *oldName,
- const char *newName, int oldSubscript, int newSubscript, int verify_paths);
+ const char *newName, int oldSubscript, int newSubscript, bool verify_paths);
/* Fix all the paths for the given ID+AnimData */
void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, struct ID *ref_id, const char *prefix,
const char *oldName, const char *newName, int oldSubscript, int newSubscript,
- int verify_paths);
+ bool verify_paths);
/* Fix all the paths for the entire database... */
void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const char *oldName, const char *newName);
/* ---------------------------------------------------------------------------- */
/* Callback format for performing operations on ID-pointers for Constraints */
-typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, short isReference, void *userdata);
+typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, bool is_reference, void *userdata);
/* ....... */
/* for multi-target constraints: return that list; otherwise make a temporary list (returns number of targets) */
int (*get_constraint_targets)(struct bConstraint *con, struct ListBase *list);
/* for single-target constraints only: flush data back to source data, and the free memory used */
- void (*flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, short nocopy);
+ void (*flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy);
/* evaluation */
/* set the ct->matrix for the given constraint target (at the given ctime) */
struct bConstraint *BKE_add_ob_constraint(struct Object *ob, const char *name, short type);
struct bConstraint *BKE_add_pose_constraint(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type);
-int BKE_remove_constraint(ListBase *list, struct bConstraint *con);
-void BKE_remove_constraints_type(ListBase *list, short type, short last_only);
+bool BKE_remove_constraint(ListBase *list, struct bConstraint *con);
+void BKE_remove_constraints_type(ListBase *list, short type, bool last_only);
/* Constraints + Proxies function prototypes */
void BKE_extract_proxylocal_constraints(struct ListBase *dst, struct ListBase *src);
-short BKE_proxylocked_constraints_owner(struct Object *ob, struct bPoseChannel *pchan);
+bool BKE_proxylocked_constraints_owner(struct Object *ob, struct bPoseChannel *pchan);
/* Constraint Evaluation function prototypes */
struct bConstraintOb *BKE_constraints_make_evalob(struct Scene *scene, struct Object *ob, void *subdata, short datatype);
bool BKE_nlastrips_has_space(ListBase *strips, float start, float end);
void BKE_nlastrips_sort_strips(ListBase *strips);
-short BKE_nlastrips_add_strip(ListBase *strips, struct NlaStrip *strip);
+bool BKE_nlastrips_add_strip(ListBase *strips, struct NlaStrip *strip);
-void BKE_nlastrips_make_metas(ListBase *strips, short temp);
-void BKE_nlastrips_clear_metas(ListBase *strips, short onlySel, short onlyTemp);
+void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp);
+void BKE_nlastrips_clear_metas(ListBase *strips, bool only_sel, bool only_temp);
void BKE_nlastrips_clear_metastrip(ListBase *strips, struct NlaStrip *strip);
-short BKE_nlameta_add_strip(struct NlaStrip *mstrip, struct NlaStrip *strip);
+bool BKE_nlameta_add_strip(struct NlaStrip *mstrip, struct NlaStrip *strip);
void BKE_nlameta_flush_transforms(struct NlaStrip *mstrip);
/* ............ */
bool BKE_nlatrack_has_space(struct NlaTrack *nlt, float start, float end);
void BKE_nlatrack_sort_strips(struct NlaTrack *nlt);
-short BKE_nlatrack_add_strip(struct NlaTrack *nlt, struct NlaStrip *strip);
+bool BKE_nlatrack_add_strip(struct NlaTrack *nlt, struct NlaStrip *strip);
-short BKE_nlatrack_get_bounds(struct NlaTrack *nlt, float bounds[2]);
+bool BKE_nlatrack_get_bounds(struct NlaTrack *nlt, float bounds[2]);
/* ............ */
struct NlaStrip *BKE_nlastrip_find_active(struct NlaTrack *nlt);
void BKE_nlastrip_set_active(struct AnimData *adt, struct NlaStrip *strip);
-short BKE_nlastrip_within_bounds(struct NlaStrip *strip, float min, float max);
+bool BKE_nlastrip_within_bounds(struct NlaStrip *strip, float min, float max);
void BKE_nlastrip_recalculate_bounds(struct NlaStrip *strip);
void BKE_nlastrip_validate_name(struct AnimData *adt, struct NlaStrip *strip);
/* ............ */
-short BKE_nlatrack_has_animated_strips(struct NlaTrack *nlt);
-short BKE_nlatracks_have_animated_strips(ListBase *tracks);
+bool BKE_nlatrack_has_animated_strips(struct NlaTrack *nlt);
+bool BKE_nlatracks_have_animated_strips(ListBase *tracks);
void BKE_nlastrip_validate_fcurves(struct NlaStrip *strip);
void BKE_nla_validate_state(struct AnimData *adt);
void BKE_nla_action_pushdown(struct AnimData *adt);
-short BKE_nla_tweakmode_enter(struct AnimData *adt);
+bool BKE_nla_tweakmode_enter(struct AnimData *adt);
void BKE_nla_tweakmode_exit(struct AnimData *adt);
/* ----------------------------- */
/* Getter/Setter -------------------------------------------- */
/* Check if ID can have AnimData */
-short id_type_can_have_animdata(ID *id)
+bool id_type_can_have_animdata(ID *id)
{
/* sanity check */
if (id == NULL)
/* Action Setter --------------------------------------- */
/* Called when user tries to change the active action of an AnimData block (via RNA, Outliner, etc.) */
-short BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act)
+bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act)
{
AnimData *adt = BKE_animdata_from_id(id);
- short ok = 0;
+ bool ok = false;
/* animdata validity check */
if (adt == NULL) {
return dadt;
}
-int BKE_copy_animdata_id(ID *id_to, ID *id_from, const bool do_action)
+bool BKE_copy_animdata_id(ID *id_to, ID *id_from, const bool do_action)
{
AnimData *adt;
/* Check if some given RNA Path needs fixing - free the given path and set a new one as appropriate
* NOTE: we assume that oldName and newName have [" "] padding around them
*/
-static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, char *oldpath, int verify_paths)
+static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, char *oldpath, bool verify_paths)
{
char *prefixPtr = strstr(oldpath, prefix);
char *oldNamePtr = strstr(oldpath, oldName);
/* Check RNA-Paths for a list of F-Curves */
static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
- const char *oldKey, const char *newKey, ListBase *curves, int verify_paths)
+ const char *oldKey, const char *newKey, ListBase *curves, bool verify_paths)
{
FCurve *fcu;
/* Check RNA-Paths for a list of Drivers */
static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix, const char *oldName, const char *newName,
- const char *oldKey, const char *newKey, ListBase *curves, int verify_paths)
+ const char *oldKey, const char *newKey, ListBase *curves, bool verify_paths)
{
FCurve *fcu;
/* Fix all RNA-Paths for Actions linked to NLA Strips */
static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
- const char *oldKey, const char *newKey, ListBase *strips, int verify_paths)
+ const char *oldKey, const char *newKey, ListBase *strips, bool verify_paths)
{
NlaStrip *strip;
* i.e. pose.bones["Bone"]
*/
void BKE_action_fix_paths_rename(ID *owner_id, bAction *act, const char *prefix, const char *oldName,
- const char *newName, int oldSubscript, int newSubscript, int verify_paths)
+ const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
{
char *oldN, *newN;
* i.e. pose.bones["Bone"]
*/
void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, const char *prefix, const char *oldName,
- const char *newName, int oldSubscript, int newSubscript, int verify_paths)
+ const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
{
NlaTrack *nlt;
char *oldN, *newN;
* - path: original path string (as stored in F-Curve data)
* - dst: destination string to write data to
*/
-static short animsys_remap_path(AnimMapper *UNUSED(remap), char *path, char **dst)
+static bool animsys_remap_path(AnimMapper *UNUSED(remap), char *path, char **dst)
{
/* is there a valid remapping table to use? */
#if 0
#define ANIMSYS_FLOAT_AS_BOOL(value) ((value) > ((1.0f - FLT_EPSILON)))
/* Write the given value to a setting using RNA, and return success */
-static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_index, float value)
+static bool animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_index, float value)
{
PropertyRNA *prop;
PointerRNA new_ptr;
}
/* Simple replacement based data-setting of the FCurve using RNA */
-static short animsys_execute_fcurve(PointerRNA *ptr, AnimMapper *remap, FCurve *fcu)
+static bool animsys_execute_fcurve(PointerRNA *ptr, AnimMapper *remap, FCurve *fcu)
{
char *path = NULL;
- short free_path = 0;
- short ok = 0;
+ bool free_path = false;
+ bool ok = false;
/* get path, remapped as appropriate to work in its new environment */
free_path = animsys_remap_path(remap, fcu->rna_path, &path);
*/
for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
ChannelDriver *driver = fcu->driver;
- short ok = 0;
+ bool ok = false;
/* check if this driver's curve should be skipped */
if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0) {
* (Hopefully all compilers will be happy with the lines with just a space on them. Those are
* really just to help this code easier to read)
*/
-#define SINGLETARGET_FLUSH_TARS(con, datatar, datasubtarget, ct, list, nocopy) \
+#define SINGLETARGET_FLUSH_TARS(con, datatar, datasubtarget, ct, list, no_copy) \
{ \
if (ct) { \
bConstraintTarget *ctn = ct->next; \
- if (nocopy == 0) { \
+ if (no_copy == 0) { \
datatar = ct->tar; \
BLI_strncpy(datasubtarget, ct->subtarget, sizeof(datasubtarget)); \
con->tarspace = (char)ct->space; \
* (Hopefully all compilers will be happy with the lines with just a space on them. Those are
* really just to help this code easier to read)
*/
-#define SINGLETARGETNS_FLUSH_TARS(con, datatar, ct, list, nocopy) \
+#define SINGLETARGETNS_FLUSH_TARS(con, datatar, ct, list, no_copy) \
{ \
if (ct) { \
bConstraintTarget *ctn = ct->next; \
- if (nocopy == 0) { \
+ if (no_copy == 0) { \
datatar = ct->tar; \
con->tarspace = (char)ct->space; \
} \
return 0;
}
-static void childof_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void childof_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bChildOfConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void trackto_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void trackto_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bTrackToConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void kinematic_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void kinematic_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bKinematicConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
- SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
+ SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, no_copy);
}
}
return 0;
}
-static void followpath_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void followpath_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bFollowPathConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy);
+ SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy);
}
}
return 0;
}
-static void loclike_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void loclike_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bLocateLikeConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void rotlike_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void rotlike_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bRotateLikeConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void sizelike_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void sizelike_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bSizeLikeConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void translike_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void translike_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bTransLikeConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void actcon_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void actcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bActionConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void locktrack_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void locktrack_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bLockTrackConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void distlimit_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void distlimit_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bDistLimitConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void stretchto_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void stretchto_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bStretchToConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void minmax_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void minmax_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bMinMaxConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void rbj_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void rbj_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bRigidBodyJointConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy);
+ SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy);
}
}
return 0;
}
-static void clampto_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void clampto_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bClampToConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy);
+ SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy);
}
}
return 0;
}
-static void transform_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void transform_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bTransformConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
}
-static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bShrinkwrapConstraint *data = con->data;
bConstraintTarget *ct = list->first;
- SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, nocopy);
+ SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, no_copy);
}
}
return 0;
}
-static void damptrack_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void damptrack_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bDampTrackConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
return 0;
}
-static void splineik_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void splineik_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bSplineIKConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy);
+ SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy);
}
}
return 0;
}
-static void pivotcon_flush_tars(bConstraint *con, ListBase *list, short nocopy)
+static void pivotcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
{
if (con && list) {
bPivotConstraint *data = con->data;
bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
- SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy);
+ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
}
/* ---------- Data Management ------- */
/* helper function for BKE_free_constraint_data() - unlinks references */
-static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *UNUSED(userData))
+static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *UNUSED(userData))
{
- if (*idpoin && isReference)
+ if (*idpoin && is_reference)
id_us_min(*idpoin);
}
/* Remove the specified constraint from the given constraint stack */
-int BKE_remove_constraint(ListBase *list, bConstraint *con)
+bool BKE_remove_constraint(ListBase *list, bConstraint *con)
{
if (con) {
BKE_free_constraint_data(con);
}
/* Remove all the constraints of the specified type from the given constraint stack */
-void BKE_remove_constraints_type(ListBase *list, short type, short last_only)
+void BKE_remove_constraints_type(ListBase *list, short type, bool last_only)
{
bConstraint *con, *conp;
/* ......... */
/* helper for BKE_relink_constraints() - call ID_NEW() on every ID reference the constraint has */
-static void con_relink_id_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *UNUSED(userdata))
+static void con_relink_id_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *UNUSED(userdata))
{
/* ID_NEW() expects a struct with inline "id" member as first
* since we've got the actual ID block, let's just inline this
/* ......... */
/* helper for BKE_copy_constraints(), to be used for making sure that ID's are valid */
-static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *UNUSED(userData))
+static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *UNUSED(userData))
{
if (*idpoin && (*idpoin)->lib)
id_lib_extern(*idpoin);
}
/* helper for BKE_copy_constraints(), to be used for making sure that usercounts of copied ID's are fixed up */
-static void con_fix_copied_refs_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *UNUSED(userData))
+static void con_fix_copied_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *UNUSED(userData))
{
/* increment usercount if this is a reference type */
- if ((*idpoin) && (isReference))
+ if ((*idpoin) && (is_reference))
id_us_plus(*idpoin);
}
}
/* Returns if the owner of the constraint is proxy-protected */
-short BKE_proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan)
+bool BKE_proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan)
{
/* Currently, constraints can only be on object or bone level */
if (ob && ob->proxy) {
*/
void sort_time_fcurve(FCurve *fcu)
{
- short ok = 1;
+ bool ok = true;
/* keep adjusting order of beztriples until nothing moves (bubble-sort) */
while (ok) {
{
Main *bmain = G.main;
Object *ob;
- int is_local = false, is_lib = false;
+ bool is_local = false, is_lib = false;
/* - only lib users: do nothing
* - only local users: set flag
}
static void library_foreach_constraintObjectLooper(bConstraint *UNUSED(con), ID **id_pointer,
- short UNUSED(isReference), void *user_data)
+ bool UNUSED(is_reference), void *user_data)
{
LibraryForeachIDData *data = (LibraryForeachIDData *) user_data;
FOREACH_CALLBACK_INVOKE_ID_PP(data->self_id, id_pointer, data->flag, data->callback, data->user_data, IDWALK_NOP);
DispList *dl;
BoundBox *bb;
float *data, min[3], max[3] /*, loc[3], size[3] */;
- int tot, do_it = false;
+ int tot;
+ bool do_it = false;
if (ob->bb == NULL) ob->bb = MEM_callocN(sizeof(BoundBox), "mb boundbox");
bb = ob->bb;
}
for (i = 0, me = medges; i < totedge; i++, me++) {
- int remove = false;
+ bool remove = false;
if (me->v1 == me->v2) {
PRINT_ERR("\tEdge %u: has matching verts, both %u\n", i, me->v1);
remove = do_fixes;
PRINT_ERR("No Polys, only tesselated Faces\n");
for (i = 0, mf = mfaces, sf = sort_faces; i < totface; i++, mf++) {
- int remove = false;
+ bool remove = false;
int fidx;
unsigned int fv[4];
sf++;
for (i = 1; i < totsortface; i++, sf++) {
- int remove = false;
+ bool remove = false;
/* on a valid mesh, code below will never run */
if (memcmp(sf->es, sf_prev->es, sizeof(sf_prev->es)) == 0) {
/* Add the given NLA-Strip to the given list of strips, assuming that it
* isn't currently a member of another list
*/
-short BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip)
+bool BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip)
{
NlaStrip *ns;
- short not_added = 1;
+ bool not_added = true;
/* sanity checks */
if (ELEM(NULL, strips, strip))
* contained within 'Meta-Strips' which act as strips which contain strips.
* temp: are the meta-strips to be created 'temporary' ones used for transforms?
*/
-void BKE_nlastrips_make_metas(ListBase *strips, short temp)
+void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp)
{
NlaStrip *mstrip = NULL;
NlaStrip *strip, *stripn;
mstrip->flag = NLASTRIP_FLAG_SELECT;
/* set temp flag if appropriate (i.e. for transform-type editing) */
- if (temp)
+ if (is_temp)
mstrip->flag |= NLASTRIP_FLAG_TEMP_META;
/* set default repeat/scale values to prevent warnings */
* sel: only consider selected meta-strips, otherwise all meta-strips are removed
* onlyTemp: only remove the 'temporary' meta-strips used for transforms
*/
-void BKE_nlastrips_clear_metas(ListBase *strips, short onlySel, short onlyTemp)
+void BKE_nlastrips_clear_metas(ListBase *strips, bool only_sel, bool only_temp)
{
NlaStrip *strip, *stripn;
/* check if strip is a meta-strip */
if (strip->type == NLASTRIP_TYPE_META) {
/* if check if selection and 'temporary-only' considerations are met */
- if ((onlySel == 0) || (strip->flag & NLASTRIP_FLAG_SELECT)) {
- if ((!onlyTemp) || (strip->flag & NLASTRIP_FLAG_TEMP_META)) {
+ if ((!only_sel) || (strip->flag & NLASTRIP_FLAG_SELECT)) {
+ if ((!only_temp) || (strip->flag & NLASTRIP_FLAG_TEMP_META)) {
BKE_nlastrips_clear_metastrip(strips, strip);
}
}
/* Add the given NLA-Strip to the given Meta-Strip, assuming that the
* strip isn't attached to any list of strips
*/
-short BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip)
+bool BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip)
{
/* sanity checks */
if (ELEM(NULL, mstrip, strip))
/* Add the given NLA-Strip to the given NLA-Track, assuming that it
* isn't currently attached to another one
*/
-short BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip)
+bool BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip)
{
/* sanity checks */
if (ELEM(NULL, nlt, strip))
/* Get the extents of the given NLA-Track including gaps between strips,
* returning whether this succeeded or not
*/
-short BKE_nlatrack_get_bounds(NlaTrack *nlt, float bounds[2])
+bool BKE_nlatrack_get_bounds(NlaTrack *nlt, float bounds[2])
{
NlaStrip *strip;
/* Does the given NLA-strip fall within the given bounds (times)? */
-short BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max)
+bool BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max)
{
const float stripLen = (strip) ? strip->end - strip->start : 0.0f;
const float boundsLen = fabsf(max - min);
/* Animated Strips ------------------------------------------- */
/* Check if the given NLA-Track has any strips with own F-Curves */
-short BKE_nlatrack_has_animated_strips(NlaTrack *nlt)
+bool BKE_nlatrack_has_animated_strips(NlaTrack *nlt)
{
NlaStrip *strip;
}
/* Check if given NLA-Tracks have any strips with own F-Curves */
-short BKE_nlatracks_have_animated_strips(ListBase *tracks)
+bool BKE_nlatracks_have_animated_strips(ListBase *tracks)
{
NlaTrack *nlt;
/* Find the active strip + track combo, and set them up as the tweaking track,
* and return if successful or not.
*/
-short BKE_nla_tweakmode_enter(AnimData *adt)
+bool BKE_nla_tweakmode_enter(AnimData *adt)
{
NlaTrack *nlt, *activeTrack = NULL;
NlaStrip *strip, *activeStrip = NULL;
{
float tmat[4][4];
float vec[3];
- int ok;
+ bool ok;
switch (ob->partype & PARTYPE) {
case PAROBJECT:
bool pbvh_bmesh_node_raycast(PBVHNode *node, const float ray_start[3],
const float ray_normal[3], float *dist,
- int use_original)
+ bool use_original)
{
bool hit = false;
bool pbvh_bmesh_node_raycast(
PBVHNode *node, const float ray_start[3],
const float ray_normal[3], float *dist,
- int use_original);
+ bool use_original);
void pbvh_bmesh_normals_update(PBVHNode **nodes, int totnode);
**********************************************************/
/* set "ignore cache" flag for all caches on this object */
-static void object_cacheIgnoreClear(Object *ob, int state)
+static void object_cacheIgnoreClear(Object *ob, bool state)
{
ListBase pidlist;
PTCacheID *pid;
BLI_freelistN(&pidlist);
}
-static int subframe_updateObject(Scene *scene, Object *ob, int update_mesh, int parent_recursion, float frame, bool for_render)
+static bool subframe_updateObject(Scene *scene, Object *ob, int update_mesh, int parent_recursion, float frame, bool for_render)
{
SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
bConstraint *con;
/* if object has parents, update them too */
if (parent_recursion) {
int recursion = parent_recursion - 1;
- int is_domain = 0;
- if (ob->parent) is_domain += subframe_updateObject(scene, ob->parent, 0, recursion, frame, for_render);
- if (ob->track) is_domain += subframe_updateObject(scene, ob->track, 0, recursion, frame, for_render);
+ bool is_domain = false;
+ if (ob->parent) is_domain |= subframe_updateObject(scene, ob->parent, 0, recursion, frame, for_render);
+ if (ob->track) is_domain |= subframe_updateObject(scene, ob->track, 0, recursion, frame, for_render);
/* skip subframe if object is parented
* to vertex of a dynamic paint canvas */
}
}
-static void em_allocateData(EmissionMap *em, int use_velocity, int hires_mul)
+static void em_allocateData(EmissionMap *em, bool use_velocity, int hires_mul)
{
int i, res[3];
}
}
-static void sample_derivedmesh(SmokeFlowSettings *sfs, MVert *mvert, MTFace *tface, MFace *mface, float *influence_map, float *velocity_map, int index, int base_res[3], float flow_center[3], BVHTreeFromMesh *treeData, float ray_start[3],
- float *vert_vel, int has_velocity, int defgrp_index, MDeformVert *dvert, float x, float y, float z)
+static void sample_derivedmesh(
+ SmokeFlowSettings *sfs, MVert *mvert, MTFace *tface, MFace *mface,
+ float *influence_map, float *velocity_map, int index, int base_res[3], float flow_center[3],
+ BVHTreeFromMesh *treeData, const float ray_start[3], const float *vert_vel,
+ bool has_velocity, int defgrp_index, MDeformVert *dvert, float x, float y, float z)
{
float ray_dir[3] = {1.0f, 0.0f, 0.0f};
BVHTreeRayHit hit = {0};
* 2) within an identifier
* 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414]
*/
- int a, is_indent = 0;
+ int a;
+ bool is_indent = false;
for (a = 0; (a < text->curc) && (text->curl->line[a] != '\0'); a++) {
char ch = text->curl->line[a];
if (ch == '#') {
ScanFillVert *v_prev;
ScanFillVert *v_curr;
- int inside = false;
+ bool inside = false;
/* first vert */
#if 0
} FOREACH_NODETREE_END
{
- int has_old_groups = 0;
+ bool has_old_groups = false;
/* XXX this should actually be part of do_versions, but since we need
* finished library linking, it is not possible there. Instead in do_versions
* we have set the NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2 flag, so at this point we can do the
ID *id;
} tConstraintLinkData;
/* callback function used to relink constraint ID-links */
-static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *userdata)
+static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *userdata)
{
tConstraintLinkData *cld= (tConstraintLinkData *)userdata;
/* for reference types, we need to increment the usercounts on load... */
- if (isReference) {
+ if (is_reference) {
/* reference type - with usercount */
*idpoin = newlibadr_us(cld->fd, cld->id->lib, *idpoin);
}
Main *mainvar;
} tConstraintExpandData;
/* callback function used to expand constraint ID-links */
-static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *userdata)
+static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *userdata)
{
tConstraintExpandData *ced = (tConstraintExpandData *)userdata;
expand_doit(ced->fd, ced->mainvar, *idpoin);
BLI_array_declare(edges1);
BLI_array_declare(edges2);
BLI_array_declare(edges);
- int ok = 1;
+ bool ok = true;
int i, count;
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
* - setting: type of setting to set
* - on: whether the visibility setting has been enabled or disabled
*/
-void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on)
+void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short mode)
{
bAnimListElem *ale, *match = NULL;
int prevLevel = 0, matchLevel = 0;
* - only flush up if the current state is now disabled (negative 'off' state is default)
* (otherwise, it's too much work to force the parents to be active too)
*/
- if ( ((setting == ACHANNEL_SETTING_VISIBLE) && on) ||
- ((setting != ACHANNEL_SETTING_VISIBLE) && on == 0) )
+ if ( ((setting == ACHANNEL_SETTING_VISIBLE) && (mode != ACHANNEL_SETFLAG_CLEAR)) ||
+ ((setting != ACHANNEL_SETTING_VISIBLE) && (mode == ACHANNEL_SETFLAG_CLEAR)))
{
/* go backwards in the list, until the highest-ranking element (by indention has been covered) */
for (ale = match->prev; ale; ale = ale->prev) {
*/
if (level < prevLevel) {
/* flush the new status... */
- ANIM_channel_setting_set(ac, ale, setting, on);
+ ANIM_channel_setting_set(ac, ale, setting, mode);
/* store this level as the 'old' level now */
prevLevel = level;
* flush the new status...
*/
if (level > matchLevel)
- ANIM_channel_setting_set(ac, ale, setting, on);
+ ANIM_channel_setting_set(ac, ale, setting, mode);
/* however, if the level is 'less than or equal to' the channel that was changed,
* (i.e. the current channel is as important if not more important than the changed channel)
* then we should stop, since we've found the last one of the children we should flush
* - restore = whether to map points back to non-mapped time
* - only_keys = whether to only adjust the location of the center point of beztriples
*/
-void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, short restore, short only_keys)
+void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, bool only_keys)
{
KeyframeEditData ked = {{NULL}};
KeyframeEditFunc map_cb;
* assuming that the buffer has been cleared already with free_fmodifiers_copybuf()
* - active: only copy the active modifier
*/
-short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active)
+bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active)
{
- short ok = 1;
+ bool ok = true;
/* sanity checks */
if (ELEM(NULL, modifiers, modifiers->first))
/* 'Paste' the F-Modifier(s) from the buffer to the specified list
* - replace: free all the existing modifiers to leave only the pasted ones
*/
-short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace)
+bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace)
{
FModifier *fcm;
- short ok = 0;
+ bool ok = false;
/* sanity checks */
if (modifiers == NULL)
*/
#define KEYFRAME_OK_CHECKS(check) \
{ \
+ CHECK_TYPE(ok, short); \
if (check(1)) \
ok |= KEYFRAME_OK_KEY; \
\
/* if a selected or active bone is protected, throw error (oonly if warn == 1) and return 1 */
/* only_selected == 1: the active bone is allowed to be protected */
#if 0 /* UNUSED 2.5 */
-static short pose_has_protected_selected(Object *ob, short warn)
+static bool pose_has_protected_selected(Object *ob, short warn)
{
/* check protection */
if (ob->proxy) {
pchan = BKE_pose_channel_find_name(pose, agrp->name);
if (pchan) {
- short ok = 0;
+ bool ok = 0;
/* check if this bone should get any animation applied */
if (pld->selcount == 0) {
BezTriple *bezt;
BPoint *bp;
int a;
- short lastsel = false;
+ bool lastsel = false;
if (next == 0) return;
/******************* de select all operator ***************/
-static short nurb_has_selected_cps(ListBase *editnurb)
+static bool nurb_has_selected_cps(ListBase *editnurb)
{
Nurb *nu;
BezTriple *bezt;
Object *obedit = CTX_data_edit_object(C);
ListBase *editnurb = object_editcurve_get(obedit);
NurbSort *nus1, *nus2;
- int ok = 1;
+ bool ok = true;
make_selection_list_nurb(editnurb);
ListBase *nubase = object_editcurve_get(obedit);
Nurb *nu, *nu1 = NULL, *nu2 = NULL;
BPoint *bp;
- int ok = 0;
+ bool ok = false;
/* int a; */ /* UNUSED */
/* first decide if this is a surface merge! */
BezTriple *bezt, *newbezt = NULL;
BPoint *bp, *newbp = NULL;
float imat[4][4], temp[3];
- int ok = 0;
+ bool ok = false;
BezTriple *bezt_recalc[3] = {NULL};
invert_m4_m4(imat, obedit->obmat);
{0, NULL, 0, NULL, NULL}
};
-static int set_style(bContext *C, const int style, const int clear)
+static int set_style(bContext *C, const int style, const bool clear)
{
Object *obedit = CTX_data_edit_object(C);
Curve *cu = obedit->data;
static int set_style_exec(bContext *C, wmOperator *op)
{
const int style = RNA_enum_get(op->ptr, "style");
- const int clear = RNA_boolean_get(op->ptr, "clear");
+ const bool clear = RNA_boolean_get(op->ptr, "clear");
return set_style(C, style, clear);
}
* - setting: type of setting to set
* - on: whether the visibility setting has been enabled or disabled
*/
-void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on);
+void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short mode);
/* Deselect all animation channels */
* assuming that the buffer has been cleared already with free_fmodifiers_copybuf()
* - active: only copy the active modifier
*/
-short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active);
+bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active);
/* 'Paste' the F-Modifier(s) from the buffer to the specified list
* - replace: free all the existing modifiers to leave only the pasted ones
*/
-short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace);
+bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace);
/* ************************************************* */
/* ASSORTED TOOLS */
struct AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale);
/* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve */
-void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, short restore, short only_keys);
+void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, bool restore, bool only_keys);
/* ..... */
*/
int ui_is_but_push_ex(uiBut *but, double *value)
{
- int is_push = false;
+ int is_push = 0;
if (but->bit) {
const bool state = ELEM3(but->type, TOGN, ICONTOGN, OPTIONN) ? false : true;
static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, bool pad, int float_precision)
{
UnitSettings *unit = but->block->unit;
- int do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0;
+ const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0;
int unit_type = uiButGetUnitType(but);
int precision;
void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
{
rctf rect;
- int ok = 0, width, height;
+ bool ok = false;
+ int width, height;
GLint scissor[4];
MovieClipScopes *scopes = (MovieClipScopes *)but->poin;
{
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
- const int unselected = RNA_boolean_get(op->ptr, "unselected");
+ const bool unselected = RNA_boolean_get(op->ptr, "unselected");
bool changed = false;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskSpline *spline;
MaskSplinePoint *point = NULL;
float co[2];
- int do_select = !RNA_boolean_get(op->ptr, "deselect");
+ bool do_select = !RNA_boolean_get(op->ptr, "deselect");
const float threshold = 19;
bool changed = false;
void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag)
{
- int ok;
+ bool ok;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
ok = BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
BMVert *eve;
BMEdge *e, *eed;
BMFace *efa;
- int sel = !RNA_boolean_get(op->ptr, "deselect");
+ const bool sel = !RNA_boolean_get(op->ptr, "deselect");
int limit;
Mesh *me = obedit->data;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
ModifierData *md;
- int mirrx = false, mirry = false, mirrz = false;
+ bool mirrx = false, mirry = false, mirrz = false;
int i, repeat;
float clip_dist = 0.0f;
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
Mesh *me = obedit->data;
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
- int usex = true, usey = true, usez = true, preserve_volume = true;
+ bool usex = true, usey = true, usez = true, preserve_volume = true;
int i, repeat;
float lambda_factor;
float lambda_border;
DerivedMesh *dm = NULL;
Key *key = me->key;
KeyBlock *kb;
- int ok = 0, nonequal_verts = 0;
+ bool ok = false, nonequal_verts = false;
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
selme = (Mesh *)base->object->data;
if (selme->totvert == me->totvert)
- ok++;
+ ok = true;
else
nonequal_verts = 1;
}
Object *obedit = CTX_data_edit_object(C);
MetaBall *mb = (MetaBall *)obedit->data;
MetaElem *ml;
- const int invert = RNA_boolean_get(op->ptr, "unselected") ? SELECT : 0;
+ const bool invert = RNA_boolean_get(op->ptr, "unselected") ? SELECT : 0;
ml = mb->editelems->first;
/********************* Make Duplicates Real ************************/
static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
- const short use_base_parent,
- const short use_hierarchy)
+ const bool use_base_parent,
+ const bool use_hierarchy)
{
Main *bmain = CTX_data_main(C);
ListBase *lb;
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- const short use_base_parent = RNA_boolean_get(op->ptr, "use_base_parent");
- const short use_hierarchy = RNA_boolean_get(op->ptr, "use_hierarchy");
+ const bool use_base_parent = RNA_boolean_get(op->ptr, "use_base_parent");
+ const bool use_hierarchy = RNA_boolean_get(op->ptr, "use_hierarchy");
BKE_main_id_clear_newpoins(bmain);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
bool changed = false;
- const int unselected = RNA_boolean_get(op->ptr, "unselected");
+ const bool unselected = RNA_boolean_get(op->ptr, "unselected");
CTX_DATA_BEGIN(C, Base *, base, visible_bases)
{
static int object_hide_render_set_exec(bContext *C, wmOperator *op)
{
- const int unselected = RNA_boolean_get(op->ptr, "unselected");
+ const bool unselected = RNA_boolean_get(op->ptr, "unselected");
CTX_DATA_BEGIN(C, Base *, base, visible_bases)
{
Object *ob;
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = NULL;
- int ok = 0;
+ bool ok = false;
if (scene->id.lib) return;
int single_group_index = RNA_enum_get(op->ptr, "group");
Group *single_group = group_object_active_find_index(ob, single_group_index);
Group *group;
- int ok = 0;
+ bool ok = false;
if (ob == NULL)
return OPERATOR_CANCELLED;
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
Object *obsel = NULL;
- const int use_bone = RNA_boolean_get(op->ptr, "use_bone");
+ const bool use_bone = RNA_boolean_get(op->ptr, "use_bone");
const int mode = use_bone ? OBJECT_ADDHOOK_SELOB_BONE : OBJECT_ADDHOOK_SELOB;
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
}
}
-static int apply_objects_internal(bContext *C, ReportList *reports, int apply_loc, int apply_rot, int apply_scale)
+static int apply_objects_internal(bContext *C, ReportList *reports, bool apply_loc, bool apply_rot, bool apply_scale)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
static int object_transform_apply_exec(bContext *C, wmOperator *op)
{
- const int loc = RNA_boolean_get(op->ptr, "location");
- const int rot = RNA_boolean_get(op->ptr, "rotation");
- const int sca = RNA_boolean_get(op->ptr, "scale");
+ const bool loc = RNA_boolean_get(op->ptr, "location");
+ const bool rot = RNA_boolean_get(op->ptr, "rotation");
+ const bool sca = RNA_boolean_get(op->ptr, "scale");
if (loc || rot || sca) {
return apply_objects_internal(C, op->reports, loc, rot, sca);
ImBuf *ibuf, *ibuf_save = NULL;
void *lock;
char name[FILE_MAX];
- int ok = 0;
- const short view_context = (oglrender->v3d != NULL);
+ bool ok = false;
+ const bool view_context = (oglrender->v3d != NULL);
Object *camera = NULL;
bool is_movie;
/* new UI convention: draw is in pixel space already. */
/* uses ROUNDBOX button in block to get the rect */
-static int ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, rcti *newrect)
+static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, rcti *newrect)
{
Render *re;
RenderResult rres;
int offx = 0;
int newx = BLI_rcti_size_x(rect);
int newy = BLI_rcti_size_y(rect);
- int ok = 0;
+ bool ok = false;
if (!split || first) sprintf(name, "Preview %p", (void *)sa);
else sprintf(name, "SecondPreview %p", (void *)sa);
Scene *scene;
Object *ob;
bNode *node;
- int texture_draw = false;
+ bool texture_draw = false;
/* icons */
BKE_icon_changed(BKE_icon_getid(&tex->id));
wmWindow *win;
ScrArea *sa;
ImagePaintSettings *imapaint = &settings->imapaint;
- int enabled = false;
+ bool enabled = false;
for (win = wm->windows.first; win; win = win->next)
for (sa = win->screen->areabase.first; sa; sa = sa->next)
static int face_select_hide_exec(bContext *C, wmOperator *op)
{
- const int unselected = RNA_boolean_get(op->ptr, "unselected");
+ const bool unselected = RNA_boolean_get(op->ptr, "unselected");
Object *ob = CTX_data_active_object(C);
paintface_hide(ob, unselected);
ED_region_tag_redraw(CTX_wm_region(C));
/* Returns true if any of the smoothing modes are active (currently
* one of smooth brush, autosmooth, mask smooth, or shift-key
* smooth) */
-static int sculpt_any_smooth_mode(const Brush *brush,
- StrokeCache *cache,
- int stroke_mode)
+static bool sculpt_any_smooth_mode(const Brush *brush,
+ StrokeCache *cache,
+ int stroke_mode)
{
return ((stroke_mode == BRUSH_STROKE_SMOOTH) ||
(cache && cache->alt_smooth) ||
SculptSession *ss = CTX_data_active_object(C)->sculpt;
Brush *brush = BKE_paint_brush(&sd->paint);
int mode = RNA_enum_get(op->ptr, "mode");
- int is_smooth = 0;
- int need_mask = false;
+ bool is_smooth;
+ bool need_mask = false;
if (brush->sculpt_tool == SCULPT_TOOL_MASK) {
need_mask = true;
DerivedMesh *dm;
SculptSession *ss = ob->sculpt;
SculptUndoNode *unode;
- int update = false, rebuild = false;
- int need_mask = false;
+ bool update = false, rebuild = false;
+ bool need_mask = false;
for (unode = lb->first; unode; unode = unode->next) {
if (strcmp(unode->idname, ob->id.name) == 0) {
/********************** clean tracks operator *********************/
-static int is_track_clean(MovieTrackingTrack *track, int frames, int del)
+static bool is_track_clean(MovieTrackingTrack *track, int frames, int del)
{
- int ok = 1, a, prev = -1, count = 0;
+ bool ok = true;
+ int a, prev = -1, count = 0;
MovieTrackingMarker *markers = track->markers, *new_markers = NULL;
int start_disabled = 0;
int markersnr = track->markersnr;
int stride;
const short type = RNA_enum_get(op->ptr, "type");
- int done = false;
+ bool done = false;
if (ci->len == 0) {
return OPERATOR_CANCELLED;
}
}
-static FileSelection file_selection_get(bContext *C, const rcti *rect, short fill)
+static FileSelection file_selection_get(bContext *C, const rcti *rect, bool fill)
{
ARegion *ar = CTX_wm_region(C);
SpaceFile *sfile = CTX_wm_space_file(C);
return sel;
}
-static FileSelect file_select_do(bContext *C, int selected_idx, short do_diropen)
+static FileSelect file_select_do(bContext *C, int selected_idx, bool do_diropen)
{
FileSelect retval = FILE_SELECT_NOTHING;
SpaceFile *sfile = CTX_wm_space_file(C);
}
-static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select, short fill, short do_diropen)
+static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select, bool fill, bool do_diropen)
{
SpaceFile *sfile = CTX_wm_space_file(C);
FileSelect retval = FILE_SELECT_NOTHING;
{
bAnimContext ac;
bAnimListElem *ale;
- short ok = 0;
+ bool ok = false;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
const bool is_render_out = (id && GS(id->name) == ID_SCE);
uiLayout *col, *row, *split, *sub;
- int show_preview = false;
+ bool show_preview = false;
col = uiLayoutColumn(layout, false);
SpaceImage *sima = CTX_wm_space_image(C);
ImBuf *ibuf;
void *lock;
- int ret = false;
+ bool ret = false;
char name[FILE_MAX];
ibuf = ED_space_image_acquire_buffer(sima, &lock);
return block;
}
-static int is_sensor_linked(uiBlock *block, bSensor *sens)
+static bool is_sensor_linked(uiBlock *block, bSensor *sens)
{
bController *cont;
int i;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- int ok = 0;
+ bool ok = false;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
AnimData *adt = ale->data;
/* try entering tweakmode if valid */
- ok += BKE_nla_tweakmode_enter(adt);
+ ok |= BKE_nla_tweakmode_enter(adt);
}
/* free temp data */
bAnimListElem *ale;
int filter;
- int done = false;
+ bool done = false;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
BKE_nlastrip_validate_name(adt, strip);
/* make note of this */
- done++;
+ done = true;
}
}
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
- int filter, ok = 0;
+ int filter;
+ bool ok = false;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
continue;
// TODO: when 'active' vs 'all' boolean is added, change last param!
- ok += ANIM_fmodifiers_copy_to_buf(&strip->modifiers, 0);
+ ok |= ANIM_fmodifiers_copy_to_buf(&strip->modifiers, 0);
}
}
}
/* recursively check for script nodes in groups using this text and update */
-static int node_shader_script_update_text_recursive(RenderEngine *engine, RenderEngineType *type, bNodeTree *ntree, Text *text)
+static bool node_shader_script_update_text_recursive(RenderEngine *engine, RenderEngineType *type, bNodeTree *ntree, Text *text)
{
- int found = false;
+ bool found = false;
bNode *node;
ntree->done = true;
bNode *node = NULL;
RenderEngine *engine;
RenderEngineType *type;
- int found = false;
+ bool found = false;
/* setup render engine */
type = RE_engines_find(scene->r.engine);
ListBase anim_basepaths = {NULL, NULL};
float min[2], max[2], center[2];
int totselect;
- int expose_all = false;
+ bool expose_all = false;
bNode *input_node, *output_node;
/* XXX rough guess, not nice but we don't have access to UI constants here ... */
if (node_group_make_use_node(node, gnode)) {
for (sock = node->inputs.first; sock; sock = sock->next) {
bNodeSocket *iosock, *input_sock;
- int skip = false;
+ bool skip = false;
for (link = ngroup->links.first; link; link = link->next) {
if (link->tosock == sock) {
skip = true;
for (sock = node->outputs.first; sock; sock = sock->next) {
bNodeSocket *iosock, *output_sock;
- int skip = false;
+ bool skip = false;
for (link = ngroup->links.first; link; link = link->next)
if (link->fromsock == sock)
skip = true;
for (nli = nodelist->first; nli; nli = nli->next) {
bNode *node_fr, *node_to;
bNodeSocket *sock_fr, *sock_to;
- int has_selected_inputs = 0;
+ bool has_selected_inputs = false;
if (nli->next == NULL) break;
RNA_END;
if (i > 1) {
- int found = false;
+ bool found = false;
bNodeLink *link, *next;
ED_preview_kill_jobs(C);
Image *ima;
ImBuf *ibuf;
float fx, fy, bufx, bufy;
- int ret = false;
+ bool ret = false;
if (STREQ(snode->tree_idname, ntreeType_Composite->idname) || (snode->flag & SNODE_BACKDRAW) == 0) {
/* use viewer image for color sampling only if we're in compositor tree
/* add color */
static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
- short is_type_set = RNA_struct_property_is_set(op->ptr, "type");
+ bool is_type_set = RNA_struct_property_is_set(op->ptr, "type");
int type = -1;
int prop_flag = SEQPROP_ENDFRAME;
GLuint last_texid;
void *display_buffer;
void *cache_handle = NULL;
- const int is_imbuf = ED_space_sequencer_check_show_imbuf(sseq);
+ const bool is_imbuf = ED_space_sequencer_check_show_imbuf(sseq);
int format, type;
bool glsl_used = false;
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, false);
Sequence *seq = BKE_sequencer_active_get(scene);
- const int is_relative_path = RNA_boolean_get(op->ptr, "relative_path");
+ const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path");
if (seq->type == SEQ_TYPE_IMAGE) {
char directory[FILE_MAX];
{
Sequence *seq;
bool changed = false;
- short is_sound = SEQ_IS_SOUND(actseq);
+ const bool is_sound = SEQ_IS_SOUND(actseq);
SEQP_BEGIN (ed, seq)
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
char *str;
- int done = false;
+ bool done = false;
size_t i = 0;
unsigned int code;
static void ruler_item_as_string(RulerItem *ruler_item, UnitSettings *unit,
char *numstr, size_t numstr_size, int prec)
{
- const int do_split = unit->flag & USER_UNIT_OPT_SPLIT;
+ const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0;
if (ruler_item->flag & RULERITEM_USE_ANGLE) {
const float ruler_angle = angle_v3v3v3(ruler_item->co[0],
Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL;
bool is_obedit;
float dist = ED_view3d_select_dist_px() * 1.3333f;
- int retval = false;
+ bool retval = false;
short hits;
const float mval_fl[2] = {(float)mval[0], (float)mval[1]};
MovieClip *clip = BKE_object_movieclip_get(scene, ob, false);
MovieTracking *tracking;
MovieTrackingObject *object;
- int ok = 0;
+ bool ok = false;
float min[3], max[3], mat[4][4], pos[3], cammat[4][4] = MAT4_UNITY;
if (!clip)
bConstraintTypeInfo *cti = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT);
bConstraintOb cob;
bConstraint *con;
- int do_limit = false;
+ bool do_limit = false;
/* Evaluate valid constraints */
for (con = td->con; con; con = con->next) {
dist = len_v3(vec);
if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) {
- int i, do_split = t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1 : 0;
+ const bool do_split = (t->scene->unit.flag & USER_UNIT_OPT_SPLIT) != 0;
+ int i;
for (i = 0; i < 3; i++) {
bUnit_AsString(&tvec[NUM_STR_REP_LEN * i], NUM_STR_REP_LEN, dvec[i] * t->scene->unit.scale_length,
}
}
- if (!(t->flag & T_2D_EDIT) && t->scene->unit.system)
+ if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) {
+ const bool do_split = (t->scene->unit.flag & USER_UNIT_OPT_SPLIT) != 0;
bUnit_AsString(distvec, sizeof(distvec), dist * t->scene->unit.scale_length, 4, t->scene->unit.system,
- B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, false);
- else if (dist > 1e10f || dist < -1e10f) /* prevent string buffer overflow */
+ B_UNIT_LENGTH, do_split, false);
+ }
+ else if (dist > 1e10f || dist < -1e10f) {
+ /* prevent string buffer overflow */
BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4e", dist);
- else
+ }
+ else {
BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4f", dist);
+ }
if (t->flag & T_AUTOIK) {
short chainlen = t->settings->autoik_chainlen;
{
TransData *td;
float ratio;
- int i, initial_feather = false;
+ int i;
+ bool initial_feather = false;
char str[MAX_INFO_LEN];
ratio = t->values[0];
/*const*/ float parent_inverse_matrix[3][3])
{
BezTriple *bezt = &point->bezt;
- short is_sel_any = MASKPOINT_ISSEL_ANY(point);
+ const bool is_sel_any = MASKPOINT_ISSEL_ANY(point);
tdm->point = point;
copy_m3_m3(tdm->vec, bezt->vec);
else if (ob && (ob->mode & OB_MODE_POSE)) {
bPoseChannel *pchan;
int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed
- int ok = false;
+ bool ok = false;
if ((ob->lay & v3d->lay) == 0) return 0;
bArmature *arm = ob->data;
bPoseChannel *pchan;
float imat[3][3], mat[3][3];
- int ok = false;
+ bool ok = false;
if (activeOnly && (pchan = BKE_pose_channel_active(ob))) {
add_v3_v3(normal, pchan->pose_mat[2]);
static int uv_remove_doubles_exec(bContext *C, wmOperator *op)
{
const float threshold = RNA_float_get(op->ptr, "threshold");
- const int use_unselected = RNA_boolean_get(op->ptr, "use_unselected");
+ const bool use_unselected = RNA_boolean_get(op->ptr, "use_unselected");
SpaceImage *sima;
Scene *scene;
const char *name;
float vec[4];
struct GPUNodeLink *link;
- short hasinput;
- short hasoutput;
+ bool hasinput;
+ bool hasoutput;
short sockettype;
} GPUNodeStack;
static void gpu_generate_mipmap(GLenum target)
{
- int is_ati = GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY);
+ const bool is_ati = GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY);
int target_enabled = 0;
/* work around bug in ATI driver, need to have GL_TEXTURE_2D enabled
/* if color correction is needed, we must update the part that needs updating. */
if (ibuf->rect_float) {
float *buffer = MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf");
- int is_data = (ima->tpageflag & IMA_GLBIND_IS_DATA);
+ bool is_data = (ima->tpageflag & IMA_GLBIND_IS_DATA) != 0;
IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h, is_data);
if (GPU_check_scaled_image(ibuf, ima, buffer, x, y, w, h)) {
void IMB_rect_from_float(struct ImBuf *ibuf);
/* Create char buffer for part of the image, color corrected if necessary,
* Changed part will be stored in buffer. This is expected to be used for texture painting updates */
-void IMB_partial_rect_from_float(struct ImBuf *ibuf, float *buffer, int x, int y, int w, int h, int is_data);
+void IMB_partial_rect_from_float(struct ImBuf *ibuf, float *buffer, int x, int y, int w, int h, bool is_data);
void IMB_float_from_rect(struct ImBuf *ibuf);
void IMB_color_to_bw(struct ImBuf *ibuf);
void IMB_saturation(struct ImBuf *ibuf, float sat);
}
/* converts from linear float to sRGB byte for part of the texture, buffer will hold the changed part */
-void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w, int h, int is_data)
+void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w, int h, bool is_data)
{
float *rect_float;
uchar *rect_byte;
else return y * w + x;
}
-static int check_pixel_assigned(const void *buffer, const char *mask, const int index, const int depth, const int is_float)
+static int check_pixel_assigned(const void *buffer, const char *mask, const int index, const int depth, const bool is_float)
{
int res = 0;
const int depth = 4; /* always 4 channels */
const int chsize = ibuf->rect_float ? sizeof(float) : sizeof(unsigned char);
const int bsize = width * height * depth * chsize;
- const int is_float = ibuf->rect_float != NULL;
+ const bool is_float = (ibuf->rect_float != NULL);
void *dstbuf = (void *) MEM_dupallocN(ibuf->rect_float ? (void *) ibuf->rect_float : (void *) ibuf->rect);
char *dstmask = mask == NULL ? NULL : (char *) MEM_dupallocN(mask);
void *srcbuf = ibuf->rect_float ? (void *) ibuf->rect_float : (void *) ibuf->rect;
return ~EOF;
}
-static short makebody_tga(ImBuf *ibuf, FILE *file, int (*out)(unsigned int, FILE *))
+static bool makebody_tga(ImBuf *ibuf, FILE *file, int (*out)(unsigned int, FILE *))
{
register int last, this;
register int copy, bytes;
return 1;
}
-static int dumptarga(struct ImBuf *ibuf, FILE *file)
+static bool dumptarga(struct ImBuf *ibuf, FILE *file)
{
int size;
uchar *rect;
{
char buf[20] = {0};
FILE *fildes;
- short ok = 0;
+ bool ok = false;
(void)flags; /* unused */
PropertyType type;
const char *funcname, *valstr;
const char *ptrstr;
- const short has_data = (dfunc->cont.properties.first != NULL);
+ const bool has_data = (dfunc->cont.properties.first != NULL);
int flag, pout, cptr, first;
srna = dsrna->srna;
for (i = 0; i < seq_size; i++) {
Py_ssize_t item_seq_size;
PyObject *item;
- int ok = 1;
+ bool ok = true;
item = PySequence_GetItem(seq, i);
if (item == NULL) {
if ( mface->mat_nr==a1 ) {
float len;
- int reverse_verts = (negative_scale != 0 && do_autosmooth == false);
+ bool reverse_verts = (negative_scale != 0 && do_autosmooth == false);
int rev_tab[] = {reverse_verts==0 ? 0 : 2, 1, reverse_verts==0 ? 2 : 0, 3};
v1= reverse_verts==0 ? mface->v1 : mface->v3;
v2= mface->v2;