Blender
V3.3
|
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "PIL_time.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "RNA_access.h"
#include "BLF_api.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_screen.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "GPU_batch_presets.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "interface_intern.h"
Go to the source code of this file.
Classes | |
struct | uiHandlePanelData |
struct | PanelSort |
struct | uiPanelDragCollapseHandle |
Drawing | |
#define | PNL_ICON UI_UNIT_X /* Could be UI_UNIT_Y too. */ |
void | UI_panels_draw (const bContext *C, ARegion *region) |
void | UI_panel_label_offset (const uiBlock *block, int *r_x, int *r_y) |
static void | panel_title_color_get (const Panel *panel, const bool show_background, const bool region_search_filter_active, uchar r_color[4]) |
static void | panel_draw_highlight_border (const Panel *panel, const rcti *rect, const rcti *header_rect) |
static void | panel_draw_aligned_widgets (const uiStyle *style, const Panel *panel, const rcti *header_rect, const float aspect, const bool show_pin, const bool show_background, const bool region_search_filter_active) |
static void | panel_draw_aligned_backdrop (const Panel *panel, const rcti *rect, const rcti *header_rect) |
void | ui_draw_aligned_panel (const uiStyle *style, const uiBlock *block, const rcti *rect, const bool show_pin, const bool show_background, const bool region_search_filter_active) |
bool | UI_panel_should_show_background (const ARegion *region, const PanelType *panel_type) |
Category Drawing (Tabs) | |
#define | TABS_PADDING_BETWEEN_FACTOR 4.0f |
#define | TABS_PADDING_TEXT_FACTOR 6.0f |
void | UI_panel_category_draw_all (ARegion *region, const char *category_id_active) |
Panel Dragging | |
#define | DRAG_REGION_PAD (PNL_HEADER * 0.5) |
static void | ui_do_drag (const bContext *C, const wmEvent *event, Panel *panel) |
#define ANIMATION_INTERVAL 0.02 |
Definition at line 58 of file interface_panel.c.
#define ANIMATION_TIME 0.30 |
Definition at line 57 of file interface_panel.c.
#define DRAG_REGION_PAD (PNL_HEADER * 0.5) |
Definition at line 1892 of file interface_panel.c.
Definition at line 1015 of file interface_panel.c.
#define TABS_PADDING_BETWEEN_FACTOR 4.0f |
Definition at line 1297 of file interface_panel.c.
#define TABS_PADDING_TEXT_FACTOR 6.0f |
Definition at line 1298 of file interface_panel.c.
typedef struct uiHandlePanelData uiHandlePanelData |
typedef enum uiHandlePanelState uiHandlePanelState |
typedef struct uiPanelDragCollapseHandle uiPanelDragCollapseHandle |
typedef enum uiPanelMouseState uiPanelMouseState |
typedef enum uiPanelRuntimeFlag uiPanelRuntimeFlag |
enum uiHandlePanelState |
Enumerator | |
---|---|
PANEL_STATE_DRAG | |
PANEL_STATE_ANIMATION | |
PANEL_STATE_EXIT |
Definition at line 90 of file interface_panel.c.
enum uiPanelMouseState |
Enumerator | |
---|---|
PANEL_MOUSE_OUTSIDE | |
PANEL_MOUSE_INSIDE_CONTENT | Mouse is not in the panel. |
PANEL_MOUSE_INSIDE_HEADER | Mouse is in the actual panel content. |
Definition at line 84 of file interface_panel.c.
enum uiPanelRuntimeFlag |
Enumerator | |
---|---|
PANEL_LAST_ADDED | |
PANEL_ACTIVE | |
PANEL_WAS_ACTIVE | |
PANEL_ANIM_ALIGN | |
PANEL_NEW_ADDED | |
PANEL_SEARCH_FILTER_MATCH | |
PANEL_USE_CLOSED_FROM_SEARCH | Use the status set by property search (PANEL_SEARCH_FILTER_MATCH) instead of PNL_CLOSED. Set to true on every property search update. |
PANEL_WAS_CLOSED | The Panel was before the start of the current / latest layout pass. |
PANEL_IS_DRAG_DROP | Set when the panel is being dragged and while it animates back to its aligned position. Unlike PANEL_STATE_ANIMATION, this is applied to sub-panels as well. |
PANEL_ACTIVE_BORDER | Draw a border with the active color around the panel. |
Definition at line 60 of file interface_panel.c.
Definition at line 1635 of file interface_panel.c.
References Panel::blocksizey, Panel::children, get_panel_real_size_y(), get_panel_size_y(), LISTBASE_FOREACH, Panel::ofsx, Panel::ofsy, PANEL_ACTIVE, and Panel::sizey.
Referenced by uiAlignPanelStep().
Definition at line 1620 of file interface_panel.c.
References Freestyle::a, usdtokens::b(), and Panel::sortorder.
Referenced by reorder_instanced_panel_list(), and uiAlignPanelStep().
Definition at line 1587 of file interface_panel.c.
References Freestyle::a, usdtokens::b(), PanelType::flag, Panel::ofsy, PANEL_TYPE_NO_HEADER, Panel::sizey, Panel::sortorder, and Panel::type.
Referenced by uiAlignPanelStep().
Recursive implementation for set_panels_list_data_expand_flag.
Definition at line 517 of file interface_panel.c.
References Panel::children, Panel::flag, LISTBASE_FOREACH, PNL_CLOSED, and SET_FLAG_FROM_TEST.
Referenced by set_panels_list_data_expand_flag().
|
static |
This function is needed because uiBlock and Panel itself don't change Panel.sizey or location when closed.
Definition at line 1566 of file interface_panel.c.
References Panel::ofsy, Panel::sizey, and UI_panel_is_closed().
Referenced by ui_panels_size().
|
static |
Definition at line 1546 of file interface_panel.c.
References PanelType::flag, PANEL_TYPE_NO_HEADER, PNL_HEADER, Panel::sizey, Panel::type, and UI_panel_is_closed().
Referenced by align_sub_panels(), panel_calculate_size_recursive(), UI_panel_size_y(), and uiAlignPanelStep().
|
static |
Definition at line 1537 of file interface_panel.c.
References PanelType::flag, PANEL_TYPE_NO_HEADER, PNL_HEADER, Panel::sizey, and Panel::type.
Referenced by align_sub_panels().
|
static |
Definition at line 2555 of file interface_panel.c.
References Panel::activedata, BLI_assert, C, CTX_wm_manager(), CTX_wm_region(), CTX_wm_window(), data, ED_region_tag_redraw(), MEM_freeN, wmWindow::modalhandlers, NULL, ot, panel_custom_data_active_set(), panel_handle_data_ensure(), PANEL_IS_DRAG_DROP, panel_set_flag_recursive(), panel_set_runtime_flag_recursive(), PANEL_STATE_ANIMATION, PANEL_STATE_DRAG, PANEL_STATE_EXIT, PNL_SELECT, state, ui_handle_afterfunc_add_operator(), ui_handler_panel(), ui_handler_remove_panel(), WM_event_remove_timer(), WM_event_remove_ui_handler(), WM_OP_INVOKE_DEFAULT, and WM_operatortype_find().
Referenced by panel_set_expansion_from_list_data(), ui_do_animate(), ui_handle_panel_header(), ui_handler_panel(), ui_handler_remove_panel(), ui_panel_drag_collapse(), UI_panels_end(), and UI_panels_free_instanced().
|
static |
Definition at line 129 of file interface_panel.c.
References data, LISTBASE_FOREACH, PANEL_ACTIVE, PANEL_ANIM_ALIGN, PANEL_STATE_ANIMATION, PANEL_WAS_ACTIVE, PANEL_WAS_CLOSED, and UI_panel_is_closed().
Referenced by panels_need_realign().
|
static |
Definition at line 223 of file interface_panel.c.
References BLI_addtail(), BLI_strncpy(), PanelType::children, Panel::children, Panel_Runtime::custom_data_ptr, PanelType::idname, LISTBASE_FOREACH, MEM_callocN, PANEL_NEW_ADDED, Panel::panelname, Panel::runtime, Panel::runtime_flag, Panel::sortorder, and Panel::type.
Referenced by UI_panel_add_instanced().
Starting from the "block size" set in UI_panel_end, calculate the full size of the panel including the sub-panel headers and buttons.
Definition at line 792 of file interface_panel.c.
References Panel::blocksizex, Panel::blocksizey, Panel::children, get_panel_real_size_y(), height, LISTBASE_FOREACH, max_ii(), Panel::ofsy, PANEL_ACTIVE, PANEL_ANIM_ALIGN, PANEL_NEW_ADDED, panel_region_offset_x_get(), Panel_Runtime::region_ofsx, Panel::runtime, Panel::runtime_flag, Panel::sizex, Panel::sizey, UI_panel_is_closed(), and width.
Referenced by UI_panels_end().
|
static |
Definition at line 2239 of file interface_panel.c.
References BLI_rcti_isect_pt(), LISTBASE_FOREACH, wmEvent::mval, NULL, and ARegion::panels_category.
Referenced by ui_handler_panel_region().
Definition at line 562 of file interface_panel.c.
References PanelType::active_property, BLI_assert, NULL, ptr, RNA_boolean_get(), RNA_pointer_is_null(), Panel::type, UI_panel_custom_data_get(), and UI_panel_is_active().
Referenced by ui_draw_aligned_panel().
Definition at line 578 of file interface_panel.c.
References PanelType::active_property, BLI_assert, NULL, ptr, RNA_boolean_set(), RNA_pointer_is_null(), RNA_struct_find_property(), Panel::type, UI_panel_custom_data_get(), and UI_panel_is_active().
Referenced by panel_activate_state(), and ui_handle_panel_header().
|
static |
Free a panel and its children. Custom data is shared by the panel and its children and is freed by UI_panels_free_instanced.
Definition at line 298 of file interface_panel.c.
References Panel::activedata, BLI_freelistN(), BLI_remlink(), C, Panel::children, LISTBASE_FOREACH_MUTABLE, and MEM_freeN.
Referenced by UI_panels_free_instanced().
|
static |
Definition at line 1176 of file interface_panel.c.
References uiBlock::aspect, Panel_Runtime::block, PanelType::flag, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_SHADER_2D_UNIFORM_COLOR, immBindBuiltinProgram(), immUnbindProgram(), NULL, ThemeUI::panel_roundness, PANEL_TYPE_NO_HEADER, PanelType::parent, Panel::runtime, TH_MATCH, TH_PANEL_BACK, TH_PANEL_HEADER, TH_PANEL_SUB_BACK, bTheme::tui, Panel::type, UI_CNR_ALL, UI_CNR_BOTTOM_LEFT, UI_CNR_BOTTOM_RIGHT, UI_CNR_TOP_LEFT, UI_CNR_TOP_RIGHT, UI_draw_roundbox_4fv(), UI_draw_roundbox_corner_set(), UI_GetTheme(), UI_GetThemeColor4fv(), UI_panel_is_closed(), UI_panel_matches_search_filter(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by ui_draw_aligned_panel().
|
static |
Definition at line 1081 of file interface_panel.c.
References batch, BLI_rcti_size_y(), Panel::drawname, Panel::flag, GPU_batch_draw(), GPU_batch_preset_panel_drag_widget(), GPU_batch_program_set_builtin(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_translate_2f(), GPU_SHADER_2D_FLAT_COLOR, GPUBatch, Panel::labelofs, NULL, panel_title_color_get(), uiStyle::paneltitle, PanelType::parent, PNL_PIN, round_fl_to_int(), TH_PANEL_BACK, TH_PANEL_HEADER, Panel::type, UI_fontstyle_draw(), UI_GetThemeColorShade4fv(), UI_icon_draw_ex(), UI_panel_is_closed(), UI_UNIT_X, uiStyle::widgetlabel, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by ui_draw_aligned_panel().
|
static |
Definition at line 1053 of file interface_panel.c.
References uiBlock::aspect, Panel_Runtime::block, color, NULL, ThemeUI::panel_roundness, PanelType::parent, Panel::runtime, TH_SELECT_ACTIVE, bTheme::tui, Panel::type, UI_CNR_ALL, UI_draw_roundbox_4fv(), UI_draw_roundbox_corner_set(), UI_GetTheme(), UI_GetThemeColor4fv(), UI_panel_is_closed(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by ui_draw_aligned_panel().
|
static |
Definition at line 2524 of file interface_panel.c.
References Panel::activedata, ANIMATION_INTERVAL, C, CTX_wm_manager(), View2D::cur, data, wmWindow::eventstate, MEM_callocN, wmWindow::modalhandlers, NULL, Panel::ofsx, Panel::ofsy, PIL_check_seconds_timer(), state, TIMER, ui_handler_panel(), ui_handler_remove_panel(), ARegion::v2d, WM_event_add_timer(), WM_event_add_ui_handler(), rctf::xmin, wmEvent::xy, and rctf::ymin.
Referenced by panel_activate_state().
|
static |
Definition at line 868 of file interface_panel.c.
References Panel::children, LISTBASE_FOREACH, PANEL_SEARCH_FILTER_MATCH, and Panel::runtime_flag.
Referenced by UI_panel_matches_search_filter().
Definition at line 777 of file interface_panel.c.
References ARegion::alignment, RGN_ALIGN_ENUM_FROM_MASK, RGN_ALIGN_RIGHT, UI_panel_category_is_visible(), and UI_PANEL_CATEGORY_MARGIN_WIDTH.
Referenced by panel_calculate_size_recursive(), and uiAlignPanelStep().
|
static |
Hide buttons in invisible layouts, which are created because buttons must be added for all panels in order to search, even panels that will end up closed.
Definition at line 926 of file interface_panel.c.
References uiBlock::active, BLI_assert, Panel_Runtime::block, uiBlock::button_groups, uiBlock::buttons, Panel::children, uiBut::flag, LISTBASE_FOREACH, NULL, PANEL_ACTIVE, Panel::runtime, UI_block_set_search_only(), UI_BUTTON_GROUP_PANEL_HEADER, UI_HIDDEN, and UI_panel_is_closed().
Referenced by region_panels_remove_invisible_layouts().
|
static |
Recursive implementation for panel_set_expansion_from_list_data.
Definition at line 463 of file interface_panel.c.
References Panel::children, Panel::flag, LISTBASE_FOREACH, PNL_CLOSED, SET_FLAG_FROM_TEST, and UI_panel_is_closed().
Referenced by panel_set_expansion_from_list_data().
Set the expansion of the panel and its sub-panels from the flag stored in the corresponding list data. The flag has expansion stored in each bit in depth first order.
Definition at line 481 of file interface_panel.c.
References BLI_assert, C, PanelType::flag, PanelType::get_list_data_expand_flag, NULL, panel_activate_state(), panel_set_expand_from_list_data_recursive(), PANEL_STATE_ANIMATION, PANEL_TYPE_INSTANCED, and Panel::type.
Referenced by region_panels_set_expansion_from_list_data(), and UI_panel_add_instanced().
|
static |
Set the flag telling the panel to use its search result status for its expansion.
Definition at line 890 of file interface_panel.c.
References C, Panel::children, PanelType::flag, LISTBASE_FOREACH, NULL, PANEL_TYPE_NO_HEADER, PANEL_USE_CLOSED_FROM_SEARCH, Panel::runtime_flag, SET_FLAG_FROM_TEST, and Panel::type.
Referenced by region_panels_set_expansion_from_search_filter().
Set flag state for a panel and its sub-panels.
Definition at line 596 of file interface_panel.c.
References Panel::children, Panel::flag, LISTBASE_FOREACH, and SET_FLAG_FROM_TEST.
Referenced by panel_activate_state(), and ui_handle_panel_header().
Set runtime flag state for a panel and its sub-panels.
Definition at line 608 of file interface_panel.c.
References Panel::children, LISTBASE_FOREACH, Panel::runtime_flag, and SET_FLAG_FROM_TEST.
Referenced by panel_activate_state().
|
static |
Definition at line 1030 of file interface_panel.c.
References copy_v4_v4_uchar(), uiWidgetColors::text, TH_TITLE, bTheme::tui, UI_GetTheme(), UI_GetThemeColor4ubv(), UI_panel_matches_search_filter(), and ThemeUI::wcol_menu_back.
Referenced by panel_draw_aligned_widgets().
|
static |
Definition at line 638 of file interface_panel.c.
References BLI_listbase_is_empty(), PanelType::category, PanelType::context, blender::compositor::context, ARegion::panels_category, STREQ, and UI_panel_category_active_get().
Referenced by reorder_instanced_panel_list().
Definition at line 617 of file interface_panel.c.
References PanelType::category, PanelType::context, PanelType::flag, LISTBASE_FOREACH, NULL, PANEL_TYPE_NO_HEADER, ARegion::panels, PNL_CLOSED, PNL_PIN, STREQ, Panel::type, UI_panel_category_active_get(), and UI_panel_category_is_visible().
Referenced by ui_handle_panel_header().
Definition at line 1814 of file interface_panel.c.
References LISTBASE_FOREACH, PANEL_ACTIVE, PANEL_IS_DRAG_DROP, PANEL_USE_CLOSED_FROM_SEARCH, PANEL_WAS_ACTIVE, PANEL_WAS_CLOSED, SET_FLAG_FROM_TEST, and UI_panel_is_closed().
Referenced by UI_panels_begin().
|
static |
Definition at line 191 of file interface_panel.c.
References blender::compositor::area(), NULL, panel_active_animation_changed(), ARegion::panels, and properties_space_needs_realign().
Referenced by UI_panels_end().
Definition at line 178 of file interface_panel.c.
References blender::compositor::area(), SpaceProperties::mainb, SpaceProperties::mainbo, ARegion::regiontype, RGN_TYPE_WINDOW, and SPACE_PROPERTIES.
Referenced by panels_need_realign(), and UI_panels_end().
Definition at line 961 of file interface_panel.c.
References BLI_assert, LISTBASE_FOREACH, NULL, PANEL_ACTIVE, panel_remove_invisible_layouts_recursive(), and ARegion::panels.
Referenced by UI_panels_end().
|
static |
Set expansion based on the data for instanced panels.
Definition at line 502 of file interface_panel.c.
References C, LISTBASE_FOREACH, NULL, PANEL_ACTIVE, panel_set_expansion_from_list_data(), PANEL_TYPE_INSTANCED, and ARegion::panels.
Referenced by UI_panels_end().
|
static |
Set the flag telling every panel to override its expansion with its search result status.
Definition at line 910 of file interface_panel.c.
References C, LISTBASE_FOREACH, panel_set_expansion_from_search_filter_recursive(), ARegion::panels, and set_panels_list_data_expand_flag().
Referenced by UI_panels_end().
|
static |
Definition at line 383 of file interface_panel.c.
References BLI_assert, C, compare_panel(), PanelType::context, blender::compositor::context, Panel_Runtime::context, CTX_store_set(), Panel::flag, LISTBASE_FOREACH, MEM_callocN, MEM_freeN, NULL, PanelSort::panel, panel_type_context_poll(), PANEL_TYPE_INSTANCED, ARegion::panels, PNL_INSTANCED_LIST_ORDER_CHANGED, PanelType::reorder, Panel::runtime, Panel::type, ARegion::type, and UI_panel_category_is_visible().
Referenced by ui_do_animate().
Call the callback to store the panel and sub-panel expansion settings in the list item that corresponds to each instanced panel.
Definition at line 536 of file interface_panel.c.
References C, PanelType::flag, get_panel_expand_flag(), LISTBASE_FOREACH, NULL, PANEL_ACTIVE, PANEL_TYPE_INSTANCED, and ARegion::panels.
Referenced by region_panels_set_expansion_from_search_filter(), ui_handle_panel_header(), and ui_panel_drag_collapse().
Definition at line 1792 of file interface_panel.c.
References Panel::activedata, ANIMATION_TIME, C, CTX_wm_region(), data, ED_region_tag_redraw(), min_ff(), panel_activate_state(), PANEL_STATE_EXIT, PIL_check_seconds_timer(), reorder_instanced_panel_list(), sqrtf, UI_panel_is_dragging(), and uiAlignPanelStep().
Referenced by ui_handler_panel().
Definition at line 1893 of file interface_panel.c.
References Panel::activedata, BLI_rctf_size_y(), BLI_rcti_size_y(), C, clamp_i(), CTX_wm_region(), View2D::cur, data, DRAG_REGION_PAD, ED_region_tag_redraw(), float(), Panel::ofsy, round_fl_to_int(), uiAlignPanelStep(), ARegion::v2d, ARegion::winrct, wmEvent::xy, y, rcti::ymax, rcti::ymin, and rctf::ymin.
Referenced by ui_handler_panel().
void ui_draw_aligned_panel | ( | const uiStyle * | style, |
const uiBlock * | block, | ||
const rcti * | rect, | ||
const bool | show_pin, | ||
const bool | show_background, | ||
const bool | region_search_filter_active | ||
) |
Definition at line 1236 of file interface_panel.c.
References uiBlock::aspect, PanelType::flag, blender::math::floor(), uiBlock::panel, panel_custom_data_active_get(), panel_draw_aligned_backdrop(), panel_draw_aligned_widgets(), panel_draw_highlight_border(), PANEL_TYPE_NO_HEADER, PNL_HEADER, Panel::type, rcti::xmax, rcti::xmin, and rcti::ymax.
|
static |
Definition at line 2265 of file interface_panel.c.
References ARegion::alignment, ED_region_tag_redraw(), ELEM, ListBase::first, PanelCategoryDyn::idname, KM_CTRL, KM_SHIFT, ListBase::last, LIKELY, wmEvent::modifier, wmEvent::mval, PanelCategoryDyn::next, ARegion::panels_category, PanelCategoryDyn::prev, RGN_ALIGN_ENUM_FROM_MASK, RGN_ALIGN_RIGHT, wmEvent::type, ui_but_supports_cycling(), UI_panel_category_active_get(), UI_panel_category_active_set(), UI_panel_category_find(), WHEELDOWNMOUSE, WHEELUPMOUSE, WM_UI_HANDLER_BREAK, and WM_UI_HANDLER_CONTINUE.
Referenced by ui_handler_panel_region().
|
static |
Supposing the block has a panel and isn't a menu, handle opening, closing, pinning, etc. Code currently assumes layout style for location of widgets
mx | The mouse x coordinate, in panel space. |
Definition at line 2059 of file interface_panel.c.
References ARegion::alignment, BLI_assert, BLI_listbase_is_empty(), C, Panel::children, CTX_wm_region(), ED_region_tag_redraw(), ELEM, EVT_AKEY, EVT_PADENTER, EVT_RETKEY, ListBase::first, PanelType::flag, Panel::flag, IN_RANGE, LEFTMOUSE, NULL, uiBlock::panel, panel_activate_state(), panel_custom_data_active_set(), panel_set_flag_recursive(), PANEL_STATE_ANIMATION, PANEL_STATE_DRAG, PANEL_TYPE_NO_HEADER, panels_collapse_all(), PanelType::parent, PNL_CLOSED, PNL_ICON, PNL_PIN, uiBlock::rect, RGN_ALIGN_FLOAT, SET_FLAG_FROM_TEST, set_panels_list_data_expand_flag(), Panel::type, UI_panel_can_be_pinned(), UI_panel_category_is_visible(), ui_panel_drag_collapse_handler_add(), UI_panel_is_closed(), UI_view2d_offset(), ARegion::v2d, and rctf::xmax.
Referenced by ui_handler_panel_region().
Definition at line 2486 of file interface_panel.c.
References Panel::activedata, C, wmEvent::customdata, data, KM_RELEASE, LEFTMOUSE, MOUSEMOVE, panel_activate_state(), PANEL_STATE_ANIMATION, PANEL_STATE_DRAG, TIMER, wmEvent::type, ui_do_animate(), ui_do_drag(), wmEvent::val, WM_UI_HANDLER_BREAK, and WM_UI_HANDLER_CONTINUE.
Referenced by panel_activate_state(), and panel_handle_data_ensure().
int ui_handler_panel_region | ( | bContext * | C, |
const wmEvent * | event, | ||
ARegion * | region, | ||
const uiBut * | active_but | ||
) |
Definition at line 2315 of file interface_panel.c.
References C, ED_region_tag_redraw(), ELEM, EVT_AKEY, EVT_PADENTER, EVT_RETKEY, EVT_TABKEY, PanelType::flag, Panel::flag, PanelCategoryDyn::idname, ISMOUSE_MOTION, KM_ALT, KM_CTRL, KM_OSKEY, KM_PRESS, KM_SHIFT, LEFTMOUSE, LISTBASE_FOREACH, wmEvent::modifier, NULL, panel_categories_find_mouse_over(), PANEL_MOUSE_INSIDE_HEADER, PANEL_MOUSE_OUTSIDE, PANEL_TYPE_NO_HEADER, PANEL_USE_CLOSED_FROM_SEARCH, PNL_CLOSED, RIGHTMOUSE, Panel::runtime_flag, SET_FLAG_FROM_TEST, Panel::type, wmEvent::type, ui_handle_panel_category_cycling(), ui_handle_panel_header(), UI_panel_category_active_set(), UI_panel_category_is_visible(), UI_panel_is_closed(), ui_panel_mouse_state_get(), ui_popup_context_menu_for_panel(), ui_region_find_active_but(), UI_view2d_mouse_in_scrollers(), UI_view2d_offset(), ui_window_to_block(), ARegion::uiblocks, ARegion::v2d, wmEvent::val, WHEELDOWNMOUSE, WHEELUPMOUSE, WM_UI_HANDLER_BREAK, WM_UI_HANDLER_CONTINUE, and wmEvent::xy.
Definition at line 2517 of file interface_panel.c.
References C, panel_activate_state(), and PANEL_STATE_EXIT.
Referenced by panel_activate_state(), and panel_handle_data_ensure().
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.
Definition at line 284 of file interface_panel.c.
References INSTANCED_PANEL_UNIQUE_STR_LEN, snprintf, and Panel::sortorder.
Referenced by ED_region_panels_layout_ex().
Definition at line 844 of file interface_panel.c.
References uiBlock::buttons, LISTBASE_FOREACH, uiBlock::panel, uiStyle::panelspace, uiBlock::rect, Panel::sizex, Panel::sizey, ui_block_bounds_calc(), UI_style_get_dpi(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by UI_panels_end().
Panel* UI_panel_add_instanced | ( | const bContext * | C, |
ARegion * | region, | ||
ListBase * | panels, | ||
const char * | panel_idname, | ||
PointerRNA * | custom_data | ||
) |
Definition at line 260 of file interface_panel.c.
References BLI_findstring(), C, NULL, panel_add_instanced(), panel_set_expansion_from_list_data(), ARegionType::paneltypes, and ARegion::type.
Panel* UI_panel_begin | ( | struct ARegion * | region, |
struct ListBase * | lb, | ||
uiBlock * | block, | ||
struct PanelType * | pt, | ||
struct Panel * | panel, | ||
bool * | r_open | ||
) |
Definition at line 665 of file interface_panel.c.
References ARegion::alignment, BLI_addtail(), BLI_insertlinkafter(), BLI_remlink(), BLI_strncpy(), Panel_Runtime::block, Panel::blocksizex, Panel::blocksizey, CTX_IFACE_, Panel::drawname, ListBase::first, PanelType::flag, Panel::flag, PanelType::idname, PanelType::label, LISTBASE_FOREACH, MEM_callocN, Panel::next, NULL, Panel::ofsx, Panel::ofsy, uiBlock::panel, PANEL_ACTIVE, PANEL_LAST_ADDED, PANEL_NEW_ADDED, PANEL_TYPE_DEFAULT_CLOSED, PANEL_WAS_CLOSED, Panel::panelname, PNL_CLOSED, RGN_ALIGN_FLOAT, Panel::runtime, Panel::runtime_flag, Panel::sizex, Panel::sizey, Panel::sortorder, PanelType::translation_context, Panel::type, UI_BLOCK_THEME_STYLE_POPUP, UI_block_theme_style_set(), and UI_panel_is_closed().
Referenced by ed_panel_draw(), and panel_property_search().
Definition at line 2474 of file interface_panel.c.
References PanelType::flag, NULL, PANEL_TYPE_INSTANCED, PanelType::parent, and Panel::type.
Referenced by ui_handle_panel_header().
PanelCategoryStack* UI_panel_category_active_find | ( | ARegion * | region, |
const char * | idname | ||
) |
Definition at line 2163 of file interface_panel.c.
References BLI_findstring(), and ARegion::panels_category_active.
Referenced by image_buttons_region_draw(), ui_panel_category_active_set(), and UI_panel_category_active_set_default().
Definition at line 2220 of file interface_panel.c.
References ListBase::first, PanelCategoryDyn::idname, LISTBASE_FOREACH, NULL, ARegion::panels_category, ARegion::panels_category_active, ui_panel_category_active_set(), and UI_panel_category_find().
Referenced by ED_area_do_mgs_subscribe_for_tool_ui(), panel_type_context_poll(), panels_collapse_all(), region_panels_collect_categories(), and ui_handle_panel_category_cycling().
Definition at line 2208 of file interface_panel.c.
References ui_panel_category_active_set().
Referenced by ED_drivers_editor_init(), text_text_search_exec(), ui_handle_panel_category_cycling(), and ui_handler_panel_region().
|
static |
Definition at line 2169 of file interface_panel.c.
References BLI_addhead(), BLI_addtail(), BLI_findstring(), BLI_remlink(), BLI_strncpy(), PanelCategoryStack::idname, MEM_callocN, MEM_freeN, PanelCategoryStack::next, ARegion::panels_category_active, ARegionType::paneltypes, ARegion::type, and UI_panel_category_active_find().
Referenced by UI_panel_category_active_get(), UI_panel_category_active_set(), and UI_panel_category_active_set_default().
Definition at line 2213 of file interface_panel.c.
References UI_panel_category_active_find(), and ui_panel_category_active_set().
Referenced by sequencer_buttons_region_init(), and spreadsheet_sidebar_init().
Definition at line 2250 of file interface_panel.c.
References BLI_addtail(), BLI_strncpy(), PanelCategoryDyn::idname, MEM_callocN, and ARegion::panels_category.
Referenced by region_panels_collect_categories().
Definition at line 2260 of file interface_panel.c.
References BLI_freelistN(), and ARegion::panels_category.
Referenced by region_panels_collect_categories().
Draw vertical tabs on the left side of the region, one tab per category.
Definition at line 1300 of file interface_panel.c.
References ARegion::alignment, BLF_color3ubv(), BLF_disable(), BLF_draw(), BLF_DRAW_STR_DUMMY_MAX, BLF_enable(), BLF_position(), BLF_rotation(), BLF_ROTATION, BLF_size(), BLF_width(), BLF_width_to_strlen(), BLI_assert, BLI_rcti_size_y(), ListBase::first, float(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_I32, GPU_FETCH_INT_TO_FLOAT, GPU_line_smooth(), GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), IFACE_, immBindBuiltinProgram(), immRecti(), immUnbindProgram(), immUniformColor3fvAlpha(), immUniformColor3ubv(), immUniformColor4fv(), immUniformColor4ubv(), immVertexFormat(), is_left(), LISTBASE_FOREACH, M_PI_2, View2D::mask, NULL, ARegion::overlap, ARegion::panels_category, uiFontStyle::points, pos, ARegion::regiontype, RGN_ALIGN_ENUM_FROM_MASK, RGN_ALIGN_RIGHT, RGN_TYPE_HAS_CATEGORY_MASK, round_fl_to_int(), roundboxtype, uiWidgetColors::roundness, STREQ, TABS_PADDING_BETWEEN_FACTOR, TABS_PADDING_TEXT_FACTOR, TH_BACK, TH_TAB_ACTIVE, TH_TAB_BACK, TH_TAB_INACTIVE, TH_TAB_OUTLINE, TH_TEXT, TH_TEXT_HI, bTheme::tui, UI_CNR_BOTTOM_LEFT, UI_CNR_BOTTOM_RIGHT, UI_CNR_TOP_LEFT, UI_CNR_TOP_RIGHT, UI_DPI_FAC, UI_draw_roundbox_4fv(), UI_draw_roundbox_corner_set(), ui_fontscale(), UI_GetTheme(), UI_GetThemeColor3ubv(), UI_GetThemeColor4fv(), UI_GetThemeColor4ubv(), UI_panel_category_is_visible(), UI_PANEL_CATEGORY_MARGIN_WIDTH, UI_style_get(), ARegion::uiblocks, uiFontStyle::uifont_id, ARegion::v2d, ThemeUI::wcol_tab, uiStyle::widget, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by ED_region_panels_draw().
PanelCategoryDyn* UI_panel_category_find | ( | const ARegion * | region, |
const char * | idname | ||
) |
Definition at line 2158 of file interface_panel.c.
References BLI_findstring(), and ARegion::panels_category.
Referenced by ui_handle_panel_category_cycling(), and UI_panel_category_active_get().
Definition at line 2151 of file interface_panel.c.
References ListBase::first, ListBase::last, and ARegion::panels_category.
Referenced by panel_region_offset_x_get(), panels_collapse_all(), reorder_instanced_panel_list(), ui_handle_panel_header(), ui_handler_panel_region(), and UI_panel_category_draw_all().
void UI_panel_context_pointer_set | ( | struct Panel * | panel, |
const char * | name, | ||
struct PointerRNA * | ptr | ||
) |
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.
Definition at line 2429 of file interface_panel.c.
References Panel_Runtime::context, Panel::layout, ptr, Panel::runtime, uiLayoutGetContextStore(), and uiLayoutSetContextPointer().
Referenced by draw_constraint_header(), gpencil_modifier_panel_get_property_pointers(), gpencil_modifier_panel_header(), modifier_panel_get_property_pointers(), modifier_panel_header(), and shaderfx_panel_get_property_pointers().
PointerRNA* UI_panel_custom_data_get | ( | const Panel * | panel | ) |
Definition at line 2447 of file interface_panel.c.
References Panel_Runtime::custom_data_ptr, and Panel::runtime.
Referenced by panel_custom_data_active_get(), panel_custom_data_active_set(), and UI_region_panel_custom_data_under_cursor().
void UI_panel_custom_data_set | ( | Panel * | panel, |
PointerRNA * | custom_data | ||
) |
Definition at line 2435 of file interface_panel.c.
References BLI_assert, Panel_Runtime::custom_data_ptr, MEM_freeN, NULL, Panel::runtime, Panel::type, and ui_panel_custom_data_set_recursive().
Referenced by ANIM_fmodifier_panels(), spreadsheet_row_filters_layout(), uiTemplateConstraints(), uiTemplateGpencilModifiers(), uiTemplateModifiers(), and uiTemplateShaderFx().
|
static |
Definition at line 2420 of file interface_panel.c.
References Panel::children, Panel_Runtime::custom_data_ptr, LISTBASE_FOREACH, and Panel::runtime.
Referenced by UI_panel_custom_data_set().
|
static |
Definition at line 1956 of file interface_panel.c.
References BLI_rctf_isect_segment(), C, CTX_wm_region(), PanelType::flag, Panel::flag, LISTBASE_FOREACH, NULL, panel_activate_state(), PANEL_STATE_ANIMATION, PANEL_TYPE_NO_HEADER, PANEL_USE_CLOSED_FROM_SEARCH, PNL_CLOSED, PNL_HEADER, Panel::runtime_flag, SET_FLAG_FROM_TEST, set_panels_list_data_expand_flag(), Panel::type, ui_window_to_block_fl(), ARegion::uiblocks, UNPACK2, uiPanelDragCollapseHandle::was_first_open, uiPanelDragCollapseHandle::xy_init, rctf::ymax, and rctf::ymin.
Referenced by ui_panel_drag_collapse_handler().
|
static |
Panel drag-collapse (modal handler). Clicking and dragging over panels toggles their collapse state based on the panel that was first dragged over. If it was open all affected panels including the initial one are closed and vice versa.
Definition at line 2006 of file interface_panel.c.
References C, CTX_wm_window(), KM_RELEASE, LEFTMOUSE, wmWindow::modalhandlers, MOUSEMOVE, wmEvent::type, ui_panel_drag_collapse(), ui_panel_drag_collapse_handler_remove(), wmEvent::val, WM_event_remove_ui_handler(), WM_UI_HANDLER_BREAK, WM_UI_HANDLER_CONTINUE, and wmEvent::xy.
Referenced by ui_panel_drag_collapse_handler_add().
Definition at line 2036 of file interface_panel.c.
References C, copy_v2_v2_int(), CTX_wm_window(), wmWindow::eventstate, MEM_mallocN, wmWindow::modalhandlers, ui_panel_drag_collapse_handler(), ui_panel_drag_collapse_handler_remove(), uiPanelDragCollapseHandle::was_first_open, WM_event_add_ui_handler(), and uiPanelDragCollapseHandle::xy_init.
Referenced by ui_handle_panel_header().
Definition at line 1950 of file interface_panel.c.
References MEM_freeN.
Referenced by ui_panel_drag_collapse_handler(), and ui_panel_drag_collapse_handler_add().
Definition at line 836 of file interface_panel.c.
References Panel::blocksizex, Panel::blocksizey, height, and width.
Referenced by ed_panel_draw().
Definition at line 653 of file interface_panel.c.
References PanelType::idname, LISTBASE_FOREACH, NULL, and STREQLEN.
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.
Definition at line 744 of file interface_panel.c.
References Panel_Runtime::block, Panel::runtime, ui_block_new_button_group(), UI_BUTTON_GROUP_LOCK, and UI_BUTTON_GROUP_PANEL_HEADER.
Referenced by ed_panel_draw().
Finish the button group for the panel header to avoid putting panel body buttons in it.
Definition at line 751 of file interface_panel.c.
References BLI_assert, BLI_listbase_is_empty(), BLI_listbase_is_single(), Panel_Runtime::block, uiBlock::button_groups, uiButtonGroup::buttons, uiButtonGroup::flag, ListBase::last, Panel::runtime, ui_block_new_button_group(), UI_BUTTON_GROUP_LOCK, and UI_BUTTON_GROUP_PANEL_HEADER.
Referenced by ed_panel_draw().
Definition at line 985 of file interface_panel.c.
References PANEL_ACTIVE, and Panel::runtime_flag.
Referenced by panel_custom_data_active_get(), and panel_custom_data_active_set().
Definition at line 971 of file interface_panel.c.
References PanelType::flag, Panel::flag, PANEL_TYPE_NO_HEADER, PANEL_USE_CLOSED_FROM_SEARCH, PNL_CLOSED, Panel::runtime_flag, Panel::type, and UI_panel_matches_search_filter().
Referenced by get_panel_real_ofsy(), get_panel_real_size_y(), panel_active_animation_changed(), panel_calculate_size_recursive(), panel_draw_aligned_backdrop(), panel_draw_aligned_widgets(), panel_draw_highlight_border(), panel_remove_invisible_layouts_recursive(), panel_set_expand_from_list_data_recursive(), panels_layout_begin_clear_flags(), ui_handle_panel_header(), ui_handler_panel_region(), UI_panel_begin(), ui_panel_mouse_state_get(), and uiAlignPanelStep().
Definition at line 1574 of file interface_panel.c.
References PANEL_IS_DRAG_DROP, and Panel::runtime_flag.
Referenced by ui_do_animate(), and UI_panels_draw().
Definition at line 1017 of file interface_panel.c.
References uiBlock::panel, PanelType::parent, Panel::type, UI_UNIT_X, and UI_UNIT_Y.
bool UI_panel_list_matches_data | ( | struct ARegion * | region, |
struct ListBase * | data, | ||
uiListPanelIDFromDataFunc | panel_idname_func | ||
) |
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.
data | The list of data to check against the instanced panels. |
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. |
Definition at line 334 of file interface_panel.c.
References BLI_listbase_count(), data, LISTBASE_FOREACH, MAX_NAME, Link::next, NULL, PANEL_TYPE_INSTANCED, ARegion::panels, PNL_INSTANCED_LIST_ORDER_CHANGED, and STREQ.
Referenced by ANIM_fmodifier_panels(), spreadsheet_row_filters_layout(), uiTemplateConstraints(), uiTemplateGpencilModifiers(), uiTemplateModifiers(), and uiTemplateShaderFx().
Definition at line 880 of file interface_panel.c.
References panel_matches_search_filter_recursive().
Referenced by panel_draw_aligned_backdrop(), panel_title_color_get(), and UI_panel_is_closed().
|
static |
Definition at line 1923 of file interface_panel.c.
References IN_RANGE, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER, PANEL_MOUSE_OUTSIDE, PNL_HEADER, uiBlock::rect, UI_panel_is_closed(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by ui_handler_panel_region(), and UI_region_panel_custom_data_under_cursor().
Definition at line 1273 of file interface_panel.c.
References ARegion::alignment, PanelType::flag, ARegion::overlap, PANEL_TYPE_NO_HEADER, ARegion::regiontype, RGN_ALIGN_FLOAT, and RGN_TYPE_TOOLS.
Referenced by ui_panels_size(), and uiAlignPanelStep().
int UI_panel_size_y | ( | const Panel * | panel | ) |
Definition at line 1557 of file interface_panel.c.
References get_panel_real_size_y().
Definition at line 863 of file interface_panel.c.
References PANEL_SEARCH_FILTER_MATCH, and Panel::runtime_flag.
Referenced by UI_block_apply_search_filter().
Definition at line 1830 of file interface_panel.c.
References ARegion::panels, and panels_layout_begin_clear_flags().
Definition at line 996 of file interface_panel.c.
References C, LISTBASE_FOREACH_BACKWARD, UI_block_draw(), UI_block_is_search_only(), UI_panel_is_dragging(), and ARegion::uiblocks.
Definition at line 1837 of file interface_panel.c.
References blender::compositor::area(), BLI_assert, C, CTX_wm_area(), ARegion::flag, LISTBASE_FOREACH, NULL, panel_activate_state(), PANEL_ACTIVE, panel_calculate_size_recursive(), PANEL_STATE_ANIMATION, ARegion::panels, panels_need_realign(), properties_space_needs_realign(), region_panels_remove_invisible_layouts(), region_panels_set_expansion_from_list_data(), region_panels_set_expansion_from_search_filter(), RGN_FLAG_SEARCH_FILTER_ACTIVE, RGN_FLAG_SEARCH_FILTER_UPDATE, ui_offset_panel_block(), ui_panels_size(), uiAlignPanelStep(), and ARegion::uiblocks.
Definition at line 313 of file interface_panel.c.
References C, LISTBASE_FOREACH_MUTABLE, MEM_freeN, NULL, panel_activate_state(), panel_delete(), PANEL_STATE_EXIT, PANEL_TYPE_INSTANCED, and ARegion::panels.
Definition at line 1756 of file interface_panel.c.
References get_panel_real_ofsy(), LISTBASE_FOREACH, max_ii(), min_ii(), PANEL_ACTIVE, ARegion::panels, ARegion::type, UI_PANEL_MARGIN_Y, UI_panel_should_show_background(), and UI_PANEL_WIDTH.
Referenced by UI_panels_end().
PointerRNA* UI_region_panel_custom_data_under_cursor | ( | const bContext * | C, |
const wmEvent * | event | ||
) |
Definition at line 2452 of file interface_panel.c.
References C, CTX_wm_region(), ELEM, LISTBASE_FOREACH, NULL, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER, UI_panel_custom_data_get(), ui_panel_mouse_state_get(), ui_window_to_block(), and ARegion::uiblocks.
Calculate the position and order of panels as they are opened, closed, and dragged.
Definition at line 1656 of file interface_panel.c.
References align_sub_panels(), BLI_assert, compare_panel(), find_highest_panel(), Panel::flag, get_panel_real_size_y(), interpf(), LISTBASE_FOREACH, MEM_freeN, MEM_mallocN, PanelSort::new_offset_x, PanelSort::new_offset_y, NULL, Panel::ofsx, Panel::ofsy, PanelSort::panel, PANEL_ACTIVE, panel_region_offset_x_get(), ARegion::panels, PNL_SELECT, Panel_Runtime::region_ofsx, round_fl_to_int(), Panel::runtime, Panel::sizey, Panel::sortorder, Panel::type, UI_panel_is_closed(), UI_PANEL_MARGIN_X, UI_PANEL_MARGIN_Y, UI_panel_should_show_background(), x, and y.
Referenced by ui_do_animate(), ui_do_drag(), and UI_panels_end().