Blender V4.5
DNA_object_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9
10#pragma once
11
12#include "BLI_utildefines.h"
13
14#include "DNA_object_enums.h"
15
17#include "DNA_defs.h"
18#include "DNA_lineart_types.h"
19#include "DNA_listBase.h"
20
21#include "DNA_ID.h"
22#include "DNA_action_types.h" /* bAnimVizSettings */
24#include "DNA_defs.h"
25#include "DNA_listBase.h"
26
27#ifdef __cplusplus
29#endif
30
31#ifdef __cplusplus
32namespace blender::bke {
33struct ObjectRuntime;
34}
36#else
38#endif
39
40struct AnimData;
41struct BoundBox;
42struct Collection;
43struct Curve;
44struct FluidsimSettings;
45struct ImageUser;
46struct Ipo;
48struct Material;
49struct Object;
50struct PartDeflect;
51struct Path;
52struct RigidBodyOb;
53struct SculptSession;
54struct SoftBody;
55struct bGPdata;
56
58typedef struct bDeformGroup {
60 char name[/*MAX_VGROUP_NAME*/ 64];
61 /* need this flag for locking weights */
62 char flag, _pad0[7];
64
65#ifdef DNA_DEPRECATED_ALLOW
66typedef struct bFaceMap {
67 struct bFaceMap *next, *prev;
68 char name[/*MAX_VGROUP_NAME*/ 64];
69 char flag;
70 char _pad0[7];
71} bFaceMap;
72#endif
73
74#define MAX_VGROUP_NAME 64
75
77enum {
79};
80
102typedef struct BoundBox {
103 float vec[8][3];
105
106typedef struct ObjectLineArt {
107 short usage;
108 short flags;
109
112
114
115 char _pad[7];
117
131
136
137/* Evaluated light linking state needed for the render engines integration. */
138typedef struct LightLinkingRuntime {
139
140 /* For objects that emit light: a bitmask of light sets this emitter is part of for the light
141 * linking.
142 * A light set is a combination of emitters used by one or more receiver objects.
143 *
144 * If there is no light linking in the scene or if the emitter does not specify light linking all
145 * bits are set.
146 *
147 * NOTE: There can only be 64 light sets in a scene. */
149
150 /* For objects that emit light: a bitmask of light sets this emitter is part of for the shadow
151 * linking.
152 * A light set is a combination of emitters from which a blocked object does not cast a shadow.
153 *
154 * If there is no shadow linking in the scene or if the emitter does not specify shadow linking
155 * all bits are set.
156 *
157 * NOTE: There can only be 64 light sets in a scene. */
159
160 /* For receiver objects: the index of the light set from which this object receives light.
161 *
162 * If there is no light linking in the scene or the receiver is not linked to any light this is
163 * assigned zero. */
165
166 /* For blocker objects: the index of the light set from which this object casts shadow from.
167 *
168 * If there is no shadow in the scene or the blocker is not linked to any emitter this is
169 * assigned zero. */
171
172 uint8_t _pad[6];
174
175typedef struct LightLinking {
176 /* Collections which contains objects (possibly via nested collection indirection) which defines
177 * the light linking relation: such as whether objects are included or excluded from being lit by
178 * this emitter (receiver_collection), or whether they block light from this emitter
179 * (blocker_collection).
180 *
181 * If the collection is a null pointer then all objects from the current scene are receiving
182 * light from this emitter, and nothing is excluded from receiving the light and shadows.
183 *
184 * The emitter in this context is assumed to be either object of lamp type, or objects with
185 * surface which has emissive shader. */
188
191
192typedef struct Object {
193#ifdef __cplusplus
196 static constexpr ID_Type id_type = ID_OB;
197#endif
198
201 struct AnimData *adt;
202
204
205 short type; /* #ObjectType */
206 short partype;
210 char parsubstr[/*MAX_NAME*/ 64];
211 struct Object *parent, *track;
212 /* Proxy pointer are deprecated, only kept for conversion to liboverrides. */
213 struct Object *proxy DNA_DEPRECATED;
214 struct Object *proxy_group DNA_DEPRECATED;
215 struct Object *proxy_from DNA_DEPRECATED;
217 struct Ipo *ipo DNA_DEPRECATED;
218 // struct Path *path;
219 struct bAction *action DNA_DEPRECATED; /* XXX deprecated... old animation system */
220 struct bAction *poselib DNA_DEPRECATED; /* Pre-Blender 3.0 pose library, deprecated in 3.5. */
222 struct bPose *pose;
224 void *data;
225
227 struct bGPdata *gpd
228 DNA_DEPRECATED; /* XXX deprecated... replaced by gpencil object, keep for readfile */
229
234 void *_pad0;
235
236 ListBase constraintChannels DNA_DEPRECATED; /* XXX deprecated... old animation system */
237 ListBase effect DNA_DEPRECATED; /* XXX deprecated... keep for readfile */
238 ListBase defbase DNA_DEPRECATED; /* Only for versioning, moved to object data. */
239 ListBase fmaps DNA_DEPRECATED; /* For versioning, moved to generic attributes. */
246
248 int mode;
250
251 /* materials */
253 struct Material **mat;
255 char *matbits;
260
261 /* rot en drot have to be together! (transform('r' en 's')) */
262 float loc[3], dloc[3];
264 float scale[3];
266 float dsize[3] DNA_DEPRECATED;
268 float dscale[3];
270 float rot[3], drot[3];
272 float quat[4], dquat[4];
274 float rotAxis[3], drotAxis[3];
278 float parentinv[4][4];
281 float constinv[4][4];
282
284 unsigned int lay DNA_DEPRECATED;
285
287 short flag;
289 short colbits DNA_DEPRECATED;
290
295 short nlaflag;
296
297 char _pad1;
299
300 /* Depsgraph */
304 unsigned short base_local_view_bits;
305
307 unsigned short col_group, col_mask;
308
310 short rotmode;
311
316
318 short dtx;
320 char dt;
325
327 short index;
329 unsigned short actdef DNA_DEPRECATED;
331 char _pad2[4];
333 float color[4];
334
336 short softflag;
337
340
342 short shapenr;
345
346 char _pad3[1];
347
350 ListBase nlastrips DNA_DEPRECATED; /* XXX deprecated... old animation system */
351 ListBase hooks DNA_DEPRECATED; /* XXX deprecated... old animation system */
354
358 struct SoftBody *soft;
361
363 struct FluidsimSettings *fluidsimSettings
364 DNA_DEPRECATED; /* XXX deprecated... replaced by mantaflow, keep for readfile */
365
367
372
374 float ima_ofs[2];
380
383
387
389
391
394
397
400
402
403#ifdef __cplusplus
404 const blender::float4x4 &object_to_world() const;
405 const blender::float4x4 &world_to_object() const;
406#endif
408
410typedef struct ObHook {
411 struct ObHook *next, *prev;
412
413 struct Object *parent;
415 float parentinv[4][4];
417 float mat[4][4];
419 float cent[3];
421 float falloff;
422
423 char name[/*MAX_NAME*/ 64];
424
429 short type, active;
430 float force;
432
433/* **************** OBJECT ********************* */
434
442#define SELECT 1
443
445typedef enum ObjectType {
453
456
459
461
463
465
467
469
471
473
474 /* Keep last. */
477
478/* check if the object type supports materials */
479#define OB_TYPE_SUPPORT_MATERIAL(_type) \
480 (((_type) >= OB_MESH && (_type) <= OB_MBALL) || \
481 ((_type) >= OB_CURVES && (_type) <= OB_GREASE_PENCIL))
482
486#define OB_TYPE_IS_GEOMETRY(_type) \
487 (ELEM(_type, \
488 OB_MESH, \
489 OB_SURF, \
490 OB_FONT, \
491 OB_MBALL, \
492 OB_CURVES_LEGACY, \
493 OB_CURVES, \
494 OB_POINTCLOUD, \
495 OB_VOLUME, \
496 OB_GREASE_PENCIL))
497#define OB_TYPE_SUPPORT_VGROUP(_type) (ELEM(_type, OB_MESH, OB_LATTICE, OB_GREASE_PENCIL))
498#define OB_TYPE_SUPPORT_EDITMODE(_type) \
499 (ELEM(_type, \
500 OB_MESH, \
501 OB_FONT, \
502 OB_CURVES_LEGACY, \
503 OB_SURF, \
504 OB_MBALL, \
505 OB_LATTICE, \
506 OB_ARMATURE, \
507 OB_CURVES, \
508 OB_POINTCLOUD, \
509 OB_GREASE_PENCIL))
510#define OB_TYPE_SUPPORT_PARVERT(_type) \
511 (ELEM(_type, OB_MESH, OB_SURF, OB_CURVES_LEGACY, OB_LATTICE))
512
514#define OB_DATA_SUPPORT_EDITMODE(_type) \
515 (ELEM(_type, ID_ME, ID_CU_LEGACY, ID_MB, ID_LT, ID_AR, ID_CV, ID_GP))
516
517/* is this ID type used as object data */
518#define OB_DATA_SUPPORT_ID(_id_type) \
519 (ELEM(_id_type, \
520 ID_ME, \
521 ID_CU_LEGACY, \
522 ID_MB, \
523 ID_LA, \
524 ID_SPK, \
525 ID_LP, \
526 ID_CA, \
527 ID_LT, \
528 ID_GD_LEGACY, \
529 ID_AR, \
530 ID_CV, \
531 ID_PT, \
532 ID_VO, \
533 ID_GP))
534
535#define OB_DATA_SUPPORT_ID_CASE \
536 ID_ME: \
537 case ID_CU_LEGACY: \
538 case ID_MB: \
539 case ID_LA: \
540 case ID_SPK: \
541 case ID_LP: \
542 case ID_CA: \
543 case ID_LT: \
544 case ID_GD_LEGACY: \
545 case ID_AR: \
546 case ID_CV: \
547 case ID_PT: \
548 case ID_VO: \
549 case ID_GP
550
552enum {
553 PARTYPE = (1 << 4) - 1,
559
560};
561
563enum {
565 OB_TRANSFLAG_UNUSED_1 = 1 << 1, /* cleared */
566 OB_NEG_SCALE = 1 << 2,
567 OB_TRANSFLAG_UNUSED_3 = 1 << 3, /* cleared */
569 OB_DUPLIROT = 1 << 5,
570 OB_TRANSFLAG_UNUSED_6 = 1 << 6, /* cleared */
571 /* runtime, calculate derivedmesh for dupli before it's used */
572 OB_TRANSFLAG_UNUSED_7 = 1 << 7, /* dirty */
576 OB_DUPLIPARTS = 1 << 11,
577 OB_TRANSFLAG_UNUSED_12 = 1 << 12, /* cleared */
578 /* runtime constraints disable */
580 /* when calculating vertex parent position, ignore CD_ORIGINDEX layer */
582
584};
585
587enum {
594};
595
597enum {
599 OB_AXIS = 1 << 1,
600 OB_TEXSPACE = 1 << 2,
601 OB_DRAWNAME = 1 << 3,
602 /* OB_DRAWIMAGE = 1 << 4, */ /* UNUSED */
603 /* for solid+wire display */
604 OB_DRAWWIRE = 1 << 5,
605 /* For overdrawing. */
607 /* Enable transparent draw. */
609 OB_DRAW_ALL_EDGES = 1 << 8, /* only for meshes currently */
611 /* Enable lights for grease pencil. */
613};
614
616enum {
625};
626
631enum {
638};
639
641enum {
646 // OB_BOUND_TRIANGLE_MESH = 4, /* UNUSED */
647 // OB_BOUND_CONVEX_HULL = 5, /* UNUSED */
648 // OB_BOUND_DYN_MESH = 6, /* UNUSED */
650};
651
652/* **************** BASE ********************* */
653
655enum {
656 BA_WAS_SEL = (1 << 1),
657 /* NOTE: BA_HAS_RECALC_DATA can be re-used later if freed in `readfile.cc`. */
658 // BA_HAS_RECALC_OB = 1 << 2, /* DEPRECATED */
659 // BA_HAS_RECALC_DATA = 1 << 3, /* DEPRECATED */
662
664 BA_TEMP_TAG = 1 << 5,
670
675
676 OB_FROMDUPLI = 1 << 9,
678 OB_DONE = 1 << 10,
680#ifdef DNA_DEPRECATED_ALLOW
681 OB_FLAG_UNUSED_12 = 1 << 12, /* cleared */
682#endif
683};
684
686enum {
696 OB_HOLDOUT = 1 << 9,
701};
702
704enum {
706#ifdef DNA_DEPRECATED_ALLOW
707 OB_SHAPE_FLAG_UNUSED_1 = 1 << 1, /* cleared */
708#endif
710};
711
713enum {
714 OB_ADS_UNUSED_1 = 1 << 0, /* cleared */
715 OB_ADS_UNUSED_2 = 1 << 1, /* cleared */
716 /* object-channel expanded status */
718 /* object's ipo-block */
719 /* OB_ADS_SHOWIPO = 1 << 11, */ /* UNUSED */
720 /* object's constraint channels */
721 /* OB_ADS_SHOWCONS = 1 << 12, */ /* UNUSED */
722 /* object's material channels */
723 /* OB_ADS_SHOWMATS = 1 << 13, */ /* UNUSED */
724 /* object's particle channels */
725 /* OB_ADS_SHOWPARTS = 1 << 14, */ /* UNUSED */
726};
727
729enum {
730 OB_LOCK_LOCX = 1 << 0,
731 OB_LOCK_LOCY = 1 << 1,
732 OB_LOCK_LOCZ = 1 << 2,
734 OB_LOCK_ROTX = 1 << 3,
735 OB_LOCK_ROTY = 1 << 4,
736 OB_LOCK_ROTZ = 1 << 5,
742 OB_LOCK_ROTW = 1 << 9,
743 OB_LOCK_ROT4D = 1 << 10,
744};
745
747enum {
750};
751
753enum {
757};
758
760enum {
766};
767
769enum {
771};
772
#define ENUM_OPERATORS(_type, _max)
ID and Library types, which are fundamental for SDNA.
ID_Type
@ ID_OB
These structs are the foundation for all linked lists in the library system.
@ 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_PARENT_USE_FINAL_INDICES
@ OB_DUPLIPARTS
@ OB_DUPLIVERTS
@ OB_TRANSFLAG_UNUSED_12
@ OB_TRANSFLAG_UNUSED_6
@ OB_TRANSFLAG_UNUSED_3
@ OB_DUPLICOLLECTION
@ OB_DUPLIROT
@ OB_DUPLIFACES_SCALE
@ OB_EMPTY_CONE
@ OB_SINGLE_ARROW
@ OB_PLAINAXES
@ OB_ARROWS
@ OB_CIRCLE
@ OB_CUBE
@ OB_EMPTY_IMAGE
@ OB_EMPTY_SPHERE
@ OB_HIDE_TRANSMISSION
@ OB_HOLDOUT
@ OB_HIDE_PROBE_VOLUME
@ OB_HIDE_RENDER
@ OB_HIDE_CAMERA
@ OB_HIDE_PROBE_PLANAR
@ OB_HIDE_PROBE_CUBEMAP
@ OB_HIDE_SELECT
@ OB_HIDE_GLOSSY
@ OB_HIDE_SHADOW
@ OB_SHADOW_CATCHER
@ OB_HIDE_VIEWPORT
@ OB_HIDE_DIFFUSE
@ OB_HIDE_VOLUME_SCATTER
@ OB_POSX
@ OB_NEGZ
@ OB_POSY
@ OB_NEGX
@ OB_POSZ
@ OB_NEGY
@ 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
@ GREASE_PENCIL_LINEART_SCENE
@ GP_STROKE
@ GREASE_PENCIL_LINEART_COLLECTION
@ GREASE_PENCIL_LINEART_OBJECT
@ GP_MONKEY
@ GP_EMPTY
ObjectModifierFlag
@ OB_MODIFIER_FLAG_ADD_REST_POSITION
@ OB_SHAPE_EDIT_MODE
@ OB_SHAPE_LOCK
eObjectLineArt_Flags
@ OBJECT_LRT_OWN_INTERSECTION_PRIORITY
@ OBJECT_LRT_OWN_CREASE
@ OB_DUPLI_FLAG_VIEWPORT
@ OB_DUPLI_FLAG_RENDER
@ OB_SPEAKER
@ OB_LATTICE
@ OB_MBALL
@ OB_EMPTY
@ OB_SURF
@ OB_CAMERA
@ OB_FONT
@ OB_GREASE_PENCIL
@ OB_TYPE_MAX
@ OB_ARMATURE
@ OB_LAMP
@ OB_MESH
@ OB_POINTCLOUD
@ OB_VOLUME
@ OB_CURVES_LEGACY
@ OB_GPENCIL_LEGACY
@ OB_CURVES
@ OB_LIGHTPROBE
struct ObjectRuntimeHandle ObjectRuntimeHandle
@ 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
@ 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
struct Object Object
@ OB_BOUND_CAPSULE
@ OB_BOUND_SPHERE
@ OB_BOUND_CONE
@ OB_BOUND_BOX
@ OB_BOUND_CYLINDER
@ OB_EMPTY_IMAGE_USE_ALPHA_BLEND
@ PARVERT1
@ PARSKEL
@ PAROBJECT
@ PARTYPE
@ PARVERT3
@ PARBONE
eObjectLineArt_Usage
@ OBJECT_LRT_INCLUDE
@ OBJECT_LRT_NO_INTERSECTION
@ OBJECT_LRT_EXCLUDE
@ OBJECT_LRT_INHERIT
@ OBJECT_LRT_OCCLUSION_ONLY
@ OBJECT_LRT_INTERSECTION_ONLY
@ OBJECT_LRT_FORCE_INTERSECTION
@ OB_FROMDUPLI
@ BA_WAS_SEL
@ OB_DONE
@ BA_TRANSFORM_CHILD
@ OB_FLAG_USE_SIMULATION_CACHE
@ BA_TRANSFORM_LOCKED_IN_PLACE
@ BA_TEMP_TAG
@ BA_TRANSFORM_PARENT
@ BA_SNAP_FIX_DEPS_FIASCO
@ DG_LOCK_WEIGHT
@ OB_EMPTY_IMAGE_DEPTH_DEFAULT
@ OB_EMPTY_IMAGE_DEPTH_FRONT
@ OB_EMPTY_IMAGE_DEPTH_BACK
unsigned long long int uint64_t
#define DNA_DEFINE_CXX_METHODS(class_name)
static ulong * next
SymEdge< T > * prev(const SymEdge< T > *se)
MatBase< float, 4, 4 > float4x4
__forceinline BoundBox()=default
float vec[8][3]
Definition DNA_ID.h:404
struct Collection * blocker_collection
LightLinkingRuntime runtime
struct Collection * receiver_collection
struct Object * parent
struct ObHook * prev
char name[64]
float mat[4][4]
float cent[3]
struct ObHook * next
float parentinv[4][4]
unsigned char intersection_priority
ListBase particlesystem
struct Object * track
short transflag
unsigned short col_group
ListBase constraints
struct Collection * instance_collection
char collision_boundtype
short base_flag
struct bPose * pose
struct Object *proxy DNA_DEPRECATED
struct LightProbeObjectCache * lightprobe_cache
ObjectRuntimeHandle * runtime
float drot[3]
ListBase modifiers
float dquat[4]
struct RigidBodyOb * rigidbody_object
float shadow_terminator_shading_offset
float constinv[4][4]
ListBase greasepencil_modifiers
struct PreviewImage * preview
struct Material ** mat
float loc[3]
char * matbits
struct PartDeflect * pd
float dloc[3]
float scale[3]
struct SoftBody * soft
float rot[3]
float parentinv[4][4]
char empty_drawtype
ListBase shader_fx
ImageUser * iuser
short visibility_flag
char _pad2[4]
unsigned short col_mask
char empty_image_flag
uint8_t modifier_flag
ObjectLineArt lineart
float drotAxis[3]
float empty_drawsize
float shadow_terminator_geometry_offset
bMotionPath * mpath
float quat[4]
LightLinking * light_linking
ListBase pc_ids
float rotAxis[3]
float drotAngle
float color[4]
struct AnimData * adt
float dscale[3]
float instance_faces_scale
short protectflag
char _pad3[1]
char empty_image_depth
struct Object * parent
short trackflag
char duplicator_visibility_flag
unsigned short base_local_view_bits
struct SculptSession * sculpt
struct RigidBodyCon * rigidbody_constraint
float shadow_terminator_normal_offset
struct LightgroupMembership * lightgroup
char parsubstr[64]
char empty_image_visibility_flag
bAnimVizSettings avs
float ima_ofs[2]
struct bDeformGroup * next
struct bDeformGroup * prev
uint8_t flag
Definition wm_window.cc:139