formatting edits. (no functional changes)
This commit is contained in:
@@ -226,7 +226,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
|
||||
fprintf(stdout, "id_release_weakref: '%s', %d items\n", id->name, BLI_ghash_size(weakinfo_hash));
|
||||
#endif
|
||||
|
||||
while (!BLI_ghashIterator_isDone(&weakinfo_hash_iter) ) {
|
||||
while (!BLI_ghashIterator_isDone(&weakinfo_hash_iter)) {
|
||||
PyObject *weakref= (PyObject *)BLI_ghashIterator_getKey(&weakinfo_hash_iter);
|
||||
PyObject *item= PyWeakref_GET_OBJECT(weakref);
|
||||
if(item != Py_None) {
|
||||
@@ -690,7 +690,7 @@ static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
|
||||
|
||||
static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)
|
||||
{
|
||||
return (a->prop==b->prop && a->ptr.data==b->ptr.data ) ? 0 : -1;
|
||||
return (a->prop==b->prop && a->ptr.data==b->ptr.data) ? 0 : -1;
|
||||
}
|
||||
|
||||
static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
|
||||
@@ -764,12 +764,12 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
|
||||
/* print name if available */
|
||||
name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE);
|
||||
if(name) {
|
||||
ret= PyUnicode_FromFormat( "<bpy_struct, %.200s(\"%.200s\")>", RNA_struct_identifier(self->ptr.type), name);
|
||||
ret= PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>", RNA_struct_identifier(self->ptr.type), name);
|
||||
MEM_freeN((void *)name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return PyUnicode_FromFormat( "<bpy_struct, %.200s at %p>", RNA_struct_identifier(self->ptr.type), self->ptr.data);
|
||||
return PyUnicode_FromFormat("<bpy_struct, %.200s at %p>", RNA_struct_identifier(self->ptr.type), self->ptr.data);
|
||||
}
|
||||
|
||||
static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
|
||||
@@ -779,18 +779,18 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
|
||||
return pyrna_struct_str(self); /* fallback */
|
||||
|
||||
if(RNA_struct_is_ID(self->ptr.type)) {
|
||||
return PyUnicode_FromFormat( "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id->name+2);
|
||||
return PyUnicode_FromFormat("bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id->name+2);
|
||||
}
|
||||
else {
|
||||
PyObject *ret;
|
||||
const char *path;
|
||||
path= RNA_path_from_ID_to_struct(&self->ptr);
|
||||
if(path) {
|
||||
ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path);
|
||||
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path);
|
||||
MEM_freeN((void *)path);
|
||||
}
|
||||
else { /* cant find, print something sane */
|
||||
ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_struct_identifier(self->ptr.type));
|
||||
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_struct_identifier(self->ptr.type));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -819,7 +819,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
|
||||
int len = -1;
|
||||
char *c= type_fmt;
|
||||
|
||||
while ( (*c++= tolower(*type_id++)) ) {} ;
|
||||
while ((*c++= tolower(*type_id++))) {} ;
|
||||
|
||||
if(type==PROP_COLLECTION) {
|
||||
len= pyrna_prop_collection_length(self);
|
||||
@@ -837,7 +837,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
|
||||
name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE);
|
||||
|
||||
if(name) {
|
||||
ret= PyUnicode_FromFormat( "<bpy_%.200s, %.200s.%.200s(\"%.200s\")>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), name);
|
||||
ret= PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), name);
|
||||
MEM_freeN((void *)name);
|
||||
return ret;
|
||||
}
|
||||
@@ -845,11 +845,11 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
|
||||
if(RNA_property_type(self->prop) == PROP_COLLECTION) {
|
||||
PointerRNA r_ptr;
|
||||
if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
|
||||
return PyUnicode_FromFormat( "<bpy_%.200s, %.200s>", type_fmt, RNA_struct_identifier(r_ptr.type));
|
||||
return PyUnicode_FromFormat("<bpy_%.200s, %.200s>", type_fmt, RNA_struct_identifier(r_ptr.type));
|
||||
}
|
||||
}
|
||||
|
||||
return PyUnicode_FromFormat( "<bpy_%.200s, %.200s.%.200s>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
|
||||
return PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
|
||||
}
|
||||
|
||||
static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
|
||||
@@ -865,11 +865,11 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
|
||||
|
||||
path= RNA_path_from_ID_to_property(&self->ptr, self->prop);
|
||||
if(path) {
|
||||
ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path);
|
||||
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path);
|
||||
MEM_freeN((void *)path);
|
||||
}
|
||||
else { /* cant find, print something sane */
|
||||
ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_property_identifier(self->prop));
|
||||
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_property_identifier(self->prop));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1139,13 +1139,13 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
|
||||
/* see if we can coorce into a python type - PropertyType */
|
||||
switch (type) {
|
||||
case PROP_BOOLEAN:
|
||||
ret = PyBool_FromLong( RNA_property_boolean_get(ptr, prop) );
|
||||
ret = PyBool_FromLong(RNA_property_boolean_get(ptr, prop));
|
||||
break;
|
||||
case PROP_INT:
|
||||
ret = PyLong_FromSsize_t( (Py_ssize_t)RNA_property_int_get(ptr, prop) );
|
||||
ret = PyLong_FromSsize_t((Py_ssize_t)RNA_property_int_get(ptr, prop));
|
||||
break;
|
||||
case PROP_FLOAT:
|
||||
ret = PyFloat_FromDouble( RNA_property_float_get(ptr, prop) );
|
||||
ret = PyFloat_FromDouble(RNA_property_float_get(ptr, prop));
|
||||
break;
|
||||
case PROP_STRING:
|
||||
{
|
||||
@@ -1308,9 +1308,9 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
|
||||
* however so many poll functions return None or a valid Object.
|
||||
* its a hassle to convert these into a bool before returning, */
|
||||
if(RNA_property_flag(prop) & PROP_OUTPUT)
|
||||
param = PyObject_IsTrue( value );
|
||||
param = PyObject_IsTrue(value);
|
||||
else
|
||||
param = PyLong_AsLong( value );
|
||||
param = PyLong_AsLong(value);
|
||||
|
||||
if(param < 0) {
|
||||
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
|
||||
@@ -1616,9 +1616,9 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_BOOLEAN:
|
||||
{
|
||||
int param = PyLong_AsLong( value );
|
||||
int param = PyLong_AsLong(value);
|
||||
|
||||
if( param < 0 || param > 1) {
|
||||
if(param < 0 || param > 1) {
|
||||
PyErr_SetString(PyExc_TypeError, "expected True/False or 0/1");
|
||||
ret = -1;
|
||||
} else {
|
||||
@@ -2127,7 +2127,7 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
|
||||
PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self)
|
||||
|
||||
if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_prop_collection: attribute \"%.200s\" from \"%.200s\" is read-only", RNA_property_identifier(self->prop), RNA_struct_identifier(self->ptr.type) );
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_prop_collection: attribute \"%.200s\" from \"%.200s\" is read-only", RNA_property_identifier(self->prop), RNA_struct_identifier(self->ptr.type));
|
||||
ret= -1;
|
||||
}
|
||||
|
||||
@@ -2174,15 +2174,15 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
|
||||
|
||||
/* for slice only */
|
||||
static PyMappingMethods pyrna_prop_array_as_mapping = {
|
||||
( lenfunc ) pyrna_prop_array_length, /* mp_length */
|
||||
( binaryfunc ) pyrna_prop_array_subscript, /* mp_subscript */
|
||||
( objobjargproc ) pyrna_prop_array_ass_subscript, /* mp_ass_subscript */
|
||||
(lenfunc) pyrna_prop_array_length, /* mp_length */
|
||||
(binaryfunc) pyrna_prop_array_subscript, /* mp_subscript */
|
||||
(objobjargproc) pyrna_prop_array_ass_subscript, /* mp_ass_subscript */
|
||||
};
|
||||
|
||||
static PyMappingMethods pyrna_prop_collection_as_mapping = {
|
||||
( lenfunc ) pyrna_prop_collection_length, /* mp_length */
|
||||
( binaryfunc ) pyrna_prop_collection_subscript, /* mp_subscript */
|
||||
( objobjargproc ) NULL, /* mp_ass_subscript */
|
||||
(lenfunc) pyrna_prop_collection_length, /* mp_length */
|
||||
(binaryfunc) pyrna_prop_collection_subscript, /* mp_subscript */
|
||||
(objobjargproc) NULL, /* mp_ass_subscript */
|
||||
};
|
||||
|
||||
/* only for fast bool's, large structs, assign nb_bool on init */
|
||||
@@ -2356,9 +2356,9 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje
|
||||
}
|
||||
|
||||
static PyMappingMethods pyrna_struct_as_mapping = {
|
||||
( lenfunc ) NULL, /* mp_length */
|
||||
( binaryfunc ) pyrna_struct_subscript, /* mp_subscript */
|
||||
( objobjargproc ) pyrna_struct_ass_subscript, /* mp_ass_subscript */
|
||||
(lenfunc) NULL, /* mp_length */
|
||||
(binaryfunc) pyrna_struct_subscript, /* mp_subscript */
|
||||
(objobjargproc) pyrna_struct_ass_subscript, /* mp_ass_subscript */
|
||||
};
|
||||
|
||||
static char pyrna_struct_keys_doc[] =
|
||||
@@ -2992,7 +2992,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
|
||||
}
|
||||
else if (name[0] != '_' && (prop= RNA_struct_find_property(&self->ptr, name))) {
|
||||
if (!RNA_property_editable_flag(&self->ptr, prop)) {
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" from \"%.200s\" is read-only", RNA_property_identifier(prop), RNA_struct_identifier(self->ptr.type) );
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" from \"%.200s\" is read-only", RNA_property_identifier(prop), RNA_struct_identifier(self->ptr.type));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -3053,12 +3053,12 @@ static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self)
|
||||
}
|
||||
|
||||
|
||||
static PyObject *pyrna_prop_array_getattro( BPy_PropertyRNA *self, PyObject *pyname )
|
||||
static PyObject *pyrna_prop_array_getattro(BPy_PropertyRNA *self, PyObject *pyname)
|
||||
{
|
||||
return PyObject_GenericGetAttr((PyObject *)self, pyname);
|
||||
}
|
||||
|
||||
static PyObject *pyrna_prop_collection_getattro( BPy_PropertyRNA *self, PyObject *pyname )
|
||||
static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject *pyname)
|
||||
{
|
||||
const char *name = _PyUnicode_AsString(pyname);
|
||||
|
||||
@@ -3093,7 +3093,7 @@ static PyObject *pyrna_prop_collection_getattro( BPy_PropertyRNA *self, PyObject
|
||||
}
|
||||
|
||||
//--------------- setattr-------------------------------------------
|
||||
static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyname, PyObject *value )
|
||||
static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pyname, PyObject *value)
|
||||
{
|
||||
const char *name = _PyUnicode_AsString(pyname);
|
||||
PropertyRNA *prop;
|
||||
@@ -3211,7 +3211,7 @@ static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
|
||||
|
||||
if(nameptr) {
|
||||
/* add to python list */
|
||||
item = PyUnicode_FromString( nameptr );
|
||||
item = PyUnicode_FromString(nameptr);
|
||||
PyList_Append(ret, item);
|
||||
Py_DECREF(item);
|
||||
/* done */
|
||||
@@ -3238,7 +3238,7 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
|
||||
item= PyTuple_New(2);
|
||||
nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name));
|
||||
if(nameptr) {
|
||||
PyTuple_SET_ITEM(item, 0, PyUnicode_FromString( nameptr ));
|
||||
PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(nameptr));
|
||||
if(name != nameptr)
|
||||
MEM_freeN(nameptr);
|
||||
}
|
||||
@@ -3340,7 +3340,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
|
||||
|
||||
static void foreach_attr_type( BPy_PropertyRNA *self, const char *attr,
|
||||
/* values to assign */
|
||||
RawPropertyType *raw_type, int *attr_tot, int *attr_signed )
|
||||
RawPropertyType *raw_type, int *attr_tot, int *attr_signed)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
*raw_type= PROP_RAW_UNSET;
|
||||
@@ -3538,19 +3538,19 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
|
||||
|
||||
switch(raw_type) {
|
||||
case PROP_RAW_CHAR:
|
||||
item= PyLong_FromSsize_t( (Py_ssize_t) ((char *)array)[i] );
|
||||
item= PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
|
||||
break;
|
||||
case PROP_RAW_SHORT:
|
||||
item= PyLong_FromSsize_t( (Py_ssize_t) ((short *)array)[i] );
|
||||
item= PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
|
||||
break;
|
||||
case PROP_RAW_INT:
|
||||
item= PyLong_FromSsize_t( (Py_ssize_t) ((int *)array)[i] );
|
||||
item= PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
|
||||
break;
|
||||
case PROP_RAW_FLOAT:
|
||||
item= PyFloat_FromDouble( (double) ((float *)array)[i] );
|
||||
item= PyFloat_FromDouble((double) ((float *)array)[i]);
|
||||
break;
|
||||
case PROP_RAW_DOUBLE:
|
||||
item= PyFloat_FromDouble( (double) ((double *)array)[i] );
|
||||
item= PyFloat_FromDouble((double) ((double *)array)[i]);
|
||||
break;
|
||||
case PROP_RAW_UNSET:
|
||||
/* should never happen */
|
||||
@@ -3707,7 +3707,7 @@ static struct PyMethodDef pyrna_prop_collection_methods[] = {
|
||||
{"foreach_set", (PyCFunction)pyrna_prop_collection_foreach_set, METH_VARARGS, pyrna_prop_collection_foreach_set_doc},
|
||||
|
||||
{"keys", (PyCFunction)pyrna_prop_collection_keys, METH_NOARGS, NULL},
|
||||
{"items", (PyCFunction)pyrna_prop_collection_items, METH_NOARGS,NULL},
|
||||
{"items", (PyCFunction)pyrna_prop_collection_items, METH_NOARGS, NULL},
|
||||
{"values", (PyCFunction)pyrna_prop_collection_values, METH_NOARGS, NULL},
|
||||
|
||||
{"get", (PyCFunction)pyrna_prop_collection_get, METH_VARARGS, NULL},
|
||||
@@ -3723,7 +3723,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
|
||||
|
||||
/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
|
||||
* todo - also accept useful args */
|
||||
static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
|
||||
static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
|
||||
{
|
||||
if(PyTuple_GET_SIZE(args) == 1) {
|
||||
BPy_StructRNA *base= (BPy_StructRNA *)PyTuple_GET_ITEM(args, 0);
|
||||
@@ -3765,7 +3765,7 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject
|
||||
|
||||
/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
|
||||
* todo - also accept useful args */
|
||||
static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) {
|
||||
static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) {
|
||||
|
||||
BPy_PropertyRNA *base;
|
||||
|
||||
@@ -3812,12 +3812,12 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
|
||||
case PROP_BOOLEAN:
|
||||
ret = PyTuple_New(len);
|
||||
for(a=0; a<len; a++)
|
||||
PyTuple_SET_ITEM(ret, a, PyBool_FromLong( ((int*)data)[a] ));
|
||||
PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((int*)data)[a]));
|
||||
break;
|
||||
case PROP_INT:
|
||||
ret = PyTuple_New(len);
|
||||
for(a=0; a<len; a++)
|
||||
PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t( (Py_ssize_t)((int*)data)[a] ));
|
||||
PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t((Py_ssize_t)((int*)data)[a]));
|
||||
break;
|
||||
case PROP_FLOAT:
|
||||
switch(RNA_property_subtype(prop)) {
|
||||
@@ -3839,7 +3839,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
|
||||
default:
|
||||
ret = PyTuple_New(len);
|
||||
for(a=0; a<len; a++)
|
||||
PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble( ((float*)data)[a] ));
|
||||
PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble(((float*)data)[a]));
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -3853,13 +3853,13 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
|
||||
/* see if we can coorce into a python type - PropertyType */
|
||||
switch (type) {
|
||||
case PROP_BOOLEAN:
|
||||
ret = PyBool_FromLong( *(int*)data );
|
||||
ret = PyBool_FromLong(*(int*)data);
|
||||
break;
|
||||
case PROP_INT:
|
||||
ret = PyLong_FromSsize_t( (Py_ssize_t)*(int*)data );
|
||||
ret = PyLong_FromSsize_t((Py_ssize_t)*(int*)data);
|
||||
break;
|
||||
case PROP_FLOAT:
|
||||
ret = PyFloat_FromDouble( *(float*)data );
|
||||
ret = PyFloat_FromDouble(*(float*)data);
|
||||
break;
|
||||
case PROP_STRING:
|
||||
{
|
||||
@@ -3949,7 +3949,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
|
||||
return ret;
|
||||
}
|
||||
|
||||
static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
|
||||
static PyObject *pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
/* Note, both BPy_StructRNA and BPy_PropertyRNA can be used here */
|
||||
PointerRNA *self_ptr= &(((BPy_DummyPointerRNA *)PyTuple_GET_ITEM(self, 0))->ptr);
|
||||
@@ -4288,7 +4288,7 @@ PyTypeObject pyrna_struct_Type = {
|
||||
NULL, /* getattrfunc tp_getattr; */
|
||||
NULL, /* setattrfunc tp_setattr; */
|
||||
NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
|
||||
( reprfunc ) pyrna_struct_repr, /* tp_repr */
|
||||
(reprfunc) pyrna_struct_repr, /* tp_repr */
|
||||
|
||||
/* Method suites for standard classes */
|
||||
|
||||
@@ -4298,11 +4298,11 @@ PyTypeObject pyrna_struct_Type = {
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
( hashfunc )pyrna_struct_hash, /* hashfunc tp_hash; */
|
||||
(hashfunc) pyrna_struct_hash, /* hashfunc tp_hash; */
|
||||
NULL, /* ternaryfunc tp_call; */
|
||||
(reprfunc) pyrna_struct_str, /* reprfunc tp_str; */
|
||||
( getattrofunc ) pyrna_struct_getattro, /* getattrofunc tp_getattro; */
|
||||
( setattrofunc ) pyrna_struct_setattro, /* setattrofunc tp_setattro; */
|
||||
(getattrofunc) pyrna_struct_getattro, /* getattrofunc tp_getattro; */
|
||||
(setattrofunc) pyrna_struct_setattro, /* setattrofunc tp_setattro; */
|
||||
|
||||
/* Functions to access object as input/output buffer */
|
||||
NULL, /* PyBufferProcs *tp_as_buffer; */
|
||||
@@ -4380,7 +4380,7 @@ PyTypeObject pyrna_prop_Type = {
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
( hashfunc ) pyrna_prop_hash, /* hashfunc tp_hash; */
|
||||
(hashfunc) pyrna_prop_hash, /* hashfunc tp_hash; */
|
||||
NULL, /* ternaryfunc tp_call; */
|
||||
(reprfunc) pyrna_prop_str, /* reprfunc tp_str; */
|
||||
|
||||
@@ -4469,7 +4469,7 @@ PyTypeObject pyrna_prop_array_Type = {
|
||||
NULL, /* reprfunc tp_str; */
|
||||
|
||||
/* will only use these if this is a subtype of a py class */
|
||||
( getattrofunc ) pyrna_prop_array_getattro, /* getattrofunc tp_getattro; */
|
||||
(getattrofunc) pyrna_prop_array_getattro, /* getattrofunc tp_getattro; */
|
||||
NULL, /* setattrofunc tp_setattro; */
|
||||
|
||||
/* Functions to access object as input/output buffer */
|
||||
@@ -4552,8 +4552,8 @@ PyTypeObject pyrna_prop_collection_Type = {
|
||||
NULL, /* reprfunc tp_str; */
|
||||
|
||||
/* will only use these if this is a subtype of a py class */
|
||||
( getattrofunc ) pyrna_prop_collection_getattro, /* getattrofunc tp_getattro; */
|
||||
( setattrofunc ) pyrna_prop_collection_setattro, /* setattrofunc tp_setattro; */
|
||||
(getattrofunc) pyrna_prop_collection_getattro, /* getattrofunc tp_getattro; */
|
||||
(setattrofunc) pyrna_prop_collection_setattro, /* setattrofunc tp_setattro; */
|
||||
|
||||
/* Functions to access object as input/output buffer */
|
||||
NULL, /* PyBufferProcs *tp_as_buffer; */
|
||||
@@ -4886,7 +4886,7 @@ static PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
|
||||
}
|
||||
|
||||
/*-----------------------CreatePyObject---------------------------------*/
|
||||
PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
|
||||
PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
|
||||
{
|
||||
BPy_StructRNA *pyrna= NULL;
|
||||
|
||||
@@ -4903,14 +4903,14 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Could not make type\n");
|
||||
pyrna = (BPy_StructRNA *) PyObject_NEW(BPy_StructRNA, &pyrna_struct_Type );
|
||||
pyrna = (BPy_StructRNA *) PyObject_NEW(BPy_StructRNA, &pyrna_struct_Type);
|
||||
#ifdef USE_WEAKREFS
|
||||
pyrna->in_weakreflist= NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if( !pyrna ) {
|
||||
if(pyrna == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError, "couldn't create bpy_struct object");
|
||||
return NULL;
|
||||
}
|
||||
@@ -4925,10 +4925,10 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
|
||||
id_weakref_pool_add(ptr->id.data, (BPy_DummyPointerRNA *)pyrna);
|
||||
}
|
||||
#endif
|
||||
return ( PyObject * ) pyrna;
|
||||
return (PyObject *)pyrna;
|
||||
}
|
||||
|
||||
PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop )
|
||||
PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
|
||||
{
|
||||
BPy_PropertyRNA *pyrna;
|
||||
|
||||
@@ -4961,7 +4961,7 @@ PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop )
|
||||
#endif
|
||||
}
|
||||
|
||||
if( !pyrna ) {
|
||||
if(pyrna == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError, "couldn't create BPy_rna object");
|
||||
return NULL;
|
||||
}
|
||||
@@ -4975,7 +4975,7 @@ PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop )
|
||||
}
|
||||
#endif
|
||||
|
||||
return ( PyObject * ) pyrna;
|
||||
return (PyObject *)pyrna;
|
||||
}
|
||||
|
||||
void BPY_rna_init(void)
|
||||
@@ -4987,22 +4987,22 @@ void BPY_rna_init(void)
|
||||
|
||||
/* metaclass */
|
||||
pyrna_struct_meta_idprop_Type.tp_base= &PyType_Type;
|
||||
if( PyType_Ready( &pyrna_struct_meta_idprop_Type ) < 0 )
|
||||
if(PyType_Ready(&pyrna_struct_meta_idprop_Type) < 0)
|
||||
return;
|
||||
|
||||
if( PyType_Ready( &pyrna_struct_Type ) < 0 )
|
||||
if(PyType_Ready(&pyrna_struct_Type) < 0)
|
||||
return;
|
||||
|
||||
if( PyType_Ready( &pyrna_prop_Type ) < 0 )
|
||||
if(PyType_Ready(&pyrna_prop_Type) < 0)
|
||||
return;
|
||||
|
||||
if( PyType_Ready( &pyrna_prop_array_Type ) < 0 )
|
||||
if(PyType_Ready(&pyrna_prop_array_Type) < 0)
|
||||
return;
|
||||
|
||||
if( PyType_Ready( &pyrna_prop_collection_Type ) < 0 )
|
||||
if(PyType_Ready(&pyrna_prop_collection_Type) < 0)
|
||||
return;
|
||||
|
||||
if( PyType_Ready( &pyrna_prop_collection_idprop_Type ) < 0 )
|
||||
if(PyType_Ready(&pyrna_prop_collection_idprop_Type) < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5029,7 +5029,7 @@ void BPY_update_rna_module(void)
|
||||
#if 0
|
||||
/* This is a way we can access docstrings for RNA types
|
||||
* without having the datatypes in blender */
|
||||
PyObject *BPY_rna_doc( void )
|
||||
PyObject *BPY_rna_doc(void)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -5044,7 +5044,7 @@ PyObject *BPY_rna_doc( void )
|
||||
/* pyrna_basetype_* - BPy_BaseTypeRNA is just a BPy_PropertyRNA struct with a differnt type
|
||||
* the self->ptr and self->prop are always set to the "structs" collection */
|
||||
//---------------getattr--------------------------------------------
|
||||
static PyObject *pyrna_basetype_getattro( BPy_BaseTypeRNA *self, PyObject *pyname )
|
||||
static PyObject *pyrna_basetype_getattro(BPy_BaseTypeRNA *self, PyObject *pyname)
|
||||
{
|
||||
PointerRNA newptr;
|
||||
PyObject *ret;
|
||||
@@ -5110,15 +5110,15 @@ PyObject *BPY_rna_types(void)
|
||||
if ((pyrna_basetype_Type.tp_flags & Py_TPFLAGS_READY)==0) {
|
||||
pyrna_basetype_Type.tp_name = "RNA_Types";
|
||||
pyrna_basetype_Type.tp_basicsize = sizeof(BPy_BaseTypeRNA);
|
||||
pyrna_basetype_Type.tp_getattro = ( getattrofunc )pyrna_basetype_getattro;
|
||||
pyrna_basetype_Type.tp_getattro = (getattrofunc) pyrna_basetype_getattro;
|
||||
pyrna_basetype_Type.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
pyrna_basetype_Type.tp_methods = pyrna_basetype_methods;
|
||||
|
||||
if( PyType_Ready( &pyrna_basetype_Type ) < 0 )
|
||||
if(PyType_Ready(&pyrna_basetype_Type) < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self= (BPy_BaseTypeRNA *)PyObject_NEW( BPy_BaseTypeRNA, &pyrna_basetype_Type );
|
||||
self= (BPy_BaseTypeRNA *)PyObject_NEW(BPy_BaseTypeRNA, &pyrna_basetype_Type);
|
||||
|
||||
/* avoid doing this lookup for every getattr */
|
||||
RNA_blender_rna_pointer_create(&self->ptr);
|
||||
|
||||
Reference in New Issue
Block a user