[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51751] trunk/blender/source/blender/ python/intern/bpy_rna.c: Disallow collection add/remove/clear/ move when drawing.
Campbell Barton
ideasman42 at gmail.com
Tue Oct 30 04:05:53 CET 2012
Revision: 51751
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51751
Author: campbellbarton
Date: 2012-10-30 03:05:45 +0000 (Tue, 30 Oct 2012)
Log Message:
-----------
Disallow collection add/remove/clear/move when drawing. - similar to how writing to attributes is disabled.
Modified Paths:
--------------
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2012-10-30 01:59:15 UTC (rev 51750)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2012-10-30 03:05:45 UTC (rev 51751)
@@ -3866,6 +3866,12 @@
{
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 @@
{
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_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 @@
{
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;
More information about the Bf-blender-cvs
mailing list