Merged changes in the trunk up to revision 28772.

This commit is contained in:
2010-05-14 21:50:15 +00:00
96 changed files with 13723 additions and 11273 deletions

View File

@@ -290,6 +290,9 @@ def rna2sphinx(BASEPATH):
fw("copyright = u'Blender Foundation'\n")
fw("version = '%s - UNSTABLE API'\n" % version_string)
fw("release = '%s - UNSTABLE API'\n" % version_string)
fw("html_theme = 'blender-org'\n")
fw("html_theme_path = ['../']\n")
fw("html_favicon = 'favicon.ico'\n")
# not helpful since the source us generated, adds to upload size.
fw("html_copy_source = False\n")
fw("\n")
@@ -681,6 +684,9 @@ if __name__ == '__main__':
# only for partial updates
path_in_tmp = path_in + "-tmp"
if not os.path.exists(path_in):
os.mkdir(path_in)
for f in os.listdir(path_examples):
if f.endswith(".py"):
EXAMPLE_SET.add(os.path.splitext(f)[0])

View File

@@ -31,8 +31,9 @@
#include "bpy_app.h"
#include "bpy_props.h"
#include "bpy_operator.h"
#include "BLI_path_util.h"
#include "BLI_bpath.h"
/* external util modules */
#include "../generic/geometry.h"
@@ -45,7 +46,7 @@
static char bpy_home_paths_doc[] =
".. function:: home_paths(subfolder)\n"
"\n"
" return 3 paths to blender home directories.\n"
" Return 3 paths to blender home directories.\n"
"\n"
" :arg subfolder: The name of a subfolder to find within the blenders home directory.\n"
" :type subfolder: string\n"
@@ -73,7 +74,56 @@ PyObject *bpy_home_paths(PyObject *self, PyObject *args)
return ret;
}
static char bpy_blend_paths_doc[] =
".. function:: blend_paths(absolute=False)\n"
"\n"
" Returns a list of paths assosiated with this blend file.\n"
"\n"
" :arg absolute: When true the paths returned are made absolute.\n"
" :type absolute: boolean\n"
" :return: path list.\n"
" :rtype: list of strigs\n";
static PyObject *bpy_blend_paths(PyObject * self, PyObject *args, PyObject *kw)
{
struct BPathIterator bpi;
PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe */
/* be sure there is low chance of the path being too short */
char filepath_expanded[1024];
char *lib;
int absolute = 0;
static char *kwlist[] = {"absolute", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "|i:blend_paths", kwlist, &absolute))
return NULL;
for(BLI_bpathIterator_init(&bpi, NULL); !BLI_bpathIterator_isDone(&bpi); BLI_bpathIterator_step(&bpi)) {
/* build the list */
if (absolute) {
BLI_bpathIterator_getPathExpanded(&bpi, filepath_expanded);
}
else {
lib = BLI_bpathIterator_getLib(&bpi);
if (lib && (strcmp(lib, bpi.base_path))) { /* relative path to the library is NOT the same as our blendfile path, return an absolute path */
BLI_bpathIterator_getPathExpanded(&bpi, filepath_expanded);
}
else {
BLI_bpathIterator_getPath(&bpi, filepath_expanded);
}
}
st = PyUnicode_FromString(filepath_expanded);
PyList_Append(list, st);
Py_DECREF(st);
}
BLI_bpathIterator_free(&bpi);
return list;
}
static PyMethodDef meth_bpy_home_paths[] = {{ "home_paths", (PyCFunction)bpy_home_paths, METH_VARARGS, bpy_home_paths_doc}};
static PyMethodDef meth_bpy_blend_paths[] = {{ "blend_paths", (PyCFunction)bpy_blend_paths, METH_VARARGS|METH_KEYWORDS, bpy_blend_paths_doc}};
static void bpy_import_test(char *modname)
{
@@ -141,6 +191,7 @@ void BPy_init_modules( void )
/* utility func's that have nowhere else to go */
PyModule_AddObject(mod, meth_bpy_home_paths->ml_name, (PyObject *)PyCFunction_New(meth_bpy_home_paths, NULL));
PyModule_AddObject(mod, meth_bpy_blend_paths->ml_name, (PyObject *)PyCFunction_New(meth_bpy_blend_paths, NULL));
/* add our own modules dir, this is a python package */
bpy_import_test("bpy");

View File

@@ -1794,7 +1794,7 @@ static PyObject *pyrna_struct_values(BPy_PropertyRNA *self)
}
/* for keyframes and drivers */
static int pyrna_struct_anim_args_parse(PointerRNA *ptr, char *error_prefix, char *path,
static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefix, const char *path,
char **path_full, int *index)
{
PropertyRNA *prop;
@@ -1844,15 +1844,15 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, char *error_prefix, cha
}
/* internal use for insert and delete */
static int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *error_prefix,
static int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
char **path_full, int *index, float *cfra, char **group_name) /* return values */
{
static char *kwlist[] = {"path", "index", "frame", "group", NULL};
char *path;
if (!PyArg_ParseTuple(args, "s|ifs", &path, index, cfra, group_name)) {
PyErr_Format(PyExc_TypeError, "%.200s expected a string and optionally an int, float, and string arguments", error_prefix);
/* note, parse_str MUST start with 's|ifs' */
if (!PyArg_ParseTupleAndKeywords(args, kw, parse_str, (char **)kwlist, &path, index, cfra, group_name))
return -1;
}
if(pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0)
return -1;
@@ -1879,7 +1879,7 @@ static char pyrna_struct_keyframe_insert_doc[] =
" :return: Success of keyframe insertion.\n"
" :rtype: boolean";
static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args)
static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw)
{
PyObject *result;
/* args, pyrna_struct_keyframe_parse handles these */
@@ -1888,7 +1888,7 @@ static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *arg
float cfra= FLT_MAX;
char *group_name= NULL;
if(pyrna_struct_keyframe_parse(&self->ptr, args, "bpy_struct.keyframe_insert():", &path_full, &index, &cfra, &group_name) == -1)
if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1)
return NULL;
result= PyBool_FromLong(insert_keyframe((ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0));
@@ -1913,7 +1913,7 @@ static char pyrna_struct_keyframe_delete_doc[] =
" :return: Success of keyframe deleation.\n"
" :rtype: boolean";
static PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args)
static PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
{
PyObject *result;
/* args, pyrna_struct_keyframe_parse handles these */
@@ -1922,7 +1922,7 @@ static PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *arg
float cfra= FLT_MAX;
char *group_name= NULL;
if(pyrna_struct_keyframe_parse(&self->ptr, args, "bpy_struct.keyframe_delete():", &path_full, &index, &cfra, &group_name) == -1)
if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_delete()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1)
return NULL;
result= PyBool_FromLong(delete_keyframe((ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0));
@@ -3002,8 +3002,8 @@ static struct PyMethodDef pyrna_struct_methods[] = {
{"as_pointer", (PyCFunction)pyrna_struct_as_pointer, METH_NOARGS, pyrna_struct_as_pointer_doc},
{"keyframe_insert", (PyCFunction)pyrna_struct_keyframe_insert, METH_VARARGS, pyrna_struct_keyframe_insert_doc},
{"keyframe_delete", (PyCFunction)pyrna_struct_keyframe_delete, METH_VARARGS, pyrna_struct_keyframe_delete_doc},
{"keyframe_insert", (PyCFunction)pyrna_struct_keyframe_insert, METH_VARARGS|METH_KEYWORDS, pyrna_struct_keyframe_insert_doc},
{"keyframe_delete", (PyCFunction)pyrna_struct_keyframe_delete, METH_VARARGS|METH_KEYWORDS, pyrna_struct_keyframe_delete_doc},
{"driver_add", (PyCFunction)pyrna_struct_driver_add, METH_VARARGS, pyrna_struct_driver_add_doc},
{"driver_remove", (PyCFunction)pyrna_struct_driver_remove, METH_VARARGS, pyrna_struct_driver_remove_doc},
{"is_property_set", (PyCFunction)pyrna_struct_is_property_set, METH_VARARGS, pyrna_struct_is_property_set_doc},