Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/unit.c
| Show First 20 Lines • Show All 827 Lines • ▼ Show 20 Lines | if (ch_is_op(remaining_str[i])) { | ||||
| if (remaining_str[i - 1] == ' ') { | if (remaining_str[i - 1] == ' ') { | ||||
| i--; | i--; | ||||
| } | } | ||||
| } | } | ||||
| return remaining_str + i; | return remaining_str + i; | ||||
| } | } | ||||
| } | } | ||||
| BLI_assert(!"String should be NULL terminated"); | BLI_assert_msg(0, "String should be NULL terminated"); | ||||
| return remaining_str + i; | return remaining_str + i; | ||||
| } | } | ||||
| /** | /** | ||||
| * Put parentheses around blocks of values after negative signs to get rid of an implied "+" | * Put parentheses around blocks of values after negative signs to get rid of an implied "+" | ||||
| * between numbers without an operation between them. For example: | * between numbers without an operation between them. For example: | ||||
| * | * | ||||
| * "-1m50cm + 1 - 2m50cm" -> "-(1m50cm) + 1 - (2m50cm)" | * "-1m50cm + 1 - 2m50cm" -> "-(1m50cm) + 1 - (2m50cm)" | ||||
| ▲ Show 20 Lines • Show All 453 Lines • ▼ Show 20 Lines | |||||
| const char *BKE_unit_display_name_get(const void *usys_pt, int index) | const char *BKE_unit_display_name_get(const void *usys_pt, int index) | ||||
| { | { | ||||
| return ((bUnitCollection *)usys_pt)->units[index].name_display; | return ((bUnitCollection *)usys_pt)->units[index].name_display; | ||||
| } | } | ||||
| const char *BKE_unit_identifier_get(const void *usys_pt, int index) | const char *BKE_unit_identifier_get(const void *usys_pt, int index) | ||||
| { | { | ||||
| const bUnitDef *unit = ((const bUnitCollection *)usys_pt)->units + index; | const bUnitDef *unit = ((const bUnitCollection *)usys_pt)->units + index; | ||||
| if (unit->identifier == NULL) { | if (unit->identifier == NULL) { | ||||
| BLI_assert(false && "identifier for this unit is not specified yet"); | BLI_assert_msg(0, "identifier for this unit is not specified yet"); | ||||
| } | } | ||||
| return unit->identifier; | return unit->identifier; | ||||
| } | } | ||||
| double BKE_unit_scalar_get(const void *usys_pt, int index) | double BKE_unit_scalar_get(const void *usys_pt, int index) | ||||
| { | { | ||||
| return ((bUnitCollection *)usys_pt)->units[index].scalar; | return ((bUnitCollection *)usys_pt)->units[index].scalar; | ||||
| } | } | ||||
| bool BKE_unit_is_suppressed(const void *usys_pt, int index) | bool BKE_unit_is_suppressed(const void *usys_pt, int index) | ||||
| { | { | ||||
| return (((bUnitCollection *)usys_pt)->units[index].flag & B_UNIT_DEF_SUPPRESS) != 0; | return (((bUnitCollection *)usys_pt)->units[index].flag & B_UNIT_DEF_SUPPRESS) != 0; | ||||
| } | } | ||||