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_edit.c
parent5279d118c2ddee0e6fef66aaf78452c1b302dd42 (diff)
Cleanup: style, use braces for editor/spaces
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c110
1 files changed, 77 insertions, 33 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index abcb5495d39..19008ebd122 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -507,8 +507,9 @@ static void viewops_data_create(
}
vod->reverse = 1.0f;
- if (rv3d->persmat[2][1] < 0.0f)
+ if (rv3d->persmat[2][1] < 0.0f) {
vod->reverse = -1.0f;
+ }
rv3d->rflag |= RV3D_NAVIGATING;
}
@@ -524,8 +525,9 @@ static void viewops_data_free(bContext *C, wmOperator *op)
ar = vod->ar;
vod->rv3d->rflag &= ~RV3D_NAVIGATING;
- if (vod->timer)
+ if (vod->timer) {
WM_event_remove_timer(CTX_wm_manager(C), vod->timer->win, vod->timer);
+ }
MEM_freeN(vod);
op->customdata = NULL;
@@ -537,7 +539,9 @@ static void viewops_data_free(bContext *C, wmOperator *op)
#if 0
if (p && (p->flags & PAINT_FAST_NAVIGATE))
#endif
+ {
ED_region_tag_redraw(ar);
+ }
}
/** \} */
@@ -580,7 +584,9 @@ void viewrotate_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Rotate Modal");
/* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items) return;
+ if (keymap && keymap->modal_items) {
+ return;
+ }
keymap = WM_modalkeymap_add(keyconf, "View3D Rotate Modal", modal_items);
@@ -1070,8 +1076,9 @@ static void view3d_ndof_pan_zoom(
if (ndof->tvec[2]) {
float zoom_distance = rv3d->dist * ndof->dt * ndof->tvec[2];
- if (U.ndof_flag & NDOF_ZOOM_INVERT)
+ if (U.ndof_flag & NDOF_ZOOM_INVERT) {
zoom_distance = -zoom_distance;
+ }
rv3d->dist += zoom_distance;
}
@@ -1197,8 +1204,9 @@ void view3d_ndof_fly(
float speed = view3d_ndof_pan_speed_calc_from_dist(rv3d, 1.0f);
float trans[3], trans_orig_y;
- if (use_precision)
+ if (use_precision) {
speed *= 0.2f;
+ }
WM_event_ndof_pan_get(ndof, trans, false);
mul_v3_fl(trans, speed * ndof->dt);
@@ -1218,9 +1226,15 @@ void view3d_ndof_fly(
if (rv3d->persp == RV3D_CAMOB) {
/* respect camera position locks */
- if (protectflag & OB_LOCK_LOCX) trans[0] = 0.0f;
- if (protectflag & OB_LOCK_LOCY) trans[1] = 0.0f;
- if (protectflag & OB_LOCK_LOCZ) trans[2] = 0.0f;
+ if (protectflag & OB_LOCK_LOCX) {
+ trans[0] = 0.0f;
+ }
+ if (protectflag & OB_LOCK_LOCY) {
+ trans[1] = 0.0f;
+ }
+ if (protectflag & OB_LOCK_LOCZ) {
+ trans[2] = 0.0f;
+ }
}
if (!is_zero_v3(trans)) {
@@ -1244,8 +1258,9 @@ void view3d_ndof_fly(
if (fabsf(angle) > 0.0001f) {
has_rotate = true;
- if (use_precision)
+ if (use_precision) {
angle *= 0.2f;
+ }
/* transform rotation axis from view to world coordinates */
mul_qt_v3(view_inv, axis);
@@ -1509,8 +1524,9 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *e
/* we're panning here! so erase any leftover rotation from other operators */
rv3d->rot_angle = 0.0f;
- if (!(has_translate || has_zoom))
+ if (!(has_translate || has_zoom)) {
return OPERATOR_CANCELLED;
+ }
ED_view3d_camera_lock_init_ex(depsgraph, v3d, rv3d, false);
@@ -1613,7 +1629,9 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Move Modal");
/* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items) return;
+ if (keymap && keymap->modal_items) {
+ return;
+ }
keymap = WM_modalkeymap_add(keyconf, "View3D Move Modal", modal_items);
@@ -1805,7 +1823,9 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Zoom Modal");
/* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items) return;
+ if (keymap && keymap->modal_items) {
+ return;
+ }
keymap = WM_modalkeymap_add(keyconf, "View3D Zoom Modal", modal_items);
@@ -2336,7 +2356,9 @@ void viewdolly_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Dolly Modal");
/* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items) return;
+ if (keymap && keymap->modal_items) {
+ return;
+ }
keymap = WM_modalkeymap_add(keyconf, "View3D Dolly Modal", modal_items);
@@ -2515,8 +2537,9 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ViewOpsData *vod;
- if (viewdolly_offset_lock_check(C, op))
+ if (viewdolly_offset_lock_check(C, op)) {
return OPERATOR_CANCELLED;
+ }
/* makes op->customdata */
viewops_data_alloc(C, op);
@@ -2883,13 +2906,16 @@ static int viewselected_exec(bContext *C, wmOperator *op)
Base *base_eval;
for (base_eval = view_layer_eval->object_bases.first; base_eval; base_eval = base_eval->next) {
if (BASE_SELECTED_EDITABLE(v3d, base_eval)) {
- if (base_eval->object->type == OB_ARMATURE)
- if (base_eval->object->mode & OB_MODE_POSE)
+ if (base_eval->object->type == OB_ARMATURE) {
+ if (base_eval->object->mode & OB_MODE_POSE) {
break;
+ }
+ }
}
}
- if (base_eval)
+ if (base_eval) {
ob_eval = base_eval->object;
+ }
}
if (is_gp_edit) {
@@ -3330,16 +3356,20 @@ static int render_border_exec(bContext *C, wmOperator *op)
/* drawing a border outside the camera view switches off border rendering */
if ((border.xmin == border.xmax || border.ymin == border.ymax)) {
- if (rv3d->persp == RV3D_CAMOB)
+ if (rv3d->persp == RV3D_CAMOB) {
scene->r.mode &= ~R_BORDER;
- else
+ }
+ else {
v3d->flag2 &= ~V3D_RENDER_BORDER;
+ }
}
else {
- if (rv3d->persp == RV3D_CAMOB)
+ if (rv3d->persp == RV3D_CAMOB) {
scene->r.mode |= R_BORDER;
- else
+ }
+ else {
v3d->flag2 |= V3D_RENDER_BORDER;
+ }
}
if (rv3d->persp == RV3D_CAMOB) {
@@ -3912,15 +3942,18 @@ static int view_camera_exec(bContext *C, wmOperator *op)
}
/* if the camera isn't found, check a number of options */
- if (v3d->camera == NULL && ob && ob->type == OB_CAMERA)
+ if (v3d->camera == NULL && ob && ob->type == OB_CAMERA) {
v3d->camera = ob;
+ }
- if (v3d->camera == NULL)
+ if (v3d->camera == NULL) {
v3d->camera = BKE_view_layer_camera_find(view_layer);
+ }
/* couldn't find any useful camera, bail out */
- if (v3d->camera == NULL)
+ if (v3d->camera == NULL) {
return OPERATOR_CANCELLED;
+ }
/* important these don't get out of sync for locked scenes */
if (v3d->scenelock && scene->camera != v3d->camera) {
@@ -4128,8 +4161,9 @@ static void viewroll_apply(ViewOpsData *vod, int x, int UNUSED(y))
angle = (len1 - len2) * (float)M_PI * 4.0f;
}
- if (angle != 0.0f)
+ if (angle != 0.0f) {
view_roll_angle(vod->ar, vod->rv3d->viewquat, vod->init.quat, vod->init.mousevec, angle);
+ }
if (vod->use_dyn_ofs) {
view3d_orbit_apply_dyn_ofs(vod->rv3d->ofs, vod->init.ofs, vod->init.quat, vod->rv3d->viewquat, vod->dyn_ofs);
@@ -4405,9 +4439,12 @@ static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
rv3d = ar->regiondata;
if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
- if (rv3d->persp != RV3D_ORTHO)
+ if (rv3d->persp != RV3D_ORTHO) {
rv3d->persp = RV3D_ORTHO;
- else rv3d->persp = RV3D_PERSP;
+ }
+ else {
+ rv3d->persp = RV3D_PERSP;
+ }
ED_region_tag_redraw(ar);
}
@@ -4617,8 +4654,9 @@ static void calc_local_clipping(float clip_local[6][4], BoundBox *clipbb, float
void ED_view3d_clipping_local(RegionView3D *rv3d, float mat[4][4])
{
- if (rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING) {
calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);
+ }
}
static int view3d_clipping_exec(bContext *C, wmOperator *op)
@@ -4646,7 +4684,9 @@ static int view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *ev
if (rv3d->rflag & RV3D_CLIPPING) {
rv3d->rflag &= ~RV3D_CLIPPING;
ED_region_tag_redraw(ar);
- if (rv3d->clipbb) MEM_freeN(rv3d->clipbb);
+ if (rv3d->clipbb) {
+ MEM_freeN(rv3d->clipbb);
+ }
rv3d->clipbb = NULL;
return OPERATOR_FINISHED;
}
@@ -4696,8 +4736,9 @@ void ED_view3d_cursor3d_position(bContext *C, const int mval[2], const bool use_
/* normally the caller should ensure this,
* but this is called from areas that aren't already dealing with the viewport */
- if (rv3d == NULL)
+ if (rv3d == NULL) {
return;
+ }
ED_view3d_calc_zfac(rv3d, cursor_co, &flip);
@@ -4736,8 +4777,9 @@ void ED_view3d_cursor3d_position_rotation(
RegionView3D *rv3d = ar->regiondata;
/* XXX, caller should check. */
- if (rv3d == NULL)
+ if (rv3d == NULL) {
return;
+ }
ED_view3d_cursor3d_position(C, mval, use_depth, cursor_co);
@@ -4872,10 +4914,12 @@ void ED_view3d_cursor3d_update(
}
}
- if (v3d->localvd)
+ if (v3d->localvd) {
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
- else
+ }
+ else {
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene);
+ }
{
struct wmMsgBus *mbus = CTX_wm_message_bus(C);