2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file DNA_curve_types.h
32 #ifndef __DNA_CURVE_TYPES_H__
33 #define __DNA_CURVE_TYPES_H__
36 #include "DNA_listBase.h"
37 #include "DNA_vec_types.h"
40 #define MAXTEXTBOX 256 /* used in readfile.c and editfont.c */
53 /* These two Lines with # tell makesdna this struct can be excluded. */
56 typedef struct PathPoint {
57 float vec[4]; /* grr, cant get rid of tilt yet */
62 /* These two Lines with # tell makesdna this struct can be excluded. */
66 struct PathPoint *data;
71 /* These two Lines with # tell makesdna this struct can be excluded. */
74 typedef struct BevList {
75 struct BevList *next, *prev;
81 /* These two Lines with # tell makesdna this struct can be excluded. */
84 typedef struct BevPoint {
85 float vec[3], alfa, radius, weight;
86 float sina, cosa; /* 2D Only */
87 float dir[3], tan[3], quat[4]; /* 3D Only */
88 short split_tag, dupe_tag;
92 * Keyframes on F-Curves (allows code reuse of Bezier eval code) and
93 * Points on Bezier Curves/Paths are generally BezTriples
95 * \note alfa location in struct is abused by Key system
97 * \note vec in BezTriple looks like this:
98 * - vec[0][0] = x location of handle 1
99 * - vec[0][1] = y location of handle 1
100 * - vec[0][2] = z location of handle 1 (not used for FCurve Points(2d))
101 * - vec[1][0] = x location of control point
102 * - vec[1][1] = y location of control point
103 * - vec[1][2] = z location of control point
104 * - vec[2][0] = x location of handle 2
105 * - vec[2][1] = y location of handle 2
106 * - vec[2][2] = z location of handle 2 (not used for FCurve Points(2d))
108 typedef struct BezTriple {
110 float alfa, weight, radius; /* alfa: tilt in 3D View, weight: used for softbody goal weight, radius: for bevel tapering */
112 short ipo; /* ipo: interpolation mode for segment from this BezTriple to the next */
114 char h1, h2; /* h1, h2: the handle type of the two handles */
115 char f1, f2, f3; /* f1, f2, f3: used for selection status */
117 char hide; /* hide: used to indicate whether BezTriple is hidden (3D), type of keyframe (eBezTriple_KeyframeTypes) */
119 float back; /* BEZT_IPO_BACK */
120 float amplitude, period; /* BEZT_IPO_ELASTIC */
121 char easing; /* easing: easing type for interpolation mode (eBezTriple_Easing) */
126 /* note; alfa location in struct is abused by Key system */
127 typedef struct BPoint {
129 float alfa, weight; /* alfa: tilt in 3D View, weight: used for softbody goal weight */
130 short f1, hide; /* f1: selection status, hide: is point hidden or not */
131 float radius, pad; /* user-set radius per point for beveling etc */
135 * \note Nurb name is misleading, since it can be used for polygons too,
136 * also, it should be NURBS (Nurb isn't the singular of Nurbs).
138 typedef struct Nurb {
139 struct Nurb *next, *prev; /* multiple nurbs per curve object are allowed */
141 short mat_nr; /* index into material list */
143 int pntsu, pntsv; /* number of points in the U or V directions */
145 short resolu, resolv; /* tessellation resolution in the U or V directions */
146 short orderu, orderv;
149 float *knotsu, *knotsv;
153 short tilt_interp; /* KEY_LINEAR, KEY_CARDINAL, KEY_BSPLINE */
159 typedef struct CharInfo {
161 short mat_nr; /* index start at 1, unlike mesh & nurbs */
167 typedef struct TextBox {
171 typedef struct EditNurb {
172 /* base of nurbs' list (old Curve->editnurb) */
175 /* index data for shape keys */
176 struct GHash *keyindex;
178 /* shape key being edited */
184 typedef struct Curve {
186 struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
190 ListBase nurb; /* actual data, called splines in rna */
192 EditNurb *editnurb; /* edited data, not in file, use pointer so we can check for it */
194 struct Object *bevobj, *taperobj, *textoncurve;
195 struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
197 struct Material **mat;
199 /* texture space, copied as one block in editobject.c */
204 short type; /* creation-time type of curve datablock */
206 short texflag; /* keep a short because of BKE_object_obdata_texspace_get() */
207 short drawflag, twist_mode;
208 float twist_smooth, smallcaps_scale;
211 short bevresol, totcol;
213 float width, ext1, ext2;
216 short resolu, resolv;
217 short resolu_ren, resolv_ren;
219 /* edit, index in nurb list */
221 /* edit, index in active nurb (BPoint or BezTriple) */
228 char spacemode, pad1;
229 float spacing, linedist, shear, fsize, wordspace, ulpos, ulheight;
233 /* copy of EditFont vars (wchar_t aligned),
234 * warning! don't use in editmode (storage only) */
236 int selstart, selend;
239 int len_wchar; /* number of characters (strinfo) */
240 int len; /* number of bytes (str - utf8) */
242 struct EditFont *editfont;
246 struct VFont *vfontb;
247 struct VFont *vfonti;
248 struct VFont *vfontbi;
253 struct CharInfo *strinfo;
254 struct CharInfo curinfo;
258 float ctime; /* current evaltime - for use by Objects parented to curves */
259 float bevfac1, bevfac2;
260 char bevfac1_mapping, bevfac2_mapping;
266 /* **************** CURVE ********************* */
269 #define CU_AUTOSPACE 1
272 #define CU_HIDE_HANDLES (1 << 0)
273 #define CU_HIDE_NORMALS (1 << 1)
281 #define CU_UV_ORCO 32
282 #define CU_DEFORM_BOUNDS_OFF 64
283 #define CU_STRETCH 128
284 /* #define CU_OFFS_PATHDIST 256 */ /* DEPRECATED */
285 #define CU_FAST 512 /* Font: no filling inside editmode */
286 /* #define CU_RETOPO 1024 */ /* DEPRECATED */
287 #define CU_DS_EXPAND 2048
288 #define CU_PATH_RADIUS 4096 /* make use of the path radius if this is enabled (default for new curves) */
289 #define CU_DEFORM_FILL 8192 /* fill 2d curve after deformation */
290 #define CU_FILL_CAPS 16384 /* fill bevel caps */
291 #define CU_MAP_TAPER 32768 /* map taper object to bevelled area */
294 #define CU_TWIST_Z_UP 0
295 // #define CU_TWIST_Y_UP 1 // not used yet
296 // #define CU_TWIST_X_UP 2
297 #define CU_TWIST_MINIMUM 3
298 #define CU_TWIST_TANGENT 4
300 /* bevel factor mapping */
302 CU_BEVFAC_MAP_RESOLU = 0,
303 CU_BEVFAC_MAP_SEGMENT = 1,
304 CU_BEVFAC_MAP_SPLINE = 2
316 #define CU_2D 8 /* moved from type since 2.4x */
322 #define CU_CARDINAL 3
324 #define CU_TYPE (CU_POLY|CU_BEZIER|CU_BSPLINE|CU_CARDINAL|CU_NURBS)
326 /* only for adding */
327 #define CU_PRIMITIVE 0xF00
330 #define CU_PRIM_CURVE 0x100
331 /* 8 points circle */
332 #define CU_PRIM_CIRCLE 0x200
334 #define CU_PRIM_PATCH 0x300
335 #define CU_PRIM_TUBE 0x400
336 #define CU_PRIM_SPHERE 0x500
337 #define CU_PRIM_DONUT 0x600
338 /* 5 points, 5th order straight line (for anim path) */
339 #define CU_PRIM_PATH 0x700
342 /* flagu flagv (nurb) */
343 #define CU_NURB_CYCLIC 1
344 #define CU_NURB_ENDPOINT 2
345 #define CU_NURB_BEZIER 4
347 #define CU_ACT_NONE -1
349 /* *************** BEZTRIPLE **************** */
351 /* h1 h2 (beztriple) */
352 typedef enum eBezTriple_Handle {
357 HD_AUTO_ANIM = 4, /* auto-clamped handles for animation */
358 HD_ALIGN_DOUBLESIDE = 5, /* align handles, displayed both of them. used for masks */
361 /* interpolation modes (used only for BezTriple->ipo) */
362 typedef enum eBezTriple_Interpolation {
363 /* traditional interpolation */
364 BEZT_IPO_CONST = 0, /* constant interpolation */
365 BEZT_IPO_LIN = 1, /* linear interpolation */
366 BEZT_IPO_BEZ = 2, /* bezier interpolation */
368 /* easing equations */
373 BEZT_IPO_ELASTIC = 7,
379 } eBezTriple_Interpolation;
381 /* easing modes (used only for Keyframes - BezTriple->easing) */
382 typedef enum eBezTriple_Easing {
383 BEZT_IPO_EASE_IN = 0,
384 BEZT_IPO_EASE_OUT = 1,
385 BEZT_IPO_EASE_IN_OUT = 2
388 /* types of keyframe (used only for BezTriple->hide when BezTriple is used in F-Curves) */
389 typedef enum eBezTriple_KeyframeType {
390 BEZT_KEYTYPE_KEYFRAME = 0, /* default - 'proper' Keyframe */
391 BEZT_KEYTYPE_EXTREME = 1, /* 'extreme' keyframe */
392 BEZT_KEYTYPE_BREAKDOWN = 2, /* 'breakdown' keyframe */
393 BEZT_KEYTYPE_JITTER = 3, /* 'jitter' keyframe (for adding 'filler' secondary motion) */
394 } eBezTriple_KeyframeType;
396 /* checks if the given BezTriple is selected */
397 #define BEZSELECTED(bezt) (((bezt)->f2 & SELECT) || ((bezt)->f1 & SELECT) || ((bezt)->f3 & SELECT))
398 #define BEZSELECTED_HIDDENHANDLES(cu, bezt) (((cu)->drawflag & CU_HIDE_HANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt))
400 /* *************** CHARINFO **************** */
403 /* note: CU_CHINFO_WRAP and CU_CHINFO_SMALLCAPS_TEST are set dynamically */
404 #define CU_CHINFO_BOLD (1<<0)
405 #define CU_CHINFO_ITALIC (1<<1)
406 #define CU_CHINFO_UNDERLINE (1<<2)
407 #define CU_CHINFO_WRAP (1<<3) /* wordwrap occurred here */
408 #define CU_CHINFO_SMALLCAPS (1<<4)
409 #define CU_CHINFO_SMALLCAPS_CHECK (1<<5) /* set at runtime, checks if case switching is needed */
411 /* mixed with KEY_LINEAR but define here since only curve supports */
412 #define KEY_CU_EASE 3
414 /* indicates point has been seen during surface duplication */