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
path: root/source
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-06-09 18:01:44 +0300
committerJacques Lucke <jacques@blender.org>2020-06-09 18:01:54 +0300
commitb37fca650eeaefc0980ffa10a56c80a5ee875c01 (patch)
tree1476bd424fc612569faf3d60c1aca953ad4a235f /source
parent0cb59866af227d6c51244bc5c63723e7dc390153 (diff)
Cleanup: Move pointcache dna to separate file
Reviewers: brecht Differential Revision: https://developer.blender.org/D7965
Diffstat (limited to 'source')
-rw-r--r--source/blender/CMakeLists.txt1
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h1
-rw-r--r--source/blender/blenkernel/intern/bpath.c1
-rw-r--r--source/blender/blenloader/intern/readfile.c1
-rw-r--r--source/blender/blenloader/intern/versioning_270.c1
-rw-r--r--source/blender/blenloader/intern/writefile.c1
-rw-r--r--source/blender/draw/engines/overlay/overlay_extra.c2
-rw-r--r--source/blender/makesdna/DNA_object_force_types.h136
-rw-r--r--source/blender/makesdna/DNA_pointcache_types.h170
-rw-r--r--source/blender/makesdna/intern/makesdna.c2
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c1
11 files changed, 180 insertions, 137 deletions
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index fc1cd28312e..593d972b0af 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -70,6 +70,7 @@ set(SRC_DNA_INC
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_outliner_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_packedFile_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_particle_types.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_pointcache_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_rigidbody_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_scene_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_screen_types.h
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index 2dd364f3c48..a8c6fe4416f 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -28,6 +28,7 @@
#include "DNA_boid_types.h"
#include "DNA_dynamicpaint_types.h"
#include "DNA_object_force_types.h"
+#include "DNA_pointcache_types.h"
#include <stdio.h> /* for FILE */
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index d179bfbedfd..f0e23ddad41 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -55,6 +55,7 @@
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
+#include "DNA_pointcache_types.h"
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_sound_types.h"
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 1e09f01fa57..79705385538 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -79,6 +79,7 @@
#include "DNA_object_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_particle_types.h"
+#include "DNA_pointcache_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 0ca6fd34535..2a468026ac5 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -43,6 +43,7 @@
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
+#include "DNA_pointcache_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_screen_types.h"
#include "DNA_sdna_types.h"
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 3fa36c6995e..9889f21c26d 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -126,6 +126,7 @@
#include "DNA_object_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_particle_types.h"
+#include "DNA_pointcache_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c
index 859f3f93b1d..15bf26a5fa8 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.c
+++ b/source/blender/draw/engines/overlay/overlay_extra.c
@@ -46,7 +46,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_modifier_types.h"
-#include "DNA_object_force_types.h"
+#include "DNA_pointcache_types.h"
#include "DNA_rigidbody_types.h"
#include "DEG_depsgraph_query.h"
diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h
index 85520f5a930..7f022f104e6 100644
--- a/source/blender/makesdna/DNA_object_force_types.h
+++ b/source/blender/makesdna/DNA_object_force_types.h
@@ -186,111 +186,6 @@ typedef struct EffectorWeights {
/* EffectorWeights->flag */
#define EFF_WEIGHT_DO_HAIR 1
-/**
- * Point cache file data types:
- * - Used as `(1 << flag)` so poke jahka if you reach the limit of 15.
- * - To add new data types update:
- * - #BKE_ptcache_data_size()
- * - #ptcache_file_pointers_init()
- */
-#define BPHYS_DATA_INDEX 0
-#define BPHYS_DATA_LOCATION 1
-#define BPHYS_DATA_SMOKE_LOW 1
-#define BPHYS_DATA_VELOCITY 2
-#define BPHYS_DATA_SMOKE_HIGH 2
-#define BPHYS_DATA_ROTATION 3
-#define BPHYS_DATA_DYNAMICPAINT 3
-#define BPHYS_DATA_AVELOCITY 4 /* used for particles */
-#define BPHYS_DATA_XCONST 4 /* used for cloth */
-#define BPHYS_DATA_SIZE 5
-#define BPHYS_DATA_TIMES 6
-#define BPHYS_DATA_BOIDS 7
-
-#define BPHYS_TOT_DATA 8
-
-#define BPHYS_EXTRA_FLUID_SPRINGS 1
-
-typedef struct PTCacheExtra {
- struct PTCacheExtra *next, *prev;
- unsigned int type, totdata;
- void *data;
-} PTCacheExtra;
-
-typedef struct PTCacheMem {
- struct PTCacheMem *next, *prev;
- unsigned int frame, totpoint;
- unsigned int data_types, flag;
-
- /** BPHYS_TOT_DATA. */
- void *data[8];
- /** BPHYS_TOT_DATA. */
- void *cur[8];
-
- struct ListBase extradata;
-} PTCacheMem;
-
-typedef struct PointCache {
- struct PointCache *next, *prev;
- /** Generic flag. */
- int flag;
-
- /**
- * The number of frames between cached frames.
- * This should probably be an upper bound for a per point adaptive step in the future,
- * buf for now it's the same for all points. Without adaptivity this can effect the perceived
- * simulation quite a bit though. If for example particles are colliding with a horizontal
- * plane (with high damping) they quickly come to a stop on the plane, however there are still
- * forces acting on the particle (gravity and collisions), so the particle velocity isn't
- * necessarily zero for the whole duration of the frame even if the particle seems stationary.
- * If all simulation frames aren't cached (step > 1) these velocities are interpolated into
- * movement for the non-cached frames.
- * The result will look like the point is oscillating around the collision location.
- * So for now cache step should be set to 1 for accurate reproduction of collisions.
- */
- int step;
-
- /** Current frame of simulation (only if SIMULATION_VALID). */
- int simframe;
- /** Simulation start frame. */
- int startframe;
- /** Simulation end frame. */
- int endframe;
- /** Frame being edited (runtime only). */
- int editframe;
- /** Last exact frame that's cached. */
- int last_exact;
- /** Used for editing cache - what is the last baked frame. */
- int last_valid;
- char _pad[4];
-
- /* for external cache files */
- /** Number of cached points. */
- int totpoint;
- /** Modifier stack index. */
- int index;
- short compression, rt;
-
- char name[64];
- char prev_name[64];
- char info[128];
- /** File path, 1024 = FILE_MAX. */
- char path[1024];
-
- /**
- * Array of length `endframe - startframe + 1` with flags to indicate cached frames.
- * Can be later used for other per frame flags too if needed.
- */
- char *cached_frames;
- int cached_frames_len;
- char _pad1[4];
-
- struct ListBase mem_cache;
-
- struct PTCacheEdit *edit;
- /** Free callback. */
- void (*free_edit)(struct PTCacheEdit *edit);
-} PointCache;
-
typedef struct SBVertex {
float vec[4];
} SBVertex;
@@ -478,37 +373,6 @@ typedef struct SoftBody {
#define PFIELD_Z_POS 1
#define PFIELD_Z_NEG 2
-/* pointcache->flag */
-#define PTCACHE_BAKED (1 << 0)
-#define PTCACHE_OUTDATED (1 << 1)
-#define PTCACHE_SIMULATION_VALID (1 << 2)
-#define PTCACHE_BAKING (1 << 3)
-//#define PTCACHE_BAKE_EDIT (1 << 4)
-//#define PTCACHE_BAKE_EDIT_ACTIVE (1 << 5)
-#define PTCACHE_DISK_CACHE (1 << 6)
-///* removed since 2.64 - [#30974], could be added back in a more useful way */
-//#define PTCACHE_QUICK_CACHE (1 << 7)
-#define PTCACHE_FRAMES_SKIPPED (1 << 8)
-#define PTCACHE_EXTERNAL (1 << 9)
-#define PTCACHE_READ_INFO (1 << 10)
-/** don't use the filename of the blendfile the data is linked from (write a local cache) */
-#define PTCACHE_IGNORE_LIBPATH (1 << 11)
-/**
- * High resolution cache is saved for smoke for backwards compatibility,
- * so set this flag to know it's a "fake" cache.
- */
-#define PTCACHE_FAKE_SMOKE (1 << 12)
-#define PTCACHE_IGNORE_CLEAR (1 << 13)
-
-#define PTCACHE_FLAG_INFO_DIRTY (1 << 14)
-
-/* PTCACHE_OUTDATED + PTCACHE_FRAMES_SKIPPED */
-#define PTCACHE_REDO_NEEDED 258
-
-#define PTCACHE_COMPRESS_NO 0
-#define PTCACHE_COMPRESS_LZO 1
-#define PTCACHE_COMPRESS_LZMA 2
-
/* ob->softflag */
#define OB_SB_ENABLE 1 /* deprecated, use modifier */
#define OB_SB_GOAL 2
diff --git a/source/blender/makesdna/DNA_pointcache_types.h b/source/blender/makesdna/DNA_pointcache_types.h
new file mode 100644
index 00000000000..fcdc22ca56d
--- /dev/null
+++ b/source/blender/makesdna/DNA_pointcache_types.h
@@ -0,0 +1,170 @@
+/*
+ * 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_POINTCACHE_TYPES_H__
+#define __DNA_POINTCACHE_TYPES_H__
+
+#include "DNA_listBase.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Point cache file data types:
+ * - Used as `(1 << flag)` so poke jahka if you reach the limit of 15.
+ * - To add new data types update:
+ * - #BKE_ptcache_data_size()
+ * - #ptcache_file_pointers_init()
+ */
+#define BPHYS_DATA_INDEX 0
+#define BPHYS_DATA_LOCATION 1
+#define BPHYS_DATA_SMOKE_LOW 1
+#define BPHYS_DATA_VELOCITY 2
+#define BPHYS_DATA_SMOKE_HIGH 2
+#define BPHYS_DATA_ROTATION 3
+#define BPHYS_DATA_DYNAMICPAINT 3
+#define BPHYS_DATA_AVELOCITY 4 /* used for particles */
+#define BPHYS_DATA_XCONST 4 /* used for cloth */
+#define BPHYS_DATA_SIZE 5
+#define BPHYS_DATA_TIMES 6
+#define BPHYS_DATA_BOIDS 7
+
+#define BPHYS_TOT_DATA 8
+
+#define BPHYS_EXTRA_FLUID_SPRINGS 1
+
+typedef struct PTCacheExtra {
+ struct PTCacheExtra *next, *prev;
+ unsigned int type, totdata;
+ void *data;
+} PTCacheExtra;
+
+typedef struct PTCacheMem {
+ struct PTCacheMem *next, *prev;
+ unsigned int frame, totpoint;
+ unsigned int data_types, flag;
+
+ /** BPHYS_TOT_DATA. */
+ void *data[8];
+ /** BPHYS_TOT_DATA. */
+ void *cur[8];
+
+ struct ListBase extradata;
+} PTCacheMem;
+
+typedef struct PointCache {
+ struct PointCache *next, *prev;
+ /** Generic flag. */
+ int flag;
+
+ /**
+ * The number of frames between cached frames.
+ * This should probably be an upper bound for a per point adaptive step in the future,
+ * buf for now it's the same for all points. Without adaptivity this can effect the perceived
+ * simulation quite a bit though. If for example particles are colliding with a horizontal
+ * plane (with high damping) they quickly come to a stop on the plane, however there are still
+ * forces acting on the particle (gravity and collisions), so the particle velocity isn't
+ * necessarily zero for the whole duration of the frame even if the particle seems stationary.
+ * If all simulation frames aren't cached (step > 1) these velocities are interpolated into
+ * movement for the non-cached frames.
+ * The result will look like the point is oscillating around the collision location.
+ * So for now cache step should be set to 1 for accurate reproduction of collisions.
+ */
+ int step;
+
+ /** Current frame of simulation (only if SIMULATION_VALID). */
+ int simframe;
+ /** Simulation start frame. */
+ int startframe;
+ /** Simulation end frame. */
+ int endframe;
+ /** Frame being edited (runtime only). */
+ int editframe;
+ /** Last exact frame that's cached. */
+ int last_exact;
+ /** Used for editing cache - what is the last baked frame. */
+ int last_valid;
+ char _pad[4];
+
+ /* for external cache files */
+ /** Number of cached points. */
+ int totpoint;
+ /** Modifier stack index. */
+ int index;
+ short compression, rt;
+
+ char name[64];
+ char prev_name[64];
+ char info[128];
+ /** File path, 1024 = FILE_MAX. */
+ char path[1024];
+
+ /**
+ * Array of length `endframe - startframe + 1` with flags to indicate cached frames.
+ * Can be later used for other per frame flags too if needed.
+ */
+ char *cached_frames;
+ int cached_frames_len;
+ char _pad1[4];
+
+ struct ListBase mem_cache;
+
+ struct PTCacheEdit *edit;
+ /** Free callback. */
+ void (*free_edit)(struct PTCacheEdit *edit);
+} PointCache;
+
+/* pointcache->flag */
+#define PTCACHE_BAKED (1 << 0)
+#define PTCACHE_OUTDATED (1 << 1)
+#define PTCACHE_SIMULATION_VALID (1 << 2)
+#define PTCACHE_BAKING (1 << 3)
+//#define PTCACHE_BAKE_EDIT (1 << 4)
+//#define PTCACHE_BAKE_EDIT_ACTIVE (1 << 5)
+#define PTCACHE_DISK_CACHE (1 << 6)
+///* removed since 2.64 - [#30974], could be added back in a more useful way */
+//#define PTCACHE_QUICK_CACHE (1 << 7)
+#define PTCACHE_FRAMES_SKIPPED (1 << 8)
+#define PTCACHE_EXTERNAL (1 << 9)
+#define PTCACHE_READ_INFO (1 << 10)
+/** don't use the filename of the blendfile the data is linked from (write a local cache) */
+#define PTCACHE_IGNORE_LIBPATH (1 << 11)
+/**
+ * High resolution cache is saved for smoke for backwards compatibility,
+ * so set this flag to know it's a "fake" cache.
+ */
+#define PTCACHE_FAKE_SMOKE (1 << 12)
+#define PTCACHE_IGNORE_CLEAR (1 << 13)
+
+#define PTCACHE_FLAG_INFO_DIRTY (1 << 14)
+
+/* PTCACHE_OUTDATED + PTCACHE_FRAMES_SKIPPED */
+#define PTCACHE_REDO_NEEDED 258
+
+#define PTCACHE_COMPRESS_NO 0
+#define PTCACHE_COMPRESS_LZO 1
+#define PTCACHE_COMPRESS_LZMA 2
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DNA_POINTCACHE_TYPES_H__ */
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 09cfe54e94d..083806350e7 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -137,6 +137,7 @@ static const char *includefiles[] = {
"DNA_pointcloud_types.h",
"DNA_volume_types.h",
"DNA_simulation_types.h",
+ "DNA_pointcache_types.h",
/* see comment above before editing! */
@@ -1584,6 +1585,7 @@ int main(int argc, char **argv)
#include "DNA_outliner_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_particle_types.h"
+#include "DNA_pointcache_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 3317ae91f98..30e0ba19608 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -25,6 +25,7 @@
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
+#include "DNA_pointcache_types.h"
#include "DNA_scene_types.h"
#include "RNA_define.h"