1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contributor(s): Blender Foundation (2008), Juho Vepsäläinen
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <stdlib.h>
#include "RNA_define.h"
#include "RNA_types.h"
#include "rna_internal.h"
#include "DNA_curve_types.h"
#ifdef RNA_RUNTIME
static int rna_Curve_texspace_editable(PointerRNA *ptr)
{
Curve *cu= (Curve*)ptr->data;
return (cu->texflag & CU_AUTOSPACE)? PROP_NOT_EDITABLE: 0;
}
#else
static void rna_def_path(BlenderRNA *brna, StructRNA *srna);
static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna);
static void rna_def_font(BlenderRNA *brna, StructRNA *srna);
void rna_def_curve(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna= RNA_def_struct(brna, "Curve", "ID", "Curve");
rna_def_ipo_common(srna);
rna_def_texmat_common(srna, "rna_Curve_texspace_editable");
rna_def_path(brna, srna);
rna_def_nurbs(brna, srna);
rna_def_font(brna, srna);
/* Number values */
prop= RNA_def_property(srna, "bevel_resolution", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "bevresol");
RNA_def_property_range(prop, 0, 32);
RNA_def_property_ui_text(prop, "Bevel Resolution", "Bevel resolution when depth is non-zero and no specific bevel object has been defined.");
prop= RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "width");
RNA_def_property_range(prop, 0.0f, 2.0f);
RNA_def_property_ui_text(prop, "Width", "Scale the original width (1.0) based on given factor.");
prop= RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ext1");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Extrude", "Amount of curve extrusion when not using a bevel object.");
prop= RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ext2");
RNA_def_property_range(prop, 0.0f, 2.0f);
RNA_def_property_ui_text(prop, "Bevel Depth", "Bevel depth when not using a bevel object.");
prop= RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "resolu");
RNA_def_property_range(prop, 1, 1024);
RNA_def_property_ui_text(prop, "U Resolution", "Surface resolution in U direction.");
prop= RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "resolv");
RNA_def_property_range(prop, 1, 1024);
RNA_def_property_ui_text(prop, "V Resolution", "Surface resolution in V direction.");
prop= RNA_def_property(srna, "resolution_u_rendering", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "resolu_ren");
RNA_def_property_range(prop, 0, 1024);
RNA_def_property_ui_text(prop, "U Resolution (Rendering)", "Surface resolution in U direction used while rendering. Zero skips this property.");
prop= RNA_def_property(srna, "resolution_v_rendering", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "resolv_ren");
RNA_def_property_range(prop, 0, 1024);
RNA_def_property_ui_text(prop, "V Resolution (Rendering)", "Surface resolution in V direction used while rendering. Zero skips this property.");
/* pointers */
prop= RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_pointer_sdna(prop, NULL, "bevobj");
RNA_def_property_ui_text(prop, "Bevel Object", "Curve object name that defines the bevel shape.");
prop= RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_pointer_sdna(prop, NULL, "taperobj");
RNA_def_property_ui_text(prop, "Taper Object", "Curve object name that defines the taper (width).");
/* Flags */
prop= RNA_def_property(srna, "3d", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_3D);
RNA_def_property_ui_text(prop, "3D Curve", "Define curve in three dimensions. Note that in this case fill won't work.");
prop= RNA_def_property(srna, "front", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FRONT);
RNA_def_property_ui_text(prop, "Front", "Draw filled front for extruded/beveled curves.");
prop= RNA_def_property(srna, "back", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_BACK);
RNA_def_property_ui_text(prop, "Back", "Draw filled back for extruded/beveled curves.");
prop= RNA_def_property(srna, "retopo", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_RETOPO);
RNA_def_property_ui_text(prop, "Retopo", "Turn on the re-topology tool.");
}
static void rna_def_path(BlenderRNA *brna, StructRNA *srna)
{
PropertyRNA *prop;
/* number values */
prop= RNA_def_property(srna, "path_length", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "pathlen");
RNA_def_property_range(prop, 1, 32767);
RNA_def_property_ui_text(prop, "Path Length", "If no speed IPO was set, the length of path in frames.");
/* flags */
prop= RNA_def_property(srna, "path", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH);
RNA_def_property_ui_text(prop, "Path", "Enable the curve to become a translation path.");
prop= RNA_def_property(srna, "follow", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FOLLOW);
RNA_def_property_ui_text(prop, "Follow", "Make curve path children to rotate along the path.");
prop= RNA_def_property(srna, "stretch", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STRETCH);
RNA_def_property_ui_text(prop, "Stretch", "Option for curve-deform: makes deformed child to stretch along entire path.");
prop= RNA_def_property(srna, "offset_path_distance", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_OFFS_PATHDIST);
RNA_def_property_ui_text(prop, "Offset Path Distance", "Children will use TimeOffs value as path distance offset.");
}
static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna)
{
PropertyRNA *prop;
/* flags */
prop= RNA_def_property(srna, "uv_orco", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO);
RNA_def_property_ui_text(prop, "UV Orco", "Forces to use UV coordinates for texture mapping 'orco'.");
prop= RNA_def_property(srna, "vertex_normal_flip", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_NOPUNOFLIP);
RNA_def_property_ui_text(prop, "Vertex Normal Flip", "Flip vertex normals towards the camera during render");
}
static void rna_def_font(BlenderRNA *brna, StructRNA *srna)
{
PropertyRNA *prop;
/* number values */
prop= RNA_def_property(srna, "text_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fsize");
RNA_def_property_range(prop, 0.1f, 10.0f);
RNA_def_property_ui_text(prop, "Text Size", "");
prop= RNA_def_property(srna, "line_dist", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "linedist");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Distance Between Lines of Text", "");
prop= RNA_def_property(srna, "word_spacing", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "wordspace");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Word Spacing", "");
prop= RNA_def_property(srna, "spacing", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spacing");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Character Spacing", "");
prop= RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "shear");
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_ui_text(prop, "Shear", "Italic angle of the characters.");
prop= RNA_def_property(srna, "x_offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "xof");
RNA_def_property_range(prop, -50.0f, 50.0f);
RNA_def_property_ui_text(prop, "X Offset", "Horizontal offset from the object center.");
prop= RNA_def_property(srna, "y_offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "yof");
RNA_def_property_range(prop, -50.0f, 50.0f);
RNA_def_property_ui_text(prop, "Y Offset", "Vertical offset from the object center.");
prop= RNA_def_property(srna, "ul_position", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ulpos");
RNA_def_property_range(prop, -0.2f, 0.8f);
RNA_def_property_ui_text(prop, "Underline Position", "Vertical position of underline.");
prop= RNA_def_property(srna, "ul_height", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ulheight");
RNA_def_property_range(prop, -0.2f, 0.8f);
RNA_def_property_ui_text(prop, "Underline Thickness", "");
prop= RNA_def_property(srna, "active_textbox", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "actbox");
RNA_def_property_range(prop, 0, 100);
RNA_def_property_ui_text(prop, "Active Textbox", "");
/* strings */
prop= RNA_def_property(srna, "family", PROP_STRING, PROP_NONE);
RNA_def_property_string_maxlength(prop, 21);
RNA_def_property_ui_text(prop, "Family", "Blender uses font from selfmade objects.");
prop= RNA_def_property(srna, "str", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "str");
RNA_def_property_ui_text(prop, "String", "");
RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
RNA_def_property_string_maxlength(prop, 8192); /* note that originally str did not have a limit! */
RNA_def_struct_name_property(srna, prop);
/* pointers */
prop= RNA_def_property(srna, "text_on_curve", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_pointer_sdna(prop, NULL, "textoncurve");
RNA_def_property_ui_text(prop, "Text on Curve", "Curve deforming text object.");
prop= RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "VectorFont");
RNA_def_property_pointer_sdna(prop, NULL, "vfont");
RNA_def_property_ui_text(prop, "Font", "");
prop= RNA_def_property(srna, "textbox", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "TextBox");
RNA_def_property_pointer_sdna(prop, NULL, "tb");
RNA_def_property_ui_text(prop, "Textbox", "");
/*
TODO: struct CharInfo curinfo;
Obviously a pointer won't work in this case.
*/
/*
prop= RNA_def_property(srna, "curinfo", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "CharInfo");
RNA_def_property_pointer_sdna(prop, NULL, "curinfo");
RNA_def_property_ui_text(prop, "curinfo", "");
*/
/* flags */
prop= RNA_def_property(srna, "fast", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FAST);
RNA_def_property_ui_text(prop, "Fast", "Don't fill polygons while editing.");
prop= RNA_def_property(srna, "left_align", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "spacemode", CU_LEFT);
RNA_def_property_ui_text(prop, "Left Align", "Left align the text from the object center.");
prop= RNA_def_property(srna, "middle_align", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "spacemode", CU_MIDDLE);
RNA_def_property_ui_text(prop, "Middle Align", "Middle align the text from the object center.");
prop= RNA_def_property(srna, "right_align", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "spacemode", CU_RIGHT);
RNA_def_property_ui_text(prop, "Right Align", "Right align the text from the object center.");
prop= RNA_def_property(srna, "justify", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "spacemode", CU_JUSTIFY);
RNA_def_property_ui_text(prop, "Justify", "Fill complete lines to maximum textframe width.");
prop= RNA_def_property(srna, "flush", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "spacemode", CU_FLUSH);
RNA_def_property_ui_text(prop, "Left Align", "Fill every line to maximum textframe width distributing space among all characters.");
}
void rna_def_textbox(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna= RNA_def_struct(brna, "TextBox", NULL, "TextBox");
/* number values */
prop= RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "x");
RNA_def_property_range(prop, -50.0f, 50.0f);
RNA_def_property_ui_text(prop, "Textbox X Offset", "");
prop= RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "y");
RNA_def_property_range(prop, -50.0f, 50.0f);
RNA_def_property_ui_text(prop, "Textbox Y Offset", "");
prop= RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "w");
RNA_def_property_range(prop, 0.0f, 50.0f);
RNA_def_property_ui_text(prop, "Textbox Width", "");
prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "h");
RNA_def_property_range(prop, 0.0f, 50.0f);
RNA_def_property_ui_text(prop, "Textbox Height", "");
}
void rna_def_charinfo(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna= RNA_def_struct(brna, "CharInfo", NULL, "CharInfo");
/* flags */
prop= RNA_def_property(srna, "style", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STYLE);
RNA_def_property_ui_text(prop, "Style", "");
prop= RNA_def_property(srna, "bold", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_BOLD);
RNA_def_property_ui_text(prop, "Bold", "");
prop= RNA_def_property(srna, "italic", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_ITALIC);
RNA_def_property_ui_text(prop, "Italic", "");
prop= RNA_def_property(srna, "underline", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UNDERLINE);
RNA_def_property_ui_text(prop, "Underline", "");
prop= RNA_def_property(srna, "wrap", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_WRAP);
RNA_def_property_ui_text(prop, "Wrap", "");
}
void RNA_def_curve(BlenderRNA *brna)
{
rna_def_curve(brna);
rna_def_textbox(brna);
rna_def_charinfo(brna);
}
#endif
|