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