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:
@@ -962,11 +962,9 @@ static bool ui_but_is_rna_undo(const uiBut *but)
|
|||||||
if (ID_CHECK_UNDO(id) == false) {
|
if (ID_CHECK_UNDO(id) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
if (but->rnapoin.type && !RNA_struct_undo_check(but->rnapoin.type)) {
|
||||||
else if (but->rnapoin.type && !RNA_struct_undo_check(but->rnapoin.type)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1482,7 +1480,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
|
|||||||
if (but->drawstr[0] == '\0') {
|
if (but->drawstr[0] == '\0') {
|
||||||
continue;
|
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
|
/* For non-popovers, shown in shortcut only
|
||||||
* (has special shortcut handling code). */
|
* (has special shortcut handling code). */
|
||||||
continue;
|
continue;
|
||||||
@@ -2305,10 +2303,8 @@ bool ui_but_is_rna_valid(uiBut *but)
|
|||||||
if (but->rnaprop == NULL || RNA_struct_contains_property(&but->rnapoin, but->rnaprop)) {
|
if (but->rnaprop == NULL || RNA_struct_contains_property(&but->rnapoin, but->rnaprop)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
printf("property removed %s: %p\n", but->drawstr, but->rnaprop);
|
printf("property removed %s: %p\n", but->drawstr, but->rnaprop);
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2490,9 +2486,7 @@ int ui_but_string_get_max_length(uiBut *but)
|
|||||||
if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) {
|
if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) {
|
||||||
return but->hardmax;
|
return but->hardmax;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return UI_MAX_DRAW_STR;
|
return UI_MAX_DRAW_STR;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uiBut *ui_but_drag_multi_edit_get(uiBut *but)
|
uiBut *ui_but_drag_multi_edit_get(uiBut *but)
|
||||||
@@ -2520,9 +2514,7 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
|
|||||||
Scene *scene = CTX_data_scene(but->block->evil_C);
|
Scene *scene = CTX_data_scene(but->block->evil_C);
|
||||||
return FRA2TIME(value);
|
return FRA2TIME(value);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return BKE_scene_unit_scale(unit, RNA_SUBTYPE_UNIT_VALUE(unit_type), value);
|
return BKE_scene_unit_scale(unit, RNA_SUBTYPE_UNIT_VALUE(unit_type), value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* str will be overwritten */
|
/* str will be overwritten */
|
||||||
@@ -2610,9 +2602,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
|
|||||||
|
|
||||||
return (float)step_final;
|
return (float)step_final;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return step_default;
|
return step_default;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2838,7 +2828,6 @@ static bool ui_number_from_string_factor(bContext *C, const char *str, double *r
|
|||||||
*r_value /= 100.0;
|
*r_value /= 100.0;
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (!ui_number_from_string(C, str, r_value)) {
|
if (!ui_number_from_string(C, str, r_value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2846,7 +2835,6 @@ static bool ui_number_from_string_factor(bContext *C, const char *str, double *r
|
|||||||
*r_value /= 100.0;
|
*r_value /= 100.0;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ui_number_from_string_percentage(bContext *C, const char *str, double *r_value)
|
static bool ui_number_from_string_percentage(bContext *C, const char *str, double *r_value)
|
||||||
@@ -2858,9 +2846,7 @@ static bool ui_number_from_string_percentage(bContext *C, const char *str, doubl
|
|||||||
MEM_freeN(str_new);
|
MEM_freeN(str_new);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return ui_number_from_string(C, str, r_value);
|
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)
|
bool ui_but_string_set_eval_num(bContext *C, uiBut *but, const char *str, double *r_value)
|
||||||
@@ -2879,19 +2865,15 @@ bool ui_but_string_set_eval_num(bContext *C, uiBut *but, const char *str, double
|
|||||||
if (ui_but_is_unit(but)) {
|
if (ui_but_is_unit(but)) {
|
||||||
return ui_set_but_string_eval_num_unit(C, but, str, r_value);
|
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);
|
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);
|
return ui_number_from_string_percentage(C, str, r_value);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return ui_number_from_string(C, str, r_value);
|
return ui_number_from_string(C, str, r_value);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ui_number_from_string(C, str, r_value);
|
return ui_number_from_string(C, str, r_value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* just the assignment/free part */
|
/* just the assignment/free part */
|
||||||
@@ -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);
|
RNA_property_string_set(&but->rnapoin, but->rnaprop, str);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (type == PROP_POINTER) {
|
|
||||||
|
if (type == PROP_POINTER) {
|
||||||
if (str[0] == '\0') {
|
if (str[0] == '\0') {
|
||||||
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, PointerRNA_NULL, NULL);
|
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, PointerRNA_NULL, NULL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* RNA pointer */
|
/* RNA pointer */
|
||||||
PointerRNA rptr;
|
PointerRNA rptr;
|
||||||
PointerRNA ptr = but->rnasearchpoin;
|
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);
|
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr, NULL);
|
||||||
}
|
}
|
||||||
else if (but->func_arg2 != NULL) {
|
else if (but->func_arg2 != NULL) {
|
||||||
RNA_pointer_create(NULL,
|
RNA_pointer_create(
|
||||||
RNA_property_pointer_type(&but->rnapoin, but->rnaprop),
|
NULL, RNA_property_pointer_type(&but->rnapoin, but->rnaprop), but->func_arg2, &rptr);
|
||||||
but->func_arg2,
|
|
||||||
&rptr);
|
|
||||||
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr, NULL);
|
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
if (type == PROP_ENUM) {
|
||||||
}
|
|
||||||
else if (type == PROP_ENUM) {
|
|
||||||
int value;
|
int value;
|
||||||
if (RNA_property_enum_value(
|
if (RNA_property_enum_value(
|
||||||
but->block->evil_C, &but->rnapoin, but->rnaprop, str, &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;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
BLI_assert(0);
|
BLI_assert(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (but->type == UI_BTYPE_TAB) {
|
else if (but->type == UI_BTYPE_TAB) {
|
||||||
if (but->rnaprop && but->custom_data) {
|
if (but->rnaprop && but->custom_data) {
|
||||||
StructRNA *ptr_type = RNA_property_pointer_type(&but->rnapoin, but->rnaprop);
|
StructRNA *ptr_type = RNA_property_pointer_type(&but->rnapoin, but->rnaprop);
|
||||||
@@ -3078,12 +3054,10 @@ static double soft_range_round_up(double value, double max)
|
|||||||
if (newmax * 0.2 >= max && newmax * 0.2 >= value) {
|
if (newmax * 0.2 >= max && newmax * 0.2 >= value) {
|
||||||
return newmax * 0.2;
|
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;
|
return newmax * 0.5;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return newmax;
|
return newmax;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static double soft_range_round_down(double value, double max)
|
static double soft_range_round_down(double value, double max)
|
||||||
@@ -3095,12 +3069,10 @@ static double soft_range_round_down(double value, double max)
|
|||||||
if (newmax * 5.0 <= max && newmax * 5.0 <= value) {
|
if (newmax * 5.0 <= max && newmax * 5.0 <= value) {
|
||||||
return newmax * 5.0;
|
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;
|
return newmax * 2.0;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return newmax;
|
return newmax;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* note: this could be split up into functions which handle arrays and not */
|
/* note: this could be split up into functions which handle arrays and not */
|
||||||
@@ -4487,7 +4459,7 @@ uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short
|
|||||||
if (icon == ALERT_ICON_BLENDER) {
|
if (icon == ALERT_ICON_BLENDER) {
|
||||||
return uiDefButImage(block, ibuf, x, y, width, height, NULL);
|
return uiDefButImage(block, ibuf, x, y, width, height, NULL);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
uchar icon_color[4];
|
uchar icon_color[4];
|
||||||
ThemeColorID color_id = TH_INFO_WARNING;
|
ThemeColorID color_id = TH_INFO_WARNING;
|
||||||
if (icon == ALERT_ICON_ERROR) {
|
if (icon == ALERT_ICON_ERROR) {
|
||||||
@@ -4501,7 +4473,6 @@ uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short
|
|||||||
}
|
}
|
||||||
UI_GetThemeColorType4ubv(color_id, SPACE_INFO, icon_color);
|
UI_GetThemeColorType4ubv(color_id, SPACE_INFO, icon_color);
|
||||||
return uiDefButImage(block, ibuf, x, y, width, height, icon_color);
|
return uiDefButImage(block, ibuf, x, y, width, height, icon_color);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -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 */
|
if (!x || !is_power_of_2_i(x)) { /* is_power_of_2_i(x) strips lowest bit */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
if (x & 0xFFFF0000) {
|
if (x & 0xFFFF0000) {
|
||||||
@@ -4542,7 +4512,6 @@ static int findBitIndex(uint x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return idx;
|
return idx;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* autocomplete helper functions */
|
/* autocomplete helper functions */
|
||||||
@@ -4591,7 +4560,7 @@ void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name)
|
|||||||
truncate[a] = 0;
|
truncate[a] = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (truncate[a] != name[a]) {
|
if (truncate[a] != name[a]) {
|
||||||
truncate[a] = 0;
|
truncate[a] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4651,7 +4620,6 @@ static uiBut *uiDefButBit(uiBlock *block,
|
|||||||
if (bitIdx == -1) {
|
if (bitIdx == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return uiDefBut(block,
|
return uiDefBut(block,
|
||||||
type | UI_BUT_POIN_BIT | bitIdx,
|
type | UI_BUT_POIN_BIT | bitIdx,
|
||||||
retval,
|
retval,
|
||||||
@@ -4666,7 +4634,6 @@ static uiBut *uiDefButBit(uiBlock *block,
|
|||||||
a1,
|
a1,
|
||||||
a2,
|
a2,
|
||||||
tip);
|
tip);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
uiBut *uiDefButF(uiBlock *block,
|
uiBut *uiDefButF(uiBlock *block,
|
||||||
int type,
|
int type,
|
||||||
@@ -5038,7 +5005,6 @@ static uiBut *uiDefIconButBit(uiBlock *block,
|
|||||||
if (bitIdx == -1) {
|
if (bitIdx == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return uiDefIconBut(block,
|
return uiDefIconBut(block,
|
||||||
type | UI_BUT_POIN_BIT | bitIdx,
|
type | UI_BUT_POIN_BIT | bitIdx,
|
||||||
retval,
|
retval,
|
||||||
@@ -5053,7 +5019,6 @@ static uiBut *uiDefIconButBit(uiBlock *block,
|
|||||||
a1,
|
a1,
|
||||||
a2,
|
a2,
|
||||||
tip);
|
tip);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uiBut *uiDefIconButF(uiBlock *block,
|
uiBut *uiDefIconButF(uiBlock *block,
|
||||||
@@ -5426,7 +5391,6 @@ static uiBut *uiDefIconTextButBit(uiBlock *block,
|
|||||||
if (bitIdx == -1) {
|
if (bitIdx == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return uiDefIconTextBut(block,
|
return uiDefIconTextBut(block,
|
||||||
type | UI_BUT_POIN_BIT | bitIdx,
|
type | UI_BUT_POIN_BIT | bitIdx,
|
||||||
retval,
|
retval,
|
||||||
@@ -5442,7 +5406,6 @@ static uiBut *uiDefIconTextButBit(uiBlock *block,
|
|||||||
a1,
|
a1,
|
||||||
a2,
|
a2,
|
||||||
tip);
|
tip);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uiBut *uiDefIconTextButF(uiBlock *block,
|
uiBut *uiDefIconTextButF(uiBlock *block,
|
||||||
@@ -5828,7 +5791,7 @@ void UI_block_order_flip(uiBlock *block)
|
|||||||
if (U.uiflag & USER_MENUFIXEDORDER) {
|
if (U.uiflag & USER_MENUFIXEDORDER) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (block->flag & UI_BLOCK_NO_FLIP) {
|
if (block->flag & UI_BLOCK_NO_FLIP) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5994,9 +5957,7 @@ int UI_but_unit_type_get(const uiBut *but)
|
|||||||
if ((ownUnit != 0) || (but->rnaprop == NULL)) {
|
if ((ownUnit != 0) || (but->rnaprop == NULL)) {
|
||||||
return ownUnit << 16;
|
return ownUnit << 16;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop));
|
return RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg)
|
void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg)
|
||||||
|
@@ -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;
|
*r_prop = (but->opptr && but->opptr->data) ? IDP_CopyProperty(but->opptr->data) : NULL;
|
||||||
return but->optype->idname;
|
return but->optype->idname;
|
||||||
}
|
}
|
||||||
else if (but->rnaprop) {
|
|
||||||
|
if (but->rnaprop) {
|
||||||
const PropertyType rnaprop_type = RNA_property_type(but->rnaprop);
|
const PropertyType rnaprop_type = RNA_property_type(but->rnaprop);
|
||||||
|
|
||||||
if (rnaprop_type == PROP_BOOLEAN) {
|
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";
|
return "WM_OT_context_toggle";
|
||||||
}
|
}
|
||||||
else if (rnaprop_type == PROP_ENUM) {
|
if (rnaprop_type == PROP_ENUM) {
|
||||||
/* Enum */
|
/* Enum */
|
||||||
*r_prop = shortcut_property_from_rna(C, but);
|
*r_prop = shortcut_property_from_rna(C, but);
|
||||||
if (*r_prop == NULL) {
|
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(
|
return (bUserMenuItem *)ED_screen_user_menu_item_find_operator(
|
||||||
&um->items, but->optype, prop, but->opcontext);
|
&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 *member_id = WM_context_member_from_ptr(C, &but->rnapoin);
|
||||||
const char *data_path = RNA_path_from_ID_to_struct(&but->rnapoin);
|
const char *data_path = RNA_path_from_ID_to_struct(&but->rnapoin);
|
||||||
const char *member_id_data_path = member_id;
|
const char *member_id_data_path = member_id;
|
||||||
@@ -369,12 +370,10 @@ static bUserMenuItem *ui_but_user_menu_find(bContext *C, uiBut *but, bUserMenu *
|
|||||||
}
|
}
|
||||||
return umi;
|
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);
|
return (bUserMenuItem *)ED_screen_user_menu_item_find_menu(&um->items, mt);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_but_user_menu_add(bContext *C, uiBut *but, bUserMenu *um)
|
static void ui_but_user_menu_add(bContext *C, uiBut *but, bUserMenu *um)
|
||||||
|
@@ -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)) {
|
if (ELEM(NULL, but, but->rnapoin.data, but->rnaprop)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return but;
|
return but;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
@@ -320,9 +320,7 @@ static int eyedropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
|
|||||||
|
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_PASS_THROUGH;
|
return OPERATOR_PASS_THROUGH;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repeat operator */
|
/* Repeat operator */
|
||||||
@@ -338,9 +336,7 @@ static int eyedropper_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_PASS_THROUGH;
|
return OPERATOR_PASS_THROUGH;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool eyedropper_poll(bContext *C)
|
static bool eyedropper_poll(bContext *C)
|
||||||
|
@@ -314,9 +314,7 @@ static int eyedropper_colorband_invoke(bContext *C, wmOperator *op, const wmEven
|
|||||||
|
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repeat operator */
|
/* Repeat operator */
|
||||||
@@ -332,9 +330,7 @@ static int eyedropper_colorband_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool eyedropper_colorband_poll(bContext *C)
|
static bool eyedropper_colorband_poll(bContext *C)
|
||||||
|
@@ -292,13 +292,11 @@ static int datadropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
|||||||
/* Could support finished & undo-skip. */
|
/* Could support finished & undo-skip. */
|
||||||
return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
BKE_report(op->reports, RPT_WARNING, "Failed to set value");
|
BKE_report(op->reports, RPT_WARNING, "Failed to set value");
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (event->type == MOUSEMOVE) {
|
else if (event->type == MOUSEMOVE) {
|
||||||
ID *id = NULL;
|
ID *id = NULL;
|
||||||
|
|
||||||
@@ -326,9 +324,7 @@ static int datadropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED
|
|||||||
|
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repeat operator */
|
/* Repeat operator */
|
||||||
@@ -341,9 +337,7 @@ static int datadropper_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool datadropper_poll(bContext *C)
|
static bool datadropper_poll(bContext *C)
|
||||||
|
@@ -321,9 +321,7 @@ static int depthdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
|
|||||||
|
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repeat operator */
|
/* Repeat operator */
|
||||||
@@ -336,9 +334,7 @@ static int depthdropper_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool depthdropper_poll(bContext *C)
|
static bool depthdropper_poll(bContext *C)
|
||||||
|
@@ -102,7 +102,6 @@ static void driverdropper_sample(bContext *C, wmOperator *op, const wmEvent *eve
|
|||||||
if (but == NULL) {
|
if (but == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* Get paths for src... */
|
/* Get paths for src... */
|
||||||
PointerRNA *target_ptr = &but->rnapoin;
|
PointerRNA *target_ptr = &but->rnapoin;
|
||||||
PropertyRNA *target_prop = but->rnaprop;
|
PropertyRNA *target_prop = but->rnaprop;
|
||||||
@@ -142,7 +141,6 @@ static void driverdropper_sample(bContext *C, wmOperator *op, const wmEvent *eve
|
|||||||
if (dst_path) {
|
if (dst_path) {
|
||||||
MEM_freeN(dst_path);
|
MEM_freeN(dst_path);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void driverdropper_cancel(bContext *C, wmOperator *op)
|
static void driverdropper_cancel(bContext *C, wmOperator *op)
|
||||||
@@ -190,9 +188,7 @@ static int driverdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
|
|||||||
|
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repeat operator */
|
/* Repeat operator */
|
||||||
@@ -205,9 +201,7 @@ static int driverdropper_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool driverdropper_poll(bContext *C)
|
static bool driverdropper_poll(bContext *C)
|
||||||
@@ -215,9 +209,7 @@ static bool driverdropper_poll(bContext *C)
|
|||||||
if (!CTX_wm_window(C)) {
|
if (!CTX_wm_window(C)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_OT_eyedropper_driver(wmOperatorType *ot)
|
void UI_OT_eyedropper_driver(wmOperatorType *ot)
|
||||||
|
@@ -324,9 +324,7 @@ static int eyedropper_gpencil_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||||||
|
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_PASS_THROUGH;
|
return OPERATOR_PASS_THROUGH;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repeat operator */
|
/* Repeat operator */
|
||||||
@@ -340,9 +338,7 @@ static int eyedropper_gpencil_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_PASS_THROUGH;
|
return OPERATOR_PASS_THROUGH;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool eyedropper_gpencil_poll(bContext *C)
|
static bool eyedropper_gpencil_poll(bContext *C)
|
||||||
|
@@ -1384,16 +1384,14 @@ static bool ui_drag_toggle_but_is_supported(const uiBut *but)
|
|||||||
if (ui_but_is_bool(but)) {
|
if (ui_but_is_bool(but)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (UI_but_is_decorator(but)) {
|
if (UI_but_is_decorator(but)) {
|
||||||
return ELEM(but->icon,
|
return ELEM(but->icon,
|
||||||
ICON_DECORATE,
|
ICON_DECORATE,
|
||||||
ICON_DECORATE_KEYFRAME,
|
ICON_DECORATE_KEYFRAME,
|
||||||
ICON_DECORATE_ANIMATE,
|
ICON_DECORATE_ANIMATE,
|
||||||
ICON_DECORATE_OVERRIDE);
|
ICON_DECORATE_OVERRIDE);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Button pushed state to compare if other buttons match. Can be more
|
/* Button pushed state to compare if other buttons match. Can be more
|
||||||
@@ -1404,19 +1402,15 @@ static int ui_drag_toggle_but_pushed_state(bContext *C, uiBut *but)
|
|||||||
if (but->pushed_state_func) {
|
if (but->pushed_state_func) {
|
||||||
return but->pushed_state_func(C, but->pushed_state_arg);
|
return but->pushed_state_func(C, but->pushed_state_arg);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* Assume icon identifies a unique state, for buttons that
|
/* Assume icon identifies a unique state, for buttons that
|
||||||
* work though functions callbacks and don't have an boolean
|
* work though functions callbacks and don't have an boolean
|
||||||
* value that indicates the state. */
|
* value that indicates the state. */
|
||||||
return but->icon + but->iconadd;
|
return but->icon + but->iconadd;
|
||||||
}
|
}
|
||||||
}
|
if (ui_but_is_bool(but)) {
|
||||||
else if (ui_but_is_bool(but)) {
|
|
||||||
return ui_but_is_pushed(but);
|
return ui_but_is_pushed(but);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct uiDragToggleHandle {
|
typedef struct uiDragToggleHandle {
|
||||||
@@ -1582,9 +1576,7 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void
|
|||||||
WM_event_add_mousemove(win);
|
WM_event_add_mousemove(win);
|
||||||
return WM_UI_HANDLER_BREAK;
|
return WM_UI_HANDLER_BREAK;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return WM_UI_HANDLER_CONTINUE;
|
return WM_UI_HANDLER_CONTINUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ui_but_is_drag_toggle(const uiBut *but)
|
static bool ui_but_is_drag_toggle(const uiBut *but)
|
||||||
@@ -2332,9 +2324,7 @@ static bool parse_float_array(char *text, float *values, int expected_length)
|
|||||||
memcpy(values, v, sizeof(float) * expected_length);
|
memcpy(values, v, sizeof(float) * expected_length);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_but_paste_numeric_array(bContext *C,
|
static void ui_but_paste_numeric_array(bContext *C,
|
||||||
@@ -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);
|
button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
|
||||||
return WM_UI_HANDLER_BREAK;
|
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' */
|
/* regular buttons will be 'UI_SELECT', menu items 'UI_ACTIVE' */
|
||||||
if (!(but->flag & (UI_SELECT | UI_ACTIVE))) {
|
if (!(but->flag & (UI_SELECT | UI_ACTIVE))) {
|
||||||
data->cancel = true;
|
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);
|
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||||
return WM_UI_HANDLER_BREAK;
|
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);
|
button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
|
||||||
return WM_UI_HANDLER_BREAK;
|
return WM_UI_HANDLER_BREAK;
|
||||||
}
|
}
|
||||||
@@ -4247,11 +4237,11 @@ static int ui_do_but_HOTKEYEVT(bContext *C,
|
|||||||
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
|
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
|
||||||
return WM_UI_HANDLER_CONTINUE;
|
return WM_UI_HANDLER_CONTINUE;
|
||||||
}
|
}
|
||||||
else if (event->type == EVT_UNKNOWNKEY) {
|
if (event->type == EVT_UNKNOWNKEY) {
|
||||||
WM_report(RPT_WARNING, "Unsupported key: Unknown");
|
WM_report(RPT_WARNING, "Unsupported key: Unknown");
|
||||||
return WM_UI_HANDLER_CONTINUE;
|
return WM_UI_HANDLER_CONTINUE;
|
||||||
}
|
}
|
||||||
else if (event->type == EVT_CAPSLOCKKEY) {
|
if (event->type == EVT_CAPSLOCKKEY) {
|
||||||
WM_report(RPT_WARNING, "Unsupported key: CapsLock");
|
WM_report(RPT_WARNING, "Unsupported key: CapsLock");
|
||||||
return WM_UI_HANDLER_CONTINUE;
|
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);
|
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||||
return WM_UI_HANDLER_BREAK;
|
return WM_UI_HANDLER_BREAK;
|
||||||
}
|
}
|
||||||
else if (event->type == EVT_ESCKEY) {
|
if (event->type == EVT_ESCKEY) {
|
||||||
if (event->val == KM_PRESS) {
|
if (event->val == KM_PRESS) {
|
||||||
data->cancel = true;
|
data->cancel = true;
|
||||||
data->escapecancel = true;
|
data->escapecancel = true;
|
||||||
@@ -4367,7 +4357,7 @@ static int ui_do_but_TAB(
|
|||||||
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
|
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
|
||||||
return WM_UI_HANDLER_BREAK;
|
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;
|
int event_val = (is_property) ? KM_PRESS : KM_CLICK;
|
||||||
if (event->val == event_val) {
|
if (event->val == event_val) {
|
||||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
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);
|
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||||
return WM_UI_HANDLER_BREAK;
|
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 */
|
/* Support alt+wheel on expanded enum rows */
|
||||||
if (but->type == UI_BTYPE_ROW) {
|
if (but->type == UI_BTYPE_ROW) {
|
||||||
const int direction = (event->type == WHEELDOWNMOUSE) ? -1 : 1;
|
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);
|
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
|
||||||
return WM_UI_HANDLER_BREAK;
|
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) {
|
if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) {
|
||||||
const int direction = (event->type == WHEELDOWNMOUSE) ? 1 : -1;
|
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);
|
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
|
||||||
return WM_UI_HANDLER_BREAK;
|
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;
|
ColorPicker *cpicker = but->custom_data;
|
||||||
float hsv_static[3] = {0.0f};
|
float hsv_static[3] = {0.0f};
|
||||||
float *hsv = cpicker ? cpicker->color_data : hsv_static;
|
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);
|
ui_apply_but(C, but->block, but, data, true);
|
||||||
return WM_UI_HANDLER_BREAK;
|
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) {
|
event->val == KM_PRESS) {
|
||||||
Palette *palette = (Palette *)but->rnapoin.owner_id;
|
Palette *palette = (Palette *)but->rnapoin.owner_id;
|
||||||
PaletteColor *color = but->rnapoin.data;
|
PaletteColor *color = but->rnapoin.data;
|
||||||
@@ -6174,7 +6164,7 @@ static int ui_do_but_HSVCUBE(
|
|||||||
return WM_UI_HANDLER_BREAK;
|
return WM_UI_HANDLER_BREAK;
|
||||||
}
|
}
|
||||||
#ifdef WITH_INPUT_NDOF
|
#ifdef WITH_INPUT_NDOF
|
||||||
else if (event->type == NDOF_MOTION) {
|
if (event->type == NDOF_MOTION) {
|
||||||
const wmNDOFMotionData *ndof = event->customdata;
|
const wmNDOFMotionData *ndof = event->customdata;
|
||||||
const enum eSnapType snap = ui_event_to_snap(event);
|
const enum eSnapType snap = ui_event_to_snap(event);
|
||||||
|
|
||||||
@@ -6187,7 +6177,7 @@ static int ui_do_but_HSVCUBE(
|
|||||||
}
|
}
|
||||||
#endif /* WITH_INPUT_NDOF */
|
#endif /* WITH_INPUT_NDOF */
|
||||||
/* XXX hardcoded keymap check.... */
|
/* 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)) {
|
if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) {
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
@@ -6450,7 +6440,7 @@ static int ui_do_but_HSVCIRCLE(
|
|||||||
return WM_UI_HANDLER_BREAK;
|
return WM_UI_HANDLER_BREAK;
|
||||||
}
|
}
|
||||||
#ifdef WITH_INPUT_NDOF
|
#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 enum eSnapType snap = ui_event_to_snap(event);
|
||||||
const wmNDOFMotionData *ndof = event->customdata;
|
const wmNDOFMotionData *ndof = event->customdata;
|
||||||
|
|
||||||
@@ -6463,7 +6453,7 @@ static int ui_do_but_HSVCIRCLE(
|
|||||||
}
|
}
|
||||||
#endif /* WITH_INPUT_NDOF */
|
#endif /* WITH_INPUT_NDOF */
|
||||||
/* XXX hardcoded keymap check.... */
|
/* 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;
|
int len;
|
||||||
|
|
||||||
/* reset only saturation */
|
/* reset only saturation */
|
||||||
@@ -7257,7 +7247,7 @@ static int ui_do_but_HISTOGRAM(
|
|||||||
return WM_UI_HANDLER_BREAK;
|
return WM_UI_HANDLER_BREAK;
|
||||||
}
|
}
|
||||||
/* XXX hardcoded keymap check.... */
|
/* 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;
|
Histogram *hist = (Histogram *)but->poin;
|
||||||
hist->ymax = 1.f;
|
hist->ymax = 1.f;
|
||||||
|
|
||||||
@@ -7333,7 +7323,7 @@ static int ui_do_but_WAVEFORM(
|
|||||||
return WM_UI_HANDLER_BREAK;
|
return WM_UI_HANDLER_BREAK;
|
||||||
}
|
}
|
||||||
/* XXX hardcoded keymap check.... */
|
/* 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 *scopes = (Scopes *)but->poin;
|
||||||
scopes->wavefrm_yfac = 1.f;
|
scopes->wavefrm_yfac = 1.f;
|
||||||
|
|
||||||
@@ -9423,9 +9413,7 @@ static bool ui_menu_pass_event_to_parent_if_nonactive(uiPopupBlockHandle *menu,
|
|||||||
BLI_assert(retval == WM_UI_HANDLER_CONTINUE);
|
BLI_assert(retval == WM_UI_HANDLER_CONTINUE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
|
static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
|
||||||
@@ -10120,12 +10108,10 @@ static int ui_handle_menu_event(bContext *C,
|
|||||||
if (menu->menuretval) {
|
if (menu->menuretval) {
|
||||||
return WM_UI_HANDLER_CONTINUE;
|
return WM_UI_HANDLER_CONTINUE;
|
||||||
}
|
}
|
||||||
else if (inside) {
|
if (inside) {
|
||||||
return WM_UI_HANDLER_BREAK;
|
return WM_UI_HANDLER_BREAK;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ui_handle_menu_return_submenu(bContext *C,
|
static int ui_handle_menu_return_submenu(bContext *C,
|
||||||
@@ -10180,9 +10166,7 @@ static int ui_handle_menu_return_submenu(bContext *C,
|
|||||||
if (menu->menuretval) {
|
if (menu->menuretval) {
|
||||||
return WM_UI_HANDLER_CONTINUE;
|
return WM_UI_HANDLER_CONTINUE;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return WM_UI_HANDLER_BREAK;
|
return WM_UI_HANDLER_BREAK;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ui_but_pie_menu_supported_apply(uiBut *but)
|
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);
|
button_activate_init(C, menu->region, but, BUTTON_ACTIVATE_OPEN);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
menu->menuretval = UI_RETURN_CANCEL;
|
menu->menuretval = UI_RETURN_CANCEL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
ui_apply_but(C, but->block, but, but->active, false);
|
ui_apply_but(C, but->block, but, but->active, false);
|
||||||
button_activate_exit((bContext *)C, but, but->active, false, true);
|
button_activate_exit((bContext *)C, but, but->active, false, true);
|
||||||
@@ -10998,9 +10980,7 @@ bool UI_textbutton_activate_rna(const bContext *C,
|
|||||||
UI_but_active_only(C, region, block, but);
|
UI_but_active_only(C, region, block, but);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut)
|
bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut)
|
||||||
@@ -11025,9 +11005,7 @@ bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut)
|
|||||||
UI_but_active_only(C, region, block, but);
|
UI_but_active_only(C, region, block, but);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
@@ -593,10 +593,10 @@ int UI_icon_from_event_type(short event_type, short event_value)
|
|||||||
if (event_type == LEFTMOUSE) {
|
if (event_type == LEFTMOUSE) {
|
||||||
return ELEM(event_value, KM_CLICK, KM_PRESS) ? ICON_MOUSE_LMB : ICON_MOUSE_LMB_DRAG;
|
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;
|
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;
|
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;
|
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);
|
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 uint tool_offset = BKE_paint_get_brush_tool_offset_from_paintmode(paint_mode);
|
||||||
const int tool_type = *(char *)POINTER_OFFSET(br, tool_offset);
|
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) {
|
if (id->tag & LIB_TAG_MISSING) {
|
||||||
return ICON_LIBRARY_DATA_BROKEN;
|
return ICON_LIBRARY_DATA_BROKEN;
|
||||||
}
|
}
|
||||||
else if (id->tag & LIB_TAG_INDIRECT) {
|
if (id->tag & LIB_TAG_INDIRECT) {
|
||||||
return ICON_LIBRARY_DATA_INDIRECT;
|
return ICON_LIBRARY_DATA_INDIRECT;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return ICON_LIBRARY_DATA_DIRECT;
|
return ICON_LIBRARY_DATA_DIRECT;
|
||||||
}
|
}
|
||||||
}
|
if (ID_IS_OVERRIDE_LIBRARY(id)) {
|
||||||
else if (ID_IS_OVERRIDE_LIBRARY(id)) {
|
|
||||||
return ICON_LIBRARY_DATA_OVERRIDE;
|
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) {
|
if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) {
|
||||||
return ICON_SHADING_TEXTURE;
|
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;
|
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;
|
return ICON_FILE_IMAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -250,28 +250,23 @@ static int ui_item_fit(
|
|||||||
if (is_last) {
|
if (is_last) {
|
||||||
return available - pos;
|
return available - pos;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
float width = *extra_pixel + (item * available) / (float)all;
|
float width = *extra_pixel + (item * available) / (float)all;
|
||||||
*extra_pixel = width - (int)width;
|
*extra_pixel = width - (int)width;
|
||||||
return (int)width;
|
return (int)width;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* contents is smaller or equal to available space */
|
/* contents is smaller or equal to available space */
|
||||||
if (alignment == UI_LAYOUT_ALIGN_EXPAND) {
|
if (alignment == UI_LAYOUT_ALIGN_EXPAND) {
|
||||||
if (is_last) {
|
if (is_last) {
|
||||||
return available - pos;
|
return available - pos;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
float width = *extra_pixel + (item * available) / (float)all;
|
float width = *extra_pixel + (item * available) / (float)all;
|
||||||
*extra_pixel = width - (int)width;
|
*extra_pixel = width - (int)width;
|
||||||
return (int)width;
|
return (int)width;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
return item;
|
return item;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* variable button size in which direction? */
|
/* variable button size in which direction? */
|
||||||
@@ -323,9 +318,7 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, bool
|
|||||||
}
|
}
|
||||||
return UI_fontstyle_string_width(fstyle, name) + (unit_x * margin);
|
return UI_fontstyle_string_width(fstyle, name) + (unit_x * margin);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return unit_x * 10;
|
return unit_x * 10;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_item_size(uiItem *item, int *r_w, int *r_h)
|
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 since rest of items is handled in new pie level */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
last_iter = true;
|
last_iter = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
continue;
|
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);
|
RNA_warning("not an enum property: %s.%s", RNA_struct_identifier(ptr->type), propname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
const EnumPropertyItem *item;
|
const EnumPropertyItem *item;
|
||||||
int totitem, i;
|
int totitem, i;
|
||||||
bool free;
|
bool free;
|
||||||
@@ -2616,7 +2607,6 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
|
|||||||
if (free) {
|
if (free) {
|
||||||
MEM_freeN((void *)item);
|
MEM_freeN((void *)item);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* intentionally don't touch UI_BLOCK_IS_FLIP here,
|
/* intentionally don't touch UI_BLOCK_IS_FLIP here,
|
||||||
* we don't know the context this is called in */
|
* 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;
|
return split_wrapper.decorate_column;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
char namestr[UI_MAX_NAME_STR];
|
char namestr[UI_MAX_NAME_STR];
|
||||||
if (text) {
|
if (text) {
|
||||||
text = ui_item_name_add_colon(text, namestr);
|
text = ui_item_name_add_colon(text, namestr);
|
||||||
@@ -3207,7 +3197,6 @@ uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int
|
|||||||
uiItemL_(layout, text, icon);
|
uiItemL_(layout, text, icon);
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon)
|
void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon)
|
||||||
@@ -5046,9 +5035,7 @@ int uiLayoutGetEmboss(uiLayout *layout)
|
|||||||
if (layout->emboss == UI_EMBOSS_UNDEFINED) {
|
if (layout->emboss == UI_EMBOSS_UNDEFINED) {
|
||||||
return layout->root->block->dt;
|
return layout->root->block->dt;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return layout->emboss;
|
return layout->emboss;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
@@ -5516,9 +5503,7 @@ MenuType *UI_but_menutype_get(uiBut *but)
|
|||||||
if (but->menu_create_func == ui_item_menutype_func) {
|
if (but->menu_create_func == ui_item_menutype_func) {
|
||||||
return (MenuType *)but->poin;
|
return (MenuType *)but->poin;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this is a bit of a hack but best keep it in one place at least */
|
/* this is a bit of a hack but best keep it in one place at least */
|
||||||
@@ -5527,9 +5512,7 @@ PanelType *UI_but_paneltype_get(uiBut *but)
|
|||||||
if (but->menu_create_func == ui_item_paneltype_func) {
|
if (but->menu_create_func == ui_item_paneltype_func) {
|
||||||
return (PanelType *)but->poin;
|
return (PanelType *)but->poin;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_menutype_draw(bContext *C, MenuType *mt, struct uiLayout *layout)
|
void UI_menutype_draw(bContext *C, MenuType *mt, struct uiLayout *layout)
|
||||||
|
@@ -209,11 +209,10 @@ static int copy_as_driver_button_exec(bContext *C, wmOperator *op)
|
|||||||
MEM_freeN(path);
|
MEM_freeN(path);
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
BKE_reportf(op->reports, RPT_ERROR, "Could not compute a valid data path");
|
BKE_reportf(op->reports, RPT_ERROR, "Could not compute a valid data path");
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
@@ -312,9 +311,7 @@ static int operator_button_property_finish(bContext *C, PointerRNA *ptr, Propert
|
|||||||
/* do nothing, go ahead with undo */
|
/* do nothing, go ahead with undo */
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool reset_default_button_poll(bContext *C)
|
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;
|
success = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (RNA_property_copy(bmain, &lptr, &ptr, prop, (all) ? -1 : index)) {
|
if (RNA_property_copy(bmain, &lptr, &ptr, prop, (all) ? -1 : index)) {
|
||||||
RNA_property_update(C, &lptr, prop);
|
RNA_property_update(C, &lptr, prop);
|
||||||
success = true;
|
success = true;
|
||||||
@@ -1015,7 +1011,6 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
MEM_SAFE_FREE(path);
|
MEM_SAFE_FREE(path);
|
||||||
BLI_freelistN(&lb);
|
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);
|
return jump_to_target_ptr(C, target_ptr, poll);
|
||||||
}
|
}
|
||||||
/* For string properties with prop_search, look up the search collection item. */
|
/* 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);
|
const uiBut *but = UI_context_active_but_get(C);
|
||||||
|
|
||||||
if (but->type == UI_BTYPE_SEARCH_MENU && but->search &&
|
if (but->type == UI_BTYPE_SEARCH_MENU && but->search &&
|
||||||
@@ -1265,9 +1260,7 @@ static bool ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b)
|
|||||||
STREQLEN(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR)) {
|
STREQLEN(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_editsource_active_but_test(uiBut *but)
|
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);
|
BKE_reportf(op->reports, RPT_WARNING, "File '%s' cannot be opened", filepath);
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* naughty!, find text area to set, not good behavior
|
/* naughty!, find text area to set, not good behavior
|
||||||
* but since this is a dev tool lets allow it - campbell */
|
* 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);
|
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);
|
txt_move_toline(text, line - 1, false);
|
||||||
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
|
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
|
||||||
}
|
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -1397,10 +1389,9 @@ static int editsource_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
BKE_report(op->reports, RPT_ERROR, "Active button not found");
|
BKE_report(op->reports, RPT_ERROR, "Active button not found");
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UI_OT_editsource(wmOperatorType *ot)
|
static void UI_OT_editsource(wmOperatorType *ot)
|
||||||
@@ -1585,10 +1576,9 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
BKE_report(op->reports, RPT_ERROR, "Active button not found");
|
BKE_report(op->reports, RPT_ERROR, "Active button not found");
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UI_OT_edittranslation_init(wmOperatorType *ot)
|
static void UI_OT_edittranslation_init(wmOperatorType *ot)
|
||||||
|
@@ -147,16 +147,16 @@ static int panel_aligned(const ScrArea *area, const ARegion *region)
|
|||||||
if (area->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) {
|
if (area->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) {
|
||||||
return BUT_VERTICAL;
|
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;
|
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;
|
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;
|
return BUT_VERTICAL;
|
||||||
}
|
}
|
||||||
else if (ELEM(region->regiontype,
|
if (ELEM(region->regiontype,
|
||||||
RGN_TYPE_UI,
|
RGN_TYPE_UI,
|
||||||
RGN_TYPE_TOOLS,
|
RGN_TYPE_TOOLS,
|
||||||
RGN_TYPE_TOOL_PROPS,
|
RGN_TYPE_TOOL_PROPS,
|
||||||
@@ -1323,9 +1323,7 @@ static int get_panel_real_ofsy(Panel *panel)
|
|||||||
if (panel->flag & PNL_CLOSEDY) {
|
if (panel->flag & PNL_CLOSEDY) {
|
||||||
return panel->ofsy + panel->sizey;
|
return panel->ofsy + panel->sizey;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return panel->ofsy;
|
return panel->ofsy;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_panel_real_ofsx(Panel *panel)
|
static int get_panel_real_ofsx(Panel *panel)
|
||||||
@@ -1333,9 +1331,7 @@ static int get_panel_real_ofsx(Panel *panel)
|
|||||||
if (panel->flag & PNL_CLOSEDX) {
|
if (panel->flag & PNL_CLOSEDX) {
|
||||||
return panel->ofsx + get_panel_header(panel);
|
return panel->ofsx + get_panel_header(panel);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return panel->ofsx + panel->sizex;
|
return panel->ofsx + panel->sizex;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UI_panel_is_dragging(const struct Panel *panel)
|
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) {
|
if (ps1->panel->ofsx > ps2->panel->ofsx) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (ps1->panel->ofsx < ps2->panel->ofsx) {
|
if (ps1->panel->ofsx < ps2->panel->ofsx) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (ps1->panel->sortorder > ps2->panel->sortorder) {
|
if (ps1->panel->sortorder > ps2->panel->sortorder) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (ps1->panel->sortorder < ps2->panel->sortorder) {
|
if (ps1->panel->sortorder < ps2->panel->sortorder) {
|
||||||
return -1;
|
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) {
|
if (ps1->panel->type->flag & PNL_NO_HEADER && ps2->panel->type->flag & PNL_NO_HEADER) {
|
||||||
/* skip and check for ofs and sortorder below */
|
/* 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;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (ps2->panel->type->flag & PNL_NO_HEADER) {
|
if (ps2->panel->type->flag & PNL_NO_HEADER) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (ps1->panel->sortorder > ps2->panel->sortorder) {
|
if (ps1->panel->sortorder > ps2->panel->sortorder) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (ps1->panel->sortorder < ps2->panel->sortorder) {
|
if (ps1->panel->sortorder < ps2->panel->sortorder) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1415,7 +1411,7 @@ static int compare_panel(const void *a1, const void *a2)
|
|||||||
if (ps1->panel->sortorder > ps2->panel->sortorder) {
|
if (ps1->panel->sortorder > ps2->panel->sortorder) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (ps1->panel->sortorder < ps2->panel->sortorder) {
|
if (ps1->panel->sortorder < ps2->panel->sortorder) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2838,7 +2834,7 @@ int ui_handler_panel_region(bContext *C,
|
|||||||
retval = WM_UI_HANDLER_BREAK;
|
retval = WM_UI_HANDLER_BREAK;
|
||||||
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);
|
panel_activate_state(C, panel, PANEL_STATE_DRAG_SCALE);
|
||||||
retval = WM_UI_HANDLER_BREAK;
|
retval = WM_UI_HANDLER_BREAK;
|
||||||
break;
|
break;
|
||||||
@@ -2993,9 +2989,7 @@ static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata)
|
|||||||
if (data && data->state == PANEL_STATE_ANIMATION) {
|
if (data && data->state == PANEL_STATE_ANIMATION) {
|
||||||
return WM_UI_HANDLER_CONTINUE;
|
return WM_UI_HANDLER_CONTINUE;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return WM_UI_HANDLER_BREAK;
|
return WM_UI_HANDLER_BREAK;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_handler_remove_panel(bContext *C, void *userdata)
|
static void ui_handler_remove_panel(bContext *C, void *userdata)
|
||||||
|
@@ -107,9 +107,7 @@ bool UI_but_is_utf8(const uiBut *but)
|
|||||||
const int subtype = RNA_property_subtype(but->rnaprop);
|
const int subtype = RNA_property_subtype(but->rnaprop);
|
||||||
return !(ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME, PROP_BYTESTRING));
|
return !(ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME, PROP_BYTESTRING));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return !(but->flag & UI_BUT_NO_UTF8);
|
return !(but->flag & UI_BUT_NO_UTF8);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_UI_POPOVER_ONCE
|
#ifdef USE_UI_POPOVER_ONCE
|
||||||
@@ -171,9 +169,7 @@ int ui_but_icon(const uiBut *but)
|
|||||||
if (but->drawflag & UI_BUT_ICON_REVERSE) {
|
if (but->drawflag & UI_BUT_ICON_REVERSE) {
|
||||||
return but->icon - but->iconadd;
|
return but->icon - but->iconadd;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return but->icon + but->iconadd;
|
return but->icon + but->iconadd;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
@@ -77,12 +77,11 @@ int ui_but_menu_step(uiBut *but, int direction)
|
|||||||
if (but->menu_step_func) {
|
if (but->menu_step_func) {
|
||||||
return but->menu_step_func(but->block->evil_C, direction, but->poin);
|
return but->menu_step_func(but->block->evil_C, direction, but->poin);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
const int curval = RNA_property_enum_get(&but->rnapoin, but->rnaprop);
|
const int curval = RNA_property_enum_get(&but->rnapoin, but->rnaprop);
|
||||||
return RNA_property_enum_step(
|
return RNA_property_enum_step(
|
||||||
but->block->evil_C, &but->rnapoin, but->rnaprop, curval, direction);
|
but->block->evil_C, &but->rnapoin, but->rnaprop, curval, direction);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
printf("%s: cannot cycle button '%s'\n", __func__, but->str);
|
printf("%s: cannot cycle button '%s'\n", __func__, but->str);
|
||||||
return 0;
|
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);
|
mem[hash_mod] = ui_popup_string_hash(but->str, but->flag & UI_BUT_HAS_SEP_CHAR);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* get */
|
/* get */
|
||||||
for (but = block->buttons.first; but; but = but->next) {
|
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)) {
|
if (mem[hash_mod] == ui_popup_string_hash(but->str, but->flag & UI_BUT_HAS_SEP_CHAR)) {
|
||||||
@@ -138,7 +137,6 @@ static uiBut *ui_popup_menu_memory__internal(uiBlock *block, uiBut *but)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uiBut *ui_popup_menu_memory_get(uiBlock *block)
|
uiBut *ui_popup_menu_memory_get(uiBlock *block)
|
||||||
@@ -488,13 +486,11 @@ bool UI_popup_menu_end_or_cancel(bContext *C, uiPopupMenu *pup)
|
|||||||
UI_popup_menu_end(C, pup);
|
UI_popup_menu_end(C, pup);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
UI_block_layout_resolve(pup->block, NULL, NULL);
|
UI_block_layout_resolve(pup->block, NULL, NULL);
|
||||||
MEM_freeN(pup->block->handle);
|
MEM_freeN(pup->block->handle);
|
||||||
UI_block_free(C, pup->block);
|
UI_block_free(C, pup->block);
|
||||||
MEM_freeN(pup);
|
MEM_freeN(pup);
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uiLayout *UI_popup_menu_layout(uiPopupMenu *pup)
|
uiLayout *UI_popup_menu_layout(uiPopupMenu *pup)
|
||||||
|
@@ -292,16 +292,14 @@ bool ui_searchbox_apply(uiBut *but, ARegion *region)
|
|||||||
|
|
||||||
return true;
|
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 is valid for _VALUE_CLEAR flavor to have no active element
|
||||||
* (it's a valid way to unlink). */
|
* (it's a valid way to unlink). */
|
||||||
but->editstr[0] = '\0';
|
but->editstr[0] = '\0';
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ARegion *wm_searchbox_tooltip_init(struct bContext *C,
|
static struct ARegion *wm_searchbox_tooltip_init(struct bContext *C,
|
||||||
|
@@ -763,9 +763,7 @@ static uiTooltipData *ui_tooltip_data_from_tool(bContext *C, uiBut *but, bool is
|
|||||||
MEM_freeN(data);
|
MEM_freeN(data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return data;
|
return data;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but)
|
static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but)
|
||||||
@@ -1045,9 +1043,7 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but)
|
|||||||
MEM_freeN(data);
|
MEM_freeN(data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return data;
|
return data;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uiTooltipData *ui_tooltip_data_from_gizmo(bContext *C, wmGizmo *gz)
|
static uiTooltipData *ui_tooltip_data_from_gizmo(bContext *C, wmGizmo *gz)
|
||||||
@@ -1144,9 +1140,7 @@ static uiTooltipData *ui_tooltip_data_from_gizmo(bContext *C, wmGizmo *gz)
|
|||||||
MEM_freeN(data);
|
MEM_freeN(data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return data;
|
return data;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ARegion *ui_tooltip_create_with_data(bContext *C,
|
static ARegion *ui_tooltip_create_with_data(bContext *C,
|
||||||
|
@@ -346,7 +346,7 @@ static void menu_types_add_from_keymap_items(bContext *C,
|
|||||||
continue;
|
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;
|
wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base;
|
||||||
wmKeyMap *keymap = WM_event_get_keymap_from_handler(wm, handler);
|
wmKeyMap *keymap = WM_event_get_keymap_from_handler(wm, handler);
|
||||||
if (keymap && WM_keymap_poll(C, keymap)) {
|
if (keymap && WM_keymap_poll(C, keymap)) {
|
||||||
|
@@ -1152,9 +1152,7 @@ ID *UI_context_active_but_get_tab_ID(bContext *C)
|
|||||||
if (but && but->type == UI_BTYPE_TAB) {
|
if (but && but->type == UI_BTYPE_TAB) {
|
||||||
return but->custom_data;
|
return but->custom_data;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void template_ID_tabs(const bContext *C,
|
static void template_ID_tabs(const bContext *C,
|
||||||
@@ -1847,9 +1845,7 @@ static Object *get_context_object(const bContext *C)
|
|||||||
if (sbuts != NULL && (sbuts->pinid != NULL) && GS(sbuts->pinid->name) == ID_OB) {
|
if (sbuts != NULL && (sbuts->pinid != NULL) && GS(sbuts->pinid->name) == ID_OB) {
|
||||||
return (Object *)sbuts->pinid;
|
return (Object *)sbuts->pinid;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return CTX_data_active_object(C);
|
return CTX_data_active_object(C);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void modifier_panel_id(void *md_link, char *r_name)
|
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");
|
UI_block_lock_set(block, true, "Operator can't' redo");
|
||||||
return return_info;
|
return return_info;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* useful for macros where only one of the steps can't be re-done */
|
/* useful for macros where only one of the steps can't be re-done */
|
||||||
UI_block_lock_clear(block);
|
UI_block_lock_clear(block);
|
||||||
}
|
|
||||||
|
|
||||||
if (layout_flags & UI_TEMPLATE_OP_PROPS_SHOW_TITLE) {
|
if (layout_flags & UI_TEMPLATE_OP_PROPS_SHOW_TITLE) {
|
||||||
uiItemL(layout, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
|
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;
|
selection_y = &point->y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (profile->path[i].flag & PROF_H1_SELECT) {
|
if (profile->path[i].flag & PROF_H1_SELECT) {
|
||||||
point = &profile->path[i];
|
point = &profile->path[i];
|
||||||
selection_x = &point->h1_loc[0];
|
selection_x = &point->h1_loc[0];
|
||||||
selection_y = &point->h1_loc[1];
|
selection_y = &point->h1_loc[1];
|
||||||
@@ -6630,47 +6625,47 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
|
|||||||
owner = scene;
|
owner = scene;
|
||||||
break;
|
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;
|
handle_event = B_STOPSEQ;
|
||||||
icon = ICON_SEQUENCE;
|
icon = ICON_SEQUENCE;
|
||||||
break;
|
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;
|
handle_event = B_STOPCLIP;
|
||||||
icon = ICON_TRACKER;
|
icon = ICON_TRACKER;
|
||||||
break;
|
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;
|
handle_event = B_STOPCLIP;
|
||||||
icon = ICON_TRACKER;
|
icon = ICON_TRACKER;
|
||||||
break;
|
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;
|
handle_event = B_STOPCLIP;
|
||||||
icon = ICON_TRACKER;
|
icon = ICON_TRACKER;
|
||||||
break;
|
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;
|
handle_event = B_STOPCLIP;
|
||||||
icon = ICON_TRACKER;
|
icon = ICON_TRACKER;
|
||||||
break;
|
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;
|
handle_event = B_STOPFILE;
|
||||||
icon = ICON_FILEBROWSER;
|
icon = ICON_FILEBROWSER;
|
||||||
break;
|
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;
|
handle_event = B_STOPRENDER;
|
||||||
icon = ICON_SCENE;
|
icon = ICON_SCENE;
|
||||||
break;
|
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;
|
handle_event = B_STOPCOMPO;
|
||||||
icon = ICON_RENDERLAYERS;
|
icon = ICON_RENDERLAYERS;
|
||||||
break;
|
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)) {
|
WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE)) {
|
||||||
/* Skip bake jobs in compositor to avoid compo header displaying
|
/* Skip bake jobs in compositor to avoid compo header displaying
|
||||||
* progress bar which is not being updated (bake jobs only need
|
* progress bar which is not being updated (bake jobs only need
|
||||||
@@ -6681,23 +6676,24 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
|
|||||||
icon = ICON_IMAGE;
|
icon = ICON_IMAGE;
|
||||||
break;
|
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;
|
handle_event = B_STOPOTHER;
|
||||||
icon = ICON_MOD_DYNAMICPAINT;
|
icon = ICON_MOD_DYNAMICPAINT;
|
||||||
break;
|
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;
|
handle_event = B_STOPOTHER;
|
||||||
icon = ICON_PHYSICS;
|
icon = ICON_PHYSICS;
|
||||||
break;
|
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;
|
handle_event = B_STOPOTHER;
|
||||||
icon = ICON_MOD_FLUIDSIM;
|
icon = ICON_MOD_FLUIDSIM;
|
||||||
break;
|
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;
|
handle_event = B_STOPOTHER;
|
||||||
icon = ICON_MOD_OCEAN;
|
icon = ICON_MOD_OCEAN;
|
||||||
break;
|
break;
|
||||||
|
@@ -88,9 +88,7 @@ const char *ui_textedit_undo(uiUndoStack_Text *stack, int direction, int *r_curs
|
|||||||
if (direction < 0) {
|
if (direction < 0) {
|
||||||
return ui_textedit_undo_impl(stack, r_cursor_index);
|
return ui_textedit_undo_impl(stack, r_cursor_index);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return ui_textedit_redo_impl(stack, r_cursor_index);
|
return ui_textedit_redo_impl(stack, r_cursor_index);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -60,13 +60,9 @@ bool ui_str_has_word_prefix(const char *haystack, const char *needle, size_t nee
|
|||||||
if ((match == haystack) || (*(match - 1) == ' ') || ispunct(*(match - 1))) {
|
if ((match == haystack) || (*(match - 1) == ' ') || ispunct(*(match - 1))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return ui_str_has_word_prefix(match + 1, needle, needle_len);
|
return ui_str_has_word_prefix(match + 1, needle, needle_len);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************** RNA Utilities ******************************/
|
/*************************** RNA Utilities ******************************/
|
||||||
@@ -397,9 +393,7 @@ static int sort_search_items_list(const void *a, const void *b)
|
|||||||
if (BLI_strcasecmp(cis1->name, cis2->name) > 0) {
|
if (BLI_strcasecmp(cis1->name, cis2->name) > 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_rna_collection_search_update_fn(const struct bContext *C,
|
void ui_rna_collection_search_update_fn(const struct bContext *C,
|
||||||
@@ -535,10 +529,8 @@ int UI_icon_from_id(ID *id)
|
|||||||
if (ob->type == OB_EMPTY) {
|
if (ob->type == OB_EMPTY) {
|
||||||
return ICON_EMPTY_DATA;
|
return ICON_EMPTY_DATA;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return UI_icon_from_id(ob->data);
|
return UI_icon_from_id(ob->data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* otherwise get it through RNA, creating the pointer
|
/* otherwise get it through RNA, creating the pointer
|
||||||
* will set the right type, also with subclassing */
|
* will set the right type, also with subclassing */
|
||||||
@@ -553,15 +545,13 @@ int UI_icon_from_report_type(int type)
|
|||||||
if (type & RPT_ERROR_ALL) {
|
if (type & RPT_ERROR_ALL) {
|
||||||
return ICON_ERROR;
|
return ICON_ERROR;
|
||||||
}
|
}
|
||||||
else if (type & RPT_WARNING_ALL) {
|
if (type & RPT_WARNING_ALL) {
|
||||||
return ICON_ERROR;
|
return ICON_ERROR;
|
||||||
}
|
}
|
||||||
else if (type & RPT_INFO_ALL) {
|
if (type & RPT_INFO_ALL) {
|
||||||
return ICON_INFO;
|
return ICON_INFO;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return ICON_NONE;
|
return ICON_NONE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************** Misc **************************************/
|
/********************************** 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));
|
RNA_property_identifier(but->rnaprop));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (but->optype) {
|
if (but->optype) {
|
||||||
WM_operator_py_idname(r_str, but->optype->idname);
|
WM_operator_py_idname(r_str, but->optype->idname);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -1408,7 +1408,7 @@ bool UI_GetIconThemeColor4ubv(int colorid, uchar col[4])
|
|||||||
if (colorid == 0) {
|
if (colorid == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (colorid == TH_ICON_FUND) {
|
if (colorid == TH_ICON_FUND) {
|
||||||
/* Always color development fund icon. */
|
/* Always color development fund icon. */
|
||||||
}
|
}
|
||||||
else if (!((theme_spacetype == SPACE_OUTLINER && theme_regionid == RGN_TYPE_WINDOW) ||
|
else if (!((theme_spacetype == SPACE_OUTLINER && theme_regionid == RGN_TYPE_WINDOW) ||
|
||||||
|
@@ -74,12 +74,10 @@ BLI_INLINE int clamp_float_to_int(const float f)
|
|||||||
if (UNLIKELY(f < min)) {
|
if (UNLIKELY(f < min)) {
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
else if (UNLIKELY(f > max)) {
|
if (UNLIKELY(f > max)) {
|
||||||
return (int)max;
|
return (int)max;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return (int)f;
|
return (int)f;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1756,12 +1754,11 @@ bool UI_view2d_view_to_region_clip(
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* set initial value in case coordinate lies outside of bounds */
|
/* set initial value in case coordinate lies outside of bounds */
|
||||||
*r_region_x = *r_region_y = V2D_IS_CLIPPED;
|
*r_region_x = *r_region_y = V2D_IS_CLIPPED;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1855,11 +1852,9 @@ bool UI_view2d_view_to_region_rcti_clip(const View2D *v2d, const rctf *rect_src,
|
|||||||
|
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
@@ -428,9 +428,7 @@ float UI_view2d_grid_resolution_x__frames_or_seconds(const struct View2D *v2d,
|
|||||||
if (display_seconds) {
|
if (display_seconds) {
|
||||||
return view2d_major_step_x__time(v2d, scene);
|
return view2d_major_step_x__time(v2d, scene);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return view2d_major_step_x__continuous(v2d);
|
return view2d_major_step_x__continuous(v2d);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float UI_view2d_grid_resolution_y__values(const struct View2D *v2d)
|
float UI_view2d_grid_resolution_y__values(const struct View2D *v2d)
|
||||||
|
@@ -1608,7 +1608,7 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||||||
if (event->type != NDOF_MOTION) {
|
if (event->type != NDOF_MOTION) {
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
const wmNDOFMotionData *ndof = event->customdata;
|
const wmNDOFMotionData *ndof = event->customdata;
|
||||||
|
|
||||||
/* tune these until it feels right */
|
/* tune these until it feels right */
|
||||||
@@ -1658,7 +1658,6 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VIEW2D_OT_ndof(wmOperatorType *ot)
|
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) {
|
if (in_bar) {
|
||||||
return SCROLLHANDLE_BAR;
|
return SCROLLHANDLE_BAR;
|
||||||
}
|
}
|
||||||
else if (in_max) {
|
if (in_max) {
|
||||||
return SCROLLHANDLE_MAX;
|
return SCROLLHANDLE_MAX;
|
||||||
}
|
}
|
||||||
else if (in_min) {
|
if (in_min) {
|
||||||
return SCROLLHANDLE_MIN;
|
return SCROLLHANDLE_MIN;
|
||||||
}
|
}
|
||||||
else if (out_min) {
|
if (out_min) {
|
||||||
return SCROLLHANDLE_MIN_OUTSIDE;
|
return SCROLLHANDLE_MIN_OUTSIDE;
|
||||||
}
|
}
|
||||||
else if (out_max) {
|
if (out_max) {
|
||||||
return SCROLLHANDLE_MAX_OUTSIDE;
|
return SCROLLHANDLE_MAX_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2323,11 +2322,10 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
|
|||||||
WM_event_add_modal_handler(C, op);
|
WM_event_add_modal_handler(C, op);
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* not in scroller, so nothing happened...
|
/* not in scroller, so nothing happened...
|
||||||
* (pass through let's something else catch event) */
|
* (pass through let's something else catch event) */
|
||||||
return OPERATOR_PASS_THROUGH;
|
return OPERATOR_PASS_THROUGH;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LMB-Drag in Scrollers - not repeatable operator! */
|
/* LMB-Drag in Scrollers - not repeatable operator! */
|
||||||
|
Reference in New Issue
Block a user