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:
authorCampbell Barton <ideasman42@gmail.com>2019-03-26 13:16:47 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-26 13:16:47 +0300
commitce3b78c73a7ccc16fdccf7decedb5d1578dfdf0a (patch)
tree87f1a9c41ebe6f74806f1ae76206f1d328c85700 /source/blender/editors/space_view3d/view3d_walk.c
parent5279d118c2ddee0e6fef66aaf78452c1b302dd42 (diff)
Cleanup: style, use braces for editor/spaces
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_walk.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c67
1 files changed, 45 insertions, 22 deletions
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 0caaf6eb113..a015b7f9945 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -166,8 +166,9 @@ void walk_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Walk Modal");
/* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items)
+ if (keymap && keymap->modal_items) {
return;
+ }
keymap = WM_modalkeymap_add(keyconf, "View3D Walk Modal", modal_items);
@@ -498,10 +499,12 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
walk->teleport.duration = U.walk_navigation.teleport_time;
walk->mouse_speed = U.walk_navigation.mouse_speed;
- if ((U.walk_navigation.flag & USER_WALK_GRAVITY))
+ if ((U.walk_navigation.flag & USER_WALK_GRAVITY)) {
walk_navigation_mode_set(C, op, walk, WALK_MODE_GRAVITY);
- else
+ }
+ else {
walk_navigation_mode_set(C, op, walk, WALK_MODE_FREE);
+ }
walk->view_height = U.walk_navigation.view_height;
walk->jump_height = U.walk_navigation.jump_height;
@@ -583,8 +586,9 @@ static int walkEnd(bContext *C, WalkInfo *walk)
wmWindow *win;
RegionView3D *rv3d;
- if (walk->state == WALK_RUNNING)
+ if (walk->state == WALK_RUNNING) {
return OPERATOR_RUNNING_MODAL;
+ }
#ifdef NDOF_WALK_DEBUG
puts("\n-- walk end --");
@@ -604,8 +608,9 @@ static int walkEnd(bContext *C, WalkInfo *walk)
rv3d->rflag &= ~RV3D_NAVIGATING;
#ifdef WITH_INPUT_NDOF
- if (walk->ndof)
+ if (walk->ndof) {
MEM_freeN(walk->ndof);
+ }
#endif
/* restore the cursor */
@@ -1019,11 +1024,12 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk)
/* it ranges from 90.0f to -90.0f */
angle = -asinf(rv3d->viewmat[2][2]);
- if (angle > WALK_TOP_LIMIT && y > 0.0f)
+ if (angle > WALK_TOP_LIMIT && y > 0.0f) {
y = 0.0f;
-
- else if (angle < WALK_BOTTOM_LIMIT && y < 0.0f)
+ }
+ else if (angle < WALK_BOTTOM_LIMIT && y < 0.0f) {
y = 0.0f;
+ }
copy_v3_fl3(upvec, 1.0f, 0.0f, 0.0f);
mul_m3_v3(mat, upvec);
@@ -1041,8 +1047,9 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk)
copy_v3_fl3(upvec, 0.0f, 1.0f, 0.0f);
mul_m3_v3(mat, upvec);
- if (upvec[2] < 0.0f)
+ if (upvec[2] < 0.0f) {
moffset[0] = -moffset[0];
+ }
/* relative offset */
x = (float) moffset[0] / ar->winx;
@@ -1073,11 +1080,13 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk)
direction = 0;
- if ((walk->active_directions & WALK_BIT_FORWARD))
+ if ((walk->active_directions & WALK_BIT_FORWARD)) {
direction += 1;
+ }
- if ((walk->active_directions & WALK_BIT_BACKWARD))
+ if ((walk->active_directions & WALK_BIT_BACKWARD)) {
direction -= 1;
+ }
copy_v3_fl3(dvec_tmp, 0.0f, 0.0f, direction);
mul_m3_v3(mat, dvec_tmp);
@@ -1097,11 +1106,13 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk)
direction = 0;
- if ((walk->active_directions & WALK_BIT_LEFT))
+ if ((walk->active_directions & WALK_BIT_LEFT)) {
direction += 1;
+ }
- if ((walk->active_directions & WALK_BIT_RIGHT))
+ if ((walk->active_directions & WALK_BIT_RIGHT)) {
direction -= 1;
+ }
dvec_tmp[0] = direction * rv3d->viewinv[0][0];
dvec_tmp[1] = direction * rv3d->viewinv[0][1];
@@ -1120,11 +1131,13 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk)
direction = 0;
- if ((walk->active_directions & WALK_BIT_UP))
+ if ((walk->active_directions & WALK_BIT_UP)) {
direction -= 1;
+ }
- if ((walk->active_directions & WALK_BIT_DOWN))
+ if ((walk->active_directions & WALK_BIT_DOWN)) {
direction = 1;
+ }
copy_v3_fl3(dvec_tmp, 0.0f, 0.0f, direction);
add_v3_v3(dvec, dvec_tmp);
@@ -1162,8 +1175,9 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk)
dvec[2] -= difference;
/* in case we switched from FREE to GRAVITY too close to the ground */
- if (walk->gravity_state == WALK_GRAVITY_STATE_START)
+ if (walk->gravity_state == WALK_GRAVITY_STATE_START) {
walk->gravity_state = WALK_GRAVITY_STATE_OFF;
+ }
}
else {
/* hijack the teleport variables */
@@ -1249,9 +1263,15 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk)
if (rv3d->persp == RV3D_CAMOB) {
Object *lock_ob = ED_view3d_cameracontrol_object_get(walk->v3d_camera_control);
- if (lock_ob->protectflag & OB_LOCK_LOCX) dvec[0] = 0.0f;
- if (lock_ob->protectflag & OB_LOCK_LOCY) dvec[1] = 0.0f;
- if (lock_ob->protectflag & OB_LOCK_LOCZ) dvec[2] = 0.0f;
+ if (lock_ob->protectflag & OB_LOCK_LOCX) {
+ dvec[0] = 0.0f;
+ }
+ if (lock_ob->protectflag & OB_LOCK_LOCY) {
+ dvec[1] = 0.0f;
+ }
+ if (lock_ob->protectflag & OB_LOCK_LOCZ) {
+ dvec[2] = 0.0f;
+ }
}
/* scale the movement to the scene size */
@@ -1310,8 +1330,9 @@ static int walk_invoke(bContext *C, wmOperator *op, const wmEvent *event)
RegionView3D *rv3d = CTX_wm_region_view3d(C);
WalkInfo *walk;
- if (rv3d->viewlock & RV3D_LOCKED)
+ if (rv3d->viewlock & RV3D_LOCKED) {
return OPERATOR_CANCELLED;
+ }
walk = MEM_callocN(sizeof(WalkInfo), "NavigationWalkOperation");
@@ -1366,8 +1387,9 @@ static int walk_modal(bContext *C, wmOperator *op, const wmEvent *event)
exit_code = walkEnd(C, walk);
- if (exit_code != OPERATOR_RUNNING_MODAL)
+ if (exit_code != OPERATOR_RUNNING_MODAL) {
do_draw = true;
+ }
if (do_draw) {
if (rv3d->persp == RV3D_CAMOB) {
@@ -1379,8 +1401,9 @@ static int walk_modal(bContext *C, wmOperator *op, const wmEvent *event)
ED_region_tag_redraw(CTX_wm_region(C));
}
- if (ELEM(exit_code, OPERATOR_FINISHED, OPERATOR_CANCELLED))
+ if (ELEM(exit_code, OPERATOR_FINISHED, OPERATOR_CANCELLED)) {
ED_workspace_status_text(C, NULL);
+ }
return exit_code;
}