Blender  V3.3
Classes | Macros | Typedefs | Enumerations
ED_numinput.h 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
 

Typedefs

typedef struct NumInput NumInput
 

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, struct UnitSettings *unit_settings)
 
bool hasNumInput (const NumInput *n)
 
bool applyNumInput (NumInput *n, float *vec)
 
bool handleNumInput (struct bContext *C, NumInput *n, const struct wmEvent *event)
 
bool user_string_to_number (bContext *C, const char *str, const struct 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 14 of file ED_numinput.h.

◆ NUM_MODAL_INCREMENT_DOWN

#define NUM_MODAL_INCREMENT_DOWN   19

Definition at line 96 of file ED_numinput.h.

◆ NUM_MODAL_INCREMENT_UP

#define NUM_MODAL_INCREMENT_UP   18

Share with TFM_MODAL_CANCEL in transform.h.

Definition at line 95 of file ED_numinput.h.

◆ NUM_STR_REP_LEN

#define NUM_STR_REP_LEN   64

Definition at line 13 of file ED_numinput.h.

Typedef Documentation

◆ NumInput

typedef struct NumInput NumInput

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

NumInput.flag

Enumerator
NUM_AFFECT_ALL 

Definition at line 47 of file ED_numinput.h.

◆ anonymous enum

anonymous enum
Enumerator
NUM_NULL_ONE 
NUM_NO_NEGATIVE 
NUM_NO_ZERO 
NUM_NO_FRACTION 

Definition at line 53 of file ED_numinput.h.

Function Documentation

◆ applyNumInput()

bool applyNumInput ( NumInput n,
float vec 
)

◆ handleNumInput()

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

◆ hasNumInput()

bool hasNumInput ( const NumInput n)

◆ 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 69 of file numinput.c.

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,
struct UnitSettings unit_settings 
)

◆ user_string_to_number()

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