forked from bartvdbraak/blender
Code cleanup: use bool for static methods
This commit is contained in:
parent
36fc4e15f6
commit
37026b12ec
@ -141,7 +141,7 @@ static int fcc_get_stream(int fcc)
|
|||||||
return 10 * (fccs[0] - '0') + (fccs[1] - '0');
|
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];
|
char fccs[4];
|
||||||
|
|
||||||
|
@ -68,10 +68,10 @@ struct DerivedMesh *dynamicPaint_Modifier_do(struct DynamicPaintModifierData *pm
|
|||||||
void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd);
|
void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd);
|
||||||
void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct DynamicPaintModifierData *tsmd);
|
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);
|
struct DynamicPaintSurface *dynamicPaint_createNewSurface(struct DynamicPaintCanvasSettings *canvas, struct Scene *scene);
|
||||||
void dynamicPaint_clearSurface(struct Scene *scene, struct DynamicPaintSurface *surface);
|
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_freeSurface(struct DynamicPaintSurface *surface);
|
||||||
void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd);
|
void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd);
|
||||||
void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd);
|
void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd);
|
||||||
|
@ -58,7 +58,7 @@ __attribute__((warn_unused_result))
|
|||||||
void calc_latt_deform(struct LatticeDeformData *lattice_deform_data, float co[3], float weight);
|
void calc_latt_deform(struct LatticeDeformData *lattice_deform_data, float co[3], float weight);
|
||||||
void end_latt_deform(struct LatticeDeformData *lattice_deform_data);
|
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 outside_lattice(struct Lattice *lt);
|
||||||
|
|
||||||
void curve_deform_verts(struct Object *cuOb, struct Object *target,
|
void curve_deform_verts(struct Object *cuOb, struct Object *target,
|
||||||
|
@ -1282,7 +1282,7 @@ void CustomData_update_typemap(CustomData *data)
|
|||||||
|
|
||||||
/* currently only used in BLI_assert */
|
/* currently only used in BLI_assert */
|
||||||
#ifndef NDEBUG
|
#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 data_copy = *data;
|
||||||
CustomData_update_typemap(&data_copy);
|
CustomData_update_typemap(&data_copy);
|
||||||
|
@ -1101,7 +1101,7 @@ DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSettings *c
|
|||||||
/*
|
/*
|
||||||
* Initialize modifier data
|
* 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 (pmd) {
|
||||||
if (type == MOD_DYNAMICPAINT_TYPE_CANVAS) {
|
if (type == MOD_DYNAMICPAINT_TYPE_CANVAS) {
|
||||||
@ -1628,7 +1628,7 @@ void dynamicPaint_clearSurface(Scene *scene, DynamicPaintSurface *surface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* completely (re)initializes surface (only for point cache types)*/
|
/* 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);
|
int numOfPoints = dynamicPaint_surfaceNumOfPoints(surface);
|
||||||
/* free existing data */
|
/* free existing data */
|
||||||
@ -1655,7 +1655,7 @@ int dynamicPaint_resetSurface(Scene *scene, DynamicPaintSurface *surface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make sure allocated surface size matches current requirements */
|
/* 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))) {
|
if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) {
|
||||||
return dynamicPaint_resetSurface(scene, surface);
|
return dynamicPaint_resetSurface(scene, surface);
|
||||||
|
@ -1205,7 +1205,7 @@ static int emDM_getNumPolys(DerivedMesh *dm)
|
|||||||
return bmdm->em->bm->totface;
|
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;
|
float *f;
|
||||||
|
|
||||||
@ -1218,8 +1218,6 @@ static int bmvert_to_mvert(BMesh *bm, BMVert *ev, MVert *r_vert)
|
|||||||
if ((f = CustomData_bmesh_get(&bm->vdata, ev->head.data, CD_BWEIGHT))) {
|
if ((f = CustomData_bmesh_get(&bm->vdata, ev->head.data, CD_BWEIGHT))) {
|
||||||
r_vert->bweight = (unsigned char)((*f) * 255.0f);
|
r_vert->bweight = (unsigned char)((*f) * 255.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void emDM_getVert(DerivedMesh *dm, int index, MVert *r_vert)
|
static void emDM_getVert(DerivedMesh *dm, int index, MVert *r_vert)
|
||||||
|
@ -563,7 +563,7 @@ static void init_curve_deform(Object *par, Object *ob, CurveDeform *cd)
|
|||||||
*
|
*
|
||||||
* returns OK: 1/0
|
* 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;
|
BevList *bl;
|
||||||
float ctime1;
|
float ctime1;
|
||||||
@ -614,7 +614,7 @@ static int where_on_path_deform(Object *ob, float ctime, float vec[4], float dir
|
|||||||
/* co: local coord, result local too */
|
/* co: local coord, result local too */
|
||||||
/* returns quaternion for rotation, using cd->no_rot_axis */
|
/* returns quaternion for rotation, using cd->no_rot_axis */
|
||||||
/* axis is using another define!!! */
|
/* axis is using another define!!! */
|
||||||
static int calc_curve_deform(Object *par, float co[3],
|
static bool calc_curve_deform(Object *par, float co[3],
|
||||||
const short axis, CurveDeform *cd, float quat_r[4])
|
const short axis, CurveDeform *cd, float quat_r[4])
|
||||||
{
|
{
|
||||||
Curve *cu = par->data;
|
Curve *cu = par->data;
|
||||||
@ -921,7 +921,7 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
|
|||||||
end_latt_deform(lattice_deform_data);
|
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) {
|
if (ob->parent && ob->parent->type == OB_LATTICE && ob->partype == PARSKEL) {
|
||||||
DispList *dl;
|
DispList *dl;
|
||||||
|
@ -1113,7 +1113,7 @@ void end_render_materials(Main *bmain)
|
|||||||
end_render_material(ma);
|
end_render_material(ma);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int material_in_nodetree(bNodeTree *ntree, Material *mat)
|
static bool material_in_nodetree(bNodeTree *ntree, Material *mat)
|
||||||
{
|
{
|
||||||
bNode *node;
|
bNode *node;
|
||||||
|
|
||||||
|
@ -1189,7 +1189,7 @@ void BKE_nlastrip_recalculate_bounds(NlaStrip *strip)
|
|||||||
|
|
||||||
/* Is the given NLA-strip the first one to occur for the given AnimData block */
|
/* 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
|
// 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;
|
NlaTrack *nlt;
|
||||||
NlaStrip *ns;
|
NlaStrip *ns;
|
||||||
|
@ -2292,7 +2292,7 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[4
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 *fp1, *fp2;
|
||||||
float fac1, fac2;
|
float fac1, fac2;
|
||||||
|
@ -494,7 +494,7 @@ typedef struct {
|
|||||||
int cd_vert_mask_offset;
|
int cd_vert_mask_offset;
|
||||||
} EdgeQueueContext;
|
} 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];
|
BMVert *v_tri[3];
|
||||||
float c[3];
|
float c[3];
|
||||||
|
@ -1185,7 +1185,7 @@ int BKE_sequencer_evaluate_frame(Scene *scene, int cfra)
|
|||||||
return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra);
|
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);
|
return (seq && !(seq->flag & SEQ_MUTE) && seq->type != SEQ_TYPE_SOUND_RAM);
|
||||||
}
|
}
|
||||||
@ -2815,9 +2815,9 @@ static ImBuf *seq_render_strip(const SeqRenderData *context, Sequence *seq, floa
|
|||||||
|
|
||||||
/*********************** strip stack rendering functions *************************/
|
/*********************** 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
|
/* bad hack, to fix crazy input ordering of
|
||||||
* those two effects */
|
* those two effects */
|
||||||
|
@ -1540,7 +1540,7 @@ void txt_insert_buf(Text *text, const char *in_buffer)
|
|||||||
/* Undo functions */
|
/* 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) {
|
while (text->undo_pos + x >= text->undo_len) {
|
||||||
if (text->undo_len * 2 > TXT_MAX_UNDO) {
|
if (text->undo_len * 2 > TXT_MAX_UNDO) {
|
||||||
|
@ -498,7 +498,7 @@ static const char *unit_find_str(const char *str, const char *substr)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* not too strict, (- = * /) are most common */
|
/* not too strict, (- = * /) are most common */
|
||||||
static int ch_is_op(char op)
|
static bool ch_is_op(char op)
|
||||||
{
|
{
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case '+':
|
case '+':
|
||||||
|
@ -8691,7 +8691,7 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
|
|||||||
|
|
||||||
/* ***************************** */
|
/* ***************************** */
|
||||||
|
|
||||||
static int object_in_any_scene(Main *mainvar, Object *ob)
|
static bool object_in_any_scene(Main *mainvar, Object *ob)
|
||||||
{
|
{
|
||||||
Scene *sce;
|
Scene *sce;
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ static void mdisp_axis_from_quad(float v1[3], float v2[3], float UNUSED(v3[3]),
|
|||||||
|
|
||||||
/* tl is loop to project onto, l is loop whose internal displacement, co, is being
|
/* 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. */
|
* 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,
|
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])
|
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 v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3];
|
||||||
|
@ -535,7 +535,7 @@ static void hull_from_bullet(BMesh *bm, BMOperator *op,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check that there are at least three vertices in the input */
|
/* 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;
|
BMOIter oiter;
|
||||||
BMVert *v;
|
BMVert *v;
|
||||||
|
@ -67,7 +67,7 @@ struct BLaplacianSystem {
|
|||||||
typedef struct BLaplacianSystem LaplacianSystem;
|
typedef struct BLaplacianSystem LaplacianSystem;
|
||||||
|
|
||||||
static float cotan_weight(float *v1, float *v2, float *v3);
|
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 LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts);
|
||||||
static void init_laplacian_matrix(LaplacianSystem *sys);
|
static void init_laplacian_matrix(LaplacianSystem *sys);
|
||||||
static void delete_laplacian_system(LaplacianSystem *sys);
|
static void delete_laplacian_system(LaplacianSystem *sys);
|
||||||
@ -392,7 +392,7 @@ static float cotan_weight(float *v1, float *v2, float *v3)
|
|||||||
return dot_v3v3(a, b) / clen;
|
return dot_v3v3(a, b) / clen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vert_is_boundary(BMVert *v)
|
static bool vert_is_boundary(BMVert *v)
|
||||||
{
|
{
|
||||||
BMEdge *ed;
|
BMEdge *ed;
|
||||||
BMFace *f;
|
BMFace *f;
|
||||||
|
@ -659,7 +659,7 @@ typedef enum eReorderIslandFlag {
|
|||||||
|
|
||||||
/* Rearrange Methods --------------------------------------------- */
|
/* Rearrange Methods --------------------------------------------- */
|
||||||
|
|
||||||
static short rearrange_island_ok(tReorderChannelIsland *island)
|
static bool rearrange_island_ok(tReorderChannelIsland *island)
|
||||||
{
|
{
|
||||||
/* island must not be untouchable */
|
/* island must not be untouchable */
|
||||||
if (island->flag & REORDER_ISLAND_UNTOUCHABLE)
|
if (island->flag & REORDER_ISLAND_UNTOUCHABLE)
|
||||||
@ -671,7 +671,7 @@ static short rearrange_island_ok(tReorderChannelIsland *island)
|
|||||||
|
|
||||||
/* ............................. */
|
/* ............................. */
|
||||||
|
|
||||||
static short rearrange_island_top(ListBase *list, tReorderChannelIsland *island)
|
static bool rearrange_island_top(ListBase *list, tReorderChannelIsland *island)
|
||||||
{
|
{
|
||||||
if (rearrange_island_ok(island)) {
|
if (rearrange_island_ok(island)) {
|
||||||
/* remove from current position */
|
/* remove from current position */
|
||||||
@ -686,7 +686,7 @@ static short rearrange_island_top(ListBase *list, tReorderChannelIsland *island)
|
|||||||
return 0;
|
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)) {
|
if (rearrange_island_ok(island)) {
|
||||||
/* moving up = moving before the previous island, otherwise we're in the same place */
|
/* moving up = moving before the previous island, otherwise we're in the same place */
|
||||||
@ -706,7 +706,7 @@ static short rearrange_island_up(ListBase *list, tReorderChannelIsland *island)
|
|||||||
return 0;
|
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)) {
|
if (rearrange_island_ok(island)) {
|
||||||
/* moving down = moving after the next island, otherwise we're in the same place */
|
/* moving down = moving after the next island, otherwise we're in the same place */
|
||||||
@ -730,7 +730,7 @@ static short rearrange_island_down(ListBase *list, tReorderChannelIsland *island
|
|||||||
return 0;
|
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)) {
|
if (rearrange_island_ok(island)) {
|
||||||
tReorderChannelIsland *last = list->last;
|
tReorderChannelIsland *last = list->last;
|
||||||
@ -762,7 +762,7 @@ static short rearrange_island_bottom(ListBase *list, tReorderChannelIsland *isla
|
|||||||
* < island: island to be moved
|
* < island: island to be moved
|
||||||
* > return[0]: whether operation was a success
|
* > 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 */
|
/* get rearranging function, given 'rearrange' mode */
|
||||||
static AnimChanRearrangeFp rearrange_get_mode_func(short mode)
|
static AnimChanRearrangeFp rearrange_get_mode_func(short mode)
|
||||||
|
@ -988,7 +988,7 @@ static void calc_shapeKeys(Object *obedit)
|
|||||||
|
|
||||||
/* ********************* Amimation data *************** */
|
/* ********************* Amimation data *************** */
|
||||||
|
|
||||||
static int curve_is_animated(Curve *cu)
|
static bool curve_is_animated(Curve *cu)
|
||||||
{
|
{
|
||||||
AnimData *ad = BKE_animdata_from_id(&cu->id);
|
AnimData *ad = BKE_animdata_from_id(&cu->id);
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ typedef struct SlidePointData {
|
|||||||
short initial_feather, overall_feather;
|
short initial_feather, overall_feather;
|
||||||
} SlidePointData;
|
} SlidePointData;
|
||||||
|
|
||||||
static int slide_point_check_initial_feather(MaskSpline *spline)
|
static bool slide_point_check_initial_feather(MaskSpline *spline)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
|
|||||||
|
|
||||||
/*************************** selection utilities *******************************/
|
/*************************** 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;
|
View3D *v3d= data->vc.v3d;
|
||||||
ViewDepths *vd = data->vc.rv3d->depths;
|
ViewDepths *vd = data->vc.rv3d->depths;
|
||||||
@ -453,7 +453,7 @@ static int key_test_depth(PEData *data, const float co[3], const int screen_co[2
|
|||||||
return 1;
|
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;
|
float dx, dy, dist;
|
||||||
int screen_co[2];
|
int screen_co[2];
|
||||||
@ -480,7 +480,7 @@ static int key_inside_circle(PEData *data, float rad, const float co[3], float *
|
|||||||
return 0;
|
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];
|
int screen_co[2];
|
||||||
|
|
||||||
@ -497,7 +497,7 @@ static int key_inside_rect(PEData *data, const float co[3])
|
|||||||
return 0;
|
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)
|
if (data->mval)
|
||||||
return key_inside_circle(data, data->rad, co, NULL);
|
return key_inside_circle(data, data->rad, co, NULL);
|
||||||
@ -505,7 +505,7 @@ static int key_inside_test(PEData *data, const float co[3])
|
|||||||
return key_inside_rect(data, co);
|
return key_inside_rect(data, co);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int point_is_selected(PTCacheEditPoint *point)
|
static bool point_is_selected(PTCacheEditPoint *point)
|
||||||
{
|
{
|
||||||
KEY_K;
|
KEY_K;
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ static float get_fluid_size_m(Scene *scene, Object *domainob, FluidsimSettings *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fluid_is_animated_mesh(FluidsimSettings *fss)
|
static bool fluid_is_animated_mesh(FluidsimSettings *fss)
|
||||||
{
|
{
|
||||||
return ((fss->type == OB_FLUIDSIM_CONTROL) || fss->domainNovecgen);
|
return ((fss->type == OB_FLUIDSIM_CONTROL) || fss->domainNovecgen);
|
||||||
}
|
}
|
||||||
@ -496,7 +496,7 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
|
|||||||
float *verts=NULL;
|
float *verts=NULL;
|
||||||
int *tris=NULL;
|
int *tris=NULL;
|
||||||
int numVerts=0, numTris=0;
|
int numVerts=0, numTris=0;
|
||||||
int deform = fluid_is_animated_mesh(fluidmd->fss);
|
bool deform = fluid_is_animated_mesh(fluidmd->fss);
|
||||||
|
|
||||||
elbeemMesh fsmesh;
|
elbeemMesh fsmesh;
|
||||||
|
|
||||||
|
@ -913,7 +913,7 @@ static void region_overlap_fix(ScrArea *sa, ARegion *ar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* overlapping regions only in the following restricted cases */
|
/* 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 (U.uiflag2 & USER_REGION_OVERLAP) {
|
||||||
if (WM_is_draw_triple(win)) {
|
if (WM_is_draw_triple(win)) {
|
||||||
|
@ -2217,7 +2217,7 @@ static void SCREEN_OT_marker_jump(wmOperatorType *ot)
|
|||||||
|
|
||||||
/* ************** switch screen operator ***************************** */
|
/* ************** 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) &&
|
return ((screen->winid == 0) &&
|
||||||
(screen->full == 0) &&
|
(screen->full == 0) &&
|
||||||
|
@ -587,7 +587,7 @@ BLI_INLINE bool sculpt_brush_test_clipping(SculptBrushTest *test, const float co
|
|||||||
return (rv3d && (ED_view3d_clipping_test(rv3d, co, true)));
|
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);
|
float distsq = len_squared_v3v3(co, test->location);
|
||||||
|
|
||||||
@ -603,7 +603,7 @@ static int sculpt_brush_test(SculptBrushTest *test, const float co[3])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
float distsq = len_squared_v3v3(co, test->location);
|
||||||
|
|
||||||
@ -619,7 +619,7 @@ static int sculpt_brush_test_sq(SculptBrushTest *test, const float co[3])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)) {
|
if (sculpt_brush_test_clipping(test, co)) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -627,7 +627,7 @@ static int sculpt_brush_test_fast(SculptBrushTest *test, float co[3])
|
|||||||
return len_squared_v3v3(co, test->location) <= test->radius_squared;
|
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 side = M_SQRT1_2;
|
||||||
float local_co[3];
|
float local_co[3];
|
||||||
@ -680,7 +680,7 @@ static float frontface(Brush *br, const float sculpt_normal[3],
|
|||||||
|
|
||||||
#if 0
|
#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)) {
|
if (sculpt_brush_test_fast(test, co)) {
|
||||||
float t1[3], t2[3], t3[3], dist;
|
float t1[3], t2[3], t3[3], dist;
|
||||||
|
@ -1101,7 +1101,7 @@ typedef struct TrackMarkersJob {
|
|||||||
struct bScreen *screen;
|
struct bScreen *screen;
|
||||||
} TrackMarkersJob;
|
} TrackMarkersJob;
|
||||||
|
|
||||||
static int track_markers_testbreak(void)
|
static bool track_markers_testbreak(void)
|
||||||
{
|
{
|
||||||
return G.is_break;
|
return G.is_break;
|
||||||
}
|
}
|
||||||
|
@ -745,19 +745,17 @@ void filelist_setfilter_types(struct FileList *filelist, const char *filter_glob
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* would recognize .blend as well */
|
/* 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;
|
const size_t a = strlen(str);
|
||||||
int retval = 0;
|
size_t b = 7;
|
||||||
|
bool retval = 0;
|
||||||
a = strlen(str);
|
|
||||||
b = 7;
|
|
||||||
|
|
||||||
if (a == 0 || b >= a) {
|
if (a == 0 || b >= a) {
|
||||||
/* pass */
|
/* pass */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char *loc;
|
const char *loc;
|
||||||
|
|
||||||
if (a > b + 1)
|
if (a > b + 1)
|
||||||
b++;
|
b++;
|
||||||
|
@ -328,7 +328,7 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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) &&
|
return (ob && (ob->mode & OB_MODE_SCULPT) &&
|
||||||
ob->sculpt && ob->sculpt->bm);
|
ob->sculpt && ob->sculpt->bm);
|
||||||
|
@ -100,7 +100,7 @@ static int node_tree_interface_poll(const bContext *C, PanelType *UNUSED(pt))
|
|||||||
return (snode && snode->edittree && (snode->edittree->inputs.first || snode->edittree->outputs.first));
|
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;
|
bNodeSocket *sock;
|
||||||
for (sock = ntree->inputs.first; sock; sock = sock->next) {
|
for (sock = ntree->inputs.first; sock; sock = sock->next) {
|
||||||
|
@ -78,7 +78,7 @@ static int sort_nodes_locx(void *a, void *b)
|
|||||||
return 0;
|
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))
|
if (nodeSocketIsHidden(sock))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -419,12 +419,12 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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));
|
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) return 0;
|
||||||
if (pred == seq) return 0;
|
if (pred == seq) return 0;
|
||||||
|
@ -306,7 +306,7 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fcu_test_selected(FCurve *fcu)
|
static bool fcu_test_selected(FCurve *fcu)
|
||||||
{
|
{
|
||||||
BezTriple *bezt = fcu->bezt;
|
BezTriple *bezt = fcu->bezt;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -304,7 +304,7 @@ static void stitch_uv_rotate(float mat[2][2], float medianPoint[2], float uv[2],
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if two uvelements are stitchable. This should only operate on -different- separate UvElements */
|
/* 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;
|
BMesh *bm = state->em->bm;
|
||||||
float limit;
|
float limit;
|
||||||
@ -339,7 +339,7 @@ static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_it
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
BMesh *bm = state->em->bm;
|
||||||
float limit;
|
float limit;
|
||||||
@ -381,7 +381,7 @@ static int stitch_check_edges_stitchable(UvEdge *edge, UvEdge *edge_iter, Stitch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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) ||
|
if ((state->snap_islands && element->island == element_iter->island) ||
|
||||||
(!state->midpoints && element->island == element_iter->island))
|
(!state->midpoints && element->island == element_iter->island))
|
||||||
@ -393,7 +393,7 @@ static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *elem
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) ||
|
if ((state->snap_islands && edge->element->island == edge_iter->element->island) ||
|
||||||
(!state->midpoints && edge->element->island == edge_iter->element->island))
|
(!state->midpoints && edge->element->island == edge_iter->element->island))
|
||||||
|
@ -66,7 +66,7 @@ extern "C" {
|
|||||||
#define DEFAULT_DKR_EPSILON 0.0f
|
#define DEFAULT_DKR_EPSILON 0.0f
|
||||||
|
|
||||||
// Freestyle configuration
|
// Freestyle configuration
|
||||||
static short freestyle_is_initialized = 0;
|
static bool freestyle_is_initialized = false;
|
||||||
static Config::Path *pathconfig = NULL;
|
static Config::Path *pathconfig = NULL;
|
||||||
static Controller *controller = NULL;
|
static Controller *controller = NULL;
|
||||||
static AppView *view = NULL;
|
static AppView *view = NULL;
|
||||||
|
@ -1130,7 +1130,7 @@ static int exr_has_alpha(InputFile *file)
|
|||||||
return !(file->header().channels().findChannel("A") == 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 StringAttribute *comments = file->header().findTypedAttribute<StringAttribute>("BlenderMultiChannel");
|
||||||
const ChannelList &channels = file->header().channels();
|
const ChannelList &channels = file->header().channels();
|
||||||
@ -1174,7 +1174,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags, char
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Mem_IStream *membuf = new Mem_IStream(mem, size);
|
Mem_IStream *membuf = new Mem_IStream(mem, size);
|
||||||
int is_multi;
|
bool is_multi;
|
||||||
file = new InputFile(*membuf);
|
file = new InputFile(*membuf);
|
||||||
|
|
||||||
Box2i dw = file->header().dataWindow();
|
Box2i dw = file->header().dataWindow();
|
||||||
|
@ -223,7 +223,7 @@ static Node *addnode(Octree *oc)
|
|||||||
return oc->adrnode[index] + (oc->nodecount & 4095);
|
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;
|
static float nor[3], d;
|
||||||
float fx, fy, fz;
|
float fx, fy, fz;
|
||||||
|
@ -119,10 +119,10 @@ static void wm_area_mark_invalid_backbuf(ScrArea *sa)
|
|||||||
((View3D *)sa->spacedata.first)->flag |= V3D_INVALID_BACKBUF;
|
((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)
|
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
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -706,7 +706,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
|
|||||||
/****************** main update call **********************/
|
/****************** main update call **********************/
|
||||||
|
|
||||||
/* quick test to prevent changing window drawable */
|
/* 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;
|
ScrArea *sa;
|
||||||
ARegion *ar;
|
ARegion *ar;
|
||||||
|
@ -146,7 +146,7 @@ void wm_event_init_from_window(wmWindow *win, wmEvent *event)
|
|||||||
|
|
||||||
/* ********************* notifiers, listeners *************** */
|
/* ********************* 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;
|
wmNotifier *note;
|
||||||
|
|
||||||
|
@ -1167,7 +1167,7 @@ void WM_keyconfig_update_operatortype(void)
|
|||||||
wm_keymap_update_flag |= WM_KEYMAP_UPDATE_OPERATORTYPE;
|
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;
|
wmKeyMapItem *kmi;
|
||||||
int update;
|
int update;
|
||||||
@ -1180,7 +1180,7 @@ static int wm_keymap_test_and_clear_update(wmKeyMap *km)
|
|||||||
kmi->flag &= ~KMI_UPDATE;
|
kmi->flag &= ~KMI_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return update;
|
return (update != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static wmKeyMap *wm_keymap_preset(wmWindowManager *wm, wmKeyMap *km)
|
static wmKeyMap *wm_keymap_preset(wmWindowManager *wm, wmKeyMap *km)
|
||||||
|
Loading…
Reference in New Issue
Block a user