Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2020-03-17 16:41:48 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2020-03-18 13:23:05 +0300
commitb0a1cf2c9ae696b07f7a236bc855a5ab4a493dcb (patch)
tree92295af11db5e984da42bfac7ca60190b8549a3f /source/blender/makesdna
parent8dcfd392e4e62f193b666304425bc5ae635ecffe (diff)
Objects: add Volume object type, and prototypes for Hair and PointCloud
Only the volume object is exposed in the user interface. It is based on OpenVDB internally. Drawing and rendering code will follow in another commit. https://wiki.blender.org/wiki/Source/Objects/Volume https://wiki.blender.org/wiki/Reference/Release_Notes/2.83/Volumes Hair and PointCloud object types are hidden behind a WITH_NEW_OBJECT_TYPES build option. These are unfinished, and included only to make it easier to cooperate on development in the future and avoid tricky merges. https://wiki.blender.org/wiki/Source/Objects/New_Object_Types Ref T73201, T68981 Differential Revision: https://developer.blender.org/D6945
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_ID.h75
-rw-r--r--source/blender/makesdna/DNA_action_types.h3
-rw-r--r--source/blender/makesdna/DNA_customdata_types.h13
-rw-r--r--source/blender/makesdna/DNA_defaults.h8
-rw-r--r--source/blender/makesdna/DNA_hair_defaults.h40
-rw-r--r--source/blender/makesdna/DNA_hair_types.h82
-rw-r--r--source/blender/makesdna/DNA_object_types.h28
-rw-r--r--source/blender/makesdna/DNA_pointcloud_defaults.h40
-rw-r--r--source/blender/makesdna/DNA_pointcloud_types.h64
-rw-r--r--source/blender/makesdna/DNA_space_types.h1
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h3
-rw-r--r--source/blender/makesdna/DNA_volume_defaults.h59
-rw-r--r--source/blender/makesdna/DNA_volume_types.h130
-rw-r--r--source/blender/makesdna/intern/CMakeLists.txt3
-rw-r--r--source/blender/makesdna/intern/dna_defaults.c24
-rw-r--r--source/blender/makesdna/intern/makesdna.c6
16 files changed, 540 insertions, 39 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 063ea04bdba..1e894d44f87 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -405,6 +405,9 @@ typedef enum ID_Type {
ID_CF = MAKE_ID2('C', 'F'), /* CacheFile */
ID_WS = MAKE_ID2('W', 'S'), /* WorkSpace */
ID_LP = MAKE_ID2('L', 'P'), /* LightProbe */
+ ID_HA = MAKE_ID2('H', 'A'), /* Hair */
+ ID_PT = MAKE_ID2('P', 'T'), /* PointCloud */
+ ID_VO = MAKE_ID2('V', 'O'), /* Volume */
} ID_Type;
/* Only used as 'placeholder' in .blend files for directly linked data-blocks. */
@@ -670,39 +673,40 @@ typedef enum IDRecalcFlag {
} IDRecalcFlag;
/* To filter ID types (filter_id). 64 bit to fit all types. */
-enum {
- FILTER_ID_AC = (1ULL << 0),
- FILTER_ID_AR = (1ULL << 1),
- FILTER_ID_BR = (1ULL << 2),
- FILTER_ID_CA = (1ULL << 3),
- FILTER_ID_CU = (1ULL << 4),
- FILTER_ID_GD = (1ULL << 5),
- FILTER_ID_GR = (1ULL << 6),
- FILTER_ID_IM = (1ULL << 7),
- FILTER_ID_LA = (1ULL << 8),
- FILTER_ID_LS = (1ULL << 9),
- FILTER_ID_LT = (1ULL << 10),
- FILTER_ID_MA = (1ULL << 11),
- FILTER_ID_MB = (1ULL << 12),
- FILTER_ID_MC = (1ULL << 13),
- FILTER_ID_ME = (1ULL << 14),
- FILTER_ID_MSK = (1ULL << 15),
- FILTER_ID_NT = (1ULL << 16),
- FILTER_ID_OB = (1ULL << 17),
- FILTER_ID_PAL = (1ULL << 18),
- FILTER_ID_PC = (1ULL << 19),
- FILTER_ID_SCE = (1ULL << 20),
- FILTER_ID_SPK = (1ULL << 21),
- FILTER_ID_SO = (1ULL << 22),
- FILTER_ID_TE = (1ULL << 23),
- FILTER_ID_TXT = (1ULL << 24),
- FILTER_ID_VF = (1ULL << 25),
- FILTER_ID_WO = (1ULL << 26),
- FILTER_ID_PA = (1ULL << 27),
- FILTER_ID_CF = (1ULL << 28),
- FILTER_ID_WS = (1ULL << 29),
- FILTER_ID_LP = (1ULL << 31),
-};
+#define FILTER_ID_AC (1ULL << 0)
+#define FILTER_ID_AR (1ULL << 1)
+#define FILTER_ID_BR (1ULL << 2)
+#define FILTER_ID_CA (1ULL << 3)
+#define FILTER_ID_CU (1ULL << 4)
+#define FILTER_ID_GD (1ULL << 5)
+#define FILTER_ID_GR (1ULL << 6)
+#define FILTER_ID_IM (1ULL << 7)
+#define FILTER_ID_LA (1ULL << 8)
+#define FILTER_ID_LS (1ULL << 9)
+#define FILTER_ID_LT (1ULL << 10)
+#define FILTER_ID_MA (1ULL << 11)
+#define FILTER_ID_MB (1ULL << 12)
+#define FILTER_ID_MC (1ULL << 13)
+#define FILTER_ID_ME (1ULL << 14)
+#define FILTER_ID_MSK (1ULL << 15)
+#define FILTER_ID_NT (1ULL << 16)
+#define FILTER_ID_OB (1ULL << 17)
+#define FILTER_ID_PAL (1ULL << 18)
+#define FILTER_ID_PC (1ULL << 19)
+#define FILTER_ID_SCE (1ULL << 20)
+#define FILTER_ID_SPK (1ULL << 21)
+#define FILTER_ID_SO (1ULL << 22)
+#define FILTER_ID_TE (1ULL << 23)
+#define FILTER_ID_TXT (1ULL << 24)
+#define FILTER_ID_VF (1ULL << 25)
+#define FILTER_ID_WO (1ULL << 26)
+#define FILTER_ID_PA (1ULL << 27)
+#define FILTER_ID_CF (1ULL << 28)
+#define FILTER_ID_WS (1ULL << 29)
+#define FILTER_ID_LP (1ULL << 31)
+#define FILTER_ID_HA (1ULL << 32)
+#define FILTER_ID_PT (1ULL << 33)
+#define FILTER_ID_VO (1ULL << 34)
#define FILTER_ID_ALL \
(FILTER_ID_AC | FILTER_ID_AR | FILTER_ID_BR | FILTER_ID_CA | FILTER_ID_CU | FILTER_ID_GD | \
@@ -710,7 +714,7 @@ enum {
FILTER_ID_MB | FILTER_ID_MC | FILTER_ID_ME | FILTER_ID_MSK | FILTER_ID_NT | FILTER_ID_OB | \
FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_SCE | FILTER_ID_SPK | FILTER_ID_SO | \
FILTER_ID_TE | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_WO | FILTER_ID_CF | FILTER_ID_WS | \
- FILTER_ID_LP)
+ FILTER_ID_LP | FILTER_ID_HA | FILTER_ID_PT | FILTER_ID_VO)
/* IMPORTANT: this enum matches the order currently use in set_listbasepointers,
* keep them in sync! */
@@ -731,6 +735,9 @@ enum {
INDEX_ID_ME,
INDEX_ID_CU,
INDEX_ID_MB,
+ INDEX_ID_HA,
+ INDEX_ID_PT,
+ INDEX_ID_VO,
INDEX_ID_LT,
INDEX_ID_LA,
INDEX_ID_CA,
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 5b9340ab3d9..be9097cf5bd 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -776,6 +776,9 @@ typedef enum eDopeSheet_FilterFlag {
typedef enum eDopeSheet_FilterFlag2 {
ADS_FILTER_NOCACHEFILES = (1 << 1),
ADS_FILTER_NOMOVIECLIPS = (1 << 2),
+ ADS_FILTER_NOHAIR = (1 << 3),
+ ADS_FILTER_NOPOINTCLOUD = (1 << 4),
+ ADS_FILTER_NOVOLUME = (1 << 5),
} eDopeSheet_FilterFlag2;
/* DopeSheet general flags */
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index 4d0d66f29ff..5ee16c2631d 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -76,7 +76,7 @@ typedef struct CustomData {
* MUST be >= CD_NUMTYPES, but we cant use a define here.
* Correct size is ensured in CustomData_update_typemap assert().
*/
- int typemap[43];
+ int typemap[47];
/** Number of layers, size of layers array. */
int totlayer, maxlayer;
/** In editmode, total size of all data layers. */
@@ -147,7 +147,13 @@ typedef enum CustomDataType {
CD_CUSTOMLOOPNORMAL = 41,
CD_SCULPT_FACE_SETS = 42,
- CD_NUMTYPES = 43,
+ /* Hair and PointCloud */
+ CD_LOCATION = 43,
+ CD_RADIUS = 44,
+ CD_HAIRCURVE = 45,
+ CD_HAIRMAPPING = 46,
+
+ CD_NUMTYPES = 47,
} CustomDataType;
/* Bits for CustomDataMask */
@@ -203,6 +209,9 @@ typedef enum CustomDataType {
/** Multires loop data. */
#define CD_MASK_MULTIRES_GRIDS (CD_MASK_MDISPS | CD_GRID_PAINT_MASK)
+/* All data layers. */
+#define CD_MASK_ALL (~0LL)
+
typedef struct CustomData_MeshMasks {
uint64_t vmask;
uint64_t emask;
diff --git a/source/blender/makesdna/DNA_defaults.h b/source/blender/makesdna/DNA_defaults.h
index c20ccc05637..9b4a05034df 100644
--- a/source/blender/makesdna/DNA_defaults.h
+++ b/source/blender/makesdna/DNA_defaults.h
@@ -29,6 +29,10 @@
#include "BLI_utildefines.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "dna_type_offsets.h"
extern const void *DNA_default_table[SDNA_TYPE_MAX];
@@ -45,4 +49,8 @@ char *_DNA_struct_default_alloc_impl(const char *data_src, size_t size, const ch
(struct_name *)_DNA_struct_default_alloc_impl( \
DNA_default_table[SDNA_TYPE_FROM_STRUCT(struct_name)], sizeof(struct_name), __func__)
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __DNA_DEFAULTS_H__ */
diff --git a/source/blender/makesdna/DNA_hair_defaults.h b/source/blender/makesdna/DNA_hair_defaults.h
new file mode 100644
index 00000000000..de7a830885d
--- /dev/null
+++ b/source/blender/makesdna/DNA_hair_defaults.h
@@ -0,0 +1,40 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup DNA
+ */
+
+#ifndef __DNA_HAIR_DEFAULTS_H__
+#define __DNA_HAIR_DEFAULTS_H__
+
+/* Struct members on own line. */
+/* clang-format off */
+
+/* -------------------------------------------------------------------- */
+/** \name Hair Struct
+ * \{ */
+
+#define _DNA_DEFAULT_Hair \
+ { \
+ .flag = 0, \
+ }
+
+/** \} */
+
+/* clang-format on */
+
+#endif /* __DNA_HAIR_DEFAULTS_H__ */
diff --git a/source/blender/makesdna/DNA_hair_types.h b/source/blender/makesdna/DNA_hair_types.h
new file mode 100644
index 00000000000..c7f145dda48
--- /dev/null
+++ b/source/blender/makesdna/DNA_hair_types.h
@@ -0,0 +1,82 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file DNA_hair_types.h
+ * \ingroup DNA
+ */
+
+#ifndef __DNA_HAIR_TYPES_H__
+#define __DNA_HAIR_TYPES_H__
+
+#include "DNA_ID.h"
+#include "DNA_customdata_types.h"
+
+typedef struct HairCurve {
+ /* Index of first point of hair curve. */
+ int firstpoint;
+ /* Number of points in hair curve, must be 2 or higher. */
+ int numpoints;
+} HairCurve;
+
+/* Hair attachment to a mesh.
+ * TODO: attach to tesselated triangles or polygons?
+ * TODO: what type of interpolation to use for uv? */
+typedef struct HairMapping {
+ float uv[2];
+ int poly;
+} HairMapping;
+
+typedef struct Hair {
+ ID id;
+ struct AnimData *adt; /* animation data (must be immediately after id) */
+
+ int flag;
+ int _pad1[1];
+
+ /* Geometry */
+ float (*co)[3];
+ float *radius;
+ struct HairCurve *curves;
+ struct HairMaping *mapping;
+ int totpoint;
+ int totcurve;
+
+ /* Custom Data */
+ struct CustomData pdata;
+ struct CustomData cdata;
+
+ /* Material */
+ struct Material **mat;
+ short totcol;
+ short _pad2[3];
+
+ /* Draw Cache */
+ void *batch_cache;
+} Hair;
+
+/* Hair.flag */
+enum {
+ HA_DS_EXPAND = (1 << 0),
+};
+
+/* Only one material supported currently. */
+#define HAIR_MATERIAL_NR 1
+
+#endif /* __DNA_HAIR_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index fca74c29909..645611144e9 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -456,12 +456,18 @@ enum {
/** Grease Pencil object used in 3D view but not used for annotation in 2D. */
OB_GPENCIL = 26,
+ OB_HAIR = 27,
+
+ OB_POINTCLOUD = 28,
+
+ OB_VOLUME = 29,
+
OB_TYPE_MAX,
};
/* check if the object type supports materials */
#define OB_TYPE_SUPPORT_MATERIAL(_type) \
- (((_type) >= OB_MESH && (_type) <= OB_MBALL) || ((_type) == OB_GPENCIL))
+ (((_type) >= OB_MESH && (_type) <= OB_MBALL) || ((_type) >= OB_GPENCIL && (_type) <= OB_VOLUME))
#define OB_TYPE_SUPPORT_VGROUP(_type) (ELEM(_type, OB_MESH, OB_LATTICE, OB_GPENCIL))
#define OB_TYPE_SUPPORT_EDITMODE(_type) \
(ELEM(_type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
@@ -472,7 +478,20 @@ enum {
/* is this ID type used as object data */
#define OB_DATA_SUPPORT_ID(_id_type) \
- (ELEM(_id_type, ID_ME, ID_CU, ID_MB, ID_LA, ID_SPK, ID_LP, ID_CA, ID_LT, ID_GD, ID_AR))
+ (ELEM(_id_type, \
+ ID_ME, \
+ ID_CU, \
+ ID_MB, \
+ ID_LA, \
+ ID_SPK, \
+ ID_LP, \
+ ID_CA, \
+ ID_LT, \
+ ID_GD, \
+ ID_AR, \
+ ID_HA, \
+ ID_PT, \
+ ID_VO))
#define OB_DATA_SUPPORT_ID_CASE \
ID_ME: \
@@ -484,7 +503,10 @@ case ID_LP: \
case ID_CA: \
case ID_LT: \
case ID_GD: \
-case ID_AR
+case ID_AR: \
+case ID_HA: \
+case ID_PT: \
+case ID_VO
/* partype: first 4 bits: type */
enum {
diff --git a/source/blender/makesdna/DNA_pointcloud_defaults.h b/source/blender/makesdna/DNA_pointcloud_defaults.h
new file mode 100644
index 00000000000..89df2d3c4be
--- /dev/null
+++ b/source/blender/makesdna/DNA_pointcloud_defaults.h
@@ -0,0 +1,40 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup DNA
+ */
+
+#ifndef __DNA_POINTCLOUD_DEFAULTS_H__
+#define __DNA_POINTCLOUD_DEFAULTS_H__
+
+/* Struct members on own line. */
+/* clang-format off */
+
+/* -------------------------------------------------------------------- */
+/** \name PointCloud Struct
+ * \{ */
+
+#define _DNA_DEFAULT_PointCloud \
+ { \
+ .flag = 0, \
+ }
+
+/** \} */
+
+/* clang-format on */
+
+#endif /* __DNA_POINTCLOUD_DEFAULTS_H__ */
diff --git a/source/blender/makesdna/DNA_pointcloud_types.h b/source/blender/makesdna/DNA_pointcloud_types.h
new file mode 100644
index 00000000000..5d6a11bfb48
--- /dev/null
+++ b/source/blender/makesdna/DNA_pointcloud_types.h
@@ -0,0 +1,64 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file DNA_pointcloud_types.h
+ * \ingroup DNA
+ */
+
+#ifndef __DNA_POINTCLOUD_TYPES_H__
+#define __DNA_POINTCLOUD_TYPES_H__
+
+#include "DNA_ID.h"
+#include "DNA_customdata_types.h"
+
+typedef struct PointCloud {
+ ID id;
+ struct AnimData *adt; /* animation data (must be immediately after id) */
+
+ int flag;
+ int _pad1[1];
+
+ /* Geometry */
+ float (*co)[3];
+ float *radius;
+ int totpoint;
+ int _pad2[1];
+
+ /* Custom Data */
+ struct CustomData pdata;
+
+ /* Material */
+ struct Material **mat;
+ short totcol;
+ short _pad3[3];
+
+ /* Draw Cache */
+ void *batch_cache;
+} PointCloud;
+
+/* PointCloud.flag */
+enum {
+ PT_DS_EXPAND = (1 << 0),
+};
+
+/* Only one material supported currently. */
+#define POINTCLOUD_MATERIAL_NR 1
+
+#endif /* __DNA_POINTCLOUD_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 548212a2b0d..f12ed0553ce 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -858,6 +858,7 @@ typedef enum eFileSel_File_Types {
/** For all kinds of recognized import/export formats. No need for specialized types. */
FILE_TYPE_OBJECT_IO = (1 << 17),
FILE_TYPE_USD = (1 << 18),
+ FILE_TYPE_VOLUME = (1 << 19),
/** An FS directory (i.e. S_ISDIR on its path is true). */
FILE_TYPE_DIR = (1 << 30),
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 904d7b8a52e..4a3c5695827 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -1133,6 +1133,9 @@ typedef enum eDupli_ID_Flags {
USER_DUP_PSYS = (1 << 11),
USER_DUP_LIGHTPROBE = (1 << 12),
USER_DUP_GPENCIL = (1 << 13),
+ USER_DUP_HAIR = (1 << 14),
+ USER_DUP_POINTCLOUD = (1 << 15),
+ USER_DUP_VOLUME = (1 << 16),
} eDupli_ID_Flags;
/**
diff --git a/source/blender/makesdna/DNA_volume_defaults.h b/source/blender/makesdna/DNA_volume_defaults.h
new file mode 100644
index 00000000000..3a0373851da
--- /dev/null
+++ b/source/blender/makesdna/DNA_volume_defaults.h
@@ -0,0 +1,59 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup DNA
+ */
+
+#ifndef __DNA_VOLUME_DEFAULTS_H__
+#define __DNA_VOLUME_DEFAULTS_H__
+
+/* Struct members on own line. */
+/* clang-format off */
+
+/* -------------------------------------------------------------------- */
+/** \name Volume Struct
+ * \{ */
+
+#define _DNA_DEFAULT_VolumeDisplay \
+ { \
+ .density = 1.0f, \
+ .wireframe_type = VOLUME_WIREFRAME_BOXES, \
+ .wireframe_detail = VOLUME_WIREFRAME_COARSE, \
+ }
+
+#define _DNA_DEFAULT_VolumeRender \
+ { \
+ .space = VOLUME_SPACE_OBJECT, \
+ .step_size = 0.0f, \
+ .clipping = 0.001f, \
+ }
+
+#define _DNA_DEFAULT_Volume \
+ { \
+ .filepath[0] = '\0', \
+ .frame_start = 1, \
+ .frame_offset = 0, \
+ .frame_duration = 0, \
+ .display = _DNA_DEFAULT_VolumeDisplay, \
+ .render = _DNA_DEFAULT_VolumeRender, \
+ }
+
+/** \} */
+
+/* clang-format on */
+
+#endif /* __DNA_VOLUME_DEFAULTS_H__ */
diff --git a/source/blender/makesdna/DNA_volume_types.h b/source/blender/makesdna/DNA_volume_types.h
new file mode 100644
index 00000000000..af419ea1d55
--- /dev/null
+++ b/source/blender/makesdna/DNA_volume_types.h
@@ -0,0 +1,130 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file DNA_volume_types.h
+ * \ingroup DNA
+ */
+
+#ifndef __DNA_VOLUME_TYPES_H__
+#define __DNA_VOLUME_TYPES_H__
+
+#include "DNA_ID.h"
+
+struct PackedFile;
+struct VolumeGridVector;
+
+typedef struct Volume_Runtime {
+ /* OpenVDB Grids */
+ struct VolumeGridVector *grids;
+
+ /* Current frame in sequence for evaluated volume */
+ int frame;
+ int _pad;
+} Volume_Runtime;
+
+typedef struct VolumeDisplay {
+ float density;
+ int wireframe_type;
+ int wireframe_detail;
+ int _pad[1];
+} VolumeDisplay;
+
+typedef struct VolumeRender {
+ int precision;
+ int space;
+ float step_size;
+ float clipping;
+} VolumeRender;
+
+typedef struct Volume {
+ ID id;
+ struct AnimData *adt; /* animation data (must be immediately after id) */
+
+ /* File */
+ char filepath[1024]; /* FILE_MAX */
+ struct PackedFile *packedfile;
+
+ /* Sequence */
+ char is_sequence;
+ char sequence_mode;
+ char _pad1[2];
+ int frame_start;
+ int frame_duration;
+ int frame_offset;
+
+ /* Flag */
+ int flag;
+
+ /* Grids */
+ int active_grid;
+
+ /* Material */
+ struct Material **mat;
+ short totcol;
+ short _pad2[3];
+
+ /* Render & Display Settings */
+ VolumeRender render;
+ VolumeDisplay display;
+
+ /* Draw Cache */
+ void *batch_cache;
+
+ /* Runtime Data */
+ Volume_Runtime runtime;
+} Volume;
+
+/* Volume.flag */
+enum {
+ VO_DS_EXPAND = (1 << 0),
+};
+
+/* Volume.sequence_mode */
+typedef enum VolumeSequenceMode {
+ VOLUME_SEQUENCE_CLIP = 0,
+ VOLUME_SEQUENCE_EXTEND,
+ VOLUME_SEQUENCE_REPEAT,
+ VOLUME_SEQUENCE_PING_PONG,
+} VolumeSequenceMode;
+
+/* VolumeDisplay.wireframe_type */
+typedef enum VolumeWireframeType {
+ VOLUME_WIREFRAME_NONE = 0,
+ VOLUME_WIREFRAME_BOUNDS = 1,
+ VOLUME_WIREFRAME_BOXES = 2,
+ VOLUME_WIREFRAME_POINTS = 3,
+} VolumeWireframeType;
+
+/* VolumeDisplay.wireframe_detail */
+typedef enum VolumeWireframeDetail {
+ VOLUME_WIREFRAME_COARSE = 0,
+ VOLUME_WIREFRAME_FINE = 1,
+} VolumeWireframeDetail;
+
+/* VolumeRender.space */
+typedef enum VolumeRenderSpace {
+ VOLUME_SPACE_OBJECT = 0,
+ VOLUME_SPACE_WORLD = 1,
+} VolumeRenderSpace;
+
+/* Only one material supported currently. */
+#define VOLUME_MATERIAL_NR 1
+
+#endif /* __DNA_VOLUME_TYPES_H__ */
diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt
index 799ec931d57..f8f765c6ece 100644
--- a/source/blender/makesdna/intern/CMakeLists.txt
+++ b/source/blender/makesdna/intern/CMakeLists.txt
@@ -135,6 +135,7 @@ set(SRC
../DNA_curve_defaults.h
../DNA_defaults.h
../DNA_image_defaults.h
+ ../DNA_hair_defaults.h
../DNA_lattice_defaults.h
../DNA_light_defaults.h
../DNA_lightprobe_defaults.h
@@ -143,11 +144,13 @@ set(SRC
../DNA_mesh_defaults.h
../DNA_meta_defaults.h
../DNA_object_defaults.h
+ ../DNA_pointcloud_defaults.h
../DNA_scene_defaults.h
../DNA_speaker_defaults.h
../DNA_texture_defaults.h
../DNA_vec_defaults.h
../DNA_view3d_defaults.h
+ ../DNA_volume_defaults.h
../DNA_world_defaults.h
)
diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c
index 260f1cd20f6..a8be435b902 100644
--- a/source/blender/makesdna/intern/dna_defaults.c
+++ b/source/blender/makesdna/intern/dna_defaults.c
@@ -59,6 +59,7 @@
#include "DNA_camera_types.h"
#include "DNA_curve_types.h"
#include "DNA_image_types.h"
+#include "DNA_hair_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_light_types.h"
@@ -68,10 +69,12 @@
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_types.h"
+#include "DNA_pointcloud_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_speaker_types.h"
#include "DNA_texture_types.h"
+#include "DNA_volume_types.h"
#include "DNA_world_types.h"
#include "DNA_brush_defaults.h"
@@ -79,6 +82,7 @@
#include "DNA_camera_defaults.h"
#include "DNA_curve_defaults.h"
#include "DNA_image_defaults.h"
+#include "DNA_hair_defaults.h"
#include "DNA_lattice_defaults.h"
#include "DNA_light_defaults.h"
#include "DNA_lightprobe_defaults.h"
@@ -87,9 +91,11 @@
#include "DNA_mesh_defaults.h"
#include "DNA_meta_defaults.h"
#include "DNA_object_defaults.h"
+#include "DNA_pointcloud_defaults.h"
#include "DNA_scene_defaults.h"
#include "DNA_speaker_defaults.h"
#include "DNA_texture_defaults.h"
+#include "DNA_volume_defaults.h"
#include "DNA_world_defaults.h"
#define SDNA_DEFAULT_DECL_STRUCT(struct_name) \
@@ -110,6 +116,9 @@ SDNA_DEFAULT_DECL_STRUCT(Curve);
/* DNA_image_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(Image);
+/* DNA_hair_defaults.h */
+SDNA_DEFAULT_DECL_STRUCT(Hair);
+
/* DNA_lattice_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(Lattice);
@@ -134,6 +143,9 @@ SDNA_DEFAULT_DECL_STRUCT(MetaBall);
/* DNA_object_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(Object);
+/* DNA_pointcloud_defaults.h */
+SDNA_DEFAULT_DECL_STRUCT(PointCloud);
+
/* DNA_scene_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(Scene);
SDNA_DEFAULT_DECL_STRUCT(ToolSettings);
@@ -147,6 +159,9 @@ SDNA_DEFAULT_DECL_STRUCT(Tex);
/* DNA_view3d_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(View3D);
+/* DNA_volume_defaults.h */
+SDNA_DEFAULT_DECL_STRUCT(Volume);
+
/* DNA_world_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(World);
@@ -194,6 +209,9 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = {
/* DNA_image_defaults.h */
SDNA_DEFAULT_DECL(Image),
+ /* DNA_hair_defaults.h */
+ SDNA_DEFAULT_DECL(Hair),
+
/* DNA_lattice_defaults.h */
SDNA_DEFAULT_DECL(Lattice),
@@ -218,6 +236,9 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = {
/* DNA_object_defaults.h */
SDNA_DEFAULT_DECL(Object),
+ /* DNA_pointcloud_defaults.h */
+ SDNA_DEFAULT_DECL(PointCloud),
+
/* DNA_scene_defaults.h */
SDNA_DEFAULT_DECL(Scene),
SDNA_DEFAULT_DECL_EX(RenderData, Scene.r),
@@ -259,6 +280,9 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = {
SDNA_DEFAULT_DECL_EX(View3DShading, View3D.shading),
SDNA_DEFAULT_DECL_EX(View3DCursor, Scene.cursor),
+ /* DNA_volume_defaults.h */
+ SDNA_DEFAULT_DECL(Volume),
+
/* DNA_world_defaults.h */
SDNA_DEFAULT_DECL(World),
};
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index a33f13be09a..3d82df79e4c 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -133,6 +133,9 @@ static const char *includefiles[] = {
"DNA_lightprobe_types.h",
"DNA_curveprofile_types.h",
"DNA_xr_types.h",
+ "DNA_hair_types.h",
+ "DNA_pointcloud_types.h",
+ "DNA_volume_types.h",
/* see comment above before editing! */
@@ -1600,6 +1603,9 @@ int main(int argc, char **argv)
#include "DNA_lightprobe_types.h"
#include "DNA_curveprofile_types.h"
#include "DNA_xr_types.h"
+#include "DNA_hair_types.h"
+#include "DNA_pointcloud_types.h"
+#include "DNA_volume_types.h"
/* end of list */