From 1f650c402d3b43eee7cb51c7d4f373ba82ac2116 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Jun 2019 00:21:57 +1000 Subject: Cleanup: style, use braces in RNA --- source/blender/makesrna/intern/rna_ID.c | 117 +++++--- source/blender/makesrna/intern/rna_action.c | 18 +- source/blender/makesrna/intern/rna_animation.c | 39 ++- source/blender/makesrna/intern/rna_armature.c | 87 ++++-- source/blender/makesrna/intern/rna_boid.c | 30 +- source/blender/makesrna/intern/rna_brush.c | 12 +- source/blender/makesrna/intern/rna_cloth.c | 33 ++- source/blender/makesrna/intern/rna_color.c | 21 +- source/blender/makesrna/intern/rna_constraint.c | 34 ++- source/blender/makesrna/intern/rna_curve.c | 69 +++-- source/blender/makesrna/intern/rna_dynamicpaint.c | 3 +- source/blender/makesrna/intern/rna_fcurve.c | 51 ++-- source/blender/makesrna/intern/rna_fcurve_api.c | 5 +- source/blender/makesrna/intern/rna_fluidsim.c | 6 +- source/blender/makesrna/intern/rna_gpencil.c | 45 ++- source/blender/makesrna/intern/rna_image.c | 30 +- source/blender/makesrna/intern/rna_image_api.c | 12 +- source/blender/makesrna/intern/rna_key.c | 24 +- source/blender/makesrna/intern/rna_lattice.c | 36 ++- source/blender/makesrna/intern/rna_layer.c | 9 +- source/blender/makesrna/intern/rna_light.c | 3 +- source/blender/makesrna/intern/rna_linestyle.c | 3 +- source/blender/makesrna/intern/rna_main.c | 9 +- source/blender/makesrna/intern/rna_main_api.c | 12 +- source/blender/makesrna/intern/rna_mask.c | 9 +- source/blender/makesrna/intern/rna_material.c | 12 +- source/blender/makesrna/intern/rna_mesh.c | 33 ++- source/blender/makesrna/intern/rna_mesh_api.c | 3 +- source/blender/makesrna/intern/rna_meta.c | 15 +- source/blender/makesrna/intern/rna_modifier.c | 15 +- source/blender/makesrna/intern/rna_movieclip.c | 3 +- source/blender/makesrna/intern/rna_nla.c | 24 +- source/blender/makesrna/intern/rna_nodetree.c | 308 ++++++++++++++------- source/blender/makesrna/intern/rna_object.c | 99 ++++--- source/blender/makesrna/intern/rna_object_api.c | 3 +- source/blender/makesrna/intern/rna_object_force.c | 105 ++++--- source/blender/makesrna/intern/rna_palette.c | 9 +- source/blender/makesrna/intern/rna_particle.c | 153 ++++++---- source/blender/makesrna/intern/rna_pose.c | 87 ++++-- source/blender/makesrna/intern/rna_render.c | 9 +- source/blender/makesrna/intern/rna_rigidbody.c | 9 +- source/blender/makesrna/intern/rna_rna.c | 105 ++++--- source/blender/makesrna/intern/rna_scene.c | 105 ++++--- source/blender/makesrna/intern/rna_scene_api.c | 3 +- source/blender/makesrna/intern/rna_screen.c | 6 +- source/blender/makesrna/intern/rna_sculpt_paint.c | 21 +- source/blender/makesrna/intern/rna_sequencer.c | 48 ++-- source/blender/makesrna/intern/rna_sequencer_api.c | 9 +- source/blender/makesrna/intern/rna_smoke.c | 36 ++- source/blender/makesrna/intern/rna_sound.c | 6 +- source/blender/makesrna/intern/rna_space.c | 70 +++-- source/blender/makesrna/intern/rna_text.c | 24 +- source/blender/makesrna/intern/rna_texture.c | 36 ++- source/blender/makesrna/intern/rna_tracking.c | 60 ++-- source/blender/makesrna/intern/rna_ui.c | 54 ++-- source/blender/makesrna/intern/rna_userdef.c | 30 +- source/blender/makesrna/intern/rna_wm.c | 96 ++++--- source/blender/makesrna/intern/rna_wm_api.c | 42 ++- source/blender/makesrna/intern/rna_wm_gizmo.c | 33 ++- source/blender/makesrna/intern/rna_world.c | 3 +- 60 files changed, 1592 insertions(+), 799 deletions(-) diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 7e6a3e70b9d..a1144378f09 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -161,8 +161,9 @@ static int rna_ID_name_editable(PointerRNA *ptr, const char **UNUSED(r_info)) if (GS(id->name) == ID_VF) { VFont *vfont = (VFont *)id; - if (BKE_vfont_is_builtin(vfont)) + if (BKE_vfont_is_builtin(vfont)) { return 0; + } } else if (!BKE_id_is_in_global_main(id)) { return 0; @@ -205,76 +206,111 @@ short RNA_type_to_ID_code(const StructRNA *type) if (UNLIKELY(base_type == NULL)) { return 0; } - if (base_type == &RNA_Action) + if (base_type == &RNA_Action) { return ID_AC; - if (base_type == &RNA_Armature) + } + if (base_type == &RNA_Armature) { return ID_AR; - if (base_type == &RNA_Brush) + } + if (base_type == &RNA_Brush) { return ID_BR; - if (base_type == &RNA_CacheFile) + } + if (base_type == &RNA_CacheFile) { return ID_CF; - if (base_type == &RNA_Camera) + } + if (base_type == &RNA_Camera) { return ID_CA; - if (base_type == &RNA_Curve) + } + if (base_type == &RNA_Curve) { return ID_CU; - if (base_type == &RNA_GreasePencil) + } + if (base_type == &RNA_GreasePencil) { return ID_GD; - if (base_type == &RNA_Collection) + } + if (base_type == &RNA_Collection) { return ID_GR; - if (base_type == &RNA_Image) + } + if (base_type == &RNA_Image) { return ID_IM; - if (base_type == &RNA_Key) + } + if (base_type == &RNA_Key) { return ID_KE; - if (base_type == &RNA_Light) + } + if (base_type == &RNA_Light) { return ID_LA; - if (base_type == &RNA_Library) + } + if (base_type == &RNA_Library) { return ID_LI; - if (base_type == &RNA_FreestyleLineStyle) + } + if (base_type == &RNA_FreestyleLineStyle) { return ID_LS; - if (base_type == &RNA_Lattice) + } + if (base_type == &RNA_Lattice) { return ID_LT; - if (base_type == &RNA_Material) + } + if (base_type == &RNA_Material) { return ID_MA; - if (base_type == &RNA_MetaBall) + } + if (base_type == &RNA_MetaBall) { return ID_MB; - if (base_type == &RNA_MovieClip) + } + if (base_type == &RNA_MovieClip) { return ID_MC; - if (base_type == &RNA_Mesh) + } + if (base_type == &RNA_Mesh) { return ID_ME; - if (base_type == &RNA_Mask) + } + if (base_type == &RNA_Mask) { return ID_MSK; - if (base_type == &RNA_NodeTree) + } + if (base_type == &RNA_NodeTree) { return ID_NT; - if (base_type == &RNA_Object) + } + if (base_type == &RNA_Object) { return ID_OB; - if (base_type == &RNA_ParticleSettings) + } + if (base_type == &RNA_ParticleSettings) { return ID_PA; - if (base_type == &RNA_Palette) + } + if (base_type == &RNA_Palette) { return ID_PAL; - if (base_type == &RNA_PaintCurve) + } + if (base_type == &RNA_PaintCurve) { return ID_PC; - if (base_type == &RNA_LightProbe) + } + if (base_type == &RNA_LightProbe) { return ID_LP; - if (base_type == &RNA_Scene) + } + if (base_type == &RNA_Scene) { return ID_SCE; - if (base_type == &RNA_Screen) + } + if (base_type == &RNA_Screen) { return ID_SCR; - if (base_type == &RNA_Sound) + } + if (base_type == &RNA_Sound) { return ID_SO; - if (base_type == &RNA_Speaker) + } + if (base_type == &RNA_Speaker) { return ID_SPK; - if (base_type == &RNA_Texture) + } + if (base_type == &RNA_Texture) { return ID_TE; - if (base_type == &RNA_Text) + } + if (base_type == &RNA_Text) { return ID_TXT; - if (base_type == &RNA_VectorFont) + } + if (base_type == &RNA_VectorFont) { return ID_VF; - if (base_type == &RNA_WorkSpace) + } + if (base_type == &RNA_WorkSpace) { return ID_WS; - if (base_type == &RNA_World) + } + if (base_type == &RNA_World) { return ID_WO; - if (base_type == &RNA_WindowManager) + } + if (base_type == &RNA_WindowManager) { return ID_WM; + } return 0; } @@ -411,8 +447,9 @@ StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), RNA_pointer_create(NULL, &RNA_PropertyGroup, NULL, &dummyptr); /* validate the python class */ - if (validate(&dummyptr, data, NULL) != 0) + if (validate(&dummyptr, data, NULL) != 0) { return NULL; + } /* note: it looks like there is no length limit on the srna id since its * just a char pointer, but take care here, also be careful that python @@ -666,10 +703,12 @@ static void rna_ImagePreview_is_custom_set(PointerRNA *ptr, int value, enum eIco return; } - if (value) + if (value) { prv_img->flag[size] |= PRV_USER_EDITED; - else + } + else { prv_img->flag[size] &= ~PRV_USER_EDITED; + } prv_img->flag[size] |= PRV_CHANGED; diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 4e98db21089..ba5355a8d95 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -59,10 +59,12 @@ static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter) bActionGroup *grp = fcu->grp; /* only continue if the next F-Curve (if existent) belongs in the same group */ - if ((fcu->next) && (fcu->next->grp == grp)) + if ((fcu->next) && (fcu->next->grp == grp)) { internal->link = (Link *)fcu->next; - else + } + else { internal->link = NULL; + } iter->valid = (internal->link != NULL); } @@ -112,8 +114,9 @@ static FCurve *rna_Action_fcurve_new(bAction *act, int index, const char *group) { - if (group && group[0] == '\0') + if (group && group[0] == '\0') { group = NULL; + } if (data_path[0] == '\0') { BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument"); @@ -261,10 +264,12 @@ bool rna_Action_id_poll(PointerRNA *ptr, PointerRNA value) * (i.e. floating "action-library" members) which we will not * be able to resolve an idroot for automatically, so let these through */ - if (act->idroot == 0) + if (act->idroot == 0) { return 1; - else if (srcId) + } + else if (srcId) { return GS(srcId->name) == act->idroot; + } } return 0; @@ -282,8 +287,9 @@ bool rna_Action_actedit_assign_poll(PointerRNA *ptr, PointerRNA value) * (i.e. floating "action-library" members) which we will not * be able to resolve an idroot for automatically, so let these through */ - if (act->idroot == 0) + if (act->idroot == 0) { return 1; + } if (saction) { if (saction->mode == SACTCONT_ACTION) { diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 6228414e4f4..4db8ccce3ef 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -145,10 +145,12 @@ static int rna_AnimData_action_editable(PointerRNA *ptr, const char **UNUSED(r_i AnimData *adt = (AnimData *)ptr->data; /* active action is only editable when it is not a tweaking strip */ - if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) + if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) { return 0; - else + } + else { return PROP_EDITABLE; + } } static void rna_AnimData_action_set(PointerRNA *ptr, @@ -277,8 +279,9 @@ static void rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type) { KeyingSetInfo *ksi = RNA_struct_blender_type_get(type); - if (ksi == NULL) + if (ksi == NULL) { return; + } /* free RNA data referencing this */ RNA_struct_free_extension(type, &ksi->ext); @@ -309,8 +312,9 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, RNA_pointer_create(NULL, &RNA_KeyingSetInfo, &dummyksi, &dummyptr); /* validate the python class */ - if (validate(&dummyptr, data, have_function) != 0) + if (validate(&dummyptr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(dummyksi.idname)) { BKE_reportf(reports, @@ -373,41 +377,49 @@ static void rna_ksPath_id_type_set(PointerRNA *ptr, int value) /* set the driver type, then clear the id-block if the type is invalid */ data->idtype = value; - if ((data->id) && (GS(data->id->name) != data->idtype)) + if ((data->id) && (GS(data->id->name) != data->idtype)) { data->id = NULL; + } } static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value) { KS_Path *ksp = (KS_Path *)ptr->data; - if (ksp->rna_path) + if (ksp->rna_path) { strcpy(value, ksp->rna_path); - else + } + else { value[0] = '\0'; + } } static int rna_ksPath_RnaPath_length(PointerRNA *ptr) { KS_Path *ksp = (KS_Path *)ptr->data; - if (ksp->rna_path) + if (ksp->rna_path) { return strlen(ksp->rna_path); - else + } + else { return 0; + } } static void rna_ksPath_RnaPath_set(PointerRNA *ptr, const char *value) { KS_Path *ksp = (KS_Path *)ptr->data; - if (ksp->rna_path) + if (ksp->rna_path) { MEM_freeN(ksp->rna_path); + } - if (value[0]) + if (value[0]) { ksp->rna_path = BLI_strdup(value); - else + } + else { ksp->rna_path = NULL; + } } /* ****************************** */ @@ -499,8 +511,9 @@ static PointerRNA rna_KeyingSet_typeinfo_get(PointerRNA *ptr) KeyingSetInfo *ksi = NULL; /* keying set info is only for builtin Keying Sets */ - if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) + if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) { ksi = ANIM_keyingset_info_find_name(ks->typeinfo); + } return rna_pointer_inherit_refine(ptr, &RNA_KeyingSetInfo, ksi); } 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) diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 95c5a31db8e..8f30a7e0a98 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -132,8 +132,9 @@ static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY); } - else + else { DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET); + } WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); } @@ -146,8 +147,9 @@ static void rna_Boids_reset_deps(Main *bmain, Scene *UNUSED(scene), PointerRNA * DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY); } - else + else { DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET); + } DEG_relations_tag_update(bmain); @@ -192,8 +194,9 @@ static PointerRNA rna_BoidState_active_boid_rule_get(PointerRNA *ptr) BoidRule *rule = (BoidRule *)state->rules.first; for (; rule; rule = rule->next) { - if (rule->flag & BOIDRULE_CURRENT) + if (rule->flag & BOIDRULE_CURRENT) { return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, rule); + } } return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, NULL); } @@ -212,8 +215,9 @@ static int rna_BoidState_active_boid_rule_index_get(PointerRNA *ptr) int i = 0; for (; rule; rule = rule->next, i++) { - if (rule->flag & BOIDRULE_CURRENT) + if (rule->flag & BOIDRULE_CURRENT) { return i; + } } return 0; } @@ -225,10 +229,12 @@ static void rna_BoidState_active_boid_rule_index_set(struct PointerRNA *ptr, int int i = 0; for (; rule; rule = rule->next, i++) { - if (i == value) + if (i == value) { rule->flag |= BOIDRULE_CURRENT; - else + } + else { rule->flag &= ~BOIDRULE_CURRENT; + } } } @@ -259,8 +265,9 @@ static PointerRNA rna_BoidSettings_active_boid_state_get(PointerRNA *ptr) BoidState *state = (BoidState *)boids->states.first; for (; state; state = state->next) { - if (state->flag & BOIDSTATE_CURRENT) + if (state->flag & BOIDSTATE_CURRENT) { return rna_pointer_inherit_refine(ptr, &RNA_BoidState, state); + } } return rna_pointer_inherit_refine(ptr, &RNA_BoidState, NULL); } @@ -279,8 +286,9 @@ static int rna_BoidSettings_active_boid_state_index_get(PointerRNA *ptr) int i = 0; for (; state; state = state->next, i++) { - if (state->flag & BOIDSTATE_CURRENT) + if (state->flag & BOIDSTATE_CURRENT) { return i; + } } return 0; } @@ -292,10 +300,12 @@ static void rna_BoidSettings_active_boid_state_index_set(struct PointerRNA *ptr, int i = 0; for (; state; state = state->next, i++) { - if (i == value) + if (i == value) { state->flag |= BOIDSTATE_CURRENT; - else + } + else { state->flag &= ~BOIDSTATE_CURRENT; + } } } diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 40c3a75df85..a049b7573c4 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -461,8 +461,9 @@ static void rna_Brush_reset_icon(Brush *br) { ID *id = &br->id; - if (br->flag & BRUSH_CUSTOM_ICON) + if (br->flag & BRUSH_CUSTOM_ICON) { return; + } if (id->icon_id >= BIFICONID_LAST) { BKE_icon_id_delete(id); @@ -568,13 +569,16 @@ static void rna_Brush_use_gradient_set(PointerRNA *ptr, bool value) { Brush *br = (Brush *)ptr->data; - if (value) + if (value) { br->flag |= BRUSH_USE_GRADIENT; - else + } + else { br->flag &= ~BRUSH_USE_GRADIENT; + } - if ((br->flag & BRUSH_USE_GRADIENT) && br->gradient == NULL) + if ((br->flag & BRUSH_USE_GRADIENT) && br->gradient == NULL) { br->gradient = BKE_colorband_add(true); + } } static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value) diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index f5cb29b5e69..c93833ef493 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -76,8 +76,9 @@ static void rna_ClothSettings_bending_set(struct PointerRNA *ptr, float value) settings->bending = value; /* check for max clipping */ - if (value > settings->max_bend) + if (value > settings->max_bend) { settings->max_bend = value; + } } static void rna_ClothSettings_max_bend_set(struct PointerRNA *ptr, float value) @@ -85,8 +86,9 @@ static void rna_ClothSettings_max_bend_set(struct PointerRNA *ptr, float value) ClothSimSettings *settings = (ClothSimSettings *)ptr->data; /* check for clipping */ - if (value < settings->bending) + if (value < settings->bending) { value = settings->bending; + } settings->max_bend = value; } @@ -98,8 +100,9 @@ static void rna_ClothSettings_tension_set(struct PointerRNA *ptr, float value) settings->tension = value; /* check for max clipping */ - if (value > settings->max_tension) + if (value > settings->max_tension) { settings->max_tension = value; + } } static void rna_ClothSettings_max_tension_set(struct PointerRNA *ptr, float value) @@ -107,8 +110,9 @@ static void rna_ClothSettings_max_tension_set(struct PointerRNA *ptr, float valu ClothSimSettings *settings = (ClothSimSettings *)ptr->data; /* check for clipping */ - if (value < settings->tension) + if (value < settings->tension) { value = settings->tension; + } settings->max_tension = value; } @@ -120,8 +124,9 @@ static void rna_ClothSettings_compression_set(struct PointerRNA *ptr, float valu settings->compression = value; /* check for max clipping */ - if (value > settings->max_compression) + if (value > settings->max_compression) { settings->max_compression = value; + } } static void rna_ClothSettings_max_compression_set(struct PointerRNA *ptr, float value) @@ -129,8 +134,9 @@ static void rna_ClothSettings_max_compression_set(struct PointerRNA *ptr, float ClothSimSettings *settings = (ClothSimSettings *)ptr->data; /* check for clipping */ - if (value < settings->compression) + if (value < settings->compression) { value = settings->compression; + } settings->max_compression = value; } @@ -142,8 +148,9 @@ static void rna_ClothSettings_shear_set(struct PointerRNA *ptr, float value) settings->shear = value; /* check for max clipping */ - if (value > settings->max_shear) + if (value > settings->max_shear) { settings->max_shear = value; + } } static void rna_ClothSettings_max_shear_set(struct PointerRNA *ptr, float value) @@ -151,8 +158,9 @@ static void rna_ClothSettings_max_shear_set(struct PointerRNA *ptr, float value) ClothSimSettings *settings = (ClothSimSettings *)ptr->data; /* check for clipping */ - if (value < settings->shear) + if (value < settings->shear) { value = settings->shear; + } settings->max_shear = value; } @@ -162,8 +170,9 @@ static void rna_ClothSettings_max_sewing_set(struct PointerRNA *ptr, float value ClothSimSettings *settings = (ClothSimSettings *)ptr->data; /* check for clipping */ - if (value < 0.0f) + if (value < 0.0f) { value = 0.0f; + } settings->max_sewing = value; } @@ -175,8 +184,9 @@ static void rna_ClothSettings_shrink_min_set(struct PointerRNA *ptr, float value settings->shrink_min = value; /* check for max clipping */ - if (value > settings->shrink_max) + if (value > settings->shrink_max) { settings->shrink_max = value; + } } static void rna_ClothSettings_shrink_max_set(struct PointerRNA *ptr, float value) @@ -184,8 +194,9 @@ static void rna_ClothSettings_shrink_max_set(struct PointerRNA *ptr, float value ClothSimSettings *settings = (ClothSimSettings *)ptr->data; /* check for clipping */ - if (value < settings->shrink_min) + if (value < settings->shrink_min) { value = settings->shrink_min; + } settings->shrink_max = value; } diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 30ab591d3c9..5f3fcaa48d7 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -66,9 +66,11 @@ static int rna_CurveMapping_curves_length(PointerRNA *ptr) CurveMapping *cumap = (CurveMapping *)ptr->data; int len; - for (len = 0; len < CM_TOT; len++) - if (!cumap->cm[len].curve) + for (len = 0; len < CM_TOT; len++) { + if (!cumap->cm[len].curve) { break; + } + } return len; } @@ -85,10 +87,12 @@ static void rna_CurveMapping_clip_set(PointerRNA *ptr, bool value) { CurveMapping *cumap = (CurveMapping *)ptr->data; - if (value) + if (value) { cumap->flag |= CUMA_DO_CLIP; - else + } + else { cumap->flag &= ~CUMA_DO_CLIP; + } curvemapping_changed(cumap, false); } @@ -340,8 +344,9 @@ static CBData *rna_ColorRampElement_new(struct ColorBand *coba, { CBData *element = BKE_colorband_element_add(coba, position); - if (element == NULL) + if (element == NULL) { BKE_reportf(reports, RPT_ERROR, "Unable to add element to colorband (limit %d)", MAXCOLORBAND); + } return element; } @@ -414,8 +419,9 @@ static void rna_ColorManagedDisplaySettings_display_device_update(Main *bmain, { ID *id = ptr->id.data; - if (!id) + if (!id) { return; + } if (GS(id->name) == ID_SCE) { Scene *scene = (Scene *)id; @@ -653,8 +659,9 @@ static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene) { ID *id = ptr->id.data; - if (!id) + if (!id) { return; + } if (GS(id->name) == ID_SCE) { DEG_id_tag_update(id, 0); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index ac319a545ac..d0dcbe1761c 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -381,8 +381,9 @@ static void rna_Constraint_name_set(PointerRNA *ptr, const char *value) ListBase *list = get_constraint_lb(ob, con, NULL); /* if we have the list, check for unique name, otherwise give up */ - if (list) + if (list) { BKE_constraint_unique_name(con, list); + } } /* fix all the animation data which may link to this */ @@ -394,11 +395,12 @@ static char *rna_Constraint_do_compute_path(Object *ob, bConstraint *con) bPoseChannel *pchan; ListBase *lb = get_constraint_lb(ob, con, &pchan); - if (lb == NULL) + if (lb == NULL) { printf("%s: internal error, constraint '%s' not found in object '%s'\n", __func__, con->name, ob->id.name); + } if (pchan) { char name_esc_pchan[sizeof(pchan->name) * 2]; @@ -491,8 +493,9 @@ static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRN { Object *ob = ptr->id.data; - if (ob->pose) + if (ob->pose) { ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK); + } rna_Constraint_update(bmain, scene, ptr); } @@ -523,10 +526,13 @@ static const EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED Object *ob = (Object *)ptr->id.data; bConstraint *con = (bConstraint *)ptr->data; - if (BLI_findindex(&ob->constraints, con) == -1) + if (BLI_findindex(&ob->constraints, con) == -1) { return owner_space_pchan_items; - else /* object */ + } + else { + /* object */ return space_object_items; + } } static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), @@ -542,15 +548,19 @@ static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSE if (cti && cti->get_constraint_targets) { cti->get_constraint_targets(con, &targets); - for (ct = targets.first; ct; ct = ct->next) - if (ct->tar && ct->tar->type == OB_ARMATURE) + for (ct = targets.first; ct; ct = ct->next) { + if (ct->tar && ct->tar->type == OB_ARMATURE) { break; + } + } - if (cti->flush_constraint_targets) + if (cti->flush_constraint_targets) { cti->flush_constraint_targets(con, &targets, 1); + } - if (ct) + if (ct) { return target_space_pchan_items; + } } return space_object_items; @@ -616,10 +626,12 @@ static int rna_SplineIKConstraint_joint_bindings_get_length(PointerRNA *ptr, bConstraint *con = (bConstraint *)ptr->data; bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data; - if (ikData) + if (ikData) { length[0] = ikData->numpoints; - else + } + else { length[0] = 256; /* for raw_access, untested */ + } return length[0]; } diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 89200240b08..a01048b79eb 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -208,10 +208,12 @@ static Nurb *curve_nurb_from_point(Curve *cu, const void *point, int *nu_index, } if (pt_index) { - if (nu->type == CU_BEZIER) + if (nu->type == CU_BEZIER) { *pt_index = (int)((BezTriple *)point - nu->bezt); - else + } + else { *pt_index = (int)((BPoint *)point - nu->bp); + } } } @@ -223,12 +225,15 @@ static StructRNA *rna_Curve_refine(PointerRNA *ptr) Curve *cu = (Curve *)ptr->data; short obtype = BKE_curve_type_get(cu); - if (obtype == OB_FONT) + if (obtype == OB_FONT) { return &RNA_TextCurve; - else if (obtype == OB_SURF) + } + else if (obtype == OB_SURF) { return &RNA_SurfaceCurve; - else + } + else { return &RNA_Curve; + } } static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values) @@ -271,8 +276,9 @@ static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), Po { Curve *cu = (Curve *)ptr->data; - if (cu->texflag & CU_AUTOSPACE) + if (cu->texflag & CU_AUTOSPACE) { BKE_curve_texspace_calc(cu); + } } static int rna_Curve_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info)) @@ -285,8 +291,9 @@ static void rna_Curve_texspace_loc_get(PointerRNA *ptr, float *values) { Curve *cu = (Curve *)ptr->data; - if (!cu->bb) + if (!cu->bb) { BKE_curve_texspace_calc(cu); + } copy_v3_v3(values, cu->loc); } @@ -302,8 +309,9 @@ static void rna_Curve_texspace_size_get(PointerRNA *ptr, float *values) { Curve *cu = (Curve *)ptr->data; - if (!cu->bb) + if (!cu->bb) { BKE_curve_texspace_calc(cu); + } copy_v3_v3(values, cu->size); } @@ -347,10 +355,12 @@ static void rna_Curve_active_textbox_index_range( static void rna_Curve_dimension_set(PointerRNA *ptr, int value) { Curve *cu = (Curve *)ptr->id.data; - if (value == CU_3D) + if (value == CU_3D) { cu->flag |= CU_3D; - else + } + else { cu->flag &= ~CU_3D; + } BKE_curve_curve_dimension_update(cu); } @@ -370,8 +380,9 @@ static const EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), static int rna_Nurb_length(PointerRNA *ptr) { Nurb *nu = (Nurb *)ptr->data; - if (nu->type == CU_BEZIER) + if (nu->type == CU_BEZIER) { return 0; + } return nu->pntsv > 0 ? nu->pntsu * nu->pntsv : nu->pntsu; } @@ -421,8 +432,9 @@ static void rna_Curve_update_points(Main *bmain, Scene *scene, PointerRNA *ptr) Curve *cu = (Curve *)ptr->id.data; Nurb *nu = curve_nurb_from_point(cu, ptr->data, NULL, NULL); - if (nu) + if (nu) { BKE_nurb_handles_calc(nu); + } rna_Curve_update_data(bmain, scene, ptr); } @@ -432,8 +444,9 @@ static PointerRNA rna_Curve_bevelObject_get(PointerRNA *ptr) Curve *cu = (Curve *)ptr->id.data; Object *ob = cu->bevobj; - if (ob) + if (ob) { return rna_pointer_inherit_refine(ptr, &RNA_Object, ob); + } return rna_pointer_inherit_refine(ptr, NULL, NULL); } @@ -477,8 +490,9 @@ static PointerRNA rna_Curve_taperObject_get(PointerRNA *ptr) Curve *cu = (Curve *)ptr->id.data; Object *ob = cu->taperobj; - if (ob) + if (ob) { return rna_pointer_inherit_refine(ptr, &RNA_Object, ob); + } return rna_pointer_inherit_refine(ptr, NULL, NULL); } @@ -568,10 +582,12 @@ static void rna_Curve_body_set(PointerRNA *ptr, const char *value) cu->len = len_bytes; cu->pos = len_chars; - if (cu->str) + if (cu->str) { MEM_freeN(cu->str); - if (cu->strinfo) + } + if (cu->strinfo) { MEM_freeN(cu->strinfo); + } cu->str = MEM_mallocN(len_bytes + sizeof(wchar_t), "str"); cu->strinfo = MEM_callocN((len_chars + 4) * sizeof(CharInfo), "strinfo"); @@ -728,8 +744,9 @@ static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr) * should be changed to be allowed outside of editmode. */ nu = BLI_findlink(nurbs, cu->actnu); - if (nu) + if (nu) { return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu); + } return rna_pointer_inherit_refine(ptr, NULL, NULL); } @@ -743,10 +760,12 @@ static void rna_Curve_active_spline_set(PointerRNA *ptr, ListBase *nubase = BKE_curve_nurbs_get(cu); /* -1 is ok for an unset index */ - if (nu == NULL) + if (nu == NULL) { cu->actnu = -1; - else + } + else { cu->actnu = BLI_findindex(nubase, nu); + } } static char *rna_Curve_spline_path(PointerRNA *ptr) @@ -756,10 +775,12 @@ static char *rna_Curve_spline_path(PointerRNA *ptr) Nurb *nu = ptr->data; int index = BLI_findindex(nubase, nu); - if (index >= 0) + if (index >= 0) { return BLI_sprintfN("splines[%d]", index); - else + } + else { return BLI_strdup(""); + } } /* use for both bezier and nurbs */ @@ -791,10 +812,12 @@ static char *rna_TextBox_path(PointerRNA *ptr) TextBox *tb = ptr->data; int index = (int)(tb - cu->tb); - if (index >= 0 && index < cu->totbox) + if (index >= 0 && index < cu->totbox) { return BLI_sprintfN("text_boxes[%d]", index); - else + } + else { return BLI_strdup(""); + } } static void rna_Curve_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 92e63b1c778..792c4450b9c 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -161,8 +161,9 @@ static PointerRNA rna_PaintSurface_active_get(PointerRNA *ptr) int id = 0; for (; surface; surface = surface->next) { - if (id == canvas->active_sur) + if (id == canvas->active_sur) { return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, surface); + } id++; } return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, NULL); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 741b73f4250..f7f18eeb005 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -284,28 +284,33 @@ static void rna_DriverTarget_id_type_set(PointerRNA *ptr, int value) } /* clear the id-block if the type is invalid */ - if ((data->id) && (GS(data->id->name) != data->idtype)) + if ((data->id) && (GS(data->id->name) != data->idtype)) { data->id = NULL; + } } static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value) { DriverTarget *dtar = (DriverTarget *)ptr->data; - if (dtar->rna_path) + if (dtar->rna_path) { strcpy(value, dtar->rna_path); - else + } + else { value[0] = '\0'; + } } static int rna_DriverTarget_RnaPath_length(PointerRNA *ptr) { DriverTarget *dtar = (DriverTarget *)ptr->data; - if (dtar->rna_path) + if (dtar->rna_path) { return strlen(dtar->rna_path); - else + } + else { return 0; + } } static void rna_DriverTarget_RnaPath_set(PointerRNA *ptr, const char *value) @@ -314,13 +319,16 @@ static void rna_DriverTarget_RnaPath_set(PointerRNA *ptr, const char *value) /* XXX in this case we need to be very careful, * as this will require some new dependencies to be added! */ - if (dtar->rna_path) + if (dtar->rna_path) { MEM_freeN(dtar->rna_path); + } - if (value[0]) + if (value[0]) { dtar->rna_path = BLI_strdup(value); - else + } + else { dtar->rna_path = NULL; + } } static void rna_DriverVariable_type_set(PointerRNA *ptr, int value) @@ -417,35 +425,41 @@ static void rna_FCurve_RnaPath_get(PointerRNA *ptr, char *value) { FCurve *fcu = (FCurve *)ptr->data; - if (fcu->rna_path) + if (fcu->rna_path) { strcpy(value, fcu->rna_path); - else + } + else { value[0] = '\0'; + } } static int rna_FCurve_RnaPath_length(PointerRNA *ptr) { FCurve *fcu = (FCurve *)ptr->data; - if (fcu->rna_path) + if (fcu->rna_path) { return strlen(fcu->rna_path); - else + } + else { return 0; + } } static void rna_FCurve_RnaPath_set(PointerRNA *ptr, const char *value) { FCurve *fcu = (FCurve *)ptr->data; - if (fcu->rna_path) + if (fcu->rna_path) { MEM_freeN(fcu->rna_path); + } if (value[0]) { fcu->rna_path = BLI_strdup(value); fcu->flag &= ~FCURVE_DISABLED; } - else + else { fcu->rna_path = NULL; + } } static void rna_FCurve_group_set(PointerRNA *ptr, @@ -702,8 +716,9 @@ static void rna_FModifier_verify_data_update(Main *bmain, Scene *scene, PointerR const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); /* call the verify callback on the modifier if applicable */ - if (fmi && fmi->verify_data) + if (fmi && fmi->verify_data) { fmi->verify_data(fcm); + } rna_FModifier_update(bmain, scene, ptr); } @@ -729,10 +744,12 @@ static int rna_FModifierGenerator_coefficients_get_length(PointerRNA *ptr, FModifier *fcm = (FModifier *)ptr->data; FMod_Generator *gen = fcm->data; - if (gen) + if (gen) { length[0] = gen->arraysize; - else + } + else { length[0] = 100; /* for raw_access, untested */ + } return length[0]; } diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c index 873b3cfa502..4cc38d3616c 100644 --- a/source/blender/makesrna/intern/rna_fcurve_api.c +++ b/source/blender/makesrna/intern/rna_fcurve_api.c @@ -86,8 +86,9 @@ static void rna_FCurve_convert_to_keyframes(FCurve *fcu, ReportList *reports, in fcu->totvert = tot_kf; /* Get first sample point to 'copy' as keyframe. */ - for (; tot_sp && (fpt->vec[0] < (float)start); fpt++, tot_sp--) - ; + for (; tot_sp && (fpt->vec[0] < (float)start); fpt++, tot_sp--) { + /* pass */ + } /* Add heading dummy flat points if needed. */ for (; tot_kf && (fpt->vec[0] > (float)start); start++, bezt++, tot_kf--) { diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 49b0a344734..45361702384 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -127,9 +127,11 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA /* remove fluidsim particle system */ if (fluidmd->fss->type & OB_FLUIDSIM_PARTICLE) { - for (psys = ob->particlesystem.first; psys; psys = psys->next) - if (psys->part->type == PART_FLUID) + for (psys = ob->particlesystem.first; psys; psys = psys->next) { + if (psys->part->type == PART_FLUID) { break; + } + } if (ob->type == OB_MESH && !psys) { /* add particle system */ diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 276b685e93f..f2560527f39 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -207,10 +207,12 @@ static void UNUSED_FUNCTION(rna_GPencil_onion_skinning_update)(Main *bmain, } } - if (enabled) + if (enabled) { gpd->flag |= GP_DATA_SHOW_ONIONSKINS; - else + } + else { gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS; + } /* Now do standard updates... */ rna_GPencil_update(bmain, scene, ptr); @@ -245,10 +247,12 @@ static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr, const char ** bGPDlayer *gpl = (bGPDlayer *)ptr->data; /* surely there must be other criteria too... */ - if (gpl->flag & GP_LAYER_LOCKED) + if (gpl->flag & GP_LAYER_LOCKED) { return 0; - else + } + else { return PROP_EDITABLE; + } } /* set parent */ @@ -503,10 +507,12 @@ static bGPDstroke *rna_GPencil_stroke_point_find_stroke(const bGPdata *gpd, return NULL; } - if (r_gpl) + if (r_gpl) { *r_gpl = NULL; - if (r_gpf) + } + if (r_gpf) { *r_gpf = NULL; + } /* there's no faster alternative than just looping over everything... */ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { @@ -514,10 +520,12 @@ static bGPDstroke *rna_GPencil_stroke_point_find_stroke(const bGPdata *gpd, for (gps = gpl->actframe->strokes.first; gps; gps = gps->next) { if ((pt >= gps->points) && (pt < &gps->points[gps->totpoints])) { /* found it */ - if (r_gpl) + if (r_gpl) { *r_gpl = gpl; - if (r_gpf) + } + if (r_gpf) { *r_gpf = gpl->actframe; + } return gps; } @@ -543,10 +551,12 @@ static void rna_GPencil_stroke_point_select_set(PointerRNA *ptr, const bool valu gps = rna_GPencil_stroke_point_find_stroke(gpd, pt, NULL, NULL); if (gps) { /* Set the new selection state for the point */ - if (value) + if (value) { pt->flag |= GP_SPOINT_SELECT; - else + } + else { pt->flag &= ~GP_SPOINT_SELECT; + } /* Check if the stroke should be selected or not... */ BKE_gpencil_stroke_sync_selection(gps); @@ -682,17 +692,21 @@ static void rna_GPencil_stroke_select_set(PointerRNA *ptr, const bool value) int i; /* set new value */ - if (value) + if (value) { gps->flag |= GP_STROKE_SELECT; - else + } + else { gps->flag &= ~GP_STROKE_SELECT; + } /* ensure that the stroke's points are selected in the same way */ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { - if (value) + if (value) { pt->flag |= GP_SPOINT_SELECT; - else + } + else { pt->flag &= ~GP_SPOINT_SELECT; + } } } @@ -817,8 +831,9 @@ static void rna_GpencilVertex_groups_begin(CollectionPropertyIterator *iter, Poi rna_iterator_array_begin( iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL); } - else + else { rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL); + } } static char *rna_GreasePencilGrid_path(PointerRNA *UNUSED(ptr)) diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index d5cefaefbb1..2d8014b60d5 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -314,12 +314,15 @@ static int rna_Image_depth_get(PointerRNA *ptr) ibuf = BKE_image_acquire_ibuf(im, NULL, &lock); - if (!ibuf) + if (!ibuf) { planes = 0; - else if (ibuf->rect_float) + } + else if (ibuf->rect_float) { planes = ibuf->planes * 4; - else + } + else { planes = ibuf->planes; + } BKE_image_release_ibuf(im, ibuf, lock); @@ -355,10 +358,12 @@ static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); - if (ibuf) + if (ibuf) { length[0] = ibuf->x * ibuf->y * ibuf->channels; - else + } + else { length[0] = 0; + } BKE_image_release_ibuf(ima, ibuf, lock); @@ -381,8 +386,9 @@ static void rna_Image_pixels_get(PointerRNA *ptr, float *values) memcpy(values, ibuf->rect_float, sizeof(float) * size); } else { - for (i = 0; i < size; i++) + for (i = 0; i < size; i++) { values[i] = ((unsigned char *)ibuf->rect)[i] * (1.0f / 255.0f); + } } } @@ -405,8 +411,9 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values) memcpy(ibuf->rect_float, values, sizeof(float) * size); } else { - for (i = 0; i < size; i++) + for (i = 0; i < size; i++) { ((unsigned char *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]); + } } ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID | IB_MIPMAP_INVALID; @@ -428,8 +435,9 @@ static int rna_Image_channels_get(PointerRNA *ptr) int channels = 0; ibuf = BKE_image_acquire_ibuf(im, NULL, &lock); - if (ibuf) + if (ibuf) { channels = ibuf->channels; + } BKE_image_release_ibuf(im, ibuf, lock); @@ -444,8 +452,9 @@ static bool rna_Image_is_float_get(PointerRNA *ptr) bool is_float = false; ibuf = BKE_image_acquire_ibuf(im, NULL, &lock); - if (ibuf) + if (ibuf) { is_float = ibuf->rect_float != NULL; + } BKE_image_release_ibuf(im, ibuf, lock); @@ -490,8 +499,9 @@ static void rna_render_slots_active_set(PointerRNA *ptr, if (value.id.data == image) { RenderSlot *slot = (RenderSlot *)value.data; int index = BLI_findindex(&image->renderslots, slot); - if (index != -1) + if (index != -1) { image->render_slot = index; + } } } diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 553dbeeb97b..a26b4c6b6e4 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -96,8 +96,9 @@ static void rna_Image_save_render( BKE_reportf(reports, RPT_ERROR, "Could not write image: %s, '%s'", strerror(errno), path); } - if (write_ibuf != ibuf) + if (write_ibuf != ibuf) { IMB_freeImBuf(write_ibuf); + } } BKE_image_release_ibuf(image, ibuf, lock); @@ -123,8 +124,9 @@ static void rna_Image_save(Image *image, Main *bmain, bContext *C, ReportList *r if (IMB_saveiff(ibuf, filename, ibuf->flags)) { image->type = IMA_TYPE_IMAGE; - if (image->source == IMA_SRC_GENERATED) + if (image->source == IMA_SRC_GENERATED) { image->source = IMA_SRC_FILE; + } IMB_colormanagement_colorspace_from_ibuf_ftype(&image->colorspace_settings, ibuf); @@ -196,8 +198,9 @@ static void rna_Image_update(Image *image, ReportList *reports) return; } - if (ibuf->rect) + if (ibuf->rect) { IMB_rect_from_float(ibuf); + } ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID; @@ -233,8 +236,9 @@ static int rna_Image_gl_touch(Image *image, ReportList *reports, int frame) BKE_image_tag_time(image); - if (image->gputexture[TEXTARGET_TEXTURE_2D] == NULL) + if (image->gputexture[TEXTARGET_TEXTURE_2D] == NULL) { error = rna_Image_gl_load(image, reports, frame); + } return error; } diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index c5997f27dc2..8ab2127d898 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -288,8 +288,9 @@ PointerRNA rna_object_shapekey_index_get(ID *id, int value) KeyBlock *kb = NULL; PointerRNA ptr; - if (key && value < key->totkey) + if (key && value < key->totkey) { kb = BLI_findlink(&key->block, value); + } RNA_pointer_create(id, &RNA_ShapeKey, kb, &ptr); @@ -302,8 +303,9 @@ int rna_object_shapekey_index_set(ID *id, PointerRNA value, int current) if (key) { int a = BLI_findindex(&key->block, value.data); - if (a != -1) + if (a != -1) { return a; + } } return current; @@ -675,10 +677,12 @@ static char *rna_ShapeKey_path(PointerRNA *ptr) BLI_strescape(name_esc, kb->name, sizeof(name_esc)); - if ((id) && (GS(id->name) != ID_KE)) + if ((id) && (GS(id->name) != ID_KE)) { return BLI_sprintfN("shape_keys.key_blocks[\"%s\"]", name_esc); - else + } + else { return BLI_sprintfN("key_blocks[\"%s\"]", name_esc); + } } static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) @@ -699,8 +703,9 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point) KeyBlock *kb; /* sanity checks */ - if (ELEM(NULL, key, point)) + 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 @@ -771,13 +776,16 @@ static char *rna_ShapeKeyPoint_path(PointerRNA *ptr) BLI_strescape(name_esc_kb, kb->name, sizeof(name_esc_kb)); - if (GS(id->name) == ID_KE) + if (GS(id->name) == ID_KE) { return BLI_sprintfN("key_blocks[\"%s\"].data[%d]", name_esc_kb, index); - else + } + else { return BLI_sprintfN("shape_keys.key_blocks[\"%s\"].data[%d]", name_esc_kb, index); + } } - else + else { return NULL; /* XXX: there's really no way to resolve this... */ + } } #else diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index fade937b321..5a8223af28a 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -72,8 +72,9 @@ static void rna_LatticePoint_groups_begin(CollectionPropertyIterator *iter, Poin rna_iterator_array_begin( iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL); } - else + else { rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL); + } } static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) @@ -81,12 +82,15 @@ static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRN Lattice *lt = (Lattice *)ptr->data; int tot = lt->pntsu * lt->pntsv * lt->pntsw; - if (lt->editlatt && lt->editlatt->latt->def) + if (lt->editlatt && lt->editlatt->latt->def) { rna_iterator_array_begin(iter, (void *)lt->editlatt->latt->def, sizeof(BPoint), tot, 0, NULL); - else if (lt->def) + } + else if (lt->def) { rna_iterator_array_begin(iter, (void *)lt->def, sizeof(BPoint), tot, 0, NULL); - else + } + else { rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL); + } } static void rna_Lattice_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -136,8 +140,9 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr) for (ob = bmain->objects.first; ob; ob = ob->id.next) { if (ob->data == lt) { BKE_lattice_resize(lt, newu, newv, neww, ob); - if (lt->editlatt) + if (lt->editlatt) { BKE_lattice_resize(lt->editlatt->latt, newu, newv, neww, ob); + } break; } } @@ -145,8 +150,9 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr) /* otherwise without, means old points are not repositioned */ if (!ob) { BKE_lattice_resize(lt, newu, newv, neww, NULL); - if (lt->editlatt) + if (lt->editlatt) { BKE_lattice_resize(lt->editlatt->latt, newu, newv, neww, NULL); + } } rna_Lattice_update_data(bmain, scene, ptr); @@ -156,18 +162,22 @@ static void rna_Lattice_use_outside_set(PointerRNA *ptr, bool value) { Lattice *lt = ptr->data; - if (value) + if (value) { lt->flag |= LT_OUTSIDE; - else + } + else { lt->flag &= ~LT_OUTSIDE; + } outside_lattice(lt); if (lt->editlatt) { - if (value) + if (value) { lt->editlatt->latt->flag |= LT_OUTSIDE; - else + } + else { lt->editlatt->latt->flag &= ~LT_OUTSIDE; + } outside_lattice(lt->editlatt->latt); } @@ -218,10 +228,12 @@ static char *rna_LatticePoint_path(PointerRNA *ptr) void *point = ptr->data; BPoint *points = NULL; - if (lt->editlatt && lt->editlatt->latt->def) + if (lt->editlatt && lt->editlatt->latt->def) { points = lt->editlatt->latt->def; - else + } + else { points = lt->def; + } if (points && point) { int tot = lt->pntsu * lt->pntsv * lt->pntsw; diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index a8682632e0c..1a3b7ee7f63 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -91,10 +91,12 @@ static void rna_LayerObjects_active_object_set(PointerRNA *ptr, struct ReportList *UNUSED(reports)) { ViewLayer *view_layer = (ViewLayer *)ptr->data; - if (value.data) + if (value.data) { view_layer->basact = BKE_view_layer_base_find(view_layer, (Object *)value.data); - else + } + else { view_layer->basact = NULL; + } } static char *rna_ViewLayer_path(PointerRNA *ptr) @@ -121,8 +123,9 @@ static IDProperty *rna_ViewLayer_idprops(PointerRNA *ptr, bool create) static void rna_ViewLayer_update_render_passes(ID *id) { Scene *scene = (Scene *)id; - if (scene->nodetree) + if (scene->nodetree) { ntreeCompositUpdateRLayers(scene->nodetree); + } } static PointerRNA rna_ViewLayer_objects_get(CollectionPropertyIterator *iter) diff --git a/source/blender/makesrna/intern/rna_light.c b/source/blender/makesrna/intern/rna_light.c index 67a9e481041..79ba5970007 100644 --- a/source/blender/makesrna/intern/rna_light.c +++ b/source/blender/makesrna/intern/rna_light.c @@ -95,8 +95,9 @@ static void rna_Light_use_nodes_update(bContext *C, PointerRNA *ptr) { Light *la = (Light *)ptr->data; - if (la->use_nodes && la->nodetree == NULL) + if (la->use_nodes && la->nodetree == NULL) { ED_node_shader_default(C, &la->id); + } rna_Light_update(CTX_data_main(C), CTX_data_scene(C), ptr); } diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c index 1ef5fb17ed8..936a5e6a53d 100644 --- a/source/blender/makesrna/intern/rna_linestyle.c +++ b/source/blender/makesrna/intern/rna_linestyle.c @@ -377,8 +377,9 @@ static void rna_LineStyle_use_nodes_update(bContext *C, PointerRNA *ptr) { FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->data; - if (linestyle->use_nodes && linestyle->nodetree == NULL) + if (linestyle->use_nodes && linestyle->nodetree == NULL) { BKE_linestyle_default_shader(C, linestyle); + } rna_LineStyle_update(CTX_data_main(C), CTX_data_scene(C), ptr); } diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 63834c9280c..41de02a738f 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -39,18 +39,21 @@ static bool rna_Main_use_autopack_get(PointerRNA *UNUSED(ptr)) { - if (G.fileflags & G_FILE_AUTOPACK) + if (G.fileflags & G_FILE_AUTOPACK) { return 1; + } return 0; } static void rna_Main_use_autopack_set(PointerRNA *UNUSED(ptr), bool value) { - if (value) + if (value) { G.fileflags |= G_FILE_AUTOPACK; - else + } + else { G.fileflags &= ~G_FILE_AUTOPACK; + } } static bool rna_Main_is_saved_get(PointerRNA *UNUSED(ptr)) diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index aa8de7f23db..1a5e5fa9634 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -252,8 +252,9 @@ static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char break; default: { const char *idname; - if (RNA_enum_id_from_value(rna_enum_id_type_items, GS(data->name), &idname) == 0) + if (RNA_enum_id_from_value(rna_enum_id_type_items, GS(data->name), &idname) == 0) { idname = "UNKNOWN"; + } BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for an object", idname); return NULL; @@ -453,14 +454,15 @@ static VFont *rna_Main_fonts_load(Main *bmain, font = BKE_vfont_load(bmain, filepath); } - if (!font) + if (!font) { BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath, errno ? strerror(errno) : TIP_("unsupported font format")); - id_us_min((ID *)font); + id_us_min((ID *)font); + } return font; } @@ -553,13 +555,13 @@ static Text *rna_Main_texts_load(Main *bmain, errno = 0; txt = BKE_text_load_ex(bmain, filepath, BKE_main_blendfile_path(bmain), is_internal); - if (!txt) + if (!txt) { BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath, errno ? strerror(errno) : TIP_("unable to load text")); - + } return txt; } diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index 7334c5baec0..abbbd04143c 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -140,8 +140,9 @@ static void rna_MaskParent_id_type_set(PointerRNA *ptr, int value) mpar->id_type = value; /* clear the id-block if the type is invalid */ - if ((mpar->id) && (GS(mpar->id->name) != mpar->id_type)) + if ((mpar->id) && (GS(mpar->id->name) != mpar->id_type)) { mpar->id = NULL; + } } static void rna_Mask_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) @@ -238,10 +239,12 @@ static void rna_MaskLayer_active_spline_set(PointerRNA *ptr, MaskSpline *spline = (MaskSpline *)value.data; int index = BLI_findindex(&masklay->splines, spline); - if (index != -1) + if (index != -1) { masklay->act_spline = spline; - else + } + else { masklay->act_spline = NULL; + } } static PointerRNA rna_MaskLayer_active_spline_point_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index df48b679235..3ff2e884d92 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -101,8 +101,9 @@ static void rna_Material_update_previews(Main *UNUSED(bmain), { Material *ma = ptr->id.data; - if (ma->nodetree) + if (ma->nodetree) { BKE_node_preview_clear_tree(ma->nodetree); + } WM_main_add_notifier(NC_MATERIAL | ND_SHADING_PREVIEW, ma); } @@ -156,8 +157,9 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, } } } - if (node) + if (node) { nodeSetActive(ma->nodetree, node); + } } if (ma->texpaintslot) { @@ -198,8 +200,9 @@ static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr) Material *ma = (Material *)ptr->data; Main *bmain = CTX_data_main(C); - if (ma->use_nodes && ma->nodetree == NULL) + if (ma->use_nodes && ma->nodetree == NULL) { ED_node_shader_default(C, &ma->id); + } DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); DEG_relations_tag_update(bmain); @@ -298,8 +301,9 @@ static void rna_TexPaintSlot_uv_layer_set(PointerRNA *ptr, const char *value) static bool rna_is_grease_pencil_get(PointerRNA *ptr) { Material *ma = (Material *)ptr->data; - if (ma->gp_style != NULL) + if (ma->gp_style != NULL) { return true; + } return false; } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 4082222340a..c51097fc8c3 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -526,8 +526,9 @@ static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, Pointe rna_iterator_array_begin( iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL); } - else + else { rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL); + } } static void rna_MeshVertex_undeformed_co_get(PointerRNA *ptr, float values[3]) @@ -543,18 +544,21 @@ static void rna_MeshVertex_undeformed_co_get(PointerRNA *ptr, float values[3]) BKE_mesh_texspace_get(me->texcomesh ? me->texcomesh : me, loc, NULL, size); madd_v3_v3v3v3(values, loc, orco[(mvert - me->mvert)], size); } - else + else { copy_v3_v3(values, mvert->co); + } } static int rna_CustomDataLayer_active_get(PointerRNA *ptr, CustomData *data, int type, bool render) { int n = ((CustomDataLayer *)ptr->data) - data->layers; - if (render) + if (render) { return (n == CustomData_get_render_layer_index(data, type)); - else + } + else { return (n == CustomData_get_active_layer_index(data, type)); + } } static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, CustomData *data, int type) @@ -570,13 +574,16 @@ static void rna_CustomDataLayer_active_set( Mesh *me = ptr->id.data; int n = (((CustomDataLayer *)ptr->data) - data->layers) - CustomData_get_layer_index(data, type); - if (value == 0) + if (value == 0) { return; + } - if (render) + if (render) { CustomData_set_layer_render(data, type, n); - else + } + else { CustomData_set_layer_active(data, type, n); + } BKE_mesh_update_customdata_pointers(me, true); } @@ -585,8 +592,9 @@ static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int { int n = ((CustomDataLayer *)ptr->data) - data->layers; - if (value == 0) + if (value == 0) { return; + } CustomData_set_layer_clone_index(data, type, n); } @@ -1098,10 +1106,13 @@ static char *rna_VertexGroupElement_path(PointerRNA *ptr) MDeformVert *dvert; int a, b; - for (a = 0, dvert = me->dvert; a < me->totvert; a++, dvert++) - for (b = 0; b < dvert->totweight; b++) - if (dw == &dvert->dw[b]) + for (a = 0, dvert = me->dvert; a < me->totvert; a++, dvert++) { + for (b = 0; b < dvert->totweight; b++) { + if (dw == &dvert->dw[b]) { return BLI_sprintfN("vertices[%d].groups[%d]", a, b); + } + } + } return NULL; } diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index 9a8487ad659..d647c647136 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -48,8 +48,9 @@ static const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, struct Mesh *me { const char *ret = BKE_mesh_cmp(mesh, mesh2, FLT_EPSILON * 60); - if (!ret) + if (!ret) { ret = "Same"; + } return ret; } diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 234929bdb36..92a32ec8ab5 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -94,9 +94,11 @@ static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) /* cheating way for importers to avoid slow updates */ if (mb->id.us > 0) { - for (ob = bmain->objects.first; ob; ob = ob->id.next) - if (ob->data == mb) + for (ob = bmain->objects.first; ob; ob = ob->id.next) { + if (ob->data == mb) { BKE_mball_properties_copy(scene, ob); + } + } DEG_id_tag_update(&mb->id, 0); WM_main_add_notifier(NC_GEOM | ND_DATA, mb); @@ -166,12 +168,15 @@ static char *rna_MetaElement_path(PointerRNA *ptr) MetaElem *ml = ptr->data; int index = -1; - if (mb->editelems) + if (mb->editelems) { index = BLI_findindex(mb->editelems, ml); - if (index == -1) + } + if (index == -1) { index = BLI_findindex(&mb->elems, ml); - if (index == -1) + } + if (index == -1) { return NULL; + } return BLI_sprintfN("elements[%d]", index); } diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 2a09abe5f8d..02bc7ebf544 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -847,8 +847,9 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) Object *ob = (Object *)ptr->id.data; /* nothing changed */ - if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) + if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) { return; + } smokeModifier_free(smd); /* XXX TODO: completely free all 3 pointers */ smokeModifier_createType(smd); /* create regarding of selected type */ @@ -962,8 +963,9 @@ static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value) int a; md->num_projectors = CLAMPIS(value, 1, MOD_UVPROJECT_MAXPROJECTORS); - for (a = md->num_projectors; a < MOD_UVPROJECT_MAXPROJECTORS; a++) + for (a = md->num_projectors; a < MOD_UVPROJECT_MAXPROJECTORS; a++) { md->projectors[a] = NULL; + } } static void rna_OceanModifier_init_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -1380,8 +1382,9 @@ static bool rna_ParticleInstanceModifier_particle_system_poll(PointerRNA *ptr, ParticleInstanceModifierData *psmd = ptr->data; ParticleSystem *psys = value.data; - if (!psmd->ob) + if (!psmd->ob) { return false; + } /* make sure psys is in the object */ return BLI_findindex(&psmd->ob->particlesystem, psys) != -1; @@ -1393,8 +1396,9 @@ static PointerRNA rna_ParticleInstanceModifier_particle_system_get(PointerRNA *p ParticleSystem *psys; PointerRNA rptr; - if (!psmd->ob) + if (!psmd->ob) { return PointerRNA_NULL; + } psys = BLI_findlink(&psmd->ob->particlesystem, psmd->psys - 1); RNA_pointer_create((ID *)psmd->ob, &RNA_ParticleSystem, psys, &rptr); @@ -1407,8 +1411,9 @@ static void rna_ParticleInstanceModifier_particle_system_set(PointerRNA *ptr, { ParticleInstanceModifierData *psmd = ptr->data; - if (!psmd->ob) + if (!psmd->ob) { return; + } psmd->psys = BLI_findindex(&psmd->ob->particlesystem, value.data) + 1; CLAMP_MIN(psmd->psys, 1); diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index 07f7db5cfcd..d09b6f6af9b 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -95,8 +95,9 @@ static void rna_MovieClipUser_proxy_render_settings_update(Main *UNUSED(bmain), if (&sc->user == user) { MovieClip *clip = ED_space_clip_get_clip(sc); - if (clip && (clip->flag & MCLIP_USE_PROXY)) + if (clip && (clip->flag & MCLIP_USE_PROXY)) { BKE_movieclip_clear_cache(clip); + } break; } diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index c3192b4f850..6f55fb4e24c 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -199,8 +199,9 @@ static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value) len = data->end - data->start; actlen = data->actend - data->actstart; - if (IS_EQF(actlen, 0.0f)) + if (IS_EQF(actlen, 0.0f)) { actlen = 1.0f; + } /* now, adjust the 'scale' setting to reflect this (so that this change can be valid) */ data->scale = len / ((actlen)*data->repeat); @@ -257,8 +258,9 @@ static void rna_NlaStrip_blend_out_set(PointerRNA *ptr, float value) CLAMP(value, 0, len); /* it also cannot overlap with blendin */ - if ((len - value) < data->blendin) + if ((len - value) < data->blendin) { value = len - data->blendin; + } data->blendout = value; } @@ -301,14 +303,16 @@ static int rna_NlaStrip_action_editable(PointerRNA *ptr, const char **UNUSED(r_i if (adt) { /* active action is only editable when it is not a tweaking strip */ - if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) + if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) { return 0; + } } } /* check for clues that strip probably shouldn't be used... */ - if (strip->flag & NLASTRIP_FLAG_TWEAKUSER) + if (strip->flag & NLASTRIP_FLAG_TWEAKUSER) { return 0; + } /* should be ok, though we may still miss some cases */ return PROP_EDITABLE; @@ -348,8 +352,9 @@ static void rna_NlaStrip_animated_influence_set(PointerRNA *ptr, bool value) data->flag |= NLASTRIP_FLAG_USR_INFLUENCE; BKE_nlastrip_validate_fcurves(data); } - else + else { data->flag &= ~NLASTRIP_FLAG_USR_INFLUENCE; + } } static void rna_NlaStrip_animated_time_set(PointerRNA *ptr, bool value) @@ -361,8 +366,9 @@ static void rna_NlaStrip_animated_time_set(PointerRNA *ptr, bool value) data->flag |= NLASTRIP_FLAG_USR_TIME; BKE_nlastrip_validate_fcurves(data); } - else + else { data->flag &= ~NLASTRIP_FLAG_USR_TIME; + } } static FCurve *rna_NlaStrip_fcurve_find(NlaStrip *strip, @@ -419,15 +425,17 @@ static NlaStrip *rna_NlaStrip_new(ID *id, * track's parents until we fall off. */ nlt_p = track; nlt = track; - while ((nlt = nlt->prev) != NULL) + while ((nlt = nlt->prev) != NULL) { nlt_p = nlt; + } adt.nla_tracks.first = nlt_p; /* do the same thing to find the last track */ nlt_p = track; nlt = track; - while ((nlt = nlt->next) != NULL) + while ((nlt = nlt->next) != NULL) { nlt_p = nlt; + } adt.nla_tracks.last = nlt_p; /* now we can just auto-name as usual */ diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index d634a34bc5b..7011e6f53f7 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -540,10 +540,12 @@ static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr) { bNodeTree *ntree = (bNodeTree *)ptr->data; - if (ntree->typeinfo->ext.srna) + if (ntree->typeinfo->ext.srna) { return ntree->typeinfo->ext.srna; - else + } + else { return &RNA_NodeTree; + } } static bool rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype) @@ -620,8 +622,9 @@ static void rna_NodeTree_unregister(Main *UNUSED(bmain), StructRNA *type) { bNodeTreeType *nt = RNA_struct_blender_type_get(type); - if (!nt) + if (!nt) { return; + } RNA_struct_free_extension(type, &nt->ext); RNA_struct_free(&BLENDER_RNA, type); @@ -652,8 +655,9 @@ static StructRNA *rna_NodeTree_register(Main *bmain, RNA_pointer_create(NULL, &RNA_NodeTree, &dummyntree, &dummyptr); /* validate the python class */ - if (validate(&dummyptr, data, have_function) != 0) + if (validate(&dummyptr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(dummynt.idname)) { BKE_reportf(reports, @@ -700,17 +704,18 @@ static StructRNA *rna_NodeTree_register(Main *bmain, static bool rna_NodeTree_check(bNodeTree *ntree, ReportList *reports) { if (!ntreeIsRegistered(ntree)) { - if (reports) + if (reports) { BKE_reportf(reports, RPT_ERROR, "Node tree '%s' has undefined type %s", ntree->id.name + 2, ntree->idname); - + } return false; } - else + else { return true; + } } static void rna_NodeTree_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) @@ -732,8 +737,9 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bNodeType *ntype; bNode *node; - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return NULL; + } ntype = nodeTypeFind(type); if (!ntype) { @@ -771,8 +777,9 @@ static void rna_NodeTree_node_remove(bNodeTree *ntree, { bNode *node = node_ptr->data; - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return; + } if (BLI_findindex(&ntree->nodes, node) == -1) { BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in node tree", node->name); @@ -791,8 +798,9 @@ static void rna_NodeTree_node_clear(bNodeTree *ntree, Main *bmain, ReportList *r { bNode *node = ntree->nodes.first; - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return; + } while (node) { bNode *next_node = node->next; @@ -821,10 +829,12 @@ static void rna_NodeTree_active_node_set(PointerRNA *ptr, bNodeTree *ntree = (bNodeTree *)ptr->data; bNode *node = (bNode *)value.data; - if (node && BLI_findindex(&ntree->nodes, node) != -1) + if (node && BLI_findindex(&ntree->nodes, node) != -1) { nodeSetActive(ntree, node); - else + } + else { nodeClearActive(ntree); + } } static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, @@ -837,16 +847,18 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, bNodeLink *ret; bNode *fromnode = NULL, *tonode = NULL; - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return NULL; + } nodeFindNode(ntree, fromsock, &fromnode, NULL); nodeFindNode(ntree, tosock, &tonode, NULL); /* check validity of the sockets: * if sockets from different trees are passed in this will fail! */ - if (!fromnode || !tonode) + if (!fromnode || !tonode) { return NULL; + } if (&fromsock->in_out == &tosock->in_out) { BKE_report(reports, RPT_ERROR, "Same input/output direction of sockets"); @@ -855,10 +867,12 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, if (verify_limits) { /* remove other socket links if limit is exceeded */ - if (nodeCountSocketLinks(ntree, fromsock) + 1 > fromsock->limit) + if (nodeCountSocketLinks(ntree, fromsock) + 1 > fromsock->limit) { nodeRemSocketLinks(ntree, fromsock); - if (nodeCountSocketLinks(ntree, tosock) + 1 > tosock->limit) + } + if (nodeCountSocketLinks(ntree, tosock) + 1 > tosock->limit) { nodeRemSocketLinks(ntree, tosock); + } } ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock); @@ -869,8 +883,9 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, fromsock->flag &= ~SOCK_HIDDEN; tosock->flag &= ~SOCK_HIDDEN; - if (tonode) + if (tonode) { nodeUpdate(ntree, tonode); + } ntreeUpdateTree(bmain, ntree); @@ -887,8 +902,9 @@ static void rna_NodeTree_link_remove(bNodeTree *ntree, { bNodeLink *link = link_ptr->data; - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return; + } if (BLI_findindex(&ntree->links, link) == -1) { BKE_report(reports, RPT_ERROR, "Unable to locate link in node tree"); @@ -906,8 +922,9 @@ static void rna_NodeTree_link_clear(bNodeTree *ntree, Main *bmain, ReportList *r { bNodeLink *link = ntree->links.first; - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return; + } while (link) { bNodeLink *next_link = link->next; @@ -927,9 +944,11 @@ static int rna_NodeTree_active_input_get(PointerRNA *ptr) bNodeSocket *gsock; int index; - for (gsock = ntree->inputs.first, index = 0; gsock; gsock = gsock->next, ++index) - if (gsock->flag & SELECT) + for (gsock = ntree->inputs.first, index = 0; gsock; gsock = gsock->next, index++) { + if (gsock->flag & SELECT) { return index; + } + } return -1; } @@ -939,11 +958,13 @@ static void rna_NodeTree_active_input_set(PointerRNA *ptr, int value) bNodeSocket *gsock; int index; - for (gsock = ntree->inputs.first, index = 0; gsock; gsock = gsock->next, ++index) { - if (index == value) + for (gsock = ntree->inputs.first, index = 0; gsock; gsock = gsock->next, index++) { + if (index == value) { gsock->flag |= SELECT; - else + } + else { gsock->flag &= ~SELECT; + } } for (gsock = ntree->outputs.first; gsock; gsock = gsock->next) { gsock->flag &= ~SELECT; @@ -956,9 +977,11 @@ static int rna_NodeTree_active_output_get(PointerRNA *ptr) bNodeSocket *gsock; int index; - for (gsock = ntree->outputs.first, index = 0; gsock; gsock = gsock->next, ++index) - if (gsock->flag & SELECT) + for (gsock = ntree->outputs.first, index = 0; gsock; gsock = gsock->next, index++) { + if (gsock->flag & SELECT) { return index; + } + } return -1; } @@ -971,11 +994,13 @@ static void rna_NodeTree_active_output_set(PointerRNA *ptr, int value) for (gsock = ntree->inputs.first; gsock; gsock = gsock->next) { gsock->flag &= ~SELECT; } - for (gsock = ntree->outputs.first, index = 0; gsock; gsock = gsock->next, ++index) { - if (index == value) + for (gsock = ntree->outputs.first, index = 0; gsock; gsock = gsock->next, index++) { + if (index == value) { gsock->flag |= SELECT; - else + } + else { gsock->flag &= ~SELECT; + } } } @@ -984,8 +1009,9 @@ static bNodeSocket *rna_NodeTree_inputs_new( { bNodeSocket *sock; - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return NULL; + } sock = ntreeAddSocketInterface(ntree, SOCK_IN, type, name); @@ -1000,8 +1026,9 @@ static bNodeSocket *rna_NodeTree_outputs_new( { bNodeSocket *sock; - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return NULL; + } sock = ntreeAddSocketInterface(ntree, SOCK_OUT, type, name); @@ -1016,8 +1043,9 @@ static void rna_NodeTree_socket_remove(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock) { - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return; + } if (BLI_findindex(&ntree->inputs, sock) == -1 && BLI_findindex(&ntree->outputs, sock) == -1) { BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier); @@ -1034,8 +1062,9 @@ static void rna_NodeTree_inputs_clear(bNodeTree *ntree, Main *bmain, ReportList { bNodeSocket *sock, *nextsock; - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return; + } for (sock = ntree->inputs.first; sock; sock = nextsock) { nextsock = sock->next; @@ -1050,8 +1079,9 @@ static void rna_NodeTree_outputs_clear(bNodeTree *ntree, Main *bmain, ReportList { bNodeSocket *sock, *nextsock; - if (!rna_NodeTree_check(ntree, reports)) + if (!rna_NodeTree_check(ntree, reports)) { return; + } for (sock = ntree->outputs.first; sock; sock = nextsock) { nextsock = sock->next; @@ -1066,10 +1096,12 @@ static void rna_NodeTree_inputs_move(bNodeTree *ntree, Main *bmain, int from_ind { bNodeSocket *sock; - if (from_index == to_index) + if (from_index == to_index) { return; - if (from_index < 0 || to_index < 0) + } + if (from_index < 0 || to_index < 0) { return; + } sock = BLI_findlink(&ntree->inputs, from_index); if (to_index < from_index) { @@ -1097,10 +1129,12 @@ static void rna_NodeTree_outputs_move(bNodeTree *ntree, Main *bmain, int from_in { bNodeSocket *sock; - if (from_index == to_index) + if (from_index == to_index) { return; - if (from_index < 0 || to_index < 0) + } + if (from_index < 0 || to_index < 0) { return; + } sock = BLI_findlink(&ntree->outputs, from_index); if (to_index < from_index) { @@ -1148,10 +1182,12 @@ static StructRNA *rna_Node_refine(struct PointerRNA *ptr) { bNode *node = (bNode *)ptr->data; - if (node->typeinfo->ext.srna) + if (node->typeinfo->ext.srna) { return node->typeinfo->ext.srna; - else + } + else { return ptr->type; + } } static char *rna_Node_path(PointerRNA *ptr) @@ -1172,16 +1208,19 @@ char *rna_Node_ImageUser_path(PointerRNA *ptr) for (node = ntree->nodes.first; node; node = node->next) { if (node->type == SH_NODE_TEX_ENVIRONMENT) { NodeTexEnvironment *data = node->storage; - if (&data->iuser != ptr->data) + if (&data->iuser != ptr->data) { continue; + } } else if (node->type == SH_NODE_TEX_IMAGE) { NodeTexImage *data = node->storage; - if (&data->iuser != ptr->data) + if (&data->iuser != ptr->data) { continue; + } } - else + else { continue; + } BLI_strescape(name_esc, node->name, sizeof(name_esc)); return BLI_sprintfN("nodes[\"%s\"].image_user", name_esc); @@ -1407,8 +1446,9 @@ static void rna_Node_unregister(Main *UNUSED(bmain), StructRNA *type) { bNodeType *nt = RNA_struct_blender_type_get(type); - if (!nt) + if (!nt) { return; + } RNA_struct_free_extension(type, &nt->ext); RNA_struct_free(&BLENDER_RNA, type); @@ -1449,8 +1489,9 @@ static bNodeType *rna_Node_register_base(Main *bmain, RNA_pointer_create(NULL, basetype, &dummynode, &dummyptr); /* validate the python class */ - if (validate(&dummyptr, data, have_function) != 0) + if (validate(&dummyptr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(dummynt.idname)) { BKE_reportf(reports, @@ -1504,10 +1545,12 @@ static bNodeType *rna_Node_register_base(Main *bmain, nt->labelfunc = (have_function[9]) ? rna_Node_draw_label : NULL; /* sanitize size values in case not all have been registered */ - if (nt->maxwidth < nt->minwidth) + if (nt->maxwidth < nt->minwidth) { nt->maxwidth = nt->minwidth; - if (nt->maxheight < nt->minheight) + } + if (nt->maxheight < nt->minheight) { nt->maxheight = nt->minheight; + } CLAMP(nt->width, nt->minwidth, nt->maxwidth); CLAMP(nt->height, nt->minheight, nt->maxheight); @@ -1524,8 +1567,9 @@ static StructRNA *rna_Node_register(Main *bmain, { bNodeType *nt = rna_Node_register_base( bmain, reports, &RNA_Node, data, identifier, validate, call, free); - if (!nt) + if (!nt) { return NULL; + } nodeRegisterType(nt); @@ -1545,8 +1589,9 @@ static StructRNA *rna_ShaderNode_register(Main *bmain, { bNodeType *nt = rna_Node_register_base( bmain, reports, &RNA_ShaderNode, data, identifier, validate, call, free); - if (!nt) + if (!nt) { return NULL; + } nodeRegisterType(nt); @@ -1566,8 +1611,9 @@ static StructRNA *rna_CompositorNode_register(Main *bmain, { bNodeType *nt = rna_Node_register_base( bmain, reports, &RNA_CompositorNode, data, identifier, validate, call, free); - if (!nt) + if (!nt) { return NULL; + } nodeRegisterType(nt); @@ -1587,8 +1633,9 @@ static StructRNA *rna_TextureNode_register(Main *bmain, { bNodeType *nt = rna_Node_register_base( bmain, reports, &RNA_TextureNode, data, identifier, validate, call, free); - if (!nt) + if (!nt) { return NULL; + } nodeRegisterType(nt); @@ -1621,12 +1668,14 @@ static void rna_Node_parent_set(PointerRNA *ptr, /* XXX only Frame node allowed for now, * in the future should have a poll function or so to test possible attachment. */ - if (parent->type != NODE_FRAME) + if (parent->type != NODE_FRAME) { return; + } /* make sure parent is not attached to the node */ - if (nodeAttachNodeCheck(parent, node)) + if (nodeAttachNodeCheck(parent, node)) { return; + } } nodeDetachNode(node); @@ -1643,12 +1692,14 @@ static bool rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value) /* XXX only Frame node allowed for now, * in the future should have a poll function or so to test possible attachment. */ - if (parent->type != NODE_FRAME) + if (parent->type != NODE_FRAME) { return false; + } /* make sure parent is not attached to the node */ - if (nodeAttachNodeCheck(parent, node)) + if (nodeAttachNodeCheck(parent, node)) { return false; + } return true; } @@ -1797,10 +1848,12 @@ static void rna_Node_inputs_move(ID *id, bNode *node, Main *bmain, int from_inde bNodeTree *ntree = (bNodeTree *)id; bNodeSocket *sock; - if (from_index == to_index) + if (from_index == to_index) { return; - if (from_index < 0 || to_index < 0) + } + if (from_index < 0 || to_index < 0) { return; + } sock = BLI_findlink(&node->inputs, from_index); if (to_index < from_index) { @@ -1827,10 +1880,12 @@ static void rna_Node_outputs_move(ID *id, bNode *node, Main *bmain, int from_ind bNodeTree *ntree = (bNodeTree *)id; bNodeSocket *sock; - if (from_index == to_index) + if (from_index == to_index) { return; - if (from_index < 0 || to_index < 0) + } + if (from_index < 0 || to_index < 0) { return; + } sock = BLI_findlink(&node->outputs, from_index); if (to_index < from_index) { @@ -1926,8 +1981,9 @@ static void rna_NodeSocket_draw_color(bContext *C, static void rna_NodeSocket_unregister(Main *UNUSED(bmain), StructRNA *type) { bNodeSocketType *st = RNA_struct_blender_type_get(type); - if (!st) + if (!st) { return; + } RNA_struct_free_extension(type, &st->ext_socket); RNA_struct_free(&BLENDER_RNA, type); @@ -1959,8 +2015,9 @@ static StructRNA *rna_NodeSocket_register(Main *UNUSED(bmain), RNA_pointer_create(NULL, &RNA_NodeSocket, &dummysock, &dummyptr); /* validate the python class */ - if (validate(&dummyptr, data, have_function) != 0) + if (validate(&dummyptr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(dummyst.idname)) { BKE_reportf(reports, @@ -2009,10 +2066,12 @@ static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr) { bNodeSocket *sock = (bNodeSocket *)ptr->data; - if (sock->typeinfo->ext_socket.srna) + if (sock->typeinfo->ext_socket.srna) { return sock->typeinfo->ext_socket.srna; - else + } + else { return &RNA_NodeSocket; + } } static char *rna_NodeSocket_path(PointerRNA *ptr) @@ -2023,8 +2082,9 @@ static char *rna_NodeSocket_path(PointerRNA *ptr) int socketindex; char name_esc[sizeof(node->name) * 2]; - if (!nodeFindNode(ntree, sock, &node, &socketindex)) + if (!nodeFindNode(ntree, sock, &node, &socketindex)) { return NULL; + } BLI_strescape(name_esc, node->name, sizeof(name_esc)); @@ -2088,13 +2148,16 @@ static void rna_NodeSocket_hide_set(PointerRNA *ptr, bool value) bNodeSocket *sock = (bNodeSocket *)ptr->data; /* don't hide linked sockets */ - if (sock->flag & SOCK_IN_USE) + if (sock->flag & SOCK_IN_USE) { return; + } - if (value) + if (value) { sock->flag |= SOCK_HIDDEN; - else + } + else { sock->flag &= ~SOCK_HIDDEN; + } } static void rna_NodeSocketInterface_draw(bContext *C, struct uiLayout *layout, PointerRNA *ptr) @@ -2105,8 +2168,9 @@ static void rna_NodeSocketInterface_draw(bContext *C, struct uiLayout *layout, P ParameterList list; FunctionRNA *func; - if (!stemp->typeinfo) + if (!stemp->typeinfo) { return; + } func = &rna_NodeSocketInterface_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */ @@ -2127,8 +2191,9 @@ static void rna_NodeSocketInterface_draw_color(bContext *C, PointerRNA *ptr, flo FunctionRNA *func; void *ret; - if (!sock->typeinfo) + if (!sock->typeinfo) { return; + } func = &rna_NodeSocketInterface_draw_color_func; /* RNA_struct_find_function(&ptr, "draw_color"); */ @@ -2153,8 +2218,9 @@ static void rna_NodeSocketInterface_register_properties(bNodeTree *ntree, ParameterList list; FunctionRNA *func; - if (!stemp->typeinfo) + if (!stemp->typeinfo) { return; + } RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, stemp, &ptr); /* RNA_struct_find_function(&ptr, "register_properties"); */ @@ -2176,8 +2242,9 @@ static void rna_NodeSocketInterface_init_socket( ParameterList list; FunctionRNA *func; - if (!stemp->typeinfo) + if (!stemp->typeinfo) { return; + } RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, stemp, &ptr); RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr); @@ -2205,8 +2272,9 @@ static void rna_NodeSocketInterface_from_socket(bNodeTree *ntree, ParameterList list; FunctionRNA *func; - if (!stemp->typeinfo) + if (!stemp->typeinfo) { return; + } RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, stemp, &ptr); RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr); @@ -2225,8 +2293,9 @@ static void rna_NodeSocketInterface_from_socket(bNodeTree *ntree, static void rna_NodeSocketInterface_unregister(Main *UNUSED(bmain), StructRNA *type) { bNodeSocketType *st = RNA_struct_blender_type_get(type); - if (!st) + if (!st) { return; + } RNA_struct_free_extension(type, &st->ext_interface); @@ -2257,8 +2326,9 @@ static StructRNA *rna_NodeSocketInterface_register(Main *UNUSED(bmain), RNA_pointer_create(NULL, &RNA_NodeSocketInterface, &dummysock, &dummyptr); /* validate the python class */ - if (validate(&dummyptr, data, have_function) != 0) + if (validate(&dummyptr, data, have_function) != 0) { return NULL; + } /* check if we have registered this socket type before */ st = nodeSocketTypeFind(dummyst.idname); @@ -2303,10 +2373,12 @@ static StructRNA *rna_NodeSocketInterface_refine(PointerRNA *ptr) { bNodeSocket *sock = (bNodeSocket *)ptr->data; - if (sock->typeinfo && sock->typeinfo->ext_interface.srna) + if (sock->typeinfo && sock->typeinfo->ext_interface.srna) { return sock->typeinfo->ext_interface.srna; - else + } + else { return &RNA_NodeSocketInterface; + } } static char *rna_NodeSocketInterface_path(PointerRNA *ptr) @@ -2316,12 +2388,14 @@ static char *rna_NodeSocketInterface_path(PointerRNA *ptr) int socketindex; socketindex = BLI_findindex(&ntree->inputs, sock); - if (socketindex != -1) + if (socketindex != -1) { return BLI_sprintfN("inputs[%d]", socketindex); + } socketindex = BLI_findindex(&ntree->outputs, sock); - if (socketindex != -1) + if (socketindex != -1) { return BLI_sprintfN("outputs[%d]", socketindex); + } return NULL; } @@ -2343,8 +2417,9 @@ static void rna_NodeSocketInterface_update(Main *bmain, Scene *UNUSED(scene), Po bNodeTree *ntree = ptr->id.data; bNodeSocket *stemp = ptr->data; - if (!stemp->typeinfo) + if (!stemp->typeinfo) { return; + } ntree->update |= NTREE_UPDATE_GROUP; ntreeUpdateTree(bmain, ntree); @@ -2554,8 +2629,9 @@ static bool rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree) static void rna_NodeInternal_update(ID *id, bNode *node) { bNodeTree *ntree = (bNodeTree *)id; - if (node->typeinfo->updatefunc) + if (node->typeinfo->updatefunc) { node->typeinfo->updatefunc(ntree, node); + } } static void rna_NodeInternal_draw_buttons(ID *id, @@ -2597,8 +2673,9 @@ static StructRNA *rna_NodeCustomGroup_register(Main *bmain, { bNodeType *nt = rna_Node_register_base( bmain, reports, &RNA_NodeCustomGroup, data, identifier, validate, call, free); - if (!nt) + if (!nt) { return NULL; + } /* this updates the group node instance from the tree's interface */ nt->group_update_func = node_group_update; @@ -2622,8 +2699,9 @@ static StructRNA *rna_ShaderNodeCustomGroup_register(Main *bmain, bNodeType *nt = rna_Node_register_base( bmain, reports, &RNA_ShaderNodeCustomGroup, data, identifier, validate, call, free); - if (!nt) + if (!nt) { return NULL; + } nt->group_update_func = node_group_update; nt->type = NODE_CUSTOM_GROUP; @@ -2647,8 +2725,9 @@ static StructRNA *rna_CompositorNodeCustomGroup_register(Main *bmain, { bNodeType *nt = rna_Node_register_base( bmain, reports, &RNA_CompositorNodeCustomGroup, data, identifier, validate, call, free); - if (!nt) + if (!nt) { return NULL; + } nt->group_update_func = node_group_update; nt->type = NODE_CUSTOM_GROUP; @@ -2681,8 +2760,9 @@ static void rna_NodeGroup_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * bNodeTree *ntree = (bNodeTree *)ptr->id.data; bNode *node = (bNode *)ptr->data; - if (node->id) + if (node->id) { ntreeUpdateTree(bmain, (bNodeTree *)node->id); + } ED_node_tag_update_nodetree(bmain, ntree, node); } @@ -2696,10 +2776,12 @@ static void rna_NodeGroup_node_tree_set(PointerRNA *ptr, bNodeTree *ngroup = value.data; if (nodeGroupPoll(ntree, ngroup)) { - if (node->id) + if (node->id) { id_us_min(node->id); - if (ngroup) + } + if (ngroup) { id_us_plus(&ngroup->id); + } node->id = &ngroup->id; } @@ -2711,8 +2793,9 @@ static bool rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value bNodeTree *ngroup = value.data; /* only allow node trees of the same type as the group node's tree */ - if (ngroup->type != ntree->type) + if (ngroup->type != ntree->type) { return false; + } return nodeGroupPoll(ntree, ngroup); } @@ -2724,8 +2807,9 @@ static StructRNA *rna_NodeGroup_interface_typef(PointerRNA *ptr) if (ngroup) { StructRNA *srna = ntreeInterfaceTypeGet(ngroup, true); - if (srna) + if (srna) { return srna; + } } return &RNA_PropertyGroup; } @@ -2736,8 +2820,9 @@ static StructRNA *rna_NodeGroupInputOutput_interface_typef(PointerRNA *ptr) if (ntree) { StructRNA *srna = ntreeInterfaceTypeGet(ntree, true); - if (srna) + if (srna) { return srna; + } } return &RNA_PropertyGroup; } @@ -2782,8 +2867,9 @@ static void rna_Matte_t1_set(PointerRNA *ptr, float value) chroma->t1 = value; - if (value < chroma->t2) + if (value < chroma->t2) { chroma->t2 = value; + } } static void rna_Matte_t2_set(PointerRNA *ptr, float value) @@ -2791,8 +2877,9 @@ static void rna_Matte_t2_set(PointerRNA *ptr, float value) bNode *node = (bNode *)ptr->data; NodeChroma *chroma = node->storage; - if (value > chroma->t1) + if (value > chroma->t1) { value = chroma->t1; + } chroma->t2 = value; } @@ -2839,10 +2926,12 @@ static const EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl) tmp.identifier = rl->name; /* Little trick: using space char instead empty string * makes the item selectable in the dropdown. */ - if (rl->name[0] == '\0') + if (rl->name[0] == '\0') { tmp.name = " "; - else + } + else { tmp.name = rl->name; + } tmp.value = i++; RNA_enum_item_add(&item, &totitem, &tmp); rl = rl->next; @@ -2881,8 +2970,9 @@ static bool rna_Node_image_has_layers_get(PointerRNA *ptr) bNode *node = (bNode *)ptr->data; Image *ima = (Image *)node->id; - if (!ima || !(ima->rr)) + if (!ima || !(ima->rr)) { return 0; + } return RE_layers_have_name(ima->rr); } @@ -2892,8 +2982,9 @@ static bool rna_Node_image_has_views_get(PointerRNA *ptr) bNode *node = (bNode *)ptr->data; Image *ima = (Image *)node->id; - if (!ima || !(ima->rr)) + if (!ima || !(ima->rr)) { return 0; + } return BLI_listbase_count_at_most(&ima->rr->views, 2) > 1; } @@ -2911,10 +3002,12 @@ static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv) tmp.identifier = rv->name; /* Little trick: using space char instead empty string * makes the item selectable in the dropdown. */ - if (rv->name[0] == '\0') + if (rv->name[0] == '\0') { tmp.name = " "; - else + } + else { tmp.name = rv->name; + } tmp.value = i++; RNA_enum_item_add(&item, &totitem, &tmp); rv = rv->next; @@ -3119,13 +3212,16 @@ static void rna_NodeCryptomatte_matte_set(PointerRNA *ptr, const char *value) bNode *node = (bNode *)ptr->data; NodeCryptomatte *nc = node->storage; - if (nc->matte_id) + if (nc->matte_id) { MEM_freeN(nc->matte_id); + } - if (value && value[0]) + if (value && value[0]) { nc->matte_id = BLI_strdup(value); - else + } + else { nc->matte_id = NULL; + } } static void rna_NodeCryptomatte_update_add(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -3205,8 +3301,9 @@ static bNodeSocket *rna_NodeOutputFile_slots_new( Scene *scene = CTX_data_scene(C); ImageFormatData *im_format = NULL; bNodeSocket *sock; - if (scene) + if (scene) { im_format = &scene->r.im_format; + } sock = ntreeCompositOutputFileAddSocket(ntree, node, name, im_format); @@ -3294,13 +3391,16 @@ static void rna_ShaderNodeScript_bytecode_set(PointerRNA *ptr, const char *value bNode *node = (bNode *)ptr->data; NodeShaderScript *nss = node->storage; - if (nss->bytecode) + if (nss->bytecode) { MEM_freeN(nss->bytecode); + } - if (value && value[0]) + if (value && value[0]) { nss->bytecode = BLI_strdup(value); - else + } + else { nss->bytecode = NULL; + } } static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index e2f566cfdab..774f82c3803 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -699,10 +699,12 @@ void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index) dg = BLI_findlink(&ob->defbase, index - 1); - if (dg) + if (dg) { BLI_strncpy(value, dg->name, sizeof(dg->name)); - else + } + else { value[0] = '\0'; + } } int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index) @@ -782,10 +784,12 @@ void rna_object_BKE_object_facemap_name_index_get(PointerRNA *ptr, char *value, fmap = BLI_findlink(&ob->fmaps, index - 1); - if (fmap) + if (fmap) { BLI_strncpy(value, fmap->name, sizeof(fmap->name)); - else + } + else { value[0] = '\0'; + } } int rna_object_BKE_object_facemap_name_index_length(PointerRNA *ptr, int index) @@ -876,8 +880,9 @@ static void rna_Object_active_material_index_set(PointerRNA *ptr, int value) if (ob->type == OB_MESH) { Mesh *me = ob->data; - if (me->edit_mesh) + if (me->edit_mesh) { me->edit_mesh->mat_nr = value; + } } } @@ -1014,14 +1019,18 @@ static int rna_Object_location_editable(PointerRNA *ptr, int index) Object *ob = (Object *)ptr->data; /* only if the axis in question is locked, not editable... */ - if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX)) + if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX)) { return 0; - else if ((index == 1) && (ob->protectflag & OB_LOCK_LOCY)) + } + else if ((index == 1) && (ob->protectflag & OB_LOCK_LOCY)) { return 0; - else if ((index == 2) && (ob->protectflag & OB_LOCK_LOCZ)) + } + else if ((index == 2) && (ob->protectflag & OB_LOCK_LOCZ)) { return 0; - else + } + else { return PROP_EDITABLE; + } } static int rna_Object_scale_editable(PointerRNA *ptr, int index) @@ -1029,14 +1038,18 @@ static int rna_Object_scale_editable(PointerRNA *ptr, int index) Object *ob = (Object *)ptr->data; /* only if the axis in question is locked, not editable... */ - if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX)) + if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX)) { return 0; - else if ((index == 1) && (ob->protectflag & OB_LOCK_SCALEY)) + } + else if ((index == 1) && (ob->protectflag & OB_LOCK_SCALEY)) { return 0; - else if ((index == 2) && (ob->protectflag & OB_LOCK_SCALEZ)) + } + else if ((index == 2) && (ob->protectflag & OB_LOCK_SCALEZ)) { return 0; - else + } + else { return PROP_EDITABLE; + } } static int rna_Object_rotation_euler_editable(PointerRNA *ptr, int index) @@ -1044,14 +1057,18 @@ static int rna_Object_rotation_euler_editable(PointerRNA *ptr, int index) Object *ob = (Object *)ptr->data; /* only if the axis in question is locked, not editable... */ - if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX)) + if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX)) { return 0; - else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTY)) + } + else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTY)) { return 0; - else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTZ)) + } + else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTZ)) { return 0; - else + } + else { return PROP_EDITABLE; + } } static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index) @@ -1061,14 +1078,18 @@ static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index) /* only consider locks if locking components individually... */ if (ob->protectflag & OB_LOCK_ROT4D) { /* only if the axis in question is locked, not editable... */ - if ((index == 0) && (ob->protectflag & OB_LOCK_ROTW)) + if ((index == 0) && (ob->protectflag & OB_LOCK_ROTW)) { return 0; - else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTX)) + } + else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTX)) { return 0; - else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTY)) + } + else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTY)) { return 0; - else if ((index == 3) && (ob->protectflag & OB_LOCK_ROTZ)) + } + else if ((index == 3) && (ob->protectflag & OB_LOCK_ROTZ)) { return 0; + } } return PROP_EDITABLE; @@ -1158,8 +1179,9 @@ static int rna_MaterialSlot_name_length(PointerRNA *ptr) ma = give_current_material(ob, index + 1); - if (ma) + if (ma) { return strlen(ma->id.name + 2); + } return 0; } @@ -1172,10 +1194,12 @@ static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str) ma = give_current_material(ob, index + 1); - if (ma) + if (ma) { strcpy(str, ma->id.name + 2); - else + } + else { str[0] = '\0'; + } } static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -1221,8 +1245,9 @@ static void rna_Object_active_shape_key_index_range( *min = 0; if (key) { *max = BLI_listbase_count(&key->block) - 1; - if (*max < 0) + if (*max < 0) { *max = 0; + } } else { *max = 0; @@ -1250,8 +1275,9 @@ static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr) KeyBlock *kb; PointerRNA keyptr; - if (key == NULL) + if (key == NULL) { return PointerRNA_NULL; + } kb = BLI_findlink(&key->block, ob->shapenr - 1); RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr); @@ -1263,8 +1289,9 @@ static PointerRNA rna_Object_field_get(PointerRNA *ptr) Object *ob = (Object *)ptr->id.data; /* weak */ - if (!ob->pd) + if (!ob->pd) { ob->pd = BKE_partdeflect_new(0); + } return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd); } @@ -1273,12 +1300,14 @@ static PointerRNA rna_Object_collision_get(PointerRNA *ptr) { Object *ob = (Object *)ptr->id.data; - if (ob->type != OB_MESH) + if (ob->type != OB_MESH) { return PointerRNA_NULL; + } /* weak */ - if (!ob->pd) + if (!ob->pd) { ob->pd = BKE_partdeflect_new(0); + } return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd); } @@ -1616,9 +1645,10 @@ static void rna_VertexGroup_vertex_add(ID *id, return; } - while (index_len--) + while (index_len--) { ED_vgroup_vert_add( ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/ + } DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data); @@ -1635,8 +1665,9 @@ static void rna_VertexGroup_vertex_remove( return; } - while (index_len--) + while (index_len--) { ED_vgroup_vert_remove(ob, dg, *index++); + } DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data); @@ -1693,8 +1724,9 @@ static void rna_FaceMap_face_add( return; } - while (index_len--) + while (index_len--) { ED_object_facemap_face_add(ob, fmap, *index++); + } WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data); } @@ -1709,8 +1741,9 @@ static void rna_FaceMap_face_remove( return; } - while (index_len--) + while (index_len--) { ED_object_facemap_face_remove(ob, fmap, *index++); + } WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data); } diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index f5c83df0f45..a891e11a944 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -476,8 +476,9 @@ static void rna_Mesh_assign_verts_to_group( } /* makes a set of dVerts corresponding to the mVerts */ - if (!me->dvert) + if (!me->dvert) { create_dverts(&me->id); + } /* loop list adding verts to group */ for (i = 0; i < totindex; i++) { diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 2abb1f3227a..c97491a92c6 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -125,8 +125,9 @@ static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR Object *ob = (Object *)ptr->id.data; PointCache *cache = (PointCache *)ptr->data; - if (!ob) + if (!ob) { return; + } cache->flag |= PTCACHE_OUTDATED; @@ -136,8 +137,9 @@ static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR if (pid.cache) { /* Just make sure this wasn't changed. */ - if (pid.type == PTCACHE_TYPE_SMOKE_DOMAIN) + if (pid.type == PTCACHE_TYPE_SMOKE_DOMAIN) { cache->step = 1; + } BKE_ptcache_update_info(&pid); } } @@ -147,16 +149,19 @@ static void rna_Cache_toggle_disk_cache(Main *UNUSED(bmain), Scene *UNUSED(scene Object *ob = (Object *)ptr->id.data; PointCache *cache = (PointCache *)ptr->data; - if (!ob) + if (!ob) { return; + } PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache); /* smoke can only use disk cache */ - if (pid.cache && pid.type != PTCACHE_TYPE_SMOKE_DOMAIN) + if (pid.cache && pid.type != PTCACHE_TYPE_SMOKE_DOMAIN) { BKE_ptcache_toggle_disk_cache(&pid); - else + } + else { cache->flag ^= PTCACHE_DISK_CACHE; + } } static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -165,8 +170,9 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P PointCache *cache = (PointCache *)ptr->data; bool use_new_name = true; - if (!ob) + if (!ob) { return; + } /* TODO: check for proper characters */ @@ -187,8 +193,9 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0); for (pid = pidlist.first; pid; pid = pid->next) { - if (pid->cache == cache) + if (pid->cache == cache) { pid2 = pid; + } else if (cache->name[0] != '\0' && STREQ(cache->name, pid->cache->name)) { /*TODO: report "name exists" to user */ BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name)); @@ -221,8 +228,9 @@ static void rna_Cache_list_begin(CollectionPropertyIterator *iter, PointerRNA *p PointCache *cache = ptr->data; ListBase lb; - while (cache->prev) + while (cache->prev) { cache = cache->prev; + } lb.first = cache; lb.last = NULL; /* not used by listbase_begin */ @@ -315,10 +323,12 @@ static bool rna_SoftBodySettings_use_edges_get(PointerRNA *ptr) static void rna_SoftBodySettings_use_edges_set(PointerRNA *ptr, bool value) { Object *data = (Object *)(ptr->id.data); - if (value) + if (value) { data->softflag |= OB_SB_EDGES; - else + } + else { data->softflag &= ~OB_SB_EDGES; + } } static bool rna_SoftBodySettings_use_goal_get(PointerRNA *ptr) @@ -330,10 +340,12 @@ static bool rna_SoftBodySettings_use_goal_get(PointerRNA *ptr) static void rna_SoftBodySettings_use_goal_set(PointerRNA *ptr, bool value) { Object *data = (Object *)(ptr->id.data); - if (value) + if (value) { data->softflag |= OB_SB_GOAL; - else + } + else { data->softflag &= ~OB_SB_GOAL; + } } static bool rna_SoftBodySettings_stiff_quads_get(PointerRNA *ptr) @@ -345,10 +357,12 @@ static bool rna_SoftBodySettings_stiff_quads_get(PointerRNA *ptr) static void rna_SoftBodySettings_stiff_quads_set(PointerRNA *ptr, bool value) { Object *data = (Object *)(ptr->id.data); - if (value) + if (value) { data->softflag |= OB_SB_QUADS; - else + } + else { data->softflag &= ~OB_SB_QUADS; + } } static bool rna_SoftBodySettings_self_collision_get(PointerRNA *ptr) @@ -360,28 +374,34 @@ static bool rna_SoftBodySettings_self_collision_get(PointerRNA *ptr) static void rna_SoftBodySettings_self_collision_set(PointerRNA *ptr, bool value) { Object *data = (Object *)(ptr->id.data); - if (value) + if (value) { data->softflag |= OB_SB_SELF; - else + } + else { data->softflag &= ~OB_SB_SELF; + } } static int rna_SoftBodySettings_new_aero_get(PointerRNA *ptr) { Object *data = (Object *)(ptr->id.data); - if (data->softflag & OB_SB_AERO_ANGLE) + if (data->softflag & OB_SB_AERO_ANGLE) { return 1; - else + } + else { return 0; + } } static void rna_SoftBodySettings_new_aero_set(PointerRNA *ptr, int value) { Object *data = (Object *)(ptr->id.data); - if (value == 1) + if (value == 1) { data->softflag |= OB_SB_AERO_ANGLE; - else /* value == 0 */ + } + else { /* value == 0 */ data->softflag &= ~OB_SB_AERO_ANGLE; + } } static bool rna_SoftBodySettings_face_collision_get(PointerRNA *ptr) @@ -393,10 +413,12 @@ static bool rna_SoftBodySettings_face_collision_get(PointerRNA *ptr) static void rna_SoftBodySettings_face_collision_set(PointerRNA *ptr, bool value) { Object *data = (Object *)(ptr->id.data); - if (value) + if (value) { data->softflag |= OB_SB_FACECOLL; - else + } + else { data->softflag &= ~OB_SB_FACECOLL; + } } static bool rna_SoftBodySettings_edge_collision_get(PointerRNA *ptr) @@ -408,10 +430,12 @@ static bool rna_SoftBodySettings_edge_collision_get(PointerRNA *ptr) static void rna_SoftBodySettings_edge_collision_set(PointerRNA *ptr, bool value) { Object *data = (Object *)(ptr->id.data); - if (value) + if (value) { data->softflag |= OB_SB_EDGECOLL; - else + } + else { data->softflag &= ~OB_SB_EDGECOLL; + } } static void rna_SoftBodySettings_goal_vgroup_get(PointerRNA *ptr, char *value) @@ -536,10 +560,12 @@ static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, Point rna_FieldSettings_shape_update(bmain, scene, ptr); - if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) + if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) { DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); - else + } + else { DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM); + } WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); } @@ -555,17 +581,20 @@ static char *rna_FieldSettings_path(PointerRNA *ptr) /* particle system force field */ ParticleSettings *part = (ParticleSettings *)ptr->id.data; - if (part->pd == pd) + if (part->pd == pd) { return BLI_strdup("force_field_1"); - else if (part->pd2 == pd) + } + else if (part->pd2 == pd) { return BLI_strdup("force_field_2"); + } } else { /* object force field */ Object *ob = (Object *)ptr->id.data; - if (ob->pd == pd) + if (ob->pd == pd) { return BLI_strdup("field"); + } } return NULL; } @@ -682,10 +711,12 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P ModifierData *md = modifiers_findByType(ob, eModifierType_Collision); /* add/remove modifier as needed */ - if (ob->pd->deflect && !md) + if (ob->pd->deflect && !md) { ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision); - else if (!ob->pd->deflect && md) + } + else if (!ob->pd->deflect && md) { ED_object_modifier_remove(NULL, bmain, ob, md); + } WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); } @@ -721,26 +752,30 @@ static const EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), { Object *ob = NULL; - if (particle_id_check(ptr)) + if (particle_id_check(ptr)) { return empty_shape_items; + } ob = (Object *)ptr->id.data; if (ob->type == OB_CURVE) { - if (ob->pd->forcefield == PFIELD_VORTEX) + if (ob->pd->forcefield == PFIELD_VORTEX) { return curve_vortex_shape_items; + } return curve_shape_items; } else if (ELEM(ob->type, OB_MESH, OB_SURF, OB_FONT)) { - if (ob->pd->forcefield == PFIELD_VORTEX) + if (ob->pd->forcefield == PFIELD_VORTEX) { return vortex_shape_items; + } return effector_shape_items; } else { - if (ob->pd->forcefield == PFIELD_VORTEX) + if (ob->pd->forcefield == PFIELD_VORTEX) { return empty_vortex_shape_items; + } return empty_shape_items; } diff --git a/source/blender/makesrna/intern/rna_palette.c b/source/blender/makesrna/intern/rna_palette.c index 9af6387389c..42bfe1a13b7 100644 --- a/source/blender/makesrna/intern/rna_palette.c +++ b/source/blender/makesrna/intern/rna_palette.c @@ -68,8 +68,9 @@ static PointerRNA rna_Palette_active_color_get(PointerRNA *ptr) color = BLI_findlink(&palette->colors, palette->active_color); - if (color) + if (color) { return rna_pointer_inherit_refine(ptr, &RNA_PaletteColor, color); + } return rna_pointer_inherit_refine(ptr, NULL, NULL); } @@ -82,10 +83,12 @@ static void rna_Palette_active_color_set(PointerRNA *ptr, PaletteColor *color = value.data; /* -1 is ok for an unset index */ - if (color == NULL) + if (color == NULL) { palette->active_color = -1; - else + } + else { palette->active_color = BLI_findindex(&palette->colors, color); + } } #else diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index dff7421ed74..c1822b35f28 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -296,9 +296,11 @@ static void rna_Particle_uv_on_emitter(ParticleData *particle, } BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ - if (num == DMCACHE_NOTFOUND) - if (particle->num < modifier->mesh_final->totface) + if (num == DMCACHE_NOTFOUND) { + if (particle->num < modifier->mesh_final->totface) { num = particle->num; + } + } /* get uvco */ if (r_uv && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) { @@ -332,24 +334,28 @@ static void rna_ParticleSystem_co_hair( int totpart; int max_k = 0; - if (particlesystem == NULL) + if (particlesystem == NULL) { return; + } part = particlesystem->part; pars = particlesystem->particles; totpart = particlesystem->totcached; totchild = particlesystem->totchildcache; - if (part == NULL || pars == NULL) + if (part == NULL || pars == NULL) { return; + } if (part->ren_as == PART_DRAW_OB || part->ren_as == PART_DRAW_GR || - part->ren_as == PART_DRAW_NOT) + part->ren_as == PART_DRAW_NOT) { return; + } /* can happen for disconnected/global hair */ - if (part->type == PART_HAIR && !particlesystem->childcache) + if (part->type == PART_HAIR && !particlesystem->childcache) { totchild = 0; + } if (particle_no < totpart) { cache = particlesystem->pathcache[particle_no]; @@ -358,10 +364,12 @@ static void rna_ParticleSystem_co_hair( else if (particle_no < totpart + totchild) { cache = particlesystem->childcache[particle_no - totpart]; - if (cache->segments < 0) + if (cache->segments < 0) { max_k = 0; - else + } + else { max_k = (int)cache->segments; + } } else { return; @@ -445,11 +453,13 @@ static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesys totchild = particlesystem->totchildcache; /* can happen for disconnected/global hair */ - if (part->type == PART_HAIR && !particlesystem->childcache) + if (part->type == PART_HAIR && !particlesystem->childcache) { totchild = 0; + } - if (particle_no >= totpart + totchild) + if (particle_no >= totpart + totchild) { return num; + } /* 2. get matching face index. */ if (particle_no < totpart) { @@ -495,8 +505,9 @@ static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesys ParticleData *parent = particlesystem->particles + cpa->parent; num = parent->num_dmcache; - if (num == DMCACHE_NOTFOUND) + if (num == DMCACHE_NOTFOUND) { num = parent->num; + } if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { if (num != DMCACHE_NOTFOUND && num < totface) { @@ -612,8 +623,9 @@ static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); } - else + else { DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | flag); + } WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); } @@ -713,10 +725,13 @@ static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget ParticleSystem *psys; ParticleTarget *pt; - for (psys = ob->particlesystem.first; psys; psys = psys->next) - for (pt = psys->targets.first; pt; pt = pt->next) - if (pt == target) + for (psys = ob->particlesystem.first; psys; psys = psys->next) { + for (pt = psys->targets.first; pt; pt = pt->next) { + if (pt == target) { return psys; + } + } + } return NULL; } @@ -731,19 +746,24 @@ static void rna_Particle_target_reset(Main *bmain, Scene *UNUSED(scene), Pointer if (pt->ob == ob || pt->ob == NULL) { kpsys = BLI_findlink(&ob->particlesystem, pt->psys - 1); - if (kpsys) + if (kpsys) { pt->flag |= PTARGET_VALID; - else + } + else { pt->flag &= ~PTARGET_VALID; + } } else { - if (pt->ob) + if (pt->ob) { kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1); + } - if (kpsys) + if (kpsys) { pt->flag |= PTARGET_VALID; - else + } + else { pt->flag &= ~PTARGET_VALID; + } } psys->recalc = ID_RECALC_PSYS_RESET; @@ -839,14 +859,16 @@ static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value) ParticleSettings *settings = (ParticleSettings *)ptr->data; /* check for clipping */ - if (value > settings->end) + if (value > settings->end) { value = settings->end; + } /*if (settings->type==PART_REACTOR && value < 1.0) */ /* value = 1.0; */ /*else */ - if (value < MINAFRAMEF) + if (value < MINAFRAMEF) { value = MINAFRAMEF; + } settings->sta = value; } @@ -856,8 +878,9 @@ static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value) ParticleSettings *settings = (ParticleSettings *)ptr->data; /* check for clipping */ - if (value < settings->sta) + if (value < settings->sta) { value = settings->sta; + } settings->end = value; } @@ -995,8 +1018,9 @@ static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr) ParticleTarget *pt = psys->targets.first; for (; pt; pt = pt->next) { - if (pt->flag & PTARGET_CURRENT) + if (pt->flag & PTARGET_CURRENT) { return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt); + } } return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL); } @@ -1014,9 +1038,11 @@ static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr) ParticleTarget *pt = psys->targets.first; int i = 0; - for (; pt; pt = pt->next, i++) - if (pt->flag & PTARGET_CURRENT) + for (; pt; pt = pt->next, i++) { + if (pt->flag & PTARGET_CURRENT) { return i; + } + } return 0; } @@ -1028,10 +1054,12 @@ static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRN int i = 0; for (; pt; pt = pt->next, i++) { - if (i == value) + if (i == value) { pt->flag |= PTARGET_CURRENT; - else + } + else { pt->flag &= ~PTARGET_CURRENT; + } } } @@ -1042,24 +1070,29 @@ static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str) if (pt->flag & PTARGET_VALID) { ParticleSystem *psys = NULL; - if (pt->ob) + if (pt->ob) { psys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1); + } else { Object *ob = (Object *)ptr->id.data; psys = BLI_findlink(&ob->particlesystem, pt->psys - 1); } if (psys) { - if (pt->ob) + if (pt->ob) { sprintf(str, "%s: %s", pt->ob->id.name + 2, psys->name); - else + } + else { strcpy(str, psys->name); + } } - else + else { strcpy(str, "Invalid target!"); + } } - else + else { strcpy(str, "Invalid target!"); + } } static int rna_ParticleTarget_name_length(PointerRNA *ptr) @@ -1108,10 +1141,12 @@ static bool rna_ParticleSystem_edited_get(PointerRNA *ptr) { ParticleSystem *psys = (ParticleSystem *)ptr->data; - if (psys->part && psys->part->type == PART_HAIR) + if (psys->part && psys->part->type == PART_HAIR) { return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited)); - else + } + else { return (psys->pointcache->edit && psys->pointcache->edit->edited); + } } static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr) { @@ -1119,8 +1154,9 @@ static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr) ParticleDupliWeight *dw = part->instance_weights.first; for (; dw; dw = dw->next) { - if (dw->flag & PART_DUPLIW_CURRENT) + if (dw->flag & PART_DUPLIW_CURRENT) { return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw); + } } return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL); } @@ -1138,9 +1174,11 @@ static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr) ParticleDupliWeight *dw = part->instance_weights.first; int i = 0; - for (; dw; dw = dw->next, i++) - if (dw->flag & PART_DUPLIW_CURRENT) + for (; dw; dw = dw->next, i++) { + if (dw->flag & PART_DUPLIW_CURRENT) { return i; + } + } return 0; } @@ -1152,10 +1190,12 @@ static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int int i = 0; for (; dw; dw = dw->next, i++) { - if (i == value) + if (i == value) { dw->flag |= PART_DUPLIW_CURRENT; - else + } + else { dw->flag &= ~PART_DUPLIW_CURRENT; + } } } @@ -1166,10 +1206,12 @@ static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str) ParticleDupliWeight *dw = ptr->data; - if (dw->ob) + if (dw->ob) { sprintf(str, "%s: %i", dw->ob->id.name + 2, dw->count); - else + } + else { strcpy(str, "No object"); + } } static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr) @@ -1199,10 +1241,12 @@ static const EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), { ParticleSettings *part = ptr->id.data; - if (part->type == PART_HAIR) + if (part->type == PART_HAIR) { return part_hair_dist_items; - else + } + else { return part_dist_items; + } } static const EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), @@ -1212,10 +1256,12 @@ static const EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), { ParticleSettings *part = ptr->id.data; - if (part->type == PART_HAIR) + if (part->type == PART_HAIR) { return part_hair_draw_as_items; - else + } + else { return part_draw_as_items; + } } static const EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), @@ -1225,10 +1271,12 @@ static const EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), { ParticleSettings *part = ptr->id.data; - if (part->type == PART_HAIR) + if (part->type == PART_HAIR) { return part_hair_ren_as_items; - else + } + else { return part_ren_as_items; + } } static PointerRNA rna_Particle_field1_get(PointerRNA *ptr) @@ -1236,8 +1284,9 @@ static PointerRNA rna_Particle_field1_get(PointerRNA *ptr) ParticleSettings *part = (ParticleSettings *)ptr->id.data; /* weak */ - if (!part->pd) + if (!part->pd) { part->pd = BKE_partdeflect_new(0); + } return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd); } @@ -1247,8 +1296,9 @@ static PointerRNA rna_Particle_field2_get(PointerRNA *ptr) ParticleSettings *part = (ParticleSettings *)ptr->id.data; /* weak */ - if (!part->pd2) + if (!part->pd2) { part->pd2 = BKE_partdeflect_new(0); + } return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2); } @@ -1294,8 +1344,9 @@ static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int i else { int defgrp_index = defgroup_name_index(ob, value); - if (defgrp_index == -1) + if (defgrp_index == -1) { return; + } psys->vgroup[index] = defgrp_index + 1; } diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 3ab41f72322..b61b7a68963 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -345,20 +345,27 @@ static void rna_Itasc_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR bItasc *itasc = ptr->data; /* verify values */ - if (itasc->precision < 0.0001f) + if (itasc->precision < 0.0001f) { itasc->precision = 0.0001f; - if (itasc->minstep < 0.001f) + } + if (itasc->minstep < 0.001f) { itasc->minstep = 0.001f; - if (itasc->maxstep < itasc->minstep) + } + if (itasc->maxstep < itasc->minstep) { itasc->maxstep = itasc->minstep; - if (itasc->feedback < 0.01f) + } + if (itasc->feedback < 0.01f) { itasc->feedback = 0.01f; - if (itasc->feedback > 100.f) + } + if (itasc->feedback > 100.f) { itasc->feedback = 100.f; - if (itasc->maxvel < 0.01f) + } + if (itasc->maxvel < 0.01f) { itasc->maxvel = 0.01f; - if (itasc->maxvel > 100.f) + } + if (itasc->maxvel > 100.f) { itasc->maxvel = 100.f; + } BIK_update_param(ob->pose); DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); @@ -396,10 +403,12 @@ static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr) bPoseChannel *pchan = (bPoseChannel *)ptr->data; bActionGroup *grp; - if (pose) + if (pose) { grp = BLI_findlink(&pose->agroups, pchan->agrp_index - 1); - else + } + else { grp = NULL; + } return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, grp); } @@ -412,10 +421,12 @@ static void rna_PoseChannel_bone_group_set(PointerRNA *ptr, bPose *pose = (ob) ? ob->pose : NULL; bPoseChannel *pchan = (bPoseChannel *)ptr->data; - if (pose) + if (pose) { pchan->agrp_index = BLI_findindex(&pose->agroups, value.data) + 1; - else + } + else { pchan->agrp_index = 0; + } } static int rna_PoseChannel_bone_group_index_get(PointerRNA *ptr) @@ -484,10 +495,12 @@ static void rna_pose_bgroup_name_index_get(PointerRNA *ptr, char *value, int ind grp = BLI_findlink(&pose->agroups, index - 1); - if (grp) + if (grp) { BLI_strncpy(value, grp->name, sizeof(grp->name)); - else + } + else { value[0] = '\0'; + } } static int rna_pose_bgroup_name_index_length(PointerRNA *ptr, int index) @@ -667,14 +680,18 @@ static int rna_PoseChannel_location_editable(PointerRNA *ptr, int index) bPoseChannel *pchan = (bPoseChannel *)ptr->data; /* only if the axis in question is locked, not editable... */ - if ((index == 0) && (pchan->protectflag & OB_LOCK_LOCX)) + if ((index == 0) && (pchan->protectflag & OB_LOCK_LOCX)) { return 0; - else if ((index == 1) && (pchan->protectflag & OB_LOCK_LOCY)) + } + else if ((index == 1) && (pchan->protectflag & OB_LOCK_LOCY)) { return 0; - else if ((index == 2) && (pchan->protectflag & OB_LOCK_LOCZ)) + } + else if ((index == 2) && (pchan->protectflag & OB_LOCK_LOCZ)) { return 0; - else + } + else { return PROP_EDITABLE; + } } static int rna_PoseChannel_scale_editable(PointerRNA *ptr, int index) @@ -682,14 +699,18 @@ static int rna_PoseChannel_scale_editable(PointerRNA *ptr, int index) bPoseChannel *pchan = (bPoseChannel *)ptr->data; /* only if the axis in question is locked, not editable... */ - if ((index == 0) && (pchan->protectflag & OB_LOCK_SCALEX)) + if ((index == 0) && (pchan->protectflag & OB_LOCK_SCALEX)) { return 0; - else if ((index == 1) && (pchan->protectflag & OB_LOCK_SCALEY)) + } + else if ((index == 1) && (pchan->protectflag & OB_LOCK_SCALEY)) { return 0; - else if ((index == 2) && (pchan->protectflag & OB_LOCK_SCALEZ)) + } + else if ((index == 2) && (pchan->protectflag & OB_LOCK_SCALEZ)) { return 0; - else + } + else { return PROP_EDITABLE; + } } static int rna_PoseChannel_rotation_euler_editable(PointerRNA *ptr, int index) @@ -697,14 +718,18 @@ static int rna_PoseChannel_rotation_euler_editable(PointerRNA *ptr, int index) bPoseChannel *pchan = (bPoseChannel *)ptr->data; /* only if the axis in question is locked, not editable... */ - if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTX)) + if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTX)) { return 0; - else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTY)) + } + else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTY)) { return 0; - else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTZ)) + } + else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTZ)) { return 0; - else + } + else { return PROP_EDITABLE; + } } static int rna_PoseChannel_rotation_4d_editable(PointerRNA *ptr, int index) @@ -714,14 +739,18 @@ static int rna_PoseChannel_rotation_4d_editable(PointerRNA *ptr, int index) /* only consider locks if locking components individually... */ if (pchan->protectflag & OB_LOCK_ROT4D) { /* only if the axis in question is locked, not editable... */ - if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTW)) + if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTW)) { return 0; - else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTX)) + } + else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTX)) { return 0; - else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTY)) + } + else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTY)) { return 0; - else if ((index == 3) && (pchan->protectflag & OB_LOCK_ROTZ)) + } + else if ((index == 3) && (pchan->protectflag & OB_LOCK_ROTZ)) { return 0; + } } return PROP_EDITABLE; diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 2dc873ca17d..6c2cff96715 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -292,8 +292,9 @@ static void rna_RenderEngine_unregister(Main *bmain, StructRNA *type) { RenderEngineType *et = RNA_struct_blender_type_get(type); - if (!et) + if (!et) { return; + } RNA_struct_free_extension(type, &et->ext); RNA_struct_free(&BLENDER_RNA, type); @@ -322,8 +323,9 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, RNA_pointer_create(NULL, &RNA_RenderEngine, &dummyengine, &dummyptr); /* validate the python class */ - if (validate(&dummyptr, data, have_function) != 0) + if (validate(&dummyptr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(dummyet.idname)) { BKE_reportf(reports, @@ -337,8 +339,9 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, /* check if we have registered this engine type before, and remove it */ for (et = R_engines.first; et; et = et->next) { if (STREQ(et->idname, dummyet.idname)) { - if (et->ext.srna) + if (et->ext.srna) { rna_RenderEngine_unregister(bmain, et->ext.srna); + } break; } } diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 799705df2b4..cb6776c2c06 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -228,8 +228,9 @@ static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *scene, Point RigidBodyOb *rbo = (RigidBodyOb *)ptr->data; BKE_rigidbody_cache_reset(rbw); - if (rbo->shared->physics_shape) + if (rbo->shared->physics_shape) { rbo->flag |= RBO_FLAG_NEEDS_RESHAPE; + } } static char *rna_RigidBodyOb_path(PointerRNA *UNUSED(ptr)) @@ -328,10 +329,12 @@ static void rna_RigidBodyOb_collision_collections_set(PointerRNA *ptr, const boo int i; for (i = 0; i < 20; i++) { - if (values[i]) + if (values[i]) { rbo->col_groups |= (1 << i); - else + } + else { rbo->col_groups &= ~(1 << i); + } } rbo->flag |= RBO_FLAG_NEEDS_VALIDATE; } diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index b8d42397841..5dad1218307 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -199,10 +199,12 @@ static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data) /* function to skip any id properties that are already known by RNA, * for the second loop where we go over unknown id properties */ do { - for (prop = ptype->cont.properties.first; prop; prop = prop->next) + for (prop = ptype->cont.properties.first; prop; prop = prop->next) { if ((prop->flag_internal & PROP_INTERN_BUILTIN) == 0 && - STREQ(prop->identifier, idprop->name)) + STREQ(prop->identifier, idprop->name)) { return 1; + } + } } while ((ptype = ptype->base)); return 0; @@ -237,15 +239,18 @@ static void rna_inheritance_next_level_restart(CollectionPropertyIterator *iter, srna = (StructRNA *)iter->parent.data; iter->level--; - for (i = iter->level; i > 0; i--) + for (i = iter->level; i > 0; i--) { srna = srna->base; + } rna_iterator_listbase_end(iter); - if (funcs) + if (funcs) { rna_iterator_listbase_begin(iter, &srna->functions, skip); - else + } + else { rna_iterator_listbase_begin(iter, &srna->cont.properties, skip); + } } } @@ -382,10 +387,12 @@ void rna_builtin_properties_begin(CollectionPropertyIterator *iter, PointerRNA * newptr.type = &RNA_Struct; newptr.data = ptr->type; - if (ptr->type->flag & STRUCT_ID) + if (ptr->type->flag & STRUCT_ID) { newptr.id.data = ptr->data; - else + } + else { newptr.id.data = NULL; + } iter->parent = newptr; iter->builtin_parent = *ptr; @@ -970,20 +977,24 @@ static void rna_EnumPropertyItem_description_get(PointerRNA *ptr, char *value) { EnumPropertyItem *eprop = (EnumPropertyItem *)ptr->data; - if (eprop->description) + if (eprop->description) { strcpy(value, eprop->description); - else + } + else { value[0] = '\0'; + } } static int rna_EnumPropertyItem_description_length(PointerRNA *ptr) { EnumPropertyItem *eprop = (EnumPropertyItem *)ptr->data; - if (eprop->description) + if (eprop->description) { return strlen(eprop->description); - else + } + else { return 0; + } } static int rna_EnumPropertyItem_value_get(PointerRNA *ptr) @@ -1361,10 +1372,12 @@ int rna_property_override_diff_default(Main *bmain, } } - if (array_a != array_stack_a) + if (array_a != array_stack_a) { MEM_freeN(array_a); - if (array_b != array_stack_b) + } + if (array_b != array_stack_b) { MEM_freeN(array_b); + } return comp; } @@ -1424,10 +1437,12 @@ int rna_property_override_diff_default(Main *bmain, } } - if (array_a != array_stack_a) + if (array_a != array_stack_a) { MEM_freeN(array_a); - if (array_b != array_stack_b) + } + if (array_b != array_stack_b) { MEM_freeN(array_b); + } return comp; } @@ -1487,10 +1502,12 @@ int rna_property_override_diff_default(Main *bmain, } } - if (array_a != array_stack_a) + if (array_a != array_stack_a) { MEM_freeN(array_a); - if (array_b != array_stack_b) + } + if (array_b != array_stack_b) { MEM_freeN(array_b); + } return comp; } @@ -1570,10 +1587,12 @@ int rna_property_override_diff_default(Main *bmain, } } - if (value_a != fixed_a) + if (value_a != fixed_a) { MEM_freeN(value_a); - if (value_b != fixed_b) + } + if (value_b != fixed_b) { MEM_freeN(value_b); + } return comp; } @@ -1949,8 +1968,9 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), changed = true; RNA_property_int_set_array(ptr_storage, prop_storage, array_b); } - if (array_b != array_stack_b) + if (array_b != array_stack_b) { MEM_freeN(array_b); + } break; } default: @@ -1958,8 +1978,9 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), break; } - if (array_a != array_stack_a) + if (array_a != array_stack_a) { MEM_freeN(array_a); + } } else { const int value = RNA_PROPERTY_GET_SINGLE(int, ptr_reference, prop_reference, index); @@ -2037,8 +2058,9 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), changed = true; RNA_property_float_set_array(ptr_storage, prop_storage, array_b); } - if (array_b != array_stack_b) + if (array_b != array_stack_b) { MEM_freeN(array_b); + } break; } case IDOVERRIDESTATIC_OP_MULTIPLY: { @@ -2059,8 +2081,9 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), changed = true; RNA_property_float_set_array(ptr_storage, prop_storage, array_b); } - if (array_b != array_stack_b) + if (array_b != array_stack_b) { MEM_freeN(array_b); + } break; } default: @@ -2068,8 +2091,9 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), break; } - if (array_a != array_stack_a) + if (array_a != array_stack_a) { MEM_freeN(array_a); + } } else { const float value = RNA_PROPERTY_GET_SINGLE(float, ptr_reference, prop_reference, index); @@ -2175,8 +2199,9 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), return false; } - if (array_a != array_stack_a) + if (array_a != array_stack_a) { MEM_freeN(array_a); + } } else { const bool value = RNA_PROPERTY_GET_SINGLE(boolean, ptr_src, prop_src, index); @@ -2212,24 +2237,28 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), array_stack_b; RNA_property_int_get_array(ptr_storage, prop_storage, array_b); if (override_op == IDOVERRIDESTATIC_OP_ADD) { - for (int i = len_dst; i--;) + for (int i = len_dst; i--;) { array_a[i] += array_b[i]; + } } else { - for (int i = len_dst; i--;) + for (int i = len_dst; i--;) { array_a[i] -= array_b[i]; + } } RNA_property_int_set_array(ptr_dst, prop_dst, array_a); - if (array_b != array_stack_b) + if (array_b != array_stack_b) { MEM_freeN(array_b); + } break; default: BLI_assert(0 && "Unsupported RNA override operation on integer"); return false; } - if (array_a != array_stack_a) + if (array_a != array_stack_a) { MEM_freeN(array_a); + } } else { const int storage_value = ptr_storage ? RNA_PROPERTY_GET_SINGLE( @@ -2288,28 +2317,33 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), array_stack_b; RNA_property_float_get_array(ptr_storage, prop_storage, array_b); if (override_op == IDOVERRIDESTATIC_OP_ADD) { - for (int i = len_dst; i--;) + for (int i = len_dst; i--;) { array_a[i] += array_b[i]; + } } else if (override_op == IDOVERRIDESTATIC_OP_SUBTRACT) { - for (int i = len_dst; i--;) + for (int i = len_dst; i--;) { array_a[i] -= array_b[i]; + } } else { - for (int i = len_dst; i--;) + for (int i = len_dst; i--;) { array_a[i] *= array_b[i]; + } } RNA_property_float_set_array(ptr_dst, prop_dst, array_a); - if (array_b != array_stack_b) + if (array_b != array_stack_b) { MEM_freeN(array_b); + } break; default: BLI_assert(0 && "Unsupported RNA override operation on float"); return false; } - if (array_a != array_stack_a) + if (array_a != array_stack_a) { MEM_freeN(array_a); + } } else { const float storage_value = ptr_storage ? RNA_PROPERTY_GET_SINGLE( @@ -2394,8 +2428,9 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), return false; } - if (value != buff) + if (value != buff) { MEM_freeN(value); + } return true; } case PROP_COLLECTION: { diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index a4b305d36ae..f101a29ec22 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -781,11 +781,13 @@ static void rna_Scene_set_set(PointerRNA *ptr, Scene *nested_set; for (nested_set = set; nested_set; nested_set = nested_set->set) { - if (nested_set == scene) + if (nested_set == scene) { return; + } /* prevent eternal loops, set can point to next, and next to set, without problems usually */ - if (nested_set->set == set) + if (nested_set->set == set) { return; + } } id_lib_extern((ID *)set); @@ -831,8 +833,9 @@ static void rna_Scene_volume_set(PointerRNA *ptr, float value) Scene *scene = (Scene *)(ptr->data); scene->audio.volume = value; - if (scene->sound_scene) + if (scene->sound_scene) { BKE_sound_set_scene_volume(scene, value); + } } static const char *rna_Scene_statistics_string_get(Scene *scene, @@ -914,8 +917,9 @@ static void rna_Scene_use_preview_range_set(PointerRNA *ptr, bool value) data->r.flag |= SCER_PRV_RANGE; } - else + else { data->r.flag &= ~SCER_PRV_RANGE; + } } static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value) @@ -1011,10 +1015,12 @@ static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, Poi /* start going over the scene KeyingSets first, while we still have pointer to it * but only if we have any Keying Sets to use... */ - if (scene->keyingsets.first) + if (scene->keyingsets.first) { rna_iterator_listbase_begin(iter, &scene->keyingsets, NULL); - else + } + else { rna_iterator_listbase_begin(iter, &builtin_keyingsets, NULL); + } } static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter) @@ -1024,10 +1030,12 @@ static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter) /* If we've run out of links in Scene list, * jump over to the builtins list unless we're there already. */ - if ((ks->next == NULL) && (ks != builtin_keyingsets.last)) + if ((ks->next == NULL) && (ks != builtin_keyingsets.last)) { internal->link = (Link *)builtin_keyingsets.first; - else + } + else { internal->link = (Link *)ks->next; + } iter->valid = (internal->link != NULL); } @@ -1123,10 +1131,12 @@ static int rna_RenderSettings_threads_mode_get(PointerRNA *ptr) RenderData *rd = (RenderData *)ptr->data; int override = BLI_system_num_threads_override_get(); - if (override > 0) + if (override > 0) { return R_FIXED_THREADS; - else + } + else { return (rd->mode & R_FIXED_THREADS); + } } static bool rna_RenderSettings_is_movie_format_get(PointerRNA *ptr) @@ -1227,8 +1237,9 @@ static const EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext Scene *scene = ptr->id.data; RenderData *rd = &scene->r; - if (BKE_ffmpeg_alpha_channel_is_supported(rd)) + if (BKE_ffmpeg_alpha_channel_is_supported(rd)) { chan_flag |= IMA_CHAN_FLAG_ALPHA; + } } # endif @@ -1239,12 +1250,15 @@ static const EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext int totitem = 0; EnumPropertyItem *item = NULL; - if (chan_flag & IMA_CHAN_FLAG_BW) + if (chan_flag & IMA_CHAN_FLAG_BW) { RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW); - if (chan_flag & IMA_CHAN_FLAG_RGB) + } + if (chan_flag & IMA_CHAN_FLAG_RGB) { RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB); - if (chan_flag & IMA_CHAN_FLAG_ALPHA) + } + if (chan_flag & IMA_CHAN_FLAG_ALPHA) { RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA); + } RNA_enum_item_end(&item, &totitem); *r_free = true; @@ -1351,8 +1365,9 @@ static const EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf(bContext EnumPropertyItem *item = NULL; int i = 1, totitem = 0; - if (imf->depth == 16) + if (imf->depth == 16) { return rna_enum_exr_codec_items; /* All compression types are defined for halfs */ + } for (i = 0; i < R_IMF_EXR_CODEC_MAX; i++) { if ((i == R_IMF_EXR_CODEC_B44 || i == R_IMF_EXR_CODEC_B44A)) { @@ -1391,10 +1406,12 @@ static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, bool value) Scene *scene = (Scene *)ptr->id.data; RenderData *rd = &scene->r; - if (value) + if (value) { rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT; - else + } + else { rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT; + } BKE_ffmpeg_codec_settings_verify(rd); } @@ -1446,8 +1463,9 @@ static void rna_RenderSettings_active_view_set(PointerRNA *ptr, RenderData *rd = (RenderData *)ptr->data; SceneRenderView *srv = (SceneRenderView *)value.data; const int index = BLI_findindex(&rd->views, srv); - if (index != -1) + if (index != -1) { rd->actview = index; + } } static SceneRenderView *rna_RenderView_new(ID *id, RenderData *UNUSED(rd), const char *name) @@ -1486,8 +1504,9 @@ static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value) if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW && value == SCE_VIEWS_FORMAT_STEREO_3D) { /* make sure the actview is visible */ - if (rd->actview > 1) + if (rd->actview > 1) { rd->actview = 1; + } } rd->views_format = value; @@ -1533,9 +1552,11 @@ static int rna_RenderSettings_engine_get(PointerRNA *ptr) RenderEngineType *type; int a = 0; - for (type = R_engines.first; type; type = type->next, a++) - if (STREQ(type->idname, rd->engine)) + for (type = R_engines.first; type; type = type->next, a++) { + if (STREQ(type->idname, rd->engine)) { return a; + } + } return 0; } @@ -1622,8 +1643,9 @@ void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; - if (scene->nodetree) + if (scene->nodetree) { ntreeCompositUpdateRLayers(scene->nodetree); + } rna_Scene_glsl_update(bmain, activescene, ptr); } @@ -1686,8 +1708,9 @@ static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSE if (view_layer->basact) { me = BKE_mesh_from_object(view_layer->basact->object); - if (me && me->edit_mesh == NULL) + if (me && me->edit_mesh == NULL) { me = NULL; + } } if (me) { @@ -1716,14 +1739,16 @@ static void object_simplify_update(Object *ob) } } - for (psys = ob->particlesystem.first; psys; psys = psys->next) + for (psys = ob->particlesystem.first; psys; psys = psys->next) { psys->recalc |= ID_RECALC_PSYS_CHILD; + } if (ob->instance_collection) { CollectionObject *cob; - for (cob = ob->instance_collection->gobject.first; cob; cob = cob->next) + for (cob = ob->instance_collection->gobject.first; cob; cob = cob->next) { object_simplify_update(cob->ob); + } } } @@ -1752,8 +1777,9 @@ static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr { Scene *sce = ptr->id.data; - if (sce->r.mode & R_SIMPLIFY) + if (sce->r.mode & R_SIMPLIFY) { rna_Scene_use_simplify_update(bmain, scene, ptr); + } } static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain), @@ -1762,8 +1788,9 @@ static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain), { Scene *sce = ptr->id.data; - if (!(sce->r.mode & R_PERSISTENT_DATA)) + if (!(sce->r.mode & R_PERSISTENT_DATA)) { RE_FreePersistentData(); + } } /* Scene.transform_orientation_slots */ @@ -1792,10 +1819,12 @@ static void rna_Scene_use_audio_set(PointerRNA *ptr, bool value) { Scene *scene = (Scene *)ptr->data; - if (value) + if (value) { scene->audio.flag |= AUDIO_MUTE; - else + } + else { scene->audio.flag &= ~AUDIO_MUTE; + } BKE_sound_mute_scene(scene, value); } @@ -1803,8 +1832,9 @@ static void rna_Scene_use_audio_set(PointerRNA *ptr, bool value) static int rna_Scene_sync_mode_get(PointerRNA *ptr) { Scene *scene = (Scene *)ptr->data; - if (scene->audio.flag & AUDIO_SYNC) + if (scene->audio.flag & AUDIO_SYNC) { return AUDIO_SYNC; + } return scene->flag & SCE_FRAME_DROP; } @@ -1986,8 +2016,9 @@ static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr)) if (view_layer->basact) { me = BKE_mesh_from_object(view_layer->basact->object); - if (me && me->edit_mesh == NULL) + if (me && me->edit_mesh == NULL) { me = NULL; + } } if (me) { @@ -2052,8 +2083,9 @@ void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, { FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data; - if (lineset->linestyle) + if (lineset->linestyle) { id_us_min(&lineset->linestyle->id); + } lineset->linestyle = (FreestyleLineStyle *)value.data; id_us_plus(&lineset->linestyle->id); } @@ -2139,13 +2171,15 @@ void rna_FreestyleSettings_module_remove(ID *id, FreestyleModuleConfig *module = module_ptr->data; if (!BKE_freestyle_module_delete((FreestyleConfig *)config, module)) { - if (module->script) + if (module->script) { BKE_reportf(reports, RPT_ERROR, "Style module '%s' could not be removed", module->script->id.name + 2); - else + } + else { BKE_report(reports, RPT_ERROR, "Style module could not be removed"); + } return; } @@ -2164,8 +2198,9 @@ static void rna_Stereo3dFormat_update(Main *bmain, Scene *UNUSED(scene), Pointer ImBuf *ibuf; void *lock; - if (!BKE_image_is_stereo(ima)) + if (!BKE_image_is_stereo(ima)) { return; + } ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 1d4d2e9cdd9..bea22d465a9 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -122,8 +122,9 @@ static void rna_SceneRender_get_frame_path( const char *suffix = BKE_scene_multiview_view_suffix_get(rd, view); /* avoid NULL pointer */ - if (!suffix) + if (!suffix) { suffix = ""; + } if (BKE_imtype_is_movie(rd->im_format.imtype)) { BKE_movie_filepath_get(name, rd, preview != 0, suffix); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 9c349d64953..6856d877fff 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -277,10 +277,12 @@ static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float re static void rna_View2D_view_to_region( struct View2D *v2d, float x, float y, bool clip, int result[2]) { - if (clip) + if (clip) { UI_view2d_view_to_region_clip(v2d, x, y, &result[0], &result[1]); - else + } + else { UI_view2d_view_to_region(v2d, x, y, &result[0], &result[1]); + } } #else diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 2791c49b3d9..3f72644448b 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -220,11 +220,13 @@ static void rna_ParticleEdit_redo(bContext *C, PointerRNA *UNUSED(ptr)) Object *ob = OBACT(view_layer); PTCacheEdit *edit = PE_get_current(scene, ob); - if (!edit) + if (!edit) { return; + } - if (ob) + if (ob) { DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); + } BKE_particle_batch_cache_dirty_tag(edit->psys, BKE_PARTICLE_BATCH_DIRTY_ALL); psys_free_path_cache(edit->psys, edit); @@ -236,8 +238,9 @@ static void rna_ParticleEdit_update(bContext *C, PointerRNA *UNUSED(ptr)) ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob = OBACT(view_layer); - if (ob) + if (ob) { DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); + } /* Sync tool setting changes from original to evaluated scenes. */ DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_COPY_ON_WRITE); @@ -420,8 +423,9 @@ static void rna_Sculpt_ShowDiffuseColor_update(bContext *C, PointerRNA *UNUSED(p Sculpt *sd = scene->toolsettings->sculpt; ob->sculpt->show_diffuse_color = ((sd->flags & SCULPT_SHOW_DIFFUSE) != 0); - if (ob->sculpt->pbvh) + if (ob->sculpt->pbvh) { pbvh_show_diffuse_color_set(ob->sculpt->pbvh, ob->sculpt->show_diffuse_color); + } DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob); @@ -547,8 +551,9 @@ static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr)) if (slink->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)slink; - if (!sima->pin) + if (!sima->pin) { ED_space_image_set(bmain, sima, obedit, ima, true); + } } } } @@ -571,12 +576,14 @@ static PointerRNA rna_GPencilSculptSettings_brush_get(PointerRNA *ptr) GP_Sculpt_Data *brush = NULL; if ((gset) && (gset->flag & GP_SCULPT_SETT_FLAG_WEIGHT_MODE)) { - if ((gset->weighttype >= GP_SCULPT_TYPE_WEIGHT) && (gset->weighttype < GP_SCULPT_TYPE_MAX)) + if ((gset->weighttype >= GP_SCULPT_TYPE_WEIGHT) && (gset->weighttype < GP_SCULPT_TYPE_MAX)) { brush = &gset->brush[gset->weighttype]; + } } else { - if ((gset->brushtype >= 0) && (gset->brushtype < GP_SCULPT_TYPE_WEIGHT)) + if ((gset->brushtype >= 0) && (gset->brushtype < GP_SCULPT_TYPE_WEIGHT)) { brush = &gset->brush[gset->brushtype]; + } } return rna_pointer_inherit_refine(ptr, &RNA_GPencilSculptBrush, brush); } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 5a80dc5fe8c..29a06eeabf2 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -179,10 +179,12 @@ static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *it ListBaseIterator *internal = &iter->internal.listbase; Sequence *seq = (Sequence *)internal->link; - if (seq->seqbase.first) + if (seq->seqbase.first) { internal->link = (Link *)seq->seqbase.first; - else if (seq->next) + } + else if (seq->next) { internal->link = (Link *)seq->next; + } else { internal->link = NULL; @@ -547,9 +549,10 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) BKE_animdata_fix_paths_rename_all(NULL, "sequence_editor.sequences_all", oldname, seq->name + 2); # endif adt = BKE_animdata_from_id(&scene->id); - if (adt) + if (adt) { BKE_animdata_fix_paths_rename( &scene->id, adt, NULL, "sequence_editor.sequences_all", oldname, seq->name + 2, 0, 0, 1); + } } static StructRNA *rna_Sequence_refine(struct PointerRNA *ptr) @@ -729,9 +732,10 @@ static void rna_Sequence_volume_set(PointerRNA *ptr, float value) Sequence *seq = (Sequence *)(ptr->data); seq->volume = value; - if (seq->scene_sound) + if (seq->scene_sound) { BKE_sound_set_scene_sound_volume( seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0); + } } static void rna_Sequence_pitch_set(PointerRNA *ptr, float value) @@ -739,9 +743,10 @@ static void rna_Sequence_pitch_set(PointerRNA *ptr, float value) Sequence *seq = (Sequence *)(ptr->data); seq->pitch = value; - if (seq->scene_sound) + if (seq->scene_sound) { BKE_sound_set_scene_sound_pitch( seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0); + } } static void rna_Sequence_pan_set(PointerRNA *ptr, float value) @@ -749,9 +754,10 @@ static void rna_Sequence_pan_set(PointerRNA *ptr, float value) Sequence *seq = (Sequence *)(ptr->data); seq->pan = value; - if (seq->scene_sound) + if (seq->scene_sound) { BKE_sound_set_scene_sound_pan( seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0); + } } static int rna_Sequence_input_count_get(PointerRNA *ptr) @@ -787,8 +793,9 @@ static void rna_Sequence_reopen_files_update(Main *bmain, Scene *UNUSED(scene), BKE_sequencer_free_imbuf(scene, &ed->seqbase, false); rna_Sequence_invalidate_raw_update(bmain, scene, ptr); - if (RNA_struct_is_a(ptr->type, &RNA_SoundSequence)) + if (RNA_struct_is_a(ptr->type, &RNA_SoundSequence)) { BKE_sequencer_update_sound_bounds(scene, ptr->data); + } } static void rna_Sequence_mute_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -937,8 +944,9 @@ static char *rna_SequenceColorBalance_path(PointerRNA *ptr) name_esc_smd); } } - else + else { return BLI_strdup(""); + } } static void rna_SequenceColorBalance_update(Main *UNUSED(bmain), @@ -958,8 +966,9 @@ static void rna_SequenceEditor_overlay_lock_set(PointerRNA *ptr, bool value) Scene *scene = ptr->id.data; Editing *ed = BKE_sequencer_editing_get(scene, false); - if (ed == NULL) + if (ed == NULL) { return; + } /* convert from abs to relative and back */ if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) == 0 && value) { @@ -977,13 +986,16 @@ static int rna_SequenceEditor_overlay_frame_get(PointerRNA *ptr) Scene *scene = (Scene *)ptr->id.data; Editing *ed = BKE_sequencer_editing_get(scene, false); - if (ed == NULL) + if (ed == NULL) { return scene->r.cfra; + } - if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS) + if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS) { return ed->over_cfra - scene->r.cfra; - else + } + else { return ed->over_ofs; + } } static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value) @@ -991,13 +1003,16 @@ static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value) Scene *scene = (Scene *)ptr->id.data; Editing *ed = BKE_sequencer_editing_get(scene, false); - if (ed == NULL) + if (ed == NULL) { return; + } - if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS) + if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS) { ed->over_cfra = (scene->r.cfra + value); - else + } + else { ed->over_ofs = value; + } } static int modifier_seq_cmp_cb(Sequence *seq, void *arg_pt) @@ -2086,7 +2101,8 @@ static void rna_def_effect_inputs(StructRNA *srna, int count) } # if 0 - if (count == 3) { // not used by any effects (perhaps one day plugins?) + if (count == 3) { + /* Not used by any effects (perhaps one day plugins?). */ prop = RNA_def_property(srna, "input_3", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "seq3"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 9b22a87cdb9..a50f01afd78 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -70,8 +70,9 @@ static void rna_Sequence_swap_internal(Sequence *seq_self, { const char *error_msg; - if (BKE_sequence_swap(seq_self, seq_other, &error_msg) == 0) + if (BKE_sequence_swap(seq_self, seq_other, &error_msg) == 0) { BKE_report(reports, RPT_ERROR, error_msg); + } } static Sequence *alloc_generic_sequence( @@ -404,11 +405,13 @@ static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, seq->len--; se = seq->strip->stripdata; - if (index > 0) + if (index > 0) { memcpy(new_seq, se, sizeof(StripElem) * index); + } - if (index < seq->len) + if (index < seq->len) { memcpy(&new_seq[index], &se[index + 1], sizeof(StripElem) * (seq->len - index)); + } MEM_freeN(seq->strip->stripdata); seq->strip->stripdata = new_seq; diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index f4fba02efe5..5c04802ac3c 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -67,8 +67,9 @@ static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *p static void rna_Smoke_resetCache(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data; - if (settings->smd && settings->smd->domain) + if (settings->smd && settings->smd->domain) { settings->point_cache[0]->flag |= PTCACHE_OUTDATED; + } DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY); } @@ -103,8 +104,9 @@ static void rna_Smoke_reset_dependency(Main *bmain, Scene *scene, PointerRNA *pt smokeModifier_reset(settings->smd); - if (settings->smd && settings->smd->domain) + if (settings->smd && settings->smd->domain) { settings->smd->domain->point_cache[0]->flag |= PTCACHE_OUTDATED; + } rna_Smoke_dependency_update(bmain, scene, ptr); } @@ -236,10 +238,12 @@ static void rna_SmokeModifier_density_grid_get(PointerRNA *ptr, float *values) BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); - if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) + if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) { density = smoke_turbulence_get_density(sds->wt); - else + } + else { density = smoke_get_density(sds->fluid); + } memcpy(values, density, size * sizeof(float)); @@ -290,16 +294,20 @@ static void rna_SmokeModifier_color_grid_get(PointerRNA *ptr, float *values) } else { if (sds->flags & MOD_SMOKE_HIGHRES) { - if (smoke_turbulence_has_colors(sds->wt)) + if (smoke_turbulence_has_colors(sds->wt)) { smoke_turbulence_get_rgba(sds->wt, values, 0); - else + } + else { smoke_turbulence_get_rgba_from_density(sds->wt, sds->active_color, values, 0); + } } else { - if (smoke_has_colors(sds->fluid)) + if (smoke_has_colors(sds->fluid)) { smoke_get_rgba(sds->fluid, values, 0); - else + } + else { smoke_get_rgba_from_density(sds->fluid, sds->active_color, values, 0); + } } } @@ -319,15 +327,19 @@ static void rna_SmokeModifier_flame_grid_get(PointerRNA *ptr, float *values) BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); - if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) + if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) { flame = smoke_turbulence_get_flame(sds->wt); - else + } + else { flame = smoke_get_flame(sds->fluid); + } - if (flame) + if (flame) { memcpy(values, flame, size * sizeof(float)); - else + } + else { memset(values, 0, size * sizeof(float)); + } BLI_rw_mutex_unlock(sds->fluid_mutex); # else diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 736e387a986..7437a24f65e 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -46,10 +46,12 @@ static bool rna_Sound_caching_get(PointerRNA *ptr) static void rna_Sound_caching_set(PointerRNA *ptr, const bool value) { bSound *sound = (bSound *)(ptr->data); - if (value) + if (value) { BKE_sound_cache(sound); - else + } + else { BKE_sound_delete_cache(sound); + } } static void rna_Sound_caching_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 91c6ec6f456..ac658533617 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -870,8 +870,9 @@ static void rna_RegionView3D_quadview_update(Main *UNUSED(main), ARegion *ar; rna_area_region_from_regiondata(ptr, &sa, &ar); - if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT) + if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT) { ED_view3d_quadview_update(sa, ar, false); + } } /* same as above but call clip==true */ @@ -883,8 +884,9 @@ static void rna_RegionView3D_quadview_clip_update(Main *UNUSED(main), ARegion *ar; rna_area_region_from_regiondata(ptr, &sa, &ar); - if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT) + if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT) { ED_view3d_quadview_update(sa, ar, true); + } } static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values) @@ -1221,10 +1223,12 @@ static const EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf(bContext *C { Scene *scene = CTX_data_scene(C); - if (scene->r.views_format == SCE_VIEWS_FORMAT_MULTIVIEW) + if (scene->r.views_format == SCE_VIEWS_FORMAT_MULTIVIEW) { return multiview_camera_items; - else + } + else { return stereo3d_camera_items; + } } static int rna_SpaceView3D_icon_from_show_object_viewport_get(PointerRNA *ptr) @@ -1269,10 +1273,12 @@ static void rna_SpaceImageEditor_show_stereo_set(PointerRNA *ptr, int value) { SpaceImage *sima = (SpaceImage *)(ptr->data); - if (value) + if (value) { sima->iuser.flag |= IMA_SHOW_STEREO; - else + } + else { sima->iuser.flag &= ~IMA_SHOW_STEREO; + } } static bool rna_SpaceImageEditor_show_stereo_get(PointerRNA *ptr) @@ -1368,8 +1374,9 @@ static const EnumPropertyItem *rna_SpaceImageEditor_display_channels_itemf( ED_space_image_release_buffer(sima, ibuf, lock); - if (alpha && zbuf) + if (alpha && zbuf) { return display_channels_items; + } if (alpha) { RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_USE_ALPHA); @@ -1495,10 +1502,12 @@ static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(bContext *UNUSED SpaceImage *sima = (SpaceImage *)ptr->data; - if (sima->mode == SI_MODE_PAINT) + if (sima->mode == SI_MODE_PAINT) { return rna_enum_transform_pivot_items_full; - else + } + else { return pivot_items; + } } /* Space Text Editor */ @@ -1528,8 +1537,9 @@ static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), { SpaceText *st = (SpaceText *)ptr->data; - if (st->text) + if (st->text) { WM_main_add_notifier(NC_TEXT | NA_EDITED, st->text); + } } /* Space Properties */ @@ -1547,8 +1557,9 @@ static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr) { SpaceProperties *sbuts = (SpaceProperties *)(ptr->data); - if (sbuts->pinid) + if (sbuts->pinid) { return ID_code_to_RNA_type(GS(sbuts->pinid->name)); + } return &RNA_ID; } @@ -1724,8 +1735,10 @@ static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value) memcpy(ci->line, value, len + 1); ci->len = len; - if (ci->cursor > len) /* clamp the cursor */ + if (ci->cursor > len) { + /* clamp the cursor */ ci->cursor = len; + } } static void rna_ConsoleLine_cursor_index_range( @@ -1754,23 +1767,27 @@ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, /* action to set must strictly meet the mode criteria... */ if (saction->mode == SACTCONT_ACTION) { /* currently, this is "object-level" only, until we have some way of specifying this */ - if (act->idroot == ID_OB) + if (act->idroot == ID_OB) { saction->action = act; - else + } + else { printf( "ERROR: cannot assign Action '%s' to Action Editor, as action is not object-level " "animation\n", act->id.name + 2); + } } else if (saction->mode == SACTCONT_SHAPEKEY) { /* as the name says, "shapekey-level" only... */ - if (act->idroot == ID_KE) + if (act->idroot == ID_KE) { saction->action = act; - else + } + else { printf( "ERROR: cannot assign Action '%s' to Shape Key Editor, as action doesn't animate " "Shape Keys\n", act->id.name + 2); + } } else { printf( @@ -1797,8 +1814,9 @@ static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr) } else if (saction->mode == SACTCONT_SHAPEKEY) { Key *key = BKE_key_from_object(obact); - if (key) + if (key) { adt = BKE_animdata_add_id(&key->id); /* this only adds if non-existent */ + } } /* set action */ @@ -1870,10 +1888,12 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr) Key *key = BKE_key_from_object(obact); /* 1) update the action stored for the editor */ - if (key) + if (key) { saction->action = (key->adt) ? key->adt->action : NULL; - else + } + else { saction->action = NULL; + } /* 2) enable 'show sliders' by default, since one of the main * points of the ShapeKey Editor is to provide a one-stop shop @@ -1885,10 +1905,12 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr) else if (saction->mode == SACTCONT_ACTION) { /* 1) update the action stored for the editor */ /* TODO: context selector could help decide this with more control? */ - if (obact) + if (obact) { saction->action = (obact->adt) ? obact->adt->action : NULL; - else + } + else { saction->action = NULL; + } } /* Collapse (and show) summary channel and hide channel list for timeline */ @@ -1998,10 +2020,12 @@ static void rna_SpaceNodeEditor_tree_type_set(PointerRNA *ptr, int value) static bool rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type) { bContext *C = (bContext *)Cv; - if (type->poll) + if (type->poll) { return type->poll(C, type); - else + } + else { return true; + } } const EnumPropertyItem *RNA_enum_node_tree_types_itemf_impl(bContext *C, bool *r_free) diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index 589f7818b68..454367b5233 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -41,10 +41,12 @@ static void rna_Text_filename_get(PointerRNA *ptr, char *value) { Text *text = (Text *)ptr->data; - if (text->name) + if (text->name) { strcpy(value, text->name); - else + } + else { value[0] = '\0'; + } } static int rna_Text_filename_length(PointerRNA *ptr) @@ -57,13 +59,16 @@ static void rna_Text_filename_set(PointerRNA *ptr, const char *value) { Text *text = (Text *)ptr->data; - if (text->name) + if (text->name) { MEM_freeN(text->name); + } - if (value[0]) + if (value[0]) { text->name = BLI_strdup(value); - else + } + else { text->name = NULL; + } } static bool rna_Text_modified_get(PointerRNA *ptr) @@ -88,10 +93,12 @@ static void rna_TextLine_body_get(PointerRNA *ptr, char *value) { TextLine *line = (TextLine *)ptr->data; - if (line->line) + if (line->line) { strcpy(value, line->line); - else + } + else { value[0] = '\0'; + } } static int rna_TextLine_body_length(PointerRNA *ptr) @@ -105,8 +112,9 @@ static void rna_TextLine_body_set(PointerRNA *ptr, const char *value) TextLine *line = (TextLine *)ptr->data; int len = strlen(value); - if (line->line) + if (line->line) { MEM_freeN(line->line); + } line->line = MEM_mallocN((len + 1) * sizeof(char), "rna_text_body"); line->len = len; diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 1271eef02af..28d2d722460 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -266,10 +266,12 @@ void rna_TextureSlot_update(bContext *C, PointerRNA *ptr) MTex *mtex = ptr->data; int recalc = ID_RECALC_GEOMETRY; - if (mtex->mapto & PAMAP_INIT) + if (mtex->mapto & PAMAP_INIT) { recalc |= ID_RECALC_PSYS_RESET; - if (mtex->mapto & PAMAP_CHILD) + } + if (mtex->mapto & PAMAP_CHILD) { recalc |= ID_RECALC_PSYS_CHILD; + } DEG_id_tag_update(id, recalc); WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); @@ -327,8 +329,9 @@ static int rna_TextureSlot_name_length(PointerRNA *ptr) { MTex *mtex = ptr->data; - if (mtex->tex) + if (mtex->tex) { return strlen(mtex->tex->id.name + 2); + } return 0; } @@ -337,10 +340,12 @@ static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str) { MTex *mtex = ptr->data; - if (mtex->tex) + if (mtex->tex) { strcpy(str, mtex->tex->id.name + 2); - else + } + else { str[0] = '\0'; + } } static int rna_TextureSlot_output_node_get(PointerRNA *ptr) @@ -355,8 +360,9 @@ static int rna_TextureSlot_output_node_get(PointerRNA *ptr) if (ntree) { for (node = ntree->nodes.first; node; node = node->next) { if (node->type == TEX_NODE_OUTPUT) { - if (cur == node->custom1) + if (cur == node->custom1) { return cur; + } } } } @@ -408,13 +414,16 @@ static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, bool value) { Tex *tex = (Tex *)ptr->data; - if (value) + if (value) { tex->flag |= TEX_COLORBAND; - else + } + else { tex->flag &= ~TEX_COLORBAND; + } - if ((tex->flag & TEX_COLORBAND) && tex->coba == NULL) + if ((tex->flag & TEX_COLORBAND) && tex->coba == NULL) { tex->coba = BKE_colorband_add(false); + } } static void rna_Texture_use_nodes_update(bContext *C, PointerRNA *ptr) @@ -424,8 +433,9 @@ static void rna_Texture_use_nodes_update(bContext *C, PointerRNA *ptr) if (tex->use_nodes) { tex->type = 0; - if (tex->nodetree == NULL) + if (tex->nodetree == NULL) { ED_node_texture_default(C, tex); + } } rna_Texture_nodes_update(CTX_data_main(C), CTX_data_scene(C), ptr); @@ -435,10 +445,12 @@ static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, bool value) { Tex *tex = (Tex *)ptr->data; - if (value) + if (value) { tex->imaflag |= TEX_MIPMAP; - else + } + else { tex->imaflag &= ~TEX_MIPMAP; + } } #else diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index d08f7bc6035..83e4766c57d 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -65,8 +65,9 @@ static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain), MovieTracking *tracking = &clip->tracking; MovieTrackingSettings *settings = &tracking->settings; - if (settings->default_search_size < settings->default_pattern_size) + if (settings->default_search_size < settings->default_pattern_size) { settings->default_search_size = settings->default_pattern_size; + } } static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), @@ -77,8 +78,9 @@ static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), MovieTracking *tracking = &clip->tracking; MovieTrackingSettings *settings = &tracking->settings; - if (settings->default_pattern_size > settings->default_search_size) + if (settings->default_pattern_size > settings->default_search_size) { settings->default_pattern_size = settings->default_search_size; + } } static char *rna_trackingTrack_path(PointerRNA *ptr) @@ -153,10 +155,12 @@ static void rna_tracking_active_track_set(PointerRNA *ptr, ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking); int index = BLI_findindex(tracksbase, track); - if (index != -1) + if (index != -1) { clip->tracking.act_track = track; - else + } + else { clip->tracking.act_track = NULL; + } } static PointerRNA rna_tracking_active_plane_track_get(PointerRNA *ptr) @@ -176,10 +180,12 @@ static void rna_tracking_active_plane_track_set(PointerRNA *ptr, ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(&clip->tracking); int index = BLI_findindex(plane_tracks_base, plane_track); - if (index != -1) + if (index != -1) { clip->tracking.act_plane_track = plane_track; - else + } + else { clip->tracking.act_plane_track = NULL; + } } static void rna_trackingTrack_name_set(PointerRNA *ptr, const char *value) @@ -305,8 +311,9 @@ static float rna_trackingCamera_focal_mm_get(PointerRNA *ptr) MovieTrackingCamera *camera = &clip->tracking.camera; float val = camera->focal; - if (clip->lastsize[0]) + if (clip->lastsize[0]) { val = val * camera->sensor_width / (float)clip->lastsize[0]; + } return val; } @@ -316,11 +323,13 @@ static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value) MovieClip *clip = (MovieClip *)ptr->id.data; MovieTrackingCamera *camera = &clip->tracking.camera; - if (clip->lastsize[0]) + if (clip->lastsize[0]) { value = clip->lastsize[0] * value / camera->sensor_width; + } - if (value >= 0.0001f) + if (value >= 0.0001f) { camera->focal = value; + } } static char *rna_trackingStabilization_path(PointerRNA *UNUSED(ptr)) @@ -332,8 +341,9 @@ static int rna_track_2d_stabilization(CollectionPropertyIterator *UNUSED(iter), { MovieTrackingTrack *track = (MovieTrackingTrack *)data; - if ((track->flag & TRACK_USE_2D_STAB) == 0) + if ((track->flag & TRACK_USE_2D_STAB) == 0) { return 1; + } return 0; } @@ -343,8 +353,9 @@ static int rna_track_2d_stabilization_rotation(CollectionPropertyIterator *UNUSE { MovieTrackingTrack *track = (MovieTrackingTrack *)data; - if ((track->flag & TRACK_USE_2D_STAB_ROT) == 0) + if ((track->flag & TRACK_USE_2D_STAB_ROT) == 0) { return 1; + } return 0; } @@ -488,10 +499,12 @@ static void rna_tracking_active_object_set(PointerRNA *ptr, MovieTrackingObject *object = (MovieTrackingObject *)value.data; int index = BLI_findindex(&clip->tracking.objects, object); - if (index != -1) + if (index != -1) { clip->tracking.objectnr = index; - else + } + else { clip->tracking.objectnr = 0; + } } static void rna_trackingObject_name_set(PointerRNA *ptr, const char *value) @@ -634,8 +647,9 @@ static MovieTrackingTrack *rna_trackingObject_tracks_new(ID *id, ListBase *tracksbase = &object->tracks; MovieTrackingTrack *track; - if (object->flag & TRACKING_OBJECT_CAMERA) + if (object->flag & TRACKING_OBJECT_CAMERA) { tracksbase = &clip->tracking.tracks; + } track = add_track_to_base(clip, &clip->tracking, tracksbase, name, frame); @@ -672,10 +686,12 @@ static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *t int framenr, bool exact) { - if (exact) + if (exact) { return BKE_tracking_marker_get_exact(track, framenr); - else + } + else { return BKE_tracking_marker_get(track, framenr); + } } static MovieTrackingMarker *rna_trackingMarkers_insert_frame(MovieTrackingTrack *track, @@ -705,8 +721,9 @@ static MovieTrackingMarker *rna_trackingMarkers_insert_frame(MovieTrackingTrack static void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int framenr) { - if (track->markersnr == 1) + if (track->markersnr == 1) { return; + } BKE_tracking_marker_delete(track, framenr); @@ -716,10 +733,12 @@ static void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int fram static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_find_frame( MovieTrackingPlaneTrack *plane_track, int framenr, bool exact) { - if (exact) + if (exact) { return BKE_tracking_plane_marker_get_exact(plane_track, framenr); - else + } + else { return BKE_tracking_plane_marker_get(plane_track, framenr); + } } static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_insert_frame( @@ -746,8 +765,9 @@ static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_insert_frame( static void rna_trackingPlaneMarkers_delete_frame(MovieTrackingPlaneTrack *plane_track, int framenr) { - if (plane_track->markersnr == 1) + if (plane_track->markersnr == 1) { return; + } BKE_tracking_plane_marker_delete(plane_track, framenr); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 0dbafbde71c..82315605ee5 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -85,8 +85,9 @@ static ARegionType *region_type_find(ReportList *reports, int space_type, int re st = BKE_spacetype_from_id(space_type); for (art = (st) ? st->regiontypes.first : NULL; art; art = art->next) { - if (art->regionid == region_type) + if (art->regionid == region_type) { break; + } } /* region type not found? abort */ @@ -184,10 +185,12 @@ static void rna_Panel_unregister(Main *UNUSED(bmain), StructRNA *type) ARegionType *art; PanelType *pt = RNA_struct_blender_type_get(type); - if (!pt) + if (!pt) { return; - if (!(art = region_type_find(NULL, pt->space_type, pt->region_type))) + } + if (!(art = region_type_find(NULL, pt->space_type, pt->region_type))) { return; + } RNA_struct_free_extension(type, &pt->ext); RNA_struct_free(&BLENDER_RNA, type); @@ -233,8 +236,9 @@ static StructRNA *rna_Panel_register(Main *bmain, strcpy(dummypt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); /* validate the python class */ - if (validate(&dummyptr, data, have_function) != 0) + if (validate(&dummyptr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(dummypt.idname)) { BKE_reportf(reports, @@ -268,16 +272,19 @@ static StructRNA *rna_Panel_register(Main *bmain, } } - if (!(art = region_type_find(reports, dummypt.space_type, dummypt.region_type))) + if (!(art = region_type_find(reports, dummypt.space_type, dummypt.region_type))) { return NULL; + } /* check if we have registered this panel type before, and remove it */ for (pt = art->paneltypes.first; pt; pt = pt->next) { if (STREQ(pt->idname, dummypt.idname)) { - if (pt->ext.srna) + if (pt->ext.srna) { rna_Panel_unregister(bmain, pt->ext.srna); - else + } + else { BLI_freelinkN(&art->paneltypes, pt); + } break; } @@ -555,8 +562,9 @@ static void rna_UIList_unregister(Main *UNUSED(bmain), StructRNA *type) { uiListType *ult = RNA_struct_blender_type_get(type); - if (!ult) + if (!ult) { return; + } RNA_struct_free_extension(type, &ult->ext); RNA_struct_free(&BLENDER_RNA, type); @@ -586,8 +594,9 @@ static StructRNA *rna_UIList_register(Main *bmain, RNA_pointer_create(NULL, &RNA_UIList, &dummyuilist, &dummyul_ptr); /* validate the python class */ - if (validate(&dummyul_ptr, data, have_function) != 0) + if (validate(&dummyul_ptr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(dummyult.idname)) { BKE_reportf(reports, @@ -663,10 +672,12 @@ static void rna_Header_unregister(Main *UNUSED(bmain), StructRNA *type) ARegionType *art; HeaderType *ht = RNA_struct_blender_type_get(type); - if (!ht) + if (!ht) { return; - if (!(art = region_type_find(NULL, ht->space_type, ht->region_type))) + } + if (!(art = region_type_find(NULL, ht->space_type, ht->region_type))) { return; + } RNA_struct_free_extension(type, &ht->ext); RNA_struct_free(&BLENDER_RNA, type); @@ -697,8 +708,9 @@ static StructRNA *rna_Header_register(Main *bmain, RNA_pointer_create(NULL, &RNA_Header, &dummyheader, &dummyhtr); /* validate the python class */ - if (validate(&dummyhtr, data, have_function) != 0) + if (validate(&dummyhtr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(dummyht.idname)) { BKE_reportf(reports, @@ -709,14 +721,16 @@ static StructRNA *rna_Header_register(Main *bmain, return NULL; } - if (!(art = region_type_find(reports, dummyht.space_type, dummyht.region_type))) + if (!(art = region_type_find(reports, dummyht.space_type, dummyht.region_type))) { return NULL; + } /* check if we have registered this header type before, and remove it */ for (ht = art->headertypes.first; ht; ht = ht->next) { if (STREQ(ht->idname, dummyht.idname)) { - if (ht->ext.srna) + if (ht->ext.srna) { rna_Header_unregister(bmain, ht->ext.srna); + } break; } } @@ -802,8 +816,9 @@ static void rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type) { MenuType *mt = RNA_struct_blender_type_get(type); - if (!mt) + if (!mt) { return; + } RNA_struct_free_extension(type, &mt->ext); RNA_struct_free(&BLENDER_RNA, type); @@ -840,8 +855,9 @@ static StructRNA *rna_Menu_register(Main *bmain, strcpy(dummymt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); /* validate the python class */ - if (validate(&dummymtr, data, have_function) != 0) + if (validate(&dummymtr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(dummymt.idname)) { BKE_reportf(reports, @@ -918,10 +934,12 @@ static void rna_Menu_bl_description_set(PointerRNA *ptr, const char *value) { Menu *data = (Menu *)(ptr->data); char *str = (char *)data->type->description; - if (!str[0]) + if (!str[0]) { BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ - else + } + else { assert(!"setting the bl_description on a non-builtin menu"); + } } /* UILayout */ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index f505e4d9e09..248beb47163 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -284,10 +284,12 @@ static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), PointerRNA *ptr) { UserDef *userdef = (UserDef *)ptr->data; - if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE) + if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE) { G.f &= ~G_FLAG_SCRIPT_AUTOEXEC; - else + } + else { G.f |= G_FLAG_SCRIPT_AUTOEXEC; + } USERDEF_TAG_DIRTY; } @@ -295,10 +297,12 @@ static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), static void rna_userdef_load_ui_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { UserDef *userdef = (UserDef *)ptr->data; - if (userdef->flag & USER_FILENOUI) + if (userdef->flag & USER_FILENOUI) { G.fileflags |= G_FILE_NO_UI; - else + } + else { G.fileflags &= ~G_FILE_NO_UI; + } USERDEF_TAG_DIRTY; } @@ -328,8 +332,9 @@ static int rna_userdef_autokeymode_get(PointerRNA *ptr) UserDef *userdef = (UserDef *)ptr->data; short retval = userdef->autokey_mode; - if (!(userdef->autokey_mode & AUTOKEY_ON)) + if (!(userdef->autokey_mode & AUTOKEY_ON)) { retval |= AUTOKEY_ON; + } return retval; } @@ -406,8 +411,9 @@ static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value) break; } - if (U.v2d_min_gridsize < required_size) + if (U.v2d_min_gridsize < required_size) { U.v2d_min_gridsize = required_size; + } } static PointerRNA rna_UserDef_view_get(PointerRNA *ptr) @@ -459,8 +465,9 @@ static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRN Object *ob; for (ob = bmain->objects.first; ob; ob = ob->id.next) { - if (ob->mode & OB_MODE_WEIGHT_PAINT) + if (ob->mode & OB_MODE_WEIGHT_PAINT) { DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); + } } rna_userdef_update(bmain, scene, ptr); @@ -484,8 +491,9 @@ static void rna_userdef_autosave_update(Main *bmain, Scene *scene, PointerRNA *p { wmWindowManager *wm = bmain->wm.first; - if (wm) + if (wm) { WM_autosave_init(wm); + } rna_userdef_update(bmain, scene, ptr); } @@ -698,8 +706,9 @@ static void rna_AddonPref_unregister(Main *UNUSED(bmain), StructRNA *type) { bAddonPrefType *apt = RNA_struct_blender_type_get(type); - if (!apt) + if (!apt) { return; + } RNA_struct_free_extension(type, &apt->ext); RNA_struct_free(&BLENDER_RNA, type); @@ -727,8 +736,9 @@ static StructRNA *rna_AddonPref_register(Main *bmain, RNA_pointer_create(NULL, &RNA_AddonPreferences, &dummy_addon, &dummy_ptr); /* validate the python class */ - if (validate(&dummy_ptr, data, NULL /* have_function */) != 0) + if (validate(&dummy_ptr, data, NULL /* have_function */) != 0) { return NULL; + } BLI_strncpy(dummy_apt.idname, dummy_addon.module, sizeof(dummy_apt.idname)); if (strlen(identifier) >= sizeof(dummy_apt.idname)) { diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 860f57e374a..3c707142951 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -548,10 +548,12 @@ static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr) { wmOperator *op = rna_OperatorProperties_find_operator(ptr); - if (op) + if (op) { return op->type->srna; - else + } + else { return ptr->type; + } } static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, bool create) @@ -725,8 +727,9 @@ static void rna_Window_scene_update(bContext *C, PointerRNA *ptr) WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, win->new_scene); - if (G.debug & G_DEBUG) + if (G.debug & G_DEBUG) { printf("scene set %p\n", win->new_scene); + } win->new_scene = NULL; } @@ -843,8 +846,9 @@ static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr) { wmKeyMapItem *kmi = ptr->data; - if (kmi->ptr) + if (kmi->ptr) { return *(kmi->ptr); + } /*return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); */ return PointerRNA_NULL; @@ -919,18 +923,24 @@ static const EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), { int map_type = rna_wmKeyMapItem_map_type_get(ptr); - if (map_type == KMI_TYPE_MOUSE) + if (map_type == KMI_TYPE_MOUSE) { return event_mouse_type_items; - if (map_type == KMI_TYPE_TWEAK) + } + if (map_type == KMI_TYPE_TWEAK) { return event_tweak_type_items; - if (map_type == KMI_TYPE_TIMER) + } + if (map_type == KMI_TYPE_TIMER) { return event_timer_type_items; - if (map_type == KMI_TYPE_NDOF) + } + if (map_type == KMI_TYPE_NDOF) { return event_ndof_type_items; - if (map_type == KMI_TYPE_TEXTINPUT) + } + if (map_type == KMI_TYPE_TEXTINPUT) { return event_textinput_type_items; - else + } + else { return rna_enum_event_type_items; + } } static const EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), @@ -940,12 +950,15 @@ static const EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), { int map_type = rna_wmKeyMapItem_map_type_get(ptr); - if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF) + if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF) { return event_keymouse_value_items; - if (map_type == KMI_TYPE_TWEAK) + } + if (map_type == KMI_TYPE_TWEAK) { return event_tweak_value_items; - else + } + else { return rna_enum_event_value_items; + } } static const EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, @@ -1029,8 +1042,9 @@ static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr) kc = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname)); - if (!kc) + if (!kc) { kc = wm->defaultconf; + } return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc); } @@ -1042,8 +1056,9 @@ static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr, wmWindowManager *wm = ptr->data; wmKeyConfig *kc = value.data; - if (kc) + if (kc) { WM_keyconfig_set_active(wm, kc->idname); + } } /* -------------------------------------------------------------------- */ @@ -1076,8 +1091,9 @@ static void rna_wmKeyConfigPref_unregister(Main *UNUSED(bmain), StructRNA *type) { wmKeyConfigPrefType_Runtime *kpt_rt = RNA_struct_blender_type_get(type); - if (!kpt_rt) + if (!kpt_rt) { return; + } RNA_struct_free_extension(type, &kpt_rt->ext); RNA_struct_free(&BLENDER_RNA, type); @@ -1106,8 +1122,9 @@ static StructRNA *rna_wmKeyConfigPref_register(Main *bmain, RNA_pointer_create(NULL, &RNA_KeyConfigPreferences, &dummy_kpt, &dummy_ptr); /* validate the python class */ - if (validate(&dummy_ptr, data, NULL /* have_function */) != 0) + if (validate(&dummy_ptr, data, NULL /* have_function */) != 0) { return NULL; + } STRNCPY(dummy_kpt_rt.idname, dummy_kpt.idname); if (strlen(identifier) >= sizeof(dummy_kpt_rt.idname)) { @@ -1447,14 +1464,16 @@ static StructRNA *rna_Operator_register(Main *bmain, strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT); /* validate the python class */ - if (validate(&dummyotr, data, have_function) != 0) + if (validate(&dummyotr, data, have_function) != 0) { return NULL; + } /* check if we have registered this operator type before, and remove it */ { wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true); - if (ot && ot->ext.srna) + if (ot && ot->ext.srna) { rna_Operator_unregister(bmain, ot->ext.srna); + } } if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) { @@ -1524,8 +1543,9 @@ static void rna_Operator_unregister(struct Main *bmain, StructRNA *type) wmOperatorType *ot = RNA_struct_blender_type_get(type); wmWindowManager *wm; - if (!ot) + if (!ot) { return; + } /* update while blender is running */ wm = bmain->wm.first; @@ -1592,8 +1612,9 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT); /* validate the python class */ - if (validate(&dummyotr, data, have_function) != 0) + if (validate(&dummyotr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(dummyop.idname)) { BKE_reportf(reports, @@ -1607,8 +1628,9 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, /* check if we have registered this operator type before, and remove it */ { wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true); - if (ot && ot->ext.srna) + if (ot && ot->ext.srna) { rna_Operator_unregister(bmain, ot->ext.srna); + } } if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) { @@ -1683,50 +1705,60 @@ static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value) { wmOperator *data = (wmOperator *)(ptr->data); char *str = (char *)data->type->idname; - if (!str[0]) + if (!str[0]) { BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */ - else + } + else { assert(!"setting the bl_idname on a non-builtin operator"); + } } static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value) { wmOperator *data = (wmOperator *)(ptr->data); char *str = (char *)data->type->name; - if (!str[0]) + if (!str[0]) { BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */ - else + } + else { assert(!"setting the bl_label on a non-builtin operator"); + } } static void rna_Operator_bl_translation_context_set(PointerRNA *ptr, const char *value) { wmOperator *data = (wmOperator *)(ptr->data); char *str = (char *)data->type->translation_context; - if (!str[0]) + if (!str[0]) { BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ - else + } + else { assert(!"setting the bl_translation_context on a non-builtin operator"); + } } static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value) { wmOperator *data = (wmOperator *)(ptr->data); char *str = (char *)data->type->description; - if (!str[0]) + if (!str[0]) { BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ - else + } + else { assert(!"setting the bl_description on a non-builtin operator"); + } } static void rna_Operator_bl_undo_group_set(PointerRNA *ptr, const char *value) { wmOperator *data = (wmOperator *)(ptr->data); char *str = (char *)data->type->undo_group; - if (!str[0]) + if (!str[0]) { BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */ - else + } + else { assert(!"setting the bl_undo_group on a non-builtin operator"); + } } static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index e4caeb2a5ae..1fea87df10c 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -228,17 +228,22 @@ static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, WM_operator_bl_idname(idname_bl, idname); - if (shift) + if (shift) { modifier |= KM_SHIFT; - if (ctrl) + } + if (ctrl) { modifier |= KM_CTRL; - if (alt) + } + if (alt) { modifier |= KM_ALT; - if (oskey) + } + if (oskey) { modifier |= KM_OSKEY; + } - if (any) + if (any) { modifier = KM_ANY; + } /* create keymap item */ kmi = WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier); @@ -296,24 +301,31 @@ static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, return NULL; } - if (shift) + if (shift) { modifier |= KM_SHIFT; - if (ctrl) + } + if (ctrl) { modifier |= KM_CTRL; - if (alt) + } + if (alt) { modifier |= KM_ALT; - if (oskey) + } + if (oskey) { modifier |= KM_OSKEY; + } - if (any) + if (any) { modifier = KM_ANY; + } /* not initialized yet, do delayed lookup */ - if (!km->modal_items) + if (!km->modal_items) { return WM_modalkeymap_add_item_str(km, type, value, modifier, keymodifier, propvalue_str); + } - if (RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue) == 0) + if (RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue) == 0) { BKE_report(reports, RPT_WARNING, "Property value not in enumeration"); + } return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue); } @@ -382,10 +394,12 @@ static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *UNUSED(keyconf), const char { wmOperatorType *ot = WM_operatortype_find(idname, 0); - if (!ot) + if (!ot) { return NULL; - else + } + else { return ot->modalkeymap; + } } static void rna_KeyMap_remove(wmKeyConfig *keyconfig, ReportList *reports, PointerRNA *keymap_ptr) diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c index e942d74bdd9..41e499471ea 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo.c +++ b/source/blender/makesrna/intern/rna_wm_gizmo.c @@ -275,10 +275,12 @@ static StructRNA *rna_GizmoProperties_refine(PointerRNA *ptr) { wmGizmo *gz = rna_GizmoProperties_find_operator(ptr); - if (gz) + if (gz) { return gz->type->srna; - else + } + else { return ptr->type; + } } static IDProperty *rna_GizmoProperties_idprops(PointerRNA *ptr, bool create) @@ -451,8 +453,9 @@ static StructRNA *rna_Gizmo_register(Main *bmain, temp_buffers.idname[0] = '\0'; /* validate the python class */ - if (validate(&mnp_ptr, data, have_function) != 0) + if (validate(&mnp_ptr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(temp_buffers.idname)) { BKE_reportf(reports, @@ -557,10 +560,12 @@ static StructRNA *rna_GizmoGroupProperties_refine(PointerRNA *ptr) { wmGizmoGroupType *gzgt = rna_GizmoGroupProperties_find_gizmo_group_type(ptr); - if (gzgt) + if (gzgt) { return gzgt->srna; - else + } + else { return ptr->type; + } } static IDProperty *rna_GizmoGroupProperties_idprops(PointerRNA *ptr, bool create) @@ -615,20 +620,24 @@ static void rna_GizmoGroup_bl_idname_set(PointerRNA *ptr, const char *value) { wmGizmoGroup *data = ptr->data; char *str = (char *)data->type->idname; - if (!str[0]) + if (!str[0]) { BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */ - else + } + else { assert(!"setting the bl_idname on a non-builtin operator"); + } } static void rna_GizmoGroup_bl_label_set(PointerRNA *ptr, const char *value) { wmGizmoGroup *data = ptr->data; char *str = (char *)data->type->name; - if (!str[0]) + if (!str[0]) { BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */ - else + } + else { assert(!"setting the bl_label on a non-builtin operator"); + } } static bool rna_GizmoGroup_has_reports_get(PointerRNA *ptr) @@ -803,8 +812,9 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain, temp_buffers.idname[0] = temp_buffers.name[0] = '\0'; /* validate the python class */ - if (validate(&wgptr, data, have_function) != 0) + if (validate(&wgptr, data, have_function) != 0) { return NULL; + } if (strlen(identifier) >= sizeof(temp_buffers.idname)) { BKE_reportf(reports, @@ -894,8 +904,9 @@ static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type) { wmGizmoGroupType *gzgt = RNA_struct_blender_type_get(type); - if (!gzgt) + if (!gzgt) { return; + } RNA_struct_free_extension(type, &gzgt->ext); RNA_struct_free(&BLENDER_RNA, type); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 19109dbe3ce..9b5611f30d7 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -89,8 +89,9 @@ static void rna_World_use_nodes_update(bContext *C, PointerRNA *ptr) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - if (wrld->use_nodes && wrld->nodetree == NULL) + if (wrld->use_nodes && wrld->nodetree == NULL) { ED_node_shader_default(C, &wrld->id); + } DEG_relations_tag_update(bmain); rna_World_update(bmain, scene, ptr); -- cgit v1.2.3