[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36799] trunk/blender/source/blender/ editors: use consistant arguments to ED_view3d_win_* funcs, a single float vector rather then 2 floats.
Campbell Barton
ideasman42 at gmail.com
Fri May 20 15:50:42 CEST 2011
Revision: 36799
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36799
Author: campbellbarton
Date: 2011-05-20 13:50:41 +0000 (Fri, 20 May 2011)
Log Message:
-----------
use consistant arguments to ED_view3d_win_* funcs, a single float vector rather then 2 floats.
Modified Paths:
--------------
trunk/blender/source/blender/editors/armature/editarmature.c
trunk/blender/source/blender/editors/armature/editarmature_sketch.c
trunk/blender/source/blender/editors/gpencil/gpencil_edit.c
trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
trunk/blender/source/blender/editors/include/ED_view3d.h
trunk/blender/source/blender/editors/physics/particle_edit.c
trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
trunk/blender/source/blender/editors/space_view3d/view3d_select.c
trunk/blender/source/blender/editors/space_view3d/view3d_view.c
trunk/blender/source/blender/editors/transform/transform.c
Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c 2011-05-20 13:10:40 UTC (rev 36798)
+++ trunk/blender/source/blender/editors/armature/editarmature.c 2011-05-20 13:50:41 UTC (rev 36799)
@@ -2489,7 +2489,7 @@
ARegion *ar;
View3D *v3d;
RegionView3D *rv3d;
- float *fp = NULL, tvec[3], oldcurs[3];
+ float *fp = NULL, tvec[3], oldcurs[3], mval_f[2];
int retv;
scene= CTX_data_scene(C);
@@ -2501,7 +2501,8 @@
copy_v3_v3(oldcurs, fp);
- ED_view3d_win_to_3d(ar, fp, event->mval[0], event->mval[1], tvec);
+ VECCOPY2D(mval_f, event->mval);
+ ED_view3d_win_to_3d(ar, fp, mval_f, tvec);
copy_v3_v3(fp, tvec);
/* extrude to the where new cursor is and store the operation result */
Modified: trunk/blender/source/blender/editors/armature/editarmature_sketch.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature_sketch.c 2011-05-20 13:10:40 UTC (rev 36798)
+++ trunk/blender/source/blender/editors/armature/editarmature_sketch.c 2011-05-20 13:50:41 UTC (rev 36799)
@@ -1022,6 +1022,7 @@
short cval[2];
float fp[3] = {0, 0, 0};
float dvec[3];
+ float mval_f[2];
if (last != NULL)
{
@@ -1032,7 +1033,8 @@
/* method taken from editview.c - mouse_cursor() */
project_short_noclip(ar, fp, cval);
- ED_view3d_win_to_delta(ar, cval[0] - dd->mval[0], cval[1] - dd->mval[1], dvec);
+ VECSUB2D(mval_f, cval, dd->mval);
+ ED_view3d_win_to_delta(ar, mval_f, dvec);
sub_v3_v3v3(vec, fp, dvec);
}
Modified: trunk/blender/source/blender/editors/gpencil/gpencil_edit.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_edit.c 2011-05-20 13:10:40 UTC (rev 36798)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_edit.c 2011-05-20 13:50:41 UTC (rev 36799)
@@ -377,31 +377,30 @@
}
else {
float *fp= give_cursor(scene, v3d);
- float mx, my;
+ float mvalf[2];
/* get screen coordinate */
if (gps->flag & GP_STROKE_2DSPACE) {
- int mxi, myi;
+ int mvali[2];
View2D *v2d= &ar->v2d;
- UI_view2d_view_to_region(v2d, pt->x, pt->y, &mxi, &myi);
- mx= mxi;
- my= myi;
+ UI_view2d_view_to_region(v2d, pt->x, pt->y, mvali, mvali+1);
+ VECCOPY2D(mvalf, mvali);
}
else {
if(subrect) {
- mx= (((float)pt->x/100.0f) * (subrect->xmax - subrect->xmin)) + subrect->xmin;
- my= (((float)pt->y/100.0f) * (subrect->ymax - subrect->ymin)) + subrect->ymin;
+ mvalf[0]= (((float)pt->x/100.0f) * (subrect->xmax - subrect->xmin)) + subrect->xmin;
+ mvalf[1]= (((float)pt->y/100.0f) * (subrect->ymax - subrect->ymin)) + subrect->ymin;
}
else {
- mx= (float)pt->x / 100.0f * ar->winx;
- my= (float)pt->y / 100.0f * ar->winy;
+ mvalf[0]= (float)pt->x / 100.0f * ar->winx;
+ mvalf[1]= (float)pt->y / 100.0f * ar->winy;
}
}
/* convert screen coordinate to 3d coordinates
* - method taken from editview.c - mouse_cursor()
*/
- ED_view3d_win_to_3d(ar, fp, mx, my, p3d);
+ ED_view3d_win_to_3d(ar, fp, mvalf, p3d);
}
}
Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c 2011-05-20 13:10:40 UTC (rev 36798)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c 2011-05-20 13:50:41 UTC (rev 36799)
@@ -253,6 +253,7 @@
else {
const int mx=mval[0], my=mval[1];
float rvec[3], dvec[3];
+ float mval_f[2];
/* Current method just converts each point in screen-coordinates to
* 3D-coordinates using the 3D-cursor as reference. In general, this
@@ -267,7 +268,10 @@
/* method taken from editview.c - mouse_cursor() */
project_int_noclip(p->ar, rvec, mval);
- ED_view3d_win_to_delta(p->ar, mval[0]-mx, mval[1]-my, dvec);
+
+ mval_f[0]= mval[0] - mx;
+ mval_f[0]= mval[1] - my;
+ ED_view3d_win_to_delta(p->ar, mval_f, dvec);
sub_v3_v3v3(out, rvec, dvec);
}
}
Modified: trunk/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_view3d.h 2011-05-20 13:10:40 UTC (rev 36798)
+++ trunk/blender/source/blender/editors/include/ED_view3d.h 2011-05-20 13:50:41 UTC (rev 36799)
@@ -85,33 +85,30 @@
* Calculate a 3d location from 2d window coordinates.
* @param ar The region (used for the window width and height).
* @param depth_pt The reference location used to calculate the Z depth.
- * @param mx The area relative X location (such as event->mval[0]).
- * @param my The area relative Y location (such as event->mval[1]).
+ * @param mval The area relative location (such as event->mval converted to floats).
* @param out The resulting world-space location.
*/
-void ED_view3d_win_to_3d(struct ARegion *ar, const float depth_pt[3], const float mx, const float my, float out[3]);
+void ED_view3d_win_to_3d(struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]);
/**
* Calculate a 3d difference vector from 2d window offset.
* note that initgrabz() must be called first to determine
* the depth used to calculate the delta.
* @param ar The region (used for the window width and height).
- * @param mx The area relative X difference (such as event->mval[0] - other_x).
- * @param my The area relative Y difference (such as event->mval[1] - other_y).
+ * @param mval The area relative 2d difference (such as event->mval[0] - other_x).
* @param out The resulting world-space delta.
*/
-void ED_view3d_win_to_delta(struct ARegion *ar, const float mx, const float my, float out[3]);
+void ED_view3d_win_to_delta(struct ARegion *ar, const float mval[2], float out[3]);
/**
* Calculate a 3d direction vector from 2d window coordinates.
* This direction vector starts and the view in the direction of the 2d window coordinates.
* In orthographic view all window coordinates yield the same vector.
* @param ar The region (used for the window width and height).
- * @param mx The area relative X difference (such as event->mval[0]).
- * @param my The area relative Y difference (such as event->mval[1]).
+ * @param mval The area relative 2d location (such as event->mval converted to floats).
* @param out The resulting normalized world-space direction vector.
*/
-void ED_view3d_win_to_vector(struct ARegion *ar, const float mx, const float my, float out[3]);
+void ED_view3d_win_to_vector(struct ARegion *ar, const float mval[2], float out[3]);
/**
* Calculate a 3d segment from 2d window coordinates.
Modified: trunk/blender/source/blender/editors/physics/particle_edit.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_edit.c 2011-05-20 13:10:40 UTC (rev 36798)
+++ trunk/blender/source/blender/editors/physics/particle_edit.c 2011-05-20 13:50:41 UTC (rev 36799)
@@ -3501,6 +3501,7 @@
switch(pset->brushtype) {
case PE_BRUSH_COMB:
{
+ float mval_f[2];
data.mval= mval;
data.rad= (float)brush->size;
@@ -3512,7 +3513,9 @@
invert_m4_m4(ob->imat, ob->obmat);
- ED_view3d_win_to_delta(ar, dx, dy, vec);
+ mval_f[0]= dx;
+ mval_f[1]= dy;
+ ED_view3d_win_to_delta(ar, mval_f, vec);
data.dvec= vec;
foreach_mouse_hit_key(&data, brush_comb, selected);
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c 2011-05-20 13:10:40 UTC (rev 36798)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c 2011-05-20 13:50:41 UTC (rev 36799)
@@ -58,12 +58,16 @@
{
Object *ob = vc->obact;
float delta[3], scale, loc[3];
+ float mval_f[2];
mul_v3_m4v3(loc, ob->obmat, center);
initgrabz(vc->rv3d, loc[0], loc[1], loc[2]);
- ED_view3d_win_to_delta(vc->ar, pixel_radius, 0, delta);
+ mval_f[0]= pixel_radius;
+ mval_f[1]= 0.0f;
+ ED_view3d_win_to_delta(vc->ar, mval_f, delta);
+
scale= fabsf(mat4_to_scale(ob->obmat));
scale= (scale == 0.0f)? 1.0f: scale;
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-05-20 13:10:40 UTC (rev 36798)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-05-20 13:50:41 UTC (rev 36799)
@@ -2994,7 +2994,7 @@
cache->orig_grab_location[1],
cache->orig_grab_location[2]);
- ED_view3d_win_to_delta(cache->vc->ar, cache->mouse[0], cache->mouse[1], grab_location);
+ ED_view3d_win_to_delta(cache->vc->ar, cache->mouse, grab_location);
/* compute delta to move verts by */
if(!cache->first_time) {
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c 2011-05-20 13:10:40 UTC (rev 36798)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c 2011-05-20 13:50:41 UTC (rev 36799)
@@ -1407,10 +1407,11 @@
}
else {
float sco[2];
+ const float mval_f[2]= {1.0f, 0.0f};
/* calc window coord */
initgrabz(rv3d, 0.0, 0.0, 0.0);
- ED_view3d_win_to_delta(ar, 1, 0, vec);
+ ED_view3d_win_to_delta(ar, mval_f, vec);
fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) );
fac= 1.0f/fac;
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-20 13:10:40 UTC (rev 36798)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-20 13:50:41 UTC (rev 36799)
@@ -418,8 +418,12 @@
}
}
- /* for dolly */
- ED_view3d_win_to_vector(vod->ar, event->mval[0], event->mval[1], vod->mousevec);
+ {
+ /* for dolly */
+ float mval_f[2];
+ VECCOPY2D(mval_f, event->mval);
+ ED_view3d_win_to_vector(vod->ar, mval_f, vod->mousevec);
+ }
/* lookup, we dont pass on v3d to prevent confusement */
vod->grid= vod->v3d->grid;
@@ -928,8 +932,12 @@
}
else {
float dvec[3];
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list