Blender  V3.3
Functions | Variables
bpy_app_timers.c File Reference
#include "BLI_timer.h"
#include "BLI_utildefines.h"
#include "PIL_time.h"
#include <Python.h>
#include "BPY_extern.h"
#include "bpy_app_timers.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"

Go to the source code of this file.

Functions

static double handle_returned_value (PyObject *function, PyObject *ret)
 
static double py_timer_execute (uintptr_t UNUSED(uuid), void *user_data)
 
static void py_timer_free (uintptr_t UNUSED(uuid), void *user_data)
 
 PyDoc_STRVAR (bpy_app_timers_register_doc, ".. function:: register(function, first_interval=0, persistent=False)\n" "\n" " Add a new function that will be called after the specified amount of seconds.\n" " The function gets no arguments and is expected to return either None or a float.\n" " If ``None`` is returned, the timer will be unregistered.\n" " A returned number specifies the delay until the function is called again.\n" " ``functools.partial`` can be used to assign some parameters.\n" "\n" " :arg function: The function that should called.\n" " :type function: Callable[[], Union[float, None]]\n" " :arg first_interval: Seconds until the callback should be called the first time.\n" " :type first_interval: float\n" " :arg persistent: Don't remove timer when a new file is loaded.\n" " :type persistent: bool\n")
 
static PyObject * bpy_app_timers_register (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (bpy_app_timers_unregister_doc, ".. function:: unregister(function)\n" "\n" " Unregister timer.\n" "\n" " :arg function: Function to unregister.\n" " :type function: function\n")
 
static PyObject * bpy_app_timers_unregister (PyObject *UNUSED(self), PyObject *function)
 
 PyDoc_STRVAR (bpy_app_timers_is_registered_doc, ".. function:: is_registered(function)\n" "\n" " Check if this function is registered as a timer.\n" "\n" " :arg function: Function to check.\n" " :type function: int\n" " :return: True when this function is registered, otherwise False.\n" " :rtype: bool\n")
 
static PyObject * bpy_app_timers_is_registered (PyObject *UNUSED(self), PyObject *function)
 
PyObject * BPY_app_timers_module (void)
 

Variables

static struct PyMethodDef M_AppTimers_methods []
 
static struct PyModuleDef M_AppTimers_module_def
 

Function Documentation

◆ bpy_app_timers_is_registered()

static PyObject* bpy_app_timers_is_registered ( PyObject *  UNUSEDself,
PyObject *  function 
)
static

Definition at line 146 of file bpy_app_timers.c.

References BLI_timer_is_registered(), and ret.

◆ BPY_app_timers_module()

PyObject* BPY_app_timers_module ( void  )

Definition at line 177 of file bpy_app_timers.c.

References M_AppTimers_module_def, and mod().

Referenced by make_app_info().

◆ bpy_app_timers_register()

static PyObject* bpy_app_timers_register ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

Definition at line 89 of file bpy_app_timers.c.

References BLI_timer_register(), NULL, py_timer_execute(), and py_timer_free().

◆ bpy_app_timers_unregister()

static PyObject* bpy_app_timers_unregister ( PyObject *  UNUSEDself,
PyObject *  function 
)
static

Definition at line 128 of file bpy_app_timers.c.

References BLI_timer_unregister(), and NULL.

◆ handle_returned_value()

static double handle_returned_value ( PyObject *  function,
PyObject *  ret 
)
static

Definition at line 18 of file bpy_app_timers.c.

References NULL, and ret.

Referenced by py_timer_execute().

◆ py_timer_execute()

static double py_timer_execute ( uintptr_t   UNUSEDuuid,
void user_data 
)
static

Definition at line 46 of file bpy_app_timers.c.

References handle_returned_value(), NULL, ret, and user_data.

Referenced by bpy_app_timers_register().

◆ py_timer_free()

static void py_timer_free ( uintptr_t   UNUSEDuuid,
void user_data 
)
static

Definition at line 61 of file bpy_app_timers.c.

References user_data.

Referenced by bpy_app_timers_register().

◆ PyDoc_STRVAR() [1/3]

PyDoc_STRVAR ( bpy_app_timers_is_registered_doc  ,
".. function:: is_registered(function)\n" "\n" " Check if this function is registered as a timer.\n" "\n" " :arg function: Function to check.\n" " :type function: int\n" " :return: True when this function is  registered,
otherwise False.\n" " :rtype:bool\n"   
)

◆ PyDoc_STRVAR() [2/3]

PyDoc_STRVAR ( bpy_app_timers_register_doc  ,
".. function:: register(function, first_interval=0, persistent=False)\n" "\n" " Add a new function that will be called after the specified amount of seconds.\n" " The function gets no arguments and is expected to return either None or a float.\n" " If ``None`` is  returned,
the timer will be unregistered.\n" " A returned number specifies the delay until the function is called again.\n" " ``functools.partial`` can be used to assign some parameters.\n" "\n" " :arg function:The function that should called.\n" " :type function:Callable  [[],
Union]\n" " :arg first_interval:Seconds until the callback should be called the first time.\n" " :type first_interval:float\n" " :arg persistent:Don 't remove timer when a new file is loaded.\n" " :type persistent:bool\n"  [float, None] 
)

◆ PyDoc_STRVAR() [3/3]

PyDoc_STRVAR ( bpy_app_timers_unregister_doc  ,
".. function:: unregister(function)\n" "\n" " Unregister timer.\n" "\n" " :arg function: Function to unregister.\n" " :type function: function\n"   
)

Variable Documentation

◆ M_AppTimers_methods

struct PyMethodDef M_AppTimers_methods[]
static
Initial value:
= {
{"register",
METH_VARARGS | METH_KEYWORDS,
bpy_app_timers_register_doc},
{"unregister", (PyCFunction)bpy_app_timers_unregister, METH_O, bpy_app_timers_unregister_doc},
{"is_registered",
METH_O,
bpy_app_timers_is_registered_doc},
{NULL, NULL, 0, NULL},
}
static PyObject * bpy_app_timers_is_registered(PyObject *UNUSED(self), PyObject *function)
static PyObject * bpy_app_timers_unregister(PyObject *UNUSED(self), PyObject *function)
static PyObject * bpy_app_timers_register(PyObject *UNUSED(self), PyObject *args, PyObject *kw)

Definition at line 146 of file bpy_app_timers.c.

◆ M_AppTimers_module_def

struct PyModuleDef M_AppTimers_module_def
static
Initial value:
= {
PyModuleDef_HEAD_INIT,
"bpy.app.timers",
NULL,
0,
NULL,
NULL,
NULL,
NULL,
}
static struct PyMethodDef M_AppTimers_methods[]

Definition at line 146 of file bpy_app_timers.c.

Referenced by BPY_app_timers_module().