Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-11-06 04:30:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-06 04:32:54 +0300
commitaa3a4973a30ff668a62447e18ac41f6c916b4a8b (patch)
tree1b24cc55995ba8b3d72aaabd9400a3e1e030d540 /source/blender/blenkernel/intern/key.c
parent7cb20d841da16d0bffb63154403267500e9941f5 (diff)
Cleanup: use ELEM macro
Diffstat (limited to 'source/blender/blenkernel/intern/key.c')
-rw-r--r--source/blender/blenkernel/intern/key.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 587b9eb1436..7468112b40e 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1616,7 +1616,7 @@ int BKE_keyblock_element_count_from_shape(const Key *key, const int shape_index)
int result = 0;
int index = 0;
for (const KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) {
- if ((shape_index == -1) || (index == shape_index)) {
+ if (ELEM(shape_index, -1, index)) {
result += kb->totelem;
}
}
@@ -1656,7 +1656,7 @@ void BKE_keyblock_data_get_from_shape(const Key *key, float (*arr)[3], const int
uint8_t *elements = (uint8_t *)arr;
int index = 0;
for (const KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) {
- if ((shape_index == -1) || (index == shape_index)) {
+ if (ELEM(shape_index, -1, index)) {
const int block_elem_len = kb->totelem * key->elemsize;
memcpy(elements, kb->data, block_elem_len);
elements += block_elem_len;
@@ -1686,7 +1686,7 @@ void BKE_keyblock_data_set_with_mat4(Key *key,
int index = 0;
for (KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) {
- if ((shape_index == -1) || (index == shape_index)) {
+ if (ELEM(shape_index, -1, index)) {
const int block_elem_len = kb->totelem;
float(*block_data)[3] = (float(*)[3])kb->data;
for (int data_offset = 0; data_offset < block_elem_len; ++data_offset) {
@@ -1710,7 +1710,7 @@ void BKE_keyblock_curve_data_set_with_mat4(
int index = 0;
for (KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) {
- if ((shape_index == -1) || (index == shape_index)) {
+ if (ELEM(shape_index, -1, index)) {
const int block_elem_size = kb->totelem * key->elemsize;
BKE_keyblock_curve_data_transform(nurb, mat, elements, kb->data);
elements += block_elem_size;
@@ -1726,7 +1726,7 @@ void BKE_keyblock_data_set(Key *key, const int shape_index, const void *data)
const uint8_t *elements = data;
int index = 0;
for (KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) {
- if ((shape_index == -1) || (index == shape_index)) {
+ if (ELEM(shape_index, -1, index)) {
const int block_elem_size = kb->totelem * key->elemsize;
memcpy(kb->data, elements, block_elem_size);
elements += block_elem_size;