forked from bartvdbraak/blender
sphinx doc gen
- use 3 column lists for inherited props, funcs and for references to save on vertical space. - use the blender version string for the upload path and PDF name.
This commit is contained in:
parent
b0c4b1216d
commit
52cefa4bc1
@ -505,7 +505,7 @@ class WM_OT_doc_view(bpy.types.Operator):
|
|||||||
bl_label = "View Documentation"
|
bl_label = "View Documentation"
|
||||||
|
|
||||||
doc_id = doc_id
|
doc_id = doc_id
|
||||||
_prefix = 'http://www.blender.org/documentation/250PythonDoc'
|
_prefix = "http://www.blender.org/documentation/blender_python_api_%s" % "_".join(str(v) for v in bpy.app.version)
|
||||||
|
|
||||||
def _nested_class_string(self, class_string):
|
def _nested_class_string(self, class_string):
|
||||||
ls = []
|
ls = []
|
||||||
|
@ -316,7 +316,7 @@ class INFO_MT_help(bpy.types.Menu):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("wm.url_open", text="Report a Bug", icon='URL').url = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse'
|
layout.operator("wm.url_open", text="Report a Bug", icon='URL').url = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse'
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = 'http://www.blender.org/documentation/250PythonDoc/contents.html'
|
layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = "http://www.blender.org/documentation/blender_python_api_%s/contents.html" % "_".join(str(v) for v in bpy.app.version)
|
||||||
layout.operator("help.operator_cheat_sheet", icon='TEXT')
|
layout.operator("help.operator_cheat_sheet", icon='TEXT')
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP')
|
layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP')
|
||||||
|
@ -307,6 +307,9 @@ def rna2sphinx(BASEPATH):
|
|||||||
if bpy.app.build_revision != "Unknown":
|
if bpy.app.build_revision != "Unknown":
|
||||||
version_string = version_string + " r" + bpy.app.build_revision
|
version_string = version_string + " r" + bpy.app.build_revision
|
||||||
|
|
||||||
|
# for use with files
|
||||||
|
version_string_fp = "_".join(str(v) for v in bpy.app.version)
|
||||||
|
|
||||||
fw("project = 'Blender'\n")
|
fw("project = 'Blender'\n")
|
||||||
# fw("master_doc = 'index'\n")
|
# fw("master_doc = 'index'\n")
|
||||||
fw("copyright = u'Blender Foundation'\n")
|
fw("copyright = u'Blender Foundation'\n")
|
||||||
@ -336,7 +339,7 @@ def rna2sphinx(BASEPATH):
|
|||||||
fw("\n")
|
fw("\n")
|
||||||
fw("An introduction to Blender and Python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n")
|
fw("An introduction to Blender and Python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n")
|
||||||
fw("\n")
|
fw("\n")
|
||||||
fw("`A PDF version of this document is also available <blender_python_reference_250.pdf>`__\n")
|
fw("`A PDF version of this document is also available <blender_python_reference_%s.pdf>`__\n" % version_string_fp)
|
||||||
fw("\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(".. 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(" \n")
|
||||||
@ -636,20 +639,24 @@ def rna2sphinx(BASEPATH):
|
|||||||
if _BPY_STRUCT_FAKE:
|
if _BPY_STRUCT_FAKE:
|
||||||
for key, descr in descr_items:
|
for key, descr in descr_items:
|
||||||
if type(descr) == GetSetDescriptorType:
|
if type(descr) == GetSetDescriptorType:
|
||||||
lines.append("* :class:`%s.%s`\n" % (_BPY_STRUCT_FAKE, key))
|
lines.append(" * :class:`%s.%s`\n" % (_BPY_STRUCT_FAKE, key))
|
||||||
|
|
||||||
for base in bases:
|
for base in bases:
|
||||||
for prop in base.properties:
|
for prop in base.properties:
|
||||||
lines.append("* :class:`%s.%s`\n" % (base.identifier, prop.identifier))
|
lines.append(" * :class:`%s.%s`\n" % (base.identifier, prop.identifier))
|
||||||
|
|
||||||
for identifier, py_prop in base.get_py_properties():
|
for identifier, py_prop in base.get_py_properties():
|
||||||
lines.append("* :class:`%s.%s`\n" % (base.identifier, identifier))
|
lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier))
|
||||||
|
|
||||||
for identifier, py_prop in base.get_py_properties():
|
for identifier, py_prop in base.get_py_properties():
|
||||||
lines.append("* :class:`%s.%s`\n" % (base.identifier, identifier))
|
lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier))
|
||||||
|
|
||||||
if lines:
|
if lines:
|
||||||
fw(".. rubric:: Inherited Properties\n\n")
|
fw(".. rubric:: Inherited Properties\n\n")
|
||||||
|
|
||||||
|
fw(".. hlist::\n")
|
||||||
|
fw(" :columns: 3\n\n")
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
fw(line)
|
fw(line)
|
||||||
fw("\n")
|
fw("\n")
|
||||||
@ -661,16 +668,20 @@ def rna2sphinx(BASEPATH):
|
|||||||
if _BPY_STRUCT_FAKE:
|
if _BPY_STRUCT_FAKE:
|
||||||
for key, descr in descr_items:
|
for key, descr in descr_items:
|
||||||
if type(descr) == MethodDescriptorType:
|
if type(descr) == MethodDescriptorType:
|
||||||
lines.append("* :class:`%s.%s`\n" % (_BPY_STRUCT_FAKE, key))
|
lines.append(" * :class:`%s.%s`\n" % (_BPY_STRUCT_FAKE, key))
|
||||||
|
|
||||||
for base in bases:
|
for base in bases:
|
||||||
for func in base.functions:
|
for func in base.functions:
|
||||||
lines.append("* :class:`%s.%s`\n" % (base.identifier, func.identifier))
|
lines.append(" * :class:`%s.%s`\n" % (base.identifier, func.identifier))
|
||||||
for identifier, py_func in base.get_py_functions():
|
for identifier, py_func in base.get_py_functions():
|
||||||
lines.append("* :class:`%s.%s`\n" % (base.identifier, identifier))
|
lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier))
|
||||||
|
|
||||||
if lines:
|
if lines:
|
||||||
fw(".. rubric:: Inherited Functions\n\n")
|
fw(".. rubric:: Inherited Functions\n\n")
|
||||||
|
|
||||||
|
fw(".. hlist::\n")
|
||||||
|
fw(" :columns: 3\n\n")
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
fw(line)
|
fw(line)
|
||||||
fw("\n")
|
fw("\n")
|
||||||
@ -682,11 +693,14 @@ def rna2sphinx(BASEPATH):
|
|||||||
# use this otherwise it gets in the index for a normal heading.
|
# use this otherwise it gets in the index for a normal heading.
|
||||||
fw(".. rubric:: References\n\n")
|
fw(".. rubric:: References\n\n")
|
||||||
|
|
||||||
|
fw(".. hlist::\n")
|
||||||
|
fw(" :columns: 3\n\n")
|
||||||
|
|
||||||
for ref in struct.references:
|
for ref in struct.references:
|
||||||
ref_split = ref.split(".")
|
ref_split = ref.split(".")
|
||||||
if len(ref_split) > 2:
|
if len(ref_split) > 2:
|
||||||
ref = ref_split[-2] + "." + ref_split[-1]
|
ref = ref_split[-2] + "." + ref_split[-1]
|
||||||
fw("* :class:`%s`\n" % ref)
|
fw(" * :class:`%s`\n" % ref)
|
||||||
fw("\n")
|
fw("\n")
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,12 @@
|
|||||||
|
|
||||||
BLENDER="./blender.bin"
|
BLENDER="./blender.bin"
|
||||||
SSH_HOST="ideasman42@emo.blender.org"
|
SSH_HOST="ideasman42@emo.blender.org"
|
||||||
SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation/250PythonDoc"
|
SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation" # blender_python_api_VERSION, added after
|
||||||
|
|
||||||
|
# sed string from hell, 'Blender 2.53 (sub 1) Build' --> '2_53_1'
|
||||||
|
# "_".join(str(v) for v in bpy.app.version)
|
||||||
|
BLENDER_VERSION=`$BLENDER --version | cut -f2-4 -d" " | sed 's/(//g' | sed 's/)//g' | sed 's/ sub /./g' | sed 's/\./_/g'`
|
||||||
|
SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION
|
||||||
|
|
||||||
# dont delete existing docs, now partial updates are used for quick builds.
|
# dont delete existing docs, now partial updates are used for quick builds.
|
||||||
$BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py
|
$BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py
|
||||||
@ -13,12 +18,12 @@ $BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py
|
|||||||
# html
|
# html
|
||||||
sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
|
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
|
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'/*'
|
ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*'
|
||||||
rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD/
|
rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
|
||||||
|
|
||||||
# pdf
|
# pdf
|
||||||
sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
|
sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
|
||||||
cd source/blender/python/doc/sphinx-out
|
cd source/blender/python/doc/sphinx-out
|
||||||
make
|
make
|
||||||
cd ../../../../../
|
cd ../../../../../
|
||||||
rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD/blender_python_reference_250.pdf
|
rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
|
||||||
|
@ -131,6 +131,8 @@ extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
|
|||||||
char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */
|
char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */
|
||||||
char btempdir[FILE_MAXDIR+FILE_MAXFILE];
|
char btempdir[FILE_MAXDIR+FILE_MAXFILE];
|
||||||
|
|
||||||
|
#define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION
|
||||||
|
|
||||||
/* Initialise callbacks for the modules that need them */
|
/* Initialise callbacks for the modules that need them */
|
||||||
static void setCallbacks(void);
|
static void setCallbacks(void);
|
||||||
|
|
||||||
@ -175,17 +177,14 @@ static void strip_quotes(char *str)
|
|||||||
|
|
||||||
static int print_version(int argc, char **argv, void *data)
|
static int print_version(int argc, char **argv, void *data)
|
||||||
{
|
{
|
||||||
|
printf (BLEND_VERSION_STRING_FMT);
|
||||||
#ifdef BUILD_DATE
|
#ifdef BUILD_DATE
|
||||||
printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
|
|
||||||
printf ("\tbuild date: %s\n", build_date);
|
printf ("\tbuild date: %s\n", build_date);
|
||||||
printf ("\tbuild time: %s\n", build_time);
|
printf ("\tbuild time: %s\n", build_time);
|
||||||
printf ("\tbuild revision: %s\n", build_rev);
|
printf ("\tbuild revision: %s\n", build_rev);
|
||||||
printf ("\tbuild platform: %s\n", build_platform);
|
printf ("\tbuild platform: %s\n", build_platform);
|
||||||
printf ("\tbuild type: %s\n", build_type);
|
printf ("\tbuild type: %s\n", build_type);
|
||||||
#else
|
|
||||||
printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -195,7 +194,7 @@ static int print_help(int argc, char **argv, void *data)
|
|||||||
{
|
{
|
||||||
bArgs *ba = (bArgs*)data;
|
bArgs *ba = (bArgs*)data;
|
||||||
|
|
||||||
printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
|
printf (BLEND_VERSION_STRING_FMT);
|
||||||
printf ("Usage: blender [args ...] [file] [args ...]\n\n");
|
printf ("Usage: blender [args ...] [file] [args ...]\n\n");
|
||||||
|
|
||||||
printf ("Render Options:\n");
|
printf ("Render Options:\n");
|
||||||
@ -344,7 +343,7 @@ static int background_mode(int argc, char **argv, void *data)
|
|||||||
static int debug_mode(int argc, char **argv, void *data)
|
static int debug_mode(int argc, char **argv, void *data)
|
||||||
{
|
{
|
||||||
G.f |= G_DEBUG; /* std output printf's */
|
G.f |= G_DEBUG; /* std output printf's */
|
||||||
printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
|
printf(BLEND_VERSION_STRING_FMT);
|
||||||
MEM_set_memory_debug();
|
MEM_set_memory_debug();
|
||||||
|
|
||||||
#ifdef NAN_BUILDINFO
|
#ifdef NAN_BUILDINFO
|
||||||
|
Loading…
Reference in New Issue
Block a user