[Bf-blender-cvs] [9ad3a3754f7] blenloader-api: update vertex weight edit modifier
Jacques Lucke
noreply at git.blender.org
Sat Mar 7 19:09:28 CET 2020
Commit: 9ad3a3754f72a31f7c27b27fd2a413f8fb48fa67
Author: Jacques Lucke
Date: Sat Mar 7 18:44:00 2020 +0100
Branches: blenloader-api
https://developer.blender.org/rB9ad3a3754f72a31f7c27b27fd2a413f8fb48fa67
update vertex weight edit modifier
===================================================================
M source/blender/blenloader/BLO_callback_api.h
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
M source/blender/modifiers/intern/MOD_weightvgedit.c
===================================================================
diff --git a/source/blender/blenloader/BLO_callback_api.h b/source/blender/blenloader/BLO_callback_api.h
index e31498f09ff..9f943bcc523 100644
--- a/source/blender/blenloader/BLO_callback_api.h
+++ b/source/blender/blenloader/BLO_callback_api.h
@@ -35,10 +35,10 @@ int BLO_get_struct_id_by_name(BloWriter *writer, const char *struct_name);
BLO_write_struct_array_by_id( \
writer, BLO_get_struct_id(writer, struct_name), array_size, data_ptr)
-void BLO_write_int32_array(BloWriter *writer, int size, int32_t *data_ptr);
-void BLO_write_uint32_array(BloWriter *writer, int size, uint32_t *data_ptr);
-void BLO_write_float_array(BloWriter *writer, int size, float *data_ptr);
-void BLO_write_float3_array(BloWriter *writer, int size, float *data_ptr);
+void BLO_write_int32_array(BloWriter *writer, int size, const int32_t *data_ptr);
+void BLO_write_uint32_array(BloWriter *writer, int size, const uint32_t *data_ptr);
+void BLO_write_float_array(BloWriter *writer, int size, const float *data_ptr);
+void BLO_write_float3_array(BloWriter *writer, int size, const float *data_ptr);
/* API for file reading.
**********************************************/
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index de5632e6ca8..3d6bc2ada6e 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5464,14 +5464,6 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb, Object *ob)
BKE_curvemapping_blo_read_struct(wrap_reader(fd), tmd->curfalloff);
}
}
- else if (md->type == eModifierType_WeightVGEdit) {
- WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
-
- wmd->cmap_curve = newdataadr(fd, wmd->cmap_curve);
- if (wmd->cmap_curve) {
- BKE_curvemapping_blo_read_struct(wrap_reader(fd), wmd->cmap_curve);
- }
- }
else if (md->type == eModifierType_MeshSequenceCache) {
MeshSeqCacheModifierData *msmcd = (MeshSeqCacheModifierData *)md;
msmcd->reader = NULL;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index e5bac8254f0..431cfff4a73 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1658,13 +1658,6 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
BKE_curvemapping_blo_write_ptr(wrap_writer(wd), tmd->curfalloff);
}
}
- else if (md->type == eModifierType_WeightVGEdit) {
- WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
-
- if (wmd->cmap_curve) {
- BKE_curvemapping_blo_write_ptr(wrap_writer(wd), wmd->cmap_curve);
- }
- }
}
}
@@ -4090,22 +4083,22 @@ int BLO_get_struct_id_by_name(BloWriter *writer, const char *struct_name)
return struct_id;
}
-void BLO_write_int32_array(BloWriter *writer, int size, int32_t *data_ptr)
+void BLO_write_int32_array(BloWriter *writer, int size, const int32_t *data_ptr)
{
BLO_write_raw(writer, sizeof(int32_t) * size, data_ptr);
}
-void BLO_write_uint32_array(BloWriter *writer, int size, uint32_t *data_ptr)
+void BLO_write_uint32_array(BloWriter *writer, int size, const uint32_t *data_ptr)
{
BLO_write_raw(writer, sizeof(uint32_t) * size, data_ptr);
}
-void BLO_write_float_array(BloWriter *writer, int size, float *data_ptr)
+void BLO_write_float_array(BloWriter *writer, int size, const float *data_ptr)
{
BLO_write_raw(writer, sizeof(float) * size, data_ptr);
}
-void BLO_write_float3_array(BloWriter *writer, int size, float *data_ptr)
+void BLO_write_float3_array(BloWriter *writer, int size, const float *data_ptr)
{
BLO_write_raw(writer, sizeof(float) * 3 * size, data_ptr);
}
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index d3cec846d48..c38856f0839 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -47,6 +47,8 @@
#include "MOD_weightvg_util.h"
#include "MOD_modifiertypes.h"
+#include "BLO_callback_api.h"
+
/**************************************
* Modifiers functions. *
**************************************/
@@ -156,6 +158,25 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
return (wmd->defgrp_name[0] == '\0');
}
+static void bloWrite(BloWriter *writer, const ModifierData *md)
+{
+ WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
+
+ if (wmd->cmap_curve) {
+ BKE_curvemapping_blo_write_ptr(writer, wmd->cmap_curve);
+ }
+}
+
+static void bloRead(BloReader *reader, ModifierData *md)
+{
+ WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
+
+ BLO_read_update_address(reader, wmd->cmap_curve);
+ if (wmd->cmap_curve) {
+ BKE_curvemapping_blo_read_struct(reader, wmd->cmap_curve);
+ }
+}
+
static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
{
BLI_assert(mesh != NULL);
@@ -318,6 +339,6 @@ ModifierTypeInfo modifierType_WeightVGEdit = {
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ foreachTexLink,
/* freeRuntimeData */ NULL,
- /* bloWrite */ NULL,
- /* bloRead */ NULL,
+ /* bloWrite */ bloWrite,
+ /* bloRead */ bloRead,
};
More information about the Bf-blender-cvs
mailing list