diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
commit | 44505b38df557a5711703613685a1dec9fc2c3d9 (patch) | |
tree | 3f05bebcc7bfadf56569f2dcca7f95fc56b1b0d0 /source/blender/editors/space_view3d/view3d_view.c | |
parent | 6654e109df952be3a3128fae2508a02c196ae593 (diff) |
Cleanup: strip trailing space in editors
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_view.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index e48ecd7797a..608580c0a08 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -132,7 +132,7 @@ void ED_view3d_smooth_view_ex( RegionView3D *rv3d = ar->regiondata; struct SmoothView3DStore sms = {{0}}; bool ok = false; - + /* initialize sms */ view3d_smooth_view_state_backup(&sms.dst, v3d, rv3d); view3d_smooth_view_state_backup(&sms.src, v3d, rv3d); @@ -185,11 +185,11 @@ void ED_view3d_smooth_view_ex( ED_view3d_from_object(sview->camera, sms.dst.ofs, sms.dst.quat, &sms.dst.dist, &sms.dst.lens); sms.to_camera = true; /* restore view3d values in end */ } - + /* skip smooth viewing for render engine draw */ if (smooth_viewtx && v3d->drawtype != OB_RENDER) { bool changed = false; /* zero means no difference */ - + if (sview->camera_old != sview->camera) changed = true; else if (sms.dst.dist != rv3d->dist) @@ -200,7 +200,7 @@ void ED_view3d_smooth_view_ex( changed = true; else if (!equals_v4v4(sms.dst.quat, rv3d->viewquat)) changed = true; - + /* The new view is different from the old one * so animate the view */ if (changed) { @@ -217,10 +217,10 @@ void ED_view3d_smooth_view_ex( } sms.time_allowed = (double)smooth_viewtx / 1000.0; - + /* if this is view rotation only * we can decrease the time allowed by - * the angle between quats + * the angle between quats * this means small rotations wont lag */ if (sview->quat && !sview->ofs && !sview->dist) { /* scale the time allowed by the rotation */ @@ -237,7 +237,7 @@ void ED_view3d_smooth_view_ex( } rv3d->rflag |= RV3D_NAVIGATING; - + /* not essential but in some cases the caller will tag the area for redraw, * and in that case we can get a flicker of the 'org' user view but we want to see 'src' */ view3d_smooth_view_state_restore(&sms.src, v3d, rv3d); @@ -256,7 +256,7 @@ void ED_view3d_smooth_view_ex( ok = true; } } - + /* if we get here nothing happens */ if (ok == false) { if (sms.to_camera == false) { @@ -297,15 +297,15 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool RegionView3D *rv3d = ar->regiondata; struct SmoothView3DStore *sms = rv3d->sms; float step, step_inv; - + if (sms->time_allowed != 0.0) step = (float)((rv3d->smooth_timer->duration) / sms->time_allowed); else step = 1.0f; - + /* end timer */ if (step >= 1.0f) { - + /* if we went to camera, store the original */ if (sms->to_camera) { rv3d->persp = RV3D_CAMOB; @@ -317,14 +317,14 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool ED_view3d_camera_lock_sync(v3d, rv3d); ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true); } - + if ((rv3d->viewlock & RV3D_LOCKED) == 0) { rv3d->view = sms->org_view; } MEM_freeN(rv3d->sms); rv3d->sms = NULL; - + WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), rv3d->smooth_timer); rv3d->smooth_timer = NULL; rv3d->rflag &= ~RV3D_NAVIGATING; @@ -343,7 +343,7 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool else { interp_v3_v3v3(rv3d->ofs, sms->src.ofs, sms->dst.ofs, step); } - + rv3d->dist = sms->dst.dist * step + sms->src.dist * step_inv; v3d->lens = sms->dst.lens * step + sms->src.lens * step_inv; @@ -355,7 +355,7 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool /* Event handling won't know if a UI item has been moved under the pointer. */ WM_event_add_mousemove(C); } - + if (sync_boxview && (rv3d->viewlock & RV3D_BOXVIEW)) { view3d_boxview_copy(CTX_wm_area(C), ar); } @@ -453,9 +453,9 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); rv3d->persp = RV3D_CAMOB; - + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, v3d->camera); - + return OPERATOR_FINISHED; } @@ -485,11 +485,11 @@ void VIEW3D_OT_camera_to_view(wmOperatorType *ot) ot->name = "Align Camera To View"; ot->description = "Set camera view to active view"; ot->idname = "VIEW3D_OT_camera_to_view"; - + /* api callbacks */ ot->exec = view3d_camera_to_view_exec; ot->poll = view3d_camera_to_view_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -654,7 +654,7 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op) } WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene); } - + return OPERATOR_FINISHED; } @@ -672,11 +672,11 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot) ot->name = "Set Active Object as Camera"; ot->description = "Set the active object as the active camera for this view or scene"; ot->idname = "VIEW3D_OT_object_as_camera"; - + /* api callbacks */ ot->exec = view3d_setobjectascamera_exec; ot->poll = ED_operator_rv3d_user_region_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -696,7 +696,7 @@ void view3d_winmatrix_set(ARegion *ar, const View3D *v3d, const rcti *rect) rctf viewplane; float clipsta, clipend; bool is_ortho; - + is_ortho = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL); rv3d->is_persp = !is_ortho; @@ -771,13 +771,13 @@ void view3d_viewmatrix_set( /* should be moved to better initialize later on XXX */ if (rv3d->viewlock & RV3D_LOCKED) ED_view3d_lock(rv3d); - + quat_to_mat4(rv3d->viewmat, rv3d->viewquat); if (rv3d->persp == RV3D_PERSP) rv3d->viewmat[3][2] -= rv3d->dist; if (v3d->ob_centre) { Object *ob = v3d->ob_centre; float vec[3]; - + copy_v3_v3(vec, ob->obmat[3]); if (ob->type == OB_ARMATURE && v3d->ob_centre_bone[0]) { bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, v3d->ob_centre_bone); @@ -929,16 +929,16 @@ int view3d_opengl_select( v3d->zbuf = true; glEnable(GL_DEPTH_TEST); } - + if (vc->rv3d->rflag & RV3D_CLIPPING) ED_view3d_clipping_set(vc->rv3d); - + GPU_select_begin(buffer, bufsize, &rect, gpu_select_mode, 0); ED_view3d_draw_select_loop(vc, scene, v3d, ar, use_obedit_skip, use_nearest); hits = GPU_select_end(); - + /* second pass, to get the closest object to camera */ if (do_passes && (hits > 0)) { GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits); @@ -950,12 +950,12 @@ int view3d_opengl_select( G.f &= ~G_PICKSEL; ED_view3d_draw_setup_view(vc->win, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL); - + if (v3d->drawtype > OB_WIRE) { v3d->zbuf = 0; glDisable(GL_DEPTH_TEST); } - + if (vc->rv3d->rflag & RV3D_CLIPPING) ED_view3d_clipping_disable(); @@ -978,9 +978,9 @@ static unsigned int free_localbit(Main *bmain) unsigned int lay; ScrArea *sa; bScreen *sc; - + lay = 0; - + /* sometimes we loose a localview: when an area is closed */ /* check all areas: which localviews are in use? */ for (sc = bmain->screen.first; sc; sc = sc->id.next) { @@ -994,7 +994,7 @@ static unsigned int free_localbit(Main *bmain) } } } - + if ((lay & 0x01000000) == 0) return 0x01000000; if ((lay & 0x02000000) == 0) return 0x02000000; if ((lay & 0x04000000) == 0) return 0x04000000; @@ -1003,35 +1003,35 @@ static unsigned int free_localbit(Main *bmain) if ((lay & 0x20000000) == 0) return 0x20000000; if ((lay & 0x40000000) == 0) return 0x40000000; if ((lay & 0x80000000) == 0) return 0x80000000; - + return 0; } int ED_view3d_scene_layer_set(int lay, const int *values, int *active) { int i, tot = 0; - + /* ensure we always have some layer selected */ for (i = 0; i < 20; i++) if (values[i]) tot++; - + if (tot == 0) return lay; - + for (i = 0; i < 20; i++) { - + if (active) { /* if this value has just been switched on, make that layer active */ if (values[i] && (lay & (1 << i)) == 0) { *active = (1 << i); } } - + if (values[i]) lay |= (1 << i); else lay &= ~(1 << i); } - + /* ensure always an active layer */ if (active && (lay & *active) == 0) { for (i = 0; i < 20; i++) { @@ -1041,7 +1041,7 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active) } } } - + return lay; } @@ -1072,9 +1072,9 @@ static bool view3d_localview_init( else { if (scene->obedit) { BKE_object_minmax(scene->obedit, min, max, false); - + ok = true; - + BASACT->lay |= locallay; scene->obedit->lay = BASACT->lay; } @@ -1092,12 +1092,12 @@ static bool view3d_localview_init( sub_v3_v3v3(box, max, min); size = max_fff(box[0], box[1], box[2]); } - + if (ok == true) { ARegion *ar; - + v3d->localvd = MEM_mallocN(sizeof(View3D), "localview"); - + memcpy(v3d->localvd, v3d, sizeof(View3D)); mid_v3_v3v3(mid, min, max); @@ -1145,11 +1145,11 @@ static bool view3d_localview_init( .dist = ok_dist ? &dist_new : NULL, .lens = &v3d->lens}); } } - + v3d->lay = locallay; } else { - /* clear flags */ + /* clear flags */ for (base = FIRSTBASE; base; base = base->next) { if (base->lay & locallay) { base->lay -= locallay; @@ -1171,9 +1171,9 @@ static void restore_localviewdata(wmWindowManager *wm, wmWindow *win, Main *bmai ARegion *ar; View3D *v3d = sa->spacedata.first; Object *camera_old, *camera_new; - + if (v3d->localvd == NULL) return; - + camera_old = v3d->camera; camera_new = v3d->localvd->camera; @@ -1181,16 +1181,16 @@ static void restore_localviewdata(wmWindowManager *wm, wmWindow *win, Main *bmai v3d->layact = v3d->localvd->layact; v3d->drawtype = v3d->localvd->drawtype; v3d->camera = v3d->localvd->camera; - + if (free) { MEM_freeN(v3d->localvd); v3d->localvd = NULL; } - + for (ar = sa->regionbase.first; ar; ar = ar->next) { if (ar->regiontype == RGN_TYPE_WINDOW) { RegionView3D *rv3d = ar->regiondata; - + if (rv3d->localvd) { Object *camera_old_rv3d, *camera_new_rv3d; @@ -1227,16 +1227,16 @@ static bool view3d_localview_exit( View3D *v3d = sa->spacedata.first; struct Base *base; unsigned int locallay; - + if (v3d->localvd) { - + locallay = v3d->lay & 0xFF000000; restore_localviewdata(wm, win, bmain, sa, smooth_viewtx); /* for when in other window the layers have changed */ if (v3d->scenelock) v3d->lay = scene->lay; - + for (base = FIRSTBASE; base; base = base->next) { if (base->lay & locallay) { base->lay -= locallay; @@ -1248,7 +1248,7 @@ static bool view3d_localview_exit( base->object->lay = base->lay; } } - + DAG_on_visible_update(bmain, false); return true; @@ -1268,7 +1268,7 @@ static int localview_exec(bContext *C, wmOperator *op) ScrArea *sa = CTX_wm_area(C); View3D *v3d = CTX_wm_view3d(C); bool changed; - + if (v3d->localvd) { changed = view3d_localview_exit(wm, win, bmain, scene, sa, smooth_viewtx); } @@ -1298,11 +1298,11 @@ void VIEW3D_OT_localview(wmOperatorType *ot) ot->name = "Local View"; ot->description = "Toggle display of selected object(s) separately and centered in view"; ot->idname = "VIEW3D_OT_localview"; - + /* api callbacks */ ot->exec = localview_exec; ot->flag = OPTYPE_UNDO; /* localview changes object layer bitflags */ - + ot->poll = ED_operator_view3d_active; } |