[Bf-blender-cvs] [1f650c402d3] master: Cleanup: style, use braces in RNA
Campbell Barton
noreply at git.blender.org
Mon Jun 3 16:25:18 CEST 2019
Commit: 1f650c402d3b43eee7cb51c7d4f373ba82ac2116
Author: Campbell Barton
Date: Tue Jun 4 00:21:57 2019 +1000
Branches: master
https://developer.blender.org/rB1f650c402d3b43eee7cb51c7d4f373ba82ac2116
Cleanup: style, use braces in RNA
===================================================================
M source/blender/makesrna/intern/rna_ID.c
M source/blender/makesrna/intern/rna_action.c
M source/blender/makesrna/intern/rna_animation.c
M source/blender/makesrna/intern/rna_armature.c
M source/blender/makesrna/intern/rna_boid.c
M source/blender/makesrna/intern/rna_brush.c
M source/blender/makesrna/intern/rna_cloth.c
M source/blender/makesrna/intern/rna_color.c
M source/blender/makesrna/intern/rna_constraint.c
M source/blender/makesrna/intern/rna_curve.c
M source/blender/makesrna/intern/rna_dynamicpaint.c
M source/blender/makesrna/intern/rna_fcurve.c
M source/blender/makesrna/intern/rna_fcurve_api.c
M source/blender/makesrna/intern/rna_fluidsim.c
M source/blender/makesrna/intern/rna_gpencil.c
M source/blender/makesrna/intern/rna_image.c
M source/blender/makesrna/intern/rna_image_api.c
M source/blender/makesrna/intern/rna_key.c
M source/blender/makesrna/intern/rna_lattice.c
M source/blender/makesrna/intern/rna_layer.c
M source/blender/makesrna/intern/rna_light.c
M source/blender/makesrna/intern/rna_linestyle.c
M source/blender/makesrna/intern/rna_main.c
M source/blender/makesrna/intern/rna_main_api.c
M source/blender/makesrna/intern/rna_mask.c
M source/blender/makesrna/intern/rna_material.c
M source/blender/makesrna/intern/rna_mesh.c
M source/blender/makesrna/intern/rna_mesh_api.c
M source/blender/makesrna/intern/rna_meta.c
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/makesrna/intern/rna_movieclip.c
M source/blender/makesrna/intern/rna_nla.c
M source/blender/makesrna/intern/rna_nodetree.c
M source/blender/makesrna/intern/rna_object.c
M source/blender/makesrna/intern/rna_object_api.c
M source/blender/makesrna/intern/rna_object_force.c
M source/blender/makesrna/intern/rna_palette.c
M source/blender/makesrna/intern/rna_particle.c
M source/blender/makesrna/intern/rna_pose.c
M source/blender/makesrna/intern/rna_render.c
M source/blender/makesrna/intern/rna_rigidbody.c
M source/blender/makesrna/intern/rna_rna.c
M source/blender/makesrna/intern/rna_scene.c
M source/blender/makesrna/intern/rna_scene_api.c
M source/blender/makesrna/intern/rna_screen.c
M source/blender/makesrna/intern/rna_sculpt_paint.c
M source/blender/makesrna/intern/rna_sequencer.c
M source/blender/makesrna/intern/rna_sequencer_api.c
M source/blender/makesrna/intern/rna_smoke.c
M source/blender/makesrna/intern/rna_sound.c
M source/blender/makesrna/intern/rna_space.c
M source/blender/makesrna/intern/rna_text.c
M source/blender/makesrna/intern/rna_texture.c
M source/blender/makesrna/intern/rna_tracking.c
M source/blender/makesrna/intern/rna_ui.c
M source/blender/makesrna/intern/rna_userdef.c
M source/blender/makesrna/intern/rna_wm.c
M source/blender/makesrna/intern/rna_wm_api.c
M source/blender/makesrna/intern/rna_wm_gizmo.c
M source/blender/makesrna/intern/rna_world.c
===================================================================
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
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list