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>2012-09-07 03:41:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-07 03:41:03 +0400
commit0ecbc047e8a540175b00ed967050abb5f7363dbc (patch)
treefdf8a8011f919fb606b07d357a3be8b9606bf592
parent774cc0ab1663a5d31eeda797ac71c5143086ca98 (diff)
code cleanup
-rw-r--r--source/blender/editors/mesh/editmesh_bvh.c8
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c6
-rw-r--r--source/blender/editors/physics/particle_edit.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c3
-rw-r--r--source/blender/editors/transform/transform.c4
10 files changed, 26 insertions, 30 deletions
diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c
index 549032f7286..c7e0077bc02 100644
--- a/source/blender/editors/mesh/editmesh_bvh.c
+++ b/source/blender/editors/mesh/editmesh_bvh.c
@@ -394,15 +394,15 @@ int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v3d, Obje
float co1[3], co2[3], co3[3], dir1[4], dir2[4], dir3[4];
float origin[3], invmat[4][4];
float epsilon = 0.01f;
- float mval_f[2], end[3];
+ float end[3];
+ const float mval_f[2] = {ar->winx / 2.0f,
+ ar->winy / 2.0f};
if (!ar) {
printf("error in BMBVH_EdgeVisible!\n");
return 0;
}
-
- mval_f[0] = ar->winx / 2.0f;
- mval_f[1] = ar->winy / 2.0f;
+
ED_view3d_win_to_segment_clip(ar, v3d, mval_f, origin, end);
invert_m4_m4(invmat, obedit->obmat);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 92cc3366b3e..546b28bfb25 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -751,10 +751,8 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent
float nor[3] = {0.0, 0.0, 0.0};
/* 2D normal calc */
- float mval_f[2];
-
- mval_f[0] = (float)event->mval[0];
- mval_f[1] = (float)event->mval[1];
+ const float mval_f[2] = {(float)event->mval[0],
+ (float)event->mval[1]};
/* check for edges that are half selected, use for rotation */
done = FALSE;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 72d2d67e081..3ed31abca94 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3540,7 +3540,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
switch (pset->brushtype) {
case PE_BRUSH_COMB:
{
- float mval_f[2];
+ const float mval_f[2] = {dx, dy};
data.mval= mval;
data.rad= (float)brush->size;
@@ -3552,8 +3552,6 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
invert_m4_m4(ob->imat, ob->obmat);
- mval_f[0]= dx;
- mval_f[1]= dy;
ED_view3d_win_to_delta(ar, mval_f, vec);
data.dvec= vec;
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 99bc192042c..df64e1c9d90 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -159,14 +159,12 @@ float paint_calc_object_space_radius(ViewContext *vc, const float center[3],
{
Object *ob = vc->obact;
float delta[3], scale, loc[3];
- float mval_f[2];
+ const float mval_f[2] = {pixel_radius, 0.0f};
mul_v3_m4v3(loc, ob->obmat, center);
initgrabz(vc->rv3d, loc[0], loc[1], loc[2]);
- 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));
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index bf948bf9dd8..ca086544c0c 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1027,14 +1027,12 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
Scene *scene = vc.scene;
ToolSettings *ts = vc.scene->toolsettings;
Brush *brush = paint_brush(&ts->wpaint->paint);
- float mval_f[2];
+ const float mval_f[2] = {(float)event->mval[0],
+ (float)event->mval[1]};
int v_idx_best = -1;
int fidx;
float len_best = FLT_MAX;
- mval_f[0] = (float)event->mval[0];
- mval_f[1] = (float)event->mval[1];
-
fidx = mp->totloop - 1;
do {
float co[3], sco[3], len;
@@ -1098,10 +1096,12 @@ static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA
if (me && me->dvert && vc.v3d && vc.rv3d) {
int index;
+ int mval[2] = {win->eventstate->x - vc.ar->winrct.xmin,
+ win->eventstate->y - vc.ar->winrct.ymin};
view3d_operator_needs_opengl(C);
- index = view3d_sample_backbuf(&vc, win->eventstate->x - vc.ar->winrct.xmin, win->eventstate->y - vc.ar->winrct.ymin);
+ index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
if (index && index <= me->totpoly) {
const int defbase_tot = BLI_countlist(&vc.obact->defbase);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 39b92645166..8a334423ab0 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1389,14 +1389,17 @@ unsigned int view3d_sample_backbuf(ViewContext *vc, int x, int y)
{
unsigned int col;
- if (x >= vc->ar->winx || y >= vc->ar->winy) return 0;
+ if (x >= vc->ar->winx || y >= vc->ar->winy) {
+ return 0;
+ }
+
x += vc->ar->winrct.xmin;
y += vc->ar->winrct.ymin;
view3d_validate_backbuf(vc);
- glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
- glReadBuffer(GL_BACK);
+ glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
+ glReadBuffer(GL_BACK);
if (ENDIAN_ORDER == B_ENDIAN) {
BLI_endian_switch_uint32(&col);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 5169d823bd8..17f1081f5c4 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -475,8 +475,8 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
{
/* for dolly */
- float mval_f[2];
- VECCOPY2D(mval_f, event->mval);
+ const float mval_f[2] = {(float)event->mval[0],
+ (float)event->mval[1]};
ED_view3d_win_to_vector(vod->ar, mval_f, vod->mousevec);
}
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index d8e394ab68c..df0908e445e 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -119,8 +119,8 @@ int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int m
initgrabz(vc->rv3d, fp[0], fp[1], fp[2]);
if (mval_cpy[0] != IS_CLIPPED) {
- float mval_f[2];
- VECSUB2D(mval_f, mval_cpy, mval);
+ const float mval_f[2] = {(float)(mval_cpy[0] - mval[0]),
+ (float)(mval_cpy[1] - mval[1])};
ED_view3d_win_to_delta(vc->ar, mval_f, dvec);
sub_v3_v3(fp, dvec);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index fbbf23beca4..1d40ae280b7 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -87,8 +87,9 @@ void view3d_operator_needs_opengl(const bContext *C)
void view3d_region_operator_needs_opengl(wmWindow *win, ARegion *ar)
{
/* for debugging purpose, context should always be OK */
- if ((ar == NULL) || (ar->regiontype != RGN_TYPE_WINDOW))
+ if ((ar == NULL) || (ar->regiontype != RGN_TYPE_WINDOW)) {
printf("view3d_region_operator_needs_opengl error, wrong region\n");
+ }
else {
RegionView3D *rv3d = ar->regiondata;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index fa7964b31ca..68cc1c8e9b6 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -164,9 +164,7 @@ static void convertViewVec2D_mask(View2D *v2d, float r_vec[3], int dx, int dy)
void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
{
if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) {
- float mval_f[2];
- mval_f[0] = dx;
- mval_f[1] = dy;
+ const float mval_f[2] = {(float)dx, (float)dy};
ED_view3d_win_to_delta(t->ar, mval_f, r_vec);
}
else if (t->spacetype == SPACE_IMAGE) {