return 10 * (fccs[0] - '0') + (fccs[1] - '0');
}
-static int fcc_is_data(int fcc)
+static bool fcc_is_data(int fcc)
{
char fccs[4];
void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd);
void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct DynamicPaintModifierData *tsmd);
-int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene);
+bool dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene);
struct DynamicPaintSurface *dynamicPaint_createNewSurface(struct DynamicPaintCanvasSettings *canvas, struct Scene *scene);
void dynamicPaint_clearSurface(struct Scene *scene, struct DynamicPaintSurface *surface);
-int dynamicPaint_resetSurface(struct Scene *scene, struct DynamicPaintSurface *surface);
+bool dynamicPaint_resetSurface(struct Scene *scene, struct DynamicPaintSurface *surface);
void dynamicPaint_freeSurface(struct DynamicPaintSurface *surface);
void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd);
void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd);
void calc_latt_deform(struct LatticeDeformData *lattice_deform_data, float co[3], float weight);
void end_latt_deform(struct LatticeDeformData *lattice_deform_data);
-int object_deform_mball(struct Object *ob, struct ListBase *dispbase);
+bool object_deform_mball(struct Object *ob, struct ListBase *dispbase);
void outside_lattice(struct Lattice *lt);
void curve_deform_verts(struct Object *cuOb, struct Object *target,
/* currently only used in BLI_assert */
#ifndef NDEBUG
-static int customdata_typemap_is_valid(const CustomData *data)
+static bool customdata_typemap_is_valid(const CustomData *data)
{
CustomData data_copy = *data;
CustomData_update_typemap(&data_copy);
/*
* Initialize modifier data
*/
-int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene)
+bool dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene)
{
if (pmd) {
if (type == MOD_DYNAMICPAINT_TYPE_CANVAS) {
}
/* completely (re)initializes surface (only for point cache types)*/
-int dynamicPaint_resetSurface(Scene *scene, DynamicPaintSurface *surface)
+bool dynamicPaint_resetSurface(Scene *scene, DynamicPaintSurface *surface)
{
int numOfPoints = dynamicPaint_surfaceNumOfPoints(surface);
/* free existing data */
}
/* make sure allocated surface size matches current requirements */
-static int dynamicPaint_checkSurfaceData(Scene *scene, DynamicPaintSurface *surface)
+static bool dynamicPaint_checkSurfaceData(Scene *scene, DynamicPaintSurface *surface)
{
if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) {
return dynamicPaint_resetSurface(scene, surface);
return bmdm->em->bm->totface;
}
-static int bmvert_to_mvert(BMesh *bm, BMVert *ev, MVert *r_vert)
+static void bmvert_to_mvert(BMesh *bm, BMVert *ev, MVert *r_vert)
{
float *f;
if ((f = CustomData_bmesh_get(&bm->vdata, ev->head.data, CD_BWEIGHT))) {
r_vert->bweight = (unsigned char)((*f) * 255.0f);
}
-
- return 1;
}
static void emDM_getVert(DerivedMesh *dm, int index, MVert *r_vert)
*
* returns OK: 1/0
*/
-static int where_on_path_deform(Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius)
+static bool where_on_path_deform(Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius)
{
BevList *bl;
float ctime1;
/* co: local coord, result local too */
/* returns quaternion for rotation, using cd->no_rot_axis */
/* axis is using another define!!! */
-static int calc_curve_deform(Object *par, float co[3],
- const short axis, CurveDeform *cd, float quat_r[4])
+static bool calc_curve_deform(Object *par, float co[3],
+ const short axis, CurveDeform *cd, float quat_r[4])
{
Curve *cu = par->data;
float fac, loc[4], dir[3], new_quat[4], radius;
end_latt_deform(lattice_deform_data);
}
-int object_deform_mball(Object *ob, ListBase *dispbase)
+bool object_deform_mball(Object *ob, ListBase *dispbase)
{
if (ob->parent && ob->parent->type == OB_LATTICE && ob->partype == PARSKEL) {
DispList *dl;
end_render_material(ma);
}
-static int material_in_nodetree(bNodeTree *ntree, Material *mat)
+static bool material_in_nodetree(bNodeTree *ntree, Material *mat)
{
bNode *node;
/* Is the given NLA-strip the first one to occur for the given AnimData block */
// TODO: make this an api method if necesary, but need to add prefix first
-static short nlastrip_is_first(AnimData *adt, NlaStrip *strip)
+static bool nlastrip_is_first(AnimData *adt, NlaStrip *strip)
{
NlaTrack *nlt;
NlaStrip *ns;
}
}
-static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4])
+static bool where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4])
{
float *fp1, *fp2;
float fac1, fac2;
int cd_vert_mask_offset;
} EdgeQueueContext;
-static int edge_queue_tri_in_sphere(const EdgeQueue *q, BMFace *f)
+static bool edge_queue_tri_in_sphere(const EdgeQueue *q, BMFace *f)
{
BMVert *v_tri[3];
float c[3];
return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra);
}
-static int video_seq_is_rendered(Sequence *seq)
+static bool video_seq_is_rendered(Sequence *seq)
{
return (seq && !(seq->flag & SEQ_MUTE) && seq->type != SEQ_TYPE_SOUND_RAM);
}
/*********************** strip stack rendering functions *************************/
-static int seq_must_swap_input_in_blend_mode(Sequence *seq)
+static bool seq_must_swap_input_in_blend_mode(Sequence *seq)
{
- int swap_input = FALSE;
+ bool swap_input = FALSE;
/* bad hack, to fix crazy input ordering of
* those two effects */
/* Undo functions */
/******************/
-static int max_undo_test(Text *text, int x)
+static bool max_undo_test(Text *text, int x)
{
while (text->undo_pos + x >= text->undo_len) {
if (text->undo_len * 2 > TXT_MAX_UNDO) {
*/
/* not too strict, (- = * /) are most common */
-static int ch_is_op(char op)
+static bool ch_is_op(char op)
{
switch (op) {
case '+':
/* ***************************** */
-static int object_in_any_scene(Main *mainvar, Object *ob)
+static bool object_in_any_scene(Main *mainvar, Object *ob)
{
Scene *sce;
/* tl is loop to project onto, l is loop whose internal displacement, co, is being
* projected. x and y are location in loop's mdisps grid of point co. */
-static int mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float *y,
- int res, float axis_x[3], float axis_y[3])
+static bool mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float *y,
+ int res, float axis_x[3], float axis_y[3])
{
float v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3];
float eps = FLT_EPSILON * 4000;
}
/* Check that there are at least three vertices in the input */
-static int hull_num_input_verts_is_ok(BMOperator *op)
+static bool hull_num_input_verts_is_ok(BMOperator *op)
{
BMOIter oiter;
BMVert *v;
typedef struct BLaplacianSystem LaplacianSystem;
static float cotan_weight(float *v1, float *v2, float *v3);
-static int vert_is_boundary(BMVert *v);
+static bool vert_is_boundary(BMVert *v);
static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts);
static void init_laplacian_matrix(LaplacianSystem *sys);
static void delete_laplacian_system(LaplacianSystem *sys);
return dot_v3v3(a, b) / clen;
}
-static int vert_is_boundary(BMVert *v)
+static bool vert_is_boundary(BMVert *v)
{
BMEdge *ed;
BMFace *f;
/* Rearrange Methods --------------------------------------------- */
-static short rearrange_island_ok(tReorderChannelIsland *island)
+static bool rearrange_island_ok(tReorderChannelIsland *island)
{
/* island must not be untouchable */
if (island->flag & REORDER_ISLAND_UNTOUCHABLE)
/* ............................. */
-static short rearrange_island_top(ListBase *list, tReorderChannelIsland *island)
+static bool rearrange_island_top(ListBase *list, tReorderChannelIsland *island)
{
if (rearrange_island_ok(island)) {
/* remove from current position */
return 0;
}
-static short rearrange_island_up(ListBase *list, tReorderChannelIsland *island)
+static bool rearrange_island_up(ListBase *list, tReorderChannelIsland *island)
{
if (rearrange_island_ok(island)) {
/* moving up = moving before the previous island, otherwise we're in the same place */
return 0;
}
-static short rearrange_island_down(ListBase *list, tReorderChannelIsland *island)
+static bool rearrange_island_down(ListBase *list, tReorderChannelIsland *island)
{
if (rearrange_island_ok(island)) {
/* moving down = moving after the next island, otherwise we're in the same place */
return 0;
}
-static short rearrange_island_bottom(ListBase *list, tReorderChannelIsland *island)
+static bool rearrange_island_bottom(ListBase *list, tReorderChannelIsland *island)
{
if (rearrange_island_ok(island)) {
tReorderChannelIsland *last = list->last;
* < island: island to be moved
* > return[0]: whether operation was a success
*/
-typedef short (*AnimChanRearrangeFp)(ListBase *list, tReorderChannelIsland *island);
+typedef bool (*AnimChanRearrangeFp)(ListBase *list, tReorderChannelIsland *island);
/* get rearranging function, given 'rearrange' mode */
static AnimChanRearrangeFp rearrange_get_mode_func(short mode)
/* ********************* Amimation data *************** */
-static int curve_is_animated(Curve *cu)
+static bool curve_is_animated(Curve *cu)
{
AnimData *ad = BKE_animdata_from_id(&cu->id);
short initial_feather, overall_feather;
} SlidePointData;
-static int slide_point_check_initial_feather(MaskSpline *spline)
+static bool slide_point_check_initial_feather(MaskSpline *spline)
{
int i;
/*************************** selection utilities *******************************/
-static int key_test_depth(PEData *data, const float co[3], const int screen_co[2])
+static bool key_test_depth(PEData *data, const float co[3], const int screen_co[2])
{
View3D *v3d= data->vc.v3d;
ViewDepths *vd = data->vc.rv3d->depths;
return 1;
}
-static int key_inside_circle(PEData *data, float rad, const float co[3], float *distance)
+static bool key_inside_circle(PEData *data, float rad, const float co[3], float *distance)
{
float dx, dy, dist;
int screen_co[2];
return 0;
}
-static int key_inside_rect(PEData *data, const float co[3])
+static bool key_inside_rect(PEData *data, const float co[3])
{
int screen_co[2];
return 0;
}
-static int key_inside_test(PEData *data, const float co[3])
+static bool key_inside_test(PEData *data, const float co[3])
{
if (data->mval)
return key_inside_circle(data, data->rad, co, NULL);
return key_inside_rect(data, co);
}
-static int point_is_selected(PTCacheEditPoint *point)
+static bool point_is_selected(PTCacheEditPoint *point)
{
KEY_K;
}
}
-static int fluid_is_animated_mesh(FluidsimSettings *fss)
+static bool fluid_is_animated_mesh(FluidsimSettings *fss)
{
return ((fss->type == OB_FLUIDSIM_CONTROL) || fss->domainNovecgen);
}
float *verts=NULL;
int *tris=NULL;
int numVerts=0, numTris=0;
- int deform = fluid_is_animated_mesh(fluidmd->fss);
+ bool deform = fluid_is_animated_mesh(fluidmd->fss);
elbeemMesh fsmesh;
}
/* overlapping regions only in the following restricted cases */
-static int region_is_overlap(wmWindow *win, ScrArea *sa, ARegion *ar)
+static bool region_is_overlap(wmWindow *win, ScrArea *sa, ARegion *ar)
{
if (U.uiflag2 & USER_REGION_OVERLAP) {
if (WM_is_draw_triple(win)) {
/* ************** switch screen operator ***************************** */
-static int screen_set_is_ok(bScreen *screen, bScreen *screen_prev)
+static bool screen_set_is_ok(bScreen *screen, bScreen *screen_prev)
{
return ((screen->winid == 0) &&
(screen->full == 0) &&
return (rv3d && (ED_view3d_clipping_test(rv3d, co, true)));
}
-static int sculpt_brush_test(SculptBrushTest *test, const float co[3])
+static bool sculpt_brush_test(SculptBrushTest *test, const float co[3])
{
float distsq = len_squared_v3v3(co, test->location);
}
}
-static int sculpt_brush_test_sq(SculptBrushTest *test, const float co[3])
+static bool sculpt_brush_test_sq(SculptBrushTest *test, const float co[3])
{
float distsq = len_squared_v3v3(co, test->location);
}
}
-static int sculpt_brush_test_fast(SculptBrushTest *test, float co[3])
+static bool sculpt_brush_test_fast(SculptBrushTest *test, float co[3])
{
if (sculpt_brush_test_clipping(test, co)) {
return 0;
return len_squared_v3v3(co, test->location) <= test->radius_squared;
}
-static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float local[4][4])
+static bool sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float local[4][4])
{
float side = M_SQRT1_2;
float local_co[3];
#if 0
-static int sculpt_brush_test_cyl(SculptBrushTest *test, float co[3], float location[3], float an[3])
+static bool sculpt_brush_test_cyl(SculptBrushTest *test, float co[3], float location[3], float an[3])
{
if (sculpt_brush_test_fast(test, co)) {
float t1[3], t2[3], t3[3], dist;
struct bScreen *screen;
} TrackMarkersJob;
-static int track_markers_testbreak(void)
+static bool track_markers_testbreak(void)
{
return G.is_break;
}
}
/* would recognize .blend as well */
-static int file_is_blend_backup(const char *str)
+static bool file_is_blend_backup(const char *str)
{
- short a, b;
- int retval = 0;
-
- a = strlen(str);
- b = 7;
-
+ const size_t a = strlen(str);
+ size_t b = 7;
+ bool retval = 0;
+
if (a == 0 || b >= a) {
/* pass */
}
else {
- char *loc;
+ const char *loc;
if (a > b + 1)
b++;
}
}
-static int stats_is_object_dynamic_topology_sculpt(Object *ob)
+static bool stats_is_object_dynamic_topology_sculpt(Object *ob)
{
return (ob && (ob->mode & OB_MODE_SCULPT) &&
ob->sculpt && ob->sculpt->bm);
return (snode && snode->edittree && (snode->edittree->inputs.first || snode->edittree->outputs.first));
}
-static int node_tree_find_active_socket(bNodeTree *ntree, bNodeSocket **r_sock, int *r_in_out)
+static bool node_tree_find_active_socket(bNodeTree *ntree, bNodeSocket **r_sock, int *r_in_out)
{
bNodeSocket *sock;
for (sock = ntree->inputs.first; sock; sock = sock->next) {
return 0;
}
-static int socket_is_available(bNodeTree *UNUSED(ntree), bNodeSocket *sock, const bool allow_used)
+static bool socket_is_available(bNodeTree *UNUSED(ntree), bNodeSocket *sock, const bool allow_used)
{
if (nodeSocketIsHidden(sock))
return 0;
}
-static int seq_is_parent(Sequence *par, Sequence *seq)
+static bool seq_is_parent(Sequence *par, Sequence *seq)
{
return ((par->seq1 == seq) || (par->seq2 == seq) || (par->seq3 == seq));
}
-static int seq_is_predecessor(Sequence *pred, Sequence *seq)
+static bool seq_is_predecessor(Sequence *pred, Sequence *seq)
{
if (!pred) return 0;
if (pred == seq) return 0;
}
}
-static int fcu_test_selected(FCurve *fcu)
+static bool fcu_test_selected(FCurve *fcu)
{
BezTriple *bezt = fcu->bezt;
unsigned int i;
}
/* check if two uvelements are stitchable. This should only operate on -different- separate UvElements */
-static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_iter, StitchState *state)
+static bool stitch_check_uvs_stitchable(UvElement *element, UvElement *element_iter, StitchState *state)
{
BMesh *bm = state->em->bm;
float limit;
}
}
-static int stitch_check_edges_stitchable(UvEdge *edge, UvEdge *edge_iter, StitchState *state)
+static bool stitch_check_edges_stitchable(UvEdge *edge, UvEdge *edge_iter, StitchState *state)
{
BMesh *bm = state->em->bm;
float limit;
}
}
-static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *element_iter, StitchState *state)
+static bool stitch_check_uvs_state_stitchable(UvElement *element, UvElement *element_iter, StitchState *state)
{
if ((state->snap_islands && element->island == element_iter->island) ||
(!state->midpoints && element->island == element_iter->island))
}
-static int stitch_check_edges_state_stitchable(UvEdge *edge, UvEdge *edge_iter, StitchState *state)
+static bool stitch_check_edges_state_stitchable(UvEdge *edge, UvEdge *edge_iter, StitchState *state)
{
if ((state->snap_islands && edge->element->island == edge_iter->element->island) ||
(!state->midpoints && edge->element->island == edge_iter->element->island))
#define DEFAULT_DKR_EPSILON 0.0f
// Freestyle configuration
-static short freestyle_is_initialized = 0;
+static bool freestyle_is_initialized = false;
static Config::Path *pathconfig = NULL;
static Controller *controller = NULL;
static AppView *view = NULL;
return !(file->header().channels().findChannel("A") == NULL);
}
-static int exr_is_multilayer(InputFile *file)
+static bool exr_is_multilayer(InputFile *file)
{
const StringAttribute *comments = file->header().findTypedAttribute<StringAttribute>("BlenderMultiChannel");
const ChannelList &channels = file->header().channels();
try
{
Mem_IStream *membuf = new Mem_IStream(mem, size);
- int is_multi;
+ bool is_multi;
file = new InputFile(*membuf);
Box2i dw = file->header().dataWindow();
return oc->adrnode[index] + (oc->nodecount & 4095);
}
-static int face_in_node(RayFace *face, short x, short y, short z, float rtf[4][3])
+static bool face_in_node(RayFace *face, short x, short y, short z, float rtf[4][3])
{
static float nor[3], d;
float fx, fy, fz;
((View3D *)sa->spacedata.first)->flag |= V3D_INVALID_BACKBUF;
}
-static int wm_area_test_invalid_backbuf(ScrArea *sa)
+static bool wm_area_test_invalid_backbuf(ScrArea *sa)
{
if (sa->spacetype == SPACE_VIEW3D)
- return (((View3D *)sa->spacedata.first)->flag & V3D_INVALID_BACKBUF);
+ return (((View3D *)sa->spacedata.first)->flag & V3D_INVALID_BACKBUF) != 0;
else
return 1;
}
/****************** main update call **********************/
/* quick test to prevent changing window drawable */
-static int wm_draw_update_test_window(wmWindow *win)
+static bool wm_draw_update_test_window(wmWindow *win)
{
ScrArea *sa;
ARegion *ar;
/* ********************* notifiers, listeners *************** */
-static int wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, void *reference)
+static bool wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, void *reference)
{
wmNotifier *note;
wm_keymap_update_flag |= WM_KEYMAP_UPDATE_OPERATORTYPE;
}
-static int wm_keymap_test_and_clear_update(wmKeyMap *km)
+static bool wm_keymap_test_and_clear_update(wmKeyMap *km)
{
wmKeyMapItem *kmi;
int update;
kmi->flag &= ~KMI_UPDATE;
}
- return update;
+ return (update != 0);
}
static wmKeyMap *wm_keymap_preset(wmWindowManager *wm, wmKeyMap *km)