diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index ec352061268e2395f8e16637919b420590dc4ac6..afc093a6965bdd73405351ed74e13eb47641e103 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -1799,15 +1799,16 @@ static PyObject *Object_addProperty( BPy_Object * self, PyObject * args ) char *prop_type = NULL; short type = -1; BPy_Property *py_prop = NULL; + int argslen = PyObject_Length( args ); - if( PyObject_Length( args ) == 3 || PyObject_Length( args ) == 2 ) { + if( argslen == 3 || argslen == 2 ) { if( !PyArg_ParseTuple ( args, "sO|s", &prop_name, &prop_data, &prop_type ) ) { return ( EXPP_ReturnPyObjError ( PyExc_AttributeError, "unable to get string, data, and optional string" ) ); } - } else if( PyObject_Length( args ) == 1 ) { + } else if( argslen == 1 ) { if( !PyArg_ParseTuple( args, "O!", &property_Type, &py_prop ) ) { return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "unable to get Property" ) ); diff --git a/source/blender/python/api2_2x/Window.c b/source/blender/python/api2_2x/Window.c index 1053c29e9302037f91bcb6bd15131b350bec7802..28a17d08936b4b1cc041c64deb713c1d12ef4b0d 100644 --- a/source/blender/python/api2_2x/Window.c +++ b/source/blender/python/api2_2x/Window.c @@ -798,7 +798,7 @@ static PyObject *M_Window_GetViewMatrix( PyObject * self ) static PyObject *M_Window_GetPerspMatrix( PyObject * self ) { PyObject *perspmat; - + if( !G.vd ) { Py_INCREF( Py_None ); return Py_None; @@ -847,9 +847,14 @@ static PyObject *M_Window_ViewLayer( PyObject * self, PyObject * args ) PyObject *list = NULL, *resl = NULL; int val, i, bit = 0, layer = 0; + if( !G.vd ) { + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "this function can only be used after a 3d View has been initialized" ); + } + if( !PyArg_ParseTuple( args, "|O!", &PyList_Type, &list ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, - "expected nothing or a list of ints as argument" ); + "expected nothing or a list of ints as argument" ); if( list ) { for( i = 0; i < PyList_Size( list ); i++ ) { @@ -911,7 +916,7 @@ static PyObject *M_Window_CameraView( PyObject * self, PyObject * args ) if( !G.vd ) return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "View3d not available!" ); + "this function can only be used after a 3d View has been initialized" ); if( !G.vd->camera ) { if( BASACT && OBACT->type == OB_CAMERA ) diff --git a/source/blender/python/api2_2x/doc/API_intro.py b/source/blender/python/api2_2x/doc/API_intro.py index b8506fd87e06d0853d7fbaab4fdaa9bc48dbc3b0..fb8df69a5eb8b0731530c04d951bfe454e0ac1e7 100644 --- a/source/blender/python/api2_2x/doc/API_intro.py +++ b/source/blender/python/api2_2x/doc/API_intro.py @@ -164,7 +164,12 @@ Command line mode: "-b" background mode and additions like the "-P" command line switch, L{Blender.Save}, L{Blender.Load}, L{Blender.Quit} and the L{Library} module, for many tasks it's possible to control Blender via some automated process - using scripts. + using scripts. Note that command line scripts are run before Blender + initializes its windows, so many functions that get or set window related + attributes (like most in L{Window}) don't work here. If you need those, use + an ONLOAD script link (see L{Scene.Scene.addScriptLink}) instead -- it's + also possible to use a command line script to write or set an ONLOAD script + link. Demo mode: ---------- @@ -294,7 +299,7 @@ A note to newbie script writers: @author: The Blender Python Team @requires: Blender 2.35 or newer. -@version: 2.35 +@version: 2.35 - 2.36 @see: U{www.blender3d.org<http://www.blender3d.org>}: main site @see: U{www.blender.org<http://www.blender.org>}: documentation and forum @see: U{www.elysiun.com<http://www.elysiun.com>}: user forum diff --git a/source/blender/python/api2_2x/doc/epy_docgen.sh b/source/blender/python/api2_2x/doc/epy_docgen.sh index 27d82c9d373aca1d6824b072f29d04bba6de4c15..8939a0db0006fb9182914face2a684ba7433f164 100644 --- a/source/blender/python/api2_2x/doc/epy_docgen.sh +++ b/source/blender/python/api2_2x/doc/epy_docgen.sh @@ -4,6 +4,6 @@ # run from the doc directory containing the .py files # usage: sh epy_docgen.sh -epydoc -o BPY_API_234 --url "http://www.blender.org" -t API_intro.py \ +epydoc -o BPY_API_236 --url "http://www.blender.org" -t API_intro.py \ -n "Blender" --no-private --no-frames \ $( ls [A-Z]*.py ) diff --git a/source/blender/python/api2_2x/logic.c b/source/blender/python/api2_2x/logic.c index d3631a00ba9536a986a35889b925689750da83a9..2dc74a8b4794e6b495d480f99fdf597056d2a3de 100644 --- a/source/blender/python/api2_2x/logic.c +++ b/source/blender/python/api2_2x/logic.c @@ -429,7 +429,7 @@ static PyObject *Property_getData( BPy_Property * self ) attr = EXPP_incr_ret( self->data ); } else { if( self->property->type == PROP_BOOL ) { - if( *( ( int * ) &self->property->poin ) ) + if( self->property->data ) attr = EXPP_incr_ret( Py_True ); else attr = EXPP_incr_ret( Py_False );