style cleanup: view3d

This commit is contained in:
Campbell Barton 2012-05-08 15:55:29 +00:00
parent facc976371
commit 80a766cbd0
8 changed files with 45 additions and 44 deletions

@ -1027,7 +1027,7 @@ void draw_mesh_paint(RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_f
glEnable(GL_COLOR_MATERIAL); glEnable(GL_COLOR_MATERIAL);
dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me, dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me,
DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
glDisable(GL_COLOR_MATERIAL); glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
@ -1035,13 +1035,14 @@ void draw_mesh_paint(RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_f
GPU_disable_material(); GPU_disable_material();
} }
else if (ob->mode & OB_MODE_VERTEX_PAINT) { else if (ob->mode & OB_MODE_VERTEX_PAINT) {
if (me->mloopcol) if (me->mloopcol) {
dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me, dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me,
DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
}
else { else {
glColor3f(1.0f, 1.0f, 1.0f); glColor3f(1.0f, 1.0f, 1.0f);
dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me, dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me,
DM_DRAW_ALWAYS_SMOOTH); DM_DRAW_ALWAYS_SMOOTH);
} }
} }

@ -1763,7 +1763,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
scale[2] = 1.0f / len_v3(ob->obmat[2]); scale[2] = 1.0f / len_v3(ob->obmat[2]);
BKE_camera_view_frame_ex(scene, cam, cam->drawsize, is_view, scale, BKE_camera_view_frame_ex(scene, cam, cam->drawsize, is_view, scale,
asp, shift, &drawsize, vec); asp, shift, &drawsize, vec);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
@ -2209,9 +2209,9 @@ void mesh_foreachScreenFace(
} }
void nurbs_foreachScreenVert( void nurbs_foreachScreenVert(
ViewContext *vc, ViewContext *vc,
void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y), void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y),
void *userData) void *userData)
{ {
Curve *cu = vc->obedit->data; Curve *cu = vc->obedit->data;
short s[2] = {IS_CLIPPED, 0}; short s[2] = {IS_CLIPPED, 0};
@ -2905,7 +2905,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
mul_v3_fl(vmid, 1.0f / (float)n); \ mul_v3_fl(vmid, 1.0f / (float)n); \
if (unit->system) \ if (unit->system) \
bUnit_AsString(numstr, sizeof(numstr), \ bUnit_AsString(numstr, sizeof(numstr), \
(double)(area * unit->scale_length), \ (double)(area * unit->scale_length), \
3, unit->system, B_UNIT_LENGTH, do_split, FALSE); \ 3, unit->system, B_UNIT_LENGTH, do_split, FALSE); \
else \ else \
BLI_snprintf(numstr, sizeof(numstr), conv_float, area); \ BLI_snprintf(numstr, sizeof(numstr), conv_float, area); \

@ -83,8 +83,8 @@
/* ******************* view3d space & buttons ************** */ /* ******************* view3d space & buttons ************** */
#define B_NOP 1 #define B_NOP 1
#define B_REDR 2 #define B_REDR 2
#define B_OBJECTPANELMEDIAN 1008 #define B_OBJECTPANELMEDIAN 1008
/* temporary struct for storing transform properties */ /* temporary struct for storing transform properties */
@ -595,7 +595,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
} }
else { else {
bp->weight = scale_w > 0.0f ? bp->weight * scale_w : bp->weight = scale_w > 0.0f ? bp->weight * scale_w :
1.0f + ((1.0f - bp->weight) * scale_w); 1.0f + ((1.0f - bp->weight) * scale_w);
CLAMP(bp->weight, 0.0f, 1.0f); CLAMP(bp->weight, 0.0f, 1.0f);
} }
} }

@ -102,7 +102,7 @@ static void star_stuff_init_func(void)
glPointSize(1.0); glPointSize(1.0);
glBegin(GL_POINTS); glBegin(GL_POINTS);
} }
static void star_stuff_vertex_func(float*i) static void star_stuff_vertex_func(float *i)
{ {
glVertex3fv(i); glVertex3fv(i);
} }
@ -716,7 +716,7 @@ static void draw_rotation_guide(RegionView3D *rv3d)
glColor4fv(color); glColor4fv(color);
glBegin(GL_LINE_LOOP); glBegin(GL_LINE_LOOP);
for (i = 0, angle = 0.f; i < ROT_AXIS_DETAIL; ++i, angle += step) { for (i = 0, angle = 0.f; i < ROT_AXIS_DETAIL; ++i, angle += step) {
float p[3] = {s * cosf(angle), s * sinf(angle), 0.0f}; float p[3] = {s *cosf(angle), s * sinf(angle), 0.0f};
if (!upright) { if (!upright) {
mul_qt_v3(q, p); mul_qt_v3(q, p);
@ -1699,7 +1699,7 @@ static void draw_bgpics(Scene *scene, ARegion *ar, View3D *v3d, int foreground)
} }
} }
else { else {
draw_bgpic(scene, ar, v3d, foreground); draw_bgpic(scene, ar, v3d, foreground);
} }
} }
@ -1861,7 +1861,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
* offset feature (used in group-duplicate.blend but no longer works in 2.5) * offset feature (used in group-duplicate.blend but no longer works in 2.5)
* so for now it should be ok to - campbell */ * so for now it should be ok to - campbell */
if (/* if this is the last no need to make a displist */ if ( /* if this is the last no need to make a displist */
(dob_next == NULL || dob_next->ob != dob->ob) || (dob_next == NULL || dob_next->ob != dob->ob) ||
/* lamp drawing messes with matrices, could be handled smarter... but this works */ /* lamp drawing messes with matrices, could be handled smarter... but this works */
(dob->ob->type == OB_LAMP) || (dob->ob->type == OB_LAMP) ||
@ -2556,7 +2556,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
/* transp and X-ray afterdraw stuff */ /* transp and X-ray afterdraw stuff */
if (v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d); if (v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
if (v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used! if (v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); /* clears zbuffer if it is used! */
if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1); if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
if (rv3d->rflag & RV3D_CLIPPING) if (rv3d->rflag & RV3D_CLIPPING)

@ -986,12 +986,12 @@ void VIEW3D_OT_rotate(wmOperatorType *ot)
/* NDOF utility functions /* NDOF utility functions
* (should these functions live in this file?) * (should these functions live in this file?)
*/ */
float ndof_to_axis_angle(struct wmNDOFMotionData*ndof, float axis[3]) float ndof_to_axis_angle(struct wmNDOFMotionData *ndof, float axis[3])
{ {
return ndof->dt * normalize_v3_v3(axis, ndof->rvec); return ndof->dt * normalize_v3_v3(axis, ndof->rvec);
} }
void ndof_to_quat(struct wmNDOFMotionData*ndof, float q[4]) void ndof_to_quat(struct wmNDOFMotionData *ndof, float q[4])
{ {
float axis[3]; float axis[3];
float angle; float angle;
@ -1010,8 +1010,8 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
else { else {
View3D *v3d = CTX_wm_view3d(C); View3D *v3d = CTX_wm_view3d(C);
RegionView3D*rv3d = CTX_wm_region_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C);
wmNDOFMotionData*ndof = (wmNDOFMotionData *) event->customdata; wmNDOFMotionData *ndof = (wmNDOFMotionData *) event->customdata;
ED_view3d_camera_lock_init(v3d, rv3d); ED_view3d_camera_lock_init(v3d, rv3d);
@ -1162,8 +1162,8 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
else { else {
View3D *v3d = CTX_wm_view3d(C); View3D *v3d = CTX_wm_view3d(C);
RegionView3D*rv3d = CTX_wm_region_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C);
wmNDOFMotionData*ndof = (wmNDOFMotionData *) event->customdata; wmNDOFMotionData *ndof = (wmNDOFMotionData *) event->customdata;
ED_view3d_camera_lock_init(v3d, rv3d); ED_view3d_camera_lock_init(v3d, rv3d);
@ -2239,7 +2239,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
size = v3d->near * 1.5f; size = v3d->near * 1.5f;
} }
} }
else /* ortho */ { else { /* ortho */
if (size < 0.0001f) { if (size < 0.0001f) {
/* bounding box was a single point so do not zoom */ /* bounding box was a single point so do not zoom */
ok_dist = 0; ok_dist = 0;

@ -174,7 +174,7 @@ typedef struct FlyInfo {
unsigned char use_freelook; unsigned char use_freelook;
int mval[2]; /* latest 2D mouse values */ int mval[2]; /* latest 2D mouse values */
wmNDOFMotionData*ndof; /* latest 3D mouse values */ wmNDOFMotionData *ndof; /* latest 3D mouse values */
/* fly state state */ /* fly state state */
float speed; /* the speed the view is moving per redraw */ float speed; /* the speed the view is moving per redraw */
@ -690,7 +690,7 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien
{ {
/* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */ /* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */
View3D*v3d = fly->v3d; View3D *v3d = fly->v3d;
Scene *scene = fly->scene; Scene *scene = fly->scene;
ID *id_key; ID *id_key;
@ -1031,7 +1031,7 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
/* shorthand for oft-used variables */ /* shorthand for oft-used variables */
wmNDOFMotionData *ndof = fly->ndof; wmNDOFMotionData *ndof = fly->ndof;
const float dt = ndof->dt; const float dt = ndof->dt;
RegionView3D*rv3d = fly->rv3d; RegionView3D *rv3d = fly->rv3d;
const int flag = U.ndof_flag; const int flag = U.ndof_flag;
#if 0 #if 0

@ -53,9 +53,9 @@ struct wmWindowManager;
#define BL_NEAR_CLIP 0.001 #define BL_NEAR_CLIP 0.001
/* drawing flags: */ /* drawing flags: */
#define DRAW_PICKING 1 #define DRAW_PICKING 1
#define DRAW_CONSTCOLOR 2 #define DRAW_CONSTCOLOR 2
#define DRAW_SCENESET 4 #define DRAW_SCENESET 4
/* draw_mesh_fancy/draw_mesh_textured draw_flags */ /* draw_mesh_fancy/draw_mesh_textured draw_flags */
#define DRAW_MODIFIERS_PREVIEW 1 #define DRAW_MODIFIERS_PREVIEW 1
@ -95,8 +95,8 @@ void VIEW3D_OT_render_border(struct wmOperatorType *ot);
void VIEW3D_OT_zoom_border(struct wmOperatorType *ot); void VIEW3D_OT_zoom_border(struct wmOperatorType *ot);
void view3d_boxview_copy(ScrArea *sa, ARegion *ar); void view3d_boxview_copy(ScrArea *sa, ARegion *ar);
void ndof_to_quat(struct wmNDOFMotionData* ndof, float q[4]); void ndof_to_quat(struct wmNDOFMotionData *ndof, float q[4]);
float ndof_to_axis_angle(struct wmNDOFMotionData* ndof, float axis[3]); float ndof_to_axis_angle(struct wmNDOFMotionData *ndof, float axis[3]);
/* view3d_fly.c */ /* view3d_fly.c */
void view3d_keymap(struct wmKeyConfig *keyconf); void view3d_keymap(struct wmKeyConfig *keyconf);
@ -105,8 +105,8 @@ void VIEW3D_OT_fly(struct wmOperatorType *ot);
/* drawanim.c */ /* drawanim.c */
void draw_motion_paths_init(View3D *v3d, struct ARegion *ar); void draw_motion_paths_init(View3D *v3d, struct ARegion *ar);
void draw_motion_path_instance(Scene *scene, void draw_motion_path_instance(Scene *scene,
struct Object *ob, struct bPoseChannel *pchan, struct Object *ob, struct bPoseChannel *pchan,
struct bAnimVizSettings *avs, struct bMotionPath *mpath); struct bAnimVizSettings *avs, struct bMotionPath *mpath);
void draw_motion_paths_cleanup(View3D *v3d); void draw_motion_paths_cleanup(View3D *v3d);
@ -120,12 +120,12 @@ void drawaxes(float size, char drawtype);
void view3d_cached_text_draw_begin(void); void view3d_cached_text_draw_begin(void);
void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4]); void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4]);
void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, float mat[][4]); void view3d_cached_text_draw_end(View3D * v3d, ARegion * ar, int depth_write, float mat[][4]);
#define V3D_CACHE_TEXT_ZBUF (1<<0) #define V3D_CACHE_TEXT_ZBUF (1 << 0)
#define V3D_CACHE_TEXT_WORLDSPACE (1<<1) #define V3D_CACHE_TEXT_WORLDSPACE (1 << 1)
#define V3D_CACHE_TEXT_ASCII (1<<2) #define V3D_CACHE_TEXT_ASCII (1 << 2)
#define V3D_CACHE_TEXT_GLOBALSPACE (1<<3) #define V3D_CACHE_TEXT_GLOBALSPACE (1 << 3)
#define V3D_CACHE_TEXT_LOCALCLIP (1<<4) #define V3D_CACHE_TEXT_LOCALCLIP (1 << 4)
/* drawarmature.c */ /* drawarmature.c */
int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline); int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline);
@ -136,7 +136,7 @@ void draw_mesh_paint(RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *
/* view3d_draw.c */ /* view3d_draw.c */
void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar); void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar);
void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (* func)(void *)); void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (*func)(void *));
void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d); void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
void add_view3d_after(ListBase *lb, Base *base, int flag); void add_view3d_after(ListBase *lb, Base *base, int flag);
@ -160,12 +160,12 @@ void VIEW3D_OT_localview(struct wmOperatorType *ot);
void VIEW3D_OT_game_start(struct wmOperatorType *ot); void VIEW3D_OT_game_start(struct wmOperatorType *ot);
int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb); int ED_view3d_boundbox_clip(RegionView3D * rv3d, float obmat[][4], struct BoundBox *bb);
void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *,
float *ofs, float *quat, float *dist, float *lens); float *ofs, float *quat, float *dist, float *lens);
void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); /* rect: for picking */ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); /* rect: for picking */
void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d); void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);
void fly_modal_keymap(struct wmKeyConfig *keyconf); void fly_modal_keymap(struct wmKeyConfig *keyconf);

@ -2055,7 +2055,7 @@ static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], un
/* gets called via generic mouse select operator */ /* gets called via generic mouse select operator */
static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], short extend, Object *obact) static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], short extend, Object *obact)
{ {
Mesh*me = obact->data; /* already checked for NULL */ Mesh *me = obact->data; /* already checked for NULL */
unsigned int index = 0; unsigned int index = 0;
MVert *mv; MVert *mv;