2 * blenlib/DNA_object_types.h (mar-2001 nzc)
4 * Object is a sort of wrapper for general info.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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_OBJECT_TYPES_H
34 #define DNA_OBJECT_TYPES_H
36 #include "DNA_listBase.h"
38 #include "DNA_scriptlink_types.h"
50 struct bConstraintChannel;
53 struct FluidsimSettings;
54 struct ParticleSystem;
57 typedef struct bDeformGroup {
58 struct bDeformGroup *next, *prev;
62 typedef struct BoundBox {
68 #define OB_BB_DISABLED 1
70 typedef struct Object {
74 int par1, par2, par3; /* can be vertexnrs */
75 char parsubstr[32]; /* String describing subobject info */
76 struct Object *parent, *track;
77 /* if ob->proxy (or proxy_group), this object is proxy for object ob->proxy */
78 /* proxy_from is set in target back to the proxy. */
79 struct Object *proxy, *proxy_group, *proxy_from;
83 struct bAction *action;
84 struct bAction *poselib;
88 ListBase constraintChannels;
92 ListBase modifiers; /* list of ModifierData structures */
94 struct Material **mat;
96 /* rot en drot have to be together! (transform('r' en 's')) */
97 float loc[3], dloc[3], orig[3];
98 float size[3], dsize[3];
99 float rot[3], drot[3];
100 /* float quat[4], dquat[4]; (not used yet) */
102 float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */
103 float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */
104 float imat[4][4]; /* for during render, old game engine, temporally: ipokeys of transform */
106 unsigned int lay; /* copy of Base */
108 short flag; /* copy of Base */
109 short colbits; /* when zero, from obdata */
111 short transflag, ipoflag; /* transformation and ipo settings */
112 short trackflag, upflag;
113 short nlaflag, protectflag; /* nlaflag defines NLA override, protectflag is bits to lock transform */
114 short ipowin, scaflag; /* ipowin: blocktype last ipowindow */
115 short scavisflag, boundtype;
117 int dupon, dupoff, dupsta, dupend;
119 float sf, ctime; /* sf is time-offset, ctime is the objects current time */
121 /* during realtime */
123 /* note that inertia is only called inertia for historical reasons
124 * and is not changed to avoid DNA surgery. It actually reflects the
125 * Size value in the GameButtons (= radius) */
127 float mass, damping, inertia;
128 /* The form factor k is introduced to give the user more control
129 * and to fix incompatibility problems.
130 * For rotational symmetric objects, the inertia value can be
131 * expressed as: Theta = k * m * r^2
132 * where m = Mass, r = Radius
133 * For a Sphere, the form factor is by default = 0.4
137 float rdamping, sizefac;
140 char totcol; /* copy of mesh or curve or meta */
141 char actcol; /* currently selected material in the user interface */
142 char empty_drawtype, pad1[3];
143 float empty_drawsize;
144 float dupfacesca; /* dupliface scale */
146 ScriptLink scriptlink;
149 ListBase controllers;
153 short index; /* custom index, for renderpasses */
154 unsigned short actdef; /* current deformation group */
155 float col[4]; /* object color, adjusted via IPO's only */
157 * Settings for game objects
158 * bit 0: Object has dynamic behaviour
159 * bit 2: Object is evaluated by the gameengine
160 * bit 6: Use Fh settings in Materials
161 * bit 7: Use face normal to rotate Object
162 * bit 8: Friction is anisotropic
163 * bit 9: Object is a ghost
164 * bit 10: Do rigid body dynamics.
165 * bit 11: Use bounding object for physics
170 * bit 15: Always ignore activity culling
173 short softflag; /* softboday settings */
174 short recalc; /* dependency flag */
175 float anisotropicFriction[3];
177 ListBase constraints;
180 ListBase particlesystem; /* particle systems */
182 struct PartDeflect *pd; /* particle deflector/attractor/collision data */
183 struct SoftBody *soft; /* if exists, saved in file */
184 struct Group *dup_group; /* object duplicator for group */
186 short fluidsimFlag; /* NT toggle fluidsim participation on/off */
188 short restrictflag; /* for restricting view, select, render etc. accessible in outliner */
190 short shapenr, shapeflag; /* current shape key for menu or pinned, flag for pinning */
191 float smoothresh; /* smoothresh is phong interpolation ray_shadow correction in render */
192 short recalco, pad4; /* recalco for temp storage of ob->recalc, bad design warning */
194 struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
196 struct DerivedMesh *derivedDeform, *derivedFinal;
197 int lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
200 /*#ifdef WITH_VERSE*/
201 void *vnode; /* pointer at object VerseNode */
205 /* Warning, this is not used anymore because hooks are now modifiers */
206 typedef struct ObHook {
207 struct ObHook *next, *prev;
209 struct Object *parent;
210 float parentinv[4][4]; /* matrix making current transform unmodified */
211 float mat[4][4]; /* temp matrix while hooking */
212 float cent[3]; /* visualization of hook */
213 float falloff; /* if not zero, falloff is distance where influence zero */
218 int totindex, curindex; /* curindex is cache for fast lookup */
219 short type, active; /* active is only first hook, for button menu */
224 /* this work object is defined in object.c */
225 extern Object workob;
228 /* **************** OBJECT ********************* */
230 /* used many places... should be specialized */
245 #define OB_LATTICE 22
247 /* 23 and 24 are for life and sector (old file compat.) */
248 #define OB_ARMATURE 25
250 /* partype: first 4 bits: type */
262 /* (short) transflag */
263 #define OB_OFFS_LOCAL 1
265 #define OB_NEG_SCALE 4
266 #define OB_DUPLI (8+16+256+512+2048)
267 #define OB_DUPLIFRAMES 8
268 #define OB_DUPLIVERTS 16
269 #define OB_DUPLIROT 32
270 #define OB_DUPLINOSPEED 64
271 #define OB_POWERTRACK 128
272 #define OB_DUPLIGROUP 256
273 #define OB_DUPLIFACES 512
274 #define OB_DUPLIFACES_SCALE 1024
275 #define OB_DUPLIPARTS 2048
276 #define OB_RENDER_DUPLI 4096
278 /* (short) ipoflag */
280 #define OB_DRAWKEYSEL 2
282 #define OB_OFFS_MAT 8
283 #define OB_OFFS_VKEY 16
284 #define OB_OFFS_PATH 32
285 #define OB_OFFS_PARENT 64
286 #define OB_OFFS_PARTICLE 128
287 /* get ipo from from action or not? */
288 #define OB_ACTION_OB 256
289 #define OB_ACTION_KEY 512
290 /* for stride edit */
291 #define OB_DISABLE_PATH 1024
293 #define OB_OFFS_PARENTADD 2048
296 /* (short) trackflag / upflag */
304 /* gameflag in game.h */
307 #define OB_BOUNDBOX 1
313 /* this condition has been made more complex since editmode can draw textures */
314 #define CHECK_OB_DRAWTEXTURE(vd, dt) \
315 ((vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || \
316 (vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX))
318 #define CHECK_OB_DRAWFACEDOT(sce, vd, dt) \
319 ( (sce->selectmode & SCE_SELECT_FACE) && \
320 (vd->drawtype<=OB_SOLID) && \
321 (((vd->drawtype==OB_SOLID) && (dt>=OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX) && (vd->flag & V3D_ZBUF_SELECT)) == 0) \
325 /* dtx: flags, char! */
327 #define OB_TEXSPACE 4
328 #define OB_DRAWNAME 8
329 #define OB_DRAWIMAGE 16
330 /* for solid+wire display */
331 #define OB_DRAWWIRE 32
333 #define OB_DRAWXRAY 64
334 /* enable transparent draw */
335 #define OB_DRAWTRANSP 128
337 /* empty_drawtype: no flags */
339 #define OB_PLAINAXES 2
341 #define OB_SINGLE_ARROW 4
343 #define OB_EMPTY_SPHERE 6
344 #define OB_EMPTY_CONE 7
347 #define OB_BOUND_BOX 0
348 #define OB_BOUND_SPHERE 1
349 #define OB_BOUND_CYLINDER 2
350 #define OB_BOUND_CONE 3
351 #define OB_BOUND_POLYH 4
352 #define OB_BOUND_POLYT 5
353 #define OB_BOUND_DYN_MESH 6
356 /* **************** BASE ********************* */
358 /* also needed for base!!!!! or rather, thy interfere....*/
359 /* base->flag and ob->flag */
361 #define BA_HAS_RECALC_OB 4
362 #define BA_HAS_RECALC_DATA 8
366 #define BA_FROMSET 128
368 /* an initial attempt as making selection more specific! */
369 #define BA_DESELECT 0
373 #define OB_FROMDUPLI 512
375 #define OB_RADIO 2048
376 #define OB_FROMGROUP 4096
377 #define OB_POSEMODE 8192
379 /* ob->recalc (flag bits!) */
380 #define OB_RECALC_OB 1
381 #define OB_RECALC_DATA 2
382 /* time flag is set when time changes need recalc, so baked systems can ignore it */
383 #define OB_RECALC_TIME 4
390 #define OB_INERTIA_LOCK_X 8
391 #define OB_INERTIA_LOCK_Y 16
392 #define OB_INERTIA_LOCK_Z 32
394 #define OB_ROT_FH 128
395 #define OB_ANISOTROPIC_FRICTION 256
397 #define OB_RIGID_BODY 1024
398 #define OB_BOUNDS 2048
400 #define OB_COLLISION_RESPONSE 4096
401 #define OB_SECTOR 8192
402 #define OB_PROP 16384
403 #define OB_MAINACTOR 32768
406 #define OB_NEVER_DO_ACTIVITY_CULLING 1
408 #define OB_LIFE (OB_PROP|OB_DYNAMIC|OB_ACTOR|OB_MAINACTOR|OB_CHILD)
411 #define OB_VIS_SENS 1
412 #define OB_VIS_CONT 2
416 #define OB_SHOWSENS 64
417 #define OB_SHOWACT 128
418 #define OB_ADDSENS 256
419 #define OB_ADDCONT 512
420 #define OB_ADDACT 1024
421 #define OB_SHOWCONT 2048
423 /* ob->restrictflag */
424 #define OB_RESTRICT_VIEW 1
425 #define OB_RESTRICT_SELECT 2
426 #define OB_RESTRICT_RENDER 4
429 #define OB_SHAPE_LOCK 1
430 #define OB_SHAPE_TEMPLOCK 2
433 #define OB_NLA_OVERRIDE 1
434 #define OB_NLA_COLLAPSED 2
436 /* ob->protectflag */
437 #define OB_LOCK_LOCX 1
438 #define OB_LOCK_LOCY 2
439 #define OB_LOCK_LOCZ 4
440 #define OB_LOCK_LOC 7
441 #define OB_LOCK_ROTX 8
442 #define OB_LOCK_ROTY 16
443 #define OB_LOCK_ROTZ 32
444 #define OB_LOCK_SCALEX 64
445 #define OB_LOCK_SCALEY 128
446 #define OB_LOCK_SCALEZ 256
448 /* ob->softflag in DNA_object_force.h */