Merged changes in the trunk up to revision 28600.

This commit is contained in:
2010-05-05 22:57:58 +00:00
118 changed files with 9245 additions and 7141 deletions

View File

@@ -52,6 +52,7 @@ EXAMPLE_SET = set()
EXAMPLE_SET_USED = set()
_BPY_STRUCT_FAKE = "bpy_struct"
_BPY_FULL_REBUILD = False
def range_str(val):
if val < -10000000: return '-inf'
@@ -675,22 +676,56 @@ if __name__ == '__main__':
import shutil
path_in = 'source/blender/python/doc/sphinx-in'
path_out = 'source/blender/python/doc/sphinx-in'
path_out = 'source/blender/python/doc/sphinx-out'
path_examples = 'source/blender/python/doc/examples'
# only for partial updates
path_in_tmp = path_in + "-tmp"
shutil.rmtree(path_in, True)
shutil.rmtree(path_out, True)
for f in os.listdir(path_examples):
if f.endswith(".py"):
EXAMPLE_SET.add(os.path.splitext(f)[0])
rna2sphinx(path_in)
# for fast module testing
# os.system("rm source/blender/python/doc/sphinx-in/bpy.types.*.rst")
# os.system("rm source/blender/python/doc/sphinx-in/bpy.ops.*.rst")
# only for full updates
if _BPY_FULL_REBUILD:
shutil.rmtree(path_in, True)
shutil.rmtree(path_out, True)
else:
# write here, then move
shutil.rmtree(path_in_tmp, True)
rna2sphinx(path_in_tmp)
if not _BPY_FULL_REBUILD:
import filecmp
# now move changed files from 'path_in_tmp' --> 'path_in'
file_list_path_in = set(os.listdir(path_in))
file_list_path_in_tmp = set(os.listdir(path_in_tmp))
# remove deprecated files that have been removed.
for f in sorted(file_list_path_in):
if f not in file_list_path_in_tmp:
print("\tdeprecated: %s" % f)
os.remove(os.path.join(path_in, f))
# freshen with new files.
for f in sorted(file_list_path_in_tmp):
f_from = os.path.join(path_in_tmp, f)
f_to = os.path.join(path_in, f)
do_copy = True
if f in file_list_path_in:
if filecmp.cmp(f_from, f_to):
do_copy = False
if do_copy:
print("\tupdating: %s" % f)
shutil.copy(f_from, f_to)
'''else:
print("\tkeeping: %s" % f) # eh, not that useful'''
EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
if EXAMPLE_SET_UNUSED:
print("\nUnused examples found in '%s'..." % path_examples)

View File

@@ -1,14 +1,13 @@
#!/bin/sh
# run from the blender source dir
# bash source/blender/python/doc/sphinx_doc_gen.sh
# ssh upload means you need a login into the server
# ssh upload means you need an account on the server
BLENDER="./blender.bin"
SSH_HOST="ideasman42@emo.blender.org"
SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation/250PythonDoc"
# clear doc dir
rm -rf ./source/blender/python/doc/sphinx-in ./source/blender/python/doc/sphinx-out
# dont delete existing docs, now partial updates are used for quick builds.
$BLENDER -b -P ./source/blender/python/doc/sphinx_doc_gen.py
# html

View File

@@ -30,7 +30,16 @@
static char py_blf_position_doc[] =
".. function:: position(fontid, x, y, z)\n"
"\n"
" Set the position for drawing text.\n";
" Set the position for drawing text.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg x: X axis position to draw the text.\n"
" :type x: float\n"
" :arg y: Y axis position to draw the text.\n"
" :type y: float\n"
" :arg z: Z axis position to draw the text.\n"
" :type x: float\n";
static PyObject *py_blf_position(PyObject *self, PyObject *args)
{
@@ -51,6 +60,8 @@ static char py_blf_size_doc[] =
"\n"
" Set the size and dpi for drawing text.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg size: Point size of the font.\n"
" :type size: int\n"
" :arg dpi: dots per inch value to use for drawing.\n"
@@ -74,6 +85,8 @@ static char py_blf_aspect_doc[] =
"\n"
" Set the aspect for drawing text.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg aspect: The aspect ratio for text drawing to use.\n"
" :type aspect: float\n";
@@ -96,6 +109,8 @@ static char py_blf_blur_doc[] =
"\n"
" Set the blur radius for drawing text.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg radius: The radius for blurring text (in pixels).\n"
" :type radius: int\n";
@@ -117,6 +132,8 @@ static char py_blf_draw_doc[] =
"\n"
" Draw text in the current context.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg text: the text to draw.\n"
" :type text: string\n";
@@ -138,6 +155,8 @@ static char py_blf_dimensions_doc[] =
"\n"
" Return the width and hight of the text.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg text: the text to draw.\n"
" :type text: string\n"
" :return: the width and height of the text.\n"
@@ -164,7 +183,18 @@ static PyObject *py_blf_dimensions(PyObject *self, PyObject *args)
static char py_blf_clipping_doc[] =
".. function:: clipping(fontid, xmin, ymin, xmax, ymax)\n"
"\n"
" Set the clipping, enable/disable using CLIPPING.\n";
" Set the clipping, enable/disable using CLIPPING.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg xmin: Clip the drawing area by these bounds.\n"
" :type xmin: float\n"
" :arg ymin: Clip the drawing area by these bounds.\n"
" :type ymin: float\n"
" :arg xmax: Clip the drawing area by these bounds.\n"
" :type xmax: float\n"
" :arg ymax: Clip the drawing area by these bounds.\n"
" :type ymax: float\n";
static PyObject *py_blf_clipping(PyObject *self, PyObject *args)
{
@@ -184,6 +214,8 @@ static char py_blf_disable_doc[] =
"\n"
" Disable option.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
" :type option: int\n";
@@ -204,6 +236,8 @@ static char py_blf_enable_doc[] =
"\n"
" Enable option.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
" :type option: int\n";
@@ -224,6 +258,8 @@ static char py_blf_rotation_doc[] =
"\n"
" Set the text rotation angle, enable/disable using ROTATION.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg angle: The angle for text drawing to use.\n"
" :type aspect: float\n";
@@ -245,8 +281,16 @@ static char py_blf_shadow_doc[] =
"\n"
" Shadow options, enable/disable using SHADOW .\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg level: The blur level, can be 3, 5 or 0.\n"
" :type level: int\n";
" :type level: int\n"
" :arg r: Shadow color (red channel 0.0 - 1.0).\n"
" :type r: float\n"
" :arg g: Shadow color (green channel 0.0 - 1.0).\n"
" :type g: float\n"
" :arg b: Shadow color (blue channel 0.0 - 1.0).\n"
" :type b: float\n";
static PyObject *py_blf_shadow(PyObject *self, PyObject *args)
{
@@ -269,7 +313,14 @@ static PyObject *py_blf_shadow(PyObject *self, PyObject *args)
static char py_blf_shadow_offset_doc[] =
".. function:: shadow_offset(fontid, x, y)\n"
"\n"
" Set the offset for shadow text.\n";
" Set the offset for shadow text.\n"
"\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg x: Vertical shadow offset value in pixels.\n"
" :type x: float\n"
" :arg y: Horizontal shadow offset value in pixels.\n"
" :type y: float\n";
static PyObject *py_blf_shadow_offset(PyObject *self, PyObject *args)
{
@@ -283,6 +334,27 @@ static PyObject *py_blf_shadow_offset(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
static char py_blf_load_doc[] =
".. function:: load(filename)\n"
"\n"
" Load a new font.\n"
"\n"
" :arg filename: the filename of the font.\n"
" :type text: string\n"
" :return: the new font's fontid or -1 if there was an error.\n"
" :rtype: integer\n";
static PyObject *py_blf_load(PyObject *self, PyObject *args)
{
int fontid = 0;
char* filename;
if (!PyArg_ParseTuple(args, "s:blf.load", &filename))
return NULL;
return PyLong_FromLong(BLF_load(filename));
}
/*----------------------------MODULE INIT-------------------------*/
struct PyMethodDef BLF_methods[] = {
{"aspect", (PyCFunction) py_blf_aspect, METH_VARARGS, py_blf_aspect_doc},
@@ -297,6 +369,7 @@ struct PyMethodDef BLF_methods[] = {
{"shadow", (PyCFunction) py_blf_shadow, METH_VARARGS, py_blf_shadow_doc},
{"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc},
{"size", (PyCFunction) py_blf_size, METH_VARARGS, py_blf_size_doc},
{"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc},
{NULL, NULL, 0, NULL}
};

View File

@@ -2335,6 +2335,10 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname )
}
}
break;
default:
/* should never happen */
PyErr_Format(PyExc_AttributeError, "bpy_struct: Context type invalid %d, can't get \"%.200s\" from context", newtype, name);
ret= NULL;
}
}
else if (done==-1) { /* found but not set */