From 391cc2d004c5fc231ac546d89f64ae4ba5c062c0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Mar 2010 16:41:01 +0000 Subject: merge own commits into render branch into trunk since 27560 27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623 --- source/blender/python/doc/sphinx_doc_gen.py | 2 ++ source/blender/python/doc/sphinx_doc_gen.sh | 25 +++++++++++++++++++++++++ source/blender/python/generic/IDProp.c | 4 +--- source/blender/python/intern/bpy_rna.c | 11 +++++++++-- 4 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 source/blender/python/doc/sphinx_doc_gen.sh (limited to 'source/blender/python') diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py index 701aad651cf..944dbb082a6 100644 --- a/source/blender/python/doc/sphinx_doc_gen.py +++ b/source/blender/python/doc/sphinx_doc_gen.py @@ -277,6 +277,8 @@ def rna2sphinx(BASEPATH): fw("\n") fw("An introduction to blender and python can be found at \n") fw("\n") + fw("`A PDF version of this document is also available `__\n") + fw("\n") fw(".. warning:: The Python API in Blender is **UNSTABLE**, It should only be used for testing, any script written now may break in future releases.\n") fw(" \n") fw(" The following areas are subject to change.\n") diff --git a/source/blender/python/doc/sphinx_doc_gen.sh b/source/blender/python/doc/sphinx_doc_gen.sh new file mode 100644 index 00000000000..3f5460a0626 --- /dev/null +++ b/source/blender/python/doc/sphinx_doc_gen.sh @@ -0,0 +1,25 @@ +#!/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 + +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 +$BLENDER -b -P ./source/blender/python/doc/sphinx_doc_gen.py + +# html +sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out +cp source/blender/python/doc/sphinx-out/contents.html source/blender/python/doc/sphinx-out/index.html +ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD'/*' +rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD/ + +# pdf +sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out +cd source/blender/python/doc/sphinx-out +make +cd ../../../../../ +rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD/blender_python_reference_250.pdf diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index eb883be5a56..f7eb800ef23 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -24,10 +24,8 @@ */ #include "BKE_idprop.h" - #include "IDProp.h" - -#define BSTR_EQ(a, b) (*(a) == *(b) && !strcmp(a, b)) +#include "MEM_guardedalloc.h" /*** Function to wrap ID properties ***/ PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index c9906bb1599..dcbdc6d64d4 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -359,7 +359,7 @@ static PyObject *pyrna_struct_repr( BPy_StructRNA *self ) return pyob; } - return PyUnicode_FromFormat( "", RNA_struct_identifier(self->ptr.type)); + return PyUnicode_FromFormat( "", RNA_struct_identifier(self->ptr.type), self->ptr.data); } static PyObject *pyrna_prop_repr( BPy_PropertyRNA *self ) @@ -1663,8 +1663,9 @@ int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *error_pre { char *path; PropertyRNA *prop; + int array_len; - if (!PyArg_ParseTuple(args, "s|if", &path, &index, &cfra)) { + if (!PyArg_ParseTuple(args, "s|if", &path, index, cfra)) { PyErr_Format(PyExc_TypeError, "%.200s expected a string and optionally an int and float arguments", error_prefix); return -1; } @@ -1693,6 +1694,12 @@ int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *error_pre return -1; } + array_len= RNA_property_array_length(ptr, prop); + if((*index) != -1 && (*index) >= array_len) { + PyErr_Format( PyExc_TypeError, "%.200s index out of range \"%s\", given %d, array length is %d", error_prefix, path, *index, array_len); + return -1; + } + if(*cfra==FLT_MAX) *cfra= CTX_data_scene(BPy_GetContext())->r.cfra; -- cgit v1.2.3