Cleanup: style

This commit is contained in:
2018-10-01 08:42:26 +10:00
parent 3cd98d9ef7
commit 8ee4fd0bdf
14 changed files with 116 additions and 119 deletions

View File

@@ -2080,7 +2080,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Shrinkwrap) {
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*)md;
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
if (smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE) {
smd->shrinkMode = MOD_SHRINKWRAP_ABOVE_SURFACE;
smd->shrinkOpts &= ~MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE;

View File

@@ -881,8 +881,8 @@ static void gpencil_draw_strokes(
/* edit points (only in edit mode and not play animation not render) */
if ((draw_ctx->obact == ob) && (src_gps) &&
(!playing) && (!is_render) && (!cache_ob->is_dup_ob)
&& ((gpl->flag & GP_LAYER_LOCKED) == 0))
(!playing) && (!is_render) && (!cache_ob->is_dup_ob) &&
((gpl->flag & GP_LAYER_LOCKED) == 0))
{
if (!stl->g_data->shgrps_edit_line) {
stl->g_data->shgrps_edit_line = DRW_shgroup_create(e_data->gpencil_line_sh, psl->edit_pass);
@@ -970,9 +970,9 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
stl->storage->unit_matrix);
if ((gpd->runtime.sbuffer_size >= 3) &&
(gpd->runtime.sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) &&
(gpd->runtime.sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) &&
((gpd->runtime.sbuffer_sflag & GP_STROKE_NOFILL) == 0) &&
((brush->gpencil_settings->flag & GP_BRUSH_DISSABLE_LASSO) == 0))
((brush->gpencil_settings->flag & GP_BRUSH_DISSABLE_LASSO) == 0))
{
/* if not solid, fill is simulated with solid color */
if (gpd->runtime.bfill_style > 0) {

View File

@@ -52,7 +52,7 @@ struct GPUTexture *globals_weight_ramp = NULL;
static bool weight_ramp_custom = false;
static ColorBand weight_ramp_copy;
static struct GPUTexture* DRW_create_weight_colorramp_texture(void);
static struct GPUTexture *DRW_create_weight_colorramp_texture(void);
void DRW_globals_update(void)
{
@@ -187,7 +187,8 @@ void DRW_globals_update(void)
bool user_weight_ramp = (U.flag & USER_CUSTOM_RANGE) != 0;
if (weight_ramp_custom != user_weight_ramp ||
(user_weight_ramp && memcmp(&weight_ramp_copy, &U.coba_weight, sizeof(ColorBand)) != 0)) {
(user_weight_ramp && memcmp(&weight_ramp_copy, &U.coba_weight, sizeof(ColorBand)) != 0))
{
DRW_TEXTURE_FREE_SAFE(globals_weight_ramp);
}
@@ -950,8 +951,7 @@ bool DRW_object_axis_orthogonal_to_view(Object *ob, int axis)
static void DRW_evaluate_weight_to_color(float *result, float weight)
{
if (U.flag & USER_CUSTOM_RANGE)
{
if (U.flag & USER_CUSTOM_RANGE) {
BKE_colorband_evaluate(&U.coba_weight, weight, result);
}
else {
@@ -964,18 +964,18 @@ static void DRW_evaluate_weight_to_color(float *result, float weight)
hsv_to_rgb_v(hsv, result);
for (int i = 0; i < 3; i++) {
result[i] = pow(result[i], 1.0f/gamma);
result[i] = pow(result[i], 1.0f / gamma);
}
}
}
static GPUTexture* DRW_create_weight_colorramp_texture(void)
static GPUTexture *DRW_create_weight_colorramp_texture(void)
{
char error[256];
float pixels[256 * 4];
for (int i = 0 ; i < 256 ; i ++) {
DRW_evaluate_weight_to_color(&pixels[i*4], i / 255.0f);
pixels[i*4 + 3] = 1.0f;
pixels[(i * 4) + 3] = 1.0f;
}
return GPU_texture_create_1D(256, GPU_RGBA8, pixels, error);

View File

@@ -1486,13 +1486,13 @@ static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op))
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
/* break connections for unseen bones */
if (((arm->layer & ebone->layer) &&
((ED_armature_ebone_selectflag_get(ebone) & (BONE_TIPSEL | BONE_SELECTED)))) == 0)
((ED_armature_ebone_selectflag_get(ebone) & (BONE_TIPSEL | BONE_SELECTED)))) == 0)
{
ebone->temp.ebone = NULL;
}
if (((arm->layer & ebone->layer) &&
((ED_armature_ebone_selectflag_get(ebone) & (BONE_ROOTSEL | BONE_SELECTED)))) == 0)
((ED_armature_ebone_selectflag_get(ebone) & (BONE_ROOTSEL | BONE_SELECTED)))) == 0)
{
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
ebone->parent->temp.ebone = NULL;
@@ -1504,7 +1504,7 @@ static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op))
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
if (ebone->parent &&
(ebone->parent->temp.ebone == ebone))
(ebone->parent->temp.ebone == ebone))
{
ebone->flag |= BONE_DONE;
}
@@ -1528,8 +1528,8 @@ static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op))
if (changed) {
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
if (ebone->parent &&
ebone->parent->temp.ebone &&
(ebone->flag & BONE_CONNECTED))
ebone->parent->temp.ebone &&
(ebone->flag & BONE_CONNECTED))
{
ebone->rad_head = ebone->parent->rad_tail;
}

