diff options
Diffstat (limited to 'source/blender/editors/interface')
35 files changed, 272 insertions, 755 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index f1c207d7326..27ec600943b 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -202,7 +202,6 @@ float ui_block_to_window_scale(const ARegion *region, uiBlock *block) return max_y - min_y; } -/* for mouse cursor */ void ui_window_to_block_fl(const ARegion *region, uiBlock *block, float *r_x, float *r_y) { const int getsizex = BLI_rcti_size_x(®ion->winrct) + 1; @@ -356,10 +355,6 @@ static void ui_update_window_matrix(const wmWindow *window, const ARegion *regio } } -/** - * Popups will add a margin to #ARegion.winrct for shadow, - * for interactivity (point-inside tests for eg), we want the winrct without the margin added. - */ void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect) { uiBlock *block = region->uiblocks.first; @@ -600,7 +595,6 @@ static void ui_block_bounds_calc_popup( } } -/* used for various cases */ void UI_block_bounds_set_normal(uiBlock *block, int addval) { if (block == NULL) { @@ -611,14 +605,12 @@ void UI_block_bounds_set_normal(uiBlock *block, int addval) block->bounds_type = UI_BLOCK_BOUNDS; } -/* Used for pull-downs. */ void UI_block_bounds_set_text(uiBlock *block, int addval) { block->bounds = addval; block->bounds_type = UI_BLOCK_BOUNDS_TEXT; } -/* used for block popups */ void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offset[2]) { block->bounds = addval; @@ -633,7 +625,6 @@ void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offs } } -/* used for menu popups */ void UI_block_bounds_set_menu(uiBlock *block, int addval, const int bounds_offset[2]) { block->bounds = addval; @@ -646,7 +637,6 @@ void UI_block_bounds_set_menu(uiBlock *block, int addval, const int bounds_offse } } -/* used for centered popups, i.e. splash */ void UI_block_bounds_set_centered(uiBlock *block, int addval) { block->bounds = addval; @@ -988,11 +978,6 @@ static bool ui_but_update_from_old_block(const bContext *C, return found_active; } -/** - * Needed for temporarily rename buttons, such as in outliner or file-select, - * they should keep calling #uiDefBut to keep them alive. - * \return false when button removed. - */ bool UI_but_active_only_ex( const bContext *C, ARegion *region, uiBlock *block, uiBut *but, const bool remove_on_failure) { @@ -1040,10 +1025,6 @@ bool UI_but_active_only(const bContext *C, ARegion *region, uiBlock *block, uiBu return UI_but_active_only_ex(C, region, block, but, true); } -/** - * \warning This must run after other handlers have been added, - * otherwise the handler won't be removed, see: T71112. - */ bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, uiBlock *block) { /* Running this command before end-block has run, means buttons that open menus @@ -1074,7 +1055,6 @@ bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, ui return done; } -/* simulate button click */ void UI_but_execute(const bContext *C, ARegion *region, uiBut *but) { void *active_back; @@ -1187,9 +1167,6 @@ static void ui_menu_block_set_keyaccels(uiBlock *block) } } -/* XXX, this code will shorten any allocated string to 'UI_MAX_NAME_STR' - * since this is really long its unlikely to be an issue, - * but this could be supported */ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_strip) { if (do_strip && (but->flag & UI_BUT_HAS_SEP_CHAR)) { @@ -1856,11 +1833,6 @@ static void ui_but_validate(const uiBut *but) } #endif -/** - * Check if the operator \a ot poll is successful with the context given by \a but (optionally). - * \param but: The button that might store context. Can be NULL for convenience (e.g. if there is - * no button to take context from, but we still want to poll the operator). - */ bool ui_but_context_poll_operator_ex(bContext *C, const uiBut *but, const wmOperatorCallParams *optype_params) @@ -2016,7 +1988,6 @@ static bool ui_but_pixelrect_in_view(const ARegion *region, const rcti *rect) return BLI_rcti_isect(®ion->winrct, &rect_winspace, NULL); } -/* uses local copy of style, to scale things down, and allow widgets to change stuff */ void UI_block_draw(const bContext *C, uiBlock *block) { uiStyle style = *UI_style_get_dpi(); /* XXX pass on as arg */ @@ -2138,11 +2109,6 @@ void UI_region_message_subscribe(ARegion *region, struct wmMsgBus *mbus) /* ************* EVENTS ************* */ -/** - * Check if the button is pushed, this is only meaningful for some button types. - * - * \return (0 == UNSELECT), (1 == SELECT), (-1 == DO-NOTHING) - */ int ui_but_is_pushed_ex(uiBut *but, double *value) { int is_push = 0; @@ -2278,7 +2244,6 @@ void UI_block_lock_clear(uiBlock *block) * this either works with the pointed to data, or can work with * an edit override pointer while dragging for example */ -/* for buttons pointing to color for example */ void ui_but_v3_get(uiBut *but, float vec[3]) { if (but->editvec) { @@ -2326,7 +2291,6 @@ void ui_but_v3_get(uiBut *but, float vec[3]) } } -/* for buttons pointing to color for example */ void ui_but_v3_set(uiBut *but, const float vec[3]) { if (but->editvec) { @@ -2438,9 +2402,6 @@ bool ui_but_is_unit(const uiBut *but) return true; } -/** - * Check if this button is similar enough to be grouped with another. - */ bool ui_but_is_compatible(const uiBut *but_a, const uiBut *but_b) { if (but_a->type != but_b->type) { @@ -2476,9 +2437,6 @@ bool ui_but_is_rna_valid(uiBut *but) return false; } -/** - * Checks if the button supports cycling next/previous menu items (ctrl+mouse-wheel). - */ bool ui_but_supports_cycling(const uiBut *but) { return (ELEM(but->type, UI_BTYPE_ROW, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_LISTBOX) || @@ -2685,7 +2643,6 @@ static double ui_get_but_scale_unit(uiBut *but, double value) 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) { if (!ui_but_is_unit(but)) { @@ -2777,12 +2734,6 @@ static float ui_get_but_step_unit(uiBut *but, float step_default) return (float)step_final; } -/** - * \param float_precision: For number buttons the precision - * to use or -1 to fallback to the button default. - * \param use_exp_float: Use exponent representation of floats - * when out of reasonable range (outside of 1e3/1e-3). - */ void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, @@ -2908,12 +2859,6 @@ void ui_but_string_get(uiBut *but, char *str, const size_t maxlen) ui_but_string_get_ex(but, str, maxlen, -1, false, NULL); } -/** - * A version of #ui_but_string_get_ex for dynamic buffer sizes - * (where #ui_but_string_get_max_length returns 0). - * - * \param r_str_size: size of the returned string (including terminator). - */ char *ui_but_string_get_dynamic(uiBut *but, int *r_str_size) { char *str = NULL; @@ -3272,9 +3217,10 @@ void ui_but_range_set_hard(uiBut *but) } } -/* NOTE: this could be split up into functions which handle arrays and not. */ void ui_but_range_set_soft(uiBut *but) { + /* This could be split up into functions which handle arrays and not. */ + /* Ideally we would not limit this, but practically it's more than * enough. Worst case is very long vectors won't use a smart soft-range, * which isn't so bad. */ @@ -3449,7 +3395,6 @@ static void ui_but_free(const bContext *C, uiBut *but) MEM_freeN(but); } -/* can be called with C==NULL */ void UI_block_free(const bContext *C, uiBlock *block) { UI_butstore_clear(block); @@ -3508,7 +3453,6 @@ void UI_blocklist_draw(const bContext *C, const ListBase *lb) } } -/* can be called with C==NULL */ void UI_blocklist_free(const bContext *C, ARegion *region) { ListBase *lb = ®ion->uiblocks; @@ -3638,10 +3582,6 @@ bool UI_block_is_search_only(const uiBlock *block) return block->flag & UI_BLOCK_SEARCH_ONLY; } -/** - * Use when a block must be searched to give accurate results - * for the whole region but shouldn't be displayed. - */ void UI_block_set_search_only(uiBlock *block, bool search_only) { SET_FLAG_FROM_TEST(block->flag, search_only, UI_BLOCK_SEARCH_ONLY); @@ -4013,13 +3953,6 @@ static uiBut *ui_but_alloc(const eButType type) return MEM_callocN(alloc_size, alloc_str); } -/** - * Reallocate the button (new address is returned) for a new button type. - * This should generally be avoided and instead the correct type be created right away. - * - * \note Only the #uiBut data can be kept. If the old button used a derived type (e.g. #uiButTab), - * the data that is not inside #uiBut will be lost. - */ uiBut *ui_but_change_type(uiBut *but, eButType new_type) { if (but->type == new_type) { @@ -4253,9 +4186,6 @@ void ui_def_but_icon(uiBut *but, const int icon, const int flag) } } -/** - * Avoid using this where possible since it's better not to ask for an icon in the first place. - */ void ui_def_but_icon_clear(uiBut *but) { but->icon = ICON_NONE; @@ -5309,7 +5239,6 @@ uiBut *uiDefButO(uiBlock *block, return uiDefButO_ptr(block, type, ot, opcontext, str, x, y, width, height, tip); } -/* if a1==1.0 then a2 is an extra icon blending factor (alpha 0.0 - 1.0) */ uiBut *uiDefIconBut(uiBlock *block, int type, int retval, @@ -5689,7 +5618,6 @@ uiBut *uiDefIconButO(uiBlock *block, return uiDefIconButO_ptr(block, type, ot, opcontext, icon, x, y, width, height, tip); } -/* Button containing both string label and icon */ uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, @@ -6120,7 +6048,6 @@ void UI_block_direction_set(uiBlock *block, char direction) block->direction = direction; } -/* this call escapes if there's alignment flags */ void UI_block_order_flip(uiBlock *block) { float centy, miny = 10000, maxy = -10000; @@ -6224,19 +6151,12 @@ void UI_but_drag_set_id(uiBut *but, ID *id) but->dragpoin = (void *)id; } -/** - * Set an image to display while dragging. This works for any drag type (`WM_DRAG_XXX`). - * Not to be confused with #UI_but_drag_set_image(), which sets up dragging of an image. - */ void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, const float scale) { but->imb = imb; but->imb_scale = scale; } -/** - * \param asset: May be passed from a temporary variable, drag data only stores a copy of this. - */ void UI_but_drag_set_asset(uiBut *but, const AssetHandle *asset, const char *path, @@ -6298,7 +6218,6 @@ void UI_but_drag_set_name(uiBut *but, const char *name) but->dragpoin = (void *)name; } -/* value from button itself */ void UI_but_drag_set_value(uiBut *but) { but->dragtype = WM_DRAG_VALUE; @@ -6561,7 +6480,6 @@ uiBut *uiDefIconMenuBut(uiBlock *block, return but; } -/* Block button containing both string label and icon */ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, @@ -6590,7 +6508,6 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, return but; } -/* Block button containing icon */ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, @@ -6643,8 +6560,6 @@ uiBut *uiDefKeyevtButS(uiBlock *block, return but; } -/* short pointers hardcoded */ -/* modkeypoin will be set to KM_SHIFT, KM_ALT, KM_CTRL, KM_OSKEY bits */ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, @@ -6675,8 +6590,6 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, return but; } -/* arg is pointer to string/name, use UI_but_func_search_set() below to make this work */ -/* here a1 and a2, if set, control thumbnail preview rows/cols */ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, @@ -6702,21 +6615,6 @@ uiBut *uiDefSearchBut(uiBlock *block, return but; } -/** - * \note The item-pointer (referred to below) is a per search item user pointer - * passed to #UI_search_item_add (stored in #uiSearchItems.pointers). - * - * \param search_create_fn: Function to create the menu. - * \param search_update_fn: Function to refresh search content after the search text has changed. - * \param arg: user value. - * \param free_arg: Set to true if the argument is newly allocated memory for every redraw and - * should be freed when the button is destroyed. - * \param search_arg_free_fn: When non-null, use this function to free \a arg. - * \param search_exec_fn: Function that executes the action, gets \a arg as the first argument. - * The second argument as the active item-pointer - * \param active: When non-null, this item-pointer item will be visible and selected, - * otherwise the first item will be selected. - */ void UI_but_func_search_set(uiBut *but, uiButSearchCreateFn search_create_fn, uiButSearchUpdateFn search_update_fn, @@ -6783,10 +6681,6 @@ void UI_but_func_search_set_context_menu(uiBut *but, uiButSearchContextMenuFn co but_search->item_context_menu_fn = context_menu_fn; } -/** - * \param search_sep_string: when not NULL, this string is used as a separator, - * showing the icon and highlighted text after the last instance of this string. - */ void UI_but_func_search_set_sep_string(uiBut *but, const char *search_sep_string) { uiButSearch *but_search = (uiButSearch *)but; @@ -6883,10 +6777,6 @@ static void operator_enum_search_exec_fn(struct bContext *UNUSED(C), void *but, } } -/** - * Same parameters as for uiDefSearchBut, with additional operator type and properties, - * used by callback to call again the right op with the right options (properties values). - */ uiBut *uiDefSearchButO_ptr(uiBlock *block, wmOperatorType *ot, IDProperty *properties, @@ -6933,9 +6823,6 @@ void UI_but_treerow_indentation_set(uiBut *but, int indentation) BLI_assert(indentation >= 0); } -/** - * Adds a hint to the button which draws right aligned, grayed out and never clipped. - */ void UI_but_hint_drawstr_set(uiBut *but, const char *string) { ui_but_add_shortcut(but, string, false); @@ -6967,10 +6854,6 @@ void UI_but_number_precision_set(uiBut *but, float precision) BLI_assert(precision > -2); } -/** - * push a new event onto event queue to activate the given button - * (usually a text-field) upon entering a popup - */ void UI_but_focus_on_enter_event(wmWindow *win, uiBut *but) { wmEvent event; @@ -7273,7 +7156,6 @@ void UI_init(void) ui_resources_init(); } -/* after reading userdef file */ void UI_init_userdef(void) { /* Initialize UI variables from values set in the preferences. */ diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c index 3149675ac04..35af557a560 100644 --- a/source/blender/editors/interface/interface_align.c +++ b/source/blender/editors/interface/interface_align.c @@ -377,13 +377,6 @@ static void ui_block_align_but_to_region(uiBut *but, const ARegion *region) } } -/** - * Compute the alignment of all 'align groups' of buttons in given block. - * - * This is using an order-independent algorithm, - * i.e. alignment of buttons should be OK regardless of order in which - * they are added to the block. - */ void ui_block_align_calc(uiBlock *block, const ARegion *region) { int num_buttons = 0; diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 3101b3222c4..1d6623f3490 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -180,10 +180,6 @@ void ui_but_anim_decorate_update_from_flag(uiButDecorator *decorator_but) but->flag = (but->flag & ~flag_copy) | (flag & flag_copy); } -/** - * \a str can be NULL to only perform check if \a but has an expression at all. - * \return if button has an expression. - */ bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen) { FCurve *fcu; @@ -241,7 +237,6 @@ bool ui_but_anim_expression_set(uiBut *but, const char *str) return false; } -/* create new expression for button (i.e. a "scripted driver"), if it can be created... */ bool ui_but_anim_expression_create(uiBut *but, const char *str) { bContext *C = but->block->evil_C; diff --git a/source/blender/editors/interface/interface_button_group.c b/source/blender/editors/interface/interface_button_group.c index 7054498d469..6449e1eb329 100644 --- a/source/blender/editors/interface/interface_button_group.c +++ b/source/blender/editors/interface/interface_button_group.c @@ -28,10 +28,6 @@ /** \name Button Groups * \{ */ -/** - * Every function that adds a set of buttons must create another group, - * then #ui_def_but adds buttons to the current group (the last). - */ void ui_block_new_button_group(uiBlock *block, uiButtonGroupFlag flag) { /* Don't create a new group if there is a "lock" on new groups. */ diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 72e7203c6ea..190b2d12ed9 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -1242,9 +1242,6 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev /** \name Panel Context Menu * \{ */ -/** - * menu to show when right clicking on the panel header - */ void ui_popup_context_menu_for_panel(bContext *C, ARegion *region, Panel *panel) { bScreen *screen = CTX_wm_screen(C); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 191eb6b5585..285c82b0fb3 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -194,8 +194,6 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ -/* based on UI_draw_roundbox_gl_mode, - * check on making a version which allows us to skip some sides */ void ui_draw_but_TAB_outline(const rcti *rect, float rad, uchar highlight[3], @@ -348,14 +346,6 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region), #endif } -/** - * Draw title and text safe areas. - * - * \note This function is to be used with the 2D dashed shader enabled. - * - * \param pos: is a #PRIM_FLOAT, 2, #GPU_FETCH_FLOAT vertex attribute. - * \param x1, x2, y1, y2: The offsets for the view, not the zones. - */ void UI_draw_safe_areas(uint pos, const rctf *rect, const float title_aspect[2], @@ -1753,9 +1743,6 @@ static bool point_draw_handles(CurveProfilePoint *point) ELEM(point->flag, PROF_H1_SELECT, PROF_H2_SELECT); } -/** - * Draws the curve profile widget. Somewhat similar to ui_draw_but_CURVE. - */ void ui_draw_but_CURVEPROFILE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index 395ecc77ef4..08ff05e517b 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -141,15 +141,6 @@ void eyedropper_draw_cursor_text_region(const int x, const int y, const char *na eyedropper_draw_cursor_text_ex(x, y, name); } -/** - * Utility to retrieve a button representing a RNA property that is currently under the cursor. - * - * This is to be used by any eyedroppers which fetch properties (e.g. UI_OT_eyedropper_driver). - * Especially during modal operations (e.g. as with the eyedroppers), context cannot be relied - * upon to provide this information, as it is not updated until the operator finishes. - * - * \return A button under the mouse which relates to some RNA Property, or NULL - */ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *event) { bScreen *screen = CTX_wm_screen(C); diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c index e45619d89e8..0ac6ea4021b 100644 --- a/source/blender/editors/interface/interface_eyedropper_color.c +++ b/source/blender/editors/interface/interface_eyedropper_color.c @@ -322,13 +322,6 @@ static bool eyedropper_cryptomatte_sample_fl( return false; } -/** - * \brief get the color from the screen. - * - * Special check for image or nodes where we MAY have HDR pixels which don't display. - * - * \note Exposed by 'interface_eyedropper_intern.h' for use with color band picking. - */ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3]) { /* we could use some clever */ diff --git a/source/blender/editors/interface/interface_eyedropper_intern.h b/source/blender/editors/interface/interface_eyedropper_intern.h index f9f3fcfb5d1..17bb78a7861 100644 --- a/source/blender/editors/interface/interface_eyedropper_intern.h +++ b/source/blender/editors/interface/interface_eyedropper_intern.h @@ -23,8 +23,18 @@ #pragma once /* interface_eyedropper.c */ + void eyedropper_draw_cursor_text_window(const struct wmWindow *window, const char *name); void eyedropper_draw_cursor_text_region(const int x, const int y, const char *name); +/** + * Utility to retrieve a button representing a RNA property that is currently under the cursor. + * + * This is to be used by any eyedroppers which fetch properties (e.g. UI_OT_eyedropper_driver). + * Especially during modal operations (e.g. as with the eyedroppers), context cannot be relied + * upon to provide this information, as it is not updated until the operator finishes. + * + * \return A button under the mouse which relates to some RNA Property, or NULL + */ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *event); void datadropper_win_area_find(const struct bContext *C, const int mval[2], @@ -33,6 +43,14 @@ void datadropper_win_area_find(const struct bContext *C, struct ScrArea **r_area); /* interface_eyedropper_color.c (expose for color-band picker) */ + +/** + * \brief get the color from the screen. + * + * Special check for image or nodes where we MAY have HDR pixels which don't display. + * + * \note Exposed by 'interface_eyedropper_intern.h' for use with color band picking. + */ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3]); /* Used for most eye-dropper operators. */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 14df5ec68ac..637ab822067 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -555,7 +555,6 @@ bool ui_but_is_editing(const uiBut *but) return (data && ELEM(data->state, BUTTON_STATE_TEXT_EDITING, BUTTON_STATE_NUM_EDITING)); } -/* assumes event type is MOUSEPAN */ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val) { static int lastdy = 0; @@ -594,11 +593,6 @@ static bool ui_but_find_select_in_enum__cmp(const uiBut *but_a, const uiBut *but (but_a->rnaprop == but_b->rnaprop)); } -/** - * Finds the pressed button in an aligned row (typically an expanded enum). - * - * \param direction: Use when there may be multiple buttons pressed. - */ uiBut *ui_but_find_select_in_enum(uiBut *but, int direction) { uiBut *but_iter = but; @@ -2992,11 +2986,6 @@ void ui_but_text_password_hide(char password_str[UI_MAX_PASSWORD_STR], /** \name Button Text Selection/Editing * \{ */ -/** - * Use handling code to set a string for the button. Handles the case where the string is set for a - * search button while the search menu is open, so the results are updated accordingly. - * This is basically the same as pasting the string into the button. - */ void ui_but_set_string_interactive(bContext *C, uiBut *but, const char *value) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); @@ -8191,9 +8180,6 @@ static void ui_blocks_set_tooltips(ARegion *region, const bool enable) } } -/** - * Recreate tool-tip (use to update dynamic tips) - */ void UI_but_tooltip_refresh(bContext *C, uiBut *but) { uiHandleButtonData *data = but->active; @@ -8205,10 +8191,6 @@ void UI_but_tooltip_refresh(bContext *C, uiBut *but) } } -/** - * Removes tool-tip timer from active but - * (meaning tool-tip is disabled until it's re-enabled again). - */ void UI_but_tooltip_timer_remove(bContext *C, uiBut *but) { uiHandleButtonData *data = but->active; @@ -8776,11 +8758,6 @@ uiBut *UI_context_active_but_get(const bContext *C) return ui_context_button_active(CTX_wm_region(C), NULL); } -/* - * Version of #UI_context_active_get() that uses the result of #CTX_wm_menu() - * if set. Does not traverse into parent menus, which may be wanted in some - * cases. - */ uiBut *UI_context_active_but_get_respect_menu(const bContext *C) { ARegion *region_menu = CTX_wm_menu(C); @@ -8804,12 +8781,6 @@ uiBlock *UI_region_block_find_mouse_over(const struct ARegion *region, return ui_block_find_mouse_over_ex(region, xy, only_clip); } -/** - * Version of #UI_context_active_but_get that also returns RNA property info. - * Helper function for insert keyframe, reset to default, etc operators. - * - * \return active button, NULL if none found or if it doesn't contain valid RNA data. - */ uiBut *UI_context_active_but_prop_get(const bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, @@ -8885,16 +8856,12 @@ wmOperator *UI_context_active_operator_get(const struct bContext *C) return NULL; } -/** - * Try to find a search-box region opened from a button in \a button_region. - */ ARegion *UI_region_searchbox_region_get(const ARegion *button_region) { uiBut *but = UI_region_active_but_get(button_region); return (but != NULL) ? but->active->searchbox : NULL; } -/* helper function for insert keyframe, reset to default, etc operators */ void UI_context_update_anim_flag(const bContext *C) { Scene *scene = CTX_data_scene(C); @@ -8943,10 +8910,6 @@ void UI_context_update_anim_flag(const bContext *C) } } -/** - * In some cases we may want to update the view (#View2D) in-between layout definition and drawing. - * E.g. to make sure a button is visible while editing. - */ void ui_but_update_view_for_active(const bContext *C, const uiBlock *block) { uiBut *active_but = ui_block_active_but_get(block); @@ -9006,11 +8969,6 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *reg return WM_UI_HANDLER_CONTINUE; } -/** - * Exported to interface.c: #UI_but_active_only() - * \note The region is only for the button. - * The context needs to be set by the caller. - */ void ui_but_activate_event(bContext *C, ARegion *region, uiBut *but) { wmWindow *win = CTX_wm_window(C); @@ -9028,12 +8986,6 @@ void ui_but_activate_event(bContext *C, ARegion *region, uiBut *but) ui_do_button(C, but->block, but, &event); } -/** - * Simulate moving the mouse over a button (or navigating to it with arrow keys). - * - * exported so menus can start with a highlighted button, - * even if the mouse isn't over it - */ void ui_but_activate_over(bContext *C, ARegion *region, uiBut *but) { button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER); @@ -11273,10 +11225,6 @@ static int ui_handle_menus_recursive(bContext *C, return retval; } -/** - * Allow setting menu return value from externals. - * E.g. WM might need to do this for exiting files correctly. - */ void UI_popup_menu_retval_set(const uiBlock *block, const int retval, const bool enable) { uiPopupBlockHandle *menu = block->handle; @@ -11686,7 +11634,6 @@ void UI_region_free_active_but_all(bContext *C, ARegion *region) } } -/* is called by notifier */ void UI_screen_free_active_but_highlight(const bContext *C, bScreen *screen) { wmWindow *win = CTX_wm_window(C); @@ -11721,8 +11668,6 @@ uiBut *UI_but_active_drop_name_button(const bContext *C) return NULL; } -/* returns true if highlighted button allows drop of names */ -/* called in region context */ bool UI_but_active_drop_name(const bContext *C) { return UI_but_active_drop_name_button(C) != NULL; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 311965ac502..ca5d08ba40e 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -830,8 +830,6 @@ static void free_icons_textures(void) } } -/* Reload the textures for internal icons. - * This function will release the previous textures. */ void UI_icons_reload_internal_textures(void) { bTheme *btheme = UI_GetTheme(); @@ -1182,7 +1180,6 @@ static DrawInfo *icon_ensure_drawinfo(Icon *icon) return di; } -/* NOTE:, returns unscaled by DPI. */ int UI_icon_get_width(int icon_id) { Icon *icon = BKE_icon_get(icon_id); @@ -1242,8 +1239,6 @@ void UI_icons_init() #endif } -/* Render size for preview images and icons - */ int UI_icon_preview_to_render_size(enum eIconSizes size) { switch (size) { @@ -2031,9 +2026,6 @@ static void ui_id_preview_image_render_size( } } -/** - * Note that if an ID doesn't support jobs for preview creation, \a use_job will be ignored. - */ void UI_icon_render_id( const bContext *C, Scene *scene, ID *id, const enum eIconSizes size, const bool use_job) { @@ -2473,7 +2465,6 @@ int UI_icon_color_from_collection(const Collection *collection) return icon; } -/* draws icon with dpi scale factor */ void UI_icon_draw(float x, float y, int icon_id) { UI_icon_draw_ex(x, y, icon_id, U.inv_dpi_fac, 1.0f, 0.0f, NULL, false); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 2d549f6176c..dc8744aaae9 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -620,6 +620,9 @@ extern void ui_block_to_window_rctf(const struct ARegion *region, rctf *rct_dst, const rctf *rct_src); extern float ui_block_to_window_scale(const struct ARegion *region, uiBlock *block); +/** + * For mouse cursor. + */ extern void ui_window_to_block_fl(const struct ARegion *region, uiBlock *block, float *x, @@ -637,23 +640,52 @@ extern void ui_window_to_region_rctf(const struct ARegion *region, rctf *rect_dst, const rctf *rct_src); extern void ui_region_to_window(const struct ARegion *region, int *x, int *y); +/** + * Popups will add a margin to #ARegion.winrct for shadow, + * for interactivity (point-inside tests for eg), we want the winrct without the margin added. + */ extern void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect); +/** + * Reallocate the button (new address is returned) for a new button type. + * This should generally be avoided and instead the correct type be created right away. + * + * \note Only the #uiBut data can be kept. If the old button used a derived type (e.g. #uiButTab), + * the data that is not inside #uiBut will be lost. + */ uiBut *ui_but_change_type(uiBut *but, eButType new_type); extern double ui_but_value_get(uiBut *but); extern void ui_but_value_set(uiBut *but, double value); +/** + * For picker, while editing HSV. + */ extern void ui_but_hsv_set(uiBut *but); +/** + * For buttons pointing to color for example. + */ extern void ui_but_v3_get(uiBut *but, float vec[3]); +/** + * For buttons pointing to color for example. + */ extern void ui_but_v3_set(uiBut *but, const float vec[3]); extern void ui_hsvcircle_vals_from_pos( const rcti *rect, const float mx, const float my, float *r_val_rad, float *r_val_dist); +/** + * Cursor in HSV circle, in float units -1 to 1, to map on radius. + */ extern void ui_hsvcircle_pos_from_vals( const ColorPicker *cpicker, const rcti *rect, const float *hsv, float *xpos, float *ypos); extern void ui_hsvcube_pos_from_vals( const struct uiButHSVCube *hsv_but, const rcti *rect, const float *hsv, float *xp, float *yp); +/** + * \param float_precision: For number buttons the precision + * to use or -1 to fallback to the button default. + * \param use_exp_float: Use exponent representation of floats + * when out of reasonable range (outside of 1e3/1e-3). + */ extern void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, @@ -661,7 +693,16 @@ extern void ui_but_string_get_ex(uiBut *but, const bool use_exp_float, bool *r_use_exp_float) ATTR_NONNULL(1, 2); extern void ui_but_string_get(uiBut *but, char *str, const size_t maxlen) ATTR_NONNULL(); +/** + * A version of #ui_but_string_get_ex for dynamic buffer sizes + * (where #ui_but_string_get_max_length returns 0). + * + * \param r_str_size: size of the returned string (including terminator). + */ extern char *ui_but_string_get_dynamic(uiBut *but, int *r_str_size); +/** + * \param str: will be overwritten. + */ extern void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) ATTR_NONNULL(); extern bool ui_but_string_set(struct bContext *C, uiBut *but, const char *str) ATTR_NONNULL(); extern bool ui_but_string_eval_number(struct bContext *C, @@ -669,12 +710,22 @@ extern bool ui_but_string_eval_number(struct bContext *C, const char *str, double *value) ATTR_NONNULL(); extern int ui_but_string_get_max_length(uiBut *but); -/* Clear & exit the active button's string. */ +/** + * Clear & exit the active button's string.. + */ extern void ui_but_active_string_clear_and_exit(struct bContext *C, uiBut *but) ATTR_NONNULL(); +/** + * Use handling code to set a string for the button. Handles the case where the string is set for a + * search button while the search menu is open, so the results are updated accordingly. + * This is basically the same as pasting the string into the button. + */ extern void ui_but_set_string_interactive(struct bContext *C, uiBut *but, const char *value); extern uiBut *ui_but_drag_multi_edit_get(uiBut *but); void ui_def_but_icon(uiBut *but, const int icon, const int flag); +/** + * Avoid using this where possible since it's better not to ask for an icon in the first place. + */ void ui_def_but_icon_clear(uiBut *but); void ui_but_extra_operator_icons_free(uiBut *but); @@ -687,6 +738,11 @@ void ui_but_range_set_hard(uiBut *but); void ui_but_range_set_soft(uiBut *but); bool ui_but_context_poll_operator(struct bContext *C, struct wmOperatorType *ot, const uiBut *but); +/** + * Check if the operator \a ot poll is successful with the context given by \a but (optionally). + * \param but: The button that might store context. Can be NULL for convenience (e.g. if there is + * no button to take context from, but we still want to poll the operator). + */ bool ui_but_context_poll_operator_ex(struct bContext *C, const uiBut *but, const struct wmOperatorCallParams *optype_params); @@ -697,10 +753,21 @@ extern PropertyScaleType ui_but_scale_type(const uiBut *but) ATTR_WARN_UNUSED_RE extern bool ui_but_is_float(const uiBut *but) ATTR_WARN_UNUSED_RESULT; extern bool ui_but_is_bool(const uiBut *but) ATTR_WARN_UNUSED_RESULT; extern bool ui_but_is_unit(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +/** + * Check if this button is similar enough to be grouped with another. + */ extern bool ui_but_is_compatible(const uiBut *but_a, const uiBut *but_b) ATTR_WARN_UNUSED_RESULT; extern bool ui_but_is_rna_valid(uiBut *but) ATTR_WARN_UNUSED_RESULT; +/** + * Checks if the button supports cycling next/previous menu items (ctrl+mouse-wheel). + */ extern bool ui_but_supports_cycling(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +/** + * Check if the button is pushed, this is only meaningful for some button types. + * + * \return (0 == UNSELECT), (1 == SELECT), (-1 == DO-NOTHING) + */ extern int ui_but_is_pushed_ex(uiBut *but, double *value) ATTR_WARN_UNUSED_RESULT; extern int ui_but_is_pushed(uiBut *but) ATTR_WARN_UNUSED_RESULT; @@ -795,6 +862,7 @@ struct uiPopupBlockHandle { /* interface_region_*.c */ /* interface_region_tooltip.c */ + /* exposed as public API in UI_interface.h */ /* interface_region_color_picker.c */ @@ -802,6 +870,10 @@ void ui_color_picker_rgb_to_hsv_compat(const float rgb[3], float r_cp[3]); void ui_color_picker_rgb_to_hsv(const float rgb[3], float r_cp[3]); void ui_color_picker_hsv_to_rgb(const float r_cp[3], float rgb[3]); +/** + * Returns true if the button is for a color with gamma baked in, + * or if it's a color picker for such a button. + */ bool ui_but_is_color_gamma(uiBut *but); void ui_scene_linear_to_perceptual_space(uiBut *but, float rgb[3]); @@ -811,7 +883,10 @@ uiBlock *ui_block_func_COLOR(struct bContext *C, uiPopupBlockHandle *handle, voi ColorPicker *ui_block_colorpicker_create(struct uiBlock *block); /* interface_region_search.c */ -/* Search-box for string button. */ + +/** + * Search-box for string button. + */ struct ARegion *ui_searchbox_create_generic(struct bContext *C, struct ARegion *butregion, uiButSearch *search_but); @@ -822,8 +897,14 @@ struct ARegion *ui_searchbox_create_menu(struct bContext *C, struct ARegion *butregion, uiButSearch *search_but); +/** + * x and y in screen-coords. + */ bool ui_searchbox_inside(struct ARegion *region, const int xy[2]) ATTR_NONNULL(1, 2); int ui_searchbox_find_index(struct ARegion *region, const char *name); +/** + * Region is the search box itself. + */ void ui_searchbox_update(struct bContext *C, struct ARegion *region, uiBut *but, const bool reset); int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *region, uiBut *but, char *str); bool ui_searchbox_event(struct bContext *C, @@ -831,16 +912,26 @@ bool ui_searchbox_event(struct bContext *C, uiBut *but, struct ARegion *butregion, const struct wmEvent *event); +/** + * String validated to be of correct length (but->hardmax). + */ bool ui_searchbox_apply(uiBut *but, struct ARegion *region); void ui_searchbox_free(struct bContext *C, struct ARegion *region); +/** + * XXX weak: search_func adds all partial matches. + */ void ui_but_search_refresh(uiButSearch *but); /* interface_region_menu_popup.c */ + int ui_but_menu_step(uiBut *but, int direction); bool ui_but_menu_step_poll(const uiBut *but); uiBut *ui_popup_menu_memory_get(struct uiBlock *block); void ui_popup_menu_memory_set(uiBlock *block, struct uiBut *but); +/** + * Called for creating new popups and refreshing existing ones. + */ uiBlock *ui_popup_block_refresh(struct bContext *C, uiPopupBlockHandle *handle, struct ARegion *butregion, @@ -860,6 +951,7 @@ uiPopupBlockHandle *ui_popup_menu_create(struct bContext *C, void *arg); /* interface_region_popover.c */ + uiPopupBlockHandle *ui_popover_panel_create(struct bContext *C, struct ARegion *butregion, uiBut *but, @@ -867,6 +959,10 @@ uiPopupBlockHandle *ui_popover_panel_create(struct bContext *C, void *arg); /* interface_region_menu_pie.c */ + +/** + * Set up data for defining a new pie menu level and add button that invokes it. + */ void ui_pie_menu_level_create(uiBlock *block, struct wmOperatorType *ot, const char *propname, @@ -877,6 +973,10 @@ void ui_pie_menu_level_create(uiBlock *block, int flag); /* interface_region_popup.c */ + +/** + * Translate any popup regions (so we can drag them). + */ void ui_popup_translate(struct ARegion *region, const int mdiff[2]); void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle); void ui_popup_block_scrolltest(struct uiBlock *block); @@ -884,10 +984,19 @@ void ui_popup_block_scrolltest(struct uiBlock *block); /* end interface_region_*.c */ /* interface_panel.c */ + +/** + * Handle region panel events like opening and closing panels, changing categories, etc. + * + * \note Could become a modal key-map. + */ extern int ui_handler_panel_region(struct bContext *C, const struct wmEvent *event, struct ARegion *region, const uiBut *active_but); +/** + * Draw a panel integrated in buttons-window, tool/property lists etc. + */ extern void ui_draw_aligned_panel(const struct uiStyle *style, const uiBlock *block, const rcti *rect, @@ -897,14 +1006,20 @@ extern void ui_draw_aligned_panel(const struct uiStyle *style, void ui_panel_tag_search_filter_match(struct Panel *panel); /* interface_draw.c */ + extern void ui_draw_dropshadow( const rctf *rct, float radius, float aspect, float alpha, int select); +/** + * Draws in resolution of 48x4 colors. + */ void ui_draw_gradient(const rcti *rect, const float hsv[3], const eButGradientType type, const float alpha); +/* based on UI_draw_roundbox_gl_mode, + * check on making a version which allows us to skip some sides */ void ui_draw_but_TAB_outline(const rcti *rect, float rad, uchar highlight[3], @@ -930,6 +1045,9 @@ void ui_draw_but_CURVE(struct ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); +/** + * Draws the curve profile widget. Somewhat similar to ui_draw_but_CURVE. + */ void ui_draw_but_CURVEPROFILE(struct ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, @@ -944,8 +1062,19 @@ void ui_draw_but_TRACKPREVIEW(struct ARegion *region, const rcti *rect); /* interface_undo.c */ + +/** + * Start the undo stack. + * + * \note The current state should be pushed immediately after calling this. + */ struct uiUndoStack_Text *ui_textedit_undo_stack_create(void); void ui_textedit_undo_stack_destroy(struct uiUndoStack_Text *undo_stack); +/** + * Push the information in the arguments to a new state in the undo stack. + * + * \note Currently the total length of the undo stack is not limited. + */ void ui_textedit_undo_push(struct uiUndoStack_Text *undo_stack, const char *text, int cursor_index); @@ -954,10 +1083,25 @@ const char *ui_textedit_undo(struct uiUndoStack_Text *undo_stack, int *r_cursor_index); /* interface_handlers.c */ + extern void ui_handle_afterfunc_add_operator(struct wmOperatorType *ot, wmOperatorCallContext opcontext); +/** + * Assumes event type is MOUSEPAN. + */ extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val); +/** + * Exported to interface.c: #UI_but_active_only() + * \note The region is only for the button. + * The context needs to be set by the caller. + */ extern void ui_but_activate_event(struct bContext *C, struct ARegion *region, uiBut *but); +/** + * Simulate moving the mouse over a button (or navigating to it with arrow keys). + * + * exported so menus can start with a highlighted button, + * even if the mouse isn't over it + */ extern void ui_but_activate_over(struct bContext *C, struct ARegion *region, uiBut *but); extern void ui_but_execute_begin(struct bContext *C, struct ARegion *region, @@ -968,13 +1112,25 @@ extern void ui_but_execute_end(struct bContext *C, uiBut *but, void *active_back); extern void ui_but_active_free(const struct bContext *C, uiBut *but); +/** + * In some cases we may want to update the view (#View2D) in-between layout definition and drawing. + * E.g. to make sure a button is visible while editing. + */ extern void ui_but_update_view_for_active(const struct bContext *C, const uiBlock *block); extern int ui_but_menu_direction(uiBut *but); extern void ui_but_text_password_hide(char password_str[128], uiBut *but, const bool restore); +/** + * Finds the pressed button in an aligned row (typically an expanded enum). + * + * \param direction: Use when there may be multiple buttons pressed. + */ extern uiBut *ui_but_find_select_in_enum(uiBut *but, int direction); bool ui_but_is_editing(const uiBut *but); float ui_block_calc_pie_segment(struct uiBlock *block, const float event_xy[2]); +/* XXX, this code will shorten any allocated string to 'UI_MAX_NAME_STR' + * since this is really long its unlikely to be an issue, + * but this could be supported */ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_strip); void ui_but_clipboard_free(void); bool ui_but_rna_equals(const uiBut *a, const uiBut *b); @@ -1039,6 +1195,9 @@ void ui_draw_widget_menu_back_color(const rcti *rect, bool use_shadow, const flo void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow); void ui_draw_tooltip_background(const struct uiStyle *style, uiBlock *block, rcti *rect); +/** + * Conversion from old to new buttons, so still messy. + */ extern void ui_draw_but(const struct bContext *C, struct ARegion *region, struct uiStyle *style, @@ -1059,6 +1218,15 @@ typedef enum { * get clipped before the normal text. */ UI_MENU_ITEM_SEPARATOR_HINT, } uiMenuItemSeparatorType; +/** + * Helper call to draw a menu item without a button. + * + * \param state: The state of the button, + * typically #UI_ACTIVE, #UI_BUT_DISABLED, #UI_BUT_INACTIVE. + * \param separator_type: The kind of separator which controls if and how the string is clipped. + * \param r_xmax: The right hand position of the text, this takes into the icon, + * padding and text clipping when there is not enough room to display the full text. + */ void ui_draw_menu_item(const struct uiFontStyle *fstyle, rcti *rect, const char *name, @@ -1072,6 +1240,10 @@ void ui_draw_preview_item(const struct uiFontStyle *fstyle, int iconid, int state, eFontStyle_Align text_align); +/** + * Version of #ui_draw_preview_item() that does not draw the menu background and item text based on + * state. It just draws the preview and text directly. + */ void ui_draw_preview_item_stateless(const struct uiFontStyle *fstyle, rcti *rect, const char *name, @@ -1081,59 +1253,102 @@ void ui_draw_preview_item_stateless(const struct uiFontStyle *fstyle, #define UI_TEXT_MARGIN_X 0.4f #define UI_POPUP_MARGIN (UI_DPI_FAC * 12) -/* Margin at top of screen for popups. Note this value must be sufficient - * to draw a popover arrow to avoid cropping it. */ +/** + * Margin at top of screen for popups. + * Note this value must be sufficient to draw a popover arrow to avoid cropping it. + */ #define UI_POPUP_MENU_TOP (int)(10 * UI_DPI_FAC) #define UI_PIXEL_AA_JITTER 8 extern const float ui_pixel_jitter[UI_PIXEL_AA_JITTER][2]; /* interface_style.c */ + +/** + * Called on each startup.blend read, + * reading without #uiFont will create one. + */ void uiStyleInit(void); /* interface_icons.c */ + void ui_icon_ensure_deferred(const struct bContext *C, const int icon_id, const bool big); int ui_id_icon_get(const struct bContext *C, struct ID *id, const bool big); /* interface_icons_event.c */ + void icon_draw_rect_input( float x, float y, int w, int h, float alpha, short event_type, short event_value); /* resources.c */ + void ui_resources_init(void); void ui_resources_free(void); /* interface_layout.c */ + void ui_layout_add_but(uiLayout *layout, uiBut *but); void ui_layout_remove_but(uiLayout *layout, const uiBut *but); +/** + * \return true if the button was successfully replaced. + */ bool ui_layout_replace_but_ptr(uiLayout *layout, const void *old_but_ptr, uiBut *new_but); +/** + * \note May reallocate \a but, so the possibly new address is returned. + */ uiBut *ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop); +/** + * Check all buttons defined in this layout, + * and set any button flagged as UI_BUT_LIST_ITEM as active/selected. + * Needed to handle correctly text colors of active (selected) list item. + */ void ui_layout_list_set_labels_active(uiLayout *layout); /* menu callback */ void ui_item_menutype_func(struct bContext *C, struct uiLayout *layout, void *arg_mt); void ui_item_paneltype_func(struct bContext *C, struct uiLayout *layout, void *arg_pt); /* interface_button_group.c */ + +/** + * Every function that adds a set of buttons must create another group, + * then #ui_def_but adds buttons to the current group (the last). + */ void ui_block_new_button_group(uiBlock *block, uiButtonGroupFlag flag); void ui_button_group_add_but(uiBlock *block, uiBut *but); void ui_button_group_replace_but_ptr(uiBlock *block, const void *old_but_ptr, uiBut *new_but); void ui_block_free_button_groups(uiBlock *block); /* interface_align.c */ + bool ui_but_can_align(const uiBut *but) ATTR_WARN_UNUSED_RESULT; int ui_but_align_opposite_to_area_align_get(const struct ARegion *region) ATTR_WARN_UNUSED_RESULT; +/** + * Compute the alignment of all 'align groups' of buttons in given block. + * + * This is using an order-independent algorithm, + * i.e. alignment of buttons should be OK regardless of order in which + * they are added to the block. + */ void ui_block_align_calc(uiBlock *block, const struct ARegion *region); /* interface_anim.c */ + void ui_but_anim_flag(uiBut *but, const struct AnimationEvalContext *anim_eval_context); void ui_but_anim_copy_driver(struct bContext *C); void ui_but_anim_paste_driver(struct bContext *C); +/** + * \a str can be NULL to only perform check if \a but has an expression at all. + * \return if button has an expression. + */ bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen); bool ui_but_anim_expression_set(uiBut *but, const char *str); +/** + * Create new expression for button (i.e. a "scripted driver"), if it can be created. + */ bool ui_but_anim_expression_create(uiBut *but, const char *str); void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, float cfra); @@ -1141,9 +1356,15 @@ void ui_but_anim_decorate_cb(struct bContext *C, void *arg_but, void *arg_dummy) void ui_but_anim_decorate_update_from_flag(uiButDecorator *but); /* interface_query.c */ + bool ui_but_is_editable(const uiBut *but) ATTR_WARN_UNUSED_RESULT; bool ui_but_is_editable_as_text(const uiBut *but) ATTR_WARN_UNUSED_RESULT; bool ui_but_is_toggle(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +/** + * Can we mouse over the button or is it hidden/disabled/layout. + * \note ctrl is kind of a hack currently, + * so that non-embossed UI_BTYPE_TEXT button behaves as a label when ctrl is not pressed. + */ bool ui_but_is_interactive(const uiBut *but, const bool labeledit) ATTR_WARN_UNUSED_RESULT; bool ui_but_is_popover_once_compat(const uiBut *but) ATTR_WARN_UNUSED_RESULT; bool ui_but_has_array_value(const uiBut *but) ATTR_WARN_UNUSED_RESULT; @@ -1174,6 +1395,9 @@ uiBut *ui_tree_row_find_mouse_over(const struct ARegion *region, const int xy[2] uiBut *ui_tree_row_find_active(const struct ARegion *region); typedef bool (*uiButFindPollFn)(const uiBut *but, const void *customdata); +/** + * x and y are only used in case event is NULL. + */ uiBut *ui_but_find_mouse_over_ex(const struct ARegion *region, const int xy[2], const bool labeledit, @@ -1220,41 +1444,56 @@ bool ui_region_contains_point_px(const struct ARegion *region, const int xy[2]) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT; bool ui_region_contains_rect_px(const struct ARegion *region, const rcti *rect_px); +/** + * Check if the cursor is over any popups. + */ struct ARegion *ui_screen_region_find_mouse_over_ex(struct bScreen *screen, const int xy[2]) ATTR_NONNULL(1, 2); struct ARegion *ui_screen_region_find_mouse_over(struct bScreen *screen, const struct wmEvent *event); /* interface_context_menu.c */ + bool ui_popup_context_menu_for_button(struct bContext *C, uiBut *but, const struct wmEvent *event); +/** + * menu to show when right clicking on the panel header + */ void ui_popup_context_menu_for_panel(struct bContext *C, struct ARegion *region, struct Panel *panel); /* interface_eyedropper.c */ + struct wmKeyMap *eyedropper_modal_keymap(struct wmKeyConfig *keyconf); struct wmKeyMap *eyedropper_colorband_modal_keymap(struct wmKeyConfig *keyconf); /* interface_eyedropper_color.c */ + void UI_OT_eyedropper_color(struct wmOperatorType *ot); /* interface_eyedropper_colorband.c */ + void UI_OT_eyedropper_colorramp(struct wmOperatorType *ot); void UI_OT_eyedropper_colorramp_point(struct wmOperatorType *ot); /* interface_eyedropper_datablock.c */ + void UI_OT_eyedropper_id(struct wmOperatorType *ot); /* interface_eyedropper_depth.c */ + void UI_OT_eyedropper_depth(struct wmOperatorType *ot); /* interface_eyedropper_driver.c */ + void UI_OT_eyedropper_driver(struct wmOperatorType *ot); /* interface_eyedropper_gpencil_color.c */ + void UI_OT_eyedropper_gpencil_color(struct wmOperatorType *ot); /* interface_template_asset_view.cc */ + struct uiListType *UI_UL_asset_view(void); /** @@ -1280,12 +1519,15 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, const bool is_first); /* interface_ops.c */ + bool ui_jump_to_target_button_poll(struct bContext *C); /* interface_queries.c */ + void ui_interface_tag_script_reload_queries(void); /* interface_view.cc */ + void ui_block_free_views(struct uiBlock *block); uiTreeViewHandle *ui_block_view_find_matching_in_old_block(const uiBlock *new_block, const uiTreeViewHandle *new_view); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index b792c59481c..cbdb284c66b 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1464,11 +1464,6 @@ BLI_INLINE bool ui_layout_is_radial(const uiLayout *layout) ((layout->item.type == ITEM_LAYOUT_ROOT) && (layout->root->type == UI_LAYOUT_PIEMENU)); } -/** - * Create UI items for enum items in \a item_array. - * - * A version of #uiItemsFullEnumO that takes pre-calculated item array. - */ void uiItemsFullEnumO_items(uiLayout *layout, wmOperatorType *ot, PointerRNA ptr, @@ -1691,7 +1686,6 @@ void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname) uiItemsFullEnumO(layout, opname, propname, NULL, layout->root->opcontext, 0); } -/* for use in cases where we have */ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, @@ -2466,9 +2460,6 @@ void uiItemR( uiItemFullR(layout, ptr, prop, RNA_NO_INDEX, 0, flag, name, icon); } -/** - * Use a wrapper function since re-implementing all the logic in this function would be messy. - */ void uiItemFullR_with_popover(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, @@ -2722,9 +2713,6 @@ static void ui_rna_collection_search_arg_free_fn(void *ptr) MEM_freeN(ptr); } -/** - * \note May reallocate \a but, so the possibly new address is returned. - */ uiBut *ui_but_add_search( uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop) { @@ -2869,7 +2857,6 @@ void uiItemPointerR(uiLayout *layout, uiItemPointerR_prop(layout, ptr, prop, searchptr, searchprop, name, icon); } -/* menu item */ void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) { MenuType *mt = (MenuType *)arg_mt; @@ -3015,10 +3002,6 @@ void uiItemMContents(uiLayout *layout, const char *menuname) UI_menutype_draw(C, mt, layout); } -/** - * Insert a decorator item for a button with the same property as \a prop. - * To force inserting a blank dummy element, NULL can be passed for \a ptr and \a prop. - */ void uiItemDecoratorR_prop(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index) { uiBlock *block = layout->root->block; @@ -3077,10 +3060,6 @@ void uiItemDecoratorR_prop(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, } } -/** - * Insert a decorator item for a button with the same property as \a prop. - * To force inserting a blank dummy element, NULL can be passed for \a ptr and \a propname. - */ void uiItemDecoratorR(uiLayout *layout, PointerRNA *ptr, const char *propname, int index) { PropertyRNA *prop = NULL; @@ -3099,7 +3078,6 @@ void uiItemDecoratorR(uiLayout *layout, PointerRNA *ptr, const char *propname, i uiItemDecoratorR_prop(layout, ptr, prop, index); } -/* popover */ void uiItemPopoverPanel_ptr( uiLayout *layout, const bContext *C, PanelType *pt, const char *name, int icon) { @@ -3241,11 +3219,6 @@ void uiItemL(uiLayout *layout, const char *name, int icon) uiItemL_(layout, name, icon); } -/** - * Normally, we handle the split layout in #uiItemFullR(), but there are other cases where the - * logic is needed. Ideally, #uiItemFullR() could just call this, but it currently has too many - * special needs. - */ uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout) { uiPropertySplitWrapper split_wrapper = {NULL}; @@ -3261,9 +3234,6 @@ uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout) return split_wrapper; } -/* - * Helper to add a label and creates a property split layout if needed. - */ uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int icon) { if (layout->item.flag & UI_ITEM_PROP_SEP) { @@ -3297,7 +3267,6 @@ void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon) } } -/* value item */ void uiItemV(uiLayout *layout, const char *name, int icon, int argval) { /* label */ @@ -3342,7 +3311,6 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval) } } -/* separator item */ void uiItemS_ex(uiLayout *layout, float factor) { uiBlock *block = layout->root->block; @@ -3370,13 +3338,11 @@ void uiItemS_ex(uiLayout *layout, float factor) ""); } -/* separator item */ void uiItemS(uiLayout *layout) { uiItemS_ex(layout, 1.0f); } -/* Flexible spacing. */ void uiItemSpacer(uiLayout *layout) { uiBlock *block = layout->root->block; @@ -3409,7 +3375,6 @@ void uiItemSpacer(uiLayout *layout) ""); } -/* level items */ void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg) { if (!func) { @@ -3419,9 +3384,6 @@ void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc ui_item_menu(layout, name, icon, func, arg, NULL, "", false); } -/** - * Version of #uiItemMenuF that free's `argN`. - */ void uiItemMenuFN(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *argN) { if (!func) { @@ -4730,7 +4692,6 @@ static void ui_layout_heading_set(uiLayout *layout, const char *heading) } } -/* layout create functions */ uiLayout *uiLayoutRow(uiLayout *layout, bool align) { uiLayout *litem = MEM_callocN(sizeof(uiLayout), "uiLayoutRow"); @@ -4744,9 +4705,6 @@ uiLayout *uiLayoutRow(uiLayout *layout, bool align) return litem; } -/** - * See #uiLayoutColumnWithHeading(). - */ uiLayout *uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading) { uiLayout *litem = uiLayoutRow(layout, align); @@ -4767,12 +4725,6 @@ uiLayout *uiLayoutColumn(uiLayout *layout, bool align) return litem; } -/** - * Variant of #uiLayoutColumn() that sets a heading label for the layout if the first item is - * added through #uiItemFullR(). If split layout is used and the item has no string to add to the - * first split-column, the heading is added there instead. Otherwise the heading inserted with a - * new row. - */ uiLayout *uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading) { uiLayout *litem = uiLayoutColumn(layout, align); @@ -4862,11 +4814,6 @@ uiLayout *uiLayoutBox(uiLayout *layout) return (uiLayout *)ui_layout_box(layout, UI_BTYPE_ROUNDBOX); } -/** - * Check all buttons defined in this layout, - * and set any button flagged as UI_BUT_LIST_ITEM as active/selected. - * Needed to handle correctly text colors of active (selected) list item. - */ void ui_layout_list_set_labels_active(uiLayout *layout) { LISTBASE_FOREACH (uiButtonItem *, bitem, &layout->items) { @@ -5214,11 +5161,6 @@ static bool block_search_filter_tag_buttons(uiBlock *block, const char *search_f return has_result; } -/** - * Apply property search behavior, setting panel flags and deactivating buttons that don't match. - * - * \note Must not be run after #UI_block_layout_resolve. - */ bool UI_block_apply_search_filter(uiBlock *block, const char *search_filter) { if (search_filter == NULL || search_filter[0] == '\0') { @@ -5643,9 +5585,6 @@ void ui_layout_remove_but(uiLayout *layout, const uiBut *but) BLI_freelinkN(&layout->items, bitem); } -/** - * \return true if the button was successfully replaced. - */ bool ui_layout_replace_but_ptr(uiLayout *layout, const void *old_but_ptr, uiBut *new_but) { uiButtonItem *bitem = ui_layout_find_button_item(layout, old_but_ptr); @@ -5683,11 +5622,6 @@ void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv) layout->root->argv = argv; } -/** - * Used for property search when the layout process needs to be cancelled in order to avoid - * computing the locations for buttons, but the layout items created while adding the buttons - * must still be freed. - */ void UI_block_layout_free(uiBlock *block) { LISTBASE_FOREACH_MUTABLE (uiLayoutRoot *, root, &block->layouts) { @@ -5759,7 +5693,6 @@ void uiLayoutSetContextFromBut(uiLayout *layout, uiBut *but) } } -/* this is a bit of a hack but best keep it in one place at least */ wmOperatorType *UI_but_operatortype_get_from_enum_menu(uiBut *but, PropertyRNA **r_prop) { if (r_prop != NULL) { @@ -5777,7 +5710,6 @@ wmOperatorType *UI_but_operatortype_get_from_enum_menu(uiBut *but, PropertyRNA * return NULL; } -/* this is a bit of a hack but best keep it in one place at least */ MenuType *UI_but_menutype_get(uiBut *but) { if (but->menu_create_func == ui_item_menutype_func) { @@ -5786,7 +5718,6 @@ MenuType *UI_but_menutype_get(uiBut *but) 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) { if (but->menu_create_func == ui_item_paneltype_func) { @@ -5886,9 +5817,6 @@ static void ui_paneltype_draw_impl(bContext *C, PanelType *pt, uiLayout *layout, } } -/** - * Used for popup panels only. - */ void UI_paneltype_draw(bContext *C, PanelType *pt, uiLayout *layout) { if (layout->context) { @@ -6009,9 +5937,6 @@ static void ui_layout_introspect_items(DynStr *ds, ListBase *lb) BLI_dynstr_append(ds, "]"); } -/** - * Evaluate layout items as a Python dictionary. - */ const char *UI_layout_introspect(uiLayout *layout) { DynStr *ds = BLI_dynstr_new(); @@ -6031,10 +5956,6 @@ const char *UI_layout_introspect(uiLayout *layout) /** \name Alert Box with Big Icon * \{ */ -/** - * Helper to add a big icon and create a split layout for alert popups. - * Returns the layout to place further items into the alert box. - */ uiLayout *uiItemsAlertBox(uiBlock *block, const int size, const eAlertIcon icon) { const uiStyle *style = UI_style_get_dpi(); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 03422e8f520..0000c850a10 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1343,10 +1343,6 @@ void UI_editsource_active_but_test(uiBut *but) BLI_ghash_insert(ui_editsource_info->hash, but, but_store); } -/** - * Remove the editsource data for \a old_but and reinsert it for \a new_but. Use when the button - * was reallocated, e.g. to have a new type (#ui_but_change_type()). - */ void UI_editsource_but_replace(const uiBut *old_but, uiBut *new_but) { uiEditSourceButStore *but_store = BLI_ghash_lookup(ui_editsource_info->hash, old_but); @@ -2085,9 +2081,6 @@ void ED_operatortypes_ui(void) WM_operatortype_append(UI_OT_eyedropper_gpencil_color); } -/** - * \brief User Interface Keymap - */ void ED_keymap_ui(wmKeyConfig *keyconf) { WM_keymap_ensure(keyconf, "User Interface", 0, 0); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 3d18489c0c9..bc1d3387ad7 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -273,10 +273,6 @@ static Panel *panel_add_instanced(ARegion *region, return panel; } -/** - * Called in situations where panels need to be added dynamically rather than - * having only one panel corresponding to each #PanelType. - */ Panel *UI_panel_add_instanced(const bContext *C, ARegion *region, ListBase *panels, @@ -301,10 +297,6 @@ Panel *UI_panel_add_instanced(const bContext *C, return new_panel; } -/** - * Find a unique key to append to the #PanelType.idname for the lookup to the panel's #uiBlock. - * Needed for instanced panels, where there can be multiple with the same type and identifier. - */ void UI_list_panel_unique_str(Panel *panel, char *r_name) { /* The panel sort-order will be unique for a specific panel type because the instanced @@ -334,12 +326,6 @@ static void panel_delete(const bContext *C, ARegion *region, ListBase *panels, P MEM_freeN(panel); } -/** - * Remove instanced panels from the region's panel list. - * - * \note Can be called with NULL \a C, but it should be avoided because - * handlers might not be removed. - */ void UI_panels_free_instanced(const bContext *C, ARegion *region) { /* Delete panels with the instanced flag. */ @@ -361,15 +347,6 @@ void UI_panels_free_instanced(const bContext *C, ARegion *region) } } -/** - * Check if the instanced panels in the region's panels correspond to the list of data the panels - * represent. Returns false if the panels have been reordered or if the types from the list data - * don't match in any way. - * - * \param data: The list of data to check against the instanced panels. - * \param panel_idname_func: Function to find the #PanelType.idname for each item in the data list. - * For a readability and generality, this lookup happens separately for each type of panel list. - */ bool UI_panel_list_matches_data(ARegion *region, ListBase *data, uiListPanelIDFromDataFunc panel_idname_func) @@ -701,9 +678,6 @@ Panel *UI_panel_find_by_type(ListBase *lb, const PanelType *pt) return NULL; } -/** - * \note \a panel should be return value from #UI_panel_find_by_type and can be NULL. - */ Panel *UI_panel_begin( ARegion *region, ListBase *lb, uiBlock *block, PanelType *pt, Panel *panel, bool *r_open) { @@ -783,11 +757,6 @@ Panel *UI_panel_begin( return panel; } -/** - * Create the panel header button group, used to mark which buttons are part of - * panel headers for the panel search process that happens later. This Should be - * called before adding buttons for the panel's header layout. - */ void UI_panel_header_buttons_begin(Panel *panel) { uiBlock *block = panel->runtime.block; @@ -795,9 +764,6 @@ void UI_panel_header_buttons_begin(Panel *panel) ui_block_new_button_group(block, UI_BUTTON_GROUP_LOCK | UI_BUTTON_GROUP_PANEL_HEADER); } -/** - * Finish the button group for the panel header to avoid putting panel body buttons in it. - */ void UI_panel_header_buttons_end(Panel *panel) { uiBlock *block = panel->runtime.block; @@ -927,10 +893,6 @@ static void panel_matches_search_filter_recursive(const Panel *panel, bool *filt } } -/** - * Find whether a panel or any of its sub-panels contain a property that matches the search filter, - * depending on the search process running in #UI_block_apply_search_filter earlier. - */ bool UI_panel_matches_search_filter(const Panel *panel) { bool search_filter_matches = false; @@ -1022,10 +984,6 @@ static void region_panels_remove_invisible_layouts(ARegion *region) } } -/** - * Get the panel's expansion state, taking into account - * expansion set from property search if it applies. - */ bool UI_panel_is_closed(const Panel *panel) { /* Header-less panels can never be closed, otherwise they could disappear. */ @@ -1051,9 +1009,6 @@ bool UI_panel_is_active(const Panel *panel) /** \name Drawing * \{ */ -/** - * Draw panels, selected (panels currently being dragged) on top. - */ void UI_panels_draw(const bContext *C, ARegion *region) { /* Draw in reverse order, because #uiBlocks are added in reverse order @@ -1075,7 +1030,6 @@ void UI_panels_draw(const bContext *C, ARegion *region) #define PNL_ICON UI_UNIT_X /* Could be UI_UNIT_Y too. */ -/* For button layout next to label. */ void UI_panel_label_offset(const uiBlock *block, int *r_x, int *r_y) { Panel *panel = block->panel; @@ -1294,9 +1248,6 @@ static void panel_draw_aligned_backdrop(const Panel *panel, immUnbindProgram(); } -/** - * Draw a panel integrated in buttons-window, tool/property lists etc. - */ void ui_draw_aligned_panel(const uiStyle *style, const uiBlock *block, const rcti *rect, @@ -1361,9 +1312,6 @@ bool UI_panel_should_show_background(const ARegion *region, const PanelType *pan #define TABS_PADDING_BETWEEN_FACTOR 4.0f #define TABS_PADDING_TEXT_FACTOR 6.0f -/** - * Draw vertical tabs on the left side of the region, one tab per category. - */ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) { // #define USE_FLAT_INACTIVE @@ -2380,11 +2328,6 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, return WM_UI_HANDLER_CONTINUE; } -/** - * Handle region panel events like opening and closing panels, changing categories, etc. - * - * \note Could become a modal key-map. - */ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *region, @@ -2496,11 +2439,6 @@ static void ui_panel_custom_data_set_recursive(Panel *panel, PointerRNA *custom_ } } -/** - * Set a context for this entire panel and its current layout. This should be used whenever panel - * callbacks that are called outside of regular drawing might require context. Currently it affects - * the #PanelType.reorder callback only. - */ void UI_panel_context_pointer_set(Panel *panel, const char *name, PointerRNA *ptr) { uiLayoutSetContextPointer(panel->layout, name, ptr); diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index a07222854d2..b486ceb8dca 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -72,11 +72,6 @@ bool ui_but_is_toggle(const uiBut *but) UI_BTYPE_TREEROW); } -/** - * Can we mouse over the button or is it hidden/disabled/layout. - * \note ctrl is kind of a hack currently, - * so that non-embossed UI_BTYPE_TEXT button behaves as a label when ctrl is not pressed. - */ bool ui_but_is_interactive(const uiBut *but, const bool labeledit) { /* NOTE: #UI_BTYPE_LABEL is included for highlights, this allows drags. */ @@ -103,7 +98,6 @@ bool ui_but_is_interactive(const uiBut *but, const bool labeledit) return true; } -/* file selectors are exempt from utf-8 checks */ bool UI_but_is_utf8(const uiBut *but) { if (but->rnaprop) { @@ -283,7 +277,6 @@ static uiBut *ui_but_find(const ARegion *region, return NULL; } -/* x and y are only used in case event is NULL... */ uiBut *ui_but_find_mouse_over_ex(const ARegion *region, const int xy[2], const bool labeledit, @@ -797,7 +790,6 @@ bool ui_region_contains_rect_px(const ARegion *region, const rcti *rect_px) /** \name Screen (#bScreen) Spatial * \{ */ -/** Check if the cursor is over any popups. */ ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, const int xy[2]) { LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) { diff --git a/source/blender/editors/interface/interface_region_color_picker.c b/source/blender/editors/interface/interface_region_color_picker.c index 48952c4f121..2b167c56186 100644 --- a/source/blender/editors/interface/interface_region_color_picker.c +++ b/source/blender/editors/interface/interface_region_color_picker.c @@ -115,8 +115,6 @@ void ui_color_picker_hsv_to_rgb(const float r_cp[3], float rgb[3]) } } -/* Returns true if the button is for a color with gamma baked in, - * or if it's a color picker for such a button. */ bool ui_but_is_color_gamma(uiBut *but) { if (but->rnaprop) { @@ -183,7 +181,6 @@ static void ui_color_picker_update_hsv(ColorPicker *cpicker, cpicker->is_init = true; } -/* for picker, while editing hsv */ void ui_but_hsv_set(uiBut *but) { float rgb_perceptual[3]; diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c index 0ffbdd6911c..788d04a8271 100644 --- a/source/blender/editors/interface/interface_region_menu_pie.c +++ b/source/blender/editors/interface/interface_region_menu_pie.c @@ -372,9 +372,6 @@ static void ui_pie_menu_level_invoke(bContext *C, void *argN, void *arg2) UI_pie_menu_end(C, pie); } -/** - * Set up data for defining a new pie menu level and add button that invokes it. - */ void ui_pie_menu_level_create(uiBlock *block, wmOperatorType *ot, const char *propname, diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index 408953f8d0e..a8980b8b122 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -384,10 +384,6 @@ uiPopupBlockHandle *ui_popup_menu_create( /** \name Popup Menu API with begin & end * \{ */ -/** - * Only return handler, and set optional title. - * \param block_name: Assigned to uiBlock.name (useful info for debugging). - */ uiPopupMenu *UI_popup_menu_begin_ex(bContext *C, const char *title, const char *block_name, @@ -450,16 +446,12 @@ uiPopupMenu *UI_popup_menu_begin(bContext *C, const char *title, int icon) return UI_popup_menu_begin_ex(C, title, __func__, icon); } -/** - * Setting the button makes the popup open from the button instead of the cursor. - */ void UI_popup_menu_but_set(uiPopupMenu *pup, struct ARegion *butregion, uiBut *but) { pup->but = but; pup->butregion = butregion; } -/* set the whole structure to work */ void UI_popup_menu_end(bContext *C, uiPopupMenu *pup) { wmWindow *window = CTX_wm_window(C); diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index 5e7e0bfe9b5..1bb589d99fb 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -340,12 +340,6 @@ int UI_popover_panel_invoke(bContext *C, const char *idname, bool keep_open, Rep /** \name Popup Menu API with begin & end * \{ */ -/** - * Only return handler, and set optional title. - * - * \param from_active_button: Use the active button for positioning, - * use when the popover is activated from an operator instead of directly from the button. - */ uiPopover *UI_popover_begin(bContext *C, int ui_menu_width, bool from_active_button) { uiPopover *pup = MEM_callocN(sizeof(uiPopover), "popover menu"); @@ -383,7 +377,6 @@ static void popover_keymap_fn(wmKeyMap *UNUSED(keymap), wmKeyMapItem *UNUSED(kmi pup->block->handle->menuretval = UI_RETURN_OK; } -/* set the whole structure to work */ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap) { wmWindow *window = CTX_wm_window(C); diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c index 0f903bd4af9..33ce47b281b 100644 --- a/source/blender/editors/interface/interface_region_popup.c +++ b/source/blender/editors/interface/interface_region_popup.c @@ -53,9 +53,6 @@ /** \name Utility Functions * \{ */ -/** - * Translate any popup regions (so we can drag them). - */ void ui_popup_translate(ARegion *region, const int mdiff[2]) { BLI_rcti_translate(®ion->winrct, UNPACK2(mdiff)); @@ -554,9 +551,6 @@ static void ui_popup_block_remove(bContext *C, uiPopupBlockHandle *handle) } } -/** - * Called for creating new popups and refreshing existing ones. - */ uiBlock *ui_popup_block_refresh(bContext *C, uiPopupBlockHandle *handle, ARegion *butregion, diff --git a/source/blender/editors/interface/interface_region_search.cc b/source/blender/editors/interface/interface_region_search.cc index 93063b1b1c9..5b30e922a67 100644 --- a/source/blender/editors/interface/interface_region_search.cc +++ b/source/blender/editors/interface/interface_region_search.cc @@ -106,17 +106,6 @@ struct uiSearchboxData { #define SEARCH_ITEMS 10 -/** - * Public function exported for functions that use #UI_BTYPE_SEARCH_MENU. - * - * \param items: Stores the items. - * \param name: Text to display for the item. - * \param poin: Opaque pointer (for use by the caller). - * \param iconid: The icon, #ICON_NONE for no icon. - * \param state: The buttons state flag, compatible with #uiBut.flag, - * typically #UI_BUT_DISABLED / #UI_BUT_INACTIVE. - * \return false if there is nothing to add. - */ bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, @@ -289,7 +278,6 @@ int ui_searchbox_find_index(ARegion *region, const char *name) return UI_search_items_find_index(&data->items, name); } -/* x and y in screen-coords. */ bool ui_searchbox_inside(ARegion *region, const int xy[2]) { uiSearchboxData *data = static_cast<uiSearchboxData *>(region->regiondata); @@ -297,7 +285,6 @@ bool ui_searchbox_inside(ARegion *region, const int xy[2]) return BLI_rcti_isect_pt(&data->bbox, xy[0] - region->winrct.xmin, xy[1] - region->winrct.ymin); } -/* string validated to be of correct length (but->hardmax) */ bool ui_searchbox_apply(uiBut *but, ARegion *region) { uiSearchboxData *data = static_cast<uiSearchboxData *>(region->regiondata); @@ -477,7 +464,6 @@ static void ui_searchbox_update_fn(bContext *C, search_but->items_update_fn(C, search_but->arg, str, items, is_first_search); } -/* region is the search box itself */ void ui_searchbox_update(bContext *C, ARegion *region, uiBut *but, const bool reset) { uiButSearch *search_but = (uiButSearch *)but; @@ -1032,8 +1018,6 @@ ARegion *ui_searchbox_create_menu(bContext *C, ARegion *butregion, uiButSearch * return region; } -/* sets red alert if button holds a string it can't find */ -/* XXX weak: search_func adds all partial matches... */ void ui_but_search_refresh(uiButSearch *search_but) { uiBut *but = &search_but->but; diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index 0d8bdfc5817..e146443faaa 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -1466,10 +1466,6 @@ ARegion *UI_tooltip_create_from_button_or_extra_icon( return region; } -/** - * \param is_label: When true, show a small tip that only shows the name, otherwise show the full - * tooltip. - */ ARegion *UI_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *but, bool is_label) { return UI_tooltip_create_from_button_or_extra_icon(C, butregion, but, NULL, is_label); @@ -1542,13 +1538,6 @@ static uiTooltipData *ui_tooltip_data_from_search_item_tooltip_data( return data; } -/** - * Create a tooltip from search-item tooltip data \a item_tooltip data. - * To be called from a callback set with #UI_but_func_search_set_tooltip(). - * - * \param item_rect: Rectangle of the search item in search region space (#ui_searchbox_butrect()) - * which is passed to the tooltip callback. - */ ARegion *UI_tooltip_create_from_search_item_generic( bContext *C, const ARegion *searchbox_region, diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 8bb1e477506..643fa128d08 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -219,7 +219,6 @@ void UI_fontstyle_draw(const uiFontStyle *fs, UI_fontstyle_draw_ex(fs, rect, str, col, fs_params, BLF_DRAW_STR_DUMMY_MAX, &xofs, &yofs, NULL); } -/* drawn same as above, but at 90 degree angle */ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const char *str, @@ -279,12 +278,6 @@ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, } } -/** - * Similar to #UI_fontstyle_draw - * but ignore alignment, shadow & no clipping rect. - * - * For drawing on-screen labels. - */ void UI_fontstyle_draw_simple( const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4]) { @@ -294,9 +287,6 @@ void UI_fontstyle_draw_simple( BLF_draw(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); } -/** - * Same as #UI_fontstyle_draw but draw a colored backdrop. - */ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs, float x, float y, @@ -331,7 +321,7 @@ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs, } /* ************** helpers ************************ */ -/* XXX: read a style configure */ + const uiStyle *UI_style_get(void) { #if 0 @@ -344,7 +334,6 @@ const uiStyle *UI_style_get(void) #endif } -/* for drawing, scaled with DPI setting */ const uiStyle *UI_style_get_dpi(void) { const uiStyle *style = UI_style_get(); @@ -376,16 +365,6 @@ int UI_fontstyle_string_width(const uiFontStyle *fs, const char *str) return (int)BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); } -/** - * Return the width of `str` with the spacing & kerning of `fs` with `aspect` - * (representing #uiBlock.aspect) applied. - * - * When calculating text width, the UI layout logic calculate widths without scale, - * only applying scale when drawing. This causes problems for fonts since kerning at - * smaller sizes often makes them wider than a scaled down version of the larger text. - * Resolve this by calculating the text at the on-screen size, - * returning the result scaled back to 1:1. See T92361. - */ int UI_fontstyle_string_width_with_block_aspect(const uiFontStyle *fs, const char *str, const float aspect) @@ -415,8 +394,6 @@ int UI_fontstyle_height_max(const uiFontStyle *fs) /* ************** init exit ************************ */ -/* called on each startup.blend read */ -/* reading without uifont will create one */ void uiStyleInit(void) { const uiStyle *style = U.uistyles.first; diff --git a/source/blender/editors/interface/interface_template_list.cc b/source/blender/editors/interface/interface_template_list.cc index d24b2ba4c59..13e539b5095 100644 --- a/source/blender/editors/interface/interface_template_list.cc +++ b/source/blender/editors/interface/interface_template_list.cc @@ -1276,9 +1276,6 @@ void uiTemplateList(uiLayout *layout, nullptr); } -/** - * \return: A RNA pointer for the operator properties. - */ PointerRNA *UI_list_custom_activate_operator_set(uiList *ui_list, const char *opname, bool create_properties) @@ -1298,9 +1295,6 @@ PointerRNA *UI_list_custom_activate_operator_set(uiList *ui_list, return dyn_data->custom_activate_opptr; } -/** - * \return: A RNA pointer for the operator properties. - */ PointerRNA *UI_list_custom_drag_operator_set(uiList *ui_list, const char *opname, bool create_properties) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index cbd57176a31..7f00db26da9 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -585,7 +585,6 @@ static uiBlock *id_search_menu(bContext *C, ARegion *region, void *arg_litem) /* This is for browsing and editing the ID-blocks used */ -/* for new/open operators */ void UI_context_active_but_prop_get_templateID(bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop) @@ -1556,9 +1555,6 @@ void uiTemplateGpencilColorPreview(uiLayout *layout, false); } -/** - * Version of #uiTemplateID using tabs. - */ void uiTemplateIDTabs(uiLayout *layout, bContext *C, PointerRNA *ptr, @@ -1592,14 +1588,6 @@ void uiTemplateIDTabs(uiLayout *layout, /** \name ID Chooser Template * \{ */ -/** - * This is for selecting the type of ID-block to use, - * and then from the relevant type choosing the block to use. - * - * \param propname: property identifier for property that ID-pointer gets stored to. - * \param proptypename: property identifier for property - * used to determine the type of ID-pointer that can be used. - */ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, @@ -1855,10 +1843,6 @@ static TemplateSearch *template_search_setup(PointerRNA *ptr, return template_search; } -/** - * Search menu to pick an item from a collection. - * A version of uiTemplateID that works for non-ID types. - */ void uiTemplateSearch(uiLayout *layout, bContext *C, PointerRNA *ptr, @@ -1909,13 +1893,6 @@ void uiTemplateSearchPreview(uiLayout *layout, /* ---------- */ -/** - * This is creating/editing RNA-Paths - * - * - ptr: struct which holds the path property - * - propname: property identifier for property that path gets stored to - * - root_ptr: struct that path gets built from - */ void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, @@ -2102,9 +2079,6 @@ static void bone_constraint_panel_id(void *md_link, char *r_name) strcat(r_name, cti->structName); } -/** - * Check if the constraint panels don't match the data and rebuild the panels if so. - */ void uiTemplateConstraints(uiLayout *UNUSED(layout), bContext *C, bool use_bone_constraints) { ARegion *region = CTX_wm_region(C); @@ -2280,9 +2254,6 @@ static void shaderfx_panel_id(void *fx_v, char *r_idname) BKE_shaderfxType_panel_id(fx->type, r_idname); } -/** - * Check if the shader effect panels don't match the data and rebuild the panels if so. - */ void uiTemplateShaderFx(uiLayout *UNUSED(layout), bContext *C) { ARegion *region = CTX_wm_region(C); @@ -2564,11 +2535,6 @@ static bool ui_layout_operator_properties_only_booleans(const bContext *C, return true; } -/** - * Draw Operator property buttons for redoing execution with different settings. - * This function does not initialize the layout, - * functions can be called on the layout before and after. - */ void uiTemplateOperatorPropertyButs( const bContext *C, uiLayout *layout, wmOperator *op, eButLabelAlign label_align, short flag) { @@ -3537,9 +3503,6 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname /** \name Icon Template * \{ */ -/** - * \param icon_scale: Scale of the icon, 1x == button height. - */ void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale) { uiBlock *block = uiLayoutAbsoluteBlock(layout); @@ -3648,9 +3611,6 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *region, void *arg_lit return block; } -/** - * \param icon_scale: Scale of the icon, 1x == button height. - */ void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, @@ -5218,10 +5178,6 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAUp UI_block_funcN_set(block, NULL, NULL, NULL); } -/** - * Template for a path creation widget intended for custom bevel profiles. - * This section is quite similar to #uiTemplateCurveMapping, but with reduced complexity. - */ void uiTemplateCurveProfile(uiLayout *layout, PointerRNA *ptr, const char *propname) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -5268,7 +5224,6 @@ void uiTemplateCurveProfile(uiLayout *layout, PointerRNA *ptr, const char *propn #define WHEEL_SIZE (5 * U.widget_unit) -/* This template now follows User Preference for type - name is not correct anymore... */ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propname, @@ -5659,10 +5614,6 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2) /* see view3d_header.c */ } -/** - * \todo for now, grouping of layers is determined by dividing up the length of - * the array of layer bitflags - */ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname, diff --git a/source/blender/editors/interface/interface_undo.c b/source/blender/editors/interface/interface_undo.c index 40f196d9b45..6916e1080b6 100644 --- a/source/blender/editors/interface/interface_undo.c +++ b/source/blender/editors/interface/interface_undo.c @@ -91,11 +91,6 @@ const char *ui_textedit_undo(uiUndoStack_Text *stack, int direction, int *r_curs return ui_textedit_redo_impl(stack, r_cursor_index); } -/** - * Push the information in the arguments to a new state in the undo stack. - * - * \note Currently the total length of the undo stack is not limited. - */ void ui_textedit_undo_push(uiUndoStack_Text *stack, const char *text, int cursor_index) { /* Clear all redo actions from the current state. */ @@ -114,11 +109,7 @@ void ui_textedit_undo_push(uiUndoStack_Text *stack, const char *text, int cursor memcpy(stack->current->text, text, text_size); BLI_addtail(&stack->states, stack->current); } -/** - * Start the undo stack. - * - * \note The current state should be pushed immediately after calling this. - */ + uiUndoStack_Text *ui_textedit_undo_stack_create(void) { uiUndoStack_Text *stack = MEM_mallocN(sizeof(uiUndoStack_Text), __func__); diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 1a41dc8e9fb..30436c52c38 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -354,12 +354,6 @@ uiBut *uiDefAutoButR(uiBlock *block, return but; } -/** - * \a check_prop callback filters functions to avoid drawing certain properties, - * in cases where PROP_HIDDEN flag can't be used for a property. - * - * \param prop_activate_init: Property to activate on initial popup (#UI_BUT_ACTIVATE_ON_INIT). - */ eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, bool (*check_prop)(PointerRNA *ptr, @@ -593,7 +587,6 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, MEM_freeN(items_list); } -/***************************** ID Utilities *******************************/ int UI_icon_from_id(const ID *id) { if (id == NULL) { @@ -618,7 +611,6 @@ int UI_icon_from_id(const ID *id) return (ptr.type) ? RNA_struct_ui_icon(ptr.type) : ICON_NONE; } -/* see: report_type_str */ int UI_icon_from_report_type(int type) { if (type & RPT_ERROR_ALL) { @@ -690,10 +682,6 @@ int UI_text_colorid_from_report_type(int type) /********************************** Misc **************************************/ -/** - * Returns the best "UI" precision for given floating value, - * so that e.g. 10.000001 rather gets drawn as '10'... - */ int UI_calc_float_precision(int prec, double value) { static const double pow10_neg[UI_PRECISION_FLOAT_MAX + 1] = { @@ -839,16 +827,6 @@ static bool ui_view2d_cur_ensure_rect_in_view(View2D *v2d, const rctf *rect) return changed; } -/** - * Adjust the view so the rectangle of \a but is in view, with some extra margin. - * - * It's important that this is only executed after buttons received their final #uiBut.rect. E.g. - * #UI_panels_end() modifies them, so if that is executed, this function must not be called before - * it. - * - * \param region: The region the button is placed in. Make sure this is actually the one the button - * is placed in, not just the context region. - */ void UI_but_ensure_in_view(const bContext *C, ARegion *region, const uiBut *but) { View2D *v2d = ®ion->v2d; @@ -892,9 +870,6 @@ struct uiButStoreElem { uiBut **but_p; }; -/** - * Create a new button store, the caller must manage and run #UI_butstore_free - */ uiButStore *UI_butstore_create(uiBlock *block) { uiButStore *bs_handle = MEM_callocN(sizeof(uiButStore), __func__); @@ -966,9 +941,6 @@ void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p) BLI_assert(0); } -/** - * Update the pointer for a registered button. - */ bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src) { bool found = false; @@ -985,9 +957,6 @@ bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *bu return found; } -/** - * NULL all pointers, don't free since the owner needs to be able to inspect. - */ void UI_butstore_clear(uiBlock *block) { LISTBASE_FOREACH (uiButStore *, bs_handle, &block->butstore) { @@ -998,9 +967,6 @@ void UI_butstore_clear(uiBlock *block) } } -/** - * Map freed buttons from the old block and update pointers. - */ void UI_butstore_update(uiBlock *block) { /* move this list to the new block */ diff --git a/source/blender/editors/interface/interface_view.cc b/source/blender/editors/interface/interface_view.cc index 0f0d1b1308e..500834f4434 100644 --- a/source/blender/editors/interface/interface_view.cc +++ b/source/blender/editors/interface/interface_view.cc @@ -56,9 +56,6 @@ template<class T> T *get_view_from_link(ViewLink &link) return t_uptr ? t_uptr->get() : nullptr; } -/** - * Override this for all available tree types. - */ AbstractTreeView *UI_block_add_view(uiBlock &block, StringRef idname, std::unique_ptr<AbstractTreeView> tree_view) @@ -79,9 +76,6 @@ void ui_block_free_views(uiBlock *block) } } -/** - * \param x, y: Coordinate to find a tree-row item at, in window space. - */ uiTreeViewItemHandle *UI_block_tree_view_find_item_at(const ARegion *region, const int xy[2]) { uiButTreeRow *tree_row_but = (uiButTreeRow *)ui_tree_row_find_mouse_over(region, xy); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d2d71c920fe..d5cbb271c8d 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -557,7 +557,6 @@ static void draw_anti_tria( GPU_blend(GPU_BLEND_NONE); } -/* Triangle 'icon' for panel header and other cases. */ void UI_draw_icon_tri(float x, float y, char dir, const float color[4]) { const float f3 = 0.05 * U.widget_unit; @@ -1520,17 +1519,6 @@ static void ui_text_clip_right_ex(const uiFontStyle *fstyle, } } -/** - * Cut off the middle of the text to fit into the given width. - * - * \note in case this middle clipping would just remove a few chars, - * it rather clips right, which is more readable. - * - * If rpart_sep is not Null, the part of str starting to first occurrence of rpart_sep - * is preserved at all cost. - * Useful for strings with shortcuts - * (like 'AVeryLongFooBarLabelForMenuEntry|Ctrl O' -> 'AVeryLong...MenuEntry|Ctrl O'). - */ float UI_text_clip_middle_ex(const uiFontStyle *fstyle, char *str, float okwidth, @@ -2881,7 +2869,6 @@ void ui_hsvcircle_vals_from_pos( *r_val_rad = atan2f(m_delta[0], m_delta[1]) / (2.0f * (float)M_PI) + 0.5f; } -/* cursor in hsv circle, in float units -1 to 1, to map on radius */ void ui_hsvcircle_pos_from_vals( const ColorPicker *cpicker, const rcti *rect, const float *hsv, float *r_xpos, float *r_ypos) { @@ -3018,7 +3005,6 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, const uiWidgetColors *wcol, const /** \name Draw Custom Buttons * \{ */ -/* draws in resolution of 48x4 colors */ void ui_draw_gradient(const rcti *rect, const float hsv[3], const eButGradientType type, @@ -3511,7 +3497,6 @@ static void widget_numbut_embossn(const uiBut *UNUSED(but), widget_numbut_draw(wcol, rect, zoom, state, roundboxalign, true); } -/* function in use for buttons and for view2d sliders */ void UI_draw_widget_scroll(uiWidgetColors *wcol, const rcti *rect, const rcti *slider, int state) { uiWidgetBase wtb; @@ -4666,7 +4651,6 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) /** \name Public API * \{ */ -/* conversion from old to new buttons, so still messy */ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBut *but, rcti *rect) { bTheme *btheme = UI_GetTheme(); @@ -5353,15 +5337,6 @@ void ui_draw_tooltip_background(const uiStyle *UNUSED(style), uiBlock *UNUSED(bl wt->draw(&wt->wcol, rect, 0, 0, 1.0f); } -/** - * Helper call to draw a menu item without a button. - * - * \param state: The state of the button, - * typically #UI_ACTIVE, #UI_BUT_DISABLED, #UI_BUT_INACTIVE. - * \param separator_type: The kind of separator which controls if and how the string is clipped. - * \param r_xmax: The right hand position of the text, this takes into the icon, - * padding and text clipping when there is not enough room to display the full text. - */ void ui_draw_menu_item(const uiFontStyle *fstyle, rcti *rect, const char *name, @@ -5500,10 +5475,6 @@ void ui_draw_menu_item(const uiFontStyle *fstyle, } } -/** - * Version of #ui_draw_preview_item() that does not draw the menu background and item text based on - * state. It just draws the preview and text directly. - */ void ui_draw_preview_item_stateless(const uiFontStyle *fstyle, rcti *rect, const char *name, diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index d960f5e6b1d..3b511e23384 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1035,12 +1035,6 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) return (const uchar *)cp; } -/** - * Initialize default theme. - * - * \note When you add new colors, created & saved themes need initialized - * use function below, #init_userdef_do_versions. - */ void UI_theme_init_default(void) { /* we search for the theme with name Default */ @@ -1091,9 +1085,6 @@ bTheme *UI_GetTheme(void) return U.themes.first; } -/** - * For the rare case we need to temp swap in a different theme (off-screen render). - */ void UI_Theme_Store(struct bThemeState *theme_state) { *theme_state = g_theme_state; @@ -1163,21 +1154,18 @@ void UI_FontThemeColor(int fontid, int colorid) BLF_color4ubv(fontid, color); } -/* get individual values, not scaled */ float UI_GetThemeValuef(int colorid) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); return ((float)cp[0]); } -/* get individual values, not scaled */ int UI_GetThemeValue(int colorid) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); return ((int)cp[0]); } -/* versions of the function above, which take a space-type */ float UI_GetThemeValueTypef(int colorid, int spacetype) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid); @@ -1190,7 +1178,6 @@ int UI_GetThemeValueType(int colorid, int spacetype) return ((int)cp[0]); } -/* get the color, range 0.0-1.0 */ void UI_GetThemeColor3fv(int colorid, float col[3]) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1217,7 +1204,6 @@ void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4]) col[3] = ((float)cp[3]) / 255.0f; } -/* get the color, range 0.0-1.0, complete with shading offset */ void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1350,7 +1336,6 @@ void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int of col[3] = ((float)a) / 255.0f; } -/* get the color, in char pointer */ void UI_GetThemeColor3ubv(int colorid, uchar col[3]) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1359,7 +1344,6 @@ void UI_GetThemeColor3ubv(int colorid, uchar col[3]) col[2] = cp[2]; } -/* get the color, range 0.0-1.0, complete with shading offset */ void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1381,7 +1365,6 @@ void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]) col[3] = ((float)a) / 255.0f; } -/* get the color, in char pointer */ void UI_GetThemeColor4ubv(int colorid, uchar col[4]) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1459,7 +1442,6 @@ void UI_GetColorPtrShade3ubv(const uchar cp[3], uchar col[3], int offset) col[2] = b; } -/* get a 3 byte color, blended and shaded between two other char color pointers */ void UI_GetColorPtrBlendShade3ubv( const uchar cp1[3], const uchar cp2[3], uchar col[3], float fac, int offset) { diff --git a/source/blender/editors/interface/tree_view.cc b/source/blender/editors/interface/tree_view.cc index 58d76b7d3de..65cc699ee17 100644 --- a/source/blender/editors/interface/tree_view.cc +++ b/source/blender/editors/interface/tree_view.cc @@ -39,8 +39,8 @@ namespace blender::ui { /* ---------------------------------------------------------------------- */ /** - * Add a tree-item to the container. This is the only place where items should be added, it handles - * important invariants! + * Add a tree-item to the container. This is the only place where items should be added, it + * handles important invariants! */ AbstractTreeViewItem &TreeViewItemContainer::add_tree_item( std::unique_ptr<AbstractTreeViewItem> item) @@ -605,12 +605,6 @@ TreeViewLayoutBuilder::TreeViewLayoutBuilder(uiBlock &block) : block_(block) { } -/** - * Moves the button following the last added chevron closer to the list item. - * - * Iterates backwards over buttons until finding the tree-row button, which is assumed to be the - * first button added for the row, and can act as a delimiter that way. - */ void TreeViewLayoutBuilder::polish_layout(const uiBlock &block) { LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block.buttons) { @@ -735,11 +729,6 @@ bool UI_tree_view_item_matches(const uiTreeViewItemHandle *a_handle, return a.matches_including_parents(b); } -/** - * Attempt to start dragging the tree-item \a item_. This will not work if the tree item doesn't - * support dragging, i.e. it won't create a drag-controller upon request. - * \return True if dragging started successfully, otherwise false. - */ bool UI_tree_view_item_drag_start(bContext *C, uiTreeViewItemHandle *item_) { const AbstractTreeViewItem &item = reinterpret_cast<const AbstractTreeViewItem &>(*item_); @@ -786,10 +775,6 @@ char *UI_tree_view_item_drop_tooltip(const uiTreeViewItemHandle *item_, const wm return BLI_strdup(drop_controller->drop_tooltip(*drag).c_str()); } -/** - * Let a tree-view item handle a drop event. - * \return True if the drop was handled by the tree-view item. - */ bool UI_tree_view_item_drop_handle(struct bContext *C, uiTreeViewItemHandle *item_, const ListBase *drags) @@ -808,11 +793,6 @@ bool UI_tree_view_item_drop_handle(struct bContext *C, return false; } -/** - * Can \a item_handle be renamed right now? Not that this isn't just a mere wrapper around - * #AbstractTreeViewItem::can_rename(). This also checks if there is another item being renamed, - * and returns false if so. - */ bool UI_tree_view_item_can_rename(const uiTreeViewItemHandle *item_handle) { const AbstractTreeViewItem &item = reinterpret_cast<const AbstractTreeViewItem &>(*item_handle); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 9a6fbbf4016..a4c3f622ad5 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -228,16 +228,6 @@ static void view2d_masks(View2D *v2d, const rcti *mask_scroll) /** \name View2D Refresh and Validation (Spatial) * \{ */ -/** - * Initialize all relevant View2D data (including view rects if first time) - * and/or refresh mask sizes after view resize. - * - * - For some of these presets, it is expected that the region will have defined some - * additional settings necessary for the customization of the 2D viewport to its requirements - * - This function should only be called from region init() callbacks, where it is expected that - * this is called before #UI_view2d_size_update(), - * as this one checks that the rects are properly initialized. - */ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) { bool tot_changed = false, do_init; @@ -872,8 +862,6 @@ bool UI_view2d_area_supports_sync(ScrArea *area) return ELEM(area->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_SEQ, SPACE_CLIP, SPACE_GRAPH); } -/* Called by menus to activate it, or by view2d operators - * to make sure 'related' views stay in synchrony */ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) { /* don't continue if no view syncing to be done */ @@ -937,11 +925,6 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) } } -/** - * Restore 'cur' rect to standard orientation (i.e. optimal maximum view of tot). - * This does not take into account if zooming the view on an axis - * will improve the view (if allowed). - */ void UI_view2d_curRect_reset(View2D *v2d) { float width, height; @@ -991,7 +974,6 @@ void UI_view2d_curRect_reset(View2D *v2d) /* ------------------ */ -/* Change the size of the maximum viewable area (i.e. 'tot' rect) */ void UI_view2d_totRect_set_resize(View2D *v2d, int width, int height, bool resize) { /* don't do anything if either value is 0 */ @@ -1110,7 +1092,6 @@ static void view2d_map_cur_using_mask(const View2D *v2d, rctf *r_curmasked) } } -/* Set view matrices to use 'cur' rect as viewing frame for View2D drawing */ void UI_view2d_view_ortho(const View2D *v2d) { rctf curmasked; @@ -1152,12 +1133,6 @@ void UI_view2d_view_ortho(const View2D *v2d) wmOrtho2(curmasked.xmin, curmasked.xmax, curmasked.ymin, curmasked.ymax); } -/** - * Set view matrices to only use one axis of 'cur' only - * - * \param xaxis: if non-zero, only use cur x-axis, - * otherwise use cur-yaxis (mostly this will be used for x). - */ void UI_view2d_view_orthoSpecial(ARegion *region, View2D *v2d, const bool xaxis) { rctf curmasked; @@ -1184,7 +1159,6 @@ void UI_view2d_view_orthoSpecial(ARegion *region, View2D *v2d, const bool xaxis) } } -/* Restore view matrices after drawing */ void UI_view2d_view_restore(const bContext *C) { ARegion *region = CTX_wm_region(C); @@ -1203,7 +1177,6 @@ void UI_view2d_view_restore(const bContext *C) /** \name Grid-Line Drawing * \{ */ -/* Draw a multi-level grid in given 2d-region */ void UI_view2d_multi_grid_draw( const View2D *v2d, int colorid, float step, int level_size, int totlevels) { @@ -1335,14 +1308,6 @@ static const DotGridLevelInfo level_info[9] = { {0.025f, 0.6f, 0.9f}, }; -/** - * Draw a multi-level grid of dots, with a dynamic number of levels based on the fading. - * - * \param grid_color_id: The theme color used for the points. Faded dynamically based on zoom. - * \param min_step: The base size of the grid. At different zoom levels, the visible grid may have - * a larger step size. - * \param grid_levels: The maximum grid depth. Larger grid levels will subdivide the grid more. - */ void UI_view2d_dot_grid_draw(const View2D *v2d, const int grid_color_id, const float min_step, @@ -1414,6 +1379,8 @@ void UI_view2d_dot_grid_draw(const View2D *v2d, */ struct View2DScrollers { /* focus bubbles */ + /* focus bubbles */ + /* focus bubbles */ int vert_min, vert_max; /* vertical scrollbar */ int hor_min, hor_max; /* horizontal scrollbar */ @@ -1423,7 +1390,6 @@ struct View2DScrollers { /* int horfull, vertfull; */ /* UNUSED */ }; -/* Calculate relevant scroller properties */ void UI_view2d_scrollers_calc(View2D *v2d, const rcti *mask_custom, struct View2DScrollers *r_scrollers) @@ -1550,7 +1516,6 @@ void UI_view2d_scrollers_calc(View2D *v2d, } } -/* Draw scrollbars in the given 2d-region */ void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) { View2DScrollers scrollers; @@ -1646,18 +1611,6 @@ void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) /** \name List View Utilities * \{ */ -/** - * Get the 'cell' (row, column) that the given 2D-view coordinates - * (i.e. in 'tot' rect space) lie in. - * - * \param columnwidth, rowheight: size of each 'cell' - * \param startx, starty: coordinates (in 'tot' rect space) that the list starts from. - * This should be (0,0) for most views. However, for those where the starting row was offsetted - * (like for Animation Editor channel lists, to make the first entry more visible), these will be - * the min-coordinates of the first item. - * \param viewx, viewy: 2D-coordinates (in 2D-view / 'tot' rect space) to get the cell for - * \param r_column, r_row: the 'coordinates' of the relevant 'cell' - */ void UI_view2d_listview_view_to_cell(float columnwidth, float rowheight, float startx, @@ -1705,12 +1658,6 @@ float UI_view2d_region_to_view_y(const struct View2D *v2d, float y) (BLI_rctf_size_y(&v2d->cur) * (y - v2d->mask.ymin) / BLI_rcti_size_y(&v2d->mask))); } -/** - * Convert from screen/region space to 2d-View space - * - * \param x, y: coordinates to convert - * \param r_view_x, r_view_y: resultant coordinates - */ void UI_view2d_region_to_view( const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) { @@ -1744,13 +1691,6 @@ float UI_view2d_view_to_region_y(const View2D *v2d, float y) (((y - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur)) * BLI_rcti_size_y(&v2d->mask))); } -/** - * Convert from 2d-View space to screen/region space - * \note Coordinates are clamped to lie within bounds of region - * - * \param x, y: Coordinates to convert. - * \param r_region_x, r_region_y: Resultant coordinates. - */ bool UI_view2d_view_to_region_clip( const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) { @@ -1772,14 +1712,6 @@ bool UI_view2d_view_to_region_clip( return false; } -/** - * Convert from 2d-view space to screen/region space - * - * \note Coordinates are NOT clamped to lie within bounds of region. - * - * \param x, y: Coordinates to convert. - * \param r_region_x, r_region_y: Resultant coordinates. - */ void UI_view2d_view_to_region( const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) { @@ -1874,7 +1806,6 @@ bool UI_view2d_view_to_region_rcti_clip(const View2D *v2d, const rctf *rect_src, /** \name Utilities * \{ */ -/* View2D data by default resides in region, so get from region stored in context */ View2D *UI_view2d_fromcontext(const bContext *C) { ScrArea *area = CTX_wm_area(C); @@ -1889,7 +1820,6 @@ View2D *UI_view2d_fromcontext(const bContext *C) return &(region->v2d); } -/* Same as above, but it returns region-window. Utility for pull-downs or buttons. */ View2D *UI_view2d_fromcontext_rwin(const bContext *C) { ScrArea *area = CTX_wm_area(C); @@ -1908,8 +1838,6 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C) return &(region->v2d); } -/* Get scrollbar sizes of the current 2D view. The size will be zero if the view has its scrollbars - * disabled. */ void UI_view2d_scroller_size_get(const View2D *v2d, float *r_x, float *r_y) { const int scroll = view2d_scroll_mapped(v2d->scroll); @@ -1933,14 +1861,6 @@ void UI_view2d_scroller_size_get(const View2D *v2d, float *r_x, float *r_y) } } -/** - * Calculate the scale per-axis of the drawing-area - * - * Is used to inverse correct drawing of icons, etc. that need to follow view - * but not be affected by scale - * - * \param r_x, r_y: scale on each axis - */ void UI_view2d_scale_get(const View2D *v2d, float *r_x, float *r_y) { if (r_x) { @@ -1958,9 +1878,6 @@ float UI_view2d_scale_get_y(const View2D *v2d) { return BLI_rcti_size_y(&v2d->mask) / BLI_rctf_size_y(&v2d->cur); } -/** - * Same as `UI_view2d_scale_get() - 1.0f / x, y`. - */ void UI_view2d_scale_get_inverse(const View2D *v2d, float *r_x, float *r_y) { if (r_x) { @@ -1971,10 +1888,6 @@ void UI_view2d_scale_get_inverse(const View2D *v2d, float *r_x, float *r_y) } } -/** - * Simple functions for consistent center offset access. - * Used by node editor to shift view center for each individual node tree. - */ void UI_view2d_center_get(const struct View2D *v2d, float *r_x, float *r_y) { /* get center */ @@ -1993,12 +1906,6 @@ void UI_view2d_center_set(struct View2D *v2d, float x, float y) UI_view2d_curRect_validate(v2d); } -/** - * Simple pan function - * (0.0, 0.0) bottom left - * (0.5, 0.5) center - * (1.0, 1.0) top right. - */ void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac) { if (xfac != -1.0f) { @@ -2022,17 +1929,6 @@ void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac) UI_view2d_curRect_validate(v2d); } -/** - * Check if mouse is within scrollers - * - * \param x, y: Mouse coordinates in screen (not region) space. - * \param r_scroll: Mapped view2d scroll flag. - * - * \return appropriate code for match. - * - 'h' = in horizontal scroller. - * - 'v' = in vertical scroller. - * - 0 = not in scroller. - */ char UI_view2d_mouse_in_scrollers_ex(const ARegion *region, const View2D *v2d, const int xy[2], @@ -2154,7 +2050,6 @@ void UI_view2d_text_cache_add( } } -/* no clip (yet) */ void UI_view2d_text_cache_add_rectf( View2D *v2d, const rctf *rect_view, const char *str, size_t str_len, const uchar col[4]) { diff --git a/source/blender/editors/interface/view2d_gizmo_navigate.c b/source/blender/editors/interface/view2d_gizmo_navigate.c index 3ff5b471731..2497081b412 100644 --- a/source/blender/editors/interface/view2d_gizmo_navigate.c +++ b/source/blender/editors/interface/view2d_gizmo_navigate.c @@ -251,7 +251,6 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *g WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false); } -/* Caller defines the name for gizmo group. */ void VIEW2D_GGT_navigate_impl(wmGizmoGroupType *gzgt, const char *idname) { gzgt->name = "View2D Navigate"; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 0bca4e327cc..0d3c427bf39 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1570,8 +1570,6 @@ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b) return min_ff(fac_max, 1.0f); } -/* will start timer if appropriate */ -/* the arguments are the desired situation */ void UI_view2d_smooth_view(bContext *C, ARegion *region, const rctf *cur, const int smooth_viewtx) { wmWindowManager *wm = CTX_wm_manager(C); @@ -1761,7 +1759,6 @@ typedef struct v2dScrollerMove { * For now, we don't need to have a separate (internal) header for structs like this... */ struct View2DScrollers { - /* focus bubbles */ int vert_min, vert_max; /* vertical scrollbar */ int hor_min, hor_max; /* horizontal scrollbar */ |