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

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

No functional changes.
This commit is contained in:
2020-07-03 14:20:10 +02:00
parent 86e7648f0e
commit f3b8792b96
26 changed files with 439 additions and 608 deletions

View File

@@ -962,11 +962,9 @@ static bool ui_but_is_rna_undo(const uiBut *but)
if (ID_CHECK_UNDO(id) == false) {
return false;
}
else {
return true;
}
}
else if (but->rnapoin.type && !RNA_struct_undo_check(but->rnapoin.type)) {
if (but->rnapoin.type && !RNA_struct_undo_check(but->rnapoin.type)) {
return false;
}
@@ -1482,7 +1480,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
if (but->drawstr[0] == '\0') {
continue;
}
else if (((block->flag & UI_BLOCK_POPOVER) == 0) && UI_but_is_tool(but)) {
if (((block->flag & UI_BLOCK_POPOVER) == 0) && UI_but_is_tool(but)) {
/* For non-popovers, shown in shortcut only
* (has special shortcut handling code). */
continue;
@@ -2305,11 +2303,9 @@ bool ui_but_is_rna_valid(uiBut *but)
if (but->rnaprop == NULL || RNA_struct_contains_property(&but->rnapoin, but->rnaprop)) {
return true;
}
else {
printf("property removed %s: %p\n", but->drawstr, but->rnaprop);
return false;
}
}
/**
* Checks if the button supports ctrl+mousewheel cycling
@@ -2490,10 +2486,8 @@ int ui_but_string_get_max_length(uiBut *but)
if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) {
return but->hardmax;
}
else {
return UI_MAX_DRAW_STR;
}
}
uiBut *ui_but_drag_multi_edit_get(uiBut *but)
{
@@ -2520,10 +2514,8 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
Scene *scene = CTX_data_scene(but->block->evil_C);
return FRA2TIME(value);
}
else {
return BKE_scene_unit_scale(unit, RNA_SUBTYPE_UNIT_VALUE(unit_type), value);
}
}
/* str will be overwritten */
void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen)
@@ -2610,10 +2602,8 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
return (float)step_final;
}
else {
return step_default;
}
}
/**
* \param float_precision: For number buttons the precision
@@ -2838,7 +2828,6 @@ static bool ui_number_from_string_factor(bContext *C, const char *str, double *r
*r_value /= 100.0;
return success;
}
else {
if (!ui_number_from_string(C, str, r_value)) {
return false;
}
@@ -2847,7 +2836,6 @@ static bool ui_number_from_string_factor(bContext *C, const char *str, double *r
}
return true;
}
}
static bool ui_number_from_string_percentage(bContext *C, const char *str, double *r_value)
{
@@ -2858,10 +2846,8 @@ static bool ui_number_from_string_percentage(bContext *C, const char *str, doubl
MEM_freeN(str_new);
return success;
}
else {
return ui_number_from_string(C, str, r_value);
}
}
bool ui_but_string_set_eval_num(bContext *C, uiBut *but, const char *str, double *r_value)
{
@@ -2879,20 +2865,16 @@ bool ui_but_string_set_eval_num(bContext *C, uiBut *but, const char *str, double
if (ui_but_is_unit(but)) {
return ui_set_but_string_eval_num_unit(C, but, str, r_value);
}
else if (subtype == PROP_FACTOR) {
if (subtype == PROP_FACTOR) {
return ui_number_from_string_factor(C, str, r_value);
}
else if (subtype == PROP_PERCENTAGE) {
if (subtype == PROP_PERCENTAGE) {
return ui_number_from_string_percentage(C, str, r_value);
}
else {
return ui_number_from_string(C, str, r_value);
}
}
else {
return ui_number_from_string(C, str, r_value);
}
}
/* just the assignment/free part */
static void ui_but_string_set_internal(uiBut *but, const char *str, size_t str_len)
@@ -2934,12 +2916,12 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
RNA_property_string_set(&but->rnapoin, but->rnaprop, str);
return true;
}
else if (type == PROP_POINTER) {
if (type == PROP_POINTER) {
if (str[0] == '\0') {
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, PointerRNA_NULL, NULL);
return true;
}
else {
/* RNA pointer */
PointerRNA rptr;
PointerRNA ptr = but->rnasearchpoin;
@@ -2955,19 +2937,15 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr, NULL);
}
else if (but->func_arg2 != NULL) {
RNA_pointer_create(NULL,
RNA_property_pointer_type(&but->rnapoin, but->rnaprop),
but->func_arg2,
&rptr);
RNA_pointer_create(
NULL, RNA_property_pointer_type(&but->rnapoin, but->rnaprop), but->func_arg2, &rptr);
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr, NULL);
}
return true;
}
return false;
}
else if (type == PROP_ENUM) {
if (type == PROP_ENUM) {
int value;
if (RNA_property_enum_value(
but->block->evil_C, &but->rnapoin, but->rnaprop, str, &value)) {
@@ -2976,11 +2954,9 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
}
return false;
}
else {
BLI_assert(0);
}
}
}
else if (but->type == UI_BTYPE_TAB) {
if (but->rnaprop && but->custom_data) {
StructRNA *ptr_type = RNA_property_pointer_type(&but->rnapoin, but->rnaprop);
@@ -3078,13 +3054,11 @@ static double soft_range_round_up(double value, double max)
if (newmax * 0.2 >= max && newmax * 0.2 >= value) {
return newmax * 0.2;
}
else if (newmax * 0.5 >= max && newmax * 0.5 >= value) {
if (newmax * 0.5 >= max && newmax * 0.5 >= value) {
return newmax * 0.5;
}
else {
return newmax;
}
}
static double soft_range_round_down(double value, double max)
{
@@ -3095,13 +3069,11 @@ static double soft_range_round_down(double value, double max)
if (newmax * 5.0 <= max && newmax * 5.0 <= value) {
return newmax * 5.0;
}
else if (newmax * 2.0 <= max && newmax * 2.0 <= value) {
if (newmax * 2.0 <= max && newmax * 2.0 <= value) {
return newmax * 2.0;
}
else {
return newmax;
}
}
/* note: this could be split up into functions which handle arrays and not */
static void ui_set_but_soft_range(uiBut *but)
@@ -4487,7 +4459,7 @@ uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short
if (icon == ALERT_ICON_BLENDER) {
return uiDefButImage(block, ibuf, x, y, width, height, NULL);
}
else {
uchar icon_color[4];
ThemeColorID color_id = TH_INFO_WARNING;
if (icon == ALERT_ICON_ERROR) {
@@ -4502,7 +4474,6 @@ uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short
UI_GetThemeColorType4ubv(color_id, SPACE_INFO, icon_color);
return uiDefButImage(block, ibuf, x, y, width, height, icon_color);
}
}
/**
* if \a _x_ is a power of two (only one bit) return the power,
@@ -4518,7 +4489,6 @@ static int findBitIndex(uint x)
if (!x || !is_power_of_2_i(x)) { /* is_power_of_2_i(x) strips lowest bit */
return -1;
}
else {
int idx = 0;
if (x & 0xFFFF0000) {
@@ -4543,7 +4513,6 @@ static int findBitIndex(uint x)
return idx;
}
}
/* autocomplete helper functions */
struct AutoComplete {
@@ -4591,7 +4560,7 @@ void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name)
truncate[a] = 0;
break;
}
else if (truncate[a] != name[a]) {
if (truncate[a] != name[a]) {
truncate[a] = 0;
}
}
@@ -4651,7 +4620,6 @@ static uiBut *uiDefButBit(uiBlock *block,
if (bitIdx == -1) {
return NULL;
}
else {
return uiDefBut(block,
type | UI_BUT_POIN_BIT | bitIdx,
retval,
@@ -4667,7 +4635,6 @@ static uiBut *uiDefButBit(uiBlock *block,
a2,
tip);
}
}
uiBut *uiDefButF(uiBlock *block,
int type,
int retval,
@@ -5038,7 +5005,6 @@ static uiBut *uiDefIconButBit(uiBlock *block,
if (bitIdx == -1) {
return NULL;
}
else {
return uiDefIconBut(block,
type | UI_BUT_POIN_BIT | bitIdx,
retval,
@@ -5054,7 +5020,6 @@ static uiBut *uiDefIconButBit(uiBlock *block,
a2,
tip);
}
}
uiBut *uiDefIconButF(uiBlock *block,
int type,
@@ -5426,7 +5391,6 @@ static uiBut *uiDefIconTextButBit(uiBlock *block,
if (bitIdx == -1) {
return NULL;
}
else {
return uiDefIconTextBut(block,
type | UI_BUT_POIN_BIT | bitIdx,
retval,
@@ -5443,7 +5407,6 @@ static uiBut *uiDefIconTextButBit(uiBlock *block,
a2,
tip);
}
}
uiBut *uiDefIconTextButF(uiBlock *block,
int type,
@@ -5828,7 +5791,7 @@ void UI_block_order_flip(uiBlock *block)
if (U.uiflag & USER_MENUFIXEDORDER) {
return;
}
else if (block->flag & UI_BLOCK_NO_FLIP) {
if (block->flag & UI_BLOCK_NO_FLIP) {
return;
}
@@ -5994,10 +5957,8 @@ int UI_but_unit_type_get(const uiBut *but)
if ((ownUnit != 0) || (but->rnaprop == NULL)) {
return ownUnit << 16;
}
else {
return RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop));
}
}
void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg)
{

View File

@@ -104,7 +104,8 @@ static const char *shortcut_get_operator_property(bContext *C, uiBut *but, IDPro
*r_prop = (but->opptr && but->opptr->data) ? IDP_CopyProperty(but->opptr->data) : NULL;
return but->optype->idname;
}
else if (but->rnaprop) {
if (but->rnaprop) {
const PropertyType rnaprop_type = RNA_property_type(but->rnaprop);
if (rnaprop_type == PROP_BOOLEAN) {
@@ -115,7 +116,7 @@ static const char *shortcut_get_operator_property(bContext *C, uiBut *but, IDPro
}
return "WM_OT_context_toggle";
}
else if (rnaprop_type == PROP_ENUM) {
if (rnaprop_type == PROP_ENUM) {
/* Enum */
*r_prop = shortcut_property_from_rna(C, but);
if (*r_prop == NULL) {
@@ -351,7 +352,7 @@ static bUserMenuItem *ui_but_user_menu_find(bContext *C, uiBut *but, bUserMenu *
return (bUserMenuItem *)ED_screen_user_menu_item_find_operator(
&um->items, but->optype, prop, but->opcontext);
}
else if (but->rnaprop) {
if (but->rnaprop) {
const char *member_id = WM_context_member_from_ptr(C, &but->rnapoin);
const char *data_path = RNA_path_from_ID_to_struct(&but->rnapoin);
const char *member_id_data_path = member_id;
@@ -369,13 +370,11 @@ static bUserMenuItem *ui_but_user_menu_find(bContext *C, uiBut *but, bUserMenu *
}
return umi;
}
else if ((mt = UI_but_menutype_get(but))) {
if ((mt = UI_but_menutype_get(but))) {
return (bUserMenuItem *)ED_screen_user_menu_item_find_menu(&um->items, mt);
}
else {
return NULL;
}
}
static void ui_but_user_menu_add(bContext *C, uiBut *but, bUserMenu *um)
{

View File

@@ -147,9 +147,7 @@ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *ev
if (ELEM(NULL, but, but->rnapoin.data, but->rnaprop)) {
return NULL;
}
else {
return but;
}
}
/** \} */

View File

@@ -320,10 +320,8 @@ static int eyedropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
return OPERATOR_RUNNING_MODAL;
}
else {
return OPERATOR_PASS_THROUGH;
}
}
/* Repeat operator */
static int eyedropper_exec(bContext *C, wmOperator *op)
@@ -338,10 +336,8 @@ static int eyedropper_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_PASS_THROUGH;
}
}
static bool eyedropper_poll(bContext *C)
{

View File

@@ -314,10 +314,8 @@ static int eyedropper_colorband_invoke(bContext *C, wmOperator *op, const wmEven
return OPERATOR_RUNNING_MODAL;
}
else {
return OPERATOR_CANCELLED;
}
}
/* Repeat operator */
static int eyedropper_colorband_exec(bContext *C, wmOperator *op)
@@ -332,10 +330,8 @@ static int eyedropper_colorband_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
static bool eyedropper_colorband_poll(bContext *C)
{

View File

@@ -292,13 +292,11 @@ static int datadropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* Could support finished & undo-skip. */
return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
else {
BKE_report(op->reports, RPT_WARNING, "Failed to set value");
return OPERATOR_CANCELLED;
}
}
}
}
else if (event->type == MOUSEMOVE) {
ID *id = NULL;
@@ -326,10 +324,8 @@ static int datadropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED
return OPERATOR_RUNNING_MODAL;
}
else {
return OPERATOR_CANCELLED;
}
}
/* Repeat operator */
static int datadropper_exec(bContext *C, wmOperator *op)
@@ -341,10 +337,8 @@ static int datadropper_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
static bool datadropper_poll(bContext *C)
{

View File

@@ -321,10 +321,8 @@ static int depthdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
return OPERATOR_RUNNING_MODAL;
}
else {
return OPERATOR_CANCELLED;
}
}
/* Repeat operator */
static int depthdropper_exec(bContext *C, wmOperator *op)
@@ -336,10 +334,8 @@ static int depthdropper_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
static bool depthdropper_poll(bContext *C)
{

View File

@@ -102,7 +102,6 @@ static void driverdropper_sample(bContext *C, wmOperator *op, const wmEvent *eve
if (but == NULL) {
return;
}
else {
/* Get paths for src... */
PointerRNA *target_ptr = &but->rnapoin;
PropertyRNA *target_prop = but->rnaprop;
@@ -143,7 +142,6 @@ static void driverdropper_sample(bContext *C, wmOperator *op, const wmEvent *eve
MEM_freeN(dst_path);
}
}
}
static void driverdropper_cancel(bContext *C, wmOperator *op)
{
@@ -190,10 +188,8 @@ static int driverdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
return OPERATOR_RUNNING_MODAL;
}
else {
return OPERATOR_CANCELLED;
}
}
/* Repeat operator */
static int driverdropper_exec(bContext *C, wmOperator *op)
@@ -205,20 +201,16 @@ static int driverdropper_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
static bool driverdropper_poll(bContext *C)
{
if (!CTX_wm_window(C)) {
return 0;
}
else {
return 1;
}
}
void UI_OT_eyedropper_driver(wmOperatorType *ot)
{

View File

@@ -324,10 +324,8 @@ static int eyedropper_gpencil_invoke(bContext *C, wmOperator *op, const wmEvent
return OPERATOR_RUNNING_MODAL;
}
else {
return OPERATOR_PASS_THROUGH;
}
}
/* Repeat operator */
static int eyedropper_gpencil_exec(bContext *C, wmOperator *op)
@@ -340,10 +338,8 @@ static int eyedropper_gpencil_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_PASS_THROUGH;
}
}
static bool eyedropper_gpencil_poll(bContext *C)
{

View File

@@ -1384,17 +1384,15 @@ static bool ui_drag_toggle_but_is_supported(const uiBut *but)
if (ui_but_is_bool(but)) {
return true;
}
else if (UI_but_is_decorator(but)) {
if (UI_but_is_decorator(but)) {
return ELEM(but->icon,
ICON_DECORATE,
ICON_DECORATE_KEYFRAME,
ICON_DECORATE_ANIMATE,
ICON_DECORATE_OVERRIDE);
}
else {
return false;
}
}
/* Button pushed state to compare if other buttons match. Can be more
* then just true or false for toggle buttons with more than 2 states. */
@@ -1404,20 +1402,16 @@ static int ui_drag_toggle_but_pushed_state(bContext *C, uiBut *but)
if (but->pushed_state_func) {
return but->pushed_state_func(C, but->pushed_state_arg);
}
else {
/* Assume icon identifies a unique state, for buttons that
* work though functions callbacks and don't have an boolean
* value that indicates the state. */
return but->icon + but->iconadd;
}
}
else if (ui_but_is_bool(but)) {
if (ui_but_is_bool(but)) {
return ui_but_is_pushed(but);
}
else {
return 0;
}
}
typedef struct uiDragToggleHandle {
/* init */
@@ -1582,10 +1576,8 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void
WM_event_add_mousemove(win);
return WM_UI_HANDLER_BREAK;
}
else {
return WM_UI_HANDLER_CONTINUE;
}
}
static bool ui_but_is_drag_toggle(const uiBut *but)
{
@@ -2332,10 +2324,8 @@ static bool parse_float_array(char *text, float *values, int expected_length)
memcpy(values, v, sizeof(float) * expected_length);
return true;
}
else {
return false;
}
}
static void ui_but_paste_numeric_array(bContext *C,
uiBut *but,
@@ -4204,7 +4194,7 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, cons
button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
return WM_UI_HANDLER_BREAK;
}
else if (event->type == LEFTMOUSE && event->val == KM_RELEASE && but->block->handle) {
if (event->type == LEFTMOUSE && event->val == KM_RELEASE && but->block->handle) {
/* regular buttons will be 'UI_SELECT', menu items 'UI_ACTIVE' */
if (!(but->flag & (UI_SELECT | UI_ACTIVE))) {
data->cancel = true;
@@ -4212,7 +4202,7 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, cons
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
else if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) {
if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
return WM_UI_HANDLER_BREAK;
}
@@ -4247,11 +4237,11 @@ static int ui_do_but_HOTKEYEVT(bContext *C,
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
return WM_UI_HANDLER_CONTINUE;
}
else if (event->type == EVT_UNKNOWNKEY) {
if (event->type == EVT_UNKNOWNKEY) {
WM_report(RPT_WARNING, "Unsupported key: Unknown");
return WM_UI_HANDLER_CONTINUE;
}
else if (event->type == EVT_CAPSLOCKKEY) {
if (event->type == EVT_CAPSLOCKKEY) {
WM_report(RPT_WARNING, "Unsupported key: CapsLock");
return WM_UI_HANDLER_CONTINUE;
}
@@ -4301,7 +4291,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C,
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
else if (event->type == EVT_ESCKEY) {
if (event->type == EVT_ESCKEY) {
if (event->val == KM_PRESS) {
data->cancel = true;
data->escapecancel = true;
@@ -4367,7 +4357,7 @@ static int ui_do_but_TAB(
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
return WM_UI_HANDLER_BREAK;
}
else if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY)) {
if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY)) {
int event_val = (is_property) ? KM_PRESS : KM_CLICK;
if (event->val == event_val) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -4469,7 +4459,7 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, cons
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
else if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) {
if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) {
/* Support alt+wheel on expanded enum rows */
if (but->type == UI_BTYPE_ROW) {
const int direction = (event->type == WHEELDOWNMOUSE) ? -1 : 1;
@@ -5567,7 +5557,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
return WM_UI_HANDLER_BREAK;
}
else if (but->type == UI_BTYPE_MENU) {
if (but->type == UI_BTYPE_MENU) {
if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) {
const int direction = (event->type == WHEELDOWNMOUSE) ? 1 : -1;
@@ -5741,7 +5731,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
return WM_UI_HANDLER_BREAK;
}
else if (ELEM(event->type, MOUSEPAN, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) {
if (ELEM(event->type, MOUSEPAN, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) {
ColorPicker *cpicker = but->custom_data;
float hsv_static[3] = {0.0f};
float *hsv = cpicker ? cpicker->color_data : hsv_static;
@@ -5768,7 +5758,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co
ui_apply_but(C, but->block, but, data, true);
return WM_UI_HANDLER_BREAK;
}
else if ((int)(but->a1) == UI_PALETTE_COLOR && event->type == EVT_DELKEY &&
if ((int)(but->a1) == UI_PALETTE_COLOR && event->type == EVT_DELKEY &&
event->val == KM_PRESS) {
Palette *palette = (Palette *)but->rnapoin.owner_id;
PaletteColor *color = but->rnapoin.data;
@@ -6174,7 +6164,7 @@ static int ui_do_but_HSVCUBE(
return WM_UI_HANDLER_BREAK;
}
#ifdef WITH_INPUT_NDOF
else if (event->type == NDOF_MOTION) {
if (event->type == NDOF_MOTION) {
const wmNDOFMotionData *ndof = event->customdata;
const enum eSnapType snap = ui_event_to_snap(event);
@@ -6187,7 +6177,7 @@ static int ui_do_but_HSVCUBE(
}
#endif /* WITH_INPUT_NDOF */
/* XXX hardcoded keymap check.... */
else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) {
if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) {
if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) {
int len;
@@ -6450,7 +6440,7 @@ static int ui_do_but_HSVCIRCLE(
return WM_UI_HANDLER_BREAK;
}
#ifdef WITH_INPUT_NDOF
else if (event->type == NDOF_MOTION) {
if (event->type == NDOF_MOTION) {
const enum eSnapType snap = ui_event_to_snap(event);
const wmNDOFMotionData *ndof = event->customdata;
@@ -6463,7 +6453,7 @@ static int ui_do_but_HSVCIRCLE(
}
#endif /* WITH_INPUT_NDOF */
/* XXX hardcoded keymap check.... */
else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) {
if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) {
int len;
/* reset only saturation */
@@ -7257,7 +7247,7 @@ static int ui_do_but_HISTOGRAM(
return WM_UI_HANDLER_BREAK;
}
/* XXX hardcoded keymap check.... */
else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) {
if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) {
Histogram *hist = (Histogram *)but->poin;
hist->ymax = 1.f;
@@ -7333,7 +7323,7 @@ static int ui_do_but_WAVEFORM(
return WM_UI_HANDLER_BREAK;
}
/* XXX hardcoded keymap check.... */
else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) {
if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) {
Scopes *scopes = (Scopes *)but->poin;
scopes->wavefrm_yfac = 1.f;
@@ -9423,10 +9413,8 @@ static bool ui_menu_pass_event_to_parent_if_nonactive(uiPopupBlockHandle *menu,
BLI_assert(retval == WM_UI_HANDLER_CONTINUE);
return true;
}
else {
return false;
}
}
static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
{
@@ -10120,13 +10108,11 @@ static int ui_handle_menu_event(bContext *C,
if (menu->menuretval) {
return WM_UI_HANDLER_CONTINUE;
}
else if (inside) {
if (inside) {
return WM_UI_HANDLER_BREAK;
}
else {
return retval;
}
}
static int ui_handle_menu_return_submenu(bContext *C,
const wmEvent *event,
@@ -10180,10 +10166,8 @@ static int ui_handle_menu_return_submenu(bContext *C,
if (menu->menuretval) {
return WM_UI_HANDLER_CONTINUE;
}
else {
return WM_UI_HANDLER_BREAK;
}
}
static bool ui_but_pie_menu_supported_apply(uiBut *but)
{
@@ -10210,10 +10194,8 @@ static int ui_but_pie_menu_apply(bContext *C,
button_activate_init(C, menu->region, but, BUTTON_ACTIVATE_OPEN);
return retval;
}
else {
menu->menuretval = UI_RETURN_CANCEL;
}
}
else {
ui_apply_but(C, but->block, but, but->active, false);
button_activate_exit((bContext *)C, but, but->active, false, true);
@@ -10998,10 +10980,8 @@ bool UI_textbutton_activate_rna(const bContext *C,
UI_but_active_only(C, region, block, but);
return true;
}
else {
return false;
}
}
bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut)
{
@@ -11025,10 +11005,8 @@ bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut)
UI_but_active_only(C, region, block, but);
return true;
}
else {
return false;
}
}
/** \} */

View File

@@ -593,10 +593,10 @@ int UI_icon_from_event_type(short event_type, short event_value)
if (event_type == LEFTMOUSE) {
return ELEM(event_value, KM_CLICK, KM_PRESS) ? ICON_MOUSE_LMB : ICON_MOUSE_LMB_DRAG;
}
else if (event_type == MIDDLEMOUSE) {
if (event_type == MIDDLEMOUSE) {
return ELEM(event_value, KM_CLICK, KM_PRESS) ? ICON_MOUSE_MMB : ICON_MOUSE_MMB_DRAG;
}
else if (event_type == RIGHTMOUSE) {
if (event_type == RIGHTMOUSE) {
return ELEM(event_value, KM_CLICK, KM_PRESS) ? ICON_MOUSE_RMB : ICON_MOUSE_RMB_DRAG;
}
@@ -2139,7 +2139,8 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
}
return id->icon_id;
}
else if (paint_mode != PAINT_MODE_INVALID) {
if (paint_mode != PAINT_MODE_INVALID) {
items = BKE_paint_get_tool_enum_from_paintmode(paint_mode);
const uint tool_offset = BKE_paint_get_brush_tool_offset_from_paintmode(paint_mode);
const int tool_type = *(char *)POINTER_OFFSET(br, tool_offset);
@@ -2198,14 +2199,12 @@ int UI_library_icon_get(const ID *id)
if (id->tag & LIB_TAG_MISSING) {
return ICON_LIBRARY_DATA_BROKEN;
}
else if (id->tag & LIB_TAG_INDIRECT) {
if (id->tag & LIB_TAG_INDIRECT) {
return ICON_LIBRARY_DATA_INDIRECT;
}
else {
return ICON_LIBRARY_DATA_DIRECT;
}
}
else if (ID_IS_OVERRIDE_LIBRARY(id)) {
if (ID_IS_OVERRIDE_LIBRARY(id)) {
return ICON_LIBRARY_DATA_OVERRIDE;
}
@@ -2239,10 +2238,10 @@ int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big
if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) {
return ICON_SHADING_TEXTURE;
}
else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
return ICON_OUTLINER_DATA_MESH;
}
else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
return ICON_FILE_IMAGE;
}
}

View File

@@ -250,29 +250,24 @@ static int ui_item_fit(
if (is_last) {
return available - pos;
}
else {
float width = *extra_pixel + (item * available) / (float)all;
*extra_pixel = width - (int)width;
return (int)width;
}
}
else {
/* contents is smaller or equal to available space */
if (alignment == UI_LAYOUT_ALIGN_EXPAND) {
if (is_last) {
return available - pos;
}
else {
float width = *extra_pixel + (item * available) / (float)all;
*extra_pixel = width - (int)width;
return (int)width;
}
}
else {
return item;
}
}
}
/* variable button size in which direction? */
#define UI_ITEM_VARY_X 1
@@ -323,10 +318,8 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, bool
}
return UI_fontstyle_string_width(fstyle, name) + (unit_x * margin);
}
else {
return unit_x * 10;
}
}
static void ui_item_size(uiItem *item, int *r_w, int *r_h)
{
@@ -1458,10 +1451,8 @@ void uiItemsFullEnumO_items(uiLayout *layout,
/* break since rest of items is handled in new pie level */
break;
}
else {
last_iter = true;
}
}
else {
continue;
}
@@ -2579,7 +2570,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
RNA_warning("not an enum property: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
else {
const EnumPropertyItem *item;
int totitem, i;
bool free;
@@ -2616,7 +2607,6 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
if (free) {
MEM_freeN((void *)item);
}
}
/* intentionally don't touch UI_BLOCK_IS_FLIP here,
* we don't know the context this is called in */
@@ -3199,7 +3189,7 @@ uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int
return split_wrapper.decorate_column;
}
else {
char namestr[UI_MAX_NAME_STR];
if (text) {
text = ui_item_name_add_colon(text, namestr);
@@ -3208,7 +3198,6 @@ uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int
return layout;
}
}
void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon)
{
@@ -5046,10 +5035,8 @@ int uiLayoutGetEmboss(uiLayout *layout)
if (layout->emboss == UI_EMBOSS_UNDEFINED) {
return layout->root->block->dt;
}
else {
return layout->emboss;
}
}
/** \} */
@@ -5516,10 +5503,8 @@ MenuType *UI_but_menutype_get(uiBut *but)
if (but->menu_create_func == ui_item_menutype_func) {
return (MenuType *)but->poin;
}
else {
return NULL;
}
}
/* this is a bit of a hack but best keep it in one place at least */
PanelType *UI_but_paneltype_get(uiBut *but)
@@ -5527,10 +5512,8 @@ PanelType *UI_but_paneltype_get(uiBut *but)
if (but->menu_create_func == ui_item_paneltype_func) {
return (PanelType *)but->poin;
}
else {
return NULL;
}
}
void UI_menutype_draw(bContext *C, MenuType *mt, struct uiLayout *layout)
{

View File

@@ -209,11 +209,10 @@ static int copy_as_driver_button_exec(bContext *C, wmOperator *op)
MEM_freeN(path);
return OPERATOR_FINISHED;
}
else {
BKE_reportf(op->reports, RPT_ERROR, "Could not compute a valid data path");
return OPERATOR_CANCELLED;
}
}
return OPERATOR_CANCELLED;
}
@@ -312,10 +311,8 @@ static int operator_button_property_finish(bContext *C, PointerRNA *ptr, Propert
/* do nothing, go ahead with undo */
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
static bool reset_default_button_poll(bContext *C)
{
@@ -1005,7 +1002,6 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
success = true;
break;
}
else {
if (RNA_property_copy(bmain, &lptr, &ptr, prop, (all) ? -1 : index)) {
RNA_property_update(C, &lptr, prop);
success = true;
@@ -1015,7 +1011,6 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
}
}
}
}
MEM_SAFE_FREE(path);
BLI_freelistN(&lb);
}
@@ -1149,7 +1144,7 @@ static bool jump_to_target_button(bContext *C, bool poll)
return jump_to_target_ptr(C, target_ptr, poll);
}
/* For string properties with prop_search, look up the search collection item. */
else if (type == PROP_STRING) {
if (type == PROP_STRING) {
const uiBut *but = UI_context_active_but_get(C);
if (but->type == UI_BTYPE_SEARCH_MENU && but->search &&
@@ -1265,10 +1260,8 @@ static bool ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b)
STREQLEN(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR)) {
return true;
}
else {
return false;
}
}
void UI_editsource_active_but_test(uiBut *but)
{
@@ -1323,7 +1316,7 @@ static int editsource_text_edit(bContext *C,
BKE_reportf(op->reports, RPT_WARNING, "File '%s' cannot be opened", filepath);
return OPERATOR_CANCELLED;
}
else {
/* naughty!, find text area to set, not good behavior
* but since this is a dev tool lets allow it - campbell */
ScrArea *area = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0);
@@ -1337,7 +1330,6 @@ static int editsource_text_edit(bContext *C,
txt_move_toline(text, line - 1, false);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
}
return OPERATOR_FINISHED;
}
@@ -1397,11 +1389,10 @@ static int editsource_exec(bContext *C, wmOperator *op)
return ret;
}
else {
BKE_report(op->reports, RPT_ERROR, "Active button not found");
return OPERATOR_CANCELLED;
}
}
static void UI_OT_editsource(wmOperatorType *ot)
{
@@ -1585,11 +1576,10 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
return ret;
}
else {
BKE_report(op->reports, RPT_ERROR, "Active button not found");
return OPERATOR_CANCELLED;
}
}
static void UI_OT_edittranslation_init(wmOperatorType *ot)
{

View File

@@ -147,16 +147,16 @@ static int panel_aligned(const ScrArea *area, const ARegion *region)
if (area->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) {
return BUT_VERTICAL;
}
else if (area->spacetype == SPACE_USERPREF && region->regiontype == RGN_TYPE_WINDOW) {
if (area->spacetype == SPACE_USERPREF && region->regiontype == RGN_TYPE_WINDOW) {
return BUT_VERTICAL;
}
else if (area->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) {
if (area->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) {
return BUT_VERTICAL;
}
else if (area->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) {
if (area->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) {
return BUT_VERTICAL;
}
else if (ELEM(region->regiontype,
if (ELEM(region->regiontype,
RGN_TYPE_UI,
RGN_TYPE_TOOLS,
RGN_TYPE_TOOL_PROPS,
@@ -1323,20 +1323,16 @@ static int get_panel_real_ofsy(Panel *panel)
if (panel->flag & PNL_CLOSEDY) {
return panel->ofsy + panel->sizey;
}
else {
return panel->ofsy;
}
}
static int get_panel_real_ofsx(Panel *panel)
{
if (panel->flag & PNL_CLOSEDX) {
return panel->ofsx + get_panel_header(panel);
}
else {
return panel->ofsx + panel->sizex;
}
}
bool UI_panel_is_dragging(const struct Panel *panel)
{
@@ -1363,13 +1359,13 @@ static int find_leftmost_panel(const void *a1, const void *a2)
if (ps1->panel->ofsx > ps2->panel->ofsx) {
return 1;
}
else if (ps1->panel->ofsx < ps2->panel->ofsx) {
if (ps1->panel->ofsx < ps2->panel->ofsx) {
return -1;
}
else if (ps1->panel->sortorder > ps2->panel->sortorder) {
if (ps1->panel->sortorder > ps2->panel->sortorder) {
return 1;
}
else if (ps1->panel->sortorder < ps2->panel->sortorder) {
if (ps1->panel->sortorder < ps2->panel->sortorder) {
return -1;
}
@@ -1385,23 +1381,23 @@ static int find_highest_panel(const void *a1, const void *a2)
if (ps1->panel->type->flag & PNL_NO_HEADER && ps2->panel->type->flag & PNL_NO_HEADER) {
/* skip and check for ofs and sortorder below */
}
else if (ps1->panel->type->flag & PNL_NO_HEADER) {
if (ps1->panel->type->flag & PNL_NO_HEADER) {
return -1;
}
else if (ps2->panel->type->flag & PNL_NO_HEADER) {
if (ps2->panel->type->flag & PNL_NO_HEADER) {
return 1;
}
if (ps1->panel->ofsy + ps1->panel->sizey < ps2->panel->ofsy + ps2->panel->sizey) {
return 1;
}
else if (ps1->panel->ofsy + ps1->panel->sizey > ps2->panel->ofsy + ps2->panel->sizey) {
if (ps1->panel->ofsy + ps1->panel->sizey > ps2->panel->ofsy + ps2->panel->sizey) {
return -1;
}
else if (ps1->panel->sortorder > ps2->panel->sortorder) {
if (ps1->panel->sortorder > ps2->panel->sortorder) {
return 1;
}
else if (ps1->panel->sortorder < ps2->panel->sortorder) {
if (ps1->panel->sortorder < ps2->panel->sortorder) {
return -1;
}
@@ -1415,7 +1411,7 @@ static int compare_panel(const void *a1, const void *a2)
if (ps1->panel->sortorder > ps2->panel->sortorder) {
return 1;
}
else if (ps1->panel->sortorder < ps2->panel->sortorder) {
if (ps1->panel->sortorder < ps2->panel->sortorder) {
return -1;
}
@@ -2838,7 +2834,7 @@ int ui_handler_panel_region(bContext *C,
retval = WM_UI_HANDLER_BREAK;
break;
}
else if ((mouse_state == PANEL_MOUSE_INSIDE_SCALE) && !(panel->flag & PNL_CLOSED)) {
if ((mouse_state == PANEL_MOUSE_INSIDE_SCALE) && !(panel->flag & PNL_CLOSED)) {
panel_activate_state(C, panel, PANEL_STATE_DRAG_SCALE);
retval = WM_UI_HANDLER_BREAK;
break;
@@ -2993,10 +2989,8 @@ static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata)
if (data && data->state == PANEL_STATE_ANIMATION) {
return WM_UI_HANDLER_CONTINUE;
}
else {
return WM_UI_HANDLER_BREAK;
}
}
static void ui_handler_remove_panel(bContext *C, void *userdata)
{

View File

@@ -107,10 +107,8 @@ bool UI_but_is_utf8(const uiBut *but)
const int subtype = RNA_property_subtype(but->rnaprop);
return !(ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME, PROP_BYTESTRING));
}
else {
return !(but->flag & UI_BUT_NO_UTF8);
}
}
#ifdef USE_UI_POPOVER_ONCE
bool ui_but_is_popover_once_compat(const uiBut *but)
@@ -171,10 +169,8 @@ int ui_but_icon(const uiBut *but)
if (but->drawflag & UI_BUT_ICON_REVERSE) {
return but->icon - but->iconadd;
}
else {
return but->icon + but->iconadd;
}
}
/** \} */

View File

@@ -77,12 +77,11 @@ int ui_but_menu_step(uiBut *but, int direction)
if (but->menu_step_func) {
return but->menu_step_func(but->block->evil_C, direction, but->poin);
}
else {
const int curval = RNA_property_enum_get(&but->rnapoin, but->rnaprop);
return RNA_property_enum_step(
but->block->evil_C, &but->rnapoin, but->rnaprop, curval, direction);
}
}
printf("%s: cannot cycle button '%s'\n", __func__, but->str);
return 0;
@@ -129,7 +128,7 @@ static uiBut *ui_popup_menu_memory__internal(uiBlock *block, uiBut *but)
mem[hash_mod] = ui_popup_string_hash(but->str, but->flag & UI_BUT_HAS_SEP_CHAR);
return NULL;
}
else {
/* get */
for (but = block->buttons.first; but; but = but->next) {
if (mem[hash_mod] == ui_popup_string_hash(but->str, but->flag & UI_BUT_HAS_SEP_CHAR)) {
@@ -139,7 +138,6 @@ static uiBut *ui_popup_menu_memory__internal(uiBlock *block, uiBut *but)
return NULL;
}
}
uiBut *ui_popup_menu_memory_get(uiBlock *block)
{
@@ -488,14 +486,12 @@ bool UI_popup_menu_end_or_cancel(bContext *C, uiPopupMenu *pup)
UI_popup_menu_end(C, pup);
return true;
}
else {
UI_block_layout_resolve(pup->block, NULL, NULL);
MEM_freeN(pup->block->handle);
UI_block_free(C, pup->block);
MEM_freeN(pup);
return false;
}
}
uiLayout *UI_popup_menu_layout(uiPopupMenu *pup)
{

View File

@@ -292,17 +292,15 @@ bool ui_searchbox_apply(uiBut *but, ARegion *region)
return true;
}
else if (but->flag & UI_BUT_VALUE_CLEAR) {
if (but->flag & UI_BUT_VALUE_CLEAR) {
/* It is valid for _VALUE_CLEAR flavor to have no active element
* (it's a valid way to unlink). */
but->editstr[0] = '\0';
return true;
}
else {
return false;
}
}
static struct ARegion *wm_searchbox_tooltip_init(struct bContext *C,
struct ARegion *region,

View File

@@ -763,10 +763,8 @@ static uiTooltipData *ui_tooltip_data_from_tool(bContext *C, uiBut *but, bool is
MEM_freeN(data);
return NULL;
}
else {
return data;
}
}
static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but)
{
@@ -1045,10 +1043,8 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but)
MEM_freeN(data);
return NULL;
}
else {
return data;
}
}
static uiTooltipData *ui_tooltip_data_from_gizmo(bContext *C, wmGizmo *gz)
{
@@ -1144,10 +1140,8 @@ static uiTooltipData *ui_tooltip_data_from_gizmo(bContext *C, wmGizmo *gz)
MEM_freeN(data);
return NULL;
}
else {
return data;
}
}
static ARegion *ui_tooltip_create_with_data(bContext *C,
uiTooltipData *data,

View File

@@ -346,7 +346,7 @@ static void menu_types_add_from_keymap_items(bContext *C,
continue;
}
else if (handler_base->poll == NULL || handler_base->poll(region, win->eventstate)) {
if (handler_base->poll == NULL || handler_base->poll(region, win->eventstate)) {
wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base;
wmKeyMap *keymap = WM_event_get_keymap_from_handler(wm, handler);
if (keymap && WM_keymap_poll(C, keymap)) {

View File

@@ -1152,10 +1152,8 @@ ID *UI_context_active_but_get_tab_ID(bContext *C)
if (but && but->type == UI_BTYPE_TAB) {
return but->custom_data;
}
else {
return NULL;
}
}
static void template_ID_tabs(const bContext *C,
uiLayout *layout,
@@ -1847,10 +1845,8 @@ static Object *get_context_object(const bContext *C)
if (sbuts != NULL && (sbuts->pinid != NULL) && GS(sbuts->pinid->name) == ID_OB) {
return (Object *)sbuts->pinid;
}
else {
return CTX_data_active_object(C);
}
}
static void modifier_panel_id(void *md_link, char *r_name)
{
@@ -2270,10 +2266,9 @@ static eAutoPropButsReturn template_operator_property_buts_draw_single(
UI_block_lock_set(block, true, "Operator can't' redo");
return return_info;
}
else {
/* useful for macros where only one of the steps can't be re-done */
UI_block_lock_clear(block);
}
if (layout_flags & UI_TEMPLATE_OP_PROPS_SHOW_TITLE) {
uiItemL(layout, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
@@ -4976,7 +4971,7 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAUp
selection_y = &point->y;
break;
}
else if (profile->path[i].flag & PROF_H1_SELECT) {
if (profile->path[i].flag & PROF_H1_SELECT) {
point = &profile->path[i];
selection_x = &point->h1_loc[0];
selection_y = &point->h1_loc[1];
@@ -6630,47 +6625,47 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
owner = scene;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_BUILD_PREVIEW)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_BUILD_PREVIEW)) {
handle_event = B_STOPSEQ;
icon = ICON_SEQUENCE;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_BUILD_PROXY)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_BUILD_PROXY)) {
handle_event = B_STOPCLIP;
icon = ICON_TRACKER;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_PREFETCH)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_PREFETCH)) {
handle_event = B_STOPCLIP;
icon = ICON_TRACKER;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_TRACK_MARKERS)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_TRACK_MARKERS)) {
handle_event = B_STOPCLIP;
icon = ICON_TRACKER;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_SOLVE_CAMERA)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_SOLVE_CAMERA)) {
handle_event = B_STOPCLIP;
icon = ICON_TRACKER;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_FILESEL_READDIR)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_FILESEL_READDIR)) {
handle_event = B_STOPFILE;
icon = ICON_FILEBROWSER;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
handle_event = B_STOPRENDER;
icon = ICON_SCENE;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
handle_event = B_STOPCOMPO;
icon = ICON_RENDERLAYERS;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE) ||
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE) ||
WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE)) {
/* Skip bake jobs in compositor to avoid compo header displaying
* progress bar which is not being updated (bake jobs only need
@@ -6681,23 +6676,24 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
icon = ICON_IMAGE;
break;
}
continue;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_DPAINT_BAKE)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_DPAINT_BAKE)) {
handle_event = B_STOPOTHER;
icon = ICON_MOD_DYNAMICPAINT;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_POINTCACHE)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_POINTCACHE)) {
handle_event = B_STOPOTHER;
icon = ICON_PHYSICS;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_FLUID)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_FLUID)) {
handle_event = B_STOPOTHER;
icon = ICON_MOD_FLUIDSIM;
break;
}
else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_OCEAN)) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_OCEAN)) {
handle_event = B_STOPOTHER;
icon = ICON_MOD_OCEAN;
break;

View File

@@ -88,10 +88,8 @@ const char *ui_textedit_undo(uiUndoStack_Text *stack, int direction, int *r_curs
if (direction < 0) {
return ui_textedit_undo_impl(stack, r_cursor_index);
}
else {
return ui_textedit_redo_impl(stack, r_cursor_index);
}
}
/**
* Push the information in the arguments to a new state in the undo stack.

View File

@@ -60,14 +60,10 @@ bool ui_str_has_word_prefix(const char *haystack, const char *needle, size_t nee
if ((match == haystack) || (*(match - 1) == ' ') || ispunct(*(match - 1))) {
return true;
}
else {
return ui_str_has_word_prefix(match + 1, needle, needle_len);
}
}
else {
return false;
}
}
/*************************** RNA Utilities ******************************/
@@ -397,10 +393,8 @@ static int sort_search_items_list(const void *a, const void *b)
if (BLI_strcasecmp(cis1->name, cis2->name) > 0) {
return 1;
}
else {
return 0;
}
}
void ui_rna_collection_search_update_fn(const struct bContext *C,
void *arg,
@@ -535,10 +529,8 @@ int UI_icon_from_id(ID *id)
if (ob->type == OB_EMPTY) {
return ICON_EMPTY_DATA;
}
else {
return UI_icon_from_id(ob->data);
}
}
/* otherwise get it through RNA, creating the pointer
* will set the right type, also with subclassing */
@@ -553,16 +545,14 @@ int UI_icon_from_report_type(int type)
if (type & RPT_ERROR_ALL) {
return ICON_ERROR;
}
else if (type & RPT_WARNING_ALL) {
if (type & RPT_WARNING_ALL) {
return ICON_ERROR;
}
else if (type & RPT_INFO_ALL) {
if (type & RPT_INFO_ALL) {
return ICON_INFO;
}
else {
return ICON_NONE;
}
}
/********************************** Misc **************************************/
@@ -632,7 +622,7 @@ bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength)
RNA_property_identifier(but->rnaprop));
return true;
}
else if (but->optype) {
if (but->optype) {
WM_operator_py_idname(r_str, but->optype->idname);
return true;
}

View File

@@ -1408,7 +1408,7 @@ bool UI_GetIconThemeColor4ubv(int colorid, uchar col[4])
if (colorid == 0) {
return false;
}
else if (colorid == TH_ICON_FUND) {
if (colorid == TH_ICON_FUND) {
/* Always color development fund icon. */
}
else if (!((theme_spacetype == SPACE_OUTLINER && theme_regionid == RGN_TYPE_WINDOW) ||

View File

@@ -74,13 +74,11 @@ BLI_INLINE int clamp_float_to_int(const float f)
if (UNLIKELY(f < min)) {
return min;
}
else if (UNLIKELY(f > max)) {
if (UNLIKELY(f > max)) {
return (int)max;
}
else {
return (int)f;
}
}
/**
* use instead of #BLI_rcti_rctf_copy so we have consistent behavior
@@ -1756,13 +1754,12 @@ bool UI_view2d_view_to_region_clip(
return true;
}
else {
/* set initial value in case coordinate lies outside of bounds */
*r_region_x = *r_region_y = V2D_IS_CLIPPED;
return false;
}
}
/**
* Convert from 2d-view space to screen/region space
@@ -1855,12 +1852,10 @@ bool UI_view2d_view_to_region_rcti_clip(const View2D *v2d, const rctf *rect_src,
return true;
}
else {
rect_dst->xmin = rect_dst->xmax = rect_dst->ymin = rect_dst->ymax = V2D_IS_CLIPPED;
rect_dst->xmin = rect_dst->xmax = rect_dst->ymin = rect_dst->ymax = V2D_IS_CLIPPED;
return false;
}
}
/** \} */

View File

@@ -428,10 +428,8 @@ float UI_view2d_grid_resolution_x__frames_or_seconds(const struct View2D *v2d,
if (display_seconds) {
return view2d_major_step_x__time(v2d, scene);
}
else {
return view2d_major_step_x__continuous(v2d);
}
}
float UI_view2d_grid_resolution_y__values(const struct View2D *v2d)
{

View File

@@ -1608,7 +1608,7 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (event->type != NDOF_MOTION) {
return OPERATOR_CANCELLED;
}
else {
const wmNDOFMotionData *ndof = event->customdata;
/* tune these until it feels right */
@@ -1659,7 +1659,6 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_FINISHED;
}
}
static void VIEW2D_OT_ndof(wmOperatorType *ot)
{
@@ -1975,16 +1974,16 @@ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_
if (in_bar) {
return SCROLLHANDLE_BAR;
}
else if (in_max) {
if (in_max) {
return SCROLLHANDLE_MAX;
}
else if (in_min) {
if (in_min) {
return SCROLLHANDLE_MIN;
}
else if (out_min) {
if (out_min) {
return SCROLLHANDLE_MIN_OUTSIDE;
}
else if (out_max) {
if (out_max) {
return SCROLLHANDLE_MAX_OUTSIDE;
}
@@ -2323,12 +2322,11 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
else {
/* not in scroller, so nothing happened...
* (pass through let's something else catch event) */
return OPERATOR_PASS_THROUGH;
}
}
/* LMB-Drag in Scrollers - not repeatable operator! */
static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)