Blender V5.3
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_enum_flags.hh"
13#include "BLI_math_constants.hh"
15
16#include "DNA_object_enums.h"
17
18#include "DNA_ID.h"
19#include "DNA_action_types.h" /* bAnimVizSettings */
20#include "DNA_defs.h"
21#include "DNA_listBase.h"
22#include "DNA_vec_defaults.h"
23
24namespace blender {
25
26namespace bke {
27struct ObjectRuntime;
28}
29
30struct AnimData;
31struct BoundBox;
32struct Collection;
33struct Curve;
34struct Effect;
35struct FluidsimSettings;
37struct ImageUser;
39struct Material;
40struct ModifierData;
41struct ObHook;
42struct Object;
43struct PartDeflect;
44struct ParticleSystem;
45struct Path;
46struct RigidBodyOb;
47struct ShaderFxData;
48struct SoftBody;
49struct bGPdata;
50struct bFaceMap;
51
52#define MAX_VGROUP_NAME 64
53
55enum ebDeformGroup_Flag : char {
57};
59
60/* **************** BASE ********************* */
61
62
63enum eObject_Flag : short {
64 OB_SELECT = (1 << 0),
65 BA_WAS_SEL = (1 << 1),
66 /* NOTE: BA_HAS_RECALC_DATA can be re-used later if freed in `readfile.cc`. */
67 // BA_HAS_RECALC_OB = 1 << 2, /* DEPRECATED */
68 // BA_HAS_RECALC_DATA = 1 << 3, /* DEPRECATED */
71
73 BA_TEMP_TAG = 1 << 5,
79
84
85 OB_FROMDUPLI = 1 << 9,
87 OB_DONE = 1 << 10,
91};
93
94/* **************** OBJECT ********************* */
95
96
97enum ObjectType : short {
105
108
111
113
115
117
119
121
123
125
126 /* Keep last. */
128};
129
131enum eObject_Partype : short {
138 PARTYPE = (1 << 4) - 1,
139};
141
142
143enum eObject_TransFlag : short {
145 OB_TRANSFLAG_UNUSED_1 = 1 << 1, /* cleared */
146 OB_NEG_SCALE = 1 << 2,
147 OB_TRANSFLAG_UNUSED_3 = 1 << 3, /* cleared */
149 OB_DUPLIROT = 1 << 5,
150 OB_TRANSFLAG_UNUSED_6 = 1 << 6, /* cleared */
151 /* runtime, calculate derivedmesh for dupli before it's used */
152 OB_TRANSFLAG_UNUSED_7 = 1 << 7, /* dirty */
156 OB_DUPLIPARTS = 1 << 11,
157 OB_TRANSFLAG_UNUSED_12 = 1 << 12, /* cleared */
158 /* runtime constraints disable */
160 /* when calculating vertex parent position, ignore CD_ORIGINDEX layer */
162
164};
166
167
168enum eObject_Axis : short {
175};
176
180 OB_AXIS = 1 << 1,
181 OB_TEXSPACE = 1 << 2,
182 OB_DRAWNAME = 1 << 3,
183 /* OB_DRAWIMAGE = 1 << 4, */ /* UNUSED */
184 /* for solid+wire display */
185 OB_DRAWWIRE = 1 << 5,
186 /* For overdrawing. */
188 /* Enable transparent draw. */
190 OB_DRAW_ALL_EDGES = 1 << 8, /* only for meshes currently */
192 /* Enable lights for grease pencil. */
194};
196
197
208
221
223enum eObject_BoundType : char {
228 // OB_BOUND_TRIANGLE_MESH = 4, /* UNUSED */
229 // OB_BOUND_CONVEX_HULL = 5, /* UNUSED */
230 // OB_BOUND_DYN_MESH = 6, /* UNUSED */
232};
233
254
255
256enum eObject_ShapeFlag : char {
258#ifdef DNA_DEPRECATED_ALLOW
259 OB_SHAPE_FLAG_UNUSED_1 = 1 << 1, /* cleared */
260#endif
262};
264
265
266enum eObject_NlaFlag : short {
267 OB_ADS_UNUSED_1 = 1 << 0, /* cleared */
268 OB_ADS_UNUSED_2 = 1 << 1, /* cleared */
269 /* object-channel expanded status */
271 /* object's ipo-block */
272 /* OB_ADS_SHOWIPO = 1 << 11, */ /* UNUSED */
273 /* object's constraint channels */
274 /* OB_ADS_SHOWCONS = 1 << 12, */ /* UNUSED */
275 /* object's material channels */
276 /* OB_ADS_SHOWMATS = 1 << 13, */ /* UNUSED */
277 /* object's particle channels */
278 /* OB_ADS_SHOWPARTS = 1 << 14, */ /* UNUSED */
279};
281
282
300
301
307
308
314
324
325
330
335
336
338 struct bDeformGroup *next = nullptr, *prev = nullptr;
339 char name[/*MAX_VGROUP_NAME*/ 64] = "";
340 /* need this flag for locking weights */
342 char _pad0[7] = {};
343};
344
345#ifdef DNA_DEPRECATED_ALLOW
346struct bFaceMap {
347 struct bFaceMap *next = nullptr, *prev = nullptr;
348 char name[/*MAX_VGROUP_NAME*/ 64] = "";
349 char flag = 0;
350 char _pad0[7] = {};
351};
352#endif
353
375struct BoundBox {
376 float vec[8][3] = {};
377};
378
392
398
410
411/* Evaluated light linking state needed for the render engines integration. */
413
414 /* For objects that emit light: a bitmask of light sets this emitter is part of for the light
415 * linking.
416 * A light set is a combination of emitters used by one or more receiver objects.
417 *
418 * If there is no light linking in the scene or if the emitter does not specify light linking all
419 * bits are set.
420 *
421 * NOTE: There can only be 64 light sets in a scene. */
423
424 /* For objects that emit light: a bitmask of light sets this emitter is part of for the shadow
425 * linking.
426 * A light set is a combination of emitters from which a blocked object does not cast a shadow.
427 *
428 * If there is no shadow linking in the scene or if the emitter does not specify shadow linking
429 * all bits are set.
430 *
431 * NOTE: There can only be 64 light sets in a scene. */
433
434 /* For receiver objects: the index of the light set from which this object receives light.
435 *
436 * If there is no light linking in the scene or the receiver is not linked to any light this is
437 * assigned zero. */
439
440 /* For blocker objects: the index of the light set from which this object casts shadow from.
441 *
442 * If there is no shadow in the scene or the blocker is not linked to any emitter this is
443 * assigned zero. */
445
446 uint8_t _pad[6] = {};
447};
448
450 /* Collections which contains objects (possibly via nested collection indirection) which defines
451 * the light linking relation: such as whether objects are included or excluded from being lit by
452 * this emitter (receiver_collection), or whether they block light from this emitter
453 * (blocker_collection).
454 *
455 * If the collection is a null pointer then all objects from the current scene are receiving
456 * light from this emitter, and nothing is excluded from receiving the light and shadows.
457 *
458 * The emitter in this context is assumed to be either object of lamp type, or objects with
459 * surface which has emissive shader. */
462
464};
465
466struct Object {
467#ifdef __cplusplus
470 static constexpr ID_Type id_type = ID_OB;
471#endif
472
475 struct AnimData *adt = nullptr;
476
480 int par1 = 0, par2 = 0, par3 = 0;
482 char parsubstr[/*MAX_NAME*/ 64] = "";
483 struct Object *parent = nullptr, *track = nullptr;
485 char _pad4[4] = {};
486 /* Proxy pointer are deprecated, only kept for conversion to liboverrides. */
487 DNA_DEPRECATED struct Object *proxy = nullptr;
490 // struct Path *path = nullptr;
491 struct bAction *poselib DNA_DEPRECATED =
492 nullptr; /* Pre-Blender 3.0 pose library, deprecated in 3.5. */
494 struct bPose *pose = nullptr;
496 ID *data = nullptr;
497
500 nullptr; /* XXX deprecated... replaced by gpencil object, keep for readfile */
501
505 bMotionPath *mpath = nullptr;
506
507 ListBaseT<Effect> effect = {nullptr, nullptr}; /* XXX deprecated... keep for readfile */
508 ListBaseT<bDeformGroup> defbase = {nullptr,
509 nullptr}; /* Only for versioning, moved to object data. */
510 ListBaseT<bFaceMap> fmaps = {nullptr,
511 nullptr}; /* For versioning, moved to generic attributes. */
512
513 ListBaseT<ModifierData> modifiers = {nullptr, nullptr};
515 ListBaseT<GpencilModifierData> greasepencil_modifiers = {nullptr, nullptr};
517 ListBaseT<ShaderFxData> shader_fx = {nullptr, nullptr};
518
522
523 /* materials */
525 struct Material **mat = nullptr;
527 char *matbits = nullptr;
529 int totcol = 0;
531 int actcol = 0;
532
533 /* rot en drot have to be together! (transform('r' en 's')) */
534 float loc[3] = {}, dloc[3] = {};
536 float scale[3] = {1, 1, 1};
538 DNA_DEPRECATED float dsize[3] = {};
540 float dscale[3] = {1, 1, 1};
542 float rot[3] = {}, drot[3] = {};
547 float rotAxis[3] = {0, 1, 0}, drotAxis[3] = {0, 1, 0};
549 float rotAngle = 0, drotAngle = 0;
555
557 DNA_DEPRECATED unsigned int lay = 0;
558
563
570
571 char _pad1 = {};
574
575 /* Depsgraph */
577 short base_flag = 0;
579 unsigned short base_local_view_bits = 0;
580
582 unsigned short col_group = 0x01, col_mask = 0xffff;
583
586
591
597 float empty_drawsize = 1.0;
600
602 short index = 0;
604 DNA_DEPRECATED unsigned short actdef = 0;
606 float color[4] = {1, 1, 1, 1};
607
610
612 short softflag = 0;
613
615 short shapenr = 0;
618
619 char _pad3[3] = {};
620
622 ListBaseT<bConstraint> constraints = {nullptr, nullptr};
623 ListBaseT<struct ObHook> hooks = {nullptr, nullptr};
625 ListBaseT<struct ParticleSystem> particlesystem = {nullptr, nullptr};
626
628 struct PartDeflect *pd = nullptr;
630 struct SoftBody *soft = nullptr;
633
635 struct FluidsimSettings *fluidsimSettings DNA_DEPRECATED =
636 nullptr; /* XXX deprecated... replaced by mantaflow, keep for readfile */
637
638 ListBaseT<LinkData> pc_ids = {nullptr, nullptr};
639
641 struct RigidBodyOb *rigidbody_object = nullptr;
644
646 float ima_ofs[2] = {-0.5, -0.5};
648 ImageUser *iuser = nullptr;
652
654
658
659 struct PreviewImage *preview = nullptr;
660
662
665
668
671
673
674#ifdef __cplusplus
675 const float4x4 &object_to_world() const;
676 const float4x4 &world_to_object() const;
677#endif
678};
679
681struct ObHook {
682 struct ObHook *next = nullptr, *prev = nullptr;
683
684 struct Object *parent = nullptr;
686 float parentinv[4][4] = {};
688 float mat[4][4] = {};
690 float cent[3] = {};
692 float falloff = 0;
693
694 char name[/*MAX_NAME*/ 64] = "";
695
696 int *indexar = nullptr;
698 int totindex = 0, curindex = 0;
700 short type = 0, active = 0;
701 float force = 0;
702};
703
711#define SELECT 1
712
713/* check if the object type supports materials */
714#define OB_TYPE_SUPPORT_MATERIAL(_type) \
715 (((_type) >= OB_MESH && (_type) <= OB_MBALL) || \
716 ((_type) >= OB_CURVES && (_type) <= OB_GREASE_PENCIL))
717
722#define OB_TYPE_IS_GEOMETRY(_type) \
723 (ELEM(_type, \
724 OB_MESH, \
725 OB_SURF, \
726 OB_FONT, \
727 OB_MBALL, \
728 OB_CURVES_LEGACY, \
729 OB_CURVES, \
730 OB_POINTCLOUD, \
731 OB_VOLUME, \
732 OB_GREASE_PENCIL))
733
734#define OB_TYPE_SUPPORT_VGROUP(_type) (ELEM(_type, OB_MESH, OB_LATTICE, OB_GREASE_PENCIL))
735
736#define OB_TYPE_SUPPORT_EDITMODE(_type) \
737 (ELEM(_type, \
738 OB_MESH, \
739 OB_FONT, \
740 OB_CURVES_LEGACY, \
741 OB_SURF, \
742 OB_MBALL, \
743 OB_LATTICE, \
744 OB_ARMATURE, \
745 OB_CURVES, \
746 OB_POINTCLOUD, \
747 OB_GREASE_PENCIL))
748
749#define OB_TYPE_SUPPORT_PARVERT(_type) \
750 (ELEM(_type, OB_MESH, OB_SURF, OB_CURVES_LEGACY, OB_LATTICE))
751
753#define OB_DATA_SUPPORT_EDITMODE(_type) \
754 (ELEM(_type, ID_ME, ID_CU_LEGACY, ID_MB, ID_LT, ID_AR, ID_CV, ID_GP))
755
756/* is this ID type used as object data */
757#define OB_DATA_SUPPORT_ID(_id_type) \
758 (ELEM(_id_type, \
759 ID_ME, \
760 ID_CU_LEGACY, \
761 ID_MB, \
762 ID_LA, \
763 ID_SPK, \
764 ID_LP, \
765 ID_CA, \
766 ID_LT, \
767 ID_GD_LEGACY, \
768 ID_AR, \
769 ID_CV, \
770 ID_PT, \
771 ID_VO, \
772 ID_GP))
773
774#define OB_DATA_SUPPORT_ID_CASE \
775 ID_ME: \
776 case ID_CU_LEGACY: \
777 case ID_MB: \
778 case ID_LA: \
779 case ID_SPK: \
780 case ID_LP: \
781 case ID_CA: \
782 case ID_LT: \
783 case ID_GD_LEGACY: \
784 case ID_AR: \
785 case ID_CV: \
786 case ID_PT: \
787 case ID_VO: \
788 case ID_GP
789
790} // namespace blender
#define ENUM_OPERATORS(_enum_type)
#define DEG2RAD(_deg)
ID and Library types, which are fundamental for SDNA.
#define DNA_DEFINE_CXX_METHODS(class_name)
Definition DNA_defs.h:104
These structs are the foundation for all linked lists in the library system.
#define _DNA_DEFAULT_UNIT_QT
#define _DNA_DEFAULT_UNIT_M4
ENUM_OPERATORS(Layer::Flags)
BMesh Iterators.
unsigned __int64 uint64_t
Definition BKE_text.h:91
eObject_DuplicatorVisibilityFlag
@ OB_FLAG_ACTIVE_CLIPBOARD
@ OB_FLAG_USE_SIMULATION_CACHE
@ BA_SNAP_FIX_DEPS_FIASCO
@ BA_TRANSFORM_LOCKED_IN_PLACE
@ OBJECT_LRT_OWN_INTERSECTION_PRIORITY
MatBase< float, 4, 4 > float4x4
@ OB_MODIFIER_FLAG_ADD_REST_POSITION
@ GREASE_PENCIL_LINEART_OBJECT
@ GREASE_PENCIL_LINEART_COLLECTION
@ GREASE_PENCIL_LINEART_SCENE
@ OBJECT_LRT_OCCLUSION_ONLY
@ OBJECT_LRT_INTERSECTION_ONLY
@ OBJECT_LRT_FORCE_INTERSECTION
@ OBJECT_LRT_NO_INTERSECTION
unsigned char uchar
Definition BKE_text.h:58
unsigned char uint8_t
Definition BKE_text.h:79
@ OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK
@ OB_PARENT_USE_FINAL_INDICES
@ OB_EMPTY_IMAGE_USE_ALPHA_BLEND
@ OB_EMPTY_IMAGE_DEPTH_DEFAULT
@ OB_EMPTY_IMAGE_DEPTH_BACK
@ OB_EMPTY_IMAGE_DEPTH_FRONT
eObject_EmptyImageVisibilityFlag
@ OB_EMPTY_IMAGE_HIDE_FRONT
@ OB_EMPTY_IMAGE_HIDE_BACK
@ OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC
@ OB_EMPTY_IMAGE_HIDE_PERSPECTIVE
@ OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED
struct Collection * blocker_collection
LightLinkingRuntime runtime
struct Collection * receiver_collection
struct Object * parent
struct ObHook * next
struct ObHook * prev
float parentinv[4][4]
eObjectLineArt_Usage usage
eObjectLineArt_Flags flags
unsigned char intersection_priority
eObjectMode restore_mode
struct PartDeflect * pd
struct Object * parent
struct bAction *poselib DNA_DEPRECATED
ListBaseT< ModifierData > modifiers
ListBaseT< struct ObHook > hooks
float parentinv[4][4]
unsigned short col_group
ObjectModifierFlag modifier_flag
eObject_DrawExtraFlag dtx
struct PreviewImage * preview
ListBaseT< ShaderFxData > shader_fx
ListBaseT< bFaceMap > fmaps
bke::ObjectRuntime * runtime
struct LightProbeObjectCache * lightprobe_cache
LightLinking * light_linking
ListBaseT< GpencilModifierData > greasepencil_modifiers
float shadow_terminator_shading_offset
float shadow_terminator_geometry_offset
ListBaseT< struct ParticleSystem > particlesystem
eObject_VisibilityFlag visibility_flag
eObject_EmptyImageDepth empty_image_depth
eObject_EmptyImageFlag empty_image_flag
bAnimVizSettings avs
float parent_bone_head_tail_factor
struct Object * track
DNA_DEPRECATED struct Object * proxy_group
unsigned short col_mask
DNA_DEPRECATED short colbits
DNA_DEPRECATED unsigned short actdef
eObject_Partype partype
ListBaseT< Effect > effect
ListBaseT< bConstraint > constraints
ListBaseT< bDeformGroup > defbase
eObject_BoundType collision_boundtype
bMotionPath * mpath
eObject_Axis upflag
eObject_ShapeFlag shapeflag
float shadow_terminator_normal_offset
DNA_DEPRECATED unsigned int lay
struct AnimData * adt
DNA_DEPRECATED struct Object * proxy
ListBaseT< LinkData > pc_ids
eObject_NlaFlag nlaflag
eObject_EmptyImageVisibilityFlag empty_image_visibility_flag
unsigned short base_local_view_bits
eObject_Axis trackflag
DNA_DEPRECATED float dsize[3]
ObjectLineArt lineart
eObject_EmptyDrawType empty_drawtype
struct RigidBodyOb * rigidbody_object
eObject_TransFlag transflag
eObject_ProtectFlag protectflag
DNA_DEPRECATED struct Object * proxy_from
struct bPose * pose
struct Collection * instance_collection
eObject_DuplicatorVisibilityFlag duplicator_visibility_flag
eObject_BoundType boundtype
struct LightgroupMembership * lightgroup
struct Material ** mat
struct RigidBodyCon * rigidbody_constraint
struct SoftBody * soft
struct bDeformGroup * prev
struct bDeformGroup * next
ebDeformGroup_Flag flag