75 value = std::abs(value);
77 if (!isfinite(value) || value >=
double(std::numeric_limits<uint64_t>::max())) {
80 return value == double(
uint64_t(value));
110 for (j = 0; j <= n->
idx_max; j++) {
123 const char *heading_exp =
"", *trailing_exp =
"";
144 double(n->
val[i] * fac),
165 const char *cur = (i == n->
idx) ?
"|" :
"";
179 const char *cur = (i == n->
idx) ?
"|" :
"";
198 for (i = 0; i <= n->
idx_max; i++) {
213 for (j = 0; j <= n->
idx_max; j++) {
247 for (j = 0; j <= n->
idx_max; j++) {
270 int len = strlen(&n->
str[cur]) + 1;
271 int n_cur = cur + buf_len;
277 memmove(&n->
str[n_cur], &n->
str[cur],
len);
278 memcpy(&n->
str[cur], buf,
sizeof(
char) * buf_len);
289 double *r_value_no_units,
290 const bool use_single_line_error,
300 char str_unit_convert[256];
303 str_unit_convert,
sizeof(str_unit_convert),
str, unit_scale, unit.
system, type);
306 if (r_value_no_units) {
310 *r_value_no_units = *r_value;
316 if (r_value_no_units) {
317 *r_value_no_units = *r_value;
320 *r_value /= unit_scale;
324 UNUSED_VARS(
C, unit, type, use_single_line_error, r_error);
325 *r_value = atof(
str);
326 if (r_value_no_units) {
327 *r_value_no_units = *r_value;
335 if (ascii >=
'0' && ascii <=
'9') {
346 const char *utf8_buf =
nullptr;
348 char ascii[2] = {
'\0',
'\0'};
349 bool updated =
false;
359 strchr(
"01234567890@%^&*-+/{}()[]<>.|", event_ascii))
371 if (
ELEM(event_ascii,
'=',
'*')) {
384 switch (event->
type) {
394 utf8_buf =
event->utf8_buf;
395 ascii[0] = event_ascii;
439 std::swap(t_cur, cur);
443 memmove(&n->
str[cur], &n->
str[t_cur], strlen(&n->
str[t_cur]) + 1);
490 idx = (idx + idx_max + ((
event->modifier &
KM_CTRL) ? 0 : 2)) % (idx_max + 1);
570 if (!updated && !utf8_buf && event->
utf8_buf[0]) {
571 utf8_buf =
event->utf8_buf;
572 ascii[0] = event_ascii;
582 if ((!utf8_buf || !utf8_buf[0]) && ascii[0]) {
587 if (utf8_buf && utf8_buf[0]) {
611 const float val_prev = n->
val[idx];
613 char *error =
nullptr;
616 double val_no_units = 0.0;
648 n->
val[idx] = -n->
val[idx];
669 if (!isfinite(n->
val[idx])) [[unlikely]] {
670 n->
val[idx] = val_prev;
#define STRNCPY_UTF8(dst, src)
Read Blender memory allocation and freeing.
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
int calc_float_precision(int prec, double value)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
size_t size_t size_t BLI_snprintf_utf8(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned __int64 uint64_t
double BKE_unit_value_scale(const UnitSettings &settings, int unit_type, double value)
bool ED_numinput_double_is_int(double value)
MINLINE void copy_v3_v3(float r[3], const float a[3])
bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
bool BPY_run_string_as_number(bContext *C, const char *imports[], const char *expr, BPy_RunErrInfo *err_info, double *r_value) ATTR_NONNULL(1
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
bool hasNumInput(const NumInput *n)
char WM_event_utf8_to_ascii(const wmEvent *event)
bool BKE_unit_replace_string(char *str, int str_maxncpy, const char *str_prev, double scale_pref, int system, int type)
bool user_string_to_number(bContext *C, const char *str, const UnitSettings &unit, int type, double *r_value, double *r_value_no_units, bool use_single_line_error, char **r_error)
char * WM_clipboard_text_get_firstline(bool selection, bool ensure_utf8, int *r_len)
void BKE_report(ReportList *reports, eReportType type, const char *message)
void initNumInput(NumInput *n)
size_t BKE_unit_value_as_string_adaptive(char *str, int str_maxncpy, double value, int prec, int system, int type, bool split, bool pad, bool do_unit_suffix)
const char int BLI_str_utf8_size_or_error(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BKE_unit_string_contains_unit(const char *str, int type)
MINLINE void zero_v3(float r[3])
bool applyNumInput(NumInput *n, float *vec)
static bool editstr_is_simple_numinput(const char ascii)
void BLI_str_cursor_step_utf8(const char *str, int str_maxlen, int *pos, eStrCursorJumpDirection direction, eStrCursorJumpType jump, bool use_init_step)
@ USER_FLAG_NUMINPUT_ADVANCED
void outputNumInput(NumInput *n, char *str, const UnitSettings &unit_settings)
void WM_clipboard_text_set(const char *buf, bool selection)
Scene * CTX_data_scene(const bContext *C)
static void value_to_editstr(NumInput *n, int idx)
ReportList * CTX_wm_reports(const bContext *C)
int BLI_str_utf8_invalid_strip(char *str, size_t str_len) ATTR_NONNULL(1)
double BKE_unit_apply_preferred_unit(const UnitSettings &settings, int type, double value)
static bool editstr_insert_at_cursor(NumInput *n, const char *buf, const int buf_len)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
bool use_single_line_error
wmEventModifierFlag modifier