Wrap UndoPush with python, needed for apricot, so changes made be scripts can have undo's as well, otherwise users undo and loose changes the script made.

This commit is contained in:
2008-02-29 20:45:57 +00:00
parent 9d05090a86
commit a577bb9fc8
2 changed files with 20 additions and 2 deletions

View File

@@ -115,6 +115,7 @@ static PyObject *Blender_PackAll( PyObject * self);
static PyObject *Blender_UnpackAll( PyObject * self, PyObject * value);
static PyObject *Blender_CountPackedFiles( PyObject * self );
static PyObject *Blender_GetPaths( PyObject * self, PyObject *args, PyObject *keywds );
static PyObject *Blender_UndoPush( PyObject * self, PyObject *args );
extern PyObject *Text3d_Init( void ); /* missing in some include */
/*****************************************************************************/
@@ -201,6 +202,9 @@ static char Blender_CountPackedFiles_doc[] =
static char Blender_GetPaths_doc[] =
"() - Returns a list of paths used in this blend file.";
static char Blender_UndoPush_doc[] =
"(s) - Push an undo with blenders current state.";
/*****************************************************************************/
/* Python method structure definition. */
/*****************************************************************************/
@@ -217,8 +221,8 @@ static struct PyMethodDef Blender_methods[] = {
{"GetPaths", ( PyCFunction ) Blender_GetPaths, METH_VARARGS|METH_KEYWORDS, Blender_GetPaths_doc},
{"PackAll", ( PyCFunction ) Blender_PackAll, METH_NOARGS, Blender_PackAll_doc},
{"UnpackAll", Blender_UnpackAll, METH_O, Blender_UnpackAll_doc},
{"UpdateMenus", ( PyCFunction ) Blender_UpdateMenus, METH_NOARGS,
Blender_UpdateMenus_doc},
{"UpdateMenus", ( PyCFunction ) Blender_UpdateMenus, METH_NOARGS, Blender_UpdateMenus_doc},
{"UndoPush", Blender_UndoPush, METH_VARARGS, Blender_UndoPush_doc},
{NULL, NULL, 0, NULL}
};
@@ -950,6 +954,14 @@ static PyObject *Blender_GetPaths( PyObject * self, PyObject *args, PyObject *ke
return list;
}
static PyObject *Blender_UndoPush( PyObject * self, PyObject *args )
{
char *str;
if ( !PyArg_ParseTuple( args , "s" , &str ))
return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a string" );
BIF_undo_push(str);
Py_RETURN_NONE;
}
static PyObject *Blender_UnpackModesDict( void )
{

View File

@@ -240,3 +240,9 @@ def Quit ():
upon exiting) when this function is called, so the data in Blender isn't
lost.
"""
def UndoPush (message):
"""
Sets an undo at the current state.
@param message: Message that appiers in the undo menu
@type message: string
"""