Merged changes in the trunk up to revision 27752.

This commit is contained in:
2010-03-25 21:40:08 +00:00
557 changed files with 8005 additions and 8010 deletions

View File

@@ -54,23 +54,23 @@ static char bpy_home_paths_doc[] =
PyObject *bpy_home_paths(PyObject *self, PyObject *args)
{
PyObject *ret= PyTuple_New(3);
char *path;
char *subfolder= "";
PyObject *ret= PyTuple_New(3);
char *path;
char *subfolder= "";
if (!PyArg_ParseTuple(args, "|s:blender_homes", &subfolder))
return NULL;
path= BLI_gethome_folder(subfolder, BLI_GETHOME_SYSTEM);
PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
path= BLI_gethome_folder(subfolder, BLI_GETHOME_SYSTEM);
PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
path= BLI_gethome_folder(subfolder, BLI_GETHOME_LOCAL);
PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
path= BLI_gethome_folder(subfolder, BLI_GETHOME_LOCAL);
PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
path= BLI_gethome_folder(subfolder, BLI_GETHOME_USER);
PyTuple_SET_ITEM(ret, 2, PyUnicode_FromString(path?path:""));
path= BLI_gethome_folder(subfolder, BLI_GETHOME_USER);
PyTuple_SET_ITEM(ret, 2, PyUnicode_FromString(path?path:""));
return ret;
return ret;
}
static PyMethodDef meth_bpy_home_paths[] = {{ "home_paths", (PyCFunction)bpy_home_paths, METH_VARARGS, bpy_home_paths_doc}};

View File

@@ -34,15 +34,15 @@ typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *)
/*
arr[3][4][5]
0 1 2 <- dimension index
0 1 2 <- dimension index
*/
/*
arr[2] = x
py_to_array_index(arraydim=0, arrayoffset=0, index=2)
validate_array(lvalue_dim=0)
... make real index ...
validate_array(lvalue_dim=0)
... make real index ...
*/
/* arr[3]=x, self->arraydim is 0, lvalue_dim is 1 */

View File

@@ -271,11 +271,11 @@ float BPY_pydriver_eval (ChannelDriver *driver)
PyGILState_Release(gilstate);
if(finite(result)) {
return (float)result;
}
else {
fprintf(stderr, "\tBPY_pydriver_eval() - driver '%s' evaluates to '%f'\n", dvar->name, result);
return 0.0f;
}
if(finite(result)) {
return (float)result;
}
else {
fprintf(stderr, "\tBPY_pydriver_eval() - driver '%s' evaluates to '%f'\n", dvar->name, result);
return 0.0f;
}
}

View File

@@ -111,7 +111,7 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -177,7 +177,7 @@ PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -254,7 +254,7 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -321,7 +321,7 @@ PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -402,7 +402,7 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -477,7 +477,7 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -555,7 +555,7 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -667,7 +667,7 @@ PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -731,7 +731,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
}
if(!RNA_struct_is_a(srna, &RNA_IDPropertyGroup)) {
PyErr_Format(PyExc_SystemError, "%.200s expected an RNA type derived from IDPropertyGroup", error_prefix);
PyErr_Format(PyExc_SystemError, "%.200s expected an RNA type derived from IDPropertyGroup", error_prefix);
return NULL;
}
@@ -752,7 +752,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -813,7 +813,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}

View File

