Blender  V2.59
DNA_object_types.h
Go to the documentation of this file.
00001 /*
00002  * $Id: DNA_object_types.h 37505 2011-06-15 10:19:35Z blendix $ 
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 #ifndef DNA_OBJECT_TYPES_H
00030 #define DNA_OBJECT_TYPES_H
00031 
00037 #include "DNA_listBase.h"
00038 #include "DNA_ID.h"
00039 #include "DNA_action_types.h" /* bAnimVizSettings */
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044         
00045 struct Object;
00046 struct AnimData;
00047 struct Ipo;
00048 struct BoundBox;
00049 struct Path;
00050 struct Material;
00051 struct bConstraintChannel;
00052 struct PartDeflect;
00053 struct SoftBody;
00054 struct FluidsimSettings;
00055 struct ParticleSystem;
00056 struct DerivedMesh;
00057 struct SculptSession;
00058 struct bGPdata;
00059 
00060 
00061 /* Vertex Groups - Name Info */
00062 typedef struct bDeformGroup {
00063         struct bDeformGroup *next, *prev;
00064         char name[32];
00065 } bDeformGroup;
00066 #define MAX_VGROUP_NAME 32
00067 
00089 typedef struct BoundBox {
00090         float vec[8][3];
00091         int flag, pad;
00092 } BoundBox;
00093 
00094 /* boundbox flag */
00095 #define OB_BB_DISABLED  1
00096 
00097 typedef struct Object {
00098         ID id;
00099         struct AnimData *adt;           /* animation data (must be immediately after id for utilities to use it) */ 
00100 
00101         struct SculptSession *sculpt;
00102         
00103         short type, partype;
00104         int par1, par2, par3;   /* can be vertexnrs */
00105         char parsubstr[32];     /* String describing subobject info */
00106         struct Object *parent, *track;
00107         /* if ob->proxy (or proxy_group), this object is proxy for object ob->proxy */
00108         /* proxy_from is set in target back to the proxy. */
00109         struct Object *proxy, *proxy_group, *proxy_from;
00110         struct Ipo *ipo;                // XXX depreceated... old animation system
00111         struct Path *path;
00112         struct BoundBox *bb;
00113         struct bAction *action;  // XXX depreceated... old animation system
00114         struct bAction *poselib;
00115         struct bPose *pose;     
00116         void *data;
00117         
00118         struct bGPdata *gpd;    /* Grease Pencil data */
00119         
00120         bAnimVizSettings avs;   /* settings for visualisation of object-transform animation */
00121         bMotionPath *mpath;             /* motion path cache for this object */
00122         
00123         ListBase constraintChannels; // XXX depreceated... old animation system
00124         ListBase effect;
00125         ListBase disp;
00126         ListBase defbase;
00127         ListBase modifiers; /* list of ModifierData structures */
00128 
00129         int mode;           /* Local object mode */
00130         int restore_mode;   /* Keep track of what mode to return to after toggling a mode */
00131 
00132         /* materials */
00133         struct Material **mat;  /* material slots */
00134         char *matbits;                  /* 1 if material linked to object */
00135         int totcol;                             /* copy of mesh or curve or meta */
00136         int actcol;                             /* currently selected material in the UI */
00137         
00138         /* rot en drot have to be together! (transform('r' en 's')) */
00139         float loc[3], dloc[3], orig[3];
00140         float size[3], dsize[3];        /* scale and delta scale */
00141         float rot[3], drot[3];          /* euler rotation */
00142         float quat[4], dquat[4];        /* quaternion rotation */
00143         float rotAxis[3], drotAxis[3];  /* axis angle rotation - axis part */
00144         float rotAngle, drotAngle;      /* axis angle rotation - angle part */
00145         float obmat[4][4];              /* final worldspace matrix with constraints & animsys applied */
00146         float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */
00147         float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */
00148         float imat[4][4];       /* inverse matrix of 'obmat' for any other use than rendering! */
00149         
00150         /* Previously 'imat' was used at render time, but as other places use it too
00151          * the interactive ui of 2.5 creates problems. So now only 'imat_ren' should
00152          * be used when ever the inverse of ob->obmat * re->viewmat is needed! - jahka
00153          */
00154         float imat_ren[4][4];
00155         
00156         unsigned int lay;                               /* copy of Base */
00157         
00158         short flag;                     /* copy of Base */
00159         short colbits;          /* deprecated */
00160         
00161         short transflag, protectflag;   /* transformation settings and transform locks  */
00162         short trackflag, upflag;
00163         short nlaflag, ipoflag;         // xxx depreceated... old animation system
00164         short ipowin, scaflag;          /* ipowin: blocktype last ipowindow */
00165         short scavisflag, boundtype;
00166         
00167         int dupon, dupoff, dupsta, dupend;
00168 
00169         float sf, ctime; /* sf is time-offset, ctime is the objects current time (XXX timing needs to be revised) */
00170         
00171         /* during realtime */
00172 
00173         /* note that inertia is only called inertia for historical reasons
00174          * and is not changed to avoid DNA surgery. It actually reflects the 
00175          * Size value in the GameButtons (= radius) */
00176 
00177         float mass, damping, inertia;
00178         /* The form factor k is introduced to give the user more control
00179          * and to fix incompatibility problems.
00180          * For rotational symmetric objects, the inertia value can be
00181          * expressed as: Theta = k * m * r^2
00182          * where m = Mass, r = Radius
00183          * For a Sphere, the form factor is by default = 0.4
00184          */
00185 
00186         float formfactor;
00187         float rdamping, sizefac;
00188         float margin;
00189         float max_vel; /* clamp the maximum velocity 0.0 is disabled */
00190         float min_vel; /* clamp the maximum velocity 0.0 is disabled */
00191         float m_contactProcessingThreshold;
00192         
00193         short rotmode;          /* rotation mode - uses defines set out in DNA_action_types.h for PoseChannel rotations... */
00194         
00195         char dt, dtx;
00196         char empty_drawtype, pad1[3];
00197         float empty_drawsize;
00198         float dupfacesca;       /* dupliface scale */
00199         
00200         ListBase prop;
00201         ListBase sensors;
00202         ListBase controllers;
00203         ListBase actuators;
00204     
00205         float bbsize[3];
00206         short index;                    /* custom index, for renderpasses */
00207         unsigned short actdef;  /* current deformation group, note: index starts at 1 */
00208         float col[4];                   /* object color */
00220         int gameflag;
00225         int gameflag2;
00226         struct BulletSoftBody *bsoft;   /* settings for game engine bullet soft body */
00227 
00228         short softflag;                 /* softbody settings */
00229         short recalc;                   /* dependency flag */
00230         float anisotropicFriction[3];
00231 
00232         ListBase constraints;           /* object constraints */
00233         ListBase nlastrips;                     // XXX depreceated... old animation system
00234         ListBase hooks;
00235         ListBase particlesystem;        /* particle systems */
00236         
00237         struct PartDeflect *pd;         /* particle deflector/attractor/collision data */
00238         struct SoftBody *soft;          /* if exists, saved in file */
00239         struct Group *dup_group;        /* object duplicator for group */
00240         
00241         short fluidsimFlag;                     /* NT toggle fluidsim participation on/off */
00242         
00243         short restrictflag;                     /* for restricting view, select, render etc. accessible in outliner */
00244 
00245         short shapenr, shapeflag;       /* current shape key for menu or pinned, flag for pinning */
00246         float smoothresh;                       /* smoothresh is phong interpolation ray_shadow correction in render */
00247         short recalco;                          /* recalco for temp storage of ob->recalc, bad design warning */
00248         short body_type;                        /* for now used to temporarily holds the type of collision object */
00249         
00250         struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
00251 
00252         struct DerivedMesh *derivedDeform, *derivedFinal;
00253         unsigned int lastDataMask;   /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
00254         unsigned int customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
00255         unsigned int state;                     /* bit masks of game controllers that are active */
00256         unsigned int init_state;        /* bit masks of initial state as recorded by the users */
00257 
00258         ListBase gpulamp;               /* runtime, for lamps only */
00259         ListBase pc_ids;
00260         ListBase *duplilist;    /* for temporary dupli list storage, only for use by RNA API */
00261 
00262         float ima_ofs[2];               /* offset for image empties */
00263         char pad3[8];
00264 } Object;
00265 
00266 /* Warning, this is not used anymore because hooks are now modifiers */
00267 typedef struct ObHook {
00268         struct ObHook *next, *prev;
00269         
00270         struct Object *parent;
00271         float parentinv[4][4];  /* matrix making current transform unmodified */
00272         float mat[4][4];                /* temp matrix while hooking */
00273         float cent[3];                  /* visualization of hook */
00274         float falloff;                  /* if not zero, falloff is distance where influence zero */
00275         
00276         char name[32];
00277 
00278         int *indexar;
00279         int totindex, curindex; /* curindex is cache for fast lookup */
00280         short type, active;             /* active is only first hook, for button menu */
00281         float force;
00282 } ObHook;
00283 
00284 typedef struct DupliObject {
00285         struct DupliObject *next, *prev;
00286         struct Object *ob;
00287         unsigned int origlay;
00288         int index, no_draw, type, animated;
00289         float mat[4][4], omat[4][4];
00290         float orco[3], uv[2];
00291 } DupliObject;
00292 
00293 /* **************** OBJECT ********************* */
00294 
00295 /* used many places... should be specialized  */
00296 #define SELECT                  1
00297 
00298 /* type */
00299 #define OB_EMPTY                0
00300 #define OB_MESH                 1
00301 #define OB_CURVE                2
00302 #define OB_SURF                 3
00303 #define OB_FONT                 4
00304 #define OB_MBALL                5
00305 
00306 #define OB_LAMP                 10
00307 #define OB_CAMERA               11
00308 
00309 // #define OB_WAVE                      21
00310 #define OB_LATTICE              22
00311 
00312 /* 23 and 24 are for life and sector (old file compat.) */
00313 #define OB_ARMATURE             25
00314 
00315 /* partype: first 4 bits: type */
00316 #define PARTYPE                 15
00317 #define PAROBJECT               0
00318 #define PARCURVE                1
00319 #define PARKEY                  2
00320 
00321 #define PARSKEL                 4
00322 #define PARVERT1                5
00323 #define PARVERT3                6
00324 #define PARBONE                 7
00325 #define PARSLOW                 16
00326 
00327 /* (short) transflag */
00328 /*#define OB_OFFS_LOCAL         1*/ /*UNUSED*/
00329 /* #define OB_QUAT                              2 */ /* never used, free flag */
00330 #define OB_NEG_SCALE            4
00331 #define OB_DUPLI                        (8+16+256+512+2048)
00332 #define OB_DUPLIFRAMES          8
00333 #define OB_DUPLIVERTS           16
00334 #define OB_DUPLIROT                     32
00335 #define OB_DUPLINOSPEED         64
00336 /*#define OB_POWERTRACK         128*/ /*UNUSED*/
00337 #define OB_DUPLIGROUP           256
00338 #define OB_DUPLIFACES           512
00339 #define OB_DUPLIFACES_SCALE     1024
00340 #define OB_DUPLIPARTS           2048
00341 #define OB_RENDER_DUPLI         4096
00342 #define OB_NO_CONSTRAINTS       8192 /* runtime constraints disable */
00343 
00344 /* (short) ipoflag */
00345         // XXX depreceated - old animation system crap
00346 #define OB_DRAWKEY                      1
00347 #define OB_DRAWKEYSEL           2
00348 #define OB_OFFS_OB                      4
00349 /* #define OB_OFFS_MAT          8 */ /*UNUSED*/
00350 /* #define OB_OFFS_VKEY         16 */ /*UNUSED*/
00351 /* #define OB_OFFS_PATH         32 */ /*UNUSED*/
00352 #define OB_OFFS_PARENT          64
00353 #define OB_OFFS_PARTICLE        128
00354         /* get ipo from from action or not? */
00355 #define OB_ACTION_OB            256
00356 #define OB_ACTION_KEY           512
00357         /* for stride edit */
00358 #define OB_DISABLE_PATH         1024
00359 
00360 #define OB_OFFS_PARENTADD       2048
00361 
00362 
00363 /* (short) trackflag / upflag */
00364 #define OB_POSX                 0
00365 #define OB_POSY                 1
00366 #define OB_POSZ                 2
00367 #define OB_NEGX                 3
00368 #define OB_NEGY                 4
00369 #define OB_NEGZ                 5
00370 
00371 /* gameflag in game.h */
00372 
00373 /* dt: no flags */
00374 #define OB_BOUNDBOX             1
00375 #define OB_WIRE                 2
00376 #define OB_SOLID                3
00377 #define OB_SHADED               4
00378 #define OB_TEXTURE              5
00379 
00380 /* dtx: flags, char! */
00381 #define OB_AXIS                 2
00382 #define OB_TEXSPACE             4
00383 #define OB_DRAWNAME             8
00384 #define OB_DRAWIMAGE    16
00385         /* for solid+wire display */
00386 #define OB_DRAWWIRE             32
00387         /* for overdraw */
00388 #define OB_DRAWXRAY             64
00389         /* enable transparent draw */
00390 #define OB_DRAWTRANSP   128
00391 
00392 /* empty_drawtype: no flags */
00393 #define OB_ARROWS               1
00394 #define OB_PLAINAXES    2
00395 #define OB_CIRCLE               3
00396 #define OB_SINGLE_ARROW 4
00397 #define OB_CUBE                 5
00398 #define OB_EMPTY_SPHERE 6
00399 #define OB_EMPTY_CONE   7
00400 #define OB_EMPTY_IMAGE  8
00401 
00402 /* boundtype */
00403 #define OB_BOUND_BOX            0
00404 #define OB_BOUND_SPHERE         1
00405 #define OB_BOUND_CYLINDER       2
00406 #define OB_BOUND_CONE           3
00407 #define OB_BOUND_POLYH          4
00408 #define OB_BOUND_POLYT          5
00409 /* #define OB_BOUND_DYN_MESH   6 */ /*UNUSED*/
00410 #define OB_BOUND_CAPSULE        7
00411 
00412 
00413 /* **************** BASE ********************* */
00414 
00415 /* also needed for base!!!!! or rather, thy interfere....*/
00416 /* base->flag and ob->flag */
00417 #define BA_WAS_SEL                      2
00418 #define BA_HAS_RECALC_OB        4
00419 #define BA_HAS_RECALC_DATA      8
00420 
00421         /* NOTE: this was used as a proper setting in past, so nullify before using */
00422 #define BA_TEMP_TAG                     32
00423 
00424 /* #define BA_FROMSET                   128 */ /*UNUSED*/
00425 
00426 #define BA_TRANSFORM_CHILD      256 /* child of a transformed object */
00427 #define BA_TRANSFORM_PARENT     8192 /* parent of a transformed object */
00428 
00429 
00430 /* an initial attempt as making selection more specific! */
00431 #define BA_DESELECT             0
00432 #define BA_SELECT               1
00433 
00434 
00435 #define OB_FROMDUPLI            512
00436 #define OB_DONE                         1024
00437 // #define OB_RADIO                     2048    /* deprecated */
00438 #define OB_FROMGROUP            4096
00439 
00440 /* ob->recalc (flag bits!) */
00441 #define OB_RECALC_OB            1
00442 #define OB_RECALC_DATA          2
00443                 /* time flag is set when time changes need recalc, so baked systems can ignore it */
00444 #define OB_RECALC_TIME          4
00445                 /* only use for matching any flag, NOT as an argument since more flags may be added. */
00446 #define OB_RECALC_ALL           (OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME)
00447 
00448 /* controller state */
00449 #define OB_MAX_STATES           30
00450 
00451 /* ob->gameflag */
00452 #define OB_DYNAMIC              1
00453 #define OB_CHILD                2
00454 #define OB_ACTOR                4
00455 #define OB_INERTIA_LOCK_X       8
00456 #define OB_INERTIA_LOCK_Y       16
00457 #define OB_INERTIA_LOCK_Z       32
00458 #define OB_DO_FH                        64
00459 #define OB_ROT_FH                       128
00460 #define OB_ANISOTROPIC_FRICTION 256
00461 #define OB_GHOST                        512
00462 #define OB_RIGID_BODY           1024
00463 #define OB_BOUNDS               2048
00464 
00465 #define OB_COLLISION_RESPONSE   4096
00466 #define OB_SECTOR               8192
00467 #define OB_PROP                 16384
00468 #define OB_MAINACTOR    32768
00469 
00470 #define OB_COLLISION    65536
00471 #define OB_SOFT_BODY    0x20000
00472 #define OB_OCCLUDER             0x40000
00473 #define OB_SENSOR               0x80000
00474 
00475 /* ob->gameflag2 */
00476 #define OB_NEVER_DO_ACTIVITY_CULLING    1
00477 #define OB_LOCK_RIGID_BODY_X_AXIS       4
00478 #define OB_LOCK_RIGID_BODY_Y_AXIS       8
00479 #define OB_LOCK_RIGID_BODY_Z_AXIS       16
00480 #define OB_LOCK_RIGID_BODY_X_ROT_AXIS   32
00481 #define OB_LOCK_RIGID_BODY_Y_ROT_AXIS   64
00482 #define OB_LOCK_RIGID_BODY_Z_ROT_AXIS   128
00483 
00484 /* #define OB_LIFE                      (OB_PROP|OB_DYNAMIC|OB_ACTOR|OB_MAINACTOR|OB_CHILD) */
00485 
00486 /* ob->body_type */
00487 #define OB_BODY_TYPE_NO_COLLISION       0
00488 #define OB_BODY_TYPE_STATIC                     1
00489 #define OB_BODY_TYPE_DYNAMIC            2
00490 #define OB_BODY_TYPE_RIGID                      3
00491 #define OB_BODY_TYPE_SOFT                       4
00492 #define OB_BODY_TYPE_OCCLUDER           5
00493 #define OB_BODY_TYPE_SENSOR                     6
00494 
00495 /* ob->scavisflag */
00496 #define OB_VIS_SENS             1
00497 #define OB_VIS_CONT             2
00498 #define OB_VIS_ACT              4
00499 
00500 /* ob->scaflag */
00501 #define OB_SHOWSENS             64
00502 #define OB_SHOWACT              128
00503 #define OB_ADDSENS              256
00504 #define OB_ADDCONT              512
00505 #define OB_ADDACT               1024
00506 #define OB_SHOWCONT             2048
00507 #define OB_ALLSTATE             4096
00508 #define OB_INITSTBIT    8192
00509 #define OB_DEBUGSTATE   16384
00510 #define OB_SHOWSTATE    32768
00511 
00512 /* ob->restrictflag */
00513 #define OB_RESTRICT_VIEW        1
00514 #define OB_RESTRICT_SELECT      2
00515 #define OB_RESTRICT_RENDER      4
00516 
00517 /* ob->shapeflag */
00518 #define OB_SHAPE_LOCK           1
00519 #define OB_SHAPE_TEMPLOCK       2               // deprecated
00520 #define OB_SHAPE_EDIT_MODE      4
00521 
00522 /* ob->nlaflag */
00523         // XXX depreceated - old animation system
00524 #define OB_NLA_OVERRIDE         (1<<0)
00525 #define OB_NLA_COLLAPSED        (1<<1)
00526 
00527         /* object-channel expanded status */
00528 #define OB_ADS_COLLAPSED        (1<<10)
00529         /* object's ipo-block */
00530 #define OB_ADS_SHOWIPO          (1<<11)
00531         /* object's constraint channels */
00532 #define OB_ADS_SHOWCONS         (1<<12)
00533         /* object's material channels */
00534 #define OB_ADS_SHOWMATS         (1<<13)
00535         /* object's marticle channels */
00536 #define OB_ADS_SHOWPARTS        (1<<14)
00537 
00538 /* ob->protectflag */
00539 #define OB_LOCK_LOCX    1
00540 #define OB_LOCK_LOCY    2
00541 #define OB_LOCK_LOCZ    4
00542 #define OB_LOCK_LOC             7
00543 #define OB_LOCK_ROTX    8
00544 #define OB_LOCK_ROTY    16
00545 #define OB_LOCK_ROTZ    32
00546 #define OB_LOCK_ROT             56
00547 #define OB_LOCK_SCALEX  64
00548 #define OB_LOCK_SCALEY  128
00549 #define OB_LOCK_SCALEZ  256
00550 #define OB_LOCK_SCALE   448
00551 #define OB_LOCK_ROTW    512
00552 #define OB_LOCK_ROT4D   1024
00553 
00554 /* ob->mode */
00555 typedef enum ObjectMode {
00556         OB_MODE_OBJECT = 0,
00557         OB_MODE_EDIT = 1,
00558         OB_MODE_SCULPT = 2,
00559         OB_MODE_VERTEX_PAINT = 4,
00560         OB_MODE_WEIGHT_PAINT = 8,
00561         OB_MODE_TEXTURE_PAINT = 16,
00562         OB_MODE_PARTICLE_EDIT = 32,
00563         OB_MODE_POSE = 64
00564 } ObjectMode;
00565 
00566 /* any mode where the brush system is used */
00567 #define OB_MODE_ALL_PAINT (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)
00568 
00569 #define MAX_DUPLI_RECUR 8
00570 
00571 #ifdef __cplusplus
00572 }
00573 #endif
00574 
00575 #endif
00576