Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2004-07-16 07:08:43 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2004-07-16 07:08:43 +0400
commit97bba404fbf97d247d0b6623c7a38f46247afddb (patch)
tree9a881f85bb539508ff184a95d4e50b3db1ae8436 /source/blender/python/api2_2x/Sys.c
parent146021ea2eba641285167814dae99cef79d7d419 (diff)
Demo mode and BPython:
- small additions and fixes to enable the demo mode; - Added sleep() to Blender.sys and 17 new functions to Blender.Window module: things to help demo script writing and as a bonus read / write access to Blender's input event queue; - updates in docs, those interested please check Window.py in python/api2_2x/doc/ to read about the new Blender.Window functions. ---- Demo mode should be working well now for (I) playing rt animation -- aka ALT+A -- and (II) rendering pics and anims and playing anims. I'll still add access to radiosity data and functions. PS: Joseph Gilbert made (II) possible with the Scene.Render module he added for 2.32. He's been coding great things for bpython, so I'd like to take the chance to point that and thank him here.
Diffstat (limited to 'source/blender/python/api2_2x/Sys.c')
-rw-r--r--source/blender/python/api2_2x/Sys.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Sys.c b/source/blender/python/api2_2x/Sys.c
index 39412fada16..f42afcbadbc 100644
--- a/source/blender/python/api2_2x/Sys.c
+++ b/source/blender/python/api2_2x/Sys.c
@@ -47,6 +47,7 @@ static PyObject *M_sys_splitext (PyObject *self, PyObject *args);
static PyObject *M_sys_makename (PyObject *self, PyObject *args, PyObject *kw);
static PyObject *M_sys_exists (PyObject *self, PyObject *args);
static PyObject *M_sys_time (PyObject *self);
+static PyObject *M_sys_sleep (PyObject *self, PyObject *args);
/*****************************************************************************/
/* The following string definitions are used for documentation strings. */
@@ -92,6 +93,11 @@ static char M_sys_time_doc[] =
Each successive call is garanteed to return values greater than or\n\
equal to the previous call.";
+static char M_sys_sleep_doc[] =
+"(milliseconds = 10) - Sleep for the specified time.\n\
+(milliseconds = 10) - the amount of time in milliseconds to sleep.\n\
+This function can be necessary in tight 'get event' loops.";
+
static char M_sys_exists_doc[] =
"(path) - Check if the given pathname exists.\n\
The return value is as follows:\n\
@@ -111,6 +117,7 @@ struct PyMethodDef M_sys_methods[] = {
{"makename", (PyCFunction)M_sys_makename, METH_VARARGS|METH_KEYWORDS,
M_sys_makename_doc},
{"exists", M_sys_exists, METH_VARARGS, M_sys_exists_doc},
+ {"sleep", M_sys_sleep, METH_VARARGS, M_sys_sleep_doc},
{"time", (PyCFunction)M_sys_time, METH_NOARGS, M_sys_time_doc},
{NULL, NULL, 0, NULL}
};
@@ -341,6 +348,19 @@ static PyObject *M_sys_time (PyObject *self)
return Py_BuildValue("d", t);
}
+static PyObject *M_sys_sleep (PyObject *self, PyObject *args)
+{
+ int millisecs = 10;
+
+ if (!PyArg_ParseTuple(args, "|i", &millisecs))
+ return EXPP_ReturnPyObjError (PyExc_TypeError,
+ "expected int argument");
+
+ PIL_sleep_ms(millisecs);
+
+ return EXPP_incr_ret(Py_None);
+}
+
static PyObject *M_sys_exists (PyObject *self, PyObject *args)
{
struct stat st;