Blender  V2.93
Classes | Typedefs | Functions
interface_utils.c File Reference
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "BLI_alloca.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_string_search.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_lib_id.h"
#include "BKE_report.h"
#include "MEM_guardedalloc.h"
#include "RNA_access.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
#include "WM_api.h"
#include "WM_types.h"
#include "interface_intern.h"

Go to the source code of this file.

Classes

struct  CollItemSearch
 
struct  uiButStore
 
struct  uiButStoreElem
 

Typedefs

typedef struct CollItemSearch CollItemSearch
 

Functions

uiButuiDefAutoButR (uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, const char *name, int icon, int x, int y, int width, int height)
 
eAutoPropButsReturn uiDefAutoButsRNA (uiLayout *layout, PointerRNA *ptr, bool(*check_prop)(PointerRNA *ptr, PropertyRNA *prop, void *user_data), void *user_data, PropertyRNA *prop_activate_init, const eButLabelAlign label_align, const bool compact)
 
static bool add_collection_search_item (CollItemSearch *cis, const bool requires_exact_data_name, const bool has_id_icon, uiSearchItems *items)
 
void ui_rna_collection_search_update_fn (const struct bContext *C, void *arg, const char *str, uiSearchItems *items, const bool is_first)
 
int UI_icon_from_id (const ID *id)
 
int UI_icon_from_report_type (int type)
 
int UI_icon_colorid_from_report_type (int type)
 
int UI_text_colorid_from_report_type (int type)
 
int UI_calc_float_precision (int prec, double value)
 
bool UI_but_online_manual_id (const uiBut *but, char *r_str, size_t maxlength)
 
bool UI_but_online_manual_id_from_active (const struct bContext *C, char *r_str, size_t maxlength)
 
Button Store

Modal Button Store API.

Store for modal operators & handlers to register button pointers which are maintained while drawing or NULL when removed.

This is needed since button pointers are continuously freed and re-allocated.

uiButStoreUI_butstore_create (uiBlock *block)
 
void UI_butstore_free (uiBlock *block, uiButStore *bs_handle)
 
bool UI_butstore_is_valid (uiButStore *bs)
 
bool UI_butstore_is_registered (uiBlock *block, uiBut *but)
 
void UI_butstore_register (uiButStore *bs_handle, uiBut **but_p)
 
void UI_butstore_unregister (uiButStore *bs_handle, uiBut **but_p)
 
bool UI_butstore_register_update (uiBlock *block, uiBut *but_dst, const uiBut *but_src)
 
void UI_butstore_clear (uiBlock *block)
 
void UI_butstore_update (uiBlock *block)
 

Typedef Documentation

◆ CollItemSearch

Function Documentation

◆ add_collection_search_item()

static bool add_collection_search_item ( CollItemSearch cis,
const bool  requires_exact_data_name,
const bool  has_id_icon,
uiSearchItems items 
)
static

◆ UI_but_online_manual_id()

bool UI_but_online_manual_id ( const uiBut but,
char *  r_str,
size_t  maxlength 
)

◆ UI_but_online_manual_id_from_active()

bool UI_but_online_manual_id_from_active ( const struct bContext C,
char *  r_str,
size_t  maxlength 
)

◆ UI_butstore_clear()

void UI_butstore_clear ( uiBlock block)

NULL all pointers, don't free since the owner needs to be able to inspect.

Definition at line 895 of file interface_utils.c.

References uiBlock::butstore, LISTBASE_FOREACH, and NULL.

Referenced by UI_block_free().

◆ UI_butstore_create()

uiButStore* UI_butstore_create ( uiBlock block)

Create a new button store, the caller must manage and run UI_butstore_free

Definition at line 802 of file interface_utils.c.

References BLI_addtail(), uiButStore::block, uiBlock::butstore, and MEM_callocN.

Referenced by ui_but_add_search(), and ui_multibut_states_create().

◆ UI_butstore_free()

void UI_butstore_free ( uiBlock block,
uiButStore bs_handle 
)

◆ UI_butstore_is_registered()

bool UI_butstore_is_registered ( uiBlock block,
uiBut but 
)

Definition at line 839 of file interface_utils.c.

References uiBlock::butstore, and LISTBASE_FOREACH.

Referenced by ui_but_free().

◆ UI_butstore_is_valid()

bool UI_butstore_is_valid ( uiButStore bs)

Definition at line 834 of file interface_utils.c.

References uiButStore::block, and NULL.

◆ UI_butstore_register()

void UI_butstore_register ( uiButStore bs_handle,
uiBut **  but_p 
)

◆ UI_butstore_register_update()

bool UI_butstore_register_update ( uiBlock block,
uiBut but_dst,
const uiBut but_src 
)

Update the pointer for a registered button.

Definition at line 876 of file interface_utils.c.

References uiBlock::butstore, and LISTBASE_FOREACH.

Referenced by ui_but_update_from_old_block().

◆ UI_butstore_unregister()

void UI_butstore_unregister ( uiButStore bs_handle,
uiBut **  but_p 
)

◆ UI_butstore_update()

void UI_butstore_update ( uiBlock block)

Map freed buttons from the old block and update pointers.

Definition at line 908 of file interface_utils.c.

References BLI_assert, BLI_movelisttolist(), uiBlock::butstore, ELEM, ListBase::first, LIKELY, LISTBASE_FOREACH, NULL, uiBlock::oldblock, and ui_but_find_new().

Referenced by UI_block_update_from_old().

◆ UI_calc_float_precision()

int UI_calc_float_precision ( int  prec,
double  value 
)

Returns the best "UI" precision for given floating value, so that e.g. 10.000001 rather gets drawn as '10'...

Definition at line 693 of file interface_utils.c.

References BLI_assert, CLAMP, e, fabs(), KDL::pow(), and UI_PRECISION_FLOAT_MAX.

Referenced by outputNumInput(), and ui_but_calc_float_precision().

◆ UI_icon_colorid_from_report_type()

int UI_icon_colorid_from_report_type ( int  type)

◆ UI_icon_from_id()

int UI_icon_from_id ( const ID id)

◆ UI_icon_from_report_type()

int UI_icon_from_report_type ( int  type)

◆ ui_rna_collection_search_update_fn()

void ui_rna_collection_search_update_fn ( const struct bContext C,
void *  arg,
const char *  str,
uiSearchItems items,
const bool  is_first 
)

◆ UI_text_colorid_from_report_type()

int UI_text_colorid_from_report_type ( int  type)

◆ uiDefAutoButR()

uiBut* uiDefAutoButR ( uiBlock block,
PointerRNA ptr,
PropertyRNA prop,
int  index,
const char *  name,
int  icon,
int  x,
int  y,
int  width,
int  height 
)

◆ uiDefAutoButsRNA()

eAutoPropButsReturn uiDefAutoButsRNA ( uiLayout layout,
PointerRNA ptr,
bool(*)(PointerRNA *ptr, PropertyRNA *prop, void *user_data check_prop,
void *  user_data,
PropertyRNA prop_activate_init,
const eButLabelAlign  label_align,
const bool  compact 
)