@@ -1099,12 +1099,17 @@ static Py_ssize_t pyrna_prop_collection_length( BPy_PropertyRNA *self )
static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum)
{
PointerRNA newptr;
int len= RNA_property_collection_length(&self->ptr, self->prop);
if(keynum < 0) keynum += RNA_property_collection_length(&self->ptr, self->prop);
if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum, &newptr))
return pyrna_struct_CreatePyObject(&newptr);
if(keynum < 0) keynum += len;
if(keynum >= 0 && keynum < len) {
if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum, &newptr)) {
return pyrna_struct_CreatePyObject(&newptr);
}
PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d could not be found", keynum);
return NULL;
}
PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d out of range", keynum);
return NULL;
}
@@ -2030,8 +2035,8 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname )
}
}
else if ((prop = RNA_struct_find_property(&self->ptr, name))) {
ret = pyrna_prop_to_py(&self->ptr, prop);
}
ret = pyrna_prop_to_py(&self->ptr, prop);
}
/* RNA function only if callback is declared (no optional functions) */
else if ((func = RNA_struct_find_function(&self->ptr, name)) && RNA_function_defined(func)) {
ret = pyrna_func_to_py((BPy_DummyPointerRNA *)self, func);
@@ -2971,7 +2976,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
RNA_parameter_list_create(&parms, self_ptr, self_func);
RNA_parameter_list_begin(&parms, &iter);
parms_len= RNA_parameter_list_size(&parms);
parms_len= RNA_parameter_list_arg_count(&parms);
ret_len= 0;
if(pyargs_len + pykw_len > parms_len) {
@@ -2999,7 +3004,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
parm_id= RNA_property_identifier(parm);
item= NULL;
if ((i < pyargs_len) && (flag & PROP_REQUIRED)) {
if (i < pyargs_len) {
item= PyTuple_GET_ITEM(args, i);
i++;
@@ -3044,7 +3049,6 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
RNA_parameter_list_end(&iter);
/* Check if we gave args that dont exist in the function
* printing the error is slow but it should only happen when developing.
* the if below is quick, checking if it passed less keyword args then we gave.
@@ -3903,19 +3907,19 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_pr
}
if(py_srna==NULL) {
PyErr_Format(PyExc_SystemError, "%.200s internal error, self of type '%.200s' had no bl_rna attribute, should never happen", error_prefix, Py_TYPE(self)->tp_name);
PyErr_Format(PyExc_SystemError, "%.200s internal error, self of type '%.200s' had no bl_rna attribute, should never happen", error_prefix, Py_TYPE(self)->tp_name);
return NULL;
}
if(!BPy_StructRNA_Check(py_srna)) {
PyErr_Format(PyExc_SystemError, "%.200s internal error, bl_rna was of type '%.200s', instead of %.200s instance", error_prefix, Py_TYPE(py_srna)->tp_name, pyrna_struct_Type.tp_name);
Py_DECREF(py_srna);
PyErr_Format(PyExc_SystemError, "%.200s internal error, bl_rna was of type '%.200s', instead of %.200s instance", error_prefix, Py_TYPE(py_srna)->tp_name, pyrna_struct_Type.tp_name);
Py_DECREF(py_srna);
return NULL;
}
if(py_srna->ptr.type != &RNA_Struct) {
PyErr_Format(PyExc_SystemError, "%.200s internal error, bl_rna was not a RNA_Struct type of rna struct", error_prefix);
Py_DECREF(py_srna);
Py_DECREF(py_srna);
return NULL;
}
@@ -4441,12 +4445,12 @@ PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class)
PyObject *item;
const char *identifier= "";
if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")) {
if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")) {
PyErr_SetString(PyExc_AttributeError, "bpy.types.register(...): already registered as a subclass.");
return NULL;
}
}
/* warning: gets parent classes srna, only for the register function */
/* warning: gets parent classes srna, only for the register function */
srna= pyrna_struct_as_srna(py_class, 1, "bpy.types.register(...):");
if(srna==NULL)
return NULL;
@@ -4513,10 +4517,10 @@ PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class)
StructUnregisterFunc unreg;
StructRNA *srna;
/*if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")==NULL) {
/*if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")==NULL) {
PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(): not a registered as a subclass.");
return NULL;
}*/
}*/
srna= pyrna_struct_as_srna(py_class, 0, "bpy.types.unregister(...):");
if(srna==NULL)

View File

@@ -50,9 +50,9 @@ PyObject *PyObject_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
/* Class type checking, use for checking classes can be added as operators, panels etc */
typedef struct BPY_class_attr_check {
const char *name; /* name of the class attribute */
char type; /* 's' = string, 'f' = function, 'l' = list, (add as needed) */
int arg_count; /* only for function types, -1 for undefined, includes self arg */
int len; /* only for string types currently */
char type; /* 's' = string, 'f' = function, 'l' = list, (add as needed) */
int arg_count; /* only for function types, -1 for undefined, includes self arg */
int len; /* only for string types currently */
int flag; /* other options */
} BPY_class_attr_check;