Cleanup: Editors, Clang-Tidy else-after-return fixes

This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/editors` module.

No functional changes.
This commit is contained in:
2020-07-03 17:30:31 +02:00
parent 367034f210
commit 33a74941c5
40 changed files with 564 additions and 713 deletions

View File

@@ -2436,7 +2436,7 @@ static void adduplicateflagNurb(
/* actvert in cyclicu selection */
break;
}
else if (calc_duplicate_actvert(editnurb,
if (calc_duplicate_actvert(editnurb,
newnurb,
cu,
starta,
@@ -4544,7 +4544,6 @@ static int make_segment_exec(bContext *C, wmOperator *op)
if (nu_select_num > 1) {
break;
}
else {
/* only 1 selected, not first or last, a little complex, but intuitive */
if (nu->pntsv == 1) {
if ((nu->bp->f1 & SELECT) || (nu->bp[nu->pntsu - 1].f1 & SELECT)) {
@@ -4555,7 +4554,6 @@ static int make_segment_exec(bContext *C, wmOperator *op)
}
}
}
}
nu = nu->next;
}
@@ -5593,10 +5591,8 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
@@ -6517,10 +6513,8 @@ static int curve_delete_exec(bContext *C, wmOperator *op)
if (changed_multi) {
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
static const EnumPropertyItem curve_delete_type_items[] = {
{CURVE_VERTEX, "VERT", 0, "Vertices", ""},

View File

@@ -191,7 +191,8 @@ void ED_curve_nurb_vert_selected_find(
*r_bezt = NULL;
return;
}
else if (*r_bezt || *r_bp) {
if (*r_bezt || *r_bp) {
*r_bp = NULL;
*r_bezt = NULL;
}
@@ -214,7 +215,8 @@ void ED_curve_nurb_vert_selected_find(
*r_nu = NULL;
return;
}
else if (*r_bezt || *r_bp) {
if (*r_bezt || *r_bp) {
*r_bp = NULL;
*r_bezt = NULL;
}

View File

@@ -66,13 +66,12 @@ bool select_beztriple(BezTriple *bezt, bool selstatus, short flag, eVisible_Type
bezt->f3 |= flag;
return true;
}
else { /* deselects */
/* deselects */
bezt->f1 &= ~flag;
bezt->f2 &= ~flag;
bezt->f3 &= ~flag;
return true;
}
}
return false;
}
@@ -85,11 +84,9 @@ bool select_bpoint(BPoint *bp, bool selstatus, short flag, bool hidden)
bp->f1 |= flag;
return true;
}
else {
bp->f1 &= ~flag;
return true;
}
}
return false;
}
@@ -99,20 +96,16 @@ static bool swap_selection_beztriple(BezTriple *bezt)
if (bezt->f2 & SELECT) {
return select_beztriple(bezt, DESELECT, SELECT, VISIBLE);
}
else {
return select_beztriple(bezt, SELECT, SELECT, VISIBLE);
}
}
static bool swap_selection_bpoint(BPoint *bp)
{
if (bp->f1 & SELECT) {
return select_bpoint(bp, DESELECT, SELECT, VISIBLE);
}
else {
return select_bpoint(bp, SELECT, SELECT, VISIBLE);
}
}
bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu)
{

View File

@@ -373,10 +373,8 @@ static wchar_t findaccent(wchar_t char1, uint code)
if (new) {
return new;
}
else {
return char1;
}
}
static int insert_into_textbuf(Object *obedit, uintptr_t c)
{
@@ -403,10 +401,8 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c)
return 1;
}
else {
return 0;
}
}
static void text_update_edited(bContext *C, Object *obedit, int mode)
{
@@ -887,10 +883,8 @@ static int font_select_all_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void FONT_OT_select_all(wmOperatorType *ot)
{
@@ -1015,11 +1009,10 @@ static bool paste_selection(Object *obedit, ReportList *reports)
if (font_paste_wchar(obedit, text_buf, len, info_buf)) {
return true;
}
else {
BKE_report(reports, RPT_WARNING, "Text too long");
return false;
}
}
static int paste_text_exec(bContext *C, wmOperator *op)
{
@@ -1347,10 +1340,8 @@ static int change_spacing_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void FONT_OT_change_spacing(wmOperatorType *ot)
{
@@ -1688,10 +1679,9 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if ((alt || ctrl || shift) == 0) {
return OPERATOR_PASS_THROUGH;
}
else {
ascii = 9;
}
}
if (event_type == EVT_BACKSPACEKEY) {
if (alt && ef->len != 0 && ef->pos > 0) {
@@ -2290,9 +2280,7 @@ bool ED_curve_editfont_select_pick(
}
return true;
}
else {
return false;
}
}
/** \} */

View File

@@ -211,7 +211,7 @@ bool gizmo_window_project_2d(bContext *C,
}
return false;
}
else {
float co[3] = {mval[0], mval[1], 0.0f};
float imat[4][4];
invert_m4_m4(imat, mat);
@@ -219,7 +219,6 @@ bool gizmo_window_project_2d(bContext *C,
copy_v2_v2(r_co, co);
return true;
}
}
bool gizmo_window_project_3d(
bContext *C, const struct wmGizmo *gz, const float mval[2], bool use_offset, float r_co[3])
@@ -245,7 +244,7 @@ bool gizmo_window_project_3d(
mul_m4_v3(mat, r_co);
return true;
}
else {
float co[3] = {mval[0], mval[1], 0.0f};
float imat[4][4];
invert_m4_m4(imat, mat);
@@ -253,4 +252,3 @@ bool gizmo_window_project_3d(
copy_v2_v2(r_co, co);
return true;
}
}

View File

@@ -253,17 +253,16 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "No objects selected -- Created empty export file");
return OPERATOR_CANCELLED;
}
else if (export_count < 0) {
if (export_count < 0) {
BKE_report(op->reports, RPT_WARNING, "Error during export (see Console)");
return OPERATOR_CANCELLED;
}
else {
char buff[100];
sprintf(buff, "Exported %d Objects", export_count);
BKE_report(op->reports, RPT_INFO, buff);
return OPERATOR_FINISHED;
}
}
static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
{
@@ -803,11 +802,10 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_BASE_FLAGS);
return OPERATOR_FINISHED;
}
else {
BKE_report(op->reports, RPT_ERROR, "Parsing errors in Document (see Blender Console)");
return OPERATOR_CANCELLED;
}
}
static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
{

View File

@@ -273,14 +273,13 @@ static bool lattice_test_bitmap_uvw(
if ((u < 0 || u >= lt->pntsu) || (v < 0 || v >= lt->pntsv) || (w < 0 || w >= lt->pntsw)) {
return false;
}
else {
int i = BKE_lattice_index_from_uvw(lt, u, v, w);
if (lt->def[i].hide == 0) {
return (BLI_BITMAP_TEST(selpoints, i) != 0) == selected;
}
return false;
}
}
static int lattice_select_more_less(bContext *C, const bool select)
{

View File

@@ -210,7 +210,7 @@ static void finSelectedSplinePoint(MaskLayer *mask_layer,
*point = NULL;
return;
}
else if (*point) {
if (*point) {
*point = NULL;
}
else {
@@ -319,9 +319,7 @@ static bool add_vertex_extrude(const bContext *C,
if (!mask_layer) {
return false;
}
else {
finSelectedSplinePoint(mask_layer, &spline, &point, true);
}
ED_mask_select_toggle_all(mask, SEL_DESELECT);
@@ -502,7 +500,7 @@ static int add_vertex_handle_cyclic(
if (is_last_point_active) {
return add_vertex_handle_cyclic_at_point(C, mask, spline, active_point, first_point, co);
}
else if (is_first_point_active) {
if (is_first_point_active) {
return add_vertex_handle_cyclic_at_point(C, mask, spline, active_point, last_point, co);
}
return OPERATOR_PASS_THROUGH;

View File

@@ -1710,10 +1710,8 @@ static int mask_hide_view_clear_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MASK_OT_hide_view_clear(wmOperatorType *ot)
{
@@ -1773,10 +1771,8 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MASK_OT_hide_view_set(wmOperatorType *ot)
{
@@ -1827,10 +1823,8 @@ static int mask_feather_weight_clear_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MASK_OT_feather_weight_clear(wmOperatorType *ot)
{

View File

@@ -331,7 +331,7 @@ static int select_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
MaskSplinePointUW *uw;
if (ED_mask_feather_find_nearest(
@@ -371,14 +371,13 @@ static int select_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else if (deselect_all) {
if (deselect_all) {
/* For clip editor tracks, leave deselect all to clip editor. */
if (!ED_clip_can_select(C)) {
ED_mask_deselect_all(C);
return OPERATOR_FINISHED;
}
}
}
return OPERATOR_PASS_THROUGH;
}

View File

@@ -71,10 +71,8 @@ static int mask_shape_key_insert_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MASK_OT_shape_key_insert(wmOperatorType *ot)
{
@@ -119,10 +117,8 @@ static int mask_shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MASK_OT_shape_key_clear(wmOperatorType *ot)
{
@@ -205,10 +201,8 @@ static int mask_shape_key_feather_reset_exec(bContext *C, wmOperator *UNUSED(op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MASK_OT_shape_key_feather_reset(wmOperatorType *ot)
{
@@ -365,10 +359,8 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MASK_OT_shape_key_rekey(wmOperatorType *ot)
{

View File

@@ -216,11 +216,9 @@ PTCacheEdit *PE_get_current_from_psys(ParticleSystem *psys)
if ((psys->flag & PSYS_HAIR_DYNAMICS) != 0 && (psys->pointcache->flag & PTCACHE_BAKED) != 0) {
return psys->pointcache->edit;
}
else {
return psys->edit;
}
}
else if (psys->pointcache->flag & PTCACHE_BAKED) {
if (psys->pointcache->flag & PTCACHE_BAKED) {
return psys->pointcache->edit;
}
return NULL;
@@ -561,10 +559,8 @@ static bool key_test_depth(const PEData *data, const float co[3], const int scre
if (win[2] - 0.00001f > depth) {
return 0;
}
else {
return 1;
}
}
static bool key_inside_circle(const PEData *data, float rad, const float co[3], float *distance)
{
@@ -618,10 +614,8 @@ static bool key_inside_test(PEData *data, const float co[3])
if (data->mval) {
return key_inside_circle(data, data->rad, co, NULL);
}
else {
return key_inside_rect(data, co);
}
}
static bool point_is_selected(PTCacheEditPoint *point)
{
@@ -3372,11 +3366,9 @@ static void PE_mirror_x(Depsgraph *depsgraph, Scene *scene, Object *ob, int tagg
PE_mirror_particle(ob, psmd_eval->mesh_final, psys, pa, NULL);
continue;
}
else {
point->flag |= PEP_TAG;
}
}
}
if ((point->flag & PEP_TAG) && mirrorfaces[pa->num * 2] != -1) {
newtotpart++;

View File

@@ -68,10 +68,8 @@ static bool ED_operator_rigidbody_con_active_poll(bContext *C)
Object *ob = ED_object_active_context(C);
return (ob && ob->rigidbody_constraint);
}
else {
return false;
}
}
static bool ED_operator_rigidbody_con_add_poll(bContext *C)
{
@@ -151,10 +149,8 @@ static int rigidbody_con_add_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void RIGIDBODY_OT_constraint_add(wmOperatorType *ot)
{
@@ -193,9 +189,7 @@ static int rigidbody_con_remove_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Object has no Rigid Body Constraint to remove");
return OPERATOR_CANCELLED;
}
else {
ED_rigidbody_constraint_remove(bmain, scene, ob);
}
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);

View File

@@ -73,10 +73,8 @@ static bool ED_operator_rigidbody_active_poll(bContext *C)
Object *ob = ED_object_active_context(C);
return (ob && ob->rigidbody_object);
}
else {
return 0;
}
}
static bool ED_operator_rigidbody_add_poll(bContext *C)
{
@@ -91,10 +89,8 @@ static bool ED_operator_rigidbody_add_poll(bContext *C)
Object *ob = ED_object_active_context(C);
return (ob && ob->type == OB_MESH);
}
else {
return false;
}
}
/* ----------------- */
@@ -135,10 +131,8 @@ static int rigidbody_object_add_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void RIGIDBODY_OT_object_add(wmOperatorType *ot)
{
@@ -186,11 +180,10 @@ static int rigidbody_object_remove_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
else {
BKE_report(op->reports, RPT_ERROR, "Object has no Rigid Body settings to remove");
return OPERATOR_CANCELLED;
}
}
void RIGIDBODY_OT_object_remove(wmOperatorType *ot)
{
@@ -233,10 +226,8 @@ static int rigidbody_objects_add_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void RIGIDBODY_OT_objects_add(wmOperatorType *ot)
{
@@ -286,10 +277,8 @@ static int rigidbody_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
/* done */
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void RIGIDBODY_OT_objects_remove(wmOperatorType *ot)
{
@@ -340,10 +329,8 @@ static int rigidbody_objects_shape_change_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void RIGIDBODY_OT_shape_change(wmOperatorType *ot)
{
@@ -531,10 +518,8 @@ static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot)
{

View File

@@ -220,13 +220,11 @@ static void image_buffer_rect_update(RenderJob *rj,
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
return;
}
else {
if (rr->renlay == NULL) {
return;
}
rectf = RE_RenderLayerGetPass(rr->renlay, RE_PASSNAME_COMBINED, viewname);
}
}
if (rectf == NULL) {
return;
}
@@ -579,7 +577,7 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec
rj->image_outdated = true;
return;
}
else if (rj->image_outdated) {
if (rj->image_outdated) {
/* update entire render */
rj->image_outdated = false;
BKE_image_signal(rj->main, ima, NULL, IMA_SIGNAL_COLORMANAGE);

View File

@@ -1236,9 +1236,8 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent
screen_opengl_render_end(C, op->customdata);
return OPERATOR_FINISHED;
}
else {
ret = screen_opengl_render_anim_step(C, op);
}
/* stop at the end or on error */
if (ret == false) {
@@ -1291,7 +1290,7 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
bool ret = true;
if (!screen_opengl_render_anim_initialize(C, op)) {
@@ -1301,7 +1300,6 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
while (ret) {
ret = screen_opengl_render_anim_step(C, op);
}
}
/* no redraw needed, we leave state as we entered it */
// ED_update_for_newframe(C);

View File

@@ -1666,13 +1666,13 @@ static int freestyle_get_modifier_type(PointerRNA *ptr)
if (RNA_struct_is_a(ptr->type, &RNA_LineStyleColorModifier)) {
return LS_MODIFIER_TYPE_COLOR;
}
else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleAlphaModifier)) {
if (RNA_struct_is_a(ptr->type, &RNA_LineStyleAlphaModifier)) {
return LS_MODIFIER_TYPE_ALPHA;
}
else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleThicknessModifier)) {
if (RNA_struct_is_a(ptr->type, &RNA_LineStyleThicknessModifier)) {
return LS_MODIFIER_TYPE_THICKNESS;
}
else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleGeometryModifier)) {
if (RNA_struct_is_a(ptr->type, &RNA_LineStyleGeometryModifier)) {
return LS_MODIFIER_TYPE_GEOMETRY;
}
return -1;

View File

@@ -283,12 +283,12 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
else if (sima->flag & SI_FULLWINDOW) {
if (sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_state_toggle(C, win, area, SCREENMAXIMIZED);
return OPERATOR_FINISHED;
}
else if (WM_window_is_temp_screen(win)) {
if (WM_window_is_temp_screen(win)) {
wm_window_close(C, CTX_wm_manager(C), win);
return OPERATOR_FINISHED;
}

View File

@@ -133,7 +133,7 @@ static bool view_layer_remove_poll(const Scene *scene, const ViewLayer *layer)
if (act == -1) {
return false;
}
else if ((scene->view_layers.first == scene->view_layers.last) &&
if ((scene->view_layers.first == scene->view_layers.last) &&
(scene->view_layers.first == layer)) {
/* ensure 1 layer is kept */
return false;

View File

@@ -337,10 +337,9 @@ static int action_pushdown_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
return OPERATOR_CANCELLED;
}
else {
/* action can be safely added */
BKE_nla_action_pushdown(adt);
}
/* Stop displaying this action in this editor
* NOTE: The editor itself doesn't set a user...
@@ -383,7 +382,7 @@ static int action_stash_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
return OPERATOR_CANCELLED;
}
else {
/* stash the action */
if (BKE_nla_action_stash(adt)) {
/* The stash operation will remove the user already,
@@ -401,7 +400,6 @@ static int action_stash_exec(bContext *C, wmOperator *op)
/* clear action refs from editor, and then also the backing data (not necessary) */
actedit_change_action(C, NULL);
}
}
/* Send notifiers that stuff has changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
@@ -486,7 +484,7 @@ static int action_stash_create_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
return OPERATOR_CANCELLED;
}
else {
/* stash the action */
if (BKE_nla_action_stash(adt)) {
bAction *new_action = NULL;
@@ -509,7 +507,6 @@ static int action_stash_create_exec(bContext *C, wmOperator *op)
actedit_change_action(C, NULL);
}
}
}
/* Send notifiers that stuff has changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
@@ -709,11 +706,11 @@ static NlaStrip *action_layer_get_nlastrip(ListBase *strips, float ctime)
/* in range - use this one */
return strip;
}
else if ((ctime < strip->start) && (strip->prev == NULL)) {
if ((ctime < strip->start) && (strip->prev == NULL)) {
/* before first - use this one */
return strip;
}
else if ((ctime > strip->end) && (strip->next == NULL)) {
if ((ctime > strip->end) && (strip->next == NULL)) {
/* after last - use this one */
return strip;
}

View File

@@ -272,9 +272,8 @@ static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
if (ac.scene == NULL) {
return OPERATOR_CANCELLED;
}
else {
scene = ac.scene;
}
/* set the range directly */
get_keyframe_extents(&ac, &min, &max, false);

View File

@@ -146,7 +146,7 @@ static int buttons_context_path_world(ButsContextPath *path)
return 1;
}
/* if we have a scene, use the scene's world */
else if (buttons_context_path_scene(path)) {
if (buttons_context_path_scene(path)) {
scene = path->ptr[path->len - 1].data;
world = scene->world;
@@ -155,10 +155,9 @@ static int buttons_context_path_world(ButsContextPath *path)
path->len++;
return 1;
}
else {
return 1;
}
}
/* no path to a world possible */
return 0;
@@ -174,7 +173,7 @@ static int buttons_context_path_linestyle(ButsContextPath *path, wmWindow *windo
return 1;
}
/* if we have a view layer, use the lineset's linestyle */
else if (buttons_context_path_view_layer(path, window)) {
if (buttons_context_path_view_layer(path, window)) {
ViewLayer *view_layer = path->ptr[path->len - 1].data;
linestyle = BKE_linestyle_active_from_view_layer(view_layer);
if (linestyle) {
@@ -223,45 +222,45 @@ static int buttons_context_path_data(ButsContextPath *path, int type)
if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_Curve) &&
if (RNA_struct_is_a(ptr->type, &RNA_Curve) &&
(type == -1 || ELEM(type, OB_CURVE, OB_SURF, OB_FONT))) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) {
if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) {
if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) {
if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) {
if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_Light) && (type == -1 || type == OB_LAMP)) {
if (RNA_struct_is_a(ptr->type, &RNA_Light) && (type == -1 || type == OB_LAMP)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) {
if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (type == -1 || type == OB_LIGHTPROBE)) {
if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (type == -1 || type == OB_LIGHTPROBE)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) {
if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) {
if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) {
if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) {
return 1;
}
else if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) {
if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) {
return 1;
}
/* try to get an object in the path, no pinning supported here */
else if (buttons_context_path_object(path)) {
if (buttons_context_path_object(path)) {
ob = path->ptr[path->len - 1].data;
if (ob && (type == -1 || type == ob->type)) {
@@ -326,7 +325,7 @@ static int buttons_context_path_material(ButsContextPath *path)
return 1;
}
/* if we have an object, use the object material slot */
else if (buttons_context_path_object(path)) {
if (buttons_context_path_object(path)) {
ob = path->ptr[path->len - 1].data;
if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
@@ -388,7 +387,7 @@ static int buttons_context_path_pose_bone(ButsContextPath *path)
if (ob->type != OB_ARMATURE || arm->edbo) {
return 0;
}
else {
if (arm->act_bone) {
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, arm->act_bone->name);
if (pchan) {
@@ -398,7 +397,6 @@ static int buttons_context_path_pose_bone(ButsContextPath *path)
}
}
}
}
/* no path to a bone possible */
return 0;
@@ -442,7 +440,7 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
return 1;
}
/* if we have a scene, use the toolsettings brushes */
else if (buttons_context_path_scene(path)) {
if (buttons_context_path_scene(path)) {
scene = path->ptr[path->len - 1].data;
if (scene) {
@@ -661,10 +659,10 @@ static int buttons_shading_new_context(const bContext *C, int flag)
if (flag & (1 << BCONTEXT_MATERIAL)) {
return BCONTEXT_MATERIAL;
}
else if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA))) {
if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA))) {
return BCONTEXT_DATA;
}
else if (flag & (1 << BCONTEXT_WORLD)) {
if (flag & (1 << BCONTEXT_WORLD)) {
return BCONTEXT_WORLD;
}
@@ -825,72 +823,72 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return 1;
}
else if (CTX_data_equals(member, "scene")) {
if (CTX_data_equals(member, "scene")) {
/* Do not return one here if scene not found in path,
* in this case we want to get default context scene! */
return set_pointer_type(path, result, &RNA_Scene);
}
else if (CTX_data_equals(member, "world")) {
if (CTX_data_equals(member, "world")) {
set_pointer_type(path, result, &RNA_World);
return 1;
}
else if (CTX_data_equals(member, "object")) {
if (CTX_data_equals(member, "object")) {
set_pointer_type(path, result, &RNA_Object);
return 1;
}
else if (CTX_data_equals(member, "mesh")) {
if (CTX_data_equals(member, "mesh")) {
set_pointer_type(path, result, &RNA_Mesh);
return 1;
}
else if (CTX_data_equals(member, "armature")) {
if (CTX_data_equals(member, "armature")) {
set_pointer_type(path, result, &RNA_Armature);
return 1;
}
else if (CTX_data_equals(member, "lattice")) {
if (CTX_data_equals(member, "lattice")) {
set_pointer_type(path, result, &RNA_Lattice);
return 1;
}
else if (CTX_data_equals(member, "curve")) {
if (CTX_data_equals(member, "curve")) {
set_pointer_type(path, result, &RNA_Curve);
return 1;
}
else if (CTX_data_equals(member, "meta_ball")) {
if (CTX_data_equals(member, "meta_ball")) {
set_pointer_type(path, result, &RNA_MetaBall);
return 1;
}
else if (CTX_data_equals(member, "light")) {
if (CTX_data_equals(member, "light")) {
set_pointer_type(path, result, &RNA_Light);
return 1;
}
else if (CTX_data_equals(member, "camera")) {
if (CTX_data_equals(member, "camera")) {
set_pointer_type(path, result, &RNA_Camera);
return 1;
}
else if (CTX_data_equals(member, "speaker")) {
if (CTX_data_equals(member, "speaker")) {
set_pointer_type(path, result, &RNA_Speaker);
return 1;
}
else if (CTX_data_equals(member, "lightprobe")) {
if (CTX_data_equals(member, "lightprobe")) {
set_pointer_type(path, result, &RNA_LightProbe);
return 1;
}
else if (CTX_data_equals(member, "hair")) {
if (CTX_data_equals(member, "hair")) {
set_pointer_type(path, result, &RNA_Hair);
return 1;
}
else if (CTX_data_equals(member, "pointcloud")) {
if (CTX_data_equals(member, "pointcloud")) {
set_pointer_type(path, result, &RNA_PointCloud);
return 1;
}
else if (CTX_data_equals(member, "volume")) {
if (CTX_data_equals(member, "volume")) {
set_pointer_type(path, result, &RNA_Volume);
return 1;
}
else if (CTX_data_equals(member, "material")) {
if (CTX_data_equals(member, "material")) {
set_pointer_type(path, result, &RNA_Material);
return 1;
}
else if (CTX_data_equals(member, "texture")) {
if (CTX_data_equals(member, "texture")) {
ButsContextTexture *ct = sbuts->texuser;
if (ct) {
@@ -899,7 +897,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
else if (CTX_data_equals(member, "material_slot")) {
if (CTX_data_equals(member, "material_slot")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr) {
@@ -917,7 +915,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
else if (CTX_data_equals(member, "texture_user")) {
if (CTX_data_equals(member, "texture_user")) {
ButsContextTexture *ct = sbuts->texuser;
if (!ct) {
@@ -931,7 +929,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
else if (CTX_data_equals(member, "texture_user_property")) {
if (CTX_data_equals(member, "texture_user_property")) {
ButsContextTexture *ct = sbuts->texuser;
if (!ct) {
@@ -945,7 +943,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
else if (CTX_data_equals(member, "texture_node")) {
if (CTX_data_equals(member, "texture_node")) {
ButsContextTexture *ct = sbuts->texuser;
if (ct) {
@@ -958,7 +956,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return -1; /* found but not available */
}
else if (CTX_data_equals(member, "texture_slot")) {
if (CTX_data_equals(member, "texture_slot")) {
ButsContextTexture *ct = sbuts->texuser;
PointerRNA *ptr;
@@ -985,23 +983,23 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
else if (CTX_data_equals(member, "bone")) {
if (CTX_data_equals(member, "bone")) {
set_pointer_type(path, result, &RNA_Bone);
return 1;
}
else if (CTX_data_equals(member, "edit_bone")) {
if (CTX_data_equals(member, "edit_bone")) {
set_pointer_type(path, result, &RNA_EditBone);
return 1;
}
else if (CTX_data_equals(member, "pose_bone")) {
if (CTX_data_equals(member, "pose_bone")) {
set_pointer_type(path, result, &RNA_PoseBone);
return 1;
}
else if (CTX_data_equals(member, "particle_system")) {
if (CTX_data_equals(member, "particle_system")) {
set_pointer_type(path, result, &RNA_ParticleSystem);
return 1;
}
else if (CTX_data_equals(member, "particle_system_editable")) {
if (CTX_data_equals(member, "particle_system_editable")) {
if (PE_poll((bContext *)C)) {
set_pointer_type(path, result, &RNA_ParticleSystem);
}
@@ -1010,7 +1008,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return 1;
}
else if (CTX_data_equals(member, "particle_settings")) {
if (CTX_data_equals(member, "particle_settings")) {
/* only available when pinned */
PointerRNA *ptr = get_pointer_type(path, &RNA_ParticleSettings);
@@ -1018,7 +1016,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
CTX_data_pointer_set(result, ptr->owner_id, &RNA_ParticleSettings, ptr->data);
return 1;
}
else {
/* get settings from active particle system instead */
ptr = get_pointer_type(path, &RNA_ParticleSystem);
@@ -1027,11 +1025,11 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
CTX_data_pointer_set(result, ptr->owner_id, &RNA_ParticleSettings, part);
return 1;
}
}
set_pointer_type(path, result, &RNA_ParticleSettings);
return 1;
}
else if (CTX_data_equals(member, "cloth")) {
if (CTX_data_equals(member, "cloth")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr && ptr->data) {
@@ -1042,7 +1040,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return -1; /* found but not available */
}
else if (CTX_data_equals(member, "soft_body")) {
if (CTX_data_equals(member, "soft_body")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr && ptr->data) {
@@ -1054,7 +1052,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return -1; /* found but not available */
}
else if (CTX_data_equals(member, "fluid")) {
if (CTX_data_equals(member, "fluid")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr && ptr->data) {
@@ -1065,7 +1063,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return -1; /* found but not available */
}
else if (CTX_data_equals(member, "collision")) {
if (CTX_data_equals(member, "collision")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr && ptr->data) {
@@ -1076,11 +1074,11 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return -1; /* found but not available */
}
else if (CTX_data_equals(member, "brush")) {
if (CTX_data_equals(member, "brush")) {
set_pointer_type(path, result, &RNA_Brush);
return 1;
}
else if (CTX_data_equals(member, "dynamic_paint")) {
if (CTX_data_equals(member, "dynamic_paint")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr && ptr->data) {
@@ -1091,21 +1089,17 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return -1; /* found but not available */
}
else if (CTX_data_equals(member, "line_style")) {
if (CTX_data_equals(member, "line_style")) {
set_pointer_type(path, result, &RNA_FreestyleLineStyle);
return 1;
}
else if (CTX_data_equals(member, "gpencil")) {
if (CTX_data_equals(member, "gpencil")) {
set_pointer_type(path, result, &RNA_GreasePencil);
return 1;
}
else {
return 0; /* not found */
}
return -1; /* found but not available */
}
/************************* Drawing the Path ************************/
static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
@@ -1154,7 +1148,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
ptr->type == &RNA_Scene)) {
continue;
}
else if ((!ELEM(sbuts->mainb,
if ((!ELEM(sbuts->mainb,
BCONTEXT_RENDER,
BCONTEXT_OUTPUT,
BCONTEXT_SCENE,

View File

@@ -208,7 +208,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
MEM_freeN(str);
return OPERATOR_CANCELLED;
}
else {
PropertyRNA *prop_relpath;
const char *path_prop = RNA_struct_find_property(op->ptr, "directory") ? "directory" :
"filepath";
@@ -247,7 +247,6 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
}
void BUTTONS_OT_file_browse(wmOperatorType *ot)
{

View File

@@ -287,13 +287,12 @@ static bool console_line_column_from_index(
*r_col = offset - pos;
return true;
}
else {
*r_cl = NULL;
*r_cl_offset = -1;
*r_col = -1;
return false;
}
}
/* static funcs for text editing */
@@ -403,9 +402,8 @@ static int console_insert_exec(bContext *C, wmOperator *op)
if (len == 0) {
return OPERATOR_CANCELLED;
}
else {
console_select_offset(sc, len);
}
console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
@@ -426,7 +424,7 @@ static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *eve
if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) {
return OPERATOR_PASS_THROUGH;
}
else {
char str[BLI_UTF8_MAX + 1];
size_t len;
@@ -441,7 +439,6 @@ static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *eve
str[len] = '\0';
RNA_string_set(op->ptr, "text", str);
}
}
return console_insert_exec(C, op);
}
@@ -674,9 +671,8 @@ static int console_delete_exec(bContext *C, wmOperator *op)
if (!done) {
return OPERATOR_CANCELLED;
}
else {
console_select_offset(sc, -stride);
}
console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));

View File

@@ -778,7 +778,7 @@ static bool file_walk_select_do(bContext *C,
}
/* if we don't extend, selecting '..' (index == 0) is allowed so
* using key selection to go to parent directory is possible */
else if (active_new != 0) {
if (active_new != 0) {
/* select initial file */
active_new = active_old;
}

View File

@@ -637,12 +637,11 @@ static bool is_hidden_dot_filename(const char *filename, FileListInternEntry *fi
if (filename[0] == '.' && !ELEM(filename[1], '.', '\0')) {
return true; /* ignore .file */
}
else {
int len = strlen(filename);
if ((len > 0) && (filename[len - 1] == '~')) {
return true; /* ignore file~ */
}
}
/* filename might actually be a piece of path, in which case we have to check all its parts. */
@@ -1011,18 +1010,17 @@ static int filelist_geticon_ex(FileDirEntry *file,
if (FILENAME_IS_PARENT(file->relpath)) {
return is_main ? ICON_FILE_PARENT : ICON_NONE;
}
else if (typeflag & FILE_TYPE_APPLICATIONBUNDLE) {
if (typeflag & FILE_TYPE_APPLICATIONBUNDLE) {
return ICON_UGLYPACKAGE;
}
else if (typeflag & FILE_TYPE_BLENDER) {
if (typeflag & FILE_TYPE_BLENDER) {
return ICON_FILE_BLEND;
}
else if (is_main) {
if (is_main) {
/* Do not return icon for folders if icons are not 'main' draw type
* (e.g. when used over previews). */
return (file->attributes & FILE_ATTR_ANY_LINK) ? ICON_FOLDER_REDIRECT : ICON_FILE_FOLDER;
}
else {
/* If this path is in System list or path cache then use that icon. */
struct FSMenu *fsmenu = ED_fsmenu_get();
@@ -1050,15 +1048,14 @@ static int filelist_geticon_ex(FileDirEntry *file,
}
}
}
}
if (file->attributes & FILE_ATTR_OFFLINE) {
return ICON_ERROR;
}
else if (file->attributes & FILE_ATTR_TEMPORARY) {
if (file->attributes & FILE_ATTR_TEMPORARY) {
return ICON_FILE_CACHE;
}
else if (file->attributes & FILE_ATTR_SYSTEM) {
if (file->attributes & FILE_ATTR_SYSTEM) {
return ICON_SYSTEM;
}
}
@@ -1066,49 +1063,49 @@ static int filelist_geticon_ex(FileDirEntry *file,
if (typeflag & FILE_TYPE_BLENDER) {
return ICON_FILE_BLEND;
}
else if (typeflag & FILE_TYPE_BLENDER_BACKUP) {
if (typeflag & FILE_TYPE_BLENDER_BACKUP) {
return ICON_FILE_BACKUP;
}
else if (typeflag & FILE_TYPE_IMAGE) {
if (typeflag & FILE_TYPE_IMAGE) {
return ICON_FILE_IMAGE;
}
else if (typeflag & FILE_TYPE_MOVIE) {
if (typeflag & FILE_TYPE_MOVIE) {
return ICON_FILE_MOVIE;
}
else if (typeflag & FILE_TYPE_PYSCRIPT) {
if (typeflag & FILE_TYPE_PYSCRIPT) {
return ICON_FILE_SCRIPT;
}
else if (typeflag & FILE_TYPE_SOUND) {
if (typeflag & FILE_TYPE_SOUND) {
return ICON_FILE_SOUND;
}
else if (typeflag & FILE_TYPE_FTFONT) {
if (typeflag & FILE_TYPE_FTFONT) {
return ICON_FILE_FONT;
}
else if (typeflag & FILE_TYPE_BTX) {
if (typeflag & FILE_TYPE_BTX) {
return ICON_FILE_BLANK;
}
else if (typeflag & FILE_TYPE_COLLADA) {
if (typeflag & FILE_TYPE_COLLADA) {
return ICON_FILE_3D;
}
else if (typeflag & FILE_TYPE_ALEMBIC) {
if (typeflag & FILE_TYPE_ALEMBIC) {
return ICON_FILE_3D;
}
else if (typeflag & FILE_TYPE_USD) {
if (typeflag & FILE_TYPE_USD) {
return ICON_FILE_3D;
}
else if (typeflag & FILE_TYPE_VOLUME) {
if (typeflag & FILE_TYPE_VOLUME) {
return ICON_FILE_VOLUME;
}
else if (typeflag & FILE_TYPE_OBJECT_IO) {
if (typeflag & FILE_TYPE_OBJECT_IO) {
return ICON_FILE_3D;
}
else if (typeflag & FILE_TYPE_TEXT) {
if (typeflag & FILE_TYPE_TEXT) {
return ICON_FILE_TEXT;
}
else if (typeflag & FILE_TYPE_ARCHIVE) {
if (typeflag & FILE_TYPE_ARCHIVE) {
return ICON_FILE_ARCHIVE;
}
else if (typeflag & FILE_TYPE_BLENDERLIB) {
if (typeflag & FILE_TYPE_BLENDERLIB) {
const int ret = UI_idcode_icon_get(file->blentype);
if (ret != ICON_NONE) {
return ret;
@@ -1145,10 +1142,8 @@ static bool filelist_checkdir_dir(struct FileList *UNUSED(filelist),
parent_dir_until_exists_or_default_root(r_dir);
return true;
}
else {
return BLI_is_dir(r_dir);
}
}
static bool filelist_checkdir_lib(struct FileList *UNUSED(filelist),
char *r_dir,
@@ -2118,7 +2113,7 @@ void filelist_cache_previews_set(FileList *filelist, const bool use_previews)
return;
}
/* Do not start preview work while listing, gives nasty flickering! */
else if (use_previews && (filelist->flags & FL_IS_READY)) {
if (use_previews && (filelist->flags & FL_IS_READY)) {
cache->flags |= FLC_PREVIEWS_ACTIVE;
BLI_assert((cache->previews_pool == NULL) && (cache->previews_done == NULL));
@@ -2227,16 +2222,16 @@ int ED_path_extension_type(const char *path)
if (BLO_has_bfile_extension(path)) {
return FILE_TYPE_BLENDER;
}
else if (file_is_blend_backup(path)) {
if (file_is_blend_backup(path)) {
return FILE_TYPE_BLENDER_BACKUP;
}
else if (BLI_path_extension_check(path, ".app")) {
if (BLI_path_extension_check(path, ".app")) {
return FILE_TYPE_APPLICATIONBUNDLE;
}
else if (BLI_path_extension_check(path, ".py")) {
if (BLI_path_extension_check(path, ".py")) {
return FILE_TYPE_PYSCRIPT;
}
else if (BLI_path_extension_check_n(path,
if (BLI_path_extension_check_n(path,
".txt",
".glsl",
".osl",
@@ -2249,45 +2244,43 @@ int ED_path_extension_type(const char *path)
NULL)) {
return FILE_TYPE_TEXT;
}
else if (BLI_path_extension_check_n(path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", NULL)) {
if (BLI_path_extension_check_n(path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", NULL)) {
return FILE_TYPE_FTFONT;
}
else if (BLI_path_extension_check(path, ".btx")) {
if (BLI_path_extension_check(path, ".btx")) {
return FILE_TYPE_BTX;
}
else if (BLI_path_extension_check(path, ".dae")) {
if (BLI_path_extension_check(path, ".dae")) {
return FILE_TYPE_COLLADA;
}
else if (BLI_path_extension_check(path, ".abc")) {
if (BLI_path_extension_check(path, ".abc")) {
return FILE_TYPE_ALEMBIC;
}
else if (BLI_path_extension_check_n(path, ".usd", ".usda", ".usdc", NULL)) {
if (BLI_path_extension_check_n(path, ".usd", ".usda", ".usdc", NULL)) {
return FILE_TYPE_USD;
}
else if (BLI_path_extension_check(path, ".vdb")) {
if (BLI_path_extension_check(path, ".vdb")) {
return FILE_TYPE_VOLUME;
}
else if (BLI_path_extension_check(path, ".zip")) {
if (BLI_path_extension_check(path, ".zip")) {
return FILE_TYPE_ARCHIVE;
}
else if (BLI_path_extension_check_n(path, ".obj", ".3ds", ".fbx", ".glb", ".gltf", NULL)) {
if (BLI_path_extension_check_n(path, ".obj", ".3ds", ".fbx", ".glb", ".gltf", NULL)) {
return FILE_TYPE_OBJECT_IO;
}
else if (BLI_path_extension_check_array(path, imb_ext_image)) {
if (BLI_path_extension_check_array(path, imb_ext_image)) {
return FILE_TYPE_IMAGE;
}
else if (BLI_path_extension_check(path, ".ogg")) {
if (BLI_path_extension_check(path, ".ogg")) {
if (IMB_isanim(path)) {
return FILE_TYPE_MOVIE;
}
else {
return FILE_TYPE_SOUND;
}
}
else if (BLI_path_extension_check_array(path, imb_ext_movie)) {
if (BLI_path_extension_check_array(path, imb_ext_movie)) {
return FILE_TYPE_MOVIE;
}
else if (BLI_path_extension_check_array(path, imb_ext_audio)) {
if (BLI_path_extension_check_array(path, imb_ext_audio)) {
return FILE_TYPE_SOUND;
}
return 0;

View File

@@ -438,14 +438,13 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *region)
numfiles = (int)((float)(x_view + x_over) / (float)(x_item));
return numfiles * layout->rows;
}
else {
const int y_item = layout->tile_h + (2 * layout->tile_border_y);
const int y_view = (int)(BLI_rctf_size_y(&region->v2d.cur)) - layout->offset_top;
const int y_over = y_item - (y_view % y_item);
numfiles = (int)((float)(y_view + y_over) / (float)(y_item));
return numfiles * layout->flow_columns;
}
}
static bool is_inside(int x, int y, int cols, int rows)
{

View File

@@ -307,7 +307,7 @@ char *ED_fsmenu_entry_get_name(struct FSMenuEntry *fsentry)
if (fsentry->name[0]) {
return fsentry->name;
}
else {
/* Here we abuse fsm_iter->name, keeping first char NULL. */
char *name = fsentry->name + 1;
size_t name_size = sizeof(fsentry->name) - 1;
@@ -315,7 +315,6 @@ char *ED_fsmenu_entry_get_name(struct FSMenuEntry *fsentry)
fsmenu_entry_generate_name(fsentry, name, name_size);
return name;
}
}
void ED_fsmenu_entry_set_name(struct FSMenuEntry *fsentry, const char *name)
{
@@ -411,7 +410,7 @@ void fsmenu_insert_entry(struct FSMenu *fsmenu,
}
return;
}
else if ((flag & FS_INSERT_SORTED) && cmp_ret < 0) {
if ((flag & FS_INSERT_SORTED) && cmp_ret < 0) {
break;
}
}
@@ -948,10 +947,10 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
/* Hide share not usable to the user. */
continue;
}
else if (!STRPREFIX(mnt->mnt_fsname, "/dev")) {
if (!STRPREFIX(mnt->mnt_fsname, "/dev")) {
continue;
}
else if (STRPREFIX(mnt->mnt_fsname, "/dev/loop")) {
if (STRPREFIX(mnt->mnt_fsname, "/dev/loop")) {
/* The dev/loop* entries are SNAPS used by desktop environment
* (Gnome) no need for them to show up in the list. */
continue;

View File

@@ -327,10 +327,8 @@ static bool draw_fcurve_handles_check(SpaceGraph *sipo, FCurve *fcu)
(fcu->totvert <= 1)) {
return false;
}
else {
return true;
}
}
/* draw lines for F-Curve handles only (this is only done in EditMode)
* note: draw_fcurve_handles_check must be checked before running this. */

View File

@@ -233,9 +233,8 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
if (ac.scene == NULL) {
return OPERATOR_CANCELLED;
}
else {
scene = ac.scene;
}
/* set the range directly */
get_graph_keyframe_extents(&ac, &min, &max, NULL, NULL, false, false);
@@ -1631,13 +1630,12 @@ static int graphkeys_decimate_modal(bContext *C, wmOperator *op, const wmEvent *
graphkeys_decimate_modal_update(C, op);
break;
}
else {
/* unhandled event - maybe it was some view manip? */
/* allow to pass through */
return OPERATOR_RUNNING_MODAL | OPERATOR_PASS_THROUGH;
}
}
}
return OPERATOR_RUNNING_MODAL;
}
@@ -1694,7 +1692,7 @@ static bool graphkeys_decimate_poll_property(const bContext *UNUSED(C),
if (STREQ(prop_id, "remove_ratio") && mode != DECIM_RATIO) {
return false;
}
else if (STREQ(prop_id, "remove_error_margin") && mode != DECIM_ERROR) {
if (STREQ(prop_id, "remove_error_margin") && mode != DECIM_ERROR) {
return false;
}
}
@@ -2577,7 +2575,7 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
if (strstr(fcu->rna_path, "rotation_euler") == NULL) {
continue;
}
else if (ELEM(fcu->array_index, 0, 1, 2) == 0) {
if (ELEM(fcu->array_index, 0, 1, 2) == 0) {
BKE_reportf(op->reports,
RPT_WARNING,
"Euler Rotation F-Curve has invalid index (ID='%s', Path='%s', Index=%d)",
@@ -2689,7 +2687,7 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
"and that F-Curves for these are in consecutive XYZ order and selected");
return OPERATOR_CANCELLED;
}
else {
if (failed) {
BKE_report(
op->reports,
@@ -2706,7 +2704,6 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
/* done at last */
return OPERATOR_FINISHED;
}
}
void GRAPH_OT_euler_filter(wmOperatorType *ot)
{
@@ -3347,10 +3344,8 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No F-Modifiers available to be copied");
return OPERATOR_CANCELLED;
}
else {
return OPERATOR_FINISHED;
}
}
void GRAPH_OT_fmodifier_copy(wmOperatorType *ot)
{
@@ -3434,11 +3429,10 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste");
return OPERATOR_CANCELLED;
}
}
void GRAPH_OT_fmodifier_paste(wmOperatorType *ot)
{
@@ -3487,10 +3481,8 @@ static int graph_driver_vars_copy_exec(bContext *C, wmOperator *op)
if (ok) {
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void GRAPH_OT_driver_variables_copy(wmOperatorType *ot)
{
@@ -3533,10 +3525,8 @@ static int graph_driver_vars_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void GRAPH_OT_driver_variables_paste(wmOperatorType *ot)
{

View File

@@ -298,13 +298,12 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert(ListBase *matches)
BLI_remlink(matches, nvi);
return nvi;
}
else {
/* if vert is selected, we've got what we want... */
if (nvi->sel) {
found = 1;
}
}
}
/* if we're still here, this means that we failed to find anything appropriate in the first pass,
* so just take the first item now...

View File

@@ -139,10 +139,8 @@ static bool ui_imageuser_slot_menu_step(bContext *C, int direction, void *image_
WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
return true;
}
else {
return true;
}
}
static const char *ui_imageuser_layer_fake_name(RenderResult *rr)
{
@@ -150,13 +148,11 @@ static const char *ui_imageuser_layer_fake_name(RenderResult *rr)
if (rv->rectf) {
return IFACE_("Composite");
}
else if (rv->rect32) {
if (rv->rect32) {
return IFACE_("Sequence");
}
else {
return NULL;
}
}
/* workaround for passing many args */
struct ImageUI_Data {

View File

@@ -198,12 +198,11 @@ static Image *image_from_context(const bContext *C)
if (ima) {
return ima;
}
else {
/* Image editor. */
SpaceImage *sima = CTX_wm_space_image(C);
return (sima) ? sima->image : NULL;
}
}
static ImageUser *image_user_from_context(const bContext *C)
{
@@ -214,12 +213,11 @@ static ImageUser *image_user_from_context(const bContext *C)
if (iuser) {
return iuser;
}
else {
/* Image editor. */
SpaceImage *sima = CTX_wm_space_image(C);
return (sima) ? &sima->iuser : NULL;
}
}
static bool image_from_context_has_data_poll(bContext *C)
{
@@ -359,11 +357,10 @@ static int image_view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *eve
image_view_pan_exec(C, op);
return OPERATOR_FINISHED;
}
else {
image_view_pan_init(C, op, event);
return OPERATOR_RUNNING_MODAL;
}
}
static int image_view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
@@ -549,11 +546,10 @@ static int image_view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
return OPERATOR_FINISHED;
}
else {
image_view_zoom_init(C, op, event);
return OPERATOR_RUNNING_MODAL;
}
}
static void image_zoom_apply(ViewZoomData *vpd,
wmOperator *op,
@@ -697,7 +693,7 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
if (event->type != NDOF_MOTION) {
return OPERATOR_CANCELLED;
}
else {
SpaceImage *sima = CTX_wm_space_image(C);
ARegion *region = CTX_wm_region(C);
float pan_vec[3];
@@ -718,7 +714,6 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
return OPERATOR_FINISHED;
}
}
void IMAGE_OT_view_ndof(wmOperatorType *ot)
{
@@ -1678,7 +1673,7 @@ static char imtype_best_depth(ImBuf *ibuf, const char imtype)
}
return R_IMF_CHAN_DEPTH_8;
}
else {
if (depth_ok & R_IMF_CHAN_DEPTH_8) {
return R_IMF_CHAN_DEPTH_8;
}
@@ -1696,7 +1691,6 @@ static char imtype_best_depth(ImBuf *ibuf, const char imtype)
}
return R_IMF_CHAN_DEPTH_8; /* fallback, should not get here */
}
}
static int image_save_options_init(Main *bmain,
ImageSaveOptions *opts,
@@ -2147,10 +2141,9 @@ static int image_save_exec(bContext *C, wmOperator *op)
if (ok) {
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
static int image_save_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
@@ -2160,10 +2153,8 @@ static int image_save_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
WM_operator_name_call(C, "IMAGE_OT_save_as", WM_OP_INVOKE_DEFAULT, NULL);
return OPERATOR_CANCELLED;
}
else {
return image_save_exec(C, op);
}
}
void IMAGE_OT_save(wmOperatorType *ot)
{
@@ -2294,10 +2285,8 @@ static bool image_should_be_saved(Image *ima, bool *is_format_writable)
ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_GENERATED, IMA_SRC_TILED)) {
return image_should_be_saved_when_modified(ima);
}
else {
return false;
}
}
static bool image_has_valid_path(Image *ima)
{

View File

@@ -108,10 +108,9 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc,
UI_GetThemeColor4ubv(icon_bg_id, r_icon_bg);
return TVC_LINE_FG | TVC_LINE_BG | TVC_LINE_ICON | TVC_LINE_ICON_FG | TVC_LINE_ICON_BG;
}
else {
return TVC_LINE_FG | TVC_LINE_BG;
}
}
/* reports! */
static void report_textview_init__internal(TextViewContext *tvc)
@@ -159,10 +158,9 @@ static int report_textview_begin(TextViewContext *tvc)
return true;
}
else {
return false;
}
}
static void report_textview_end(TextViewContext *UNUSED(tvc))
{
@@ -185,18 +183,15 @@ static int report_textview_step(TextViewContext *tvc)
return true;
}
else {
return false;
}
}
else {
/* step to the next newline */
tvc->iter_char_end = tvc->iter_char_begin - 1;
report_textview_init__internal(tvc);
return true;
}
}
static void report_textview_line_get(TextViewContext *tvc, const char **r_line, int *r_len)
{

View File

@@ -186,7 +186,7 @@ static bool textview_draw_string(TextViewDrawState *tds,
MEM_freeN(offsets);
return true;
}
else if (y_next < tds->scroll_ymin) {
if (y_next < tds->scroll_ymin) {
/* Have not reached the drawable area so don't break. */
tds->xy[1] = y_next;

View File

@@ -461,11 +461,10 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
"block)");
return OPERATOR_CANCELLED;
}
else {
id = adt_ptr.owner_id;
adt = adt_ptr.data;
}
}
else {
/* indexed channel */
ListBase anim_data = {NULL, NULL};
@@ -483,7 +482,7 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
ANIM_animdata_freelist(&anim_data);
return OPERATOR_CANCELLED;
}
else if (ale->type != ANIMTYPE_NLAACTION) {
if (ale->type != ANIMTYPE_NLAACTION) {
BKE_reportf(op->reports,
RPT_ERROR,
"Animation channel at index %d is not a NLA 'Active Action' channel",
@@ -505,22 +504,21 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Internal Error - AnimData block is not valid");
return OPERATOR_CANCELLED;
}
else if (nlaedit_is_tweakmode_on(&ac)) {
if (nlaedit_is_tweakmode_on(&ac)) {
BKE_report(op->reports,
RPT_WARNING,
"Cannot push down actions while tweaking a strip's action, exit tweak mode first");
return OPERATOR_CANCELLED;
}
else if (adt->action == NULL) {
if (adt->action == NULL) {
BKE_report(op->reports, RPT_WARNING, "No active action to push down");
return OPERATOR_CANCELLED;
}
else {
/* 'push-down' action - only usable when not in TweakMode */
BKE_nla_action_pushdown(adt);
DEG_id_tag_update_ex(CTX_data_main(C), id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
}
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
@@ -735,7 +733,7 @@ static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
else {
/* failed to add any tracks */
BKE_report(
op->reports, RPT_WARNING, "Select an existing NLA Track or an empty action line first");
@@ -743,7 +741,6 @@ static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op)
/* not done */
return OPERATOR_CANCELLED;
}
}
void NLA_OT_tracks_add(wmOperatorType *ot)
{

View File

@@ -269,10 +269,8 @@ static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op)
if (ok) {
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void NLA_OT_tweakmode_exit(wmOperatorType *ot)
{
@@ -373,9 +371,8 @@ static int nlaedit_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
if (ac.scene == NULL) {
return OPERATOR_CANCELLED;
}
else {
scene = ac.scene;
}
/* set the range directly */
get_nlastrip_extents(&ac, &min, &max, true);
@@ -616,7 +613,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
// printf("Add strip - actname = '%s'\n", actname);
return OPERATOR_CANCELLED;
}
else if (act->idroot == 0) {
if (act->idroot == 0) {
/* hopefully in this case (i.e. library of userless actions),
* the user knows what they're doing... */
BKE_reportf(op->reports,
@@ -830,13 +827,12 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
else {
BKE_report(op->reports,
RPT_ERROR,
"Needs at least a pair of adjacent selected strips with a gap between them");
return OPERATOR_CANCELLED;
}
}
void NLA_OT_transition_add(wmOperatorType *ot)
{
@@ -1146,10 +1142,9 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
@@ -1293,9 +1288,8 @@ static void nlaedit_split_strip_actclip(
if (IS_EQF(len, 0.0f)) {
return;
}
else {
splitframe = strip->start + (len / 2.0f);
}
/* action range */
len = strip->actend - strip->actstart;
@@ -2504,11 +2498,10 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No F-Modifiers available to be copied");
return OPERATOR_CANCELLED;
}
else {
/* no updates needed - copy is non-destructive operation */
return OPERATOR_FINISHED;
}
}
void NLA_OT_fmodifier_copy(wmOperatorType *ot)
{
@@ -2591,11 +2584,10 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
else {
BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste");
return OPERATOR_CANCELLED;
}
}
void NLA_OT_fmodifier_paste(wmOperatorType *ot)
{

View File

@@ -360,7 +360,7 @@ bool ED_undo_is_legacy_compatible_for_property(struct bContext *C, ID *id)
CLOG_INFO(&LOG, 1, "skipping undo for paint-mode");
return false;
}
else if (obact->mode & OB_MODE_EDIT) {
if (obact->mode & OB_MODE_EDIT) {
if ((id == NULL) || (obact->data == NULL) ||
(GS(id->name) != GS(((ID *)obact->data)->name))) {
/* No undo push on id type mismatch in edit-mode. */

View File

@@ -123,10 +123,10 @@ void ED_editors_init(bContext *C)
if (mode == OB_MODE_OBJECT) {
continue;
}
else if (BKE_object_has_mode_data(ob, mode)) {
if (BKE_object_has_mode_data(ob, mode)) {
continue;
}
else if (ob->type == OB_GPENCIL) {
if (ob->type == OB_GPENCIL) {
/* For multi-edit mode we may already have mode data (grease pencil does not need it).
* However we may have a non-active object stuck in a grease-pencil edit mode. */
if (ob != obact) {

View File

@@ -239,14 +239,13 @@ bool applyNumInput(NumInput *n, float *vec)
#endif
return true;
}
else {
/* Else, we set the 'org' values for numinput! */
for (j = 0; j <= n->idx_max; j++) {
n->val[j] = n->val_org[j] = vec[j];
}
return false;
}
}
static void value_to_editstr(NumInput *n, int idx)
{
@@ -291,12 +290,12 @@ bool user_string_to_number(
return BPY_execute_string_as_number(C, NULL, str_unit_convert, true, r_value);
}
else {
int success = BPY_execute_string_as_number(C, NULL, str, true, r_value);
*r_value *= bUnit_PreferredInputUnitScalar(unit, type);
*r_value /= unit_scale;
return success;
}
#else
UNUSED_VARS(C, unit, type);
*r_value = atof(str);
@@ -309,13 +308,11 @@ static bool editstr_is_simple_numinput(const char ascii)
if (ascii >= '0' && ascii <= '9') {
return true;
}
else if (ascii == '.') {
if (ascii == '.') {
return true;
}
else {
return false;
}
}
bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
{
@@ -348,7 +345,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
n->val_flag[idx] |= NUM_EDITED;
return true;
}
else if (event->ctrl) {
if (event->ctrl) {
n->flag &= ~NUM_EDIT_FULL;
return true;
}