==Python API==
layerMask access for bone and armatures Window.PoseMode() similar to Window.EditMode()
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include "BIF_screen.h"
|
||||
#include "BIF_space.h"
|
||||
#include "BIF_drawtext.h"
|
||||
#include "BIF_poseobject.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
@@ -86,6 +87,7 @@ static PyObject *M_Window_GetPerspMatrix( PyObject * self );
|
||||
static PyObject *M_Window_FileSelector( PyObject * self, PyObject * args );
|
||||
static PyObject *M_Window_ImageSelector( PyObject * self, PyObject * args );
|
||||
static PyObject *M_Window_EditMode( PyObject * self, PyObject * args );
|
||||
static PyObject *M_Window_PoseMode( PyObject * self, PyObject * args );
|
||||
static PyObject *M_Window_ViewLayers( PyObject * self, PyObject * args );
|
||||
static PyObject *M_Window_CameraView( PyObject * self, PyObject * args );
|
||||
static PyObject *M_Window_QTest( PyObject * self );
|
||||
@@ -180,6 +182,9 @@ Returns the current status. This function is mostly useful to leave\n\
|
||||
edit mode before applying changes to a mesh (otherwise the changes will\n\
|
||||
be lost) and then returning to it upon leaving.";
|
||||
|
||||
static char M_Window_PoseMode_doc[] =
|
||||
"() - Get the current status -- 0: not in pose mode; 1: in edit mode";
|
||||
|
||||
static char M_Window_ViewLayers_doc[] =
|
||||
"(layers = [], winid = None) - Get/set active layers in all 3d View windows.\n\
|
||||
() - Make no changes, only return currently visible layers.\n\
|
||||
@@ -325,6 +330,8 @@ struct PyMethodDef M_Window_methods[] = {
|
||||
M_Window_GetPerspMatrix_doc},
|
||||
{"EditMode", ( PyCFunction ) M_Window_EditMode, METH_VARARGS,
|
||||
M_Window_EditMode_doc},
|
||||
{"PoseMode", ( PyCFunction ) M_Window_PoseMode, METH_VARARGS,
|
||||
M_Window_PoseMode_doc},
|
||||
{"ViewLayers", ( PyCFunction ) M_Window_ViewLayers, METH_VARARGS,
|
||||
M_Window_ViewLayers_doc},
|
||||
/* typo, deprecate someday: */
|
||||
@@ -949,6 +956,32 @@ static PyObject *M_Window_EditMode( PyObject * self, PyObject * args )
|
||||
return Py_BuildValue( "h", G.obedit ? 1 : 0 );
|
||||
}
|
||||
|
||||
static PyObject *M_Window_PoseMode( PyObject * self, PyObject * args )
|
||||
{
|
||||
short status = -1;
|
||||
short is_posemode = 0;
|
||||
Base *base;
|
||||
|
||||
if( !PyArg_ParseTuple( args, "|h", &status ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected optional int (bool) as argument" );
|
||||
|
||||
if( status >= 0 ) {
|
||||
if( status ) {
|
||||
enter_posemode();
|
||||
} else if( G.obedit ) {
|
||||
exit_posemode();
|
||||
}
|
||||
}
|
||||
|
||||
base= BASACT;
|
||||
if (base && base->object->flag & OB_POSEMODE) {
|
||||
is_posemode = 1;
|
||||
}
|
||||
|
||||
return Py_BuildValue( "h", is_posemode );
|
||||
}
|
||||
|
||||
static PyObject *M_Window_ViewLayers( PyObject * self, PyObject * args )
|
||||
{
|
||||
PyObject *item = NULL;
|
||||
|
||||
Reference in New Issue
Block a user