32
33
#ifndef EXPP_TEXT_H
33
34
#define EXPP_TEXT_H
39
#include <BKE_global.h>
40
#include <BKE_library.h>
42
#include <BIF_drawtext.h>
44
#include <BLI_blenlib.h>
45
36
#include <DNA_text_types.h>
47
#include "gen_utils.h"
49
#include "../BPY_extern.h"
51
#define EXPP_TEXT_MODE_FOLLOW TXT_FOLLOW
53
/*****************************************************************************/
54
/* Python API function prototypes for the Text module. */
55
/*****************************************************************************/
56
static PyObject *M_Text_New (PyObject *self, PyObject *args,
58
static PyObject *M_Text_Get (PyObject *self, PyObject *args);
59
static PyObject *M_Text_Load (PyObject *self, PyObject *args);
60
static PyObject *M_Text_unlink (PyObject *self, PyObject *args);
62
/*****************************************************************************/
63
/* The following string definitions are used for documentation strings. */
64
/* In Python these will be written to the console when doing a */
65
/* Blender.Text.__doc__ */
66
/*****************************************************************************/
67
static char M_Text_doc[] =
68
"The Blender Text module\n\n";
70
static char M_Text_New_doc[] =
71
"() - return a new Text object";
73
static char M_Text_Get_doc[] =
74
"(name) - return the Text with name 'name', \
75
returns None if not found.\n If 'name' is not specified, \
76
it returns a list of all Texts in the\ncurrent scene.";
78
static char M_Text_Load_doc[] =
79
"(filename) - return text from file filename as a Text Object, \
80
returns None if not found.\n";
82
static char M_Text_unlink_doc[] =
83
"(text) - remove Text object 'text' from Blender";
85
/*****************************************************************************/
86
/* Python method structure definition for Blender.Text module: */
87
/*****************************************************************************/
88
struct PyMethodDef M_Text_methods[] = {
89
{"New",(PyCFunction)M_Text_New, METH_VARARGS|METH_KEYWORDS,
91
{"Get", M_Text_Get, METH_VARARGS, M_Text_Get_doc},
92
{"get", M_Text_Get, METH_VARARGS, M_Text_Get_doc},
93
{"Load", M_Text_Load, METH_VARARGS, M_Text_Load_doc},
94
{"unlink", M_Text_unlink, METH_VARARGS, M_Text_unlink_doc},
98
/*****************************************************************************/
99
/* Python BPy_Text structure definition: */
100
/*****************************************************************************/
107
/*****************************************************************************/
108
/* Python BPy_Text methods declarations: */
109
/*****************************************************************************/
110
static PyObject *Text_getName(BPy_Text *self);
111
static PyObject *Text_getFilename(BPy_Text *self);
112
static PyObject *Text_getNLines(BPy_Text *self);
113
static PyObject *Text_setName(BPy_Text *self, PyObject *args);
114
static PyObject *Text_clear(BPy_Text *self, PyObject *args);
115
static PyObject *Text_write(BPy_Text *self, PyObject *args);
116
static PyObject *Text_set(BPy_Text *self, PyObject *args);
117
static PyObject *Text_asLines(BPy_Text *self, PyObject *args);
119
/*****************************************************************************/
120
/* Python BPy_Text methods table: */
121
/*****************************************************************************/
122
static PyMethodDef BPy_Text_methods[] = {
123
/* name, method, flags, doc */
124
{"getName", (PyCFunction)Text_getName, METH_NOARGS,
125
"() - Return Text Object name"},
126
{"getFilename", (PyCFunction)Text_getFilename, METH_VARARGS,
127
"() - Return Text Object filename"},
128
{"getNLines", (PyCFunction)Text_getNLines, METH_VARARGS,
129
"() - Return number of lines in text buffer"},
130
{"setName", (PyCFunction)Text_setName, METH_VARARGS,
131
"(str) - Change Text Object name"},
132
{"clear", (PyCFunction)Text_clear, METH_VARARGS,
133
"() - Clear Text buffer"},
134
{"write", (PyCFunction)Text_write, METH_VARARGS,
135
"(line) - Append string 'str' to Text buffer"},
136
{"set", (PyCFunction)Text_set, METH_VARARGS,
137
"(name, val) - Set attribute 'name' to value 'val'"},
138
{"asLines", (PyCFunction)Text_asLines, METH_VARARGS,
139
"() - Return text buffer as a list of lines"},
143
/*****************************************************************************/
144
/* Python Text_Type callback function prototypes: */
145
/*****************************************************************************/
146
static void Text_dealloc (BPy_Text *self);
147
static int Text_setAttr (BPy_Text *self, char *name, PyObject *v);
148
static PyObject *Text_getAttr (BPy_Text *self, char *name);
149
static int Text_compare (BPy_Text *a, BPy_Text *b);
150
static PyObject *Text_repr (BPy_Text *self);
152
/*****************************************************************************/
153
/* Python Text_Type structure definition: */
154
/*****************************************************************************/
155
PyTypeObject Text_Type =
157
PyObject_HEAD_INIT(NULL)
159
"Blender Text", /* tp_name */
160
sizeof (BPy_Text), /* tp_basicsize */
163
(destructor)Text_dealloc, /* tp_dealloc */
165
(getattrfunc)Text_getAttr, /* tp_getattr */
166
(setattrfunc)Text_setAttr, /* tp_setattr */
167
(cmpfunc)Text_compare, /* tp_compare */
168
(reprfunc)Text_repr, /* tp_repr */
169
0, /* tp_as_number */
170
0, /* tp_as_sequence */
171
0, /* tp_as_mapping */
176
BPy_Text_methods, /* tp_methods */
180
static int Text_IsLinked(BPy_Text *self);
182
#endif /* EXPP_TEXT_H */
38
PyObject *Text_Init( void );
39
PyObject *Text_CreatePyObject( Text * txt );
41
#endif /* EXPP_TEXT_H */