Blender V4.3
bpy_rna_types_capi.cc File Reference
#include <Python.h>
#include <descrobject.h>
#include "RNA_types.hh"
#include "BLI_utildefines.h"
#include "bpy_library.hh"
#include "bpy_rna.hh"
#include "bpy_rna_callback.hh"
#include "bpy_rna_context.hh"
#include "bpy_rna_data.hh"
#include "bpy_rna_id_collection.hh"
#include "bpy_rna_text.hh"
#include "bpy_rna_types_capi.hh"
#include "bpy_rna_ui.hh"
#include "bpy_rna_operator.hh"
#include "../generic/py_capi_utils.hh"
#include "RNA_prototypes.hh"
#include "MEM_guardedalloc.h"
#include "WM_api.hh"

Go to the source code of this file.

Functions

Window Manager Clipboard Property

Avoid using the RNA API because this value may change between checking its length and creating the buffer, causing writes past the allocated length.

 PyDoc_STRVAR (pyrna_WindowManager_clipboard_doc, "Clipboard text storage.\n" "\n" ":type: str")
 
static PyObject * pyrna_WindowManager_clipboard_get (PyObject *, void *)
 
static int pyrna_WindowManager_clipboard_set (PyObject *, PyObject *value, void *)
 
Public API
void BPY_rna_types_extend_capi ()
 

Variables

Blend Data
static PyMethodDef pyrna_blenddata_methods []
 
Blend Data Libraries
static PyMethodDef pyrna_blenddatalibraries_methods []
 
UI Layout
static PyMethodDef pyrna_uilayout_methods []
 
Operator
static PyMethodDef pyrna_operator_methods []
 
Text Editor
static PyMethodDef pyrna_text_methods []
 
Context Type
static PyMethodDef pyrna_context_methods []
 

Window Manager Type

static PyMethodDef pyrna_windowmanager_methods []
 
static PyGetSetDef pyrna_windowmanager_getset []
 
 PyDoc_STRVAR (pyrna_draw_cursor_add_doc, ".. classmethod:: draw_cursor_add(callback, args, space_type, region_type)\n" "\n" " Add a new draw cursor handler to this space type.\n" " It will be called every time the cursor for the specified region in the space " "type will be drawn.\n" " Note: All arguments are positional only for now.\n" "\n" " :arg callback:\n" " A function that will be called when the cursor is drawn.\n" " It gets the specified arguments as input with the mouse position (tuple) as last " "argument.\n" " :type callback: Callable[[Any, ..., tuple[int, int]], Any]\n" " :arg args: Arguments that will be passed to the callback.\n" " :type args: tuple[Any, ...]\n" " :arg space_type: The space type the callback draws in; for example ``VIEW_3D``. " "(:class:`bpy.types.Space.type`)\n" " :type space_type: str\n" " :arg region_type: The region type the callback draws in; usually ``WINDOW``. " "(:class:`bpy.types.Region.type`)\n" " :type region_type: str\n" " :return: Handler that can be removed later on.\n" " :rtype: object\n")
 
 PyDoc_STRVAR (pyrna_draw_cursor_remove_doc, ".. classmethod:: draw_cursor_remove(handler)\n" "\n" " Remove a draw cursor handler that was added previously.\n" "\n" " :arg handler: The draw cursor handler that should be removed.\n" " :type handler: object\n")
 

Space Type

static PyMethodDef pyrna_space_methods []
 
 PyDoc_STRVAR (pyrna_draw_handler_add_doc, ".. classmethod:: draw_handler_add(callback, args, region_type, draw_type)\n" "\n" " Add a new draw handler to this space type.\n" " It will be called every time the specified region in the space type will be drawn.\n" " Note: All arguments are positional only for now.\n" "\n" " :arg callback:\n" " A function that will be called when the region is drawn.\n" " It gets the specified arguments as input, it's return value is ignored.\n" " :type callback: Callable[[Any, ...], Any]\n" " :arg args: Arguments that will be passed to the callback.\n" " :type args: tuple[Any, ...]\n" " :arg region_type: The region type the callback draws in; usually ``WINDOW``. " "(:class:`bpy.types.Region.type`)\n" " :type region_type: str\n" " :arg draw_type: Usually ``POST_PIXEL`` for 2D drawing and ``POST_VIEW`` for 3D drawing. " "In some cases ``PRE_VIEW`` can be used. ``BACKDROP`` can be used for backdrops in the node " "editor.\n" " :type draw_type: str\n" " :return: Handler that can be removed later on.\n" " :rtype: object")
 
 PyDoc_STRVAR (pyrna_draw_handler_remove_doc, ".. classmethod:: draw_handler_remove(handler, region_type)\n" "\n" " Remove a draw handler that was added previously.\n" "\n" " :arg handler: The draw handler that should be removed.\n" " :type handler: object\n" " :arg region_type: Region type the callback was added to.\n" " :type region_type: str\n")
 

