Constraint stuff from tuhopuu including (but probably not limited too):
[blender-staging.git] / source / blender / makesdna / DNA_constraint_types.h
1 /**
2  * $Id$
3  *
4  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. The Blender
10  * Foundation also sells licenses for use in proprietary software under
11  * the Blender License.  See http://www.blender.org/BL/ for information
12  * about this.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  *
23  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
24  * All rights reserved.
25  *
26  * The Original Code is: all of this file.
27  *
28  * Contributor(s): none yet.
29  *
30  * ***** END GPL/BL DUAL LICENSE BLOCK *****
31  * Constraint DNA data
32  */
33
34 #ifndef DNA_CONSTRAINT_TYPES_H
35 #define DNA_CONSTRAINT_TYPES_H
36
37 #include "DNA_ID.h"
38 #include "DNA_ipo_types.h"
39 #include "DNA_object_types.h"
40
41 struct Action;
42
43 typedef struct bConstraintChannel{
44         struct bConstraintChannel *next, *prev;
45         Ipo                     *ipo;
46         short           flag;
47         char            name[30];
48 } bConstraintChannel;
49
50 typedef struct bConstraint{
51         struct bConstraint *next, *prev;
52         void            *data;          /*      Constraint data (a valid constraint type) */
53         Ipo                     *ipo;           /*      Constraint ipo  */
54         char            type;           /*      Constraint type */
55         char            otype;          /*      Old type - for menu callbacks */
56         short           flag;           /*      Flag */
57         short           reserved1;      
58         char            name[30];       /*      Constraint name */
59
60         float           enforce;
61         float           time;           
62         float           offset[3];      /* Target location offset */
63         float           orient[3];      /* Target orientation offset */
64         float           roll[3];        /* Target roll offset (needed?) */
65 } bConstraint;
66
67 /* Single-target subobject constraints */
68 typedef struct bKinematicConstraint{
69         Object          *tar;
70         float           tolerance;              /* Acceptable distance from target */
71         int                     iterations;             /* Maximum number of iterations to try */
72         char            subtarget[32];  /* String to specify sub-object target */
73
74         float           cacheeff[3];    /* Target location cache */
75         int                     reserved1;
76
77         float           cachemat[4][4]; /* Result cache */
78 } bKinematicConstraint;
79
80 typedef struct bTrackToConstraint{
81         Object          *tar;
82         int                     reserved1;
83         int                     reserved2;
84         char            subtarget[32];
85 } bTrackToConstraint;
86
87 typedef struct bRotateLikeConstraint{
88         Object          *tar;
89         int                     flag;
90         int                     reserved1;
91         char            subtarget[32];
92 } bRotateLikeConstraint;
93
94 typedef struct bLocateLikeConstraint{
95         Object          *tar;
96         int                     flag;
97         int                     reserved1;
98         char            subtarget[32];
99 } bLocateLikeConstraint;
100
101 typedef struct bActionConstraint{
102         Object          *tar;
103         int                     type;
104         short           start;
105         short           end;
106         float           min;
107         float           max;
108         struct bAction  *act;
109         char            subtarget[32];
110 } bActionConstraint;
111
112 /* Locked Axis Tracking constraint */
113 typedef struct bLockTrackConstraint{
114         Object          *tar;
115         int                     trackflag;
116         int                     lockflag;
117         char            subtarget[32];
118 } bLockTrackConstraint;
119
120 /* Follow Path constraints */
121 typedef struct bFollowPathConstraint{
122         Object          *tar;   /* Must be path object */
123         float           offset; /* Offset in time on the path (in frame) */
124         int                     followflag;
125         int                     trackflag;
126         int                     upflag;
127 } bFollowPathConstraint;
128
129 /* Zero-target constraints */
130 typedef struct bRotationConstraint{
131         float xmin, xmax;
132         float ymin, ymax;
133         float zmin, zmax;
134 } bRotationConstraint;
135
136 /* bConstraint.type */
137 #define CONSTRAINT_TYPE_NULL            0
138 #define CONSTRAINT_TYPE_CHILDOF         1       /* Unimplemented */
139 #define CONSTRAINT_TYPE_TRACKTO         2       
140 #define CONSTRAINT_TYPE_KINEMATIC       3       
141 #define CONSTRAINT_TYPE_FOLLOWPATH      4
142 #define CONSTRAINT_TYPE_ROTLIMIT        5       /* Unimplemented */
143 #define CONSTRAINT_TYPE_LOCLIMIT        6       /* Unimplemented */
144 #define CONSTRAINT_TYPE_SIZELIMIT       7       /* Unimplemented */
145 #define CONSTRAINT_TYPE_ROTLIKE         8       
146 #define CONSTRAINT_TYPE_LOCLIKE         9       
147 #define CONSTRAINT_TYPE_SIZELIKE        10      /* Unimplemented */
148 #define CONSTRAINT_TYPE_PYTHON          11      /* Unimplemented */
149 #define CONSTRAINT_TYPE_ACTION          12
150 #define CONSTRAINT_TYPE_LOCKTRACK       13      /* New Tracking constraint that locks an axis in place - theeth */
151
152 /* bConstraint.flag */
153 #define CONSTRAINT_EXPAND               0x00000001
154 #define CONSTRAINT_DONE                 0x00000002
155 #define CONSTRAINT_DISABLE              0x00000004
156 #define CONSTRAINT_LOOPTESTED   0x00000008
157
158 #define CONSTRAINT_EXPAND_BIT   0
159 #define CONSTRAINT_DONE_BIT             1
160 #define CONSTRAINT_DISABLE_BIT  2
161
162 /* bConstraintChannel.flag */
163 #define CONSTRAINT_CHANNEL_SELECT       0x00000001
164
165 /* bLocateLikeConstraint.flag */
166 #define LOCLIKE_X               0x00000001
167 #define LOCLIKE_Y               0x00000002
168 #define LOCLIKE_Z               0x00000004
169
170 /* Tracking flags */
171 #define LOCK_X          0x00000000
172 #define LOCK_Y          0x00000001
173 #define LOCK_Z          0x00000002
174
175 #define UP_X            0x00000000
176 #define UP_Y            0x00000001
177 #define UP_Z            0x00000002
178
179 #define TRACK_X         0x00000000
180 #define TRACK_Y         0x00000001
181 #define TRACK_Z         0x00000002
182 #define TRACK_nX        0x00000003
183 #define TRACK_nY        0x00000004
184 #define TRACK_nZ        0x00000005
185
186 #endif
187