give a more useful error when attempting to opengl render in background mode.

add some tips to the python docs.
This commit is contained in:
Campbell Barton 2012-01-13 06:59:16 +00:00
parent cb499c57ec
commit 153be23dbe
2 changed files with 27 additions and 0 deletions

View File

@ -26,6 +26,27 @@ There are 3 main uses for the terminal, these are:
For Linux and OSX users this means starting the terminal first, then running blender from within it. On Windows the terminal can be enabled from the help menu. For Linux and OSX users this means starting the terminal first, then running blender from within it. On Windows the terminal can be enabled from the help menu.
Interface Tricks
================
Access Operator Commands
------------------------
You may have noticed that the tooltip for menu items and buttons includes the ``bpy.ops``... command to run that button, a handy (hidden) feature is that you can press Ctrl+C over any menu item/button to copy this command into the clipboard.
Access Data Path
----------------
To find the path from an :class:`ID` datablock to its setting isn't always so simple since it may be nested away. To get this quickly you can right click on the setting and select select **Copy Data Path**,
if this can't be generated, only the property name is copied.
.. note::
This uses the same method for creating the animation path used by :class:`FCurve.data_path` and :class:`DriverTarget.data_path` drivers.
Show All Operators Show All Operators
================== ==================

View File

@ -46,6 +46,7 @@
#include "DNA_object_types.h" #include "DNA_object_types.h"
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h" #include "BKE_image.h"
#include "BKE_main.h" #include "BKE_main.h"
#include "BKE_report.h" #include "BKE_report.h"
@ -258,6 +259,11 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
const short is_write_still= RNA_boolean_get(op->ptr, "write_still"); const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
char err_out[256]= "unknown"; char err_out[256]= "unknown";
if(G.background) {
BKE_report(op->reports, RPT_ERROR, "Can't use OpenGL render in background mode (no opengl context)");
return 0;
}
/* ensure we have a 3d view */ /* ensure we have a 3d view */
if(!ED_view3d_context_activate(C)) { if(!ED_view3d_context_activate(C)) {