Detailed Description

This file extends RNA types from bpy.types with C/Python API methods and attributes.

We should avoid adding code here, and prefer:

Otherwise functions can be added here as a last resort.

Definition in file bpy_rna_types_capi.cc.

Function Documentation

◆ BPY_rna_types_extend_capi()

◆ PyDoc_STRVAR() [1/5]

PyDoc_STRVAR ( pyrna_draw_cursor_add_doc ,
".. classmethod:: draw_cursor_add(callback, args, space_type, region_type)\n" "\n" " Add a new draw cursor handler to this space type.\n" " It will be called every time the cursor for the specified region in the space " "type will be drawn.\n" " Note: All arguments are positional only for now.\n" "\n" " :arg callback:\n" " A function that will be called when the cursor is drawn.\n" " It gets the specified arguments as input with the mouse position (tuple) as last " "argument.\n" " :type callback: Callable] [[Any,..., tuple[int, int],
Any]\n" " :arg args:Arguments that will be passed to the callback.\n" " :type args:tuple\n" " :arg space_type:The space type the callback draws in;for example ``VIEW_3D``. " "(:class:`bpy.types.Space.type`)\n" " :type space_type:str\n" " :arg region_type:The region type the callback draws in;usually ``WINDOW``. " "(:class:`bpy.types.Region.type`)\n" " :type region_type:str\n" " :return:Handler that can be removed later on.\n" " :rtype:object\n" [Any,...] )

◆ PyDoc_STRVAR() [2/5]

PyDoc_STRVAR ( pyrna_draw_cursor_remove_doc ,
".. classmethod:: draw_cursor_remove(handler)\n" "\n" " Remove a draw cursor handler that was added previously.\n" "\n" " :arg handler: The draw cursor handler that should be removed.\n" " :type handler: object\n"  )

◆ PyDoc_STRVAR() [3/5]

PyDoc_STRVAR ( pyrna_draw_handler_add_doc ,
".. classmethod:: draw_handler_add(callback, args, region_type, draw_type)\n" "\n" " Add a new draw handler to this space type.\n" " It will be called every time the specified region in the space type will be drawn.\n" " Note: All arguments are positional only for now.\n" "\n" " :arg callback:\n" " A function that will be called when the region is drawn.\n" " It gets the specified arguments as input,
it 's return value is ignored.\n" " :type callback:Callable [[Any,...],
Any]\n" " :arg args:Arguments that will be passed to the callback.\n" " :type args:tuple\n" " :arg region_type:The region type the callback draws in;usually ``WINDOW``. " "(:class:`bpy.types.Region.type`)\n" " :type region_type:str\n" " :arg draw_type:Usually ``POST_PIXEL`` for 2D drawing and ``POST_VIEW`` for 3D drawing. " "In some cases ``PRE_VIEW`` can be used. ``BACKDROP`` can be used for backdrops in the node " "editor.\n" " :type draw_type:str\n" " :return:Handler that can be removed later on.\n" " :rtype:object" [Any,...] )

◆ PyDoc_STRVAR() [4/5]

PyDoc_STRVAR ( pyrna_draw_handler_remove_doc ,
".. classmethod:: draw_handler_remove(handler, region_type)\n" "\n" " Remove a draw handler that was added previously.\n" "\n" " :arg handler: The draw handler that should be removed.\n" " :type handler: object\n" " :arg region_type: Region type the callback was added to.\n" " :type region_type: str\n"  )

