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;
63 * The following illustrates the orientation of the
64 * bounding box in local space
83 typedef struct BoundBox {
89 #define OB_BB_DISABLED 1
91 typedef struct Object {
95 int par1, par2, par3; /* can be vertexnrs */
96 char parsubstr[32]; /* String describing subobject info */
97 struct Object *parent, *track;
98 /* if ob->proxy (or proxy_group), this object is proxy for object ob->proxy */
99 /* proxy_from is set in target back to the proxy. */
100 struct Object *proxy, *proxy_group, *proxy_from;
104 struct bAction *action;
105 struct bAction *poselib;
109 ListBase constraintChannels;
113 ListBase modifiers; /* list of ModifierData structures */
115 struct Material **mat;
117 /* rot en drot have to be together! (transform('r' en 's')) */
118 float loc[3], dloc[3], orig[3];
119 float size[3], dsize[3];
120 float rot[3], drot[3];
121 /* float quat[4], dquat[4]; (not used yet) */
123 float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */
124 float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */
125 float imat[4][4]; /* for during render, old game engine, temporally: ipokeys of transform */
127 unsigned int lay; /* copy of Base */
129 short flag; /* copy of Base */
130 short colbits; /* when zero, from obdata */
132 short transflag, ipoflag; /* transformation and ipo settings */
133 short trackflag, upflag;
134 short nlaflag, protectflag; /* nlaflag defines NLA override, protectflag is bits to lock transform */
135 short ipowin, scaflag; /* ipowin: blocktype last ipowindow */
136 short scavisflag, boundtype;
138 int dupon, dupoff, dupsta, dupend;
140 float sf, ctime; /* sf is time-offset, ctime is the objects current time */
142 /* during realtime */
144 /* note that inertia is only called inertia for historical reasons
145 * and is not changed to avoid DNA surgery. It actually reflects the
146 * Size value in the GameButtons (= radius) */
148 float mass, damping, inertia;
149 /* The form factor k is introduced to give the user more control
150 * and to fix incompatibility problems.
151 * For rotational symmetric objects, the inertia value can be
152 * expressed as: Theta = k * m * r^2
153 * where m = Mass, r = Radius
154 * For a Sphere, the form factor is by default = 0.4
158 float rdamping, sizefac;
163 char totcol; /* copy of mesh or curve or meta */
164 char actcol; /* currently selected material in the user interface */
165 char empty_drawtype, pad1[3];
166 float empty_drawsize;
167 float dupfacesca; /* dupliface scale */
169 ScriptLink scriptlink;
172 ListBase controllers;
176 short index; /* custom index, for renderpasses */
177 unsigned short actdef; /* current deformation group */
178 float col[4]; /* object color, adjusted via IPO's only */
180 * Settings for game objects
181 * bit 0: Object has dynamic behaviour
182 * bit 2: Object is evaluated by the gameengine
183 * bit 6: Use Fh settings in Materials
184 * bit 7: Use face normal to rotate Object
185 * bit 8: Friction is anisotropic
186 * bit 9: Object is a ghost
187 * bit 10: Do rigid body dynamics.
188 * bit 11: Use bounding object for physics
193 * bit 15: Always ignore activity culling
196 short softflag; /* softboday settings */
197 short recalc; /* dependency flag */
198 float anisotropicFriction[3];
200 ListBase constraints;
203 ListBase particlesystem; /* particle systems */
205 struct PartDeflect *pd; /* particle deflector/attractor/collision data */
206 struct SoftBody *soft; /* if exists, saved in file */
207 struct Group *dup_group; /* object duplicator for group */
209 short fluidsimFlag; /* NT toggle fluidsim participation on/off */
211 short restrictflag; /* for restricting view, select, render etc. accessible in outliner */
213 short shapenr, shapeflag; /* current shape key for menu or pinned, flag for pinning */
214 float smoothresh; /* smoothresh is phong interpolation ray_shadow correction in render */
215 short recalco, pad4; /* recalco for temp storage of ob->recalc, bad design warning */
217 struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
219 struct DerivedMesh *derivedDeform, *derivedFinal;
220 int lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
221 unsigned int state; /* bit masks of game controllers that are active */
222 unsigned int init_state; /* bit masks of initial state as recorded by the users */
225 /*#ifdef WITH_VERSE*/
226 void *vnode; /* pointer at object VerseNode */
229 ListBase gpulamp; /* runtime, for lamps only */
232 /* Warning, this is not used anymore because hooks are now modifiers */
233 typedef struct ObHook {
234 struct ObHook *next, *prev;
236 struct Object *parent;
237 float parentinv[4][4]; /* matrix making current transform unmodified */
238 float mat[4][4]; /* temp matrix while hooking */
239 float cent[3]; /* visualization of hook */
240 float falloff; /* if not zero, falloff is distance where influence zero */
245 int totindex, curindex; /* curindex is cache for fast lookup */
246 short type, active; /* active is only first hook, for button menu */
251 /* this work object is defined in object.c */
252 extern Object workob;
255 /* **************** OBJECT ********************* */
257 /* used many places... should be specialized */
272 #define OB_LATTICE 22
274 /* 23 and 24 are for life and sector (old file compat.) */
275 #define OB_ARMATURE 25
277 /* partype: first 4 bits: type */
289 /* (short) transflag */
290 #define OB_OFFS_LOCAL 1
292 #define OB_NEG_SCALE 4
293 #define OB_DUPLI (8+16+256+512+2048)
294 #define OB_DUPLIFRAMES 8
295 #define OB_DUPLIVERTS 16
296 #define OB_DUPLIROT 32
297 #define OB_DUPLINOSPEED 64
298 #define OB_POWERTRACK 128
299 #define OB_DUPLIGROUP 256
300 #define OB_DUPLIFACES 512
301 #define OB_DUPLIFACES_SCALE 1024
302 #define OB_DUPLIPARTS 2048
303 #define OB_RENDER_DUPLI 4096
305 /* (short) ipoflag */
307 #define OB_DRAWKEYSEL 2
309 #define OB_OFFS_MAT 8
310 #define OB_OFFS_VKEY 16
311 #define OB_OFFS_PATH 32
312 #define OB_OFFS_PARENT 64
313 #define OB_OFFS_PARTICLE 128
314 /* get ipo from from action or not? */
315 #define OB_ACTION_OB 256
316 #define OB_ACTION_KEY 512
317 /* for stride edit */
318 #define OB_DISABLE_PATH 1024
320 #define OB_OFFS_PARENTADD 2048
323 /* (short) trackflag / upflag */
331 /* gameflag in game.h */
334 #define OB_BOUNDBOX 1
340 /* this condition has been made more complex since editmode can draw textures */
341 #define CHECK_OB_DRAWTEXTURE(vd, dt) \
342 ((vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || \
343 (vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX))
345 #define CHECK_OB_DRAWFACEDOT(sce, vd, dt) \
346 ( (sce->selectmode & SCE_SELECT_FACE) && \
347 (vd->drawtype<=OB_SOLID) && \
348 (((vd->drawtype==OB_SOLID) && (dt>=OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX) && (vd->flag & V3D_ZBUF_SELECT)) == 0) \
352 /* dtx: flags, char! */
354 #define OB_TEXSPACE 4
355 #define OB_DRAWNAME 8
356 #define OB_DRAWIMAGE 16
357 /* for solid+wire display */
358 #define OB_DRAWWIRE 32
360 #define OB_DRAWXRAY 64
361 /* enable transparent draw */
362 #define OB_DRAWTRANSP 128
364 /* empty_drawtype: no flags */
366 #define OB_PLAINAXES 2
368 #define OB_SINGLE_ARROW 4
370 #define OB_EMPTY_SPHERE 6
371 #define OB_EMPTY_CONE 7
374 #define OB_BOUND_BOX 0
375 #define OB_BOUND_SPHERE 1
376 #define OB_BOUND_CYLINDER 2
377 #define OB_BOUND_CONE 3
378 #define OB_BOUND_POLYH 4
379 #define OB_BOUND_POLYT 5
380 #define OB_BOUND_DYN_MESH 6
383 /* **************** BASE ********************* */
385 /* also needed for base!!!!! or rather, thy interfere....*/
386 /* base->flag and ob->flag */
388 #define BA_HAS_RECALC_OB 4
389 #define BA_HAS_RECALC_DATA 8
393 #define BA_FROMSET 128
395 /* an initial attempt as making selection more specific! */
396 #define BA_DESELECT 0
400 #define OB_FROMDUPLI 512
402 #define OB_RADIO 2048
403 #define OB_FROMGROUP 4096
404 #define OB_POSEMODE 8192
406 /* ob->recalc (flag bits!) */
407 #define OB_RECALC_OB 1
408 #define OB_RECALC_DATA 2
409 /* time flag is set when time changes need recalc, so baked systems can ignore it */
410 #define OB_RECALC_TIME 4
417 #define OB_INERTIA_LOCK_X 8
418 #define OB_INERTIA_LOCK_Y 16
419 #define OB_INERTIA_LOCK_Z 32
421 #define OB_ROT_FH 128
422 #define OB_ANISOTROPIC_FRICTION 256
424 #define OB_RIGID_BODY 1024
425 #define OB_BOUNDS 2048
427 #define OB_COLLISION_RESPONSE 4096
428 #define OB_SECTOR 8192
429 #define OB_PROP 16384
430 #define OB_MAINACTOR 32768
432 #define OB_PHYSICS 65536
435 #define OB_NEVER_DO_ACTIVITY_CULLING 1
437 #define OB_LIFE (OB_PROP|OB_DYNAMIC|OB_ACTOR|OB_MAINACTOR|OB_CHILD)
440 #define OB_VIS_SENS 1
441 #define OB_VIS_CONT 2
445 #define OB_SHOWSENS 64
446 #define OB_SHOWACT 128
447 #define OB_ADDSENS 256
448 #define OB_ADDCONT 512
449 #define OB_ADDACT 1024
450 #define OB_SHOWCONT 2048
451 #define OB_SETSTBIT 4096
452 #define OB_INITSTBIT 8192
454 /* ob->restrictflag */
455 #define OB_RESTRICT_VIEW 1
456 #define OB_RESTRICT_SELECT 2
457 #define OB_RESTRICT_RENDER 4
460 #define OB_SHAPE_LOCK 1
461 #define OB_SHAPE_TEMPLOCK 2
464 #define OB_NLA_OVERRIDE 1
465 #define OB_NLA_COLLAPSED 2
467 /* ob->protectflag */
468 #define OB_LOCK_LOCX 1
469 #define OB_LOCK_LOCY 2
470 #define OB_LOCK_LOCZ 4
471 #define OB_LOCK_LOC 7
472 #define OB_LOCK_ROTX 8
473 #define OB_LOCK_ROTY 16
474 #define OB_LOCK_ROTZ 32
475 #define OB_LOCK_ROT 56
476 #define OB_LOCK_SCALEX 64
477 #define OB_LOCK_SCALEY 128
478 #define OB_LOCK_SCALEZ 256
479 #define OB_LOCK_SCALE 448
481 /* ob->softflag in DNA_object_force.h */