[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25542] trunk/blender/source/blender: minor pyapi changes
Campbell Barton
ideasman42 at gmail.com
Thu Dec 24 12:40:14 CET 2009
Revision: 25542
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25542
Author: campbellbarton
Date: 2009-12-24 12:40:14 +0100 (Thu, 24 Dec 2009)
Log Message:
-----------
minor pyapi changes
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/RNA_access.h
trunk/blender/source/blender/makesrna/intern/rna_access.c
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/makesrna/RNA_access.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_access.h 2009-12-24 10:39:30 UTC (rev 25541)
+++ trunk/blender/source/blender/makesrna/RNA_access.h 2009-12-24 11:40:14 UTC (rev 25542)
@@ -587,7 +587,7 @@
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type);
struct IDProperty *RNA_struct_idproperties(PointerRNA *ptr, int create);
-int RNA_struct_idproperties_check(PointerRNA *ptr);
+int RNA_struct_idproperties_check(StructRNA *srna);
PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier);
Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c 2009-12-24 10:39:30 UTC (rev 25541)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c 2009-12-24 11:40:14 UTC (rev 25542)
@@ -226,10 +226,9 @@
return NULL;
}
-int RNA_struct_idproperties_check(PointerRNA *ptr)
+int RNA_struct_idproperties_check(StructRNA *srna)
{
- StructRNA *type= ptr->type;
- return (type && type->idproperties) ? 1 : 0;
+ return (srna && srna->idproperties) ? 1 : 0;
}
static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2009-12-24 10:39:30 UTC (rev 25541)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2009-12-24 11:40:14 UTC (rev 25542)
@@ -1204,7 +1204,7 @@
return -1;
}
- if(RNA_struct_idproperties_check(&self->ptr)==0) {
+ if(RNA_struct_idproperties_check(self->ptr.type)==0) {
PyErr_SetString( PyExc_TypeError, "this type doesnt support IDProperties");
return -1;
}
@@ -1258,7 +1258,7 @@
IDProperty *group, *idprop;
char *name= _PyUnicode_AsString(key);
- if(RNA_struct_idproperties_check(&self->ptr)==0) {
+ if(RNA_struct_idproperties_check(self->ptr.type)==0) {
PyErr_SetString( PyExc_TypeError, "this type doesn't support IDProperties");
return NULL;
}
@@ -1307,7 +1307,7 @@
{
IDProperty *group;
- if(RNA_struct_idproperties_check(&self->ptr)==0) {
+ if(RNA_struct_idproperties_check(self->ptr.type)==0) {
PyErr_SetString( PyExc_TypeError, "this type doesnt support IDProperties");
return NULL;
}
@@ -1324,7 +1324,7 @@
{
IDProperty *group;
- if(RNA_struct_idproperties_check(&self->ptr)==0) {
+ if(RNA_struct_idproperties_check(self->ptr.type)==0) {
PyErr_SetString( PyExc_TypeError, "this type doesnt support IDProperties");
return NULL;
}
@@ -1342,7 +1342,7 @@
{
IDProperty *group;
- if(RNA_struct_idproperties_check(&self->ptr)==0) {
+ if(RNA_struct_idproperties_check(self->ptr.type)==0) {
PyErr_SetString( PyExc_TypeError, "this type doesnt support IDProperties");
return NULL;
}
@@ -1671,7 +1671,7 @@
if(name[0]=='_') { // rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups
/* annoying exception, maybe we need to have different types for this... */
- if((strcmp(name, "__getitem__")==0 || strcmp(name, "__setitem__")==0) && !RNA_struct_idproperties_check(&self->ptr)) {
+ if((strcmp(name, "__getitem__")==0 || strcmp(name, "__setitem__")==0) && !RNA_struct_idproperties_check(self->ptr.type)) {
PyErr_SetString(PyExc_AttributeError, "StructRNA - no __getitem__ support for this type");
ret = NULL;
}
@@ -2027,7 +2027,7 @@
return NULL;
/* mostly copied from BPy_IDGroup_Map_GetItem */
- if(RNA_struct_idproperties_check(&self->ptr)==0) {
+ if(RNA_struct_idproperties_check(self->ptr.type)==0) {
PyErr_SetString( PyExc_TypeError, "this type doesn't support IDProperties");
return NULL;
}
@@ -3011,8 +3011,9 @@
/* sanity check, could skip this unless in debug mode */
if(newclass) {
PyObject *base_compare= pyrna_srna_PyBase(srna);
- PyObject *bases= PyObject_GetAttrString(newclass, "__bases__");
//PyObject *slots= PyObject_GetAttrString(newclass, "__slots__"); // cant do this because it gets superclasses values!
+ //PyObject *bases= PyObject_GetAttrString(newclass, "__bases__"); // can do this but faster not to.
+ PyObject *bases= ((PyTypeObject *)newclass)->tp_bases;
PyObject *slots = PyDict_GetItemString(((PyTypeObject *)newclass)->tp_dict, "__slots__");
if(slots==NULL) {
@@ -3032,8 +3033,6 @@
fprintf(stderr, "SRNA Subclassed: '%s'\n", idname);
}
}
-
- Py_DECREF(bases);
}
return newclass;
More information about the Bf-blender-cvs
mailing list