View File

@@ -1866,8 +1866,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
tGPsdata *p = NULL;
/* GPXX Need a better solution */
if (sa && sa->spacetype == SPACE_VIEW3D)
{
if (sa && sa->spacetype == SPACE_VIEW3D) {
if ((ob != NULL) && (ob->type == OB_GPENCIL)) {
BKE_report(op->reports, RPT_ERROR, "Cannot draw annotation with a Grease Pencil object active");
return OPERATOR_CANCELLED;

View File

@@ -1230,9 +1230,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
gso->cfra = INT_MAX; /* NOTE: So that first stroke will get handled in init_stroke() */
/* some brushes cannot use pressure for radius */
if ((gso->brush_type == GP_EDITBRUSH_TYPE_GRAB) ||
(gso->brush_type == GP_EDITBRUSH_TYPE_CLONE))
{
if (ELEM(gso->brush_type, GP_EDITBRUSH_TYPE_GRAB, GP_EDITBRUSH_TYPE_CLONE)) {
gso->brush->flag &= ~GP_EDITBRUSH_FLAG_PRESSURE_RADIUS;
}

View File

@@ -2163,7 +2163,8 @@ static void ui_but_paste_numeric_value(bContext *C, uiBut *but, uiHandleButtonDa
data->value = value;
ui_but_string_set(C, but, buf_paste);
button_activate_state(C, but, BUTTON_STATE_EXIT);
} else {
}
else {
WM_report(RPT_ERROR, "Expected a number");
}
}
@@ -2313,54 +2314,53 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
bool has_required_data = !(but->poin == NULL && but->rnapoin.data == NULL);
switch (but->type)
{
case UI_BTYPE_NUM:
case UI_BTYPE_NUM_SLIDER:
if (!has_required_data) break;
if (copy_array && ui_but_has_array_value(but)) {
switch (but->type) {
case UI_BTYPE_NUM:
case UI_BTYPE_NUM_SLIDER:
if (!has_required_data) break;
if (copy_array && ui_but_has_array_value(but)) {
ui_but_copy_numeric_array(but, buffer_to_copy, max_copy_length);
}
else {
ui_but_copy_numeric_value(but, buffer_to_copy, max_copy_length);
}
break;
case UI_BTYPE_UNITVEC:
if (!has_required_data) break;
ui_but_copy_numeric_array(but, buffer_to_copy, max_copy_length);
}
else {
ui_but_copy_numeric_value(but, buffer_to_copy, max_copy_length);
}
break;
break;
case UI_BTYPE_UNITVEC:
if (!has_required_data) break;
ui_but_copy_numeric_array(but, buffer_to_copy, max_copy_length);
break;
case UI_BTYPE_COLOR:
if (!has_required_data) break;
ui_but_copy_color(but, buffer_to_copy, max_copy_length);
break;
case UI_BTYPE_COLOR:
if (!has_required_data) break;
ui_but_copy_color(but, buffer_to_copy, max_copy_length);
break;
case UI_BTYPE_TEXT:
case UI_BTYPE_SEARCH_MENU:
if (!has_required_data) break;
ui_but_copy_text(but, buffer_to_copy, max_copy_length);
break;
case UI_BTYPE_TEXT:
case UI_BTYPE_SEARCH_MENU:
if (!has_required_data) break;
ui_but_copy_text(but, buffer_to_copy, max_copy_length);
break;
case UI_BTYPE_COLORBAND:
ui_but_copy_colorband(but);
break;
case UI_BTYPE_COLORBAND:
ui_but_copy_colorband(but);
break;
case UI_BTYPE_CURVE:
ui_but_copy_curvemapping(but);
break;
case UI_BTYPE_CURVE:
ui_but_copy_curvemapping(but);
break;
case UI_BTYPE_BUT:
ui_but_copy_operator(C, but, buffer_to_copy, max_copy_length);
break;
case UI_BTYPE_BUT:
ui_but_copy_operator(C, but, buffer_to_copy, max_copy_length);
break;
case UI_BTYPE_MENU:
case UI_BTYPE_PULLDOWN:
ui_but_copy_menu(but, buffer_to_copy, max_copy_length);
break;
case UI_BTYPE_MENU:
case UI_BTYPE_PULLDOWN:
ui_but_copy_menu(but, buffer_to_copy, max_copy_length);
break;
default:
break;
default:
break;
}
WM_clipboard_text_set(buffer_to_copy, 0);
@@ -2376,45 +2376,44 @@ static void ui_but_paste(bContext *C, uiBut *but, uiHandleButtonData *data, cons
bool has_required_data = !(but->poin == NULL && but->rnapoin.data == NULL);
switch (but->type)
{
case UI_BTYPE_NUM:
case UI_BTYPE_NUM_SLIDER:
if (!has_required_data) break;
if (paste_array && ui_but_has_array_value(but)) {
ui_but_paste_numeric_array(C, but, data, buf_paste);
}
else {
ui_but_paste_numeric_value(C, but, data, buf_paste);
}
break;
switch (but->type) {
case UI_BTYPE_NUM:
case UI_BTYPE_NUM_SLIDER:
if (!has_required_data) break;
if (paste_array && ui_but_has_array_value(but)) {
ui_but_paste_numeric_array(C, but, data, buf_paste);
}
else {
ui_but_paste_numeric_value(C, but, data, buf_paste);
}
break;
case UI_BTYPE_UNITVEC:
if (!has_required_data) break;
ui_but_paste_normalized_vector(C, but, buf_paste);
break;
case UI_BTYPE_UNITVEC:
if (!has_required_data) break;
ui_but_paste_normalized_vector(C, but, buf_paste);
break;
case UI_BTYPE_COLOR:
if (!has_required_data) break;
ui_but_paste_color(C, but, buf_paste);
break;
case UI_BTYPE_COLOR:
if (!has_required_data) break;
ui_but_paste_color(C, but, buf_paste);
break;
case UI_BTYPE_TEXT:
case UI_BTYPE_SEARCH_MENU:
if (!has_required_data) break;
ui_but_paste_text(C, but, data, buf_paste);
break;
case UI_BTYPE_TEXT:
case UI_BTYPE_SEARCH_MENU:
if (!has_required_data) break;
ui_but_paste_text(C, but, data, buf_paste);
break;
case UI_BTYPE_COLORBAND:
ui_but_paste_colorband(C, but, data);
break;
case UI_BTYPE_COLORBAND:
ui_but_paste_colorband(C, but, data);
break;
case UI_BTYPE_CURVE:
ui_but_paste_curvemapping(C, but);
break;
case UI_BTYPE_CURVE:
ui_but_paste_curvemapping(C, but);
break;
default:
break;
default:
break;
}
MEM_freeN((void *)buf_paste);

View File

@@ -1527,7 +1527,7 @@ static void icon_draw_size(
/* icon that matches text color, assumed to be white */
float color[4];
if (mono_rgba) {
rgba_uchar_to_float(color, (const unsigned char*)mono_rgba);
rgba_uchar_to_float(color, (const uchar *)mono_rgba);
}
else {
UI_GetThemeColor4fv(TH_TEXT, color);

View File

@@ -724,7 +724,7 @@ void ui_draw_aligned_panel(
#endif
{
char col_title[4];
UI_GetThemeColor4ubv(TH_TITLE, (unsigned char*)col_title);
UI_GetThemeColor4ubv(TH_TITLE, (uchar *)col_title);
GPU_blend(true);
UI_icon_draw_aspect(

View File

@@ -1278,8 +1278,8 @@ static int ui_but_draw_menu_icon(const uiBut *but)
/* icons have been standardized... and this call draws in untransformed coordinates */
static void widget_draw_icon(
const uiBut *but, BIFIconID icon, float alpha,
const rcti *rect, const char mono_color[4])
const uiBut *but, BIFIconID icon, float alpha,
const rcti *rect, const char mono_color[4])
{
float xs = 0.0f, ys = 0.0f;
float aspect, height;

View File

@@ -186,9 +186,9 @@ static void deformVerts(
/* create bounding box hierarchy */
collmd->bvhtree = bvhtree_build_from_mvert(
collmd->x,
collmd->tri, collmd->tri_num,
ob->pd->pdef_sboft);
collmd->x,
collmd->tri, collmd->tri_num,
ob->pd->pdef_sboft);
collmd->time_x = collmd->time_xnew = current_time;
collmd->is_static = true;
@@ -220,26 +220,26 @@ static void deformVerts(
if (ob->pd->pdef_sboft != BLI_bvhtree_get_epsilon(collmd->bvhtree)) {
BLI_bvhtree_free(collmd->bvhtree);
collmd->bvhtree = bvhtree_build_from_mvert(
collmd->current_x,
collmd->tri, collmd->tri_num,
ob->pd->pdef_sboft);
collmd->current_x,
collmd->tri, collmd->tri_num,
ob->pd->pdef_sboft);
}
}
/* happens on file load (ONLY when i decomment changes in readfile.c) */
if (!collmd->bvhtree) {
collmd->bvhtree = bvhtree_build_from_mvert(
collmd->current_x,
collmd->tri, collmd->tri_num,
ob->pd->pdef_sboft);
collmd->current_x,
collmd->tri, collmd->tri_num,
ob->pd->pdef_sboft);
}
else if (!collmd->is_static || !is_static) {
/* recalc static bounding boxes */
bvhtree_update_from_mvert(
collmd->bvhtree,
collmd->current_x, collmd->current_xnew,
collmd->tri, collmd->tri_num,
true);
collmd->bvhtree,
collmd->current_x, collmd->current_xnew,
collmd->tri, collmd->tri_num,
true);
}
collmd->is_static = is_static;

View File

@@ -328,7 +328,8 @@ static void meshdeformModifier_do(
/* Write binding data to original modifier. */
Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
Object *ob_orig = DEG_get_original_object(ob);
MeshDeformModifierData *mmd_orig = (MeshDeformModifierData*)modifiers_findByName(ob_orig, mmd->modifier.name);
MeshDeformModifierData *mmd_orig = (MeshDeformModifierData *)modifiers_findByName(
ob_orig, mmd->modifier.name);
recursive = 1;
mmd->bindfunc(scene, mmd_orig, cagemesh, (float *)vertexCos, numVerts, cagemat);

View File

@@ -70,10 +70,10 @@ static PyObject *bpygpu_IndexBuf_new(PyTypeObject *UNUSED(type), PyObject *args,
verts_per_prim = GPU_indexbuf_primitive_len(params.type_id);
if (verts_per_prim == -1) {
PyErr_Format(PyExc_ValueError,
"The argument 'type' must be "
"'POINTS', 'LINES', 'TRIS' or 'LINES_ADJ'");
return NULL;
PyErr_Format(PyExc_ValueError,
"The argument 'type' must be "
"'POINTS', 'LINES', 'TRIS' or 'LINES_ADJ'");
return NULL;
}
if (PyObject_CheckBuffer(params.seq)) {

View File

@@ -439,7 +439,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
drag_rect_minmax(rect, x, y, x + w, y + iconsize);
}
else {
UI_fontstyle_draw_simple(fstyle, x, y, wm_drag_name(drag), (unsigned char*)text_col);
UI_fontstyle_draw_simple(fstyle, x, y, wm_drag_name(drag), (uchar *)text_col);
}
/* operator name with roundbox */