Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c47
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c30
-rw-r--r--source/blender/editors/space_view3d/drawobject.c278
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c119
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c152
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c163
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h16
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c34
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c258
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c56
16 files changed, 620 insertions, 575 deletions
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index f37437b159d..cb685b59b64 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -144,7 +144,7 @@ static void cp_shade_color3ub(unsigned char cp[3], const int offset)
}
/* This function sets the gl-color for coloring a certain bone (based on bcolor) */
-static short set_pchan_glColor(short colCode, int boneflag, short constflag)
+static bool set_pchan_glColor(short colCode, int boneflag, short constflag)
{
switch (colCode) {
case PCHAN_COLOR_NORMAL:
@@ -184,7 +184,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag)
}
}
- return 1;
+ return true;
}
break;
@@ -196,7 +196,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag)
else
UI_ThemeColor(TH_BONE_SOLID);
- return 1;
+ return true;
}
break;
@@ -208,7 +208,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag)
else if (constflag & PCHAN_HAS_SPLINEIK) glColor4ub(200, 255, 0, 80);
else if (constflag & PCHAN_HAS_CONST) glColor4ub(0, 255, 120, 80);
- return 1;
+ return true;
}
else
return 0;
@@ -238,7 +238,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag)
else UI_ThemeColor(TH_BONE_SOLID);
}
- return 1;
+ return true;
}
break;
case PCHAN_COLOR_SPHEREBONE_END:
@@ -288,12 +288,12 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag)
UI_ThemeColorShade(TH_BACK, -30);
}
- return 1;
+ return true;
}
break;
}
- return 0;
+ return false;
}
static void set_ebone_glColor(const unsigned int boneflag)
@@ -1660,7 +1660,7 @@ static void bone_matrix_translate_y(float mat[4][4], float y)
/* assumes object is Armature with pose */
static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
const short dt, const unsigned char ob_wire_col[4],
- const short do_const_color, const short is_outline)
+ const bool do_const_color, const bool is_outline)
{
RegionView3D *rv3d = ar->regiondata;
Object *ob = base->object;
@@ -1670,7 +1670,8 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
GLfloat tmp;
float smat[4][4], imat[4][4], bmat[4][4];
int index = -1;
- short do_dashed = 3, draw_wire = FALSE;
+ short do_dashed = 3;
+ bool draw_wire = false;
int flag;
/* being set below */
@@ -1736,7 +1737,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0))
{
if (bone->layer & arm->layer) {
- int use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
+ const bool use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
glPushMatrix();
if (use_custom && pchan->custom_tx) {
@@ -1767,7 +1768,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (use_custom) {
/* if drawwire, don't try to draw in solid */
if (pchan->bone->flag & BONE_DRAWWIRE) {
- draw_wire = 1;
+ draw_wire = true;
}
else {
draw_custom_bone(scene, v3d, rv3d, pchan->custom,
@@ -1801,7 +1802,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* very very confusing... but in object mode, solid draw, we cannot do glLoadName yet,
* stick bones and/or wire custom-shapes are drawn in next loop
*/
- if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == 0)) {
+ if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == false)) {
/* object tag, for bordersel optim */
glLoadName(index & 0xFFFF);
index = -1;
@@ -1810,7 +1811,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* draw custom bone shapes as wireframes */
if (!(arm->flag & ARM_NO_CUSTOM) &&
- ((draw_wire) || (dt <= OB_WIRE)) )
+ (draw_wire || (dt <= OB_WIRE)) )
{
if (arm->flag & ARM_POSEMODE)
index = base->selcol;
@@ -2384,7 +2385,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2466,7 +2467,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2539,7 +2540,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
}
@@ -2554,7 +2555,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
}
}
@@ -2579,16 +2580,16 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
/* called from drawobject.c, return 1 if nothing was drawn
* (ob_wire_col == NULL) when drawing ghost */
-int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
- const short dt, const short dflag, const unsigned char ob_wire_col[4],
- const short is_outline)
+bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
+ const short dt, const short dflag, const unsigned char ob_wire_col[4],
+ const bool is_outline)
{
Object *ob = base->object;
bArmature *arm = ob->data;
- int retval = 0;
+ bool retval = false;
if (v3d->flag2 & V3D_RENDER_OVERRIDE)
- return 1;
+ return true;
if (dt > OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
/* we use color for solid lighting */
@@ -2652,7 +2653,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
UI_ThemeColor(TH_WIRE); /* restore, for extra draw stuff */
}
else {
- retval = 1;
+ retval = true;
}
}
/* restore */
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 9000ccbf324..b13f395b80b 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -240,13 +240,13 @@ static struct TextureDrawState {
unsigned char obcol[4];
} Gtexdraw = {NULL, 0, 0, 0, false, {0, 0, 0, 0}};
-static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *ma, struct TextureDrawState gtexdraw)
+static bool set_draw_settings_cached(int clearcache, MTFace *texface, Material *ma, struct TextureDrawState gtexdraw)
{
static Material *c_ma;
static int c_textured;
static MTFace c_texface;
static int c_backculled;
- static int c_badtex;
+ static bool c_badtex;
static int c_lit;
static int c_has_texface;
@@ -256,12 +256,12 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
int textured = 0;
int lit = 0;
int has_texface = texface != NULL;
- int need_set_tpage = FALSE;
+ bool need_set_tpage = false;
if (clearcache) {
c_textured = c_lit = c_backculled = -1;
memset(&c_texface, 0, sizeof(MTFace));
- c_badtex = 0;
+ c_badtex = false;
c_has_texface = -1;
}
else {
@@ -307,7 +307,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
}
else {
GPU_set_tpage(NULL, 0, 0);
- c_badtex = 0;
+ c_badtex = false;
}
c_textured = textured;
c_has_texface = has_texface;
@@ -345,7 +345,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
{
unsigned char obcol[4];
- int is_tex, solidtex;
+ bool is_tex, solidtex;
Mesh *me = ob->data;
/* XXX scene->obedit warning */
@@ -353,24 +353,24 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
/* texture draw is abused for mask selection mode, do this so wire draw
* with face selection in weight paint is not lit. */
if ((v3d->drawtype <= OB_WIRE) && (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))) {
- solidtex = FALSE;
+ solidtex = false;
Gtexdraw.is_lit = 0;
}
else if (v3d->drawtype == OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype != OB_TEXTURE)) {
/* draw with default lights in solid draw mode and edit mode */
- solidtex = TRUE;
+ solidtex = true;
Gtexdraw.is_lit = -1;
}
else {
/* draw with lights in the scene otherwise */
- solidtex = FALSE;
+ solidtex = false;
Gtexdraw.is_lit = GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp);
}
rgba_float_to_uchar(obcol, ob->col);
- if (solidtex || v3d->drawtype == OB_TEXTURE) is_tex = 1;
- else is_tex = 0;
+ if (solidtex || v3d->drawtype == OB_TEXTURE) is_tex = true;
+ else is_tex = false;
Gtexdraw.ob = ob;
Gtexdraw.is_tex = is_tex;
@@ -412,7 +412,7 @@ static void draw_textured_end(void)
static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr)
{
Material *ma = give_current_material(Gtexdraw.ob, matnr + 1);
- int invalidtexture = 0;
+ bool invalidtexture = false;
if (ma && (ma->game.flag & GEMAT_INVISIBLE))
return DM_DRAW_OPTION_SKIP;
@@ -867,7 +867,7 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
if (ED_object_get_active_image(data->ob, mat_nr, &ima, &iuser, &node)) {
/* get openl texture */
int mipmap = 1;
- int bindcode = (ima) ? GPU_verify_image(ima, iuser, 0, 0, mipmap, FALSE) : 0;
+ int bindcode = (ima) ? GPU_verify_image(ima, iuser, 0, 0, mipmap, false) : 0;
float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
if (bindcode) {
@@ -1020,7 +1020,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
{
DMSetDrawOptions facemask = NULL;
Mesh *me = ob->data;
- const short do_light = (v3d->drawtype >= OB_SOLID);
+ const bool do_light = (v3d->drawtype >= OB_SOLID);
/* hide faces in face select mode */
if (me->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL))
@@ -1070,7 +1070,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
if (draw_flags & DRAW_FACE_SELECT) {
draw_mesh_face_select(rv3d, me, dm);
}
- else if ((do_light == FALSE) || (ob->dtx & OB_DRAWWIRE)) {
+ else if ((do_light == false) || (ob->dtx & OB_DRAWWIRE)) {
const int use_depth = (v3d->flag & V3D_ZBUF_SELECT) || !(ob->mode & OB_MODE_WEIGHT_PAINT);
/* weight paint in solid mode, special case. focus on making the weights clear
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 15c3385f67c..8eae1571933 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -195,61 +195,61 @@ static bool check_object_draw_texture(Scene *scene, View3D *v3d, int drawtype)
return false;
}
-static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
+static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
{
if ((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0)
- return 0;
+ return false;
if (G.f & G_BACKBUFSEL)
- return 0;
+ return false;
if ((vd->flag & V3D_ZBUF_SELECT) == 0)
- return 1;
+ return true;
/* if its drawing textures with zbuf sel, then don't draw dots */
if (dt == OB_TEXTURE && vd->drawtype == OB_TEXTURE)
- return 0;
+ return false;
if ((vd->drawtype >= OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX))
- return 0;
+ return false;
- return 1;
+ return true;
}
/* ************************ */
/* check for glsl drawing */
-int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const char dt)
+bool draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const char dt)
{
if (!GPU_glsl_support())
- return 0;
+ return false;
if (G.f & G_PICKSEL)
- return 0;
+ return false;
if (!check_object_draw_texture(scene, v3d, dt))
- return 0;
+ return false;
if (ob == OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
- return 0;
+ return false;
if (v3d->flag2 & V3D_SHOW_SOLID_MATCAP)
- return 1;
+ return true;
if (BKE_scene_use_new_shading_nodes(scene))
- return 0;
+ return false;
return (scene->gm.matmode == GAME_MAT_GLSL) && (dt > OB_SOLID);
}
-static int check_alpha_pass(Base *base)
+static bool check_alpha_pass(Base *base)
{
if (base->flag & OB_FROMDUPLI)
- return 0;
+ return false;
if (G.f & G_PICKSEL)
- return 0;
+ return false;
if (base->object->mode & OB_MODE_ALL_PAINT)
- return 0;
+ return false;
return (base->object->dtx & OB_DRAWTRANSP);
}
@@ -607,10 +607,16 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char
glScalef(scale * sca_x, scale * sca_y, 1.0f);
if (ibuf && ibuf->rect) {
+ const bool use_clip = (U.glalphaclip != 1.0f);
/* Setup GL params */
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ if (use_clip) {
+ glEnable(GL_ALPHA_TEST);
+ glAlphaFunc(GL_GREATER, U.glalphaclip);
+ }
+
/* Use the object color and alpha */
glColor4fv(ob->col);
@@ -619,6 +625,11 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
glDisable(GL_BLEND);
+
+ if (use_clip) {
+ glDisable(GL_ALPHA_TEST);
+ glAlphaFunc(GL_GREATER, 0.0f);
+ }
}
if ((dflag & DRAW_CONSTCOLOR) == 0) {
@@ -758,7 +769,7 @@ void view3d_cached_text_draw_add(const float co[3],
memcpy(++vos, str, alloc_len);
}
-void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, float mat[4][4])
+void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, bool depth_write, float mat[4][4])
{
RegionView3D *rv3d = ar->regiondata;
ListBase *strings = &CachedText[CachedTextLevel - 1];
@@ -1098,13 +1109,13 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
unsigned char col[4];
/* cone can't be drawn for duplicated lamps, because duplilist would be freed to */
/* the moment of view3d_draw_transp() call */
- const short is_view = (rv3d->persp == RV3D_CAMOB && v3d->camera == base->object);
- const short drawcone = ((dt > OB_WIRE) &&
- !(G.f & G_PICKSEL) &&
- (la->type == LA_SPOT) &&
- (la->mode & LA_SHOW_CONE) &&
- !(base->flag & OB_FROMDUPLI) &&
- !is_view);
+ const bool is_view = (rv3d->persp == RV3D_CAMOB && v3d->camera == base->object);
+ const bool drawcone = ((dt > OB_WIRE) &&
+ !(G.f & G_PICKSEL) &&
+ (la->type == LA_SPOT) &&
+ (la->mode & LA_SHOW_CONE) &&
+ !(base->flag & OB_FROMDUPLI) &&
+ !is_view);
if (drawcone && !v3d->transp) {
/* in this case we need to draw delayed */
@@ -1370,7 +1381,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
setlinestyle(0);
- if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == FALSE)) {
+ if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == false)) {
drawshadbuflimits(la, ob->obmat);
}
@@ -1402,20 +1413,22 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
}
-static void draw_limit_line(float sta, float end, unsigned int col)
+static void draw_limit_line(float sta, float end, const short dflag, unsigned int col)
{
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, -sta);
glVertex3f(0.0, 0.0, -end);
glEnd();
- glPointSize(3.0);
- glBegin(GL_POINTS);
- cpack(col);
- glVertex3f(0.0, 0.0, -sta);
- glVertex3f(0.0, 0.0, -end);
- glEnd();
- glPointSize(1.0);
+ if (!(dflag & DRAW_PICKING)) {
+ glPointSize(3.0);
+ glBegin(GL_POINTS);
+ cpack(col);
+ glVertex3f(0.0, 0.0, -sta);
+ glVertex3f(0.0, 0.0, -end);
+ glEnd();
+ glPointSize(1.0);
+ }
}
@@ -1433,7 +1446,7 @@ static void draw_focus_cross(float dist, float size)
#ifdef VIEW3D_CAMERA_BORDER_HACK
unsigned char view3d_camera_border_hack_col[3];
-short view3d_camera_border_hack_test = FALSE;
+bool view3d_camera_border_hack_test = false;
#endif
/* ****************** draw clip data *************** */
@@ -1464,7 +1477,7 @@ static void draw_bundle_sphere(void)
static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D *v3d,
MovieClip *clip, MovieTrackingObject *tracking_object,
const short dflag, const unsigned char ob_wire_col[4],
- int *global_track_index, int draw_selected)
+ int *global_track_index, bool draw_selected)
{
MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *track;
@@ -1619,7 +1632,7 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, MovieClip *clip,
const short dflag, const unsigned char ob_wire_col[4],
- int draw_selected)
+ const bool draw_selected)
{
MovieTracking *tracking = &clip->tracking;
MovieTrackingObject *tracking_object;
@@ -1668,13 +1681,13 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
float vec[4][3], asp[2], shift[2], scale[3];
int i;
float drawsize;
- const short is_view = (rv3d->persp == RV3D_CAMOB && ob == v3d->camera);
+ const bool is_view = (rv3d->persp == RV3D_CAMOB && ob == v3d->camera);
MovieClip *clip = BKE_object_movieclip_get(scene, base->object, 0);
/* draw data for movie clip set as active for scene */
if (clip) {
- draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, FALSE);
- draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, TRUE);
+ draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, false);
+ draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, true);
}
#ifdef VIEW3D_CAMERA_BORDER_HACK
@@ -1689,7 +1702,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
glGetFloatv(GL_CURRENT_COLOR, col);
rgb_float_to_uchar(view3d_camera_border_hack_col, col);
}
- view3d_camera_border_hack_test = TRUE;
+ view3d_camera_border_hack_test = true;
return;
}
#endif
@@ -1756,10 +1769,9 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
glEnd();
}
- if (dflag == 0) {
- if (cam->flag & (CAM_SHOWLIMITS + CAM_SHOWMIST)) {
+ if ((dflag & DRAW_SCENESET) == 0) {
+ if (cam->flag & (CAM_SHOWLIMITS | CAM_SHOWMIST)) {
float nobmat[4][4];
- World *wrld;
/* draw in normalized object matrix space */
copy_m4_m4(nobmat, ob->obmat);
@@ -1770,15 +1782,17 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
glMultMatrixf(nobmat);
if (cam->flag & CAM_SHOWLIMITS) {
- draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF);
+ draw_limit_line(cam->clipsta, cam->clipend, dflag, 0x77FFFF);
/* qdn: was yafray only, now also enabled for Blender to be used with defocus composite node */
draw_focus_cross(BKE_camera_object_dof_distance(ob), cam->drawsize);
}
- wrld = scene->world;
- if (cam->flag & CAM_SHOWMIST)
- if (wrld) draw_limit_line(wrld->miststa, wrld->miststa + wrld->mistdist, 0xFFFFFF);
-
+ if (cam->flag & CAM_SHOWMIST) {
+ World *world = scene->world;
+ if (world) {
+ draw_limit_line(world->miststa, world->miststa + world->mistdist, dflag, 0xFFFFFF);
+ }
+ }
glPopMatrix();
}
}
@@ -1857,13 +1871,13 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel)
bglEnd();
}
-static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, int use_wcol)
+static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, int actdef_wcol)
{
int index = ((w * lt->pntsv + v) * lt->pntsu) + u;
- if (use_wcol) {
+ if (actdef_wcol) {
float col[3];
- MDeformWeight *mdw = defvert_find_index(lt->dvert + index, use_wcol - 1);
+ MDeformWeight *mdw = defvert_find_index(lt->dvert + index, actdef_wcol - 1);
weight_to_rgb(col, mdw ? mdw->weight : 0.0f);
glColor3fv(col);
@@ -1884,7 +1898,8 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
Lattice *lt = ob->data;
DispList *dl;
int u, v, w;
- int use_wcol = FALSE, is_edit = (lt->editlatt != NULL);
+ int actdef_wcol = 0;
+ const bool is_edit = (lt->editlatt != NULL);
/* now we default make displist, this will modifiers work for non animated case */
if (ob->disp.first == NULL)
@@ -1897,7 +1912,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
cpack(0x004000);
if (ob->defbase.first && lt->dvert) {
- use_wcol = ob->actdef;
+ actdef_wcol = ob->actdef;
glShadeModel(GL_SMOOTH);
}
}
@@ -1911,16 +1926,16 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
int uxt = (u == 0 || u == lt->pntsu - 1);
if (w && ((uxt || vxt) || !(lt->flag & LT_OUTSIDE))) {
- drawlattice__point(lt, dl, u, v, w - 1, use_wcol);
- drawlattice__point(lt, dl, u, v, w, use_wcol);
+ drawlattice__point(lt, dl, u, v, w - 1, actdef_wcol);
+ drawlattice__point(lt, dl, u, v, w, actdef_wcol);
}
if (v && ((uxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
- drawlattice__point(lt, dl, u, v - 1, w, use_wcol);
- drawlattice__point(lt, dl, u, v, w, use_wcol);
+ drawlattice__point(lt, dl, u, v - 1, w, actdef_wcol);
+ drawlattice__point(lt, dl, u, v, w, actdef_wcol);
}
if (u && ((vxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
- drawlattice__point(lt, dl, u - 1, v, w, use_wcol);
- drawlattice__point(lt, dl, u, v, w, use_wcol);
+ drawlattice__point(lt, dl, u - 1, v, w, actdef_wcol);
+ drawlattice__point(lt, dl, u, v, w, actdef_wcol);
}
}
}
@@ -1928,7 +1943,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
glEnd();
/* restoration for weight colors */
- if (use_wcol)
+ if (actdef_wcol)
glShadeModel(GL_FLAT);
if (is_edit) {
@@ -2422,7 +2437,7 @@ static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *ba
/* double lookup */
data.orig_index_mf_to_mpoly = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
data.orig_index_mp_to_orig = DM_get_poly_data_layer(dm, CD_ORIGINDEX);
- if ((data.orig_index_mf_to_mpoly && data.orig_index_mp_to_orig) == FALSE) {
+ if ((data.orig_index_mf_to_mpoly && data.orig_index_mp_to_orig) == false) {
data.orig_index_mf_to_mpoly = data.orig_index_mp_to_orig = NULL;
}
@@ -2685,7 +2700,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
if (unit->system) {
bUnit_AsString(numstr, sizeof(numstr), len_v3v3(v1, v2) * unit->scale_length, 3,
- unit->system, B_UNIT_LENGTH, do_split, FALSE);
+ unit->system, B_UNIT_LENGTH, do_split, false);
}
else {
sprintf(numstr, conv_float, len_v3v3(v1, v2));
@@ -2708,7 +2723,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
if (unit->system) { \
bUnit_AsString(numstr, sizeof(numstr), \
(double)(area * unit->scale_length * unit->scale_length), \
- 3, unit->system, B_UNIT_AREA, do_split, FALSE); \
+ 3, unit->system, B_UNIT_AREA, do_split, false); \
view3d_cached_text_draw_add(vmid, numstr, 0, \
/* Metric system uses unicode "squared" sign! */ \
txt_flag ^ V3D_CACHE_TEXT_ASCII, col); \
@@ -2769,7 +2784,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
if (is_face_sel || do_moving) {
BMIter liter;
BMLoop *loop;
- int is_first = TRUE;
+ bool is_first = true;
BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) {
if (is_face_sel || (do_moving && BM_elem_flag_test(loop->v, BM_ELEM_SELECT))) {
@@ -2785,7 +2800,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
mul_mat3_m4_v3(ob->obmat, v1);
mul_mat3_m4_v3(ob->obmat, v2);
}
- is_first = FALSE;
+ is_first = false;
}
if (do_global) {
@@ -2892,7 +2907,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
{
Mesh *me = ob->data;
- BMFace *efa_act = BM_active_face_get(em->bm, FALSE, FALSE); /* annoying but active faces is stored differently */
+ BMFace *efa_act = BM_active_face_get(em->bm, false, false); /* annoying but active faces is stored differently */
BMEdge *eed_act = NULL;
BMVert *eve_act = NULL;
@@ -3100,8 +3115,8 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
{
- if ((v3d->transp == FALSE) && /* not when we draw the transparent pass */
- (ob->mode & OB_MODE_ALL_PAINT) == FALSE) /* not when painting (its distracting) - campbell */
+ if ((v3d->transp == false) && /* not when we draw the transparent pass */
+ (ob->mode & OB_MODE_ALL_PAINT) == false) /* not when painting (its distracting) - campbell */
{
glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
glDepthMask(0);
@@ -3358,14 +3373,15 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
/* returns 1 if nothing was drawn, for detecting to draw an object center */
-static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base,
- const char dt, const unsigned char ob_wire_col[4], const short dflag)
+static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base,
+ const char dt, const unsigned char ob_wire_col[4], const short dflag)
{
Object *ob = base->object;
Object *obedit = scene->obedit;
Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
- int do_alpha_after = FALSE, drawlinked = 0, retval = 0, glsl, check_alpha, i;
+ int i;
+ bool do_alpha_after = false, drawlinked = false, retval = false;
/* If we are drawing shadows and any of the materials don't cast a shadow,
* then don't draw the object */
@@ -3373,7 +3389,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
for (i = 0; i < ob->totcol; ++i) {
Material *ma = give_current_material(ob, i);
if (ma && !(ma->mode & MA_SHADBUF)) {
- return 1;
+ return true;
}
}
}
@@ -3381,7 +3397,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
if (obedit && ob != obedit && ob->data == obedit->data) {
if (BKE_key_from_object(ob) || BKE_key_from_object(obedit)) {}
else if (ob->modifiers.first || obedit->modifiers.first) {}
- else drawlinked = 1;
+ else drawlinked = true;
}
/* backface culling */
@@ -3400,7 +3416,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
scene->customdata_mask);
if (dt > OB_WIRE) {
- glsl = draw_glsl_material(scene, ob, v3d, dt);
+ const bool glsl = draw_glsl_material(scene, ob, v3d, dt);
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
}
@@ -3415,8 +3431,8 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
else {
/* ob->bb was set by derived mesh system, do NULL check just to be sure */
if (me->totpoly <= 4 || (!ob->bb || ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb))) {
- glsl = draw_glsl_material(scene, ob, v3d, dt);
- check_alpha = check_alpha_pass(base);
+ const bool glsl = draw_glsl_material(scene, ob, v3d, dt);
+ const bool check_alpha = check_alpha_pass(base);
if (dt == OB_SOLID || glsl) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl,
@@ -3427,7 +3443,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
GPU_end_object_materials();
- if (me->totvert == 0) retval = 1;
+ if (me->totvert == 0) retval = true;
}
}
@@ -3457,11 +3473,11 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* ************** DRAW DISPLIST ****************** */
-static int draw_index_wire = 1;
-static int index3_nors_incr = 1;
+static bool draw_index_wire = true;
+static bool index3_nors_incr = true;
/* returns 1 when nothing was drawn */
-static int drawDispListwire(ListBase *dlbase)
+static bool drawDispListwire(ListBase *dlbase)
{
DispList *dl;
int parts, nr;
@@ -3551,11 +3567,11 @@ static int drawDispListwire(ListBase *dlbase)
glDisableClientState(GL_VERTEX_ARRAY);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- return 0;
+ return false;
}
static void drawDispListsolid(ListBase *lb, Object *ob, const short dflag,
- const unsigned char ob_wire_col[4], int use_glsl)
+ const unsigned char ob_wire_col[4], const bool use_glsl)
{
DispList *dl;
GPUVertexAttribs gattribs;
@@ -3680,14 +3696,14 @@ static void drawCurveDMWired(Object *ob)
dm->drawEdges(dm, 1, 0);
}
-/* return 1 when nothing was drawn */
-static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt)
+/* return true when nothing was drawn */
+static bool drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt)
{
Object *ob = base->object;
DerivedMesh *dm = ob->derivedFinal;
if (!dm) {
- return 1;
+ return true;
}
if (dt > OB_WIRE && dm->getNumTessFaces(dm)) {
@@ -3709,15 +3725,15 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
drawCurveDMWired(ob);
}
- return 0;
+ return false;
}
/**
* Only called by #drawDispList
* \return 1 when nothing was drawn
*/
-static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
- const char dt, const short dflag, const unsigned char ob_wire_col[4])
+static bool drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
+ const char dt, const short dflag, const unsigned char ob_wire_col[4])
{
Object *ob = base->object;
ListBase *lb = NULL;
@@ -3726,8 +3742,8 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d
const short render_only = (v3d->flag2 & V3D_RENDER_OVERRIDE);
const short solid = (dt > OB_WIRE);
- if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == 0) {
- return FALSE;
+ if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == false) {
+ return false;
}
switch (ob->type) {
@@ -3740,45 +3756,45 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d
if (solid) {
dl = lb->first;
if (dl == NULL) {
- return TRUE;
+ return true;
}
if (dl->nors == NULL) BKE_displist_normals_add(lb);
- index3_nors_incr = 0;
+ index3_nors_incr = false;
- if (BKE_displist_has_faces(lb) == 0) {
+ if (BKE_displist_has_faces(lb) == false) {
if (!render_only) {
- draw_index_wire = 0;
+ draw_index_wire = false;
drawDispListwire(lb);
- draw_index_wire = 1;
+ draw_index_wire = true;
}
}
else {
if (draw_glsl_material(scene, ob, v3d, dt)) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, true);
GPU_end_object_materials();
}
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, false);
GPU_end_object_materials();
}
if (cu->editnurb && cu->bevobj == NULL && cu->taperobj == NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
cpack(0);
- draw_index_wire = 0;
+ draw_index_wire = false;
drawDispListwire(lb);
- draw_index_wire = 1;
+ draw_index_wire = true;
}
}
- index3_nors_incr = 1;
+ index3_nors_incr = true;
}
else {
if (!render_only || (render_only && BKE_displist_has_faces(lb))) {
int retval;
- draw_index_wire = 0;
+ draw_index_wire = false;
retval = drawDispListwire(lb);
- draw_index_wire = 1;
+ draw_index_wire = true;
return retval;
}
}
@@ -3790,19 +3806,19 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d
if (solid) {
dl = lb->first;
if (dl == NULL) {
- return TRUE;
+ return true;
}
if (dl->nors == NULL) BKE_displist_normals_add(lb);
if (draw_glsl_material(scene, ob, v3d, dt)) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, true);
GPU_end_object_materials();
}
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, false);
GPU_end_object_materials();
}
}
@@ -3816,19 +3832,19 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d
lb = &ob->disp;
if (lb->first == NULL) BKE_displist_make_mball(scene, ob);
if (lb->first == NULL) {
- return TRUE;
+ return true;
}
if (solid) {
if (draw_glsl_material(scene, ob, v3d, dt)) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, true);
GPU_end_object_materials();
}
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, false);
GPU_end_object_materials();
}
}
@@ -3842,10 +3858,10 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d
return FALSE;
}
-static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
- const char dt, const short dflag, const unsigned char ob_wire_col[4])
+static bool drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
+ const char dt, const short dflag, const unsigned char ob_wire_col[4])
{
- int retval;
+ bool retval;
/* backface culling */
if (v3d->flag2 & V3D_BACKFACE_CULLING) {
@@ -5532,11 +5548,11 @@ static void drawspiral(const float cent[3], float rad, float tmat[4][4], int sta
float vec[3], vx[3], vy[3];
const float tot_inv = (1.0f / (float)CIRCLE_RESOL);
int a;
- char inverse = FALSE;
+ bool inverse = false;
float x, y, fac;
if (start < 0) {
- inverse = TRUE;
+ inverse = true;
start = -start;
}
@@ -5660,9 +5676,9 @@ static void drawcone(const float vec[3], float radius, float height, float tmat[
glEnd();
}
-/* return TRUE if nothing was drawn */
-static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
- const char dt, const short dflag, const unsigned char ob_wire_col[4])
+/* return true if nothing was drawn */
+static bool drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
+ const char dt, const short dflag, const unsigned char ob_wire_col[4])
{
Object *ob = base->object;
MetaBall *mb;
@@ -5690,11 +5706,11 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
if (ml == NULL) {
- return TRUE;
+ return true;
}
if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
- return FALSE;
+ return false;
}
invert_m4_m4(imat, rv3d->viewmatob);
@@ -5738,7 +5754,7 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
ml = ml->next;
}
- return FALSE;
+ return false;
}
static void draw_forcefield(Object *ob, RegionView3D *rv3d,
@@ -6090,24 +6106,24 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
Curve *cu = ob->data;
DerivedMesh *dm = ob->derivedFinal;
- int hasfaces = 0;
+ bool has_faces = false;
if (dm) {
- hasfaces = dm->getNumTessFaces(dm);
+ has_faces = dm->getNumTessFaces(dm);
}
else {
- hasfaces = BKE_displist_has_faces(&ob->disp);
+ has_faces = BKE_displist_has_faces(&ob->disp);
}
- if (hasfaces && ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
- draw_index_wire = 0;
+ if (has_faces && ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
+ draw_index_wire = false;
if (dm) {
draw_mesh_object_outline(v3d, ob, dm);
}
else {
drawDispListwire(&ob->disp);
}
- draw_index_wire = 1;
+ draw_index_wire = true;
}
}
else if (ob->type == OB_MBALL) {
@@ -6118,7 +6134,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
}
else if (ob->type == OB_ARMATURE) {
if (!(ob->mode & OB_MODE_POSE && base == scene->basact))
- draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, ob_wire_col, TRUE);
+ draw_armature(scene, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true);
}
glLineWidth(1.0);
@@ -6143,7 +6159,7 @@ static void draw_wire_extra(Scene *scene, RegionView3D *rv3d, Object *ob, unsign
Curve *cu = ob->data;
if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
if (ob->type == OB_CURVE)
- draw_index_wire = 0;
+ draw_index_wire = false;
if (ob->derivedFinal) {
drawCurveDMWired(ob);
@@ -6153,7 +6169,7 @@ static void draw_wire_extra(Scene *scene, RegionView3D *rv3d, Object *ob, unsign
}
if (ob->type == OB_CURVE)
- draw_index_wire = 1;
+ draw_index_wire = true;
}
}
else if (ob->type == OB_MBALL) {
@@ -6657,7 +6673,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
else {
if (dt > OB_WIRE)
GPU_enable_material(0, NULL); /* we use default material */
- empty_object = draw_armature(scene, v3d, ar, base, dt, dflag, ob_wire_col, FALSE);
+ empty_object = draw_armature(scene, v3d, ar, base, dt, dflag, ob_wire_col, false);
if (dt > OB_WIRE)
GPU_disable_material();
}
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 70d3857601f..3933d8e4753 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -105,7 +105,7 @@ static int intersect_edges(float *points, float a, float b, float c, float d, fl
return numpoints;
}
-static int convex(const float p0[3], const float up[3], const float a[3], const float b[3])
+static bool convex(const float p0[3], const float up[3], const float a[3], const float b[3])
{
/* Vec3 va = a-p0, vb = b-p0; */
float va[3], vb[3], tmp[3];
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 340744839d2..ef16090c39d 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -159,7 +159,7 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
/* ideally would return an rv3d but in some cases the region is needed too
* so return that, the caller can then access the ar->regiondata */
-int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
+bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
{
ScrArea *sa = CTX_wm_area(C);
@@ -175,7 +175,7 @@ int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
if (rv3d && rv3d->viewlock == 0) {
*r_v3d = v3d;
*r_ar = ar;
- return 1;
+ return true;
}
else {
ARegion *ar_unlock_user = NULL;
@@ -198,19 +198,19 @@ int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
if (ar_unlock_user) {
*r_v3d = v3d;
*r_ar = ar_unlock_user;
- return 1;
+ return true;
}
if (ar_unlock) {
*r_v3d = v3d;
*r_ar = ar_unlock;
- return 1;
+ return true;
}
}
}
}
- return 0;
+ return false;
}
/* Most of the time this isn't needed since you could assume the view matrix was
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index bb286194992..533bb30d8d1 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -158,7 +158,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
TransformProperties *tfp;
float median[NBR_TRANSFORM_PROPERTIES], ve_median[NBR_TRANSFORM_PROPERTIES];
int tot, totedgedata, totcurvedata, totlattdata, totskinradius, totcurvebweight;
- int meshdata = FALSE;
+ bool has_meshdata = false;
char defstr[320];
PointerRNA data_ptr;
@@ -253,7 +253,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
}
- meshdata = totedgedata || totskinradius;
+ has_meshdata = (totedgedata || totskinradius);
}
else if (ob->type == OB_CURVE || ob->type == OB_SURF) {
Curve *cu = ob->data;
@@ -360,7 +360,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
if (v3d->flag & V3D_GLOBAL_STATS)
mul_m4_v3(ob->obmat, &median[LOC_X]);
- if (meshdata) {
+ if (has_meshdata) {
if (totedgedata) {
median[M_CREASE] /= (float)totedgedata;
median[M_WEIGHT] /= (float)totedgedata;
@@ -428,7 +428,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiBlockEndAlign(block);
/* Meshes... */
- if (meshdata) {
+ if (has_meshdata) {
if (totedgedata) {
/* customdata layer added on demand */
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN,
@@ -808,8 +808,8 @@ static void editvert_mirror_update(Object *ob, BMVert *eve, int def_nr, int inde
if (def_nr == -1) {
/* all vgroups, add groups where neded */
int flip_map_len;
- int *flip_map = defgroup_flip_map(ob, &flip_map_len, TRUE);
- defvert_sync_mapped(dvert_dst, dvert_src, flip_map, flip_map_len, TRUE);
+ int *flip_map = defgroup_flip_map(ob, &flip_map_len, true);
+ defvert_sync_mapped(dvert_dst, dvert_src, flip_map, flip_map_len, true);
MEM_freeN(flip_map);
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index e27f00de748..66047b6e8f4 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -219,20 +219,20 @@ void ED_view3d_clipping_enable(void)
}
}
-static int view3d_clipping_test(const float co[3], float clip[6][4])
+static bool view3d_clipping_test(const float co[3], float clip[6][4])
{
if (0.0f < clip[0][3] + dot_v3v3(co, clip[0]))
if (0.0f < clip[1][3] + dot_v3v3(co, clip[1]))
if (0.0f < clip[2][3] + dot_v3v3(co, clip[2]))
if (0.0f < clip[3][3] + dot_v3v3(co, clip[3]))
- return 0;
+ return false;
- return 1;
+ return true;
}
/* for 'local' ED_view3d_clipping_local must run first
* then all comparisons can be done in localspace */
-int ED_view3d_clipping_test(RegionView3D *rv3d, const float co[3], const bool is_local)
+bool ED_view3d_clipping_test(RegionView3D *rv3d, const float co[3], const bool is_local)
{
return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
}
@@ -1002,7 +1002,7 @@ void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, R
{
rctf viewborder;
- view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, TRUE, TRUE);
+ view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, true, true);
r_size[0] = BLI_rctf_size_x(&viewborder);
r_size[1] = BLI_rctf_size_y(&viewborder);
}
@@ -1099,7 +1099,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
if (v3d->camera->type == OB_CAMERA)
ca = v3d->camera->data;
- ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false);
/* the offsets */
x1 = viewborder.xmin;
y1 = viewborder.ymin;
@@ -1150,10 +1150,10 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
glRectf(x1i, y1i, x2i, y2i);
#ifdef VIEW3D_CAMERA_BORDER_HACK
- if (view3d_camera_border_hack_test == TRUE) {
+ if (view3d_camera_border_hack_test == true) {
glColor3ubv(view3d_camera_border_hack_col);
glRectf(x1i + 1, y1i + 1, x2i - 1, y2i - 1);
- view3d_camera_border_hack_test = FALSE;
+ view3d_camera_border_hack_test = false;
}
#endif
@@ -1433,6 +1433,13 @@ void view3d_opengl_read_pixels(ARegion *ar, int x, int y, int w, int h, int form
}
}
+/* XXX depth reading exception, for code not using gpu offscreen */
+static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h, int format, int type, void *data)
+{
+
+ glReadPixels(ar->winrct.xmin + x, ar->winrct.ymin + y, w, h, format, type, data);
+}
+
void view3d_validate_backbuf(ViewContext *vc)
{
if (vc->v3d->flag & V3D_INVALID_BACKBUF)
@@ -1590,7 +1597,7 @@ exit:
/* ************************************************************* */
static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
- const short do_foreground, const short do_camera_frame)
+ const bool do_foreground, const bool do_camera_frame)
{
RegionView3D *rv3d = ar->regiondata;
BGpic *bgpic;
@@ -1688,7 +1695,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
if (do_camera_frame) {
rctf vb;
- ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, false);
x1 = vb.xmin;
y1 = vb.ymin;
x2 = vb.xmax;
@@ -1819,7 +1826,12 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
glPixelZoom(zoomx, zoomy);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f - bgpic->blend);
- glaDrawPixelsAuto(x1, y1, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_LINEAR, ibuf->rect);
+
+ /* could not use glaDrawPixelsAuto because it could fallback to
+ * glaDrawPixelsSafe in some cases, which will end up in misssing
+ * alpha transparency for the background image (sergey)
+ */
+ glaDrawPixelsTex(x1, y1, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect);
glPixelZoom(1.0, 1.0);
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
@@ -1843,7 +1855,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
}
static void view3d_draw_bgpic_test(Scene *scene, ARegion *ar, View3D *v3d,
- const short do_foreground, const short do_camera_frame)
+ const bool do_foreground, const bool do_camera_frame)
{
RegionView3D *rv3d = ar->regiondata;
@@ -1990,7 +2002,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
if (base->object->restrictflag & OB_RESTRICT_VIEW) return;
tbase.flag = OB_FROMDUPLI | base->flag;
- lb = object_duplilist(scene, base->object, FALSE);
+ lb = object_duplilist(scene, base->object, false);
// BLI_sortlist(lb, dupli_ob_sort); /* might be nice to have if we have a dupli list with mixed objects. */
dob = dupli_step(lb->first);
@@ -2020,7 +2032,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
/* generate displist, test for new object */
if (dob_prev && dob_prev->ob != dob->ob) {
- if (use_displist == TRUE)
+ if (use_displist == true)
glDeleteLists(displist, 1);
use_displist = -1;
@@ -2042,7 +2054,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
!(bb_tmp = BKE_object_boundbox_get(dob->ob)))
{
// printf("draw_dupli_objects_color: skipping displist for %s\n", dob->ob->id.name + 2);
- use_displist = FALSE;
+ use_displist = false;
}
else {
// printf("draw_dupli_objects_color: using displist for %s\n", dob->ob->id.name + 2);
@@ -2058,7 +2070,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
draw_object(scene, ar, v3d, &tbase, DRAW_CONSTCOLOR);
glEndList();
- use_displist = TRUE;
+ use_displist = true;
BKE_object_boundbox_flag(dob->ob, OB_BB_DISABLED, 0);
}
}
@@ -2099,6 +2111,7 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas
draw_dupli_objects_color(scene, ar, v3d, base, color);
}
+/* XXX warning, not using gpu offscreen here */
void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
{
int x, y, w, h;
@@ -2125,7 +2138,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
MEM_freeN(d->depths);
d->depths = NULL;
- d->damaged = FALSE;
+ d->damaged = false;
}
else if (d->w != w ||
d->h != h ||
@@ -2144,13 +2157,14 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths Subset");
- d->damaged = TRUE;
+ d->damaged = true;
}
if (d->damaged) {
- view3d_opengl_read_pixels(ar, d->x, d->y, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
+ /* XXX using special function here, it doesn't use the gpu offscreen system */
+ view3d_opengl_read_Z_pixels(ar, d->x, d->y, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
- d->damaged = FALSE;
+ d->damaged = false;
}
}
@@ -2172,14 +2186,14 @@ void ED_view3d_depth_update(ARegion *ar)
if (d->depths)
MEM_freeN(d->depths);
d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths");
- d->damaged = 1;
+ d->damaged = true;
}
if (d->damaged) {
view3d_opengl_read_pixels(ar, 0, 0, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
- d->damaged = 0;
+ d->damaged = false;
}
}
}
@@ -2228,7 +2242,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
glEnable(GL_DEPTH_TEST);
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
- draw_gpencil_view3d(scene, v3d, ar, TRUE);
+ draw_gpencil_view3d(scene, v3d, ar, true);
}
v3d->zbuf = zbuf;
@@ -2410,7 +2424,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
if (ob->transflag & OB_DUPLI) {
DupliObject *dob;
- ListBase *lb = object_duplilist(scene, ob, FALSE);
+ ListBase *lb = object_duplilist(scene, ob, false);
for (dob = lb->first; dob; dob = dob->next)
if (dob->ob->type == OB_LAMP)
@@ -2449,7 +2463,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
invert_m4_m4(rv3d.persinv, rv3d.viewinv);
/* no need to call ED_view3d_draw_offscreen_init since shadow buffers were already updated */
- ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat, FALSE);
+ ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat, false);
GPU_lamp_shadow_buffer_unbind(shadow->lamp);
v3d->drawtype = drawtype;
@@ -2597,7 +2611,7 @@ void ED_view3d_draw_offscreen_init(Scene *scene, View3D *v3d)
* stuff like shadow buffers
*/
void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy,
- float viewmat[4][4], float winmat[4][4], int do_bgpic)
+ float viewmat[4][4], float winmat[4][4], bool do_bgpic)
{
RegionView3D *rv3d = ar->regiondata;
Base *base;
@@ -2648,7 +2662,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* important to do before clipping */
if (do_bgpic) {
- view3d_draw_bgpic_test(scene, ar, v3d, FALSE, FALSE);
+ view3d_draw_bgpic_test(scene, ar, v3d, false, false);
}
if (rv3d->rflag & RV3D_CLIPPING)
@@ -2682,7 +2696,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* must be before xray draw which clears the depth buffer */
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
- draw_gpencil_view3d(scene, v3d, ar, TRUE);
+ draw_gpencil_view3d(scene, v3d, ar, true);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
@@ -2696,7 +2710,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* important to do after clipping */
if (do_bgpic) {
- view3d_draw_bgpic_test(scene, ar, v3d, TRUE, FALSE);
+ view3d_draw_bgpic_test(scene, ar, v3d, true, false);
}
/* cleanup */
@@ -2711,7 +2725,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
- draw_gpencil_view3d(scene, v3d, ar, FALSE);
+ draw_gpencil_view3d(scene, v3d, ar, false);
}
/* freeing the images again here could be done after the operator runs, leaving for now */
@@ -2753,7 +2767,7 @@ static void offscreen_imbuf_add_sky(ImBuf *ibuf, Scene *scene)
/* utility func for ED_view3d_draw_offscreen */
ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag,
- int draw_background, int alpha_mode, char err_out[256])
+ bool draw_background, int alpha_mode, char err_out[256])
{
RegionView3D *rv3d = ar->regiondata;
ImBuf *ibuf;
@@ -2811,7 +2825,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
/* creates own 3d views, used by the sequencer */
ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int width, int height, unsigned int flag, int drawtype,
- int use_solid_tex, int draw_background, int alpha_mode, char err_out[256])
+ bool use_solid_tex, bool draw_background, int alpha_mode, char err_out[256])
{
View3D v3d = {NULL};
ARegion ar = {NULL};
@@ -2917,7 +2931,7 @@ static void draw_viewport_fps(Scene *scene, rcti *rect)
static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit);
-static int view3d_main_area_do_render_draw(const bContext *C)
+static bool view3d_main_area_do_render_draw(const bContext *C)
{
Scene *scene = CTX_data_scene(C);
RenderEngineType *type = RE_engines_find(scene->r.engine);
@@ -2925,7 +2939,7 @@ static int view3d_main_area_do_render_draw(const bContext *C)
return (type && type->view_update && type->view_draw);
}
-static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw_border)
+static bool view3d_main_area_draw_engine(const bContext *C, ARegion *ar, const bool draw_border)
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -2940,9 +2954,9 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
type = RE_engines_find(scene->r.engine);
if (!(type->view_update && type->view_draw))
- return 0;
+ return false;
- engine = RE_engine_create_ex(type, TRUE);
+ engine = RE_engine_create_ex(type, true);
engine->tile_x = scene->r.tilex;
engine->tile_y = scene->r.tiley;
@@ -2964,7 +2978,7 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
rcti cliprct;
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false);
cliprct.xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder);
cliprct.ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder);
@@ -2992,15 +3006,16 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
glGetIntegerv(GL_SCISSOR_BOX, scissor);
glScissor(cliprct.xmin, cliprct.ymin, BLI_rcti_size_x(&cliprct), BLI_rcti_size_y(&cliprct));
}
- else
- return 0;
+ else {
+ return false;
+ }
}
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (v3d->flag & V3D_DISPBGPICS)
- view3d_draw_bgpic(scene, ar, v3d, FALSE, TRUE);
+ view3d_draw_bgpic(scene, ar, v3d, false, true);
else
fdrawcheckerboard(0, 0, ar->winx, ar->winy);
@@ -3009,14 +3024,14 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
type->view_draw(rv3d->render_engine, C);
if (v3d->flag & V3D_DISPBGPICS)
- view3d_draw_bgpic(scene, ar, v3d, TRUE, TRUE);
+ view3d_draw_bgpic(scene, ar, v3d, true, true);
if (draw_border) {
/* restore scissor as it was before */
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
}
- return 1;
+ return true;
}
static void view3d_main_area_draw_engine_info(RegionView3D *rv3d, ARegion *ar)
@@ -3045,7 +3060,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar)
GLubyte grid_col[VIEWGRAD_RES_X][VIEWGRAD_RES_Y][4];
static float grid_pos[VIEWGRAD_RES_X][VIEWGRAD_RES_Y][3];
static GLushort indices[VIEWGRAD_RES_X - 1][VIEWGRAD_RES_X - 1][4];
- static char buf_calculated = FALSE;
+ static bool buf_calculated = false;
IMB_colormanagement_pixel_to_display_space_v3(col_hor, &scene->world->horr, &scene->view_settings,
&scene->display_settings);
@@ -3084,7 +3099,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar)
}
}
- buf_calculated = TRUE;
+ buf_calculated = true;
}
for (x = 0; x < VIEWGRAD_RES_X; x++) {
@@ -3238,7 +3253,6 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
/* enables anti-aliasing for 3D view drawing */
if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
- // if (!(U.gameflags & USER_DISABLE_AA))
glEnable(GL_MULTISAMPLE_ARB);
}
@@ -3271,7 +3285,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
}
}
- view3d_draw_bgpic_test(scene, ar, v3d, FALSE, TRUE);
+ view3d_draw_bgpic_test(scene, ar, v3d, false, true);
if (rv3d->rflag & RV3D_CLIPPING)
ED_view3d_clipping_set(rv3d);
@@ -3335,7 +3349,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
/* must be before xray draw which clears the depth buffer */
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
- draw_gpencil_view3d(scene, v3d, ar, TRUE);
+ draw_gpencil_view3d(scene, v3d, ar, true);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
@@ -3350,13 +3364,12 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
ED_view3d_clipping_disable();
/* important to do after clipping */
- view3d_draw_bgpic_test(scene, ar, v3d, TRUE, TRUE);
+ view3d_draw_bgpic_test(scene, ar, v3d, true, true);
BIF_draw_manipulator(C);
/* Disable back anti-aliasing */
if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
- // if (!(U.gameflags & USER_DISABLE_AA))
glDisable(GL_MULTISAMPLE_ARB);
}
@@ -3404,7 +3417,7 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
- draw_gpencil_view3d(scene, v3d, ar, FALSE);
+ draw_gpencil_view3d(scene, v3d, ar, false);
}
if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
@@ -3456,12 +3469,12 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
const char *grid_unit = NULL;
- int draw_border = FALSE;
+ bool draw_border = false;
if (rv3d->persp == RV3D_CAMOB)
- draw_border = scene->r.mode & R_BORDER;
+ draw_border = (scene->r.mode & R_BORDER) != 0;
else
- draw_border = v3d->flag2 & V3D_RENDER_BORDER;
+ draw_border = (v3d->flag2 & V3D_RENDER_BORDER) != 0;
/* draw viewport using opengl */
if (v3d->drawtype != OB_RENDER || !view3d_main_area_do_render_draw(C) || draw_border) {
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index a8e9c8b6cba..9d9dd0535ff 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -88,7 +88,7 @@
/* ********************** view3d_edit: view manipulations ********************* */
-int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
+bool ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
{
return ((v3d->camera) &&
(v3d->camera->id.lib == NULL) &&
@@ -105,8 +105,8 @@ void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d)
}
}
-/* return TRUE if the camera is moved */
-int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
+/* return true if the camera is moved */
+bool ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
{
if (ED_view3d_camera_lock_check(v3d, rv3d)) {
ObjectTfmProtectedChannels obtfm;
@@ -130,7 +130,7 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
mult_m4_m4m4(parent_mat, diff_mat, root_parent->obmat);
BKE_object_tfm_protected_backup(root_parent, &obtfm);
- BKE_object_apply_mat4(root_parent, parent_mat, TRUE, FALSE);
+ BKE_object_apply_mat4(root_parent, parent_mat, true, false);
BKE_object_tfm_protected_restore(root_parent, &obtfm, root_parent->protectflag);
ob_update = v3d->camera;
@@ -149,10 +149,10 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
WM_main_add_notifier(NC_OBJECT | ND_TRANSFORM, v3d->camera);
}
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
@@ -309,7 +309,7 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
}
/* 'clip' is used to know if our clip setting has changed */
-void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip)
+void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip)
{
ARegion *ar_sync = NULL;
RegionView3D *rv3d = ar->regiondata;
@@ -323,7 +323,7 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip)
viewlock = 0;
else if ((viewlock & RV3D_BOXVIEW) == 0) {
viewlock &= ~RV3D_BOXCLIP;
- do_clip = TRUE;
+ do_clip = true;
}
for (; ar; ar = ar->prev) {
@@ -367,12 +367,12 @@ typedef struct ViewOpsData {
float mousevec[3]; /* dolly only */
float reverse, dist0, camzoom0;
float grid, far;
- short axis_snap; /* view rotate only */
+ bool axis_snap; /* view rotate only */
float zfac;
/* use for orbit selection and auto-dist */
float ofs[3], dyn_ofs[3];
- short use_dyn_ofs;
+ bool use_dyn_ofs;
int origx, origy, oldx, oldy;
int origkey; /* the key that triggered the operator */
@@ -432,7 +432,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, const wmEvent *even
vod->origx = vod->oldx = event->x;
vod->origy = vod->oldy = event->y;
vod->origkey = event->type; /* the key that triggered the operator. */
- vod->use_dyn_ofs = (U.uiflag & USER_ORBIT_SELECTION) ? 1 : 0;
+ vod->use_dyn_ofs = (U.uiflag & USER_ORBIT_SELECTION) != 0;
copy_v3_v3(vod->ofs, rv3d->ofs);
if (vod->use_dyn_ofs) {
@@ -454,10 +454,11 @@ static void viewops_data_create(bContext *C, wmOperator *op, const wmEvent *even
negate_v3_v3(vod->dyn_ofs, lastofs);
}
else if (U.uiflag & USER_ZBUF_ORBIT) {
+ Scene *scene = CTX_data_scene(C);
view3d_operator_needs_opengl(C); /* needed for zbuf drawing */
- if ((vod->use_dyn_ofs = ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true))) {
+ if ((vod->use_dyn_ofs = ED_view3d_autodist(scene, vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true))) {
if (rv3d->is_persp) {
float my_origin[3]; /* original G.vd->ofs */
float my_pivot[3]; /* view */
@@ -856,11 +857,11 @@ static int viewrotate_modal(bContext *C, wmOperator *op, const wmEvent *event)
event_code = VIEW_CONFIRM;
break;
case VIEWROT_MODAL_AXIS_SNAP_ENABLE:
- vod->axis_snap = TRUE;
+ vod->axis_snap = true;
event_code = VIEW_APPLY;
break;
case VIEWROT_MODAL_AXIS_SNAP_DISABLE:
- vod->axis_snap = FALSE;
+ vod->axis_snap = false;
event_code = VIEW_APPLY;
break;
case VIEWROT_MODAL_SWITCH_ZOOM:
@@ -1703,7 +1704,7 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
static void viewzoom_apply(ViewOpsData *vod, const int x, const int y, const short viewzoom, const short zoom_invert)
{
float zfac = 1.0;
- short use_cam_zoom;
+ bool use_cam_zoom;
use_cam_zoom = (vod->rv3d->persp == RV3D_CAMOB) && !(vod->rv3d->is_persp && ED_view3d_camera_lock_check(vod->v3d, vod->rv3d));
@@ -1845,9 +1846,9 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
RegionView3D *rv3d;
ScrArea *sa;
ARegion *ar;
- short use_cam_zoom;
+ bool use_cam_zoom;
- int delta = RNA_int_get(op->ptr, "delta");
+ const int delta = RNA_int_get(op->ptr, "delta");
int mx, my;
if (op->customdata) {
@@ -2108,7 +2109,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
ARegion *ar;
float mousevec[3];
- int delta = RNA_int_get(op->ptr, "delta");
+ const int delta = RNA_int_get(op->ptr, "delta");
if (op->customdata) {
ViewOpsData *vod = op->customdata;
@@ -2176,7 +2177,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
if (event->type == MOUSEZOOM) {
- /* Bypass Zoom invert flag for track pads (pass FALSE always) */
+ /* Bypass Zoom invert flag for track pads (pass false always) */
if (U.uiflag & USER_ZOOM_HORIZ) {
vod->origx = vod->oldx = event->x;
@@ -2253,7 +2254,7 @@ void VIEW3D_OT_dolly(wmOperatorType *ot)
static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar,
const float min[3], const float max[3],
- int ok_dist)
+ bool ok_dist)
{
RegionView3D *rv3d = ar->regiondata;
float afm[3];
@@ -2292,7 +2293,7 @@ static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar,
else { /* ortho */
if (size < 0.0001f) {
/* bounding box was a single point so do not zoom */
- ok_dist = 0;
+ ok_dist = false;
}
else {
/* adjust zoom so it looks nicer */
@@ -2327,7 +2328,7 @@ static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar,
/* same as view3d_from_minmax but for all regions (except cameras) */
static void view3d_from_minmax_multi(bContext *C, View3D *v3d,
const float min[3], const float max[3],
- const int ok_dist)
+ const bool ok_dist)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar;
@@ -2350,14 +2351,14 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
Scene *scene = CTX_data_scene(C);
Base *base;
float *curs;
- const short use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
- const short skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
- /* any one of the regions may be locked */
- (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
- int center = RNA_boolean_get(op->ptr, "center");
+ const bool use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
+ const bool skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
+ /* any one of the regions may be locked */
+ (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
+ const bool center = RNA_boolean_get(op->ptr, "center");
float min[3], max[3];
- int ok = 1, onedone = FALSE;
+ bool change = false;
if (center) {
/* in 2.4x this also move the cursor to (0, 0, 0) (with shift+c). */
@@ -2372,16 +2373,16 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
for (base = scene->base.first; base; base = base->next) {
if (BASE_VISIBLE(v3d, base)) {
- onedone = TRUE;
+ change = true;
if (skip_camera && base->object == v3d->camera) {
continue;
}
- BKE_object_minmax(base->object, min, max, FALSE);
+ BKE_object_minmax(base->object, min, max, false);
}
}
- if (!onedone) {
+ if (!change) {
ED_region_tag_redraw(ar);
/* TODO - should this be cancel?
* I think no, because we always move the cursor, with or without
@@ -2393,15 +2394,11 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
return OPERATOR_FINISHED;
}
- if (ok == 0) {
- return OPERATOR_FINISHED;
- }
-
if (use_all_regions) {
- view3d_from_minmax_multi(C, v3d, min, max, TRUE);
+ view3d_from_minmax_multi(C, v3d, min, max, true);
}
else {
- view3d_from_minmax(C, v3d, ar, min, max, TRUE);
+ view3d_from_minmax(C, v3d, ar, min, max, true);
}
return OPERATOR_FINISHED;
@@ -2438,11 +2435,11 @@ static int viewselected_exec(bContext *C, wmOperator *op)
Object *ob = OBACT;
Object *obedit = CTX_data_edit_object(C);
float min[3], max[3];
- int ok = 0, ok_dist = 1;
- const short use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
- const short skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
- /* any one of the regions may be locked */
- (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
+ bool ok = false, ok_dist = true;
+ const bool use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
+ const bool skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
+ /* any one of the regions may be locked */
+ (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
INIT_MINMAX(min, max);
@@ -2505,8 +2502,8 @@ static int viewselected_exec(bContext *C, wmOperator *op)
}
/* account for duplis */
- if (BKE_object_minmax_dupli(scene, base->object, min, max, FALSE) == 0)
- BKE_object_minmax(base->object, min, max, FALSE); /* use if duplis not found */
+ if (BKE_object_minmax_dupli(scene, base->object, min, max, false) == 0)
+ BKE_object_minmax(base->object, min, max, false); /* use if duplis not found */
ok = 1;
}
@@ -2726,7 +2723,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
rcti rect;
rctf vb, border;
- int camera_only = RNA_boolean_get(op->ptr, "camera_only");
+ const bool camera_only = RNA_boolean_get(op->ptr, "camera_only");
if (camera_only && rv3d->persp != RV3D_CAMOB)
return OPERATOR_PASS_THROUGH;
@@ -2737,7 +2734,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
/* calculate range */
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, false);
}
else {
vb.xmin = 0;
@@ -3040,7 +3037,7 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot)
ot->flag = 0;
/* rna */
- WM_operator_properties_gesture_border(ot, FALSE);
+ WM_operator_properties_gesture_border(ot, false);
}
/* sets the view to 1:1 camera/render-pixel */
@@ -3106,7 +3103,7 @@ static EnumPropertyItem prop_view_items[] = {
static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
float q1, float q2, float q3, float q4,
- short view, int perspo, int align_active)
+ short view, int perspo, bool align_active)
{
RegionView3D *rv3d = ar->regiondata; /* no NULL check is needed, poll checks */
float new_quat[4];
@@ -3120,14 +3117,14 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
Object *obact = CTX_data_active_object(C);
if (obact == NULL) {
/* no active object, ignore this option */
- align_active = FALSE;
+ align_active = false;
}
else {
float obact_quat[4];
float twmat[3][3];
/* same as transform manipulator when normal is set */
- ED_getTransformOrientationMatrix(C, twmat, FALSE);
+ ED_getTransformOrientationMatrix(C, twmat, false);
mat3_to_quat(obact_quat, twmat);
invert_qt(obact_quat);
@@ -3137,7 +3134,7 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
}
}
- if (align_active == FALSE) {
+ if (align_active == false) {
/* normal operation */
if (rv3d->viewlock) {
/* only pass on if */
@@ -3186,7 +3183,8 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
RegionView3D *rv3d;
Scene *scene = CTX_data_scene(C);
static int perspo = RV3D_PERSP;
- int viewnum, align_active, nextperspo;
+ int viewnum, nextperspo;
+ bool align_active;
/* no NULL check is needed, poll checks */
ED_view3d_context_user_region(C, &v3d, &ar);
@@ -3197,7 +3195,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
/* set this to zero, gets handled in axis_set_view */
if (rv3d->viewlock)
- align_active = 0;
+ align_active = false;
/* Use this to test if we started out with a camera */
@@ -3584,7 +3582,7 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot)
static int background_image_remove_exec(bContext *C, wmOperator *op)
{
View3D *v3d = CTX_wm_view3d(C);
- int index = RNA_int_get(op->ptr, "index");
+ const int index = RNA_int_get(op->ptr, "index");
BGpic *bgpic_rem = BLI_findlink(&v3d->bgpicbase, index);
if (bgpic_rem) {
@@ -3741,15 +3739,15 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2])
}
if (ED_view3d_project_float_global(ar, fp, mval_fl, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
- short depth_used = FALSE;
+ bool depth_used = false;
if (U.uiflag & USER_ZBUF_CURSOR) { /* maybe this should be accessed some other way */
view3d_operator_needs_opengl(C);
if (ED_view3d_autodist(scene, ar, v3d, mval, fp, true))
- depth_used = TRUE;
+ depth_used = true;
}
- if (depth_used == FALSE) {
+ if (depth_used == false) {
float dvec[3];
VECSUB2D(mval_fl, mval_fl, mval);
ED_view3d_win_to_delta(ar, mval_fl, dvec, zfac);
@@ -3917,7 +3915,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
}
/* XXX todo Zooms in on a border drawn by the user */
-int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride)
+bool ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride)
{
bglMats mats; /* ZBuffer depth vars */
float depth_close = FLT_MAX;
@@ -3930,7 +3928,7 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2]
depth_close = view_autodist_depth_margin(ar, mval, 4);
if (depth_close == FLT_MAX)
- return 0;
+ return false;
cent[0] = (double)mval[0];
cent[1] = (double)mval[1];
@@ -3938,16 +3936,16 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2]
if (!gluUnProject(cent[0], cent[1], depth_close,
mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2]))
{
- return 0;
+ return false;
}
mouse_worldloc[0] = (float)p[0];
mouse_worldloc[1] = (float)p[1];
mouse_worldloc[2] = (float)p[2];
- return 1;
+ return true;
}
-int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode)
+void ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode)
{
/* Get Z Depths, needed for perspective, nice for ortho */
switch (mode) {
@@ -3958,13 +3956,11 @@ int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode)
draw_depth_gpencil(scene, ar, v3d);
break;
}
-
- return 1;
}
-/* no 4x4 sampling, run view_autodist_init first */
-int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3],
- int margin, float *force_depth)
+/* no 4x4 sampling, run #ED_view3d_autodist_init first */
+bool ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3],
+ int margin, float *force_depth)
{
bglMats mats; /* ZBuffer depth vars, could cache? */
float depth;
@@ -3977,7 +3973,7 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl
depth = view_autodist_depth_margin(ar, mval, margin);
if (depth == FLT_MAX)
- return 0;
+ return false;
cent[0] = (double)mval[0];
cent[1] = (double)mval[1];
@@ -3987,23 +3983,23 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl
if (!gluUnProject(cent[0], cent[1], depth,
mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2]))
{
- return 0;
+ return false;
}
mouse_worldloc[0] = (float)p[0];
mouse_worldloc[1] = (float)p[1];
mouse_worldloc[2] = (float)p[2];
- return 1;
+ return true;
}
-int ED_view3d_autodist_depth(ARegion *ar, const int mval[2], int margin, float *depth)
+bool ED_view3d_autodist_depth(ARegion *ar, const int mval[2], int margin, float *depth)
{
*depth = view_autodist_depth_margin(ar, mval, margin);
- return (*depth == FLT_MAX) ? 0 : 1;
+ return (*depth != FLT_MAX);
}
-static int depth_segment_cb(int x, int y, void *userData)
+static bool depth_segment_cb(int x, int y, void *userData)
{
struct { ARegion *ar; int margin; float depth; } *data = userData;
int mval[2];
@@ -4023,8 +4019,8 @@ static int depth_segment_cb(int x, int y, void *userData)
}
}
-int ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int mval_end[2],
- int margin, float *depth)
+bool ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int mval_end[2],
+ int margin, float *depth)
{
struct { ARegion *ar; int margin; float depth; } data = {NULL};
int p1[2];
@@ -4041,7 +4037,7 @@ int ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int m
*depth = data.depth;
- return (*depth == FLT_MAX) ? 0 : 1;
+ return (*depth != FLT_MAX);
}
/* problem - ofs[3] can be on same location as camera itself.
@@ -4155,7 +4151,7 @@ void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], co
{
float mat[4][4];
ED_view3d_to_m4(mat, ofs, quat, dist);
- BKE_object_apply_mat4(ob, mat, TRUE, TRUE);
+ BKE_object_apply_mat4(ob, mat, true, true);
}
BGpic *ED_view3D_background_image_new(View3D *v3d)
@@ -4198,6 +4194,6 @@ void ED_view3D_lock_clear(View3D *v3d)
{
v3d->ob_centre = NULL;
v3d->ob_centre_bone[0] = '\0';
- v3d->ob_centre_cursor = FALSE;
+ v3d->ob_centre_cursor = false;
v3d->flag2 &= ~V3D_LOCK_CAMERA;
}
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 700027d62a2..2cedf7da725 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -78,9 +78,21 @@ enum {
FLY_MODAL_FREELOOK_ENABLE,
FLY_MODAL_FREELOOK_DISABLE,
FLY_MODAL_SPEED, /* mousepan typically */
-
};
+/* relative view axis locking - xlock, zlock */
+typedef enum eFlyPanState {
+ /* disabled */
+ FLY_AXISLOCK_STATE_OFF = 0,
+
+ /* enabled but not checking because mouse hasn't moved outside the margin since locking was checked an not needed
+ * when the mouse moves, locking is set to 2 so checks are done. */
+ FLY_AXISLOCK_STATE_IDLE = 1,
+
+ /* mouse moved and checking needed, if no view altering is done its changed back to #FLY_AXISLOCK_STATE_IDLE */
+ FLY_AXISLOCK_STATE_ACTIVE = 2
+} eFlyPanState;
+
/* called in transform_ops.c, on each regeneration of keymaps */
void fly_modal_keymap(wmKeyConfig *keyconf)
{
@@ -170,11 +182,11 @@ typedef struct FlyInfo {
wmTimer *timer; /* needed for redraws */
short state;
- short redraw;
- unsigned char use_precision;
+ bool redraw;
+ bool use_precision;
/* if the user presses shift they can look about
* without moving the direction there looking */
- unsigned char use_freelook;
+ bool use_freelook;
int mval[2]; /* latest 2D mouse values */
wmNDOFMotionData *ndof; /* latest 3D mouse values */
@@ -182,14 +194,9 @@ typedef struct FlyInfo {
/* fly state state */
float speed; /* the speed the view is moving per redraw */
short axis; /* Axis index to move along by default Z to move along the view */
- short pan_view; /* when true, pan the view instead of rotating */
-
- /* relative view axis locking - xlock, zlock
- * 0) disabled
- * 1) enabled but not checking because mouse hasn't moved outside the margin since locking was checked an not needed
- * when the mouse moves, locking is set to 2 so checks are done.
- * 2) mouse moved and checking needed, if no view altering is done its changed back to 1 */
- short xlock, zlock;
+ bool pan_view; /* when true, pan the view instead of rotating */
+
+ eFlyPanState xlock, zlock;
float xlock_momentum, zlock_momentum; /* nicer dynamics */
float grid; /* world scale 1.0 default */
@@ -208,7 +215,7 @@ typedef struct FlyInfo {
/* are we flying an ortho camera in perspective view,
* which was originall in ortho view?
* could probably figure it out but better be explicit */
- short is_ortho_cam;
+ bool is_ortho_cam;
void *obtfm; /* backup the objects transform */
/* compare between last state */
@@ -272,7 +279,7 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar),
#define FLY_CANCEL 1
#define FLY_CONFIRM 2
-static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent *event)
+static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent *event)
{
wmWindow *win = CTX_wm_window(C);
float upvec[3]; /* tmp */
@@ -294,30 +301,30 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
if (fly->rv3d->persp == RV3D_CAMOB && fly->v3d->camera->id.lib) {
BKE_report(op->reports, RPT_ERROR, "Cannot fly a camera from an external library");
- return FALSE;
+ return false;
}
if (fly->v3d->ob_centre) {
BKE_report(op->reports, RPT_ERROR, "Cannot fly when the view is locked to an object");
- return FALSE;
+ return false;
}
if (fly->rv3d->persp == RV3D_CAMOB && fly->v3d->camera->constraints.first) {
BKE_report(op->reports, RPT_ERROR, "Cannot fly an object with constraints");
- return FALSE;
+ return false;
}
fly->state = FLY_RUNNING;
fly->speed = 0.0f;
fly->axis = 2;
- fly->pan_view = FALSE;
- fly->xlock = FALSE;
- fly->zlock = FALSE;
+ fly->pan_view = false;
+ fly->xlock = FLY_AXISLOCK_STATE_OFF;
+ fly->zlock = FLY_AXISLOCK_STATE_OFF;
fly->xlock_momentum = 0.0f;
fly->zlock_momentum = 0.0f;
fly->grid = 1.0f;
- fly->use_precision = FALSE;
- fly->use_freelook = FALSE;
+ fly->use_precision = false;
+ fly->use_freelook = false;
#ifdef NDOF_FLY_DRAW_TOOMUCH
fly->redraw = 1;
@@ -342,7 +349,7 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
copy_m3_m4(mat, fly->rv3d->viewinv);
mul_m3_v3(mat, upvec);
if (fabsf(upvec[2]) < 0.1f) {
- fly->zlock = 1;
+ fly->zlock = FLY_AXISLOCK_STATE_IDLE;
}
upvec[0] = 0;
upvec[1] = 0;
@@ -354,10 +361,10 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
/* check for flying ortho camera - which we cant support well
* we _could_ also check for an ortho camera but this is easier */
if ((fly->rv3d->persp == RV3D_CAMOB) &&
- (fly->rv3d->is_persp == FALSE))
+ (fly->rv3d->is_persp == false))
{
((Camera *)fly->v3d->camera->data)->type = CAM_PERSP;
- fly->is_ortho_cam = TRUE;
+ fly->is_ortho_cam = true;
}
if (fly->rv3d->persp == RV3D_CAMOB) {
@@ -601,11 +608,11 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event)
break;
}
case FLY_MODAL_PAN_ENABLE:
- fly->pan_view = TRUE;
+ fly->pan_view = true;
break;
case FLY_MODAL_PAN_DISABLE:
//XXX2.5 WM_cursor_warp(CTX_wm_window(C), cent_orig[0], cent_orig[1]);
- fly->pan_view = FALSE;
+ fly->pan_view = false;
break;
/* implement WASD keys,
@@ -677,40 +684,41 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event)
break;
case FLY_MODAL_AXIS_LOCK_X:
- if (fly->xlock)
- fly->xlock = 0;
+ if (fly->xlock != FLY_AXISLOCK_STATE_OFF)
+ fly->xlock = FLY_AXISLOCK_STATE_OFF;
else {
- fly->xlock = 2;
+ fly->xlock = FLY_AXISLOCK_STATE_ACTIVE;
fly->xlock_momentum = 0.0;
}
break;
case FLY_MODAL_AXIS_LOCK_Z:
- if (fly->zlock)
- fly->zlock = 0;
+ if (fly->zlock != FLY_AXISLOCK_STATE_OFF)
+ fly->zlock = FLY_AXISLOCK_STATE_OFF;
else {
- fly->zlock = 2;
+ fly->zlock = FLY_AXISLOCK_STATE_ACTIVE;
fly->zlock_momentum = 0.0;
}
break;
case FLY_MODAL_PRECISION_ENABLE:
- fly->use_precision = TRUE;
+ fly->use_precision = true;
break;
case FLY_MODAL_PRECISION_DISABLE:
- fly->use_precision = FALSE;
+ fly->use_precision = false;
break;
case FLY_MODAL_FREELOOK_ENABLE:
- fly->use_freelook = TRUE;
+ fly->use_freelook = true;
break;
case FLY_MODAL_FREELOOK_DISABLE:
- fly->use_freelook = FALSE;
+ fly->use_freelook = false;
break;
}
}
}
-static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orientationChanged, int positionChanged)
+static void flyMoveCamera(bContext *C, RegionView3D *rv3d, FlyInfo *fly,
+ const bool do_rotate, const bool do_translate)
{
/* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */
@@ -733,7 +741,7 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien
ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
mult_m4_m4m4(diff_mat, view_mat, prev_view_imat);
mult_m4_m4m4(parent_mat, diff_mat, fly->root_parent->obmat);
- BKE_object_apply_mat4(fly->root_parent, parent_mat, TRUE, FALSE);
+ BKE_object_apply_mat4(fly->root_parent, parent_mat, true, false);
// BKE_object_where_is_calc(scene, fly->root_parent);
@@ -748,7 +756,7 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien
else {
float view_mat[4][4];
ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
- BKE_object_apply_mat4(v3d->camera, view_mat, TRUE, FALSE);
+ BKE_object_apply_mat4(v3d->camera, view_mat, true, false);
id_key = &v3d->camera->id;
}
@@ -764,11 +772,11 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien
* 2) on each subsequent frame
* TODO: need to check in future that frame changed before doing this
*/
- if (orientationChanged) {
+ if (do_rotate) {
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
}
- if (positionChanged) {
+ if (do_translate) {
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
}
@@ -851,7 +859,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
/* Should we redraw? */
if ((fly->speed != 0.0f) ||
moffset[0] || moffset[1] ||
- fly->zlock || fly->xlock ||
+ (fly->zlock != FLY_AXISLOCK_STATE_OFF) ||
+ (fly->xlock != FLY_AXISLOCK_STATE_OFF) ||
dvec[0] || dvec[1] || dvec[2])
{
float dvec_tmp[3];
@@ -876,7 +885,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
copy_m3_m4(mat, rv3d->viewinv);
- if (fly->pan_view == TRUE) {
+ if (fly->pan_view == true) {
/* pan only */
dvec_tmp[0] = -moffset[0];
dvec_tmp[1] = -moffset[1];
@@ -904,10 +913,10 @@ static int flyApply(bContext *C, FlyInfo *fly)
axis_angle_to_quat(tmp_quat, upvec, (float)moffset[1] * time_redraw * -FLY_ROTATE_FAC);
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
- if (fly->xlock)
- fly->xlock = 2; /* check for rotation */
- if (fly->zlock)
- fly->zlock = 2;
+ if (fly->xlock != FLY_AXISLOCK_STATE_OFF)
+ fly->xlock = FLY_AXISLOCK_STATE_ACTIVE; /* check for rotation */
+ if (fly->zlock != FLY_AXISLOCK_STATE_OFF)
+ fly->zlock = FLY_AXISLOCK_STATE_ACTIVE;
fly->xlock_momentum = 0.0f;
}
@@ -940,13 +949,13 @@ static int flyApply(bContext *C, FlyInfo *fly)
axis_angle_to_quat(tmp_quat, upvec, (float)moffset[0] * time_redraw * FLY_ROTATE_FAC);
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
- if (fly->xlock)
- fly->xlock = 2; /* check for rotation */
- if (fly->zlock)
- fly->zlock = 2;
+ if (fly->xlock != FLY_AXISLOCK_STATE_OFF)
+ fly->xlock = FLY_AXISLOCK_STATE_ACTIVE; /* check for rotation */
+ if (fly->zlock != FLY_AXISLOCK_STATE_OFF)
+ fly->zlock = FLY_AXISLOCK_STATE_ACTIVE;
}
- if (fly->zlock == 2) {
+ if (fly->zlock == FLY_AXISLOCK_STATE_ACTIVE) {
upvec[0] = 1.0f;
upvec[1] = 0.0f;
upvec[2] = 0.0f;
@@ -968,12 +977,13 @@ static int flyApply(bContext *C, FlyInfo *fly)
fly->zlock_momentum += FLY_ZUP_CORRECT_ACCEL;
}
else {
- fly->zlock = 1; /* don't check until the view rotates again */
+ fly->zlock = FLY_AXISLOCK_STATE_IDLE; /* don't check until the view rotates again */
fly->zlock_momentum = 0.0f;
}
}
- if (fly->xlock == 2 && moffset[1] == 0) { /* only apply xcorrect when mouse isn't applying x rot */
+ /* only apply xcorrect when mouse isn't applying x rot */
+ if (fly->xlock == FLY_AXISLOCK_STATE_ACTIVE && moffset[1] == 0) {
upvec[0] = 0;
upvec[1] = 0;
upvec[2] = 1;
@@ -995,7 +1005,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
fly->xlock_momentum += 0.05f;
}
else {
- fly->xlock = 1; /* see above */
+ fly->xlock = FLY_AXISLOCK_STATE_IDLE; /* see above */
fly->xlock_momentum = 0.0f;
}
}
@@ -1035,8 +1045,13 @@ static int flyApply(bContext *C, FlyInfo *fly)
add_v3_v3(rv3d->ofs, dvec);
- if (rv3d->persp == RV3D_CAMOB)
- move_camera(C, rv3d, fly, (fly->xlock || fly->zlock || moffset[0] || moffset[1]), fly->speed);
+ if (rv3d->persp == RV3D_CAMOB) {
+ const bool do_rotate = ((fly->xlock != FLY_AXISLOCK_STATE_OFF) ||
+ (fly->zlock != FLY_AXISLOCK_STATE_OFF) ||
+ ((moffset[0] || moffset[1]) && !fly->pan_view));
+ const bool do_translate = (fly->speed != 0.0f || fly->pan_view);
+ flyMoveCamera(C, rv3d, fly, do_rotate, do_translate);
+ }
}
else {
@@ -1059,19 +1074,19 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
const int flag = U.ndof_flag;
#if 0
- int shouldRotate = (flag & NDOF_SHOULD_ROTATE) && (fly->pan_view == FALSE);
- int shouldTranslate = (flag & (NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM));
+ bool do_rotate = (flag & NDOF_SHOULD_ROTATE) && (fly->pan_view == false);
+ bool do_translate = (flag & (NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM));
#endif
- int shouldRotate = (fly->pan_view == FALSE);
- int shouldTranslate = TRUE;
+ bool do_rotate = (fly->pan_view == false);
+ bool do_translate = true;
float view_inv[4];
invert_qt_qt(view_inv, rv3d->viewquat);
rv3d->rot_angle = 0.0f; /* disable onscreen rotation doo-dad */
- if (shouldTranslate) {
+ if (do_translate) {
const float forward_sensitivity = 1.0f;
const float vertical_sensitivity = 0.4f;
const float lateral_sensitivity = 0.6f;
@@ -1107,14 +1122,14 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
if (!is_zero_v3(trans)) {
/* move center of view opposite of hand motion (this is camera mode, not object mode) */
sub_v3_v3(rv3d->ofs, trans);
- shouldTranslate = TRUE;
+ do_translate = true;
}
else {
- shouldTranslate = FALSE;
+ do_translate = false;
}
}
- if (shouldRotate) {
+ if (do_rotate) {
const float turn_sensitivity = 1.0f;
float rotation[4];
@@ -1122,7 +1137,7 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
float angle = turn_sensitivity * ndof_to_axis_angle(ndof, axis);
if (fabsf(angle) > 0.0001f) {
- shouldRotate = TRUE;
+ do_rotate = true;
if (fly->use_precision)
angle *= 0.2f;
@@ -1164,15 +1179,15 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
rv3d->view = RV3D_VIEW_USER;
}
else {
- shouldRotate = FALSE;
+ do_rotate = false;
}
}
- if (shouldTranslate || shouldRotate) {
- fly->redraw = TRUE;
+ if (do_translate || do_rotate) {
+ fly->redraw = true;
if (rv3d->persp == RV3D_CAMOB) {
- move_camera(C, rv3d, fly, shouldRotate, shouldTranslate);
+ flyMoveCamera(C, rv3d, fly, do_rotate, do_translate);
}
}
@@ -1191,7 +1206,7 @@ static int fly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
op->customdata = fly;
- if (initFlyInfo(C, fly, op, event) == FALSE) {
+ if (initFlyInfo(C, fly, op, event) == false) {
MEM_freeN(op->customdata);
return OPERATOR_CANCELLED;
}
@@ -1217,7 +1232,7 @@ static int fly_cancel(bContext *C, wmOperator *op)
static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
int exit_code;
- short do_draw = FALSE;
+ bool do_draw = false;
FlyInfo *fly = op->customdata;
RegionView3D *rv3d = fly->rv3d;
Object *fly_object = fly->root_parent ? fly->root_parent : fly->v3d->camera;
@@ -1240,7 +1255,7 @@ static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event)
exit_code = flyEnd(C, fly);
if (exit_code != OPERATOR_RUNNING_MODAL)
- do_draw = TRUE;
+ do_draw = true;
if (do_draw) {
if (rv3d->persp == RV3D_CAMOB) {
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 430ed8698d7..854bd9f6cf8 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -147,7 +147,7 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
int nr = RNA_int_get(op->ptr, "nr");
- int toggle = RNA_boolean_get(op->ptr, "toggle");
+ const bool toggle = RNA_boolean_get(op->ptr, "toggle");
if (nr < 0)
return OPERATOR_CANCELLED;
@@ -198,7 +198,7 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
if (v3d->scenelock) handle_view3d_lock(C);
- DAG_on_visible_update(CTX_data_main(C), FALSE);
+ DAG_on_visible_update(CTX_data_main(C), false);
ED_area_tag_redraw(sa);
@@ -215,10 +215,10 @@ static int view3d_layers_invoke(bContext *C, wmOperator *op, const wmEvent *even
if (event->shift)
RNA_boolean_set(op->ptr, "extend", TRUE);
else
- RNA_boolean_set(op->ptr, "extend", FALSE);
+ RNA_boolean_set(op->ptr, "extend", false);
if (event->alt) {
- int nr = RNA_int_get(op->ptr, "nr") + 10;
+ const int nr = RNA_int_get(op->ptr, "nr") + 10;
RNA_int_set(op->ptr, "nr", nr);
}
view3d_layers_exec(C, op);
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 8bce8cd3e01..11cd0fdb1d7 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -122,14 +122,14 @@ void draw_motion_paths_cleanup(View3D *v3d);
/* drawobject.c */
void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, const short dflag);
-int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, const char dt);
+bool draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, const char dt);
void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const char dt, int outline);
void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob);
void drawaxes(float size, char drawtype);
void view3d_cached_text_draw_begin(void);
void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4]);
-void view3d_cached_text_draw_end(View3D * v3d, ARegion * ar, int depth_write, float mat[4][4]);
+void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, bool depth_write, float mat[4][4]);
enum {
V3D_CACHE_TEXT_ZBUF = (1 << 0),
@@ -140,9 +140,9 @@ enum {
};
/* drawarmature.c */
-int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
- const short dt, const short dflag, const unsigned char ob_wire_col[4],
- const short is_outline);
+bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
+ const short dt, const short dflag, const unsigned char ob_wire_col[4],
+ const bool is_outline);
/* drawmesh.c */
void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
@@ -176,7 +176,7 @@ void VIEW3D_OT_localview(struct wmOperatorType *ot);
void VIEW3D_OT_game_start(struct wmOperatorType *ot);
-int ED_view3d_boundbox_clip(RegionView3D * rv3d, float obmat[4][4], struct BoundBox *bb);
+bool ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], const struct BoundBox *bb);
void view3d_smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *,
float *ofs, float *quat, float *dist, float *lens);
@@ -200,7 +200,7 @@ void view3d_toolshelf_register(struct ARegionType *art);
void view3d_tool_props_register(struct ARegionType *art);
/* view3d_snap.c */
-int ED_view3d_minmax_verts(struct Object *obedit, float min[3], float max[3]);
+bool ED_view3d_minmax_verts(struct Object *obedit, float min[3], float max[3]);
void VIEW3D_OT_snap_selected_to_grid(struct wmOperatorType *ot);
void VIEW3D_OT_snap_selected_to_cursor(struct wmOperatorType *ot);
@@ -239,7 +239,7 @@ void draw_smoke_heat(struct SmokeDomainSettings *domain, struct Object *ob);
#define VIEW3D_CAMERA_BORDER_HACK
#ifdef VIEW3D_CAMERA_BORDER_HACK
extern unsigned char view3d_camera_border_hack_col[3];
-extern short view3d_camera_border_hack_test;
+extern bool view3d_camera_border_hack_test;
#endif
#endif /* __VIEW3D_INTERN_H__ */
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 30a100283cc..7d728234c92 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -110,8 +110,8 @@ eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *bas
}
/* perspmat is typically...
- * - 'rv3d->perspmat', is_local == FALSE
- * - 'rv3d->persmatob', is_local == TRUE
+ * - 'rv3d->perspmat', is_local == false
+ * - 'rv3d->persmatob', is_local == true
*/
static eV3DProjStatus ed_view3d_project__internal(const ARegion *ar,
float perspmat[4][4], const bool is_local, /* normally hidden */
@@ -231,39 +231,39 @@ eV3DProjStatus ED_view3d_project_float_ex(const ARegion *ar, float perspmat[4][4
eV3DProjStatus ED_view3d_project_short_global(const ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_short_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
+ return ED_view3d_project_short_ex(ar, rv3d->persmat, false, co, r_co, flag);
}
/* object space, use ED_view3d_init_mats_rv3d before calling */
eV3DProjStatus ED_view3d_project_short_object(const ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_short_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+ return ED_view3d_project_short_ex(ar, rv3d->persmatob, true, co, r_co, flag);
}
/* --- int --- */
eV3DProjStatus ED_view3d_project_int_global(const ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_int_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
+ return ED_view3d_project_int_ex(ar, rv3d->persmat, false, co, r_co, flag);
}
/* object space, use ED_view3d_init_mats_rv3d before calling */
eV3DProjStatus ED_view3d_project_int_object(const ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_int_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+ return ED_view3d_project_int_ex(ar, rv3d->persmatob, true, co, r_co, flag);
}
/* --- float --- */
eV3DProjStatus ED_view3d_project_float_global(const ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_float_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
+ return ED_view3d_project_float_ex(ar, rv3d->persmat, false, co, r_co, flag);
}
/* object space, use ED_view3d_init_mats_rv3d before calling */
eV3DProjStatus ED_view3d_project_float_object(const ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_float_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+ return ED_view3d_project_float_ex(ar, rv3d->persmatob, true, co, r_co, flag);
}
@@ -367,7 +367,7 @@ void ED_view3d_win_to_3d(const ARegion *ar, const float depth_pt[3], const float
ED_view3d_win_to_vector(ar, mval, mousevec);
add_v3_v3v3(line_end, line_sta, mousevec);
- if (isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], TRUE) == 0) {
+ if (isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], true) == 0) {
/* highly unlikely to ever happen, mouse vec paralelle with view plane */
zero_v3(out);
}
@@ -435,7 +435,8 @@ void ED_view3d_win_to_vector(const ARegion *ar, const float mval[2], float out[3
normalize_v3(out);
}
-void ED_view3d_win_to_segment(const ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
+void ED_view3d_win_to_segment(const ARegion *ar, View3D *v3d, const float mval[2],
+ float ray_start[3], float ray_end[3])
{
RegionView3D *rv3d = ar->regiondata;
@@ -472,9 +473,10 @@ void ED_view3d_win_to_segment(const ARegion *ar, View3D *v3d, const float mval[2
* \param mval The area relative 2d location (such as event->mval, converted into float[2]).
* \param ray_start The world-space starting point of the segment.
* \param ray_end The world-space end point of the segment.
- * \return success, FALSE if the segment is totally clipped.
+ * \return success, false if the segment is totally clipped.
*/
-int ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
+bool ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mval[2],
+ float ray_start[3], float ray_end[3])
{
RegionView3D *rv3d = ar->regiondata;
ED_view3d_win_to_segment(ar, v3d, mval, ray_start, ray_end);
@@ -482,14 +484,14 @@ int ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mv
/* clipping */
if (rv3d->rflag & RV3D_CLIPPING) {
/* if the ray is totally clipped,
- * restore the original values but return FALSE
+ * restore the original values but return false
* caller can choose what to do */
float tray_start[3] = {UNPACK3(ray_start)};
float tray_end[3] = {UNPACK3(ray_end)};
int a;
for (a = 0; a < 4; a++) {
- if (clip_line_plane(tray_start, tray_end, rv3d->clip[a]) == FALSE) {
- return FALSE;
+ if (clip_line_plane(tray_start, tray_end, rv3d->clip[a]) == false) {
+ return false;
}
}
@@ -498,7 +500,7 @@ int ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mv
copy_v3_v3(ray_end, tray_end);
}
- return TRUE;
+ return true;
}
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c
index 410d20a1dc0..d6cc218e266 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -924,7 +924,7 @@ static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event)
void VIEW3D_OT_ruler(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "3D Ruler & Protractor";
+ ot->name = "Ruler/Protractor";
ot->description = "Interactive ruler";
ot->idname = "VIEW3D_OT_ruler";
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index b441e48f59d..a84075fb60e 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -127,7 +127,7 @@ bool view3d_get_view_aligned_coordinate(ARegion *ar, float fp[3], const int mval
ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
sub_v3_v3(fp, dvec);
- return TRUE;
+ return true;
}
else {
/* fallback to the view center */
@@ -262,17 +262,17 @@ typedef struct LassoSelectUserData {
rctf _rect_fl;
const int (*mcords)[2];
int moves;
- int select;
+ bool select;
/* runtime */
int pass;
- int is_done;
- int is_change;
+ bool is_done;
+ bool is_change;
} LassoSelectUserData;
static void view3d_userdata_lassoselect_init(LassoSelectUserData *r_data,
ViewContext *vc, const rcti *rect, const int (*mcords)[2],
- const int moves, const int select)
+ const int moves, const bool select)
{
r_data->vc = vc;
@@ -286,8 +286,8 @@ static void view3d_userdata_lassoselect_init(LassoSelectUserData *r_data,
/* runtime */
r_data->pass = 0;
- r_data->is_done = FALSE;
- r_data->is_change = FALSE;
+ r_data->is_done = false;
+ r_data->is_change = false;
}
static int view3d_selectable_data(bContext *C)
@@ -356,7 +356,7 @@ static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChann
bArmature *arm = data->vc->obact->data;
if (PBONE_SELECTABLE(arm, pchan->bone)) {
- int is_point_done = FALSE;
+ bool is_point_done = false;
int points_proj_tot = 0;
const int x0 = screen_co_a[0];
@@ -370,7 +370,7 @@ static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChann
if (BLI_rcti_isect_pt(data->rect, x0, y0) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, x0, y0, INT_MAX))
{
- is_point_done = TRUE;
+ is_point_done = true;
}
}
@@ -380,23 +380,23 @@ static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChann
if (BLI_rcti_isect_pt(data->rect, x1, y1) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, x1, y1, INT_MAX))
{
- is_point_done = TRUE;
+ is_point_done = true;
}
}
/* if one of points selected, we skip the bone itself */
- if ((is_point_done == TRUE) ||
- ((is_point_done == FALSE) && (points_proj_tot == 2) &&
+ if ((is_point_done == true) ||
+ ((is_point_done == false) && (points_proj_tot == 2) &&
BLI_lasso_is_edge_inside(data->mcords, data->moves, x0, y0, x1, y1, INT_MAX)))
{
if (data->select) pchan->bone->flag |= BONE_SELECTED;
else pchan->bone->flag &= ~BONE_SELECTED;
- data->is_change = TRUE;
+ data->is_change = true;
}
data->is_change |= is_point_done;
}
}
-static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[][2], short moves, short select)
+static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[][2], short moves, bool select)
{
ViewContext vc_tmp;
LassoSelectUserData data;
@@ -437,11 +437,11 @@ static void object_deselect_all_visible(Scene *scene, View3D *v3d)
}
}
-static void do_lasso_select_objects(ViewContext *vc, const int mcords[][2], const short moves, short extend, short select)
+static void do_lasso_select_objects(ViewContext *vc, const int mcords[][2], const short moves, bool extend, bool select)
{
Base *base;
- if (extend == 0 && select)
+ if (extend == false && select)
object_deselect_all_visible(vc->scene, vc->v3d);
for (base = vc->scene->base.first; base; base = base->next) {
@@ -486,7 +486,7 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, cons
BLI_lasso_is_point_inside(data->mcords, data->moves, x1, y1, IS_CLIPPED))
{
BM_edge_select_set(data->vc->em->bm, eed, data->select);
- data->is_done = TRUE;
+ data->is_done = true;
}
}
else {
@@ -507,7 +507,7 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, cons
}
}
-static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
ToolSettings *ts = vc->scene->toolsettings;
@@ -521,7 +521,7 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
- if (extend == 0 && select)
+ if (extend == false && select)
EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT);
/* for non zbuf projections, don't change the GL state */
@@ -543,7 +543,7 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
data.pass = 0;
mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
- if (data.is_done == 0) {
+ if (data.is_done == false) {
data.pass = 1;
mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
}
@@ -595,7 +595,7 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BP
}
}
-static void do_lasso_select_curve(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_curve(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
rcti rect;
@@ -604,7 +604,7 @@ static void do_lasso_select_curve(ViewContext *vc, const int mcords[][2], short
view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
- if (extend == 0 && select)
+ if (extend == false && select)
CU_deselect_all(vc->obedit);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@@ -621,7 +621,7 @@ static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, const
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
}
}
-static void do_lasso_select_lattice(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_lattice(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
rcti rect;
@@ -630,7 +630,7 @@ static void do_lasso_select_lattice(ViewContext *vc, const int mcords[][2], shor
view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
- if (extend == 0 && select)
+ if (extend == false && select)
ED_setflagsLatt(vc->obedit, 0);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@@ -643,7 +643,7 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo
bArmature *arm = data->vc->obedit->data;
if (EBONE_SELECTABLE(arm, ebone)) {
- int is_point_done = FALSE;
+ bool is_point_done = false;
int points_proj_tot = 0;
const int x0 = screen_co_a[0];
@@ -657,7 +657,7 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo
if (BLI_rcti_isect_pt(data->rect, x0, y0) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, x0, y0, INT_MAX))
{
- is_point_done = TRUE;
+ is_point_done = true;
if (data->select) ebone->flag |= BONE_ROOTSEL;
else ebone->flag &= ~BONE_ROOTSEL;
}
@@ -669,26 +669,26 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo
if (BLI_rcti_isect_pt(data->rect, x1, y1) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, x1, y1, INT_MAX))
{
- is_point_done = TRUE;
+ is_point_done = true;
if (data->select) ebone->flag |= BONE_TIPSEL;
else ebone->flag &= ~BONE_TIPSEL;
}
}
/* if one of points selected, we skip the bone itself */
- if ((is_point_done == FALSE) && (points_proj_tot == 2) &&
+ if ((is_point_done == false) && (points_proj_tot == 2) &&
BLI_lasso_is_edge_inside(data->mcords, data->moves, x0, y0, x1, y1, INT_MAX))
{
if (data->select) ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- data->is_change = TRUE;
+ data->is_change = true;
}
data->is_change |= is_point_done;
}
}
-static void do_lasso_select_armature(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_armature(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
rcti rect;
@@ -699,7 +699,7 @@ static void do_lasso_select_armature(ViewContext *vc, const int mcords[][2], sho
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
- if (extend == 0 && select)
+ if (extend == false && select)
ED_armature_deselect_all_visible(vc->obedit);
armature_foreachScreenBone(vc, do_lasso_select_armature__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
@@ -721,17 +721,17 @@ static void do_lasso_select_mball__doSelectElem(void *userData, struct MetaElem
{
if (data->select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
- data->is_change = TRUE;
+ data->is_change = true;
}
}
-static void do_lasso_select_meta(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_meta(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
rcti rect;
MetaBall *mb = (MetaBall *)vc->obedit->data;
- if (extend == 0 && select)
+ if (extend == false && select)
BKE_mball_deselect_all(mb);
BLI_lasso_boundbox(&rect, mcords, moves);
@@ -753,7 +753,7 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv,
BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
}
}
-static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
const int use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT);
Object *ob = vc->obact;
@@ -763,8 +763,8 @@ static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], sh
if (me == NULL || me->totvert == 0)
return;
- if (extend == 0 && select)
- paintvert_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
+ if (extend == false && select)
+ paintvert_deselect_all_visible(ob, SEL_DESELECT, false); /* flush selection at the end */
BLI_lasso_boundbox(&rect, mcords, moves);
@@ -790,7 +790,7 @@ static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], sh
paintvert_flush_flags(ob);
}
-static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
Object *ob = vc->obact;
Mesh *me = ob ? ob->data : NULL;
@@ -799,8 +799,8 @@ static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], sh
if (me == NULL || me->totpoly == 0)
return;
- if (extend == 0 && select)
- paintface_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
+ if (extend == false && select)
+ paintface_deselect_all_visible(ob, SEL_DESELECT, false); /* flush selection at the end */
bm_vertoffs = me->totpoly + 1; /* max index array */
@@ -847,7 +847,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
static void view3d_lasso_select(bContext *C, ViewContext *vc,
const int mcords[][2], short moves,
- short extend, short select)
+ bool extend, bool select)
{
Object *ob = CTX_data_active_object(C);
@@ -902,7 +902,7 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
if (mcords) {
- short extend, select;
+ bool extend, select;
view3d_operator_needs_opengl(C);
/* setup view context for argument to callbacks */
@@ -1031,9 +1031,9 @@ static EnumPropertyItem *object_select_menu_enum_itemf(bContext *C, PointerRNA *
static int object_select_menu_exec(bContext *C, wmOperator *op)
{
- int name_index = RNA_enum_get(op->ptr, "name");
- short toggle = RNA_boolean_get(op->ptr, "toggle");
- short changed = 0;
+ const int name_index = RNA_enum_get(op->ptr, "name");
+ const bool toggle = RNA_boolean_get(op->ptr, "toggle");
+ bool change = false;
const char *name = object_mouse_select_menu_data[name_index].idname;
if (!toggle) {
@@ -1041,7 +1041,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
{
if (base->flag & SELECT) {
ED_base_object_select(base, BA_DESELECT);
- changed = 1;
+ change = true;
}
}
CTX_DATA_END;
@@ -1053,7 +1053,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
if (STREQ(name, base->object->id.name + 2)) {
ED_base_object_activate(C, base);
ED_base_object_select(base, BA_SELECT);
- changed = 1;
+ change = true;
}
}
CTX_DATA_END;
@@ -1062,7 +1062,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
memset(object_mouse_select_menu_data, 0, sizeof(object_mouse_select_menu_data));
/* undo? */
- if (changed) {
+ if (change) {
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -1112,12 +1112,12 @@ static void deselectall_except(Scene *scene, Base *b) /* deselect all except b
static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], short toggle)
{
short baseCount = 0;
- short ok;
+ bool ok;
LinkNode *linklist = NULL;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
- ok = FALSE;
+ ok = false;
/* two selection methods, the CTRL select uses max dist of 15 */
if (buffer) {
@@ -1125,7 +1125,7 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
for (a = 0; a < hits; a++) {
/* index was converted */
if (base->selcol == buffer[(4 * a) + 3])
- ok = TRUE;
+ ok = true;
}
}
else {
@@ -1134,7 +1134,7 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
temp = abs(base->sx - mval[0]) + abs(base->sy - mval[1]);
if (temp < dist)
- ok = TRUE;
+ ok = true;
}
if (ok) {
@@ -1185,15 +1185,15 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
}
}
-static int selectbuffer_has_bones(const unsigned int *buffer, const unsigned int hits)
+static bool selectbuffer_has_bones(const unsigned int *buffer, const unsigned int hits)
{
unsigned int i;
for (i = 0; i < hits; i++) {
if (buffer[(4 * i) + 3] & 0xFFFF0000) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
/* we want a select buffer with bones, if there are... */
@@ -1203,7 +1203,7 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff
rcti rect;
int offs;
short hits15, hits9 = 0, hits5 = 0;
- short has_bones15 = FALSE, has_bones9 = FALSE, has_bones5 = FALSE;
+ bool has_bones15 = false, has_bones9 = false, has_bones5 = false;
BLI_rcti_init(&rect, mval[0] - 14, mval[0] + 14, mval[1] - 14, mval[1] + 14);
hits15 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
@@ -1255,20 +1255,22 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff
}
/* returns basact */
-static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], Base *startbase, int has_bones)
+static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits, const int mval[2],
+ Base *startbase, bool has_bones)
{
Scene *scene = vc->scene;
View3D *v3d = vc->v3d;
Base *base, *basact = NULL;
static int lastmval[2] = {-100, -100};
- int a, do_nearest = FALSE;
+ int a;
+ bool do_nearest = false;
/* define if we use solid nearest select or not */
if (v3d->drawtype > OB_WIRE) {
- do_nearest = TRUE;
+ do_nearest = true;
if (ABS(mval[0] - lastmval[0]) < 3 && ABS(mval[1] - lastmval[1]) < 3) {
if (!has_bones) /* hrms, if theres bones we always do nearest */
- do_nearest = FALSE;
+ do_nearest = false;
}
}
lastmval[0] = mval[0]; lastmval[1] = mval[1];
@@ -1362,7 +1364,7 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
hits = mixed_bones_object_selectbuffer(&vc, buffer, mval);
if (hits > 0) {
- const int has_bones = selectbuffer_has_bones(buffer, hits);
+ const bool has_bones = selectbuffer_has_bones(buffer, hits);
basact = mouse_select_eval_buffer(&vc, buffer, hits, mval, vc.scene->base.first, has_bones);
}
@@ -1389,7 +1391,7 @@ static void deselect_all_tracks(MovieTracking *tracking)
}
/* mval is region coords */
-static int mouse_select(bContext *C, const int mval[2], short extend, short deselect, short toggle, short obcenter, short enumerate)
+static bool mouse_select(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, bool obcenter, short enumerate)
{
ViewContext vc;
ARegion *ar = CTX_wm_region(C);
@@ -1397,7 +1399,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
Scene *scene = CTX_data_scene(C);
Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL;
float dist = 100.0f;
- int retval = 0;
+ int retval = false;
short hits;
const float mval_fl[2] = {(float)mval[0], (float)mval[1]};
@@ -1449,7 +1451,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
if (hits > 0) {
/* note: bundles are handling in the same way as bones */
- const int has_bones = selectbuffer_has_bones(buffer, hits);
+ const bool has_bones = selectbuffer_has_bones(buffer, hits);
/* note; shift+alt goes to group-flush-selecting */
if (has_bones == 0 && enumerate) {
@@ -1502,7 +1504,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
basact->flag |= SELECT;
basact->object->flag = basact->flag;
- retval = 1;
+ retval = true;
WM_event_add_notifier(C, NC_MOVIECLIP | ND_SELECT, track);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -1526,7 +1528,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
basact->flag |= SELECT;
basact->object->flag = basact->flag;
- retval = 1;
+ retval = true;
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object);
@@ -1546,7 +1548,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
/* so, do we have something selected? */
if (basact) {
- retval = 1;
+ retval = true;
if (vc.obedit) {
/* only do select */
@@ -1601,8 +1603,8 @@ typedef struct BoxSelectUserData {
/* runtime */
int pass;
- int is_done;
- int is_change;
+ bool is_done;
+ bool is_change;
} BoxSelectUserData;
static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data,
@@ -1618,29 +1620,29 @@ static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data,
/* runtime */
r_data->pass = 0;
- r_data->is_done = FALSE;
- r_data->is_change = FALSE;
+ r_data->is_done = false;
+ r_data->is_change = false;
}
-int edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2])
+bool edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2])
{
int radius_squared = radius * radius;
/* check points in circle itself */
if (len_squared_v2v2(cent, screen_co_a) <= radius_squared) {
- return TRUE;
+ return true;
}
if (len_squared_v2v2(cent, screen_co_b) <= radius_squared) {
- return TRUE;
+ return true;
}
else {
/* pointdistline */
if (dist_squared_to_line_segment_v2(cent, screen_co_a, screen_co_b) < (float)radius_squared) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
@@ -1651,7 +1653,7 @@ static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, con
BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
}
}
-static int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+static int do_paintvert_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
const int use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT);
Mesh *me;
@@ -1669,8 +1671,8 @@ static int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int
return OPERATOR_CANCELLED;
- if (extend == 0 && select)
- paintvert_deselect_all_visible(vc->obact, SEL_DESELECT, FALSE);
+ if (extend == false && select)
+ paintvert_deselect_all_visible(vc->obact, SEL_DESELECT, false);
if (use_zbuf) {
selar = MEM_callocN(me->totvert + 1, "selar");
@@ -1754,13 +1756,13 @@ static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoi
}
}
}
-static int do_nurbs_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+static int do_nurbs_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
BoxSelectUserData data;
view3d_userdata_boxselect_init(&data, vc, rect, select);
- if (extend == 0 && select)
+ if (extend == false && select)
CU_deselect_all(vc->obedit);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@@ -1777,13 +1779,13 @@ static void do_lattice_box_select__doSelect(void *userData, BPoint *bp, const fl
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
}
}
-static int do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+static int do_lattice_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
BoxSelectUserData data;
view3d_userdata_boxselect_init(&data, vc, rect, select);
- if (extend == 0 && select)
+ if (extend == false && select)
ED_setflagsLatt(vc->obedit, 0);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@@ -1808,7 +1810,7 @@ static void do_mesh_box_select__doSelectEdge(void *userData, BMEdge *eed, const
if (data->pass == 0) {
if (edge_fully_inside_rect(data->rect_fl, screen_co_a, screen_co_b)) {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
- data->is_done = TRUE;
+ data->is_done = true;
}
}
else {
@@ -1826,7 +1828,7 @@ static void do_mesh_box_select__doSelectFace(void *userData, BMFace *efa, const
BM_face_select_set(data->vc->em->bm, efa, data->select);
}
}
-static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+static int do_mesh_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
BoxSelectUserData data;
ToolSettings *ts = vc->scene->toolsettings;
@@ -1834,7 +1836,7 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
view3d_userdata_boxselect_init(&data, vc, rect, select);
- if (extend == 0 && select)
+ if (extend == false && select)
EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT);
/* for non zbuf projections, don't change the GL state */
@@ -1879,7 +1881,7 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
return OPERATOR_FINISHED;
}
-static int do_meta_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+static int do_meta_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
MetaBall *mb = (MetaBall *)vc->obedit->data;
MetaElem *ml;
@@ -1890,7 +1892,7 @@ static int do_meta_box_select(ViewContext *vc, rcti *rect, int select, int exten
hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect);
- if (extend == 0 && select)
+ if (extend == false && select)
BKE_mball_deselect_all(mb);
for (ml = mb->editelems->first; ml; ml = ml->next) {
@@ -1913,7 +1915,7 @@ static int do_meta_box_select(ViewContext *vc, rcti *rect, int select, int exten
return OPERATOR_FINISHED;
}
-static int do_armature_box_select(ViewContext *vc, rcti *rect, short select, short extend)
+static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
bArmature *arm = vc->obedit->data;
EditBone *ebone;
@@ -1928,7 +1930,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, short select, sho
for (ebone = arm->edbo->first; ebone; ebone = ebone->next)
ebone->flag &= ~BONE_DONE;
- if (extend == 0 && select)
+ if (extend == false && select)
ED_armature_deselect_all_visible(vc->obedit);
/* first we only check points inside the border */
@@ -1983,7 +1985,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, short select, sho
return OPERATOR_CANCELLED;
}
-static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, int select, int extend)
+static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, bool select, bool extend)
{
Bone *bone;
Object *ob = vc->obact;
@@ -1999,7 +2001,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
else
bone_only = 0;
- if (extend == 0 && select) {
+ if (extend == false && select) {
if (bone_only) {
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones)
{
@@ -2091,8 +2093,8 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
{
ViewContext vc;
rcti rect;
- short extend;
- short select;
+ bool extend;
+ bool select;
int ret = OPERATOR_CANCELLED;
@@ -2187,12 +2189,12 @@ void VIEW3D_OT_select_border(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* rna */
- WM_operator_properties_gesture_border(ot, TRUE);
+ WM_operator_properties_gesture_border(ot, true);
}
/* mouse selection in weight paint */
/* gets called via generic mouse select operator */
-static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], short extend, short deselect, short toggle, Object *obact)
+static bool mouse_weight_paint_vertex_select(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, Object *obact)
{
View3D *v3d = CTX_wm_view3d(C);
const int use_zbuf = (v3d->flag & V3D_ZBUF_SELECT);
@@ -2213,14 +2215,14 @@ static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], shor
mv->flag ^= SELECT;
}
else {
- paintvert_deselect_all_visible(obact, SEL_DESELECT, FALSE);
+ paintvert_deselect_all_visible(obact, SEL_DESELECT, false);
mv->flag |= SELECT;
}
paintvert_flush_flags(obact);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/* ****** Mouse Select ****** */
@@ -2230,13 +2232,13 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, const wmEvent *even
{
Object *obedit = CTX_data_edit_object(C);
Object *obact = CTX_data_active_object(C);
- short extend = RNA_boolean_get(op->ptr, "extend");
- short deselect = RNA_boolean_get(op->ptr, "deselect");
- short toggle = RNA_boolean_get(op->ptr, "toggle");
- short center = RNA_boolean_get(op->ptr, "center");
- short enumerate = RNA_boolean_get(op->ptr, "enumerate");
- short object = RNA_boolean_get(op->ptr, "object");
- int retval = 0;
+ bool extend = RNA_boolean_get(op->ptr, "extend");
+ bool deselect = RNA_boolean_get(op->ptr, "deselect");
+ bool toggle = RNA_boolean_get(op->ptr, "toggle");
+ bool center = RNA_boolean_get(op->ptr, "center");
+ bool enumerate = RNA_boolean_get(op->ptr, "enumerate");
+ bool object = RNA_boolean_get(op->ptr, "object");
+ bool retval = false;
view3d_operator_needs_opengl(C);
@@ -2247,10 +2249,10 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, const wmEvent *even
/* ack, this is incorrect but to do this correctly we would need an
* alternative editmode/objectmode keymap, this copies the functionality
* from 2.4x where Ctrl+Select in editmode does object select only */
- center = FALSE;
+ center = false;
}
- if (obedit && object == FALSE) {
+ if (obedit && object == false) {
if (obedit->type == OB_MESH)
retval = EDBM_select_pick(C, event->mval, extend, deselect, toggle);
else if (obedit->type == OB_ARMATURE)
@@ -2317,7 +2319,7 @@ typedef struct CircleSelectUserData {
float radius_squared;
/* runtime */
- int is_change;
+ bool is_change;
} CircleSelectUserData;
static void view3d_userdata_circleselect_init(CircleSelectUserData *r_data,
@@ -2333,7 +2335,7 @@ static void view3d_userdata_circleselect_init(CircleSelectUserData *r_data,
r_data->radius_squared = rad * rad;
/* runtime */
- r_data->is_change = FALSE;
+ r_data->is_change = false;
}
static void mesh_circle_doSelectVert(void *userData, BMVert *eve, const float screen_co[2], int UNUSED(index))
@@ -2540,14 +2542,14 @@ static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChan
bArmature *arm = data->vc->obact->data;
if (PBONE_SELECTABLE(arm, pchan->bone)) {
- int is_point_done = FALSE;
+ bool is_point_done = false;
int points_proj_tot = 0;
/* project head location to screenspace */
if (screen_co_a[0] != IS_CLIPPED) {
points_proj_tot++;
if (pchan_circle_doSelectJoint(data, pchan, screen_co_a)) {
- is_point_done = TRUE;
+ is_point_done = true;
}
}
@@ -2555,7 +2557,7 @@ static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChan
if (screen_co_b[0] != IS_CLIPPED) {
points_proj_tot++;
if (pchan_circle_doSelectJoint(data, pchan, screen_co_a)) {
- is_point_done = TRUE;
+ is_point_done = true;
}
}
@@ -2566,12 +2568,12 @@ static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChan
/* only if the endpoints didn't get selected, deal with the middle of the bone too
* It works nicer to only do this if the head or tail are not in the circle,
* otherwise there is no way to circle select joints alone */
- if ((is_point_done == FALSE) && (points_proj_tot == 2) &&
+ if ((is_point_done == false) && (points_proj_tot == 2) &&
edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b))
{
if (data->select) pchan->bone->flag |= BONE_SELECTED;
else pchan->bone->flag &= ~BONE_SELECTED;
- data->is_change = TRUE;
+ data->is_change = true;
}
data->is_change |= is_point_done;
@@ -2626,22 +2628,22 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB
bArmature *arm = data->vc->obedit->data;
if (EBONE_SELECTABLE(arm, ebone)) {
- int is_point_done = FALSE;
+ bool is_point_done = false;
int points_proj_tot = 0;
/* project head location to screenspace */
if (screen_co_a[0] != IS_CLIPPED) {
points_proj_tot++;
- if (armature_circle_doSelectJoint(data, ebone, screen_co_a, TRUE)) {
- is_point_done = TRUE;
+ if (armature_circle_doSelectJoint(data, ebone, screen_co_a, true)) {
+ is_point_done = true;
}
}
/* project tail location to screenspace */
if (screen_co_b[0] != IS_CLIPPED) {
points_proj_tot++;
- if (armature_circle_doSelectJoint(data, ebone, screen_co_b, FALSE)) {
- is_point_done = TRUE;
+ if (armature_circle_doSelectJoint(data, ebone, screen_co_b, false)) {
+ is_point_done = true;
}
}
@@ -2652,12 +2654,12 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB
/* only if the endpoints didn't get selected, deal with the middle of the bone too
* It works nicer to only do this if the head or tail are not in the circle,
* otherwise there is no way to circle select joints alone */
- if ((is_point_done == FALSE) && (points_proj_tot == 2) &&
+ if ((is_point_done == false) && (points_proj_tot == 2) &&
edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b))
{
if (data->select) ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- data->is_change = TRUE;
+ data->is_change = true;
}
data->is_change |= is_point_done;
@@ -2688,7 +2690,7 @@ static void do_circle_select_mball__doSelectElem(void *userData, struct MetaElem
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
if (data->select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
- data->is_change = TRUE;
+ data->is_change = true;
}
}
static void mball_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
@@ -2728,12 +2730,12 @@ static void obedit_circle_select(ViewContext *vc, short select, const int mval[2
}
}
-static int object_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static bool object_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
{
Scene *scene = vc->scene;
const float radius_squared = rad * rad;
const float mval_fl[2] = {mval[0], mval[1]};
- int is_change = FALSE;
+ bool is_change = false;
int select_flag = select ? SELECT : 0;
Base *base;
@@ -2746,7 +2748,7 @@ static int object_circle_select(ViewContext *vc, int select, const int mval[2],
{
if (len_squared_v2v2(mval_fl, screen_co) <= radius_squared) {
ED_base_object_select(base, select);
- is_change = TRUE;
+ is_change = true;
}
}
}
@@ -2760,8 +2762,8 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
- int radius = RNA_int_get(op->ptr, "radius");
- int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
+ const int radius = RNA_int_get(op->ptr, "radius");
+ const int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
int select;
const int mval[2] = {RNA_int_get(op->ptr, "x"),
RNA_int_get(op->ptr, "y")};
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 6edcf980d58..eb32baf4c3f 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -101,7 +101,7 @@ static void special_transvert_update(Object *obedit)
if (obedit->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(obedit);
- BM_mesh_normals_update(em->bm, TRUE); /* does face centers too */
+ BM_mesh_normals_update(em->bm, true); /* does face centers too */
}
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu = obedit->data;
@@ -1075,7 +1075,7 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot)
/* **************************************************** */
-int ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
+bool ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
{
TransVert *tv;
float centroid[3], vec[3], bmat[3][3];
@@ -1085,7 +1085,7 @@ int ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
if (ELEM5(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE))
make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS);
- if (tottrans == 0) return 0;
+ if (tottrans == 0) return false;
copy_m3_m4(bmat, obedit->obmat);
@@ -1101,5 +1101,5 @@ int ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
MEM_freeN(transvmain);
transvmain = NULL;
- return 1;
+ return true;
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index b2e10fa8457..b227d32d987 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -460,7 +460,7 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o
/* only touch location */
BKE_object_tfm_protected_backup(camera_ob, &obtfm);
- BKE_object_apply_mat4(camera_ob, obmat_new, TRUE, TRUE);
+ BKE_object_apply_mat4(camera_ob, obmat_new, true, true);
BKE_object_tfm_protected_restore(camera_ob, &obtfm, OB_LOCK_SCALE | OB_LOCK_ROT4D);
/* notifiers */
@@ -479,7 +479,7 @@ static int view3d_camera_to_view_selected_poll(bContext *C)
if (v3d && v3d->camera && v3d->camera->id.lib == NULL) {
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if (rv3d) {
- if (rv3d->is_persp == FALSE) {
+ if (rv3d->is_persp == false) {
CTX_wm_operator_poll_msg_set(C, "Only valid for a perspective camera view");
}
else if (!rv3d->viewlock) {
@@ -612,7 +612,7 @@ void ED_view3d_clipping_calc(BoundBox *bb, float planes[4][4], bglMats *mats, co
}
-int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], BoundBox *bb)
+bool ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], const BoundBox *bb)
{
/* return 1: draw */
@@ -620,8 +620,8 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], BoundBox *bb)
float vec[4], min, max;
int a, flag = -1, fl;
- if (bb == NULL) return 1;
- if (bb->flag & OB_BB_DISABLED) return 1;
+ if (bb == NULL) return true;
+ if (bb->flag & OB_BB_DISABLED) return true;
mult_m4_m4m4(mat, rv3d->persmat, obmat);
@@ -641,10 +641,10 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], BoundBox *bb)
if (vec[2] > max) fl += 32;
flag &= fl;
- if (flag == 0) return 1;
+ if (flag == 0) return true;
}
- return 0;
+ return false;
}
float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
@@ -663,7 +663,7 @@ float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
void ED_view3d_depth_tag_update(RegionView3D *rv3d)
{
if (rv3d->depths)
- rv3d->depths->damaged = 1;
+ rv3d->depths->damaged = true;
}
/* copies logic of get_view3d_viewplane(), keep in sync */
@@ -951,7 +951,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
Base tbase;
tbase.flag = OB_FROMDUPLI;
- lb = object_duplilist(scene, base->object, FALSE);
+ lb = object_duplilist(scene, base->object, false);
for (dob = lb->first; dob; dob = dob->next) {
tbase.object = dob->ob;
@@ -975,7 +975,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
}
}
}
- v3d->xray = FALSE; /* restore */
+ v3d->xray = false; /* restore */
}
glPopName(); /* see above (pushname) */
@@ -1073,14 +1073,14 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
return lay;
}
-static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportList *reports)
+static bool view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportList *reports)
{
View3D *v3d = sa->spacedata.first;
Base *base;
float min[3], max[3], box[3];
float size = 0.0f, size_persp = 0.0f, size_ortho = 0.0f;
unsigned int locallay;
- int ok = FALSE;
+ bool ok = false;
if (v3d->localvd) {
return ok;
@@ -1092,13 +1092,13 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
if (locallay == 0) {
BKE_report(reports, RPT_ERROR, "No more than 8 local views");
- ok = FALSE;
+ ok = false;
}
else {
if (scene->obedit) {
- BKE_object_minmax(scene->obedit, min, max, FALSE);
+ BKE_object_minmax(scene->obedit, min, max, false);
- ok = TRUE;
+ ok = true;
BASACT->lay |= locallay;
scene->obedit->lay = BASACT->lay;
@@ -1106,10 +1106,10 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
else {
for (base = FIRSTBASE; base; base = base->next) {
if (TESTBASE(v3d, base)) {
- BKE_object_minmax(base->object, min, max, FALSE);
+ BKE_object_minmax(base->object, min, max, false);
base->lay |= locallay;
base->object->lay = base->lay;
- ok = TRUE;
+ ok = true;
}
}
}
@@ -1125,7 +1125,7 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
size_ortho = ED_view3d_radius_to_ortho_dist(v3d->lens, size / 2.0f) * VIEW3D_MARGIN;
}
- if (ok == TRUE) {
+ if (ok == true) {
ARegion *ar;
v3d->localvd = MEM_mallocN(sizeof(View3D), "localview");
@@ -1220,7 +1220,7 @@ static void restore_localviewdata(ScrArea *sa, int free)
}
}
-static int view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa)
+static bool view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa)
{
View3D *v3d = sa->spacedata.first;
struct Base *base;
@@ -1247,12 +1247,12 @@ static int view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa)
}
}
- DAG_on_visible_update(bmain, FALSE);
+ DAG_on_visible_update(bmain, false);
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
@@ -1262,7 +1262,7 @@ static int localview_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = CTX_wm_view3d(C);
- int change;
+ bool change;
if (v3d->localvd) {
change = view3d_localview_exit(bmain, scene, sa);
@@ -1403,7 +1403,7 @@ static int game_engine_poll(bContext *C)
return 1;
}
-int ED_view3d_context_activate(bContext *C)
+bool ED_view3d_context_activate(bContext *C)
{
bScreen *sc = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
@@ -1416,20 +1416,20 @@ int ED_view3d_context_activate(bContext *C)
break;
if (!sa)
- return 0;
+ return false;
for (ar = sa->regionbase.first; ar; ar = ar->next)
if (ar->regiontype == RGN_TYPE_WINDOW)
break;
if (!ar)
- return 0;
+ return false;
/* bad context switch .. */
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
- return 1;
+ return true;
}
static int game_engine_exec(bContext *C, wmOperator *op)
@@ -1466,7 +1466,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
{
/* Letterbox */
rctf cam_framef;
- ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, FALSE);
+ ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, false);
cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin;
cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin;
cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin;