Code cleanup: style

This commit is contained in:
Campbell Barton 2014-03-24 12:59:36 +11:00
parent 25b4b5fb9f
commit 551d1a1ed5
9 changed files with 53 additions and 45 deletions

View File

@ -181,12 +181,14 @@ bool ray_face_intersection(const float ray_start[3], const float ray_normal[3],
void pbvh_update_BB_redraw(PBVH *bvh, PBVHNode **nodes, int totnode, int flag);
/* pbvh_bmesh.c */
int pbvh_bmesh_node_raycast(PBVHNode *node, const float ray_start[3],
const float ray_normal[3], float *dist,
int use_original);
int pbvh_bmesh_node_raycast(
PBVHNode *node, const float ray_start[3],
const float ray_normal[3], float *dist,
int use_original);
int pbvh_bmesh_node_raycast_detail(PBVHNode *node, const float ray_start[3],
const float ray_normal[3], float *detail, float *dist);
int pbvh_bmesh_node_raycast_detail(
PBVHNode *node, const float ray_start[3],
const float ray_normal[3], float *detail, float *dist);
void pbvh_bmesh_normals_update(PBVHNode **nodes, int totnode);

View File

@ -227,7 +227,7 @@ float ExpoEaseInOut(float time, float begin, float change, float duration)
if (time == duration)
return begin + change;
if ((time /= duration / 2) < 1)
return change/2 * pow(2, 10 * (time - 1)) + begin;
return change / 2 * pow(2, 10 * (time - 1)) + begin;
--time;
return change / 2 * (-pow(2, -10 * time) + 2) + begin;
}
@ -275,7 +275,7 @@ float QuartEaseInOut(float time, float begin, float change, float duration)
if ((time /= duration / 2) < 1)
return change / 2 * time * time * time * time + begin;
time -= 2;
return -change/2 * ( time * time * time * time - 2) + begin;
return -change / 2 * ( time * time * time * time - 2) + begin;
}
float QuintEaseIn(float time, float begin, float change, float duration)
@ -291,7 +291,7 @@ float QuintEaseOut(float time, float begin, float change, float duration)
float QuintEaseInOut(float time, float begin, float change, float duration)
{
if ((time /= duration / 2) < 1)
return change/2 * time * time * time * time * time + begin;
return change / 2 * time * time * time * time * time + begin;
time -= 2;
return change / 2 * (time * time * time * time * time + 2) + begin;
}

View File

@ -988,7 +988,7 @@ static short set_bezt_quint(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
static short set_bezt_sine(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->ipo= BEZT_IPO_SINE;
bezt->ipo = BEZT_IPO_SINE;
return 0;
}

View File

@ -2081,7 +2081,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
* lock the value of the color wheel to 1.
* Useful for color correction tools where you're only interested in hue. */
if (but->flag & UI_BUT_COLOR_LOCK) {
if(U.color_picker_type == USER_CP_CIRCLE_HSV)
if (U.color_picker_type == USER_CP_CIRCLE_HSV)
hsv[2] = 1.f;
else
hsv[2] = 0.5f;

View File

@ -126,8 +126,9 @@ typedef struct VertProjData {
/* paint_vertex_proj.c */
struct VertProjHandle;
struct VertProjHandle *ED_vpaint_proj_handle_create(struct Scene *scene, struct Object *ob,
VertProjData **r_vcosnos);
struct VertProjHandle *ED_vpaint_proj_handle_create(
struct Scene *scene, struct Object *ob,
VertProjData **r_vcosnos);
void ED_vpaint_proj_handle_update(
struct VertProjHandle *vp_handle,
/* runtime vars */

View File

@ -910,8 +910,9 @@ static int sample_backbuf_area(ViewContext *vc, int *indexar, int totface, int x
}
/* whats _dl mean? */
static float calc_vp_strength_col_dl(VPaint *vp, ViewContext *vc, const VertProjData *data, const int index,
const float brush_size_pressure, float rgba[4])
static float calc_vp_strength_col_dl(
VPaint *vp, ViewContext *vc, const VertProjData *data, const int index,
const float brush_size_pressure, float rgba[4])
{
float dist_sq = data->dists_sq[index];
if (dist_sq <= brush_size_pressure * brush_size_pressure) {
@ -939,10 +940,11 @@ static float calc_vp_strength_col_dl(VPaint *vp, ViewContext *vc, const VertProj
return 0.0f;
}
static float calc_vp_alpha_col_dl(VPaint *vp, ViewContext *vc,
float vpimat[3][3], const VertProjData *data,
const int index,
const float brush_size_pressure, const float brush_alpha_pressure, float rgba[4])
static float calc_vp_alpha_col_dl(
VPaint *vp, ViewContext *vc,
float vpimat[3][3], const VertProjData *data,
const int index,
const float brush_size_pressure, const float brush_alpha_pressure, float rgba[4])
{
float strength = calc_vp_strength_col_dl(vp, vc, data, index, brush_size_pressure, rgba);
@ -2842,7 +2844,7 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f
}
static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Mesh *me, const unsigned int index,
const float brush_size_pressure, const float brush_alpha_pressure)
const float brush_size_pressure, const float brush_alpha_pressure)
{
ViewContext *vc = &vpd->vc;
Brush *brush = BKE_paint_brush(&vp->paint);
@ -2892,8 +2894,8 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Mesh *me, const unsig
float rgba[4];
unsigned int paintcol;
alpha = calc_vp_alpha_col_dl(vp, vc, vpd->vpimat,
vpd->data, ml->v,
brush_size_pressure, brush_alpha_pressure, rgba);
vpd->data, ml->v,
brush_size_pressure, brush_alpha_pressure, rgba);
if (vpd->is_texbrush) {
float rgba_br[3];

View File

@ -124,8 +124,9 @@ static void vpaint_proj_dm_map_cosnos_init(Scene *scene, Object *ob,
/* Same as init but take mouse location into account */
static void vpaint_proj_dm_map_cosnos_update__map_cb(void *userData, int index, const float co[3],
const float no_f[3], const short no_s[3])
static void vpaint_proj_dm_map_cosnos_update__map_cb(
void *userData, int index, const float co[3],
const float no_f[3], const short no_s[3])
{
struct VertProjUpdate *vp_update = userData;
@ -136,8 +137,8 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb(void *userData, int index,
float co_ss[2]; /* screenspace */
if (ED_view3d_project_float_object(vp_update->ar,
co, co_ss,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
co, co_ss,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
const float dist_sq = len_squared_v2v2(vp_update->mval_fl, co_ss);
if (dist_sq > data->dists_sq[index]) {
@ -158,8 +159,9 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb(void *userData, int index,
}
}
static void vpaint_proj_dm_map_cosnos_update(struct VertProjHandle *vp_handle,
ARegion *ar, const float mval_fl[2])
static void vpaint_proj_dm_map_cosnos_update(
struct VertProjHandle *vp_handle,
ARegion *ar, const float mval_fl[2])
{
struct VertProjUpdate vp_update = {vp_handle, ar, mval_fl};
@ -187,8 +189,9 @@ static void vpaint_proj_dm_map_cosnos_update(struct VertProjHandle *vp_handle,
/* -------------------------------------------------------------------- */
/* Public Functions */
struct VertProjHandle *ED_vpaint_proj_handle_create(Scene *scene, Object *ob,
VertProjData **r_vcosnos)
struct VertProjHandle *ED_vpaint_proj_handle_create(
Scene *scene, Object *ob,
VertProjData **r_vcosnos)
{
struct VertProjHandle *vp_handle = MEM_mallocN(sizeof(struct VertProjHandle), __func__);
Mesh *me = ob->data;

View File

@ -115,7 +115,7 @@ int system_physical_thread_count(void)
size_t pcount_len;
sysctlbyname("hw.physicalcpu", &pcount, &pcount_len, NULL, 0);
return pcount;
}
}
#endif // __APPLE__
void ED_sculpt_get_average_stroke(Object *ob, float stroke[3])
@ -3793,7 +3793,7 @@ static void sculpt_omp_start(Sculpt *sd, SculptSession *ss)
cache->num_threads = omp_get_num_procs();
#endif
}
else {
else {
cache->num_threads = 1;
}
omp_set_num_threads(cache->num_threads);
@ -4301,7 +4301,8 @@ static void sculpt_raycast_detail_cb(PBVHNode *node, void *data_v, float *tmin)
if (BKE_pbvh_node_get_tmin(node) < *tmin) {
SculptDetailRaycastData *srd = data_v;
if (BKE_pbvh_bmesh_node_raycast_detail(node, srd->ray_start, srd->ray_normal,
&srd->detail, &srd->dist)) {
&srd->detail, &srd->dist))
{
srd->hit = 1;
*tmin = srd->dist;
}
@ -5262,8 +5263,7 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *UNUSED(op))
size = max_fff(bb_max[0], bb_max[1], bb_max[2]);
/* update topology size */
BKE_pbvh_bmesh_detail_size_set(ss->pbvh,
sd->constant_detail/ 100.0f);
BKE_pbvh_bmesh_detail_size_set(ss->pbvh, sd->constant_detail / 100.0f);
sculpt_undo_push_begin("Dynamic topology flood fill");
sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_COORDS);
@ -5342,10 +5342,9 @@ static void sample_detail(bContext *C, int ss_co[2])
srd.detail = sd->constant_detail;
BKE_pbvh_raycast(ob->sculpt->pbvh, sculpt_raycast_detail_cb, &srd,
ray_start, ray_normal, false);
ray_start, ray_normal, false);
if (srd.hit)
{
if (srd.hit) {
sd->constant_detail = srd.detail * 100.0f;
}
}
@ -5359,7 +5358,8 @@ static int sculpt_sample_detail_size_exec(bContext *C, wmOperator *op)
}
static int sculpt_sample_detail_size_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e)) {
static int sculpt_sample_detail_size_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e))
{
ScrArea *sa = CTX_wm_area(C);
ED_area_headerprint(sa, "Click on the mesh to set the detail");
WM_cursor_modal_set(CTX_wm_window(C), BC_EYEDROPPER_CURSOR);
@ -5367,8 +5367,8 @@ static int sculpt_sample_detail_size_invoke(bContext *C, wmOperator *op, const w
return OPERATOR_RUNNING_MODAL;
}
static int sculpt_sample_detail_size_modal(bContext *C, wmOperator *op, const wmEvent *e) {
static int sculpt_sample_detail_size_modal(bContext *C, wmOperator *op, const wmEvent *e)
{
switch (e->type) {
case LEFTMOUSE:
if (e->val == KM_PRESS) {

View File

@ -1666,23 +1666,23 @@ static void rna_def_fkeyframe(BlenderRNA *brna)
RNA_def_property_enum_items(prop, beztriple_interpolation_easing_items);
RNA_def_property_ui_text(prop, "Easing",
"Which ends of the segment between this and the next keyframe easing "
"interpolation is applied to");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
"interpolation is applied to");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "back");
RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "amplitude");
RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of bounces for elastic easing");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "period");
RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
/* Vector values */
prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */