diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-09 15:40:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-09 15:40:09 +0300 |
commit | fb565ddb681f39cbe47e91d11e5b728bb4314a7b (patch) | |
tree | 93eba0946d0e65fd3cf16564cb41a0417bb3ba1e /source/blender/makesrna/intern/rna_key.c | |
parent | 56a47e58f4de3f66c2fee827fb2a7883b4f493e9 (diff) |
Cleanup: trailing space in RNA
Diffstat (limited to 'source/blender/makesrna/intern/rna_key.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_key.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index e65011d34d7..9a22742e7b9 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -74,20 +74,20 @@ static void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value) { KeyBlock *kb = ptr->data; char oldname[sizeof(kb->name)]; - + /* make a copy of the old name first */ BLI_strncpy(oldname, kb->name, sizeof(kb->name)); - + /* copy the new name into the name slot */ BLI_strncpy_utf8(kb->name, value, sizeof(kb->name)); - + /* make sure the name is truly unique */ if (ptr->id.data) { Key *key = rna_ShapeKey_find_key(ptr->id.data); BLI_uniquename(&key->block, kb, CTX_DATA_(BLT_I18NCONTEXT_ID_SHAPEKEY, "Key"), '.', offsetof(KeyBlock, name), sizeof(kb->name)); } - + /* fix all the animation data which may link to this */ BKE_animdata_fix_paths_rename_all(NULL, "key_blocks", oldname, kb->name); } @@ -130,7 +130,7 @@ static void rna_ShapeKey_slider_min_set(PointerRNA *ptr, float value) { KeyBlock *data = (KeyBlock *)ptr->data; float min, max, softmin, softmax; - + rna_ShapeKey_slider_min_range(ptr, &min, &max, &softmin, &softmax); CLAMP(value, min, max); data->slidermin = value; @@ -149,7 +149,7 @@ static void rna_ShapeKey_slider_max_set(PointerRNA *ptr, float value) { KeyBlock *data = (KeyBlock *)ptr->data; float min, max, softmin, softmax; - + rna_ShapeKey_slider_max_range(ptr, &min, &max, &softmin, &softmax); CLAMP(value, min, max); data->slidermax = value; @@ -273,7 +273,7 @@ PointerRNA rna_object_shapekey_index_get(ID *id, int value) if (key && value < key->totkey) kb = BLI_findlink(&key->block, value); - + RNA_pointer_create(id, &RNA_ShapeKey, kb, &ptr); return ptr; @@ -287,7 +287,7 @@ int rna_object_shapekey_index_set(ID *id, PointerRNA value, int current) int a = BLI_findindex(&key->block, value.data); if (a != -1) return a; } - + return current; } @@ -410,17 +410,17 @@ static void rna_ShapeKey_data_begin(CollectionPropertyIterator *iter, PointerRNA Curve *cu; Nurb *nu; int tot = kb->totelem, size = key->elemsize; - + if (GS(key->from->name) == ID_CU) { cu = (Curve *)key->from; nu = cu->nurb.first; - + if (nu->bezt) { tot /= 3; size *= 3; } } - + rna_iterator_array_begin(iter, (void *)kb->data, size, tot, 0, NULL); } @@ -431,15 +431,15 @@ static int rna_ShapeKey_data_length(PointerRNA *ptr) Curve *cu; Nurb *nu; int tot = kb->totelem; - + if (GS(key->from->name) == ID_CU) { cu = (Curve *)key->from; nu = cu->nurb.first; - + if (nu->bezt) tot /= 3; } - + return tot; } @@ -449,11 +449,11 @@ static PointerRNA rna_ShapeKey_data_get(CollectionPropertyIterator *iter) StructRNA *type; Curve *cu; Nurb *nu; - + if (GS(key->from->name) == ID_CU) { cu = (Curve *)key->from; nu = cu->nurb.first; - + if (nu->bezt) type = &RNA_ShapeKeyBezierPoint; else @@ -461,7 +461,7 @@ static PointerRNA rna_ShapeKey_data_get(CollectionPropertyIterator *iter) } else type = &RNA_ShapeKeyPoint; - + return rna_pointer_inherit_refine(&iter->parent, type, rna_iterator_array_get(iter)); } @@ -495,11 +495,11 @@ static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *p static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point) { KeyBlock *kb; - + /* sanity checks */ if (ELEM(NULL, key, point)) return NULL; - + /* we'll need to manually search through the keyblocks and check * if the point is somewhere in the middle of each block's data */ @@ -507,7 +507,7 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point) if (kb->data) { float *start = (float *)kb->data; float *end; - + /* easy cases first */ if ((start == NULL) || (start > point)) { /* there's no chance point is in array */ @@ -517,12 +517,12 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point) /* exact match - point is first in array */ return kb; } - + /* determine where end of array is * - elemsize is in bytes, so use (char *) cast to get array in terms of bytes */ end = (float *)((char *)start + (key->elemsize * kb->totelem)); - + /* if point's address is less than the end, then it is somewhere between start and end, so in array */ if (end > point) { /* we've found the owner of the point data */ @@ -530,7 +530,7 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point) } } } - + return NULL; } @@ -542,18 +542,18 @@ static int rna_ShapeKeyPoint_get_index(Key *key, KeyBlock *kb, float *point) */ char *start = (char *)kb->data; char *pt = (char *)point; - + return (int)(pt - start) / key->elemsize; } static int rna_ShapeKeyBezierPoint_get_index(KeyBlock *kb, float *point) { float *start = (float *)kb->data; - + /* Unlike with rna_ShapeKeyPoint_get_index(), we cannot use key->elemsize here * since the default value for curves (16) is actually designed for BPoints * (i.e. NURBS Surfaces). The magic number "12" here was found by empirical - * testing on a 64-bit system, and is similar to what's used for meshes and + * testing on a 64-bit system, and is similar to what's used for meshes and * lattices. For more details, see T38013 */ return (int)(point - start) / 12; @@ -565,21 +565,21 @@ static char *rna_ShapeKeyPoint_path(PointerRNA *ptr) Key *key = rna_ShapeKey_find_key(ptr->id.data); KeyBlock *kb; float *point = (float *)ptr->data; - + /* if we can get a key block, we can construct a path */ kb = rna_ShapeKeyData_find_keyblock(key, point); - + if (kb) { char name_esc_kb[sizeof(kb->name) * 2]; int index; - + if (ptr->type == &RNA_ShapeKeyBezierPoint) index = rna_ShapeKeyBezierPoint_get_index(kb, point); else index = rna_ShapeKeyPoint_get_index(key, kb, point); BLI_strescape(name_esc_kb, kb->name, sizeof(name_esc_kb)); - + if (GS(id->name) == ID_KE) return BLI_sprintfN("key_blocks[\"%s\"].data[%d]", name_esc_kb, index); else @@ -689,7 +689,7 @@ static void rna_def_keyblock(BlenderRNA *brna) RNA_def_property_float_funcs(prop, "rna_ShapeKey_frame_get", NULL, NULL); RNA_def_property_ui_text(prop, "Frame", "Frame for absolute keys"); RNA_def_property_update(prop, 0, "rna_Key_update_data"); - + /* for now, this is editable directly, as users can set this even if they're not animating them * (to test results) */ prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_FACTOR); |