Blender V4.3
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
9#pragma once
10
11#define NUM_STR_REP_LEN 64
12#define NUM_MAX_ELEMENTS 3
13
14struct wmEvent;
15struct UnitSettings;
16
44
46enum {
47 NUM_AFFECT_ALL = (1 << 0),
48 /* (1 << 9) and above are reserved for internal flags! */
49};
50
52enum {
53 /* Public! */
54 NUM_NULL_ONE = (1 << 0),
55 NUM_NO_NEGATIVE = (1 << 1),
56 NUM_NO_ZERO = (1 << 2),
57 NUM_NO_FRACTION = (1 << 3),
58 /* (1 << 9) and above are reserved for internal flags! */
59};
60
61/* -------------------------------------------------------------------- */
79void initNumInput(NumInput *n);
83void outputNumInput(NumInput *n, char *str, const UnitSettings *unit_settings);
84bool hasNumInput(const NumInput *n);
88bool applyNumInput(NumInput *n, float *vec);
89bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event);
90
92#define NUM_MODAL_INCREMENT_UP 18
93#define NUM_MODAL_INCREMENT_DOWN 19
94
96 const char *str,
97 const UnitSettings *unit,
98 int type,
99 double *r_value,
100 bool use_single_line_error,
101 char **r_error);
102
void initNumInput(NumInput *n)
Definition numinput.cc:70
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
@ NUM_AFFECT_ALL
#define NUM_STR_REP_LEN
void outputNumInput(NumInput *n, char *str, const UnitSettings *unit_settings)
Definition numinput.cc:88
#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
bool hasNumInput(const NumInput *n)
Definition numinput.cc:171
#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