diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-07-26 10:34:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-07-26 10:34:56 +0400 |
commit | e62c0ea835534acf2500ab0b4efcbb7b1eaa3cdd (patch) | |
tree | a0e557b6b00ae51772c33671b02eb644a5365a8e /source/blender/editors/space_view3d | |
parent | 304043ee5f21caf364e0eeedd7f7217e04371540 (diff) |
replace macros VECCOPY and QUATCOPY with inline math functions no functional changes
also replace mul_m4_v3() with mul_v3_m4v3() in a few places.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 29 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 70 |
4 files changed, 57 insertions, 66 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a23a4952b49..38e763e6f88 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -189,7 +189,7 @@ void view3d_clr_clipping(void) static int test_clipping(float *vec, float clip[][4]) { float view[3]; - VECCOPY(view, vec); + copy_v3_v3(view, vec); if(0.0f < clip[0][3] + INPR(view, clip[0])) if(0.0f < clip[1][3] + INPR(view, clip[1])) @@ -1937,9 +1937,9 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar, { float len1, len2, vec[3]; - VECCOPY(vec, rv3d->persinv[0]); + copy_v3_v3(vec, rv3d->persinv[0]); len1= normalize_v3(vec); - VECCOPY(vec, rv3d->persinv[1]); + copy_v3_v3(vec, rv3d->persinv[1]); len2= normalize_v3(vec); rv3d->pixsize= 2.0f*(len1>len2?len1:len2); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index aee4b2515ec..1385482212e 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -206,7 +206,7 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar) if(rv3dtest->viewlock) { rv3dtest->dist= rv3d->dist; - VECCOPY(rv3dtest->ofs, rv3d->ofs); + copy_v3_v3(rv3dtest->ofs, rv3d->ofs); ED_region_tag_redraw(artest); } } @@ -310,14 +310,14 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) vod->ar= CTX_wm_region(C); vod->rv3d= rv3d= vod->ar->regiondata; vod->dist0= rv3d->dist; - QUATCOPY(vod->oldquat, rv3d->viewquat); + copy_qt_qt(vod->oldquat, rv3d->viewquat); 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; if (vod->use_dyn_ofs) { - VECCOPY(vod->ofs, rv3d->ofs); + copy_v3_v3(vod->ofs, rv3d->ofs); /* If there's no selection, lastofs is unmodified and last value since static */ calculateTransformCenter(C, V3D_CENTROID, lastofs); negate_v3_v3(vod->dyn_ofs, lastofs); @@ -336,8 +336,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) float mat[3][3]; float upvec[3]; - VECCOPY(my_origin, rv3d->ofs); - negate_v3(my_origin); /* ofs is flipped */ + negate_v3_v3(my_origin, rv3d->ofs); /* ofs is flipped */ /* Set the dist value to be the distance from this 3d point */ /* this means youll always be able to zoom into it and panning wont go bad when dist was zero */ @@ -358,7 +357,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) negate_v3_v3(rv3d->ofs, dvec); } negate_v3(vod->dyn_ofs); - VECCOPY(vod->ofs, rv3d->ofs); + copy_v3_v3(vod->ofs, rv3d->ofs); } else { vod->ofs[0] = vod->ofs[1] = vod->ofs[2] = 0.0f; } @@ -538,12 +537,12 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) if (vod->use_dyn_ofs) { /* compute the post multiplication quat, to rotate the offset correctly */ - QUATCOPY(q1, vod->oldquat); + copy_qt_qt(q1, vod->oldquat); conjugate_qt(q1); mul_qt_qtqt(q1, q1, rv3d->viewquat); conjugate_qt(q1); /* conj == inv for unit quat */ - VECCOPY(rv3d->ofs, vod->ofs); + copy_v3_v3(rv3d->ofs, vod->ofs); sub_v3_v3(rv3d->ofs, vod->dyn_ofs); mul_qt_v3(q1, rv3d->ofs); add_v3_v3(rv3d->ofs, vod->dyn_ofs); @@ -1024,7 +1023,7 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my) /* Offset to target position and dolly */ new_dist = rv3d->dist * dfac; - VECCOPY(rv3d->ofs, tvec); + copy_v3_v3(rv3d->ofs, tvec); rv3d->dist = new_dist; /* Calculate final offset */ @@ -1432,11 +1431,9 @@ static int viewselected_exec(bContext *C, wmOperator *op) /* like a localview wi if(pchan->bone->layer & arm->layer) { bPoseChannel *pchan_tx= pchan->custom_tx ? pchan->custom_tx : pchan; ok= 1; - VECCOPY(vec, pchan_tx->pose_head); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_head); DO_MINMAX(vec, min, max); - VECCOPY(vec, pchan_tx->pose_tail); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_tail); DO_MINMAX(vec, min, max); } } @@ -2084,7 +2081,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op) } else if(orbitdir == V3D_VIEW_STEPDOWN || orbitdir == V3D_VIEW_STEPUP) { /* horizontal axis */ - VECCOPY(q1+1, rv3d->viewinv[0]); + copy_v3_v3(q1+1, rv3d->viewinv[0]); normalize_v3(q1+1); phi= (float)(M_PI/360.0)*U.pad_rot_angle; @@ -2397,7 +2394,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event) fp= give_cursor(scene, v3d); // if(obedit && ctrl) lr_click= 1; - VECCOPY(oldcurs, fp); + copy_v3_v3(oldcurs, fp); mx= event->x - ar->winrct.xmin; my= event->y - ar->winrct.ymin; @@ -2982,7 +2979,7 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode) obofs[2] = -ob->obmat[3][2]; } else { - VECCOPY(obofs, rv3d->ofs); + copy_v3_v3(obofs, rv3d->ofs); } /* calc an adjustment based on distance from camera diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 714297b7807..fc3dea5fd22 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -356,11 +356,9 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, short mcords[][2], if(ob->type!=OB_ARMATURE || ob->pose==NULL) return; for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { - VECCOPY(vec, pchan->pose_head); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, pchan->pose_head); project_short(vc->ar, vec, sco1); - VECCOPY(vec, pchan->pose_tail); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail); project_short(vc->ar, vec, sco2); if(lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) { @@ -644,11 +642,9 @@ static void do_lasso_select_armature(ViewContext *vc, short mcords[][2], short m for (ebone= arm->edbo->first; ebone; ebone=ebone->next) { - VECCOPY(vec, ebone->head); - mul_m4_v3(vc->obedit->obmat, vec); + mul_v3_m4v3(vec, vc->obedit->obmat, ebone->head); project_short(vc->ar, vec, sco1); - VECCOPY(vec, ebone->tail); - mul_m4_v3(vc->obedit->obmat, vec); + mul_v3_m4v3(vec, vc->obedit->obmat, ebone->tail); project_short(vc->ar, vec, sco2); didpoint= 0; @@ -2010,13 +2006,11 @@ static void armature_circle_select(ViewContext *vc, int selecting, short *mval, float vec[3]; /* project head location to screenspace */ - VECCOPY(vec, ebone->head); - mul_m4_v3(vc->obedit->obmat, vec); + mul_v3_m4v3(vec, vc->obedit->obmat, ebone->head); project_short(vc->ar, vec, sco1); /* project tail location to screenspace */ - VECCOPY(vec, ebone->tail); - mul_m4_v3(vc->obedit->obmat, vec); + mul_v3_m4v3(vec, vc->obedit->obmat, ebone->tail); project_short(vc->ar, vec, sco2); /* check if the head and/or tail is in the circle diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index d8982fb68ca..6b1f5736f03 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -194,15 +194,15 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo /* initialize sms */ memset(&sms,0,sizeof(struct SmoothViewStore)); - VECCOPY(sms.new_ofs, rv3d->ofs); - QUATCOPY(sms.new_quat, rv3d->viewquat); + copy_v3_v3(sms.new_ofs, rv3d->ofs); + copy_qt_qt(sms.new_quat, rv3d->viewquat); sms.new_dist= rv3d->dist; sms.new_lens= v3d->lens; sms.to_camera= 0; /* store the options we want to end with */ - if(ofs) VECCOPY(sms.new_ofs, ofs); - if(quat) QUATCOPY(sms.new_quat, quat); + if(ofs) copy_v3_v3(sms.new_ofs, ofs); + if(quat) copy_qt_qt(sms.new_quat, quat); if(dist) sms.new_dist= *dist; if(lens) sms.new_lens= *lens; @@ -243,8 +243,8 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo if (quat && !ofs && !dist) { float vec1[3], vec2[3]; - VECCOPY(vec1, sms.new_quat); - VECCOPY(vec2, sms.orig_quat); + copy_v3_v3(vec1, sms.new_quat); + copy_v3_v3(vec2, sms.orig_quat); normalize_v3(vec1); normalize_v3(vec2); /* scale the time allowed by the rotation */ @@ -257,8 +257,8 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo view3d_settings_from_ob(oldcamera, sms.orig_ofs, sms.orig_quat, &sms.orig_dist, &sms.orig_lens); } else { - VECCOPY(sms.orig_ofs, rv3d->ofs); - QUATCOPY(sms.orig_quat, rv3d->viewquat); + copy_v3_v3(sms.orig_ofs, rv3d->ofs); + copy_qt_qt(sms.orig_quat, rv3d->viewquat); sms.orig_dist= rv3d->dist; sms.orig_lens= v3d->lens; } @@ -289,8 +289,8 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo /* if we get here nothing happens */ if(sms.to_camera==0) { - VECCOPY(rv3d->ofs, sms.new_ofs); - QUATCOPY(rv3d->viewquat, sms.new_quat); + copy_v3_v3(rv3d->ofs, sms.new_ofs); + copy_qt_qt(rv3d->viewquat, sms.new_quat); rv3d->dist = sms.new_dist; v3d->lens = sms.new_lens; } @@ -317,14 +317,14 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *op, wmEvent *event) /* if we went to camera, store the original */ if(sms->to_camera) { rv3d->persp= RV3D_CAMOB; - VECCOPY(rv3d->ofs, sms->orig_ofs); - QUATCOPY(rv3d->viewquat, sms->orig_quat); + copy_v3_v3(rv3d->ofs, sms->orig_ofs); + copy_qt_qt(rv3d->viewquat, sms->orig_quat); rv3d->dist = sms->orig_dist; v3d->lens = sms->orig_lens; } else { - VECCOPY(rv3d->ofs, sms->new_ofs); - QUATCOPY(rv3d->viewquat, sms->new_quat); + copy_v3_v3(rv3d->ofs, sms->new_ofs); + copy_qt_qt(rv3d->viewquat, sms->new_quat); rv3d->dist = sms->new_dist; v3d->lens = sms->new_lens; } @@ -571,9 +571,9 @@ void viewvector(RegionView3D *rv3d, float coord[3], float vec[3]) { float p1[4], p2[4]; - VECCOPY(p1, coord); + copy_v3_v3(p1, coord); p1[3] = 1.0f; - VECCOPY(p2, p1); + copy_v3_v3(p2, p1); p2[3] = 1.0f; mul_m4_v4(rv3d->viewmat, p2); @@ -584,7 +584,7 @@ void viewvector(RegionView3D *rv3d, float coord[3], float vec[3]) sub_v3_v3v3(vec, p1, p2); } else { - VECCOPY(vec, rv3d->viewinv[2]); + copy_v3_v3(vec, rv3d->viewinv[2]); } normalize_v3(vec); } @@ -686,7 +686,7 @@ void view3d_project_float(ARegion *ar, float *vec, float *adr, float mat[4][4]) float vec4[4]; adr[0]= IS_CLIPPED; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(mat, vec4); @@ -713,7 +713,7 @@ int boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb) mul_m4_m4m4(mat, obmat, rv3d->persmat); for(a=0; a<8; a++) { - VECCOPY(vec, bb->vec[a]); + copy_v3_v3(vec, bb->vec[a]); vec[3]= 1.0; mul_m4_v4(mat, vec); max= vec[3]; @@ -746,7 +746,7 @@ void project_short(ARegion *ar, float *vec, short *adr) /* clips */ return; } - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -771,7 +771,7 @@ void project_int(ARegion *ar, float *vec, int *adr) float fx, fy, vec4[4]; adr[0]= (int)2140000000.0f; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -795,7 +795,7 @@ void project_int_noclip(ARegion *ar, float *vec, int *adr) RegionView3D *rv3d= ar->regiondata; float fx, fy, vec4[4]; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -820,7 +820,7 @@ void project_short_noclip(ARegion *ar, float *vec, short *adr) float fx, fy, vec4[4]; adr[0]= IS_CLIPPED; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -846,7 +846,7 @@ void project_float(ARegion *ar, float *vec, float *adr) float vec4[4]; adr[0]= IS_CLIPPED; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -862,7 +862,7 @@ void project_float_noclip(ARegion *ar, float *vec, float *adr) RegionView3D *rv3d= ar->regiondata; float vec4[4]; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -1109,7 +1109,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short float orig_ofs[3]; float orig_dist= rv3d->dist; float orig_lens= v3d->lens; - VECCOPY(orig_ofs, rv3d->ofs); + copy_v3_v3(orig_ofs, rv3d->ofs); /* Switch from camera view */ mat3_to_quat( new_quat,tmat); @@ -1205,11 +1205,11 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) Object *ob= v3d->ob_centre; float vec[3]; - VECCOPY(vec, ob->obmat[3]); + copy_v3_v3(vec, ob->obmat[3]); if(ob->type==OB_ARMATURE && v3d->ob_centre_bone[0]) { bPoseChannel *pchan= get_pose_channel(ob->pose, v3d->ob_centre_bone); if(pchan) { - VECCOPY(vec, pchan->pose_mat[3]); + copy_v3_v3(vec, pchan->pose_mat[3]); mul_m4_v3(ob->obmat, vec); } } @@ -1543,8 +1543,8 @@ static void restore_localviewdata(ScrArea *sa, int free) if(rv3d->localvd) { rv3d->dist= rv3d->localvd->dist; - VECCOPY(rv3d->ofs, rv3d->localvd->ofs); - QUATCOPY(rv3d->viewquat, rv3d->localvd->viewquat); + copy_v3_v3(rv3d->ofs, rv3d->localvd->ofs); + copy_qt_qt(rv3d->viewquat, rv3d->localvd->viewquat); rv3d->view= rv3d->localvd->view; rv3d->persp= rv3d->localvd->persp; rv3d->camzoom= rv3d->localvd->camzoom; @@ -2057,7 +2057,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even /* perspective or ortho */ if (fly->rv3d->persp==RV3D_ORTHO) fly->rv3d->persp= RV3D_PERSP; /*if ortho projection, make perspective */ - QUATCOPY(fly->rot_backup, fly->rv3d->viewquat); + copy_qt_qt(fly->rot_backup, fly->rv3d->viewquat); copy_v3_v3(fly->ofs_backup, fly->rv3d->ofs); fly->rv3d->dist= 0.0f; @@ -2101,8 +2101,8 @@ static int flyEnd(bContext *C, FlyInfo *fly) DAG_id_flush_update(&ob_back->id, OB_RECALC_OB); } else { /* Non Camera we need to reset the view back to the original location bacause the user canceled*/ - QUATCOPY(rv3d->viewquat, fly->rot_backup); - VECCOPY(rv3d->ofs, fly->ofs_backup); + copy_qt_qt(rv3d->viewquat, fly->rot_backup); + copy_v3_v3(rv3d->ofs, fly->ofs_backup); rv3d->persp= fly->persp_backup; } } @@ -2590,7 +2590,7 @@ static int flyApply(bContext *C, FlyInfo *fly) /*were not redrawing but we need to update the time else the view will jump */ fly->time_lastdraw= PIL_check_seconds_timer(); /* end drawing */ - VECCOPY(fly->dvec_prev, dvec); + copy_v3_v3(fly->dvec_prev, dvec); } /* moved to flyEnd() */ @@ -2703,7 +2703,7 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f float orig_dist= rv3d->dist; float orig_lens= v3d->lens; - VECCOPY(orig_ofs, rv3d->ofs); + copy_v3_v3(orig_ofs, rv3d->ofs); rv3d->persp= RV3D_PERSP; rv3d->dist= 0.0; view3d_settings_from_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens); |