Blender V4.3
ED_numinput.hh File Reference

Go to the source code of this file.

Classes

struct  NumInput
 

Macros

#define NUM_STR_REP_LEN   64
 
#define NUM_MAX_ELEMENTS   3
 

Enumerations

enum  { NUM_AFFECT_ALL = (1 << 0) }
 
enum  { NUM_NULL_ONE = (1 << 0) , NUM_NO_NEGATIVE = (1 << 1) , NUM_NO_ZERO = (1 << 2) , NUM_NO_FRACTION = (1 << 3) }
 

NumInput

#define NUM_MODAL_INCREMENT_UP   18
 
#define NUM_MODAL_INCREMENT_DOWN   19
 
void initNumInput (NumInput *n)
 
void outputNumInput (NumInput *n, char *str, const UnitSettings *unit_settings)
 
bool hasNumInput (const NumInput *n)
 
bool applyNumInput (NumInput *n, float *vec)
 
bool handleNumInput (bContext *C, NumInput *n, const wmEvent *event)
 
bool user_string_to_number (bContext *C, const char *str, const UnitSettings *unit, int type, double *r_value, bool use_single_line_error, char **r_error)
 

Macro Definition Documentation

◆ NUM_MAX_ELEMENTS

#define NUM_MAX_ELEMENTS   3

Definition at line 12 of file ED_numinput.hh.

Referenced by initNumInput().

◆ NUM_MODAL_INCREMENT_DOWN

#define NUM_MODAL_INCREMENT_DOWN   19

Definition at line 93 of file ED_numinput.hh.

Referenced by handleNumInput(), and transform_modal_keymap().

◆ NUM_MODAL_INCREMENT_UP

#define NUM_MODAL_INCREMENT_UP   18

Share with TFM_MODAL_CANCEL in transform.h.

Definition at line 92 of file ED_numinput.hh.

Referenced by handleNumInput(), and transform_modal_keymap().

◆ NUM_STR_REP_LEN

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

NumInput.flag

Enumerator
NUM_AFFECT_ALL 

Definition at line 46 of file ED_numinput.hh.

◆ anonymous enum

anonymous enum

NumInput::val_flag

Enumerator
NUM_NULL_ONE 
NUM_NO_NEGATIVE 
NUM_NO_ZERO 
NUM_NO_FRACTION 

Definition at line 52 of file ED_numinput.hh.

Function Documentation

◆ applyNumInput()

◆ handleNumInput()

bool handleNumInput ( bContext * C,
NumInput * n,
const wmEvent * event )

Definition at line 312 of file numinput.cc.

References ATTR_FALLTHROUGH, B_UNIT_ROTATION, BKE_report(), BLI_assert, BLI_str_cursor_step_utf8(), BLI_str_utf8_size_or_error(), copy_v3_v3(), CTX_data_scene(), CTX_wm_reports(), DEG2RAD, editstr_insert_at_cursor(), editstr_is_simple_numinput(), ELEM, error(), EVT_BACKSPACEKEY, EVT_CKEY, EVT_DELKEY, EVT_ENDKEY, EVT_HOMEKEY, EVT_LEFTARROWKEY, EVT_MINUSKEY, EVT_MODAL_MAP, EVT_PADMINUS, EVT_PADPERIOD, EVT_PADSLASHKEY, EVT_PERIODKEY, EVT_RIGHTARROWKEY, EVT_SLASHKEY, EVT_TABKEY, EVT_VKEY, NumInput::flag, float, NumInput::idx, NumInput::idx_max, KM_ALT, KM_CTRL, KM_SHIFT, MEM_freeN(), wmEvent::modifier, NUM_EDIT_FULL, NUM_EDITED, NUM_FAKE_EDITED, NUM_INVALID, NUM_INVERSE, NUM_MODAL_INCREMENT_DOWN, NUM_MODAL_INCREMENT_UP, NUM_NEGATE, printf, RAD2DEG, RPT_ERROR, NumInput::str, NumInput::str_cur, STRCUR_DIR_NEXT, STRCUR_DIR_PREV, STRCUR_JUMP_DELIM, STRCUR_JUMP_NONE, wmEvent::type, Scene::unit, NumInput::unit_type, NumInput::unit_use_radians, UNLIKELY, USER_FLAG_NUMINPUT_ADVANCED, user_string_to_number(), wmEvent::utf8_buf, NumInput::val, wmEvent::val, NumInput::val_flag, NumInput::val_inc, NumInput::val_org, value_to_editstr(), WM_clipboard_text_get_firstline(), WM_clipboard_text_set(), and WM_event_utf8_to_ascii().

Referenced by ed_marker_move_modal(), edbm_bevel_modal(), edbm_inset_modal(), graph_slider_modal(), blender::ed::sculpt_paint::greasepencil::grease_pencil_interpolate_modal(), knifetool_modal(), loopcut_modal(), pose_slide_modal(), radial_control_modal(), sequencer_slip_modal(), and transformEvent().

◆ hasNumInput()

◆ initNumInput()

void initNumInput ( NumInput * n)

There are important things to note here for code using numeric-input:

  • Values passed to applyNumInput() should be valid and are stored as default ones (val_org), if it is not EDITED.
  • bool returned by applyNumInput should be used to decide whether to apply numeric-input-specific post-process to data.
  • Once applyNumInput has been called, hasNumInput returns a valid value to decide whether to use numinput as drawstr source or not (i.e. to call outputNumInput).

Those two steps have to be separated (so do not use a common call to hasNumInput() to do both in the same time!).

Definition at line 70 of file numinput.cc.

References B_UNIT_NONE, copy_vn_fl(), copy_vn_i(), copy_vn_short(), NumInput::flag, NumInput::idx, NumInput::idx_max, NUM_MAX_ELEMENTS, NumInput::str, NumInput::str_cur, NumInput::unit_sys, NumInput::unit_type, NumInput::unit_use_radians, USER_UNIT_NONE, NumInput::val, NumInput::val_flag, NumInput::val_inc, NumInput::val_org, and zero_v3().

Referenced by ed_marker_move_init(), edbm_bevel_init(), edbm_inset_init(), initTransInfo(), knifetool_init(), pose_slide_init(), radial_control_invoke(), ringsel_init(), and sequencer_slip_invoke().

◆ outputNumInput()

void outputNumInput ( NumInput * n,
char * str,
const UnitSettings * unit_settings )

◆ user_string_to_number()

bool user_string_to_number ( bContext * C,
const char * str,
const UnitSettings * unit,
int type,
double * r_value,
bool use_single_line_error,
char ** r_error )