Blender V5.3
interface_panel.cc File Reference
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "BLI_listbase.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_string.hh"
#include "BLI_string_utf8.hh"
#include "BLI_time.hh"
#include "BLI_utildefines.hh"
#include "BLT_translation.hh"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
#include "BKE_context.hh"
#include "BKE_recents.hh"
#include "BKE_screen.hh"
#include "RNA_access.hh"
#include "BLF_api.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "ED_screen.hh"
#include "UI_interface_c.hh"
#include "UI_interface_icons.hh"
#include "UI_resources.hh"
#include "UI_view2d.hh"
#include "GPU_batch_presets.hh"
#include "GPU_immediate.hh"
#include "GPU_matrix.hh"
#include "GPU_state.hh"
#include "RNA_prototypes.hh"
#include "interface_intern.hh"

Go to the source code of this file.

Classes

struct  blender::ui::HandlePanelData
struct  blender::ui::PanelSort
struct  blender::ui::PanelDragCollapseHandle

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::ui

Functions

void blender::ui::panel_category_show_tab (const bContext &C, ARegion *region, StringRef category)
static int blender::ui::panel_category_show_active_tab (const bContext &C, ARegion *region, const int mval[2])
Local Functions
static bool blender::ui::panel_active_animation_changed (ListBaseT< Panel > *lb, Panel **r_panel_animation, bool *r_no_animation)
static bool blender::ui::properties_space_needs_realign (const ScrArea *area, const ARegion *region)
static bool blender::ui::panels_need_realign (const ScrArea *area, ARegion *region, Panel **r_panel_animation)
Functions for Instanced Panels
static Panel * blender::ui::panel_add_instanced (ListBaseT< Panel > *panels, PanelType *panel_type, PointerRNA *custom_data)
Panel * blender::ui::panel_add_instanced (const bContext *C, ARegion *region, ListBaseT< Panel > *panels, const char *panel_idname, PointerRNA *custom_data)
void blender::ui::list_panel_unique_str (Panel *panel, char *r_name)
static void blender::ui::panel_delete (ARegion *region, ListBaseT< Panel > *panels, Panel *panel)
static void blender::ui::panel_exit_state_recursive (const bContext *C, Panel &panel)
void blender::ui::panels_free_instanced (const bContext *C, ARegion *region)
bool blender::ui::panel_list_matches_data (ARegion *region, ListBase *data, ListPanelIDFromDataFunc panel_idname_func)
static void blender::ui::reorder_instanced_panel_list (bContext *C, ARegion *region, Panel *drag_panel)
static bool blender::ui::panel_set_expand_from_list_data_recursive (Panel *panel, short flag, short *flag_index)
static void blender::ui::region_panels_set_expansion_from_list_data (const bContext *C, ARegion *region)
static void blender::ui::get_panel_expand_flag (const Panel *panel, short *flag, short *flag_index)
static void blender::ui::set_panels_list_data_expand_flag (const bContext *C, const ARegion *region)
Panels
static bool blender::ui::panel_custom_pin_to_last_get (const Panel *panel)
static void blender::ui::panel_custom_pin_to_last_set (const bContext *C, const Panel *panel, const bool value)
static bool blender::ui::panel_custom_data_active_get (const Panel *panel)
static void blender::ui::panel_custom_data_active_set (Panel *panel)
static void blender::ui::panel_set_flag_recursive (Panel *panel, ePanel_Flag flag, bool value)
static void blender::ui::panel_set_runtime_flag_recursive (Panel *panel, short flag, bool value)
static void blender::ui::panels_collapse_all (ARegion *region, const Panel *from_panel)
Panel * blender::ui::panel_find_by_type (ListBaseT< Panel > *lb, const PanelType *pt)
Panel * blender::ui::panel_begin (ARegion *region, ListBaseT< Panel > *lb, Block *block, PanelType *pt, Panel *panel, bool *r_open)
void blender::ui::panel_header_buttons_begin (Panel *panel)
void blender::ui::panel_header_buttons_end (Panel *panel)
static float blender::ui::panel_region_offset_x_get (const ARegion *region)
static void blender::ui::panel_calculate_size_recursive (ARegion *region, Panel *panel)
void blender::ui::panel_end (Panel *panel, int width, int height)
void blender::ui::panel_drawname_set (Panel *panel, StringRef name)
static void blender::ui::offset_panel_block (Block *block)
void blender::ui::panel_tag_search_filter_match (Panel *panel)
static void blender::ui::panel_matches_search_filter_recursive (const Panel *panel, bool *filter_matches)
bool blender::ui::panel_matches_search_filter (const Panel *panel)
static void blender::ui::panel_set_expansion_from_search_filter_recursive (const bContext *C, Panel *panel, const bool use_search_closed)
static void blender::ui::region_panels_set_expansion_from_search_filter (const bContext *C, ARegion *region, const bool use_search_closed)
static void blender::ui::panel_remove_invisible_layouts_recursive (Panel *panel, const Panel *parent_panel)
static void blender::ui::region_panels_remove_invisible_layouts (ARegion *region)
bool blender::ui::panel_is_closed (const Panel *panel)
bool blender::ui::panel_is_active (const Panel *panel)
Panel Alignment
static int blender::ui::get_panel_size_y (const Panel *panel)
int blender::ui::panel_size_y (const Panel *panel)
static int blender::ui::get_panel_real_ofsy (Panel *panel)
bool blender::ui::panel_is_dragging (const Panel *panel)
static bool blender::ui::find_highest_panel (const PanelSort &a, const PanelSort &b)
static bool blender::ui::compare_panel (const PanelSort &a, const PanelSort &b)
static void blender::ui::align_sub_panels (Panel *panel)
static bool blender::ui::uiAlignPanelStep (ARegion *region, const float factor, const bool drag)
static void blender::ui::panels_size (ARegion *region, int *r_x, int *r_y)
static void blender::ui::do_animate (bContext *C, Panel *panel)
static void blender::ui::panels_layout_begin_clear_flags (ListBaseT< Panel > *lb)
void blender::ui::panels_begin (const bContext *C, ARegion *region)
void blender::ui::panels_end (const bContext *C, ARegion *region, int *r_x, int *r_y)
Region Level Panel Interaction
LayoutPanelHeader * blender::ui::layout_panel_header_under_mouse (const Panel &panel, const int my)
static PanelMouseState blender::ui::panel_mouse_state_get (const Block *block, const Panel *panel, const int mx, const int my)
static void blender::ui::panel_drag_collapse_handler_remove (bContext *, void *userdata)
static void blender::ui::panel_drag_collapse (const bContext *C, const PanelDragCollapseHandle *dragcol_data, const int xy_dst[2])
static int blender::ui::panel_drag_collapse_handler (bContext *C, const wmEvent *event, void *userdata)
void blender::ui::panel_drag_collapse_handler_add (const bContext *C, const bool was_open)
bool blender::ui::layout_panel_toggle_open (const bContext *C, LayoutPanelHeader *header)
static void blender::ui::handle_layout_panel_header (bContext *C, const Block *block, const int, const int my, const int event_type)
static void blender::ui::handle_panel_header (const bContext *C, const Block *block, const int mx, const int event_type, const bool ctrl, const bool shift)
bool blender::ui::panel_category_is_visible (const ARegion *region)
bool blender::ui::panel_category_tabs_is_visible (const ARegion *region)
PanelCategoryDyn * blender::ui::panel_category_find (const ARegion *region, const char *idname)
int blender::ui::panel_category_index_find (ARegion *region, const char *idname)
PanelCategoryStack * blender::ui::panel_category_active_find (ARegion *region, const char *idname)
static void blender::ui::panel_category_active_set (ARegion *region, const char *idname, bool fallback)
void blender::ui::panel_category_active_set (ARegion *region, const char *idname)
void blender::ui::panel_category_index_active_set (ARegion *region, const int index)
void blender::ui::panel_category_active_set_default (ARegion *region, const char *idname)
const char * blender::ui::panel_category_active_get (ARegion *region, bool set_fallback)
void blender::ui::panel_category_add (ARegion *region, const char *name, int icon=0)
void blender::ui::panel_category_clear_all (ARegion *region)
static bool blender::ui::panel_categories_tab_is_mouse_over (ARegion *region, const wmEvent *event)
static int blender::ui::handle_panel_category_cycling (const wmEvent *event, ARegion *region, const Button *active_but)
void blender::ui::panel_region_width_set (ARegion *region, const float aspect, int unscaled_size)
int blender::ui::handler_panel_region (bContext *C, const wmEvent *event, ARegion *region, const Button *active_but)
static void blender::ui::panel_custom_data_set_recursive (Panel *panel, PointerRNA *custom_data)
void blender::ui::panel_context_pointer_set (Panel *panel, const char *name, PointerRNA *ptr)
void blender::ui::panel_custom_data_set (Panel *panel, PointerRNA *custom_data)
PointerRNA * blender::ui::panel_custom_data_get (const Panel *panel)
PointerRNA * blender::ui::region_panel_custom_data_under_cursor (const bContext *C, const wmEvent *event)
bool blender::ui::panel_can_be_pinned (const Panel *panel)
Window Level Modal Panel Interaction
static int blender::ui::handler_panel (bContext *C, const wmEvent *event, void *userdata)
static void blender::ui::handler_remove_panel (bContext *C, void *userdata)
static void blender::ui::panel_handle_data_ensure (const bContext *C, wmWindow *win, const ARegion *region, Panel *panel, const HandlePanelState state)
void blender::ui::panel_stop_animation (const bContext *C, Panel *panel)
bool blender::ui::region_panels_fits_only_categories (const ARegion *region)
void blender::ui::region_panels_sort_for_search_filter_visibility_change (bContext *C, const ARegion *region)
bool blender::ui::panel_region_visible_width_ensure (ARegion *region)

