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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui.c')
-rw-r--r--source/blender/makesrna/intern/rna_ui.c54
1 files changed, 36 insertions, 18 deletions
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 */