Blender V5.0
ED_numinput.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#define NUM_STR_REP_LEN 64
12#define NUM_MAX_ELEMENTS 3
13
14struct bContext;
15struct wmEvent;
16struct UnitSettings;
17
45
47enum {
48 NUM_AFFECT_ALL = (1 << 0),
49 /* (1 << 9) and above are reserved for internal flags! */
50};
51
53enum {
54 /* Public! */
55 NUM_NULL_ONE = (1 << 0),
56 NUM_NO_NEGATIVE = (1 << 1),
57 NUM_NO_ZERO = (1 << 2),
58 NUM_NO_FRACTION = (1 << 3),
59 /* (1 << 9) and above are reserved for internal flags! */
60};
61
62/* -------------------------------------------------------------------- */
65
79
80void initNumInput(NumInput *n);
84void outputNumInput(NumInput *n, char *str, const UnitSettings &unit_settings);
85bool hasNumInput(const NumInput *n);
89bool applyNumInput(NumInput *n, float *vec);
90bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event);
91
93#define NUM_MODAL_INCREMENT_UP 18
94#define NUM_MODAL_INCREMENT_DOWN 19
95
97 const char *str,
98 const UnitSettings &unit,
99 int type,
100 double *r_value,
101 bool use_single_line_error,
102 char **r_error);
103
void initNumInput(NumInput *n)
Definition numinput.cc:70
#define NUM_STR_REP_LEN
@ NUM_AFFECT_ALL
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)
Definition numinput.cc:266
#define NUM_MAX_ELEMENTS
bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
Definition numinput.cc:312
bool applyNumInput(NumInput *n, float *vec)
Definition numinput.cc:190
@ NUM_NO_NEGATIVE
@ NUM_NULL_ONE
@ NUM_NO_ZERO
@ NUM_NO_FRACTION
void outputNumInput(NumInput *n, char *str, const UnitSettings &unit_settings)
Definition numinput.cc:88
bool hasNumInput(const NumInput *n)
Definition numinput.cc:171
#define C
Definition RandGen.cpp:29
#define str(s)
short idx_max
float val[NUM_MAX_ELEMENTS]
short val_flag[NUM_MAX_ELEMENTS]
float val_inc[NUM_MAX_ELEMENTS]
char str[NUM_STR_REP_LEN]
float val_org[NUM_MAX_ELEMENTS]
int unit_type[NUM_MAX_ELEMENTS]
short flag
bool unit_use_radians
short idx