Defines & Structs

#define ANIMATION_TIME   0.30
#define ANIMATION_INTERVAL   0.02
enum  blender::ui::PanelRuntimeFlag {
  blender::ui::PANEL_LAST_ADDED = (1 << 0) , blender::ui::PANEL_ACTIVE = (1 << 2) , blender::ui::PANEL_WAS_ACTIVE = (1 << 3) , blender::ui::PANEL_ANIM_ALIGN = (1 << 4) ,
  blender::ui::PANEL_NEW_ADDED = (1 << 5) , blender::ui::PANEL_SEARCH_FILTER_MATCH = (1 << 7) , blender::ui::PANEL_USE_CLOSED_FROM_SEARCH = (1 << 8) , blender::ui::PANEL_WAS_CLOSED = (1 << 9) ,
  blender::ui::PANEL_IS_DRAG_DROP = (1 << 10) , blender::ui::PANEL_ACTIVE_BORDER = (1 << 11)
}
enum  blender::ui::PanelMouseState { blender::ui::PANEL_MOUSE_OUTSIDE , blender::ui::PANEL_MOUSE_INSIDE_CONTENT , blender::ui::PANEL_MOUSE_INSIDE_HEADER , blender::ui::PANEL_MOUSE_INSIDE_LAYOUT_PANEL_HEADER }
enum  blender::ui::HandlePanelState { blender::ui::PANEL_STATE_DRAG , blender::ui::PANEL_STATE_ANIMATION , blender::ui::PANEL_STATE_EXIT }
static void blender::ui::panel_set_expansion_from_list_data (const bContext *C, Panel *panel)
static int blender::ui::get_panel_real_size_y (const Panel *panel)
static void blender::ui::panel_activate_state (const bContext *C, Panel *panel, const HandlePanelState state)
static bool blender::ui::panel_type_context_poll (ARegion *region, const PanelType *panel_type, const char *context)

