Blender V4.3
BKE_unit.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
5#pragma once
6
7#include "BLI_sys_types.h"
8
13struct UnitSettings;
14
15/* In all cases the value is assumed to be scaled by the user-preference. */
16
21 int str_maxncpy,
22 double value,
23 int prec,
24 int system,
25 int type,
26 bool split,
27 bool pad);
32size_t BKE_unit_value_as_string(char *str,
33 int str_maxncpy,
34 double value,
35 int prec,
36 int type,
37 const UnitSettings *settings,
38 bool pad);
39
58 char *str, int str_maxncpy, const char *str_prev, double scale_pref, int system, int type);
59
63bool BKE_unit_string_contains_unit(const char *str, int type);
64
68double BKE_unit_apply_preferred_unit(const UnitSettings *settings, int type, double value);
69
73void BKE_unit_name_to_alt(char *str, int str_maxncpy, const char *orig_str, int system, int type);
74
78double BKE_unit_closest_scalar(double value, int system, int type);
79
83double BKE_unit_base_scalar(int system, int type);
84
88bool BKE_unit_is_valid(int system, int type);
89
93// double bUnit_Iter(void **unit, char **name, int system, int type);
94
95void BKE_unit_system_get(int system, int type, const void **r_usys_pt, int *r_len);
96int BKE_unit_base_get(const void *usys_pt);
97int BKE_unit_base_of_type_get(int system, int type);
98const char *BKE_unit_name_get(const void *usys_pt, int index);
99const char *BKE_unit_display_name_get(const void *usys_pt, int index);
100const char *BKE_unit_identifier_get(const void *usys_pt, int index);
101double BKE_unit_scalar_get(const void *usys_pt, int index);
102bool BKE_unit_is_suppressed(const void *usys_pt, int index);
103
105enum {
123};
void BKE_unit_name_to_alt(char *str, int str_maxncpy, const char *orig_str, int system, int type)
Definition unit.cc:2405
int BKE_unit_base_of_type_get(int system, int type)
Definition unit.cc:2495
bool BKE_unit_is_valid(int system, int type)
Definition unit.cc:2472
const char * BKE_unit_identifier_get(const void *usys_pt, int index)
Definition unit.cc:2512
bool BKE_unit_is_suppressed(const void *usys_pt, int index)
Definition unit.cc:2530
void BKE_unit_system_get(int system, int type, const void **r_usys_pt, int *r_len)
Definition unit.cc:2477
const char * BKE_unit_display_name_get(const void *usys_pt, int index)
Definition unit.cc:2506
@ B_UNIT_TIME_ABSOLUTE
Definition BKE_unit.hh:113
@ B_UNIT_AREA
Definition BKE_unit.hh:108
@ B_UNIT_FREQUENCY
Definition BKE_unit.hh:121
@ B_UNIT_TYPE_TOT
Definition BKE_unit.hh:122
@ B_UNIT_VOLUME
Definition BKE_unit.hh:109
@ B_UNIT_LENGTH
Definition BKE_unit.hh:107
@ B_UNIT_ROTATION
Definition BKE_unit.hh:111
@ B_UNIT_TEMPERATURE
Definition BKE_unit.hh:118
@ B_UNIT_CAMERA
Definition BKE_unit.hh:116
@ B_UNIT_ACCELERATION
Definition BKE_unit.hh:115
@ B_UNIT_MASS
Definition BKE_unit.hh:110
@ B_UNIT_WAVELENGTH
Definition BKE_unit.hh:119
@ B_UNIT_NONE
Definition BKE_unit.hh:106
@ B_UNIT_POWER
Definition BKE_unit.hh:117
@ B_UNIT_COLOR_TEMPERATURE
Definition BKE_unit.hh:120
@ B_UNIT_TIME
Definition BKE_unit.hh:112
@ B_UNIT_VELOCITY
Definition BKE_unit.hh:114
const char * BKE_unit_name_get(const void *usys_pt, int index)
Definition unit.cc:2500
int BKE_unit_base_get(const void *usys_pt)
Definition unit.cc:2490
bool BKE_unit_replace_string(char *str, int str_maxncpy, const char *str_prev, double scale_pref, int system, int type)
Definition unit.cc:2315
double BKE_unit_scalar_get(const void *usys_pt, int index)
Definition unit.cc:2523
double BKE_unit_closest_scalar(double value, int system, int type)
Definition unit.cc:2446
size_t BKE_unit_value_as_string(char *str, int str_maxncpy, double value, int prec, int type, const UnitSettings *settings, bool pad)
Definition unit.cc:1876
double BKE_unit_apply_preferred_unit(const UnitSettings *settings, int type, double value)
Definition unit.cc:2303
double BKE_unit_base_scalar(int system, int type)
Definition unit.cc:2462
bool BKE_unit_string_contains_unit(const char *str, int type)
Definition unit.cc:2289
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)
Definition unit.cc:1863
int pad[32 - sizeof(int)]
#define str(s)