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:
authorJoseph Eagar <joeedh@gmail.com>2006-11-17 11:19:58 +0300
committerJoseph Eagar <joeedh@gmail.com>2006-11-17 11:19:58 +0300
commitab141e143947c9691fb747ad8d9fd8842c4dacde (patch)
treef0be2678aee5e5ba2bef3175e94e5aa64477d8d3 /source/blender/python/api2_2x/IDProp.c
parent80f7ea96c83d8ae442b961906dc838ec03f06f00 (diff)
=ID Properties Python Update=
IDProperties now have a sanity check to prevent different ID properties in the same group from having the same name. The appropriate code has been added to the python bindings to catch this and raise an error.
Diffstat (limited to 'source/blender/python/api2_2x/IDProp.c')
-rw-r--r--source/blender/python/api2_2x/IDProp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/IDProp.c b/source/blender/python/api2_2x/IDProp.c
index 06a8d75b549..ff785c4d93d 100644
--- a/source/blender/python/api2_2x/IDProp.c
+++ b/source/blender/python/api2_2x/IDProp.c
@@ -264,7 +264,11 @@ char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObje
Py_XDECREF(vals);
}
- IDP_AddToGroup(group, prop);
+ if (!IDP_AddToGroup(group, prop)) {
+ IDP_FreeProperty(prop);
+ MEM_freeN(prop);
+ return "property name already exists in group";
+ }
return NULL;
}
@@ -848,7 +852,10 @@ PyObject *BPy_IDGroup_NewProperty(BPy_IDProperty *self, PyObject *args)
"invalid id property type");
}
- IDP_AddToGroup(self->prop, prop);
+ if (!IDP_AddToGroup(self->prop, prop)) {
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "property name already exists in group");
+ }
pyprop = BPy_Wrap_IDProperty(self->id, prop);
//Py_XINCREF(pyprop);
return pyprop;