Drawing

#define PNL_ICON   UI_UNIT_X
void blender::ui::panels_draw (const bContext *C, ARegion *region)
void blender::ui::panels_do_after_block_layout_fns (const bContext *C, ARegion *region)
void blender::ui::panel_label_offset (const Block *block, int *r_x, int *r_y)
static void blender::ui::panel_title_color_get (const Panel *panel, const bool show_background, const bool region_search_filter_active, uchar r_color[4])
static void blender::ui::panel_draw_border (const Panel *panel, const rcti *rect, const rcti *header_rect, const bool is_active)
static void blender::ui::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)
void blender::ui::draw_layout_panels_backdrop (const ARegion *region, const Panel *panel, const float radius, float subpanel_backcolor[4])
static void blender::ui::panel_draw_softshadow (const rctf *box_rect, const int roundboxalign, const float radius, const float shadow_width)
static void blender::ui::panel_draw_aligned_backdrop (const ARegion *region, const Panel *panel, const rcti *rect, const rcti *header_rect)
void blender::ui::draw_aligned_panel (const ARegion *region, const uiStyle *style, const Block *block, const rcti *rect, bool show_pin, bool show_background, bool region_search_filter_active)
bool blender::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
static constexpr const char * blender::ui::panel_category_tabs_block_name = "panel_category_tabs"
static void blender::ui::expand_panel_region (bContext &C, ARegion *region)
static void blender::ui::expand_panel_region_on_category_change (bContext &C, StringRef category, StringRef active)
void blender::ui::panel_category_tabs_draw_all (const bContext *C, ARegion *region, const char *category_id_active)

Panel Dragging

#define DRAG_REGION_PAD   (PNL_HEADER * 0.5)
static void blender::ui::do_drag (const bContext *C, const wmEvent *event, Panel *panel)

Macro Definition Documentation

◆ ANIMATION_INTERVAL

#define ANIMATION_INTERVAL   0.02

Definition at line 66 of file interface_panel.cc.

Referenced by blender::ui::panel_handle_data_ensure().

◆ ANIMATION_TIME

#define ANIMATION_TIME   0.30

Definition at line 65 of file interface_panel.cc.

Referenced by blender::ui::do_animate().

◆ DRAG_REGION_PAD

#define DRAG_REGION_PAD   (PNL_HEADER * 0.5)

Definition at line 2086 of file interface_panel.cc.

Referenced by blender::ui::do_drag().

◆ PNL_ICON

#define PNL_ICON   UI_UNIT_X

Definition at line 1072 of file interface_panel.cc.

Referenced by blender::ui::handle_panel_header().

◆ TABS_PADDING_BETWEEN_FACTOR

#define TABS_PADDING_BETWEEN_FACTOR   4.0f

Definition at line 1446 of file interface_panel.cc.

Referenced by blender::ui::panel_category_tabs_draw_all().

◆ TABS_PADDING_TEXT_FACTOR

#define TABS_PADDING_TEXT_FACTOR   6.0f

Definition at line 1447 of file interface_panel.cc.

Referenced by blender::ui::panel_category_tabs_draw_all().