- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
  image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
  be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
  accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
  now), same in Blender.Sound: renamed makeActive to setCurrent.  Stephen Swaney
  pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
  functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
  after reading a discussion on blender.org's Python forum where eeshlo mentioned the
  pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
  confirmed, talked to Theeth about this and as he suggested am changing the default
  back to 'worldspace'.
This commit is contained in:
2004-10-20 05:51:24 +00:00
parent f2f004af2d
commit fa9135385a
18 changed files with 535 additions and 101 deletions

View File

@@ -196,9 +196,14 @@ hierarchy (faster)"},
"(i = 0) - Returns list of materials assigned to the object.\n\
if i is nonzero, empty slots are not ignored: they are returned as None's."},
{"getMatrix", ( PyCFunction ) Object_getMatrix, METH_VARARGS,
"(str = 'localspace') - Returns the object matrix.\n\
(str = 'localspace') - the wanted matrix: worldspace, localspace (default)\n\
or oldlocal (not updated, it was the only choice before Blender 2.34)."},
"(str = 'worldspace') - Returns the object matrix.\n\
(str = 'localspace') - the wanted matrix: worldspace (default), localspace\n\
or old_worldspace.\n\
\n\
'old_worldspace' was the only behavior before Blender 2.34. With it the\n\
matrix is not updated for changes made by the script itself\n\
(like obj.LocX = 10) until a redraw happens, either called by the script or\n\
automatic when the script finishes."},
{"getName", ( PyCFunction ) Object_getName, METH_NOARGS,
"Returns the name of the object"},
{"getParent", ( PyCFunction ) Object_getParent, METH_NOARGS,
@@ -952,7 +957,7 @@ static PyObject *Object_getMaterials( BPy_Object * self, PyObject * args )
static PyObject *Object_getMatrix( BPy_Object * self, PyObject * args )
{
PyObject *matrix;
char *space = "localspace"; /* default to local */
char *space = "worldspace"; /* default to local */
if( !PyArg_ParseTuple( args, "|s", &space ) ) {
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
@@ -970,13 +975,14 @@ static PyObject *Object_getMatrix( BPy_Object * self, PyObject * args )
} else if( BLI_streq( space, "localspace" ) ) { /* Localspace matrix */
object_to_mat4( self->object,
*( ( MatrixObject * ) matrix )->matrix );
} else if( BLI_streq( space, "oldlocal" ) ) { /* old behavior, prior to 2.34 */
/* old behavior, prior to 2.34, check this method's doc string: */
} else if( BLI_streq( space, "old_worldspace" ) ) {
Mat4CpyMat4( *( ( MatrixObject * ) matrix )->matrix,
self->object->obmat );
} else {
return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
"wrong parameter, expected nothing or either 'localspace' (default),\n\
'worldspace' or 'oldlocal'" ) );
"wrong parameter, expected nothing or either 'worldspace' (default),\n\
'localspace' or 'old_worldspace'" ) );
}
return matrix;
}
@@ -2199,7 +2205,7 @@ static PyObject *Object_getAttr( BPy_Object * obj, char *name )
}
if( StringEqual( name, "mat" ) || StringEqual( name, "matrix" ) )
return ( Object_getMatrix
( obj, Py_BuildValue( "(s)", "localspace" ) ) );
( obj, Py_BuildValue( "(s)", "worldspace" ) ) );
if( StringEqual( name, "matrixWorld" ) )
return ( Object_getMatrix
( obj, Py_BuildValue( "(s)", "worldspace" ) ) );