RNA: check for duplicate manipulator names
This commit is contained in:
parent
58a4c767a1
commit
9d6d413c7c
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue