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>2019-06-03 17:21:57 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-06-03 17:24:38 +0300
commit1f650c402d3b43eee7cb51c7d4f373ba82ac2116 (patch)
treeba2432fe9424ae545d3758d37ec8ebb0419a2ba5 /source/blender/makesrna/intern/rna_armature.c
parente3f2034e7b925bc7e31e65051842cf26d70a20bc (diff)
Cleanup: style, use braces in RNA
Diffstat (limited to 'source/blender/makesrna/intern/rna_armature.c')
-rw-r--r--source/blender/makesrna/intern/rna_armature.c87
1 files changed, 58 insertions, 29 deletions
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index 604be10d5ab..d0081894c41 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -157,8 +157,9 @@ static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), Pointe
/* proxy lib exception, store it here so we can restore layers on file
* load, since it would otherwise get lost due to being linked data */
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
- if (ob->data == arm && ob->pose)
+ if (ob->data == arm && ob->pose) {
ob->pose->proxy_layer = arm->layer;
+ }
}
DEG_id_tag_update(&arm->id, ID_RECALC_COPY_ON_WRITE);
@@ -284,18 +285,23 @@ static void rna_bone_layer_set(int *layer, const bool *values)
int i, tot = 0;
/* ensure we always have some layer selected */
- for (i = 0; i < 32; i++)
- if (values[i])
+ for (i = 0; i < 32; i++) {
+ if (values[i]) {
tot++;
+ }
+ }
- if (tot == 0)
+ if (tot == 0) {
return;
+ }
for (i = 0; i < 32; i++) {
- if (values[i])
+ if (values[i]) {
*layer |= (1u << i);
- else
+ }
+ else {
*layer &= ~(1u << i);
+ }
}
}
@@ -316,18 +322,23 @@ static void rna_Armature_layer_set(PointerRNA *ptr, const bool *values)
int i, tot = 0;
/* ensure we always have some layer selected */
- for (i = 0; i < 32; i++)
- if (values[i])
+ for (i = 0; i < 32; i++) {
+ if (values[i]) {
tot++;
+ }
+ }
- if (tot == 0)
+ if (tot == 0) {
return;
+ }
for (i = 0; i < 32; i++) {
- if (values[i])
+ if (values[i]) {
arm->layer |= (1u << i);
- else
+ }
+ else {
arm->layer &= ~(1u << i);
+ }
}
}
@@ -372,8 +383,9 @@ static void rna_EditBone_connected_check(EditBone *ebone)
/* Attach this bone to its parent */
copy_v3_v3(ebone->head, ebone->parent->tail);
- if (ebone->flag & BONE_ROOTSEL)
+ if (ebone->flag & BONE_ROOTSEL) {
ebone->parent->flag |= BONE_TIPSEL;
+ }
}
else if (!(ebone->parent->flag & BONE_ROOTSEL)) {
ebone->parent->flag &= ~BONE_TIPSEL;
@@ -385,10 +397,12 @@ static void rna_EditBone_connected_set(PointerRNA *ptr, bool value)
{
EditBone *ebone = (EditBone *)(ptr->data);
- if (value)
+ if (value) {
ebone->flag |= BONE_CONNECTED;
- else
+ }
+ else {
ebone->flag &= ~BONE_CONNECTED;
+ }
rna_EditBone_connected_check(ebone);
}
@@ -407,24 +421,29 @@ static void rna_EditBone_parent_set(PointerRNA *ptr,
EditBone *pbone, *parbone = (EditBone *)value.data;
if (parbone == NULL) {
- if (ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL))
+ if (ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL)) {
ebone->parent->flag &= ~BONE_TIPSEL;
+ }
ebone->parent = NULL;
ebone->flag &= ~BONE_CONNECTED;
}
else {
/* within same armature */
- if (value.id.data != ptr->id.data)
+ if (value.id.data != ptr->id.data) {
return;
+ }
/* make sure this is a valid child */
- if (parbone == ebone)
+ if (parbone == ebone) {
return;
+ }
- for (pbone = parbone->parent; pbone; pbone = pbone->parent)
- if (pbone == ebone)
+ for (pbone = parbone->parent; pbone; pbone = pbone->parent) {
+ if (pbone == ebone) {
return;
+ }
+ }
ebone->parent = parbone;
rna_EditBone_connected_check(ebone);
@@ -534,13 +553,16 @@ static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, Po
EditBone *child, *eboflip;
/* update our parent */
- if (ebone->parent && ebone->flag & BONE_CONNECTED)
+ if (ebone->parent && ebone->flag & BONE_CONNECTED) {
copy_v3_v3(ebone->parent->tail, ebone->head);
+ }
/* update our children if necessary */
- for (child = arm->edbo->first; child; child = child->next)
- if (child->parent == ebone && (child->flag & BONE_CONNECTED))
+ for (child = arm->edbo->first; child; child = child->next) {
+ if (child->parent == ebone && (child->flag & BONE_CONNECTED)) {
copy_v3_v3(child->head, ebone->tail);
+ }
+ }
if (arm->flag & ARM_MIRROR_EDIT) {
eboflip = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
@@ -552,13 +574,16 @@ static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, Po
eboflip->tail[0] = -ebone->tail[0];
/* update our parent */
- if (eboflip->parent && eboflip->flag & BONE_CONNECTED)
+ if (eboflip->parent && eboflip->flag & BONE_CONNECTED) {
copy_v3_v3(eboflip->parent->tail, eboflip->head);
+ }
/* update our children if necessary */
- for (child = arm->edbo->first; child; child = child->next)
- if (child->parent == eboflip && (child->flag & BONE_CONNECTED))
+ for (child = arm->edbo->first; child; child = child->next) {
+ if (child->parent == eboflip && (child->flag & BONE_CONNECTED)) {
copy_v3_v3(child->head, eboflip->tail);
+ }
+ }
}
}
@@ -570,10 +595,12 @@ static void rna_Armature_bones_next(CollectionPropertyIterator *iter)
ListBaseIterator *internal = &iter->internal.listbase;
Bone *bone = (Bone *)internal->link;
- if (bone->childbase.first)
+ if (bone->childbase.first) {
internal->link = (Link *)bone->childbase.first;
- else if (bone->next)
+ }
+ else if (bone->next) {
internal->link = (Link *)bone->next;
+ }
else {
internal->link = NULL;
@@ -622,10 +649,12 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone)
{
# define RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone) \
{ \
- if (is_posebone) \
+ if (is_posebone) { \
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); \
- else \
+ } \
+ else { \
RNA_def_property_update(prop, 0, "rna_Armature_update_data"); \
+ } \
} \
((void)0)