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"
50 struct bConstraintChannel;
53 struct FluidsimSettings;
54 struct ParticleSystem;
58 typedef struct bDeformGroup {
59 struct bDeformGroup *next, *prev;
64 * The following illustrates the orientation of the
65 * bounding box in local space
84 typedef struct BoundBox {
90 #define OB_BB_DISABLED 1
92 typedef struct Object {
94 struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
96 struct SculptSession *sculpt;
99 int par1, par2, par3; /* can be vertexnrs */
100 char parsubstr[32]; /* String describing subobject info */
101 struct Object *parent, *track;
102 /* if ob->proxy (or proxy_group), this object is proxy for object ob->proxy */
103 /* proxy_from is set in target back to the proxy. */
104 struct Object *proxy, *proxy_group, *proxy_from;
105 struct Ipo *ipo; // XXX depreceated... old animation system
108 struct bAction *action; // XXX depreceated... old animation system
109 struct bAction *poselib;
113 ListBase constraintChannels; // XXX depreceated... old animation system
117 ListBase modifiers; /* list of ModifierData structures */
119 /* For now just a flag for sculpt mode, eventually we make the other modes local too */
123 struct Material **mat; /* material slots */
124 char *matbits; /* 1 if material linked to object */
125 int totcol; /* copy of mesh or curve or meta */
126 int actcol; /* currently selected material in the UI */
128 /* rot en drot have to be together! (transform('r' en 's')) */
129 float loc[3], dloc[3], orig[3];
130 float size[3], dsize[3];
131 float rot[3], drot[3];
132 /* float quat[4], dquat[4]; (not used yet) */
134 float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */
135 float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */
136 float imat[4][4]; /* for during render, old game engine, temporally: ipokeys of transform */
138 unsigned int lay; /* copy of Base */
140 short flag; /* copy of Base */
141 short colbits; /* deprecated */
143 short transflag, protectflag; /* transformation settings and transform locks */
144 short trackflag, upflag;
145 short nlaflag, ipoflag; // xxx depreceated... old animation system
146 short ipowin, scaflag; /* ipowin: blocktype last ipowindow */
147 short scavisflag, boundtype;
149 int dupon, dupoff, dupsta, dupend;
151 float sf, ctime; /* sf is time-offset, ctime is the objects current time (XXX timing needs to be revised) */
153 /* during realtime */
155 /* note that inertia is only called inertia for historical reasons
156 * and is not changed to avoid DNA surgery. It actually reflects the
157 * Size value in the GameButtons (= radius) */
159 float mass, damping, inertia;
160 /* The form factor k is introduced to give the user more control
161 * and to fix incompatibility problems.
162 * For rotational symmetric objects, the inertia value can be
163 * expressed as: Theta = k * m * r^2
164 * where m = Mass, r = Radius
165 * For a Sphere, the form factor is by default = 0.4
169 float rdamping, sizefac;
171 float max_vel; /* clamp the maximum velocity 0.0 is disabled */
172 float min_vel; /* clamp the maximum velocity 0.0 is disabled */
173 float m_contactProcessingThreshold;
176 char empty_drawtype, pad1[5];
177 float empty_drawsize;
178 float dupfacesca; /* dupliface scale */
182 ListBase controllers;
186 short index; /* custom index, for renderpasses */
187 unsigned short actdef; /* current deformation group */
188 float col[4]; /* object color, adjusted via IPO's only */
190 * Settings for game objects
191 * bit 0: Object has dynamic behaviour
192 * bit 2: Object is evaluated by the gameengine
193 * bit 6: Use Fh settings in Materials
194 * bit 7: Use face normal to rotate Object
195 * bit 8: Friction is anisotropic
196 * bit 9: Object is a ghost
197 * bit 10: Do rigid body dynamics.
198 * bit 11: Use bounding object for physics
203 * bit 15: Always ignore activity culling
206 struct BulletSoftBody *bsoft; /* settings for game engine bullet soft body */
208 short softflag; /* softbody settings */
209 short recalc; /* dependency flag */
210 float anisotropicFriction[3];
212 ListBase constraints;
213 ListBase nlastrips; // XXX depreceated... old animation system
215 ListBase particlesystem; /* particle systems */
217 struct PartDeflect *pd; /* particle deflector/attractor/collision data */
218 struct SoftBody *soft; /* if exists, saved in file */
219 struct Group *dup_group; /* object duplicator for group */
221 short fluidsimFlag; /* NT toggle fluidsim participation on/off */
223 short restrictflag; /* for restricting view, select, render etc. accessible in outliner */
225 short shapenr, shapeflag; /* current shape key for menu or pinned, flag for pinning */
226 float smoothresh; /* smoothresh is phong interpolation ray_shadow correction in render */
227 short recalco; /* recalco for temp storage of ob->recalc, bad design warning */
228 short body_type; /* for now used to temporarily holds the type of collision object */
230 struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
232 struct DerivedMesh *derivedDeform, *derivedFinal;
233 int lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
234 unsigned int state; /* bit masks of game controllers that are active */
235 unsigned int init_state; /* bit masks of initial state as recorded by the users */
237 int restore_mode; /* Keep track of what mode to return to after edit mode exits */
239 ListBase gpulamp; /* runtime, for lamps only */
242 /* Warning, this is not used anymore because hooks are now modifiers */
243 typedef struct ObHook {
244 struct ObHook *next, *prev;
246 struct Object *parent;
247 float parentinv[4][4]; /* matrix making current transform unmodified */
248 float mat[4][4]; /* temp matrix while hooking */
249 float cent[3]; /* visualization of hook */
250 float falloff; /* if not zero, falloff is distance where influence zero */
255 int totindex, curindex; /* curindex is cache for fast lookup */
256 short type, active; /* active is only first hook, for button menu */
261 /* this work object is defined in object.c */
262 extern Object workob;
265 /* **************** OBJECT ********************* */
267 /* used many places... should be specialized */
282 #define OB_LATTICE 22
284 /* 23 and 24 are for life and sector (old file compat.) */
285 #define OB_ARMATURE 25
287 /* partype: first 4 bits: type */
299 /* (short) transflag */
300 #define OB_OFFS_LOCAL 1
302 #define OB_NEG_SCALE 4
303 #define OB_DUPLI (8+16+256+512+2048)
304 #define OB_DUPLIFRAMES 8
305 #define OB_DUPLIVERTS 16
306 #define OB_DUPLIROT 32
307 #define OB_DUPLINOSPEED 64
308 #define OB_POWERTRACK 128
309 #define OB_DUPLIGROUP 256
310 #define OB_DUPLIFACES 512
311 #define OB_DUPLIFACES_SCALE 1024
312 #define OB_DUPLIPARTS 2048
313 #define OB_RENDER_DUPLI 4096
315 /* (short) ipoflag */
316 // XXX depreceated - old animation system crap
318 #define OB_DRAWKEYSEL 2
320 #define OB_OFFS_MAT 8
321 #define OB_OFFS_VKEY 16
322 #define OB_OFFS_PATH 32
323 #define OB_OFFS_PARENT 64
324 #define OB_OFFS_PARTICLE 128
325 /* get ipo from from action or not? */
326 #define OB_ACTION_OB 256
327 #define OB_ACTION_KEY 512
328 /* for stride edit */
329 #define OB_DISABLE_PATH 1024
331 #define OB_OFFS_PARENTADD 2048
334 /* (short) trackflag / upflag */
342 /* gameflag in game.h */
345 #define OB_BOUNDBOX 1
351 /* dtx: flags, char! */
353 #define OB_TEXSPACE 4
354 #define OB_DRAWNAME 8
355 #define OB_DRAWIMAGE 16
356 /* for solid+wire display */
357 #define OB_DRAWWIRE 32
359 #define OB_DRAWXRAY 64
360 /* enable transparent draw */
361 #define OB_DRAWTRANSP 128
363 /* empty_drawtype: no flags */
365 #define OB_PLAINAXES 2
367 #define OB_SINGLE_ARROW 4
369 #define OB_EMPTY_SPHERE 6
370 #define OB_EMPTY_CONE 7
373 #define OB_BOUND_BOX 0
374 #define OB_BOUND_SPHERE 1
375 #define OB_BOUND_CYLINDER 2
376 #define OB_BOUND_CONE 3
377 #define OB_BOUND_POLYH 4
378 #define OB_BOUND_POLYT 5
379 #define OB_BOUND_DYN_MESH 6
382 /* **************** BASE ********************* */
384 /* also needed for base!!!!! or rather, thy interfere....*/
385 /* base->flag and ob->flag */
387 #define BA_HAS_RECALC_OB 4
388 #define BA_HAS_RECALC_DATA 8
392 #define BA_FROMSET 128
394 #define BA_TRANSFORM_CHILD 256 /* child of a transformed object */
396 /* an initial attempt as making selection more specific! */
397 #define BA_DESELECT 0
401 #define OB_FROMDUPLI 512
403 #define OB_RADIO 2048
404 #define OB_FROMGROUP 4096
405 #define OB_POSEMODE 8192
407 /* ob->recalc (flag bits!) */
408 #define OB_RECALC_OB 1
409 #define OB_RECALC_DATA 2
410 /* time flag is set when time changes need recalc, so baked systems can ignore it */
411 #define OB_RECALC_TIME 4
419 #define OB_INERTIA_LOCK_X 8
420 #define OB_INERTIA_LOCK_Y 16
421 #define OB_INERTIA_LOCK_Z 32
423 #define OB_ROT_FH 128
424 #define OB_ANISOTROPIC_FRICTION 256
426 #define OB_RIGID_BODY 1024
427 #define OB_BOUNDS 2048
429 #define OB_COLLISION_RESPONSE 4096
430 #define OB_SECTOR 8192
431 #define OB_PROP 16384
432 #define OB_MAINACTOR 32768
434 #define OB_COLLISION 65536
435 #define OB_SOFT_BODY 0x20000
436 #define OB_OCCLUDER 0x40000
437 #define OB_SENSOR 0x80000
440 #define OB_NEVER_DO_ACTIVITY_CULLING 1
441 #define OB_LOCK_RIGID_BODY_X_AXIS 4
442 #define OB_LOCK_RIGID_BODY_Y_AXIS 8
443 #define OB_LOCK_RIGID_BODY_Z_AXIS 16
444 #define OB_LOCK_RIGID_BODY_X_ROT_AXIS 32
445 #define OB_LOCK_RIGID_BODY_Y_ROT_AXIS 64
446 #define OB_LOCK_RIGID_BODY_Z_ROT_AXIS 128
448 #define OB_LIFE (OB_PROP|OB_DYNAMIC|OB_ACTOR|OB_MAINACTOR|OB_CHILD)
451 #define OB_BODY_TYPE_NO_COLLISION 0
452 #define OB_BODY_TYPE_STATIC 1
453 #define OB_BODY_TYPE_DYNAMIC 2
454 #define OB_BODY_TYPE_RIGID 3
455 #define OB_BODY_TYPE_SOFT 4
456 #define OB_BODY_TYPE_OCCLUDER 5
457 #define OB_BODY_TYPE_SENSOR 6
460 #define OB_VIS_SENS 1
461 #define OB_VIS_CONT 2
465 #define OB_SHOWSENS 64
466 #define OB_SHOWACT 128
467 #define OB_ADDSENS 256
468 #define OB_ADDCONT 512
469 #define OB_ADDACT 1024
470 #define OB_SHOWCONT 2048
471 #define OB_SETSTBIT 4096
472 #define OB_INITSTBIT 8192
473 #define OB_DEBUGSTATE 16384
475 /* ob->restrictflag */
476 #define OB_RESTRICT_VIEW 1
477 #define OB_RESTRICT_SELECT 2
478 #define OB_RESTRICT_RENDER 4
481 #define OB_SHAPE_LOCK 1
482 #define OB_SHAPE_TEMPLOCK 2
485 // XXX depreceated - old animation system
486 #define OB_NLA_OVERRIDE (1<<0)
487 #define OB_NLA_COLLAPSED (1<<1)
489 /* object-channel expanded status */
490 #define OB_ADS_COLLAPSED (1<<10)
491 /* object's ipo-block */
492 #define OB_ADS_SHOWIPO (1<<11)
493 /* object's constraint channels */
494 #define OB_ADS_SHOWCONS (1<<12)
495 /* object's material channels */
496 #define OB_ADS_SHOWMATS (1<<13)
497 /* object's marticle channels */
498 #define OB_ADS_SHOWPARTS (1<<14)
500 /* ob->protectflag */
501 #define OB_LOCK_LOCX 1
502 #define OB_LOCK_LOCY 2
503 #define OB_LOCK_LOCZ 4
504 #define OB_LOCK_LOC 7
505 #define OB_LOCK_ROTX 8
506 #define OB_LOCK_ROTY 16
507 #define OB_LOCK_ROTZ 32
508 #define OB_LOCK_ROT 56
509 #define OB_LOCK_SCALEX 64
510 #define OB_LOCK_SCALEY 128
511 #define OB_LOCK_SCALEZ 256
512 #define OB_LOCK_SCALE 448
515 #define OB_MODE_NONE 0
516 #define OB_MODE_SCULPT 1
518 /* ob->softflag in DNA_object_force.h */