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>2012-10-30 07:05:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-30 07:05:45 +0400
commit8c9e1b3c16d3c15a22740211e5ea68586892424c (patch)
tree1adbefd7013edaed3ed941ff06814dd4148e91d8
parentca969539876f085ead7528868659dd67c0875d22 (diff)
Disallow collection add/remove/clear/move when drawing. - similar to how writing to attributes is disabled.
-rw-r--r--source/blender/python/intern/bpy_rna.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 170eeb9e2af..db9ff2e1a32 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -3866,6 +3866,12 @@ static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
{
PointerRNA r_ptr;
+#ifdef USE_PEDANTIC_WRITE
+ if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+ return NULL;
+ }
+#endif /* USE_PEDANTIC_WRITE */
+
RNA_property_collection_add(&self->ptr, self->prop, &r_ptr);
if (!r_ptr.data) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.add(): not supported for this collection");
@@ -3880,6 +3886,12 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
{
int key = PyLong_AsLong(value);
+#ifdef USE_PEDANTIC_WRITE
+ if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+ return NULL;
+ }
+#endif /* USE_PEDANTIC_WRITE */
+
if (key == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.remove(): expected one int argument");
return NULL;
@@ -3895,6 +3907,12 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
static PyObject *pyrna_prop_collection_idprop_clear(BPy_PropertyRNA *self)
{
+#ifdef USE_PEDANTIC_WRITE
+ if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+ return NULL;
+ }
+#endif /* USE_PEDANTIC_WRITE */
+
RNA_property_collection_clear(&self->ptr, self->prop);
Py_RETURN_NONE;
@@ -3904,6 +3922,12 @@ static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObje
{
int key = 0, pos = 0;
+#ifdef USE_PEDANTIC_WRITE
+ if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+ return NULL;
+ }
+#endif /* USE_PEDANTIC_WRITE */
+
if (!PyArg_ParseTuple(args, "ii", &key, &pos)) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.move(): expected two ints as arguments");
return NULL;