Automatically generate blender.1 man page during build process

Patch T40418 by Lawrence D'Oliveiro
This commit is contained in:
Campbell Barton 2014-06-14 01:19:58 +10:00
parent 2ca497d84d
commit cb7915fc60
Notes: blender-bot 2023-02-14 10:34:14 +01:00
Referenced by issue #40418, Automatically generate blender.1 man page during build process
3 changed files with 35 additions and 475 deletions

View File

@ -1,457 +0,0 @@
.TH "BLENDER" "1" "March 6, 2014" "Blender Blender 2\&.70"
.SH NAME
blender \- a 3D modelling and rendering package
.SH SYNOPSIS
.B blender [args ...] [file] [args ...]
.br
.SH DESCRIPTION
.PP
.B blender
is a 3D modelling and rendering package. It is the in-house software of a high quality animation studio, Blender has proven to be an extremely fast and versatile design instrument. The software has a personal touch, offering a unique approach to the world of Three Dimensions.
Use Blender to create TV commercials, to make technical visualizations, business graphics, to do some morphing, or design user interfaces. You can easy build and manage complex environments. The renderer is versatile and extremely fast. All basic animation principles (curves & keys) are well implemented.
http://www.blender.org
.SH OPTIONS
Blender 2.66
Usage: blender [args ...] [file] [args ...]
.br
.SS "Render Options:"
.TP
.B \-b or \-\-background <file>
.br
Load <file> in background (often used for UI\-less rendering)
.br
.TP
.B \-a or \-\-render\-anim
.br
Render frames from start to end (inclusive)
.br
.TP
.B \-S or \-\-scene <name>
.br
Set the active scene <name> for rendering
.br
.TP
.B \-f or \-\-render\-frame <frame>
.br
Render frame <frame> and save it.
.br
+<frame> start frame relative, \-<frame> end frame relative.
.br
.TP
.B \-s or \-\-frame\-start <frame>
.br
Set start to frame <frame> (use before the \-a argument)
.br
.TP
.B \-e or \-\-frame\-end <frame>
.br
Set end to frame <frame> (use before the \-a argument)
.br
.TP
.B \-j or \-\-frame\-jump <frames>
.br
Set number of frames to step forward after each rendered frame
.br
.TP
.B \-o or \-\-render\-output <path>
.br
Set the render path and file name.
.br
Use // at the start of the path to
.br
render relative to the blend file.
.br
The # characters are replaced by the frame number, and used to define zero padding.
.br
ani_##_test.png becomes ani_01_test.png
.br
test\-######.png becomes test\-000001.png
.br
When the filename does not contain #, The suffix #### is added to the filename
.br
The frame number will be added at the end of the filename.
.br
eg: blender \-b foobar.blend \-o //render_ \-F PNG \-x 1 \-a
.br
//render_ becomes //render_####, writing frames as //render_0001.png//
.br
.TP
.B \-E or \-\-engine <engine>
.br
Specify the render engine
.br
use \-E help to list available engines
.br
.IP
.SS "Format Options:"
.TP
.B \-F or \-\-render\-format <format>
.br
Set the render format, Valid options are...
.br
TGA IRIS JPEG MOVIE IRIZ RAWTGA
.br
AVIRAW AVIJPEG PNG BMP FRAMESERVER
.br
(formats that can be compiled into blender, not available on all systems)
.br
HDR TIFF EXR MULTILAYER MPEG AVICODEC QUICKTIME CINEON DPX DDS
.br
.TP
.B \-x or \-\-use\-extension <bool>
.br
Set option to add the file extension to the end of the file
.br
.TP
.B \-t or \-\-threads <threads>
.br
Use amount of <threads> for rendering in background
.br
[1\-64], 0 for systems processor count.
.br
.IP
.SS "Animation Playback Options:"
.TP
.B \-a <options> <file(s)>
.br
Playback <file(s)>, only operates this way when not running in background.
.br
\-p <sx> <sy> Open with lower left corner at <sx>, <sy>
.br
\-m Read from disk (Don't buffer)
.br
\-f <fps> <fps\-base> Specify FPS to start with
.br
\-j <frame> Set frame step to <frame>
.br
\-s <frame> Play from <frame>
.br
\-e <frame> Play until <frame>
.br
.IP
.SS "Window Options:"
.TP
.B \-w or \-\-window\-border
.br
Force opening with borders (default)
.br
.TP
.B \-W or \-\-window\-borderless
.br
Force opening without borders
.br
.TP
.B \-p or \-\-window\-geometry <sx> <sy> <w> <h>
.br
Open with lower left corner at <sx>, <sy> and width and height as <w>, <h>
.br
.TP
.B \-con or \-\-start\-console
.br
Start with the console window open (ignored if \-b is set)
.br
.IP
.SS "Game Engine Specific Options:"
.TP
.B \-g Game Engine specific options
.br
\-g fixedtime Run on 50 hertz without dropping frames
.br
\-g vertexarrays Use Vertex Arrays for rendering (usually faster)
.br
\-g nomipmap No Texture Mipmapping
.br
\-g linearmipmap Linear Texture Mipmapping instead of Nearest (default)
.br
.IP
.SS "Misc Options:"
.TP
.B \-d or \-\-debug
.br
Turn debugging on
.br
.IP
* Prints every operator call and their arguments
.br
* Disables mouse grab (to interact with a debugger in some cases)
.br
* Keeps python sys.stdin rather than setting it to None
.br
.TP
.B \-\-debug\-fpe
.br
Enable floating point exceptions
.br
.TP
.B \-\-disable\-crash\-handler
.br
Disable the crash handler
.br
.IP
.TP
.B \-\-factory\-startup
.br
Skip reading the "startup.blend" in the users home directory
.br
.IP
.TP
.B \-\-env\-system\-datafiles
.br
Set the BLENDER_SYSTEM_DATAFILES environment variable
.br
.TP
.B \-\-env\-system\-scripts
.br
Set the BLENDER_SYSTEM_SCRIPTS environment variable
.br
.TP
.B \-\-env\-system\-python
.br
Set the BLENDER_SYSTEM_PYTHON environment variable
.br
.IP
.TP
.B \-nojoystick
.br
Disable joystick support
.br
.TP
.B \-noglsl
.br
Disable GLSL shading
.br
.TP
.B \-noaudio
.br
Force sound system to None
.br
.TP
.B \-setaudio
.br
Force sound system to a specific device
.br
NULL SDL OPENAL JACK
.br
.IP
.TP
.B \-h or \-\-help
.br
Print this help text and exit
.br
.IP
.TP
.B \-y or \-\-enable\-autoexec
.br
Enable automatic python script execution, (default)
.br
.TP
.B \-Y or \-\-disable\-autoexec
.br
Disable automatic python script execution (pydrivers & startup scripts)
.br
.IP
.TP
.B \-P or \-\-python <filename>
.br
Run the given Python script file
.br
.TP
.B \-\-python\-text <name>
.br
Run the given Python script text block
.br
.TP
.B \-\-python\-console
.br
Run blender with an interactive console
.br
.TP
.B \-\-addons
.br
Comma separated list of addons (no spaces)
.br
.TP
.B \-v or \-\-version
.br
Print Blender version and exit
.br
.TP
.B \-\-
.br
Ends option processing, following arguments passed unchanged. Access via python's sys.argv
.br
.SS "Other Options:"
.TP
.B /?
.br
Print this help text and exit (windows only)
.br
.TP
.B \-\-debug\-python
.br
Enable debug messages for python
.br
.TP
.B \-\-debug\-events
.br
Enable debug messages for the event system
.br
.TP
.B \-\-debug\-handlers
.br
Enable debug messages for event handling
.br
.TP
.B \-\-debug\-wm
.br
Enable debug messages for the window manager
.br
.TP
.B \-\-debug\-all
.br
Enable all debug messages (excludes libmv)
.br
.TP
.B \-\-debug\-value <value>
.br
Set debug value of <value> on startup
.br
.IP
.TP
.B \-\-debug\-jobs
.br
Enable time profiling for background jobs.
.br
.TP
.B \-\-verbose <verbose>
.br
Set logging verbosity level.
.br
.TP
.B \-R
.br
Register .blend extension, then exit (Windows only)
.br
.TP
.B \-r
.br
Silently register .blend extension, then exit (Windows only)
.br
.TP
.B \-\-no\-native\-pixels
.br
Do not use native pixel size, for high resolution displays (MacBook 'Retina')
.br
.SS "Argument Parsing:"
arguments must be separated by white space. eg
"blender \-ba test.blend"
...will ignore the 'a'
"blender \-b test.blend \-f8"
...will ignore 8 because there is no space between the \-f and the frame value
.br
.SS "Argument Order:"
Arguments are executed in the order they are given. eg
"blender \-\-background test.blend \-\-render\-frame 1 \-\-render\-output /tmp"
...will not render to /tmp because '\-\-render\-frame 1' renders before the output path is set
"blender \-\-background \-\-render\-output /tmp test.blend \-\-render\-frame 1"
...will not render to /tmp because loading the blend file overwrites the render output that was set
"blender \-\-background test.blend \-\-render\-output /tmp \-\-render\-frame 1" works as expected.
.br
.br
.SH "ENVIRONMENT VARIABLES"
\fIBLENDER_USER_CONFIG\fR Directory for user configuration files.
\fIBLENDER_USER_SCRIPTS\fR Directory for user scripts.
\fIBLENDER_SYSTEM_SCRIPTS\fR Directory for system wide scripts.
\fIDirectory\fR for user data files (icons, translations, ..).
\fIBLENDER_SYSTEM_DATAFILES\fR Directory for system wide data files.
\fIBLENDER_SYSTEM_PYTHON\fR Directory for system python libraries.
\fITMP\fR or \fITMPDIR\fR Store temporary files here.
\fIPYTHONHOME\fR Path to the python directory, eg. /usr/lib/python.
.br
.br
.br
.SH SEE ALSO
.B yafaray(1)
.br
.SH AUTHORS
This manpage was written for a Debian GNU/Linux system by Daniel Mester
<mester@uni-bremen.de> and updated by Cyril Brulebois
<cyril.brulebois@enst-bretagne.fr> and Dan Eicher <dan@trollwerks.org>.

40
doc/manpage/blender.1.py Normal file → Executable file
View File

@ -18,6 +18,16 @@
#
# ##### END GPL LICENSE BLOCK #####
'''
This script generates the blender.1 man page, embedding the help text
from the Blender executable itself. Invoke it as follows:
blender.1.py <path-to-blender> <output-filename>
where <path-to-blender> is the path to the Blender executable,
and <output-filename> is where to write the generated man page.
'''
# <pep8 compliant>
import subprocess
@ -33,26 +43,23 @@ def man_format(data):
data = data.replace("\t", " ")
return data
# allow passing blender as argument
if sys.argv[-1].endswith(os.sep + "blender"):
blender_bin = sys.argv[-1]
else:
blender_bin = os.path.join(os.path.dirname(__file__), "../../blender.bin")
if len(sys.argv) != 3:
import getopt
raise getopt.GetoptError("Usage: %s <path-to-blender> <output-filename>" % sys.argv[0])
blender_bin = sys.argv[1]
outfilename = sys.argv[2]
cmd = [blender_bin, "--help"]
print(" executing:", " ".join(cmd))
blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode(encoding="utf-8")
blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode(encoding="utf-8").strip()
blender_version = blender_version.split("Build")[0]
blender_help = subprocess.check_output(cmd).decode(encoding="utf-8")
blender_version = subprocess.check_output([blender_bin, "--version"]).decode(encoding="utf-8").strip()
blender_version = blender_version.split("build")[0].rstrip()
blender_version = blender_version.partition(" ")[2] # remove 'Blender' prefix.
date_string = datetime.date.fromtimestamp(time.time()).strftime("%B %d, %Y")
filepath = os.path.splitext(__file__)[0]
file = open(filepath, "w")
fw = file.write
outfile = open(outfilename, "w")
fw = outfile.write
fw('.TH "BLENDER" "1" "%s" "Blender %s"\n' % (date_string, blender_version.replace(".", "\\&.")))
@ -128,4 +135,5 @@ This manpage was written for a Debian GNU/Linux system by Daniel Mester
<cyril.brulebois@enst-bretagne.fr> and Dan Eicher <dan@trollwerks.org>.
''')
print("written:", filepath)
outfile.close()
print("written:", outfilename)

View File

@ -387,13 +387,22 @@ endif()
if(UNIX AND NOT APPLE)
install(
CODE
"
execute_process(COMMAND
${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py
${TARGETDIR}/blender
${TARGETDIR}/blender.1)
"
)
# there are a few differences between portable and system install
if(WITH_INSTALL_PORTABLE)
install(
FILES
${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
DESTINATION ${TARGETDIR}
)
@ -456,7 +465,7 @@ if(UNIX AND NOT APPLE)
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
install(
FILES ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
FILES ${TARGETDIR}/blender.1
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
)
install(