Blender  V2.93
DNA_object_types.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
25 #pragma once
26 
27 #include "DNA_object_enums.h"
28 
29 #include "DNA_customdata_types.h"
30 #include "DNA_defs.h"
31 #include "DNA_lineart_types.h"
32 #include "DNA_listBase.h"
33 
34 #include "DNA_ID.h"
35 #include "DNA_action_types.h" /* bAnimVizSettings */
36 #include "DNA_customdata_types.h"
37 #include "DNA_defs.h"
38 #include "DNA_listBase.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 struct AnimData;
45 struct BoundBox;
46 struct Curve;
47 struct FluidsimSettings;
48 struct GeometrySet;
49 struct Ipo;
50 struct Material;
51 struct Mesh;
52 struct Object;
53 struct PartDeflect;
54 struct Path;
55 struct RigidBodyOb;
56 struct SculptSession;
57 struct SoftBody;
58 struct bGPdata;
59 
60 /* Vertex Groups - Name Info */
61 typedef struct bDeformGroup {
62  struct bDeformGroup *next, *prev;
64  char name[64];
65  /* need this flag for locking weights */
66  char flag, _pad0[7];
68 
69 /* Face Maps*/
70 typedef struct bFaceMap {
71  struct bFaceMap *next, *prev;
73  char name[64];
74  char flag;
75  char _pad0[7];
77 
78 #define MAX_VGROUP_NAME 64
79 
80 /* bDeformGroup->flag */
81 #define DG_LOCK_WEIGHT 1
82 
104 typedef struct BoundBox {
105  float vec[8][3];
106  int flag;
107  char _pad0[4];
109 
110 /* boundbox flag */
111 enum {
112  BOUNDBOX_DISABLED = (1 << 0),
113  BOUNDBOX_DIRTY = (1 << 1),
114 };
115 
116 struct CustomData_MeshMasks;
117 
118 /* Not saved in file! */
119 typedef struct Object_Runtime {
125 
128 
129  char _pad0[3];
130 
133 
139  char _pad1[3];
140 
146 
148  struct BoundBox *bb;
149 
155  struct ID *data_orig;
161  struct ID *data_eval;
162 
170 
176 
182 
188  struct bGPdata *gpd_orig;
193  struct bGPdata *gpd_eval;
194 
200 
206 
209 
210  unsigned short local_collections_bits;
211  short _pad2[3];
212  void *_pad3;
214 
215 typedef struct ObjectLineArt {
216  short usage;
217  short flags;
218 
222 
228  OBJECT_LRT_INCLUDE = (1 << 0),
230  OBJECT_LRT_EXCLUDE = (1 << 2),
233 };
234 
237 };
238 
239 typedef struct Object {
242  struct AnimData *adt;
244  struct DrawDataList drawdata;
245 
247 
248  short type, partype;
250  int par1, par2, par3;
252  char parsubstr[64];
253  struct Object *parent, *track;
254  /* if ob->proxy (or proxy_group), this object is proxy for object ob->proxy */
255  /* proxy_from is set in target back to the proxy. */
258  struct Ipo *ipo DNA_DEPRECATED;
259  /* struct Path *path; */
260  struct bAction *action DNA_DEPRECATED; /* XXX deprecated... old animation system */
261  struct bAction *poselib;
263  struct bPose *pose;
265  void *data;
266 
268  struct bGPdata *gpd
269  DNA_DEPRECATED; /* XXX deprecated... replaced by gpencil object, keep for readfile */
270 
275  void *_pad0;
276 
277  ListBase constraintChannels DNA_DEPRECATED; /* XXX deprecated... old animation system */
278  ListBase effect DNA_DEPRECATED; /* XXX deprecated... keep for readfile */
289 
291  int mode;
293 
294  /* materials */
296  struct Material **mat;
298  char *matbits;
300  int totcol;
302  int actcol;
303 
304  /* rot en drot have to be together! (transform('r' en 's')) */
305  float loc[3], dloc[3];
307  float scale[3];
309  float dsize[3] DNA_DEPRECATED;
311  float dscale[3];
313  float rot[3], drot[3];
315  float quat[4], dquat[4];
317  float rotAxis[3], drotAxis[3];
321  float obmat[4][4];
323  float parentinv[4][4];
326  float constinv[4][4];
334  float imat[4][4];
335 
336  /* Previously 'imat' was used at render time, but as other places use it too
337  * the interactive ui of 2.5 creates problems. So now only 'imat_ren' should
338  * be used when ever the inverse of ob->obmat * re->viewmat is needed! - jahka
339  */
340  float imat_ren[4][4];
341 
343  unsigned int lay DNA_DEPRECATED;
344 
346  short flag;
348  short colbits DNA_DEPRECATED;
349 
354  short nlaflag;
355 
356  char _pad1;
358 
359  /* Depsgraph */
361  short base_flag;
363  unsigned short base_local_view_bits;
364 
366  unsigned short col_group, col_mask;
367 
369  short rotmode;
370 
372  char boundtype;
375 
377  short dtx;
379  char dt;
384 
386  short index;
388  unsigned short actdef;
390  unsigned short actfmap;
391  char _pad2[2];
393  float color[4];
394 
396  short softflag;
397 
400 
402  char shapeflag;
404  short shapenr;
405 
406  char _pad3[2];
407 
410  ListBase nlastrips DNA_DEPRECATED; /* XXX deprecated... old animation system */
411  ListBase hooks DNA_DEPRECATED; /* XXX deprecated... old animation system */
414 
416  struct PartDeflect *pd;
418  struct SoftBody *soft;
421 
423  struct FluidsimSettings *fluidsimSettings
424  DNA_DEPRECATED; /* XXX deprecated... replaced by mantaflow, keep for readfile */
425 
427 
432 
434  float ima_ofs[2];
440  char _pad8[5];
441 
443 
445 
447  void *_pad9;
450 
451 /* Warning, this is not used anymore because hooks are now modifiers */
452 typedef struct ObHook {
453  struct ObHook *next, *prev;
454 
455  struct Object *parent;
457  float parentinv[4][4];
459  float mat[4][4];
461  float cent[3];
463  float falloff;
464 
466  char name[64];
467 
468  int *indexar;
472  short type, active;
473  float force;
475 
476 /* **************** OBJECT ********************* */
477 
478 /* used many places... should be specialized */
479 #define SELECT 1
480 
481 #define OBJECT_ACTIVE_MODIFIER_NONE -1
482 
483 /* type */
484 enum {
485  OB_EMPTY = 0,
486  OB_MESH = 1,
487  OB_CURVE = 2,
488  OB_SURF = 3,
489  OB_FONT = 4,
490  OB_MBALL = 5,
491 
492  OB_LAMP = 10,
493  OB_CAMERA = 11,
494 
497 
499 
501 
504 
505  OB_HAIR = 27,
506 
508 
509  OB_VOLUME = 29,
510 
511  /* Keep last. */
513 };
514 
515 /* check if the object type supports materials */
516 #define OB_TYPE_SUPPORT_MATERIAL(_type) \
517  (((_type) >= OB_MESH && (_type) <= OB_MBALL) || ((_type) >= OB_GPENCIL && (_type) <= OB_VOLUME))
518 #define OB_TYPE_SUPPORT_VGROUP(_type) (ELEM(_type, OB_MESH, OB_LATTICE, OB_GPENCIL))
519 #define OB_TYPE_SUPPORT_EDITMODE(_type) \
520  (ELEM(_type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
521 #define OB_TYPE_SUPPORT_PARVERT(_type) (ELEM(_type, OB_MESH, OB_SURF, OB_CURVE, OB_LATTICE))
522 
524 #define OB_DATA_SUPPORT_EDITMODE(_type) (ELEM(_type, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR))
525 
526 /* is this ID type used as object data */
527 #define OB_DATA_SUPPORT_ID(_id_type) \
528  (ELEM(_id_type, \
529  ID_ME, \
530  ID_CU, \
531  ID_MB, \
532  ID_LA, \
533  ID_SPK, \
534  ID_LP, \
535  ID_CA, \
536  ID_LT, \
537  ID_GD, \
538  ID_AR, \
539  ID_HA, \
540  ID_PT, \
541  ID_VO))
542 
543 #define OB_DATA_SUPPORT_ID_CASE \
544  ID_ME: \
545  case ID_CU: \
546  case ID_MB: \
547  case ID_LA: \
548  case ID_SPK: \
549  case ID_LP: \
550  case ID_CA: \
551  case ID_LT: \
552  case ID_GD: \
553  case ID_AR: \
554  case ID_HA: \
555  case ID_PT: \
556  case ID_VO
557 
558 /* partype: first 4 bits: type */
559 enum {
560  PARTYPE = (1 << 4) - 1,
562  PARSKEL = 4,
563  PARVERT1 = 5,
564  PARVERT3 = 6,
565  PARBONE = 7,
566 
567 };
568 
569 /* (short) transflag */
570 enum {
572  OB_TRANSFLAG_UNUSED_1 = 1 << 1, /* cleared */
573  OB_NEG_SCALE = 1 << 2,
574  OB_TRANSFLAG_UNUSED_3 = 1 << 3, /* cleared */
575  OB_DUPLIVERTS = 1 << 4,
576  OB_DUPLIROT = 1 << 5,
577  OB_TRANSFLAG_UNUSED_6 = 1 << 6, /* cleared */
578  /* runtime, calculate derivedmesh for dupli before it's used */
579  OB_TRANSFLAG_UNUSED_7 = 1 << 7, /* dirty */
581  OB_DUPLIFACES = 1 << 9,
583  OB_DUPLIPARTS = 1 << 11,
584  OB_TRANSFLAG_UNUSED_12 = 1 << 12, /* cleared */
585  /* runtime constraints disable */
586  OB_NO_CONSTRAINTS = 1 << 13,
587 
589 };
590 
591 /* (short) trackflag / upflag */
592 enum {
593  OB_POSX = 0,
594  OB_POSY = 1,
595  OB_POSZ = 2,
596  OB_NEGX = 3,
597  OB_NEGY = 4,
598  OB_NEGZ = 5,
599 };
600 
601 /* dtx: flags (short) */
602 enum {
603  OB_DRAWBOUNDOX = 1 << 0,
604  OB_AXIS = 1 << 1,
605  OB_TEXSPACE = 1 << 2,
606  OB_DRAWNAME = 1 << 3,
607  /* OB_DRAWIMAGE = 1 << 4, */ /* UNUSED */
608  /* for solid+wire display */
609  OB_DRAWWIRE = 1 << 5,
610  /* for overdraw s*/
612  /* enable transparent draw */
613  OB_DRAWTRANSP = 1 << 7,
614  OB_DRAW_ALL_EDGES = 1 << 8, /* only for meshes currently */
616  /* Enable lights for grease pencil. */
618 };
619 
620 /* empty_drawtype: no flags */
621 enum {
626  OB_CUBE = 5,
630 };
631 
632 /* gpencil add types */
633 enum {
634  GP_EMPTY = 0,
640 };
641 
642 /* boundtype */
643 enum {
648  /* OB_BOUND_TRIANGLE_MESH = 4, */ /* UNUSED */
649  /* OB_BOUND_CONVEX_HULL = 5, */ /* UNUSED */
650  /* OB_BOUND_DYN_MESH = 6, */ /*UNUSED*/
652 };
653 
654 /* **************** BASE ********************* */
655 
656 /* base->flag_legacy */
657 enum {
658  BA_WAS_SEL = (1 << 1),
659  /* NOTE: BA_HAS_RECALC_DATA can be re-used later if freed in readfile.c. */
660  // BA_HAS_RECALC_OB = (1 << 2), /* DEPRECATED */
661  // BA_HAS_RECALC_DATA = (1 << 3), /* DEPRECATED */
664 };
665 
666 /* NOTE: this was used as a proper setting in past, so nullify before using */
667 #define BA_TEMP_TAG (1 << 5)
668 
673 #define BA_TRANSFORM_LOCKED_IN_PLACE (1 << 7)
674 
675 #define BA_TRANSFORM_CHILD (1 << 8) /* child of a transformed object */
676 #define BA_TRANSFORM_PARENT (1 << 13) /* parent of a transformed object */
677 
678 #define OB_FROMDUPLI (1 << 9)
679 #define OB_DONE (1 << 10) /* unknown state, clear before use */
680 #ifdef DNA_DEPRECATED_ALLOW
681 # define OB_FLAG_UNUSED_11 (1 << 11) /* cleared */
682 # define OB_FLAG_UNUSED_12 (1 << 12) /* cleared */
683 #endif
684 
685 /* ob->restrictflag */
686 enum {
690 };
691 
692 /* ob->shapeflag */
693 enum {
694  OB_SHAPE_LOCK = 1 << 0,
695 #ifdef DNA_DEPRECATED_ALLOW
696  OB_SHAPE_FLAG_UNUSED_1 = 1 << 1, /* cleared */
697 #endif
699 };
700 
701 /* ob->nlaflag */
702 enum {
703  OB_ADS_UNUSED_1 = 1 << 0, /* cleared */
704  OB_ADS_UNUSED_2 = 1 << 1, /* cleared */
705  /* object-channel expanded status */
706  OB_ADS_COLLAPSED = 1 << 10,
707  /* object's ipo-block */
708  /* OB_ADS_SHOWIPO = 1 << 11, */ /* UNUSED */
709  /* object's constraint channels */
710  /* OB_ADS_SHOWCONS = 1 << 12, */ /* UNUSED */
711  /* object's material channels */
712  /* OB_ADS_SHOWMATS = 1 << 13, */ /* UNUSED */
713  /* object's marticle channels */
714  /* OB_ADS_SHOWPARTS = 1 << 14, */ /* UNUSED */
715 };
716 
717 /* ob->protectflag */
718 enum {
719  OB_LOCK_LOCX = 1 << 0,
720  OB_LOCK_LOCY = 1 << 1,
721  OB_LOCK_LOCZ = 1 << 2,
723  OB_LOCK_ROTX = 1 << 3,
724  OB_LOCK_ROTY = 1 << 4,
725  OB_LOCK_ROTZ = 1 << 5,
727  OB_LOCK_SCALEX = 1 << 6,
728  OB_LOCK_SCALEY = 1 << 7,
729  OB_LOCK_SCALEZ = 1 << 8,
731  OB_LOCK_ROTW = 1 << 9,
732  OB_LOCK_ROT4D = 1 << 10,
733 };
734 
735 /* ob->duplicator_visibility_flag */
736 enum {
739 };
740 
741 /* ob->empty_image_depth */
742 #define OB_EMPTY_IMAGE_DEPTH_DEFAULT 0
743 #define OB_EMPTY_IMAGE_DEPTH_FRONT 1
744 #define OB_EMPTY_IMAGE_DEPTH_BACK 2
745 
747 enum {
753 };
754 
756 enum {
758 };
759 
760 #define MAX_DUPLI_RECUR 8
761 
762 #ifdef __cplusplus
763 }
764 #endif
ID and Library types, which are fundamental for sdna.
These structs are the foundation for all linked lists in the library system.
struct ObHook ObHook
@ OB_BOUND_CAPSULE
@ OB_BOUND_SPHERE
@ OB_BOUND_CONE
@ OB_BOUND_BOX
@ OB_BOUND_CYLINDER
struct ObjectLineArt ObjectLineArt
@ OB_ADS_COLLAPSED
@ OB_ADS_UNUSED_1
@ OB_ADS_UNUSED_2
@ OB_LOCK_ROTZ
@ OB_LOCK_ROT4D
@ OB_LOCK_ROT
@ OB_LOCK_SCALEZ
@ OB_LOCK_ROTX
@ OB_LOCK_SCALEX
@ OB_LOCK_ROTW
@ OB_LOCK_LOCY
@ OB_LOCK_LOCZ
@ OB_LOCK_ROTY
@ OB_LOCK_SCALEY
@ OB_LOCK_LOC
@ OB_LOCK_LOCX
@ OB_LOCK_SCALE
@ OB_DUPLIFACES
@ OB_TRANSFLAG_UNUSED_7
@ OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK
@ OB_DUPLI
@ OB_NO_CONSTRAINTS
@ OB_TRANSFLAG_UNUSED_1
@ OB_NEG_SCALE
@ OB_DUPLIPARTS
@ OB_DUPLIVERTS
@ OB_TRANSFLAG_UNUSED_12
@ OB_TRANSFLAG_UNUSED_6
@ OB_TRANSFLAG_UNUSED_3
@ OB_DUPLICOLLECTION
@ OB_DUPLIROT
@ OB_DUPLIFACES_SCALE
eObjectLineArt_Flags
@ OBJECT_LRT_OWN_CREASE
@ OB_DRAWNAME
@ OB_DRAWBOUNDOX
@ OB_DRAW_ALL_EDGES
@ OB_AXIS
@ OB_USE_GPENCIL_LIGHTS
@ OB_DRAW_NO_SHADOW_CAST
@ OB_DRAW_IN_FRONT
@ OB_TEXSPACE
@ OB_DRAWWIRE
@ OB_DRAWTRANSP
struct bDeformGroup bDeformGroup
struct BoundBox BoundBox
@ OB_EMPTY_CONE
@ OB_SINGLE_ARROW
@ OB_PLAINAXES
@ OB_ARROWS
@ OB_CIRCLE
@ OB_CUBE
@ OB_EMPTY_IMAGE
@ OB_EMPTY_SPHERE
struct bFaceMap bFaceMap
@ BOUNDBOX_DIRTY
@ BOUNDBOX_DISABLED
struct Object Object
@ PARVERT1
@ PARSKEL
@ PAROBJECT
@ PARTYPE
@ PARVERT3
@ PARBONE
@ GP_STROKE
@ GP_MONKEY
@ GP_EMPTY
@ GP_LRT_OBJECT
@ GP_LRT_COLLECTION
@ GP_LRT_SCENE
@ OB_SHAPE_EDIT_MODE
@ OB_SHAPE_LOCK
eObjectLineArt_Usage
@ OBJECT_LRT_INCLUDE
@ OBJECT_LRT_NO_INTERSECTION
@ OBJECT_LRT_EXCLUDE
@ OBJECT_LRT_INHERIT
@ OBJECT_LRT_OCCLUSION_ONLY
@ OBJECT_LRT_INTERSECTION_ONLY
@ OB_POSX
@ OB_NEGZ
@ OB_POSY
@ OB_NEGX
@ OB_POSZ
@ OB_NEGY
@ OB_EMPTY_IMAGE_USE_ALPHA_BLEND
@ OB_SPEAKER
@ OB_LATTICE
@ OB_MBALL
@ OB_EMPTY
@ OB_SURF
@ OB_CAMERA
@ OB_FONT
@ OB_TYPE_MAX
@ OB_ARMATURE
@ OB_LAMP
@ OB_MESH
@ OB_POINTCLOUD
@ OB_HAIR
@ OB_VOLUME
@ OB_CURVE
@ OB_GPENCIL
@ OB_LIGHTPROBE
struct Object_Runtime Object_Runtime
@ OB_RESTRICT_VIEWPORT
@ OB_RESTRICT_SELECT
@ OB_RESTRICT_RENDER
@ OB_DUPLI_FLAG_VIEWPORT
@ OB_DUPLI_FLAG_RENDER
@ BA_WAS_SEL
@ BA_SNAP_FIX_DEPS_FIASCO
@ OB_EMPTY_IMAGE_HIDE_FRONT
@ OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED
@ OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC
@ OB_EMPTY_IMAGE_HIDE_BACK
@ OB_EMPTY_IMAGE_HIDE_PERSPECTIVE
float vec[8][3]
char _pad0[4]
Definition: DNA_ID.h:273
struct Object * parent
struct ObHook * prev
char name[64]
float mat[4][4]
float cent[3]
short active
struct ObHook * next
int * indexar
float falloff
float parentinv[4][4]
struct bGPdata * gpd_orig
struct CurveCache * curve_cache
CustomData_MeshMasks last_data_mask
unsigned short local_collections_bits
float parent_display_origin[3]
struct Mesh * mesh_deform_eval
struct ID * data_eval
struct bGPdata * gpd_eval
void * geometry_set_previews
struct Curve * object_as_temp_curve
struct GeometrySet * geometry_set_eval
struct ID * data_orig
struct BoundBox * bb
struct Mesh * object_as_temp_mesh
struct Object * proxy_group
int restore_mode
struct bAction * poselib
short partype
ListBase particlesystem
struct Object * track
short transflag
ListBase defbase
float imat_ren[4][4]
unsigned short col_group
ListBase constraints
struct Collection * instance_collection
char collision_boundtype
short base_flag
struct bPose * pose
float drot[3]
ListBase modifiers
float dquat[4]
float dsize[3] DNA_DEPRECATED
unsigned int lay DNA_DEPRECATED
struct Object * proxy_from
struct RigidBodyOb * rigidbody_object
ListBase hooks DNA_DEPRECATED
char boundtype
struct bGPdata *gpd DNA_DEPRECATED
float constinv[4][4]
ListBase greasepencil_modifiers
struct PreviewImage * preview
struct Material ** mat
struct Object * proxy
float loc[3]
char * matbits
struct PartDeflect * pd
float dloc[3]
unsigned short actfmap
float scale[3]
float imat[4][4]
struct SoftBody * soft
short nlaflag
float rot[3]
short shapenr
void * _pad0
float parentinv[4][4]
char empty_drawtype
char _pad3[2]
short colbits DNA_DEPRECATED
struct bAction *action DNA_DEPRECATED
unsigned short actdef
struct Ipo *ipo DNA_DEPRECATED
ListBase shader_fx
Object_Runtime runtime
ImageUser * iuser
unsigned short col_mask
char empty_image_flag
struct FluidsimSettings *fluidsimSettings DNA_DEPRECATED
ObjectLineArt lineart
float drotAxis[3]
float empty_drawsize
bMotionPath * mpath
float obmat[4][4]
short softflag
float quat[4]
ListBase effect DNA_DEPRECATED
short rotmode
float rotAngle
char _pad8[5]
ListBase pc_ids
float rotAxis[3]
float drotAngle
float color[4]
struct AnimData * adt
float dscale[3]
float instance_faces_scale
short protectflag
char empty_image_depth
struct DrawDataList drawdata
struct Object * parent
short trackflag
char duplicator_visibility_flag
unsigned short base_local_view_bits
struct SculptSession * sculpt
void * _pad9
struct RigidBodyCon * rigidbody_constraint
ListBase nlastrips DNA_DEPRECATED
char _pad2[2]
short upflag
void * data
char shapeflag
ListBase constraintChannels DNA_DEPRECATED
ListBase fmaps
char parsubstr[64]
char empty_image_visibility_flag
char restrictflag
bAnimVizSettings avs
float ima_ofs[2]
struct bDeformGroup * next
struct bDeformGroup * prev
struct bFaceMap * next
char _pad0[7]
struct bFaceMap * prev
char name[64]