Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00019 * All rights reserved. 00020 * 00021 * The Original Code is: all of this file. 00022 * 00023 * Contributor(s): none yet. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00032 #ifndef DNA_CURVE_TYPES_H 00033 #define DNA_CURVE_TYPES_H 00034 00035 #include "DNA_defs.h" 00036 #include "DNA_listBase.h" 00037 #include "DNA_vec_types.h" 00038 #include "DNA_ID.h" 00039 00040 #define MAXTEXTBOX 256 /* used in readfile.c and editfont.c */ 00041 00042 struct BoundBox; 00043 struct Object; 00044 struct Ipo; 00045 struct Key; 00046 struct Material; 00047 struct VFont; 00048 struct AnimData; 00049 struct SelBox; 00050 struct EditFont; 00051 struct GHash; 00052 00053 /* These two Lines with # tell makesdna this struct can be excluded. */ 00054 # 00055 # 00056 typedef struct PathPoint { 00057 float vec[4]; /* grr, cant get rid of tilt yet */ 00058 float quat[4]; 00059 float radius, weight; 00060 } PathPoint; 00061 00062 /* These two Lines with # tell makesdna this struct can be excluded. */ 00063 # 00064 # 00065 typedef struct Path { 00066 struct PathPoint *data; 00067 int len; 00068 float totdist; 00069 } Path; 00070 00071 /* These two Lines with # tell makesdna this struct can be excluded. */ 00072 # 00073 # 00074 typedef struct BevList { 00075 struct BevList *next, *prev; 00076 int nr, dupe_nr; 00077 short poly, hole; 00078 } BevList; 00079 00080 /* These two Lines with # tell makesdna this struct can be excluded. */ 00081 # 00082 # 00083 typedef struct BevPoint { 00084 float vec[3], alfa, radius, weight; 00085 float sina, cosa; /* 2D Only */ 00086 float dir[3], tan[3], quat[4]; /* 3D Only */ 00087 short split_tag, dupe_tag; 00088 } BevPoint; 00089 00090 /* Keyframes on F-Curves (allows code reuse of Bezier eval code) and 00091 * Points on Bezier Curves/Paths are generally BezTriples 00092 */ 00093 /* note: alfa location in struct is abused by Key system */ 00094 /* vec in BezTriple looks like this: 00095 vec[0][0]=x location of handle 1 00096 vec[0][1]=y location of handle 1 00097 vec[0][2]=z location of handle 1 (not used for FCurve Points(2d)) 00098 vec[1][0]=x location of control point 00099 vec[1][1]=y location of control point 00100 vec[1][2]=z location of control point 00101 vec[2][0]=x location of handle 2 00102 vec[2][1]=y location of handle 2 00103 vec[2][2]=z location of handle 2 (not used for FCurve Points(2d)) 00104 */ 00105 typedef struct BezTriple { 00106 float vec[3][3]; 00107 float alfa, weight, radius; /* alfa: tilt in 3D View, weight: used for softbody goal weight, radius: for bevel tapering */ 00108 short ipo; /* ipo: interpolation mode for segment from this BezTriple to the next */ 00109 char h1, h2; /* h1, h2: the handle type of the two handles */ 00110 char f1, f2, f3; /* f1, f2, f3: used for selection status */ 00111 char hide; /* hide: used to indicate whether BezTriple is hidden (3D), type of keyframe (eBezTriple_KeyframeTypes) */ 00112 } BezTriple; 00113 00114 /* note; alfa location in struct is abused by Key system */ 00115 typedef struct BPoint { 00116 float vec[4]; 00117 float alfa, weight; /* alfa: tilt in 3D View, weight: used for softbody goal weight */ 00118 short f1, hide; /* f1: selection status, hide: is point hidden or not */ 00119 float radius, pad; /* user-set radius per point for bevelling etc */ 00120 } BPoint; 00121 00122 typedef struct Nurb { 00123 struct Nurb *next, *prev; /* multiple nurbs per curve object are allowed */ 00124 short type; 00125 short mat_nr; /* index into material list */ 00126 short hide, flag; 00127 short pntsu, pntsv; /* number of points in the U or V directions */ 00128 short resolu, resolv; /* tesselation resolution in the U or V directions */ 00129 short orderu, orderv; 00130 short flagu, flagv; 00131 00132 float *knotsu, *knotsv; 00133 BPoint *bp; 00134 BezTriple *bezt; 00135 00136 short tilt_interp; /* KEY_LINEAR, KEY_CARDINAL, KEY_BSPLINE */ 00137 short radius_interp; 00138 00139 int charidx; 00140 } Nurb; 00141 00142 typedef struct CharInfo { 00143 short kern; 00144 short mat_nr; /* index start at 1, unlike mesh & nurbs */ 00145 char flag; 00146 char pad; 00147 short pad2; 00148 } CharInfo; 00149 00150 typedef struct TextBox { 00151 float x, y, w, h; 00152 } TextBox; 00153 00154 typedef struct EditNurb { 00155 /* base of nurbs' list (old Curve->editnurb) */ 00156 ListBase nurbs; 00157 00158 /* index data for shape keys */ 00159 struct GHash *keyindex; 00160 00161 /* shape key being edited */ 00162 int shapenr; 00163 00164 char pad[4]; 00165 } EditNurb; 00166 00167 typedef struct Curve { 00168 ID id; 00169 struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ 00170 00171 struct BoundBox *bb; 00172 00173 ListBase nurb; /* actual data, called splines in rna */ 00174 ListBase disp; /* undeformed display list, used mostly for texture space calculation */ 00175 00176 EditNurb *editnurb; /* edited data, not in file, use pointer so we can check for it */ 00177 00178 struct Object *bevobj, *taperobj, *textoncurve; 00179 struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ 00180 Path *path; 00181 struct Key *key; 00182 struct Material **mat; 00183 00184 ListBase bev; 00185 00186 /* texture space, copied as one block in editobject.c */ 00187 float loc[3]; 00188 float size[3]; 00189 float rot[3]; 00190 00191 short type; /* creation-time type of curve datablock */ 00192 00193 short texflag; /* keep a short because of give_obdata_texspace() */ 00194 short drawflag, twist_mode; 00195 float twist_smooth, smallcaps_scale; 00196 00197 int pathlen; 00198 short pad, totcol; 00199 short flag, bevresol; 00200 float width, ext1, ext2; 00201 00202 /* default */ 00203 short resolu, resolv; 00204 short resolu_ren, resolv_ren; 00205 00206 /* edit, index in nurb list */ 00207 int actnu; 00208 /* edit, last selected point */ 00209 void *lastsel; 00210 00211 /* font part */ 00212 short len, lines, pos, spacemode; 00213 float spacing, linedist, shear, fsize, wordspace, ulpos, ulheight; 00214 float xof, yof; 00215 float linewidth; 00216 00217 char *str; 00218 struct SelBox *selboxes; 00219 struct EditFont *editfont; 00220 00221 char family[24]; 00222 struct VFont *vfont; 00223 struct VFont *vfontb; 00224 struct VFont *vfonti; 00225 struct VFont *vfontbi; 00226 00227 int sepchar; 00228 00229 float ctime; /* current evaltime - for use by Objects parented to curves */ 00230 int totbox, actbox; 00231 struct TextBox *tb; 00232 00233 int selstart, selend; 00234 00235 struct CharInfo *strinfo; 00236 struct CharInfo curinfo; 00237 } Curve; 00238 00239 /* **************** CURVE ********************* */ 00240 00241 /* texflag */ 00242 #define CU_AUTOSPACE 1 00243 00244 /* drawflag */ 00245 #define CU_HIDE_HANDLES (1 << 0) 00246 #define CU_HIDE_NORMALS (1 << 1) 00247 00248 /* flag */ 00249 #define CU_3D 1 00250 #define CU_FRONT 2 00251 #define CU_BACK 4 00252 #define CU_PATH 8 00253 #define CU_FOLLOW 16 00254 #define CU_UV_ORCO 32 00255 #define CU_DEFORM_BOUNDS_OFF 64 00256 #define CU_STRETCH 128 00257 #define CU_OFFS_PATHDIST 256 00258 #define CU_FAST 512 /* Font: no filling inside editmode */ 00259 /* #define CU_RETOPO 1024 */ /* DEPRECATED */ 00260 #define CU_DS_EXPAND 2048 00261 #define CU_PATH_RADIUS 4096 /* make use of the path radius if this is enabled (default for new curves) */ 00262 #define CU_DEFORM_FILL 8192 /* fill 2d curve after deformation */ 00263 00264 /* twist mode */ 00265 #define CU_TWIST_Z_UP 0 00266 // #define CU_TWIST_Y_UP 1 // not used yet 00267 // #define CU_TWIST_X_UP 2 00268 #define CU_TWIST_MINIMUM 3 00269 #define CU_TWIST_TANGENT 4 00270 00271 /* spacemode */ 00272 #define CU_LEFT 0 00273 #define CU_MIDDLE 1 00274 #define CU_RIGHT 2 00275 #define CU_JUSTIFY 3 00276 #define CU_FLUSH 4 00277 00278 /* flag (nurb) */ 00279 #define CU_SMOOTH 1 00280 #define CU_2D 8 /* moved from type since 2.4x */ 00281 00282 /* type (nurb) */ 00283 #define CU_POLY 0 00284 #define CU_BEZIER 1 00285 #define CU_BSPLINE 2 00286 #define CU_CARDINAL 3 00287 #define CU_NURBS 4 00288 #define CU_TYPE (CU_POLY|CU_BEZIER|CU_BSPLINE|CU_CARDINAL|CU_NURBS) 00289 00290 /* only for adding */ 00291 #define CU_PRIMITIVE 0xF00 00292 00293 /* 2 or 4 points */ 00294 #define CU_PRIM_CURVE 0x100 00295 /* 8 points circle */ 00296 #define CU_PRIM_CIRCLE 0x200 00297 /* 4x4 patch Nurb */ 00298 #define CU_PRIM_PATCH 0x300 00299 #define CU_PRIM_TUBE 0x400 00300 #define CU_PRIM_SPHERE 0x500 00301 #define CU_PRIM_DONUT 0x600 00302 /* 5 points, 5th order straight line (for anim path) */ 00303 #define CU_PRIM_PATH 0x700 00304 00305 00306 /* flagu flagv (nurb) */ 00307 #define CU_NURB_CYCLIC 1 00308 #define CU_NURB_ENDPOINT 2 00309 #define CU_NURB_BEZIER 4 00310 00311 /* *************** BEZTRIPLE **************** */ 00312 00313 /* h1 h2 (beztriple) */ 00314 typedef enum eBezTriple_Handle { 00315 HD_FREE = 0, 00316 HD_AUTO, 00317 HD_VECT, 00318 HD_ALIGN, 00319 HD_AUTO_ANIM /* auto-clamped handles for animation */ 00320 } eBezTriple_Handle; 00321 00322 /* interpolation modes (used only for BezTriple->ipo) */ 00323 typedef enum eBezTriple_Interpolation { 00324 BEZT_IPO_CONST = 0, /* constant interpolation */ 00325 BEZT_IPO_LIN, /* linear interpolation */ 00326 BEZT_IPO_BEZ /* bezier interpolation */ 00327 } eBezTriple_Interpolation; 00328 00329 /* types of keyframe (used only for BezTriple->hide when BezTriple is used in F-Curves) */ 00330 typedef enum eBezTriple_KeyframeType { 00331 BEZT_KEYTYPE_KEYFRAME = 0, /* default - 'proper' Keyframe */ 00332 BEZT_KEYTYPE_EXTREME, /* 'extreme' keyframe */ 00333 BEZT_KEYTYPE_BREAKDOWN, /* 'breakdown' keyframe */ 00334 BEZT_KEYTYPE_JITTER, /* 'jitter' keyframe (for adding 'filler' secondary motion) */ 00335 } eBezTriple_KeyframeType; 00336 00337 /* checks if the given BezTriple is selected */ 00338 #define BEZSELECTED(bezt) (((bezt)->f2 & SELECT) || ((bezt)->f1 & SELECT) || ((bezt)->f3 & SELECT)) 00339 #define BEZSELECTED_HIDDENHANDLES(cu, bezt) (((cu)->drawflag & CU_HIDE_HANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt)) 00340 00341 /* *************** CHARINFO **************** */ 00342 00343 /* flag */ 00344 /* note: CU_CHINFO_WRAP and CU_CHINFO_SMALLCAPS_TEST are set dynamically */ 00345 #define CU_CHINFO_BOLD (1<<0) 00346 #define CU_CHINFO_ITALIC (1<<1) 00347 #define CU_CHINFO_UNDERLINE (1<<2) 00348 #define CU_CHINFO_WRAP (1<<3) /* wordwrap occurred here */ 00349 #define CU_CHINFO_SMALLCAPS (1<<4) 00350 #define CU_CHINFO_SMALLCAPS_CHECK (1<<5) /* set at runtime, checks if case switching is needed */ 00351 00352 /* mixed with KEY_LINEAR but define here since only curve supports */ 00353 #define KEY_CU_EASE 3 00354 00355 00356 #endif 00357