Blender  V2.93
DNA_curve_types.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "DNA_ID.h"
27 #include "DNA_defs.h"
28 #include "DNA_listBase.h"
29 #include "DNA_vec_types.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #define MAXTEXTBOX 256 /* used in readfile.c and editfont.c */
36 
37 struct AnimData;
38 struct CurveProfile;
39 struct EditFont;
40 struct GHash;
41 struct Ipo;
42 struct Key;
43 struct Material;
44 struct Object;
45 struct VFont;
46 
47 /* These two Lines with # tell makesdna this struct can be excluded. */
48 #
49 #
50 typedef struct BevPoint {
51  float vec[3], tilt, radius, weight, offset;
53  float sina, cosa;
55  float dir[3], tan[3], quat[4];
56  short dupe_tag;
58 
59 /* These two Lines with # tell makesdna this struct can be excluded. */
60 #
61 #
62 typedef struct BevList {
63  struct BevList *next, *prev;
64  int nr, dupe_nr;
65  int poly, hole;
66  int charidx;
68  float *seglen;
71 
89 typedef struct BezTriple {
90  float vec[3][3];
92  float tilt;
94  float weight;
96  float radius;
97 
99  char ipo;
100 
105 
108  char hide;
109 
111  char easing;
113  float back;
116 
119  char _pad[3];
121 
125 typedef struct BPoint {
126  float vec[4];
128  float tilt;
130  float weight;
133  char _pad1[1];
134  short hide;
136  float radius;
137  char _pad[4];
139 
144 typedef struct Nurb {
146  struct Nurb *next, *prev;
147  short type;
149  short mat_nr;
150  short hide, flag;
152  int pntsu, pntsv;
153  char _pad[4];
155  short resolu, resolv;
156  short orderu, orderv;
157  short flagu, flagv;
158 
159  float *knotsu, *knotsv;
162 
164  short tilt_interp;
166 
167  /* only used for dynamically generated Nurbs created from OB_FONT's */
168  int charidx;
170 
171 typedef struct CharInfo {
172  short kern;
174  short mat_nr;
175  char flag;
176  char _pad[3];
178 
179 typedef struct TextBox {
180  float x, y, w, h;
182 
183 /* These two Lines with # tell makesdna this struct can be excluded. */
184 #
185 #
186 typedef struct EditNurb {
187  /* base of nurbs' list (old Curve->editnurb) */
189 
190  /* index data for shape keys */
191  struct GHash *keyindex;
192 
193  /* shape key being edited */
194  int shapenr;
195 
201 
203 
204 typedef struct Curve {
207  struct AnimData *adt;
208 
211 
214 
217  struct Ipo *ipo DNA_DEPRECATED;
218  struct Key *key;
219  struct Material **mat;
220 
222 
223  /* texture space, copied as one block in editobject.c */
224  float loc[3];
225  float size[3];
226 
228  short type;
229 
231  short texflag;
232  char _pad0[6];
233  short twist_mode;
235 
236  int pathlen;
237  short bevresol, totcol;
238  int flag;
239  float width, ext1, ext2;
240 
241  /* default */
242  short resolu, resolv;
244 
245  /* edit, index in nurb list */
246  int actnu;
247  /* edit, index in active nurb (BPoint or BezTriple) */
248  int actvert;
249 
250  char overflow;
258  char _pad;
259 
260  /* font part */
261  short lines;
263  float xof, yof;
264  float linewidth;
265 
266  /* copy of EditFont vars (wchar_t aligned),
267  * warning! don't use in editmode (storage only) */
268  int pos;
270 
271  /* text data */
278  int len;
279  char *str;
281 
282  char family[64];
283  struct VFont *vfont;
284  struct VFont *vfontb;
285  struct VFont *vfonti;
286  struct VFont *vfontbi;
287 
288  struct TextBox *tb;
290 
291  struct CharInfo *strinfo;
292  struct CharInfo curinfo;
293  /* font part end */
294 
296  float ctime;
297  float bevfac1, bevfac2;
299 
300  char _pad2[6];
302 
303  void *batch_cache;
304 } Curve;
305 
306 #define CURVE_VFONT_ANY(cu) ((cu)->vfont), ((cu)->vfontb), ((cu)->vfonti), ((cu)->vfontbi)
307 
308 /* **************** CURVE ********************* */
309 
310 /* Curve.texflag */
311 enum {
314 };
315 
316 #if 0 /* Moved to overlay options in 2.8 */
317 /* Curve.drawflag */
318 enum {
319  CU_HIDE_HANDLES = 1 << 0,
320  CU_HIDE_NORMALS = 1 << 1,
321 };
322 #endif
323 
324 /* Curve.flag */
325 enum {
326  CU_3D = 1 << 0,
327  CU_FRONT = 1 << 1,
328  CU_BACK = 1 << 2,
329  CU_PATH = 1 << 3,
330  CU_FOLLOW = 1 << 4,
331  CU_PATH_CLAMP = 1 << 5,
333  CU_STRETCH = 1 << 7,
334  /* CU_OFFS_PATHDIST = 1 << 8, */ /* DEPRECATED */
335  CU_FAST = 1 << 9, /* Font: no filling inside editmode */
336  /* CU_RETOPO = 1 << 10, */ /* DEPRECATED */
337  CU_DS_EXPAND = 1 << 11,
339  CU_PATH_RADIUS = 1 << 12,
341  CU_DEFORM_FILL = 1 << 13,
343  CU_FILL_CAPS = 1 << 14,
345  CU_MAP_TAPER = 1 << 15,
346 };
347 
348 /* Curve.twist_mode */
349 enum {
351  /* CU_TWIST_Y_UP = 1, */ /* not used yet */
352  /* CU_TWIST_X_UP = 2, */
355 };
356 
357 /* Curve.bevfac1_mapping, Curve.bevfac2_mapping, bevel factor mapping */
358 enum {
362 };
363 
364 /* Curve.spacemode */
365 enum {
371 };
372 
373 /* Curve.align_y */
374 enum {
380 };
381 
382 /* Curve.bevel_mode */
383 enum {
387 };
388 
390 enum {
397 };
398 
399 /* Curve.overflow. */
400 enum {
404 };
405 
406 /* Nurb.flag */
407 enum {
408  CU_SMOOTH = 1 << 0,
409 };
410 
411 /* Nurb.type */
412 enum {
413  CU_POLY = 0,
417  CU_NURBS = 4,
419 
420  /* only for adding */
421  CU_PRIMITIVE = 0xF00,
422 
423  /* 2 or 4 points */
424  CU_PRIM_CURVE = 0x100,
425  /* 8 points circle */
426  CU_PRIM_CIRCLE = 0x200,
427  /* 4x4 patch Nurb */
428  CU_PRIM_PATCH = 0x300,
429  CU_PRIM_TUBE = 0x400,
430  CU_PRIM_SPHERE = 0x500,
431  CU_PRIM_DONUT = 0x600,
432  /* 5 points, 5th order straight line (for anim path) */
433  CU_PRIM_PATH = 0x700,
434 };
435 
436 /* Nurb.flagu, Nurb.flagv */
437 enum {
438  CU_NURB_CYCLIC = 1 << 0,
440  CU_NURB_BEZIER = 1 << 2,
441 };
442 
443 #define CU_ACT_NONE -1
444 
445 /* *************** BEZTRIPLE **************** */
446 
447 /* BezTriple.f1,2,3 */
448 typedef enum eBezTriple_Flag {
449  /* SELECT */
450  BEZT_FLAG_TEMP_TAG = (1 << 1), /* always clear. */
452 
453 /* h1 h2 (beztriple) */
454 typedef enum eBezTriple_Handle {
455  HD_FREE = 0,
456  HD_AUTO = 1,
457  HD_VECT = 2,
458  HD_ALIGN = 3,
459  HD_AUTO_ANIM = 4, /* auto-clamped handles for animation */
460  HD_ALIGN_DOUBLESIDE = 5, /* align handles, displayed both of them. used for masks */
462 
463 /* auto_handle_type (beztriple) */
464 typedef enum eBezTriple_Auto_Type {
465  /* Normal automatic handle that can be refined further. */
467  /* Handle locked horizontal due to being an Auto Clamped local
468  * extreme or a curve endpoint with Constant extrapolation.
469  * Further smoothing is disabled. */
472 
473 /* interpolation modes (used only for BezTriple->ipo) */
475  /* traditional interpolation */
476  BEZT_IPO_CONST = 0, /* constant interpolation */
477  BEZT_IPO_LIN = 1, /* linear interpolation */
478  BEZT_IPO_BEZ = 2, /* bezier interpolation */
479 
480  /* easing equations */
492 
493 /* easing modes (used only for Keyframes - BezTriple->easing) */
494 typedef enum eBezTriple_Easing {
496 
501 
502 /* types of keyframe (used only for BezTriple->hide when BezTriple is used in F-Curves) */
504  BEZT_KEYTYPE_KEYFRAME = 0, /* default - 'proper' Keyframe */
505  BEZT_KEYTYPE_EXTREME = 1, /* 'extreme' keyframe */
506  BEZT_KEYTYPE_BREAKDOWN = 2, /* 'breakdown' keyframe */
507  BEZT_KEYTYPE_JITTER = 3, /* 'jitter' keyframe (for adding 'filler' secondary motion) */
508  BEZT_KEYTYPE_MOVEHOLD = 4, /* one end of a 'moving hold' */
510 
511 /* checks if the given BezTriple is selected */
512 #define BEZT_ISSEL_ANY(bezt) \
513  (((bezt)->f2 & SELECT) || ((bezt)->f1 & SELECT) || ((bezt)->f3 & SELECT))
514 #define BEZT_ISSEL_ALL(bezt) \
515  (((bezt)->f2 & SELECT) && ((bezt)->f1 & SELECT) && ((bezt)->f3 & SELECT))
516 #define BEZT_ISSEL_ALL_HIDDENHANDLES(v3d, bezt) \
517  ((((v3d) != NULL) && ((v3d)->overlay.handle_display == CURVE_HANDLE_NONE)) ? \
518  (bezt)->f2 & SELECT : \
519  BEZT_ISSEL_ALL(bezt))
520 #define BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt) \
521  ((((v3d) != NULL) && ((v3d)->overlay.handle_display == CURVE_HANDLE_NONE)) ? \
522  (bezt)->f2 & SELECT : \
523  BEZT_ISSEL_ANY(bezt))
524 
525 #define BEZT_ISSEL_IDX(bezt, i) \
526  ((i == 0 && (bezt)->f1 & SELECT) || (i == 1 && (bezt)->f2 & SELECT) || \
527  (i == 2 && (bezt)->f3 & SELECT))
528 
529 #define BEZT_SEL_ALL(bezt) \
530  { \
531  (bezt)->f1 |= SELECT; \
532  (bezt)->f2 |= SELECT; \
533  (bezt)->f3 |= SELECT; \
534  } \
535  ((void)0)
536 #define BEZT_DESEL_ALL(bezt) \
537  { \
538  (bezt)->f1 &= ~SELECT; \
539  (bezt)->f2 &= ~SELECT; \
540  (bezt)->f3 &= ~SELECT; \
541  } \
542  ((void)0)
543 #define BEZT_SEL_INVERT(bezt) \
544  { \
545  (bezt)->f1 ^= SELECT; \
546  (bezt)->f2 ^= SELECT; \
547  (bezt)->f3 ^= SELECT; \
548  } \
549  ((void)0)
550 
551 #define BEZT_SEL_IDX(bezt, i) \
552  { \
553  switch (i) { \
554  case 0: \
555  (bezt)->f1 |= SELECT; \
556  break; \
557  case 1: \
558  (bezt)->f2 |= SELECT; \
559  break; \
560  case 2: \
561  (bezt)->f3 |= SELECT; \
562  break; \
563  default: \
564  break; \
565  } \
566  } \
567  ((void)0)
568 
569 #define BEZT_DESEL_IDX(bezt, i) \
570  { \
571  switch (i) { \
572  case 0: \
573  (bezt)->f1 &= ~SELECT; \
574  break; \
575  case 1: \
576  (bezt)->f2 &= ~SELECT; \
577  break; \
578  case 2: \
579  (bezt)->f3 &= ~SELECT; \
580  break; \
581  default: \
582  break; \
583  } \
584  } \
585  ((void)0)
586 
587 #define BEZT_IS_AUTOH(bezt) \
588  (ELEM((bezt)->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM((bezt)->h2, HD_AUTO, HD_AUTO_ANIM))
589 
590 /* *************** CHARINFO **************** */
591 
592 /* CharInfo.flag */
593 enum {
594  /* note: CU_CHINFO_WRAP, CU_CHINFO_SMALLCAPS_TEST and CU_CHINFO_TRUNCATE are set dynamically */
595  CU_CHINFO_BOLD = 1 << 0,
599  CU_CHINFO_WRAP = 1 << 3,
605 };
606 
607 /* mixed with KEY_LINEAR but define here since only curve supports */
608 #define KEY_CU_EASE 3
609 
610 /* indicates point has been seen during surface duplication */
611 #define SURF_SEEN 4
612 
613 #ifdef __cplusplus
614 }
615 #endif
ID and Library types, which are fundamental for sdna.
struct Nurb Nurb
struct BevList BevList
@ CU_BEV_MODE_OBJECT
@ CU_BEV_MODE_ROUND
@ CU_BEV_MODE_CURVE_PROFILE
@ CU_OVERFLOW_SCALE
@ CU_OVERFLOW_TRUNCATE
@ CU_OVERFLOW_NONE
@ CU_PRIM_SPHERE
@ CU_PRIM_CURVE
@ CU_BEZIER
@ CU_BSPLINE
@ CU_PRIMITIVE
@ CU_TYPE
@ CU_POLY
@ CU_PRIM_DONUT
@ CU_PRIM_TUBE
@ CU_PRIM_CIRCLE
@ CU_NURBS
@ CU_PRIM_PATCH
@ CU_CARDINAL
@ CU_PRIM_PATH
struct CharInfo CharInfo
@ CU_SMOOTH
@ CU_ALIGN_Y_TOP
@ CU_ALIGN_Y_BOTTOM_BASELINE
@ CU_ALIGN_Y_CENTER
@ CU_ALIGN_Y_BOTTOM
@ CU_ALIGN_Y_TOP_BASELINE
struct Curve Curve
struct BevPoint BevPoint
@ CU_TAPER_RADIUS_OVERRIDE
@ CU_TAPER_RADIUS_MULTIPLY
@ CU_TAPER_RADIUS_ADD
struct BPoint BPoint
@ CU_NURB_CYCLIC
@ CU_NURB_ENDPOINT
@ CU_NURB_BEZIER
@ CU_TWIST_MINIMUM
@ CU_TWIST_TANGENT
@ CU_TWIST_Z_UP
@ CU_CHINFO_WRAP
@ CU_CHINFO_UNDERLINE
@ CU_CHINFO_BOLD
@ CU_CHINFO_ITALIC
@ CU_CHINFO_SMALLCAPS_CHECK
@ CU_CHINFO_SMALLCAPS
@ CU_CHINFO_OVERFLOW
@ CU_AUTOSPACE
@ CU_AUTOSPACE_EVALUATED
struct EditNurb EditNurb
eBezTriple_Handle
@ HD_AUTO_ANIM
@ HD_VECT
@ HD_FREE
@ HD_AUTO
@ HD_ALIGN_DOUBLESIDE
@ HD_ALIGN
eBezTriple_Auto_Type
@ HD_AUTOTYPE_NORMAL
@ HD_AUTOTYPE_LOCKED_FINAL
struct TextBox TextBox
struct BezTriple BezTriple
eBezTriple_Interpolation
@ BEZT_IPO_ELASTIC
@ BEZT_IPO_CIRC
@ BEZT_IPO_QUART
@ BEZT_IPO_BACK
@ BEZT_IPO_BOUNCE
@ BEZT_IPO_CUBIC
@ BEZT_IPO_EXPO
@ BEZT_IPO_CONST
@ BEZT_IPO_BEZ
@ BEZT_IPO_LIN
@ BEZT_IPO_SINE
@ BEZT_IPO_QUAD
@ BEZT_IPO_QUINT
@ CU_FILL_CAPS
@ CU_FAST
@ CU_3D
@ CU_FRONT
@ CU_FOLLOW
@ CU_PATH
@ CU_STRETCH
@ CU_DS_EXPAND
@ CU_PATH_RADIUS
@ CU_PATH_CLAMP
@ CU_MAP_TAPER
@ CU_DEFORM_FILL
@ CU_BACK
@ CU_DEFORM_BOUNDS_OFF
eBezTriple_Easing
@ BEZT_IPO_EASE_OUT
@ BEZT_IPO_EASE_AUTO
@ BEZT_IPO_EASE_IN
@ BEZT_IPO_EASE_IN_OUT
@ CU_BEVFAC_MAP_SPLINE
@ CU_BEVFAC_MAP_RESOLU
@ CU_BEVFAC_MAP_SEGMENT
eBezTriple_Flag
@ BEZT_FLAG_TEMP_TAG
@ CU_ALIGN_X_FLUSH
@ CU_ALIGN_X_MIDDLE
@ CU_ALIGN_X_LEFT
@ CU_ALIGN_X_JUSTIFY
@ CU_ALIGN_X_RIGHT
eBezTriple_KeyframeType
@ BEZT_KEYTYPE_EXTREME
@ BEZT_KEYTYPE_JITTER
@ BEZT_KEYTYPE_BREAKDOWN
@ BEZT_KEYTYPE_MOVEHOLD
@ BEZT_KEYTYPE_KEYFRAME
These structs are the foundation for all linked lists in the library system.
unsigned char uint8_t
Definition: stdint.h:81
short hide
char _pad1[1]
char _pad[4]
float weight
uint8_t f1
float vec[4]
float radius
float tilt
struct BevList * next
float * seglen
BevPoint * bevpoints
int * segbevcount
struct BevList * prev
short dupe_tag
float offset
float radius
float dir[3]
float tan[3]
float quat[4]
float weight
float vec[3]
char auto_handle_type
float vec[3][3]
char _pad[3]
char _pad[3]
struct Object * bevobj
char overflow
float spacing
float loc[3]
struct CurveProfile * bevel_profile
struct Material ** mat
struct VFont * vfont
short totcol
float bevfac2
float xof
int len_char32
float ext1
char align_y
struct CharInfo curinfo
struct TextBox * tb
short resolv
void * batch_cache
int selstart
struct Ipo *ipo DNA_DEPRECATED
struct AnimData * adt
float ulheight
float ulpos
struct EditFont * editfont
char bevfac2_mapping
short bevresol
char family[64]
short resolv_ren
short resolu
short lines
float fsize_realtime
float bevfac1
char spacemode
short twist_mode
float wordspace
char _pad0[6]
struct Key * key
struct CharInfo * strinfo
struct VFont * vfontb
float linewidth
struct Object * textoncurve
float shear
char bevel_mode
char * str
EditNurb * editnurb
char _pad2[6]
struct VFont * vfonti
short texflag
float smallcaps_scale
ListBase nurb
float linedist
float fsize
float yof
struct VFont * vfontbi
float ctime
float ext2
char taper_radius_mode
char bevfac1_mapping
float width
struct Object * taperobj
short resolu_ren
float size[3]
float twist_smooth
short type
char needs_flush_to_id
struct GHash * keyindex
ListBase nurbs
Definition: DNA_ID.h:273
short flagu
short orderu
struct Nurb * next
short orderv
float * knotsu
int charidx
short flag
short tilt_interp
short type
float * knotsv
BezTriple * bezt
BPoint * bp
short resolu
struct Nurb * prev
char _pad[4]
short resolv
short radius_interp
short hide
short flagv
short mat_nr