◆ PyDoc_STRVAR() [5/5]

PyDoc_STRVAR ( pyrna_WindowManager_clipboard_doc ,
"Clipboard text storage.\n" "\n" ":type: str"  )

◆ pyrna_WindowManager_clipboard_get()

static PyObject * pyrna_WindowManager_clipboard_get ( PyObject * ,
void *  )
static

◆ pyrna_WindowManager_clipboard_set()

static int pyrna_WindowManager_clipboard_set ( PyObject * ,
PyObject * value,
void *  )
static

Definition at line 129 of file bpy_rna_types_capi.cc.

References PyC_UnicodeAsBytes(), and WM_clipboard_text_set().

Variable Documentation

◆ pyrna_blenddata_methods

PyMethodDef pyrna_blenddata_methods[]
static
Initial value:
= {
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
}

Definition at line 48 of file bpy_rna_types_capi.cc.

Referenced by BPY_rna_types_extend_capi().

◆ pyrna_blenddatalibraries_methods

PyMethodDef pyrna_blenddatalibraries_methods[]
static
Initial value:
= {
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
}

Definition at line 62 of file bpy_rna_types_capi.cc.

Referenced by BPY_rna_types_extend_capi().

◆ pyrna_context_methods

PyMethodDef pyrna_context_methods[]
static
Initial value:
= {
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
}

Definition at line 210 of file bpy_rna_types_capi.cc.

Referenced by BPY_rna_types_extend_capi().

◆ pyrna_operator_methods

PyMethodDef pyrna_operator_methods[]
static
Initial value:
= {
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
}

Definition at line 85 of file bpy_rna_types_capi.cc.

Referenced by BPY_rna_types_extend_capi().

◆ pyrna_space_methods

PyMethodDef pyrna_space_methods[]
static
Initial value:
= {
{"draw_handler_add",
METH_VARARGS | METH_CLASS,
pyrna_draw_handler_add_doc},
{"draw_handler_remove",
METH_VARARGS | METH_CLASS,
pyrna_draw_handler_remove_doc},
{nullptr, nullptr, 0, nullptr},
}
PyObject * pyrna_callback_classmethod_remove(PyObject *, PyObject *args)
PyObject * pyrna_callback_classmethod_add(PyObject *, PyObject *args)

Definition at line 258 of file bpy_rna_types_capi.cc.

Referenced by BPY_rna_types_extend_capi().

◆ pyrna_text_methods

PyMethodDef pyrna_text_methods[]
static
Initial value:
= {
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
}

Definition at line 96 of file bpy_rna_types_capi.cc.

Referenced by BPY_rna_types_extend_capi().

◆ pyrna_uilayout_methods

PyMethodDef pyrna_uilayout_methods[]
static
Initial value:
= {
{nullptr, nullptr, 0, nullptr},
{nullptr, nullptr, 0, nullptr},
}

Definition at line 74 of file bpy_rna_types_capi.cc.

Referenced by BPY_rna_types_extend_capi().

◆ pyrna_windowmanager_getset

PyGetSetDef pyrna_windowmanager_getset[]
static
Initial value:
= {
{"clipboard",
pyrna_WindowManager_clipboard_doc,
nullptr},
{nullptr, nullptr, nullptr, nullptr, nullptr}
}
static int pyrna_WindowManager_clipboard_set(PyObject *, PyObject *value, void *)
static PyObject * pyrna_WindowManager_clipboard_get(PyObject *, void *)

Definition at line 195 of file bpy_rna_types_capi.cc.

Referenced by BPY_rna_types_extend_capi().

◆ pyrna_windowmanager_methods

PyMethodDef pyrna_windowmanager_methods[]
static
Initial value:
= {
{"draw_cursor_add",
METH_VARARGS | METH_CLASS,
pyrna_draw_cursor_add_doc},
{"draw_cursor_remove",
METH_VARARGS | METH_CLASS,
pyrna_draw_cursor_remove_doc},
{nullptr, nullptr, 0, nullptr},
}

Definition at line 183 of file bpy_rna_types_capi.cc.

Referenced by BPY_rna_types_extend_capi().