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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-08-23 09:22:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-08-23 09:22:48 +0300
commit9d6d413c7c543463eea7874e7d5d4cf1e914325e (patch)
tree3dd270607a26b8231ac4e5b00f319923def18ed3
parent58a4c767a14b60b903fbe5c5e7e960c57212faeb (diff)
RNA: check for duplicate manipulator names
-rw-r--r--source/blender/makesrna/intern/rna_wm_manipulator.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_manipulator.c b/source/blender/makesrna/intern/rna_wm_manipulator.c
index a0fdd76e4a3..b074433e3b5 100644
--- a/source/blender/makesrna/intern/rna_wm_manipulator.c
+++ b/source/blender/makesrna/intern/rna_wm_manipulator.c
@@ -434,14 +434,6 @@ static StructRNA *rna_Manipulator_register(
return NULL;
}
- { /* allocate the idname */
- const uint idname_len = strlen(temp_buffers.idname) + 1;
- char *ch = MEM_mallocN(
- sizeof(char) * idname_len, __func__);
- dummywt.idname = ch;
- memcpy(ch, temp_buffers.idname, idname_len);
- }
-
/* check if we have registered this manipulator type before, and remove it */
{
const wmManipulatorType *wt = WM_manipulatortype_find(dummywt.idname, true);
@@ -449,6 +441,17 @@ static StructRNA *rna_Manipulator_register(
rna_Manipulator_unregister(bmain, wt->ext.srna);
}
}
+ if (!RNA_struct_available_or_report(reports, identifier)) {
+ return NULL;
+ }
+
+ { /* allocate the idname */
+ const uint idname_len = strlen(temp_buffers.idname) + 1;
+ char *ch = MEM_mallocN(
+ sizeof(char) * idname_len, __func__);
+ dummywt.idname = ch;
+ memcpy(ch, temp_buffers.idname, idname_len);
+ }
/* create a new manipulator type */
dummywt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywt.idname, &RNA_Manipulator);
@@ -739,6 +742,17 @@ static StructRNA *rna_ManipulatorGroup_register(
return NULL;
}
+ /* check if we have registered this manipulatorgroup type before, and remove it */
+ {
+ wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(dummywgt.idname, true);
+ if (wgt && wgt->ext.srna) {
+ rna_ManipulatorGroup_unregister(bmain, wgt->ext.srna);
+ }
+ }
+ if (!RNA_struct_available_or_report(reports, identifier)) {
+ return NULL;
+ }
+
{ /* allocate the idname */
const uint idname_len = strlen(temp_buffers.idname) + 1;
const uint name_len = strlen(temp_buffers.name) + 1;
@@ -751,14 +765,6 @@ static StructRNA *rna_ManipulatorGroup_register(
dummywgt.name = ch;
}
- /* check if we have registered this manipulatorgroup type before, and remove it */
- {
- wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(dummywgt.idname, true);
- if (wgt && wgt->ext.srna) {
- rna_ManipulatorGroup_unregister(bmain, wgt->ext.srna);
- }
- }
-
/* create a new manipulatorgroup type */
dummywgt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywgt.idname, &RNA_ManipulatorGroup);
RNA_def_struct_flag(dummywgt.ext.srna, STRUCT_NO_IDPROPERTIES); /* manipulatorgroup properties are registered separately */