2 * blenlib/DNA_curve_types.h (mar-2001 nzc)
8 * ***** BEGIN GPL LICENSE BLOCK *****
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
25 * All rights reserved.
27 * The Original Code is: all of this file.
29 * Contributor(s): none yet.
31 * ***** END GPL LICENSE BLOCK *****
33 #ifndef DNA_CURVE_TYPES_H
34 #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. */
67 struct PathPoint *data;
71 /* These two Lines with # tell makesdna this struct can be excluded. */
74 typedef struct BevList {
75 struct BevList *next, *prev;
80 /* These two Lines with # tell makesdna this struct can be excluded. */
83 typedef struct BevPoint {
84 float vec[3], alfa, radius, weight;
85 float sina, cosa; /* 2D Only */
86 float dir[3], tan[3], quat[4]; /* 3D Only */
87 short split_tag, dupe_tag;
90 /* Keyframes on F-Curves (allows code reuse of Bezier eval code) and
91 * Points on Bezier Curves/Paths are generally BezTriples
93 /* note: alfa location in struct is abused by Key system */
94 /* vec in BezTriple looks like this:
95 vec[0][0]=x location of handle 1
96 vec[0][1]=y location of handle 1
97 vec[0][2]=z location of handle 1 (not used for FCurve Points(2d))
98 vec[1][0]=x location of control point
99 vec[1][1]=y location of control point
100 vec[1][2]=z location of control point
101 vec[2][0]=x location of handle 2
102 vec[2][1]=y location of handle 2
103 vec[2][2]=z location of handle 2 (not used for FCurve Points(2d))
105 typedef struct BezTriple {
107 float alfa, weight, radius; /* alfa: tilt in 3D View, weight: used for softbody goal weight, radius: for bevel tapering */
108 short ipo; /* ipo: interpolation mode for segment from this BezTriple to the next */
109 char h1, h2; /* h1, h2: the handle type of the two handles */
110 char f1, f2, f3; /* f1, f2, f3: used for selection status */
111 char hide; /* hide: used to indicate whether BezTriple is hidden (3D), type of keyframe (eBezTriple_KeyframeTypes) */
114 /* note; alfa location in struct is abused by Key system */
115 typedef struct BPoint {
117 float alfa, weight; /* alfa: tilt in 3D View, weight: used for softbody goal weight */
118 short f1, hide; /* f1: selection status, hide: is point hidden or not */
119 float radius, pad; /* user-set radius per point for bevelling etc */
122 typedef struct Nurb {
123 struct Nurb *next, *prev; /* multiple nurbs per curve object are allowed */
125 short mat_nr; /* index into material list */
127 short pntsu, pntsv; /* number of points in the U or V directions */
128 short resolu, resolv; /* tesselation resolution in the U or V directions */
129 short orderu, orderv;
132 float *knotsu, *knotsv;
136 short tilt_interp; /* KEY_LINEAR, KEY_CARDINAL, KEY_BSPLINE */
142 typedef struct CharInfo {
144 short mat_nr; /* index start at 1, unlike mesh & nurbs */
150 typedef struct TextBox {
154 typedef struct EditNurb {
155 /* base of nurbs' list (old Curve->editnurb) */
158 /* index data for shape keys */
159 struct GHash *keyindex;
161 /* shape key being edited */
167 typedef struct Curve {
169 struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
173 ListBase nurb; /* actual data, called splines in rna */
176 EditNurb *editnurb; /* edited data, not in file, use pointer so we can check for it */
178 struct Object *bevobj, *taperobj, *textoncurve;
179 struct Ipo *ipo; // XXX depreceated... old animation system
182 struct Material **mat;
186 /* texture space, copied as one block in editobject.c */
191 short texflag, pad1; /* keep a short because of give_obdata_texspace() */
193 short drawflag, twist_mode, pad[2];
194 float twist_smooth, smallcaps_scale;
196 short pathlen, totcol;
197 short flag, bevresol;
198 float width, ext1, ext2;
201 short resolu, resolv;
202 short resolu_ren, resolv_ren;
204 /* edit, index in nurb list */
206 /* edit, last selected point */
210 short len, lines, pos, spacemode;
211 float spacing, linedist, shear, fsize, wordspace, ulpos, ulheight;
216 struct SelBox *selboxes;
217 struct EditFont *editfont;
221 struct VFont *vfontb;
222 struct VFont *vfonti;
223 struct VFont *vfontbi;
227 float ctime; /* current evaltime - for use by Objects parented to curves */
231 int selstart, selend;
233 struct CharInfo *strinfo;
234 struct CharInfo curinfo;
237 /* **************** CURVE ********************* */
240 #define CU_AUTOSPACE 1
243 #define CU_HIDE_HANDLES (1 << 0)
244 #define CU_HIDE_NORMALS (1 << 1)
252 #define CU_UV_ORCO 32
253 #define CU_DEFORM_BOUNDS_OFF 64
254 #define CU_STRETCH 128
255 #define CU_OFFS_PATHDIST 256
256 #define CU_FAST 512 /* Font: no filling inside editmode */
257 #define CU_RETOPO 1024
258 #define CU_DS_EXPAND 2048
259 #define CU_PATH_RADIUS 4096 /* make use of the path radius if this is enabled (default for new curves) */
260 #define CU_DEFORM_FILL 8192 /* fill 2d curve after deformation */
263 #define CU_TWIST_Z_UP 0
264 // #define CU_TWIST_Y_UP 1 // not used yet
265 // #define CU_TWIST_X_UP 2
266 #define CU_TWIST_MINIMUM 3
267 #define CU_TWIST_TANGENT 4
278 #define CU_2D 8 /* moved from type since 2.4x */
284 #define CU_CARDINAL 3
286 #define CU_TYPE (CU_POLY|CU_BEZIER|CU_BSPLINE|CU_CARDINAL|CU_NURBS)
288 /* only for adding */
289 #define CU_PRIMITIVE 0xF00
292 #define CU_PRIM_CURVE 0x100
293 /* 8 points circle */
294 #define CU_PRIM_CIRCLE 0x200
296 #define CU_PRIM_PATCH 0x300
297 #define CU_PRIM_TUBE 0x400
298 #define CU_PRIM_SPHERE 0x500
299 #define CU_PRIM_DONUT 0x600
300 /* 5 points, 5th order straight line (for anim path) */
301 #define CU_PRIM_PATH 0x700
304 /* flagu flagv (nurb) */
305 #define CU_NURB_CYCLIC 1
306 #define CU_NURB_ENDPOINT 2
307 #define CU_NURB_BEZIER 4
309 /* *************** BEZTRIPLE **************** */
311 /* h1 h2 (beztriple) */
312 typedef enum eBezTriple_Handle {
317 HD_AUTO_ANIM, /* not real handle type, but is just used as dummy item for anim code */
320 /* interpolation modes (used only for BezTriple->ipo) */
321 typedef enum eBezTriple_Interpolation {
322 BEZT_IPO_CONST = 0, /* constant interpolation */
323 BEZT_IPO_LIN, /* linear interpolation */
324 BEZT_IPO_BEZ, /* bezier interpolation */
325 } eBezTriple_Interpolation;
327 /* types of keyframe (used only for BezTriple->hide when BezTriple is used in F-Curves) */
328 typedef enum eBezTriple_KeyframeType {
329 BEZT_KEYTYPE_KEYFRAME = 0, /* default - 'proper' Keyframe */
330 BEZT_KEYTYPE_EXTREME, /* 'extreme' keyframe */
331 BEZT_KEYTYPE_BREAKDOWN, /* 'breakdown' keyframe */
332 } eBezTriple_KeyframeType;
334 /* checks if the given BezTriple is selected */
335 #define BEZSELECTED(bezt) (((bezt)->f2 & SELECT) || ((bezt)->f1 & SELECT) || ((bezt)->f3 & SELECT))
336 #define BEZSELECTED_HIDDENHANDLES(cu, bezt) (((cu)->drawflag & CU_HIDE_HANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt))
338 /* *************** CHARINFO **************** */
341 /* note: CU_CHINFO_WRAP and CU_CHINFO_SMALLCAPS_TEST are set dynamically */
342 #define CU_CHINFO_BOLD (1<<0)
343 #define CU_CHINFO_ITALIC (1<<1)
344 #define CU_CHINFO_UNDERLINE (1<<2)
345 #define CU_CHINFO_WRAP (1<<3) /* wordwrap occurred here */
346 #define CU_CHINFO_SMALLCAPS (1<<4)
347 #define CU_CHINFO_SMALLCAPS_CHECK (1<<5) /* set at runtime, checks if case switching is needed */
349 /* mixed with KEY_LINEAR but define here since only curve supports */
350 #define KEY_CU_EASE 3