Cleanup: Editors/Space/View3D, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/editors/space_view3d` module. No functional changes.
This commit is contained in:
parent
b61ecb785c
commit
2f6fc5a7e8
|
@ -120,14 +120,13 @@ bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_regi
|
|||
*r_region = region;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
||||
if (ED_view3d_area_user_region(area, v3d, r_region)) {
|
||||
*r_v3d = v3d;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -508,9 +507,8 @@ static bool view3d_ima_drop_poll(bContext *C,
|
|||
/* rule might not work? */
|
||||
return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE));
|
||||
}
|
||||
else {
|
||||
|
||||
return WM_drag_ID(drag, ID_IM) != NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static bool view3d_ima_bg_is_camera_view(bContext *C)
|
||||
|
|
|
@ -126,10 +126,10 @@ static float compute_scale_factor(const float ve_median, const float median)
|
|||
if (ve_median <= 0.0f) {
|
||||
return 0.0f;
|
||||
}
|
||||
else if (ve_median >= 1.0f) {
|
||||
if (ve_median >= 1.0f) {
|
||||
return 1.0f;
|
||||
}
|
||||
else {
|
||||
|
||||
/* Scale value to target median. */
|
||||
float median_new = ve_median;
|
||||
float median_orig = ve_median - median; /* Previous median value. */
|
||||
|
@ -142,11 +142,9 @@ static float compute_scale_factor(const float ve_median, const float median)
|
|||
/* Scale down. */
|
||||
return median_new / median_orig;
|
||||
}
|
||||
else {
|
||||
|
||||
/* Scale up, negative to indicate it... */
|
||||
return -(1.0f - median_new) / (1.0f - median_orig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1117,13 +1115,12 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
|
|||
/* not for me */
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
Object *ob = view_layer->basact->object;
|
||||
ED_vgroup_vert_active_mirror(ob, event - B_VGRP_PNL_EDIT_SINGLE);
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
|
||||
}
|
||||
}
|
||||
|
||||
static bool view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
|
||||
|
@ -1641,14 +1638,13 @@ static int view3d_object_mode_menu(bContext *C, wmOperator *op)
|
|||
BKE_report(op->reports, RPT_WARNING, "No active object found");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else if (((ob->mode & OB_MODE_EDIT) == 0) && (ELEM(ob->type, OB_ARMATURE))) {
|
||||
if (((ob->mode & OB_MODE_EDIT) == 0) && (ELEM(ob->type, OB_ARMATURE))) {
|
||||
ED_object_mode_set(C, (ob->mode == OB_MODE_OBJECT) ? OB_MODE_POSE : OB_MODE_OBJECT);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else {
|
||||
|
||||
UI_pie_menu_invoke(C, "VIEW3D_MT_object_mode_pie", CTX_wm_window(C)->eventstate);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_object_mode_pie_or_toggle(wmOperatorType *ot)
|
||||
|
|
|
@ -116,9 +116,8 @@ Object *ED_view3d_cameracontrol_object_get(View3DCameraControl *vctrl)
|
|||
if (rv3d->persp == RV3D_CAMOB) {
|
||||
return view3d_cameracontrol_object(vctrl);
|
||||
}
|
||||
else {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1619,9 +1619,7 @@ RenderEngineType *ED_view3d_engine_type(const Scene *scene, int drawtype)
|
|||
if (drawtype == OB_MATERIAL && (type->flag & RE_USE_EEVEE_VIEWPORT)) {
|
||||
return RE_engines_find(RE_engine_id_BLENDER_EEVEE);
|
||||
}
|
||||
else {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
void view3d_main_region_draw(const bContext *C, ARegion *region)
|
||||
|
|
|
@ -1021,12 +1021,11 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
/* add temp handler */
|
||||
WM_event_add_modal_handler(C, op);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
}
|
||||
|
||||
static void viewrotate_cancel(bContext *C, wmOperator *op)
|
||||
|
@ -1848,12 +1847,11 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
/* add temp handler */
|
||||
WM_event_add_modal_handler(C, op);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
}
|
||||
|
||||
static void viewmove_cancel(bContext *C, wmOperator *op)
|
||||
|
@ -2407,7 +2405,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
viewops_data_free(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
if (U.viewzoom == USER_ZOOM_CONT) {
|
||||
/* needs a timer to continue redrawing */
|
||||
vod->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
|
||||
|
@ -2419,7 +2417,6 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
}
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -2500,9 +2497,7 @@ static bool viewdolly_offset_lock_check(bContext *C, wmOperator *op)
|
|||
BKE_report(op->reports, RPT_WARNING, "Cannot dolly when the view offset is locked");
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void view_dolly_to_vector_3d(ARegion *region, float orig_ofs[3], float dvec[3], float dfac)
|
||||
|
@ -2726,13 +2721,11 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
viewops_data_free(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
/* add temp handler */
|
||||
WM_event_add_modal_handler(C, op);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
}
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -3170,9 +3163,8 @@ static int view_lock_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_view_lock_clear(wmOperatorType *ot)
|
||||
|
@ -3228,9 +3220,8 @@ static int view_lock_to_active_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_view_lock_to_active(wmOperatorType *ot)
|
||||
|
@ -4500,10 +4491,9 @@ static int viewroll_exec(bContext *C, wmOperator *op)
|
|||
viewops_data_free(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
viewops_data_free(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
static int viewroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
@ -4535,13 +4525,11 @@ static int viewroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
viewops_data_free(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
/* add temp handler */
|
||||
WM_event_add_modal_handler(C, op);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
}
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -4755,9 +4743,8 @@ static Camera *background_image_camera_from_context(bContext *C)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
|
||||
return CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data;
|
||||
}
|
||||
}
|
||||
|
||||
static int background_image_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
@ -4848,9 +4835,7 @@ static int background_image_remove_exec(bContext *C, wmOperator *op)
|
|||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_background_image_remove(wmOperatorType *ot)
|
||||
|
@ -4933,9 +4918,7 @@ static int view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
|||
rv3d->clipbb = NULL;
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return WM_gesture_box_invoke(C, op, event);
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_clip_border(wmOperatorType *ot)
|
||||
|
|
|
@ -425,7 +425,7 @@ static int flyEnd(bContext *C, FlyInfo *fly)
|
|||
if (fly->state == FLY_RUNNING) {
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
else if (fly->state == FLY_CONFIRM) {
|
||||
if (fly->state == FLY_CONFIRM) {
|
||||
/* Needed for auto_keyframe. */
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
if (fly->ndof) {
|
||||
|
|
|
@ -397,9 +397,7 @@ static bool view3d_ruler_item_mousemove(struct Depsgraph *depsgraph,
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -126,9 +126,8 @@ static void WIDGETGROUP_tool_generic_refresh(const bContext *C, wmGizmoGroup *gz
|
|||
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, true);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
gzgroup->use_fallback_keymap = true;
|
||||
}
|
||||
|
||||
/* skip, we don't draw anything anyway */
|
||||
{
|
||||
|
|
|
@ -826,7 +826,7 @@ static int view3d_interactive_add_modal(bContext *C, wmOperator *op, const wmEve
|
|||
view3d_interactive_add_exit(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else if (event->type == MOUSEMOVE) {
|
||||
if (event->type == MOUSEMOVE) {
|
||||
do_cursor_update = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1398,10 +1398,8 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
|
|||
if (changed_multi) {
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
|
@ -1542,9 +1540,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
|
|||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_select_menu(wmOperatorType *ot)
|
||||
|
@ -1630,7 +1626,7 @@ static Base *object_mouse_select_menu(bContext *C,
|
|||
BLI_linklist_free(linklist, NULL);
|
||||
return base;
|
||||
}
|
||||
else {
|
||||
|
||||
/* UI, full in static array values that we later use in an enum function */
|
||||
LinkNode *node;
|
||||
int i;
|
||||
|
@ -1646,7 +1642,6 @@ static Base *object_mouse_select_menu(bContext *C,
|
|||
object_mouse_select_menu_data[i].icon = UI_icon_from_id(&ob->id);
|
||||
}
|
||||
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_find("VIEW3D_OT_select_menu", false);
|
||||
PointerRNA ptr;
|
||||
|
||||
|
@ -1656,11 +1651,9 @@ static Base *object_mouse_select_menu(bContext *C,
|
|||
RNA_boolean_set(&ptr, "toggle", toggle);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr);
|
||||
WM_operator_properties_free(&ptr);
|
||||
}
|
||||
|
||||
BLI_linklist_free(linklist, NULL);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static bool selectbuffer_has_bones(const uint *buffer, const uint hits)
|
||||
|
@ -2504,9 +2497,7 @@ static int view3d_select_exec(bContext *C, wmOperator *op)
|
|||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_PASS_THROUGH; /* nothing selected, just passthrough */
|
||||
}
|
||||
}
|
||||
|
||||
static int view3d_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
@ -3116,12 +3107,10 @@ static int opengl_bone_select_buffer_cmp(const void *sel_a_p, const void *sel_b_
|
|||
if (sel_a < sel_b) {
|
||||
return -1;
|
||||
}
|
||||
else if (sel_a > sel_b) {
|
||||
if (sel_a > sel_b) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static bool do_object_box_select(bContext *C, ViewContext *vc, rcti *rect, const eSelectOp sel_op)
|
||||
|
@ -3380,9 +3369,7 @@ static int view3d_box_select_exec(bContext *C, wmOperator *op)
|
|||
if (changed_multi) {
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_select_box(wmOperatorType *ot)
|
||||
|
|
|
@ -869,9 +869,7 @@ static int snap_curs_to_sel_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot)
|
||||
|
@ -921,9 +919,7 @@ static int snap_curs_to_active_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot)
|
||||
|
|
|
@ -113,9 +113,7 @@ Camera *ED_view3d_camera_data_get(View3D *v3d, RegionView3D *rv3d)
|
|||
if ((rv3d->persp == RV3D_CAMOB) && v3d->camera && (v3d->camera->type == OB_CAMERA)) {
|
||||
return v3d->camera->data;
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ED_view3d_dist_range_get(const View3D *v3d, float r_dist_range[2])
|
||||
|
@ -602,9 +600,7 @@ bool ED_view3d_camera_lock_sync(const Depsgraph *depsgraph, View3D *v3d, RegionV
|
|||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ED_view3d_camera_autokey(const Scene *scene,
|
||||
|
@ -639,9 +635,7 @@ bool ED_view3d_camera_autokey(const Scene *scene,
|
|||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -673,9 +667,7 @@ bool ED_view3d_camera_lock_autokey(View3D *v3d,
|
|||
|
||||
return ED_view3d_camera_autokey(scene, id_key, C, do_rotate, do_translate);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -1017,9 +1009,7 @@ bool ED_view3d_autodist(Depsgraph *depsgraph,
|
|||
ED_view3d_win_to_3d_int(v3d, region, fallback_depth_pt, mval, mouse_worldloc);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void ED_view3d_autodist_init(Depsgraph *depsgraph, ARegion *region, View3D *v3d, int mode)
|
||||
|
@ -1086,9 +1076,7 @@ static bool depth_segment_cb(int x, int y, void *userData)
|
|||
data->depth = depth;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool ED_view3d_autodist_depth_seg(
|
||||
|
@ -1390,9 +1378,7 @@ bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, f
|
|||
copy_qt_qt(quat, view3d_quat_axis[view - RV3D_VIEW_FRONT][view_axis_roll]);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ED_view3d_quat_to_axis_view(const float quat[4],
|
||||
|
@ -1575,10 +1561,9 @@ float ED_view3d_depth_read_cached(const ViewContext *vc, const int mval[2])
|
|||
if (vd && vd->depths && x > 0 && y > 0 && x < vd->w && y < vd->h) {
|
||||
return vd->depths[y * vd->w + x];
|
||||
}
|
||||
else {
|
||||
|
||||
BLI_assert(1.0 <= vd->depth_range[1]);
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
bool ED_view3d_depth_read_cached_normal(const ViewContext *vc,
|
||||
|
@ -1633,9 +1618,7 @@ bool ED_view3d_depth_read_cached_normal(const ViewContext *vc,
|
|||
if (normalize_v3(r_normal) != 0.0f) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ED_view3d_depth_unproject(const ARegion *region,
|
||||
|
|
|
@ -568,9 +568,7 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op)
|
|||
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, camera_ob);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
|
||||
|
@ -1486,9 +1484,7 @@ static int localview_exec(bContext *C, wmOperator *op)
|
|||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void VIEW3D_OT_localview(wmOperatorType *ot)
|
||||
|
@ -1538,10 +1534,9 @@ static int localview_remove_from_exec(bContext *C, wmOperator *op)
|
|||
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
BKE_report(op->reports, RPT_ERROR, "No object selected");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
static bool localview_remove_from_poll(bContext *C)
|
||||
|
|
|
@ -620,7 +620,7 @@ static int walkEnd(bContext *C, WalkInfo *walk)
|
|||
if (walk->state == WALK_RUNNING) {
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
else if (walk->state == WALK_CONFIRM) {
|
||||
if (walk->state == WALK_CONFIRM) {
|
||||
/* Needed for auto_keyframe. */
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
if (walk->ndof) {
|
||||
|
|
Loading…
Reference in New Issue