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:
authorJacques Lucke <jacques@blender.org>2020-06-15 18:37:07 +0300
committerJacques Lucke <jacques@blender.org>2020-06-15 18:43:30 +0300
commitb6981d9e48ef9ccf3ae1b39d11af480a4d76f135 (patch)
tree2892555e5b89c7868931b8e3e922ac730746d3cd /source/blender/blenkernel/BKE_modifier.h
parenteaff606f2dbbf99b09fac57f4034b70c53a398ef (diff)
Modifiers: New callbacks for reading and writing .blend files
This is part of a greater blenloader decentralization effort (T76372). For modifiers the goal is that fewer files have to be modified when a new modifier is added. This patch just adds the `blendWrite` and `blendRead` callbacks to `ModifierTypeInfo` but does not change any other code yet. In the next steps, modifier specific code will be moved from `writefile.c` and `readfile.c` into their corresponding `MOD_*` files.
Diffstat (limited to 'source/blender/blenkernel/BKE_modifier.h')
-rw-r--r--source/blender/blenkernel/BKE_modifier.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index e4cf7d44f05..766ca78dc50 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -41,6 +41,8 @@ struct ModifierData;
struct Object;
struct Scene;
struct bArmature;
+struct BlendWriter;
+struct BlendDataReader;
typedef enum {
/* Should not be used, only for None modifier type */
@@ -355,6 +357,21 @@ typedef struct ModifierTypeInfo {
/* Register the panel types for the modifier's UI. */
void (*panelRegister)(struct ARegionType *region_type);
+
+ /* Is called when the modifier is written to a file. The modifier data struct itself is written
+ * already.
+ *
+ * This method should write any additional arrays and referenced structs that should be
+ * stored in the file.
+ */
+ void (*blendWrite)(struct BlendWriter *writer, const struct ModifierData *md);
+
+ /* Is called when the modifier is read from a file.
+ *
+ * It can be used to update pointers to arrays and other structs. Furthermore, fields that have
+ * not been written (e.g. runtime data) can be reset.
+ */
+ void (*blendRead)(struct BlendDataReader *reader, struct ModifierData *md);
} ModifierTypeInfo;
/* Used to find a modifier's panel type. */