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:
authorBastien Montagne <mont29>2022-05-16 17:00:00 +0300
committerBastien Montagne <bastien@blender.org>2022-05-16 17:56:27 +0300
commit68d203af0bfbdf132604b5b2541e6f1fe9c49764 (patch)
treea3cef5602e2dc649ce32d90f2ea8e82cccbe0d8a /source/blender/blenkernel/intern/modifier.c
parentf1beb3b3f60be45854285935d6bfcedf839b317c (diff)
Refactor modifiers writing code.
This changes is needed to give more control to modifiers' writing callback when defined. It will allow to implement better culling of needless data when writing e.g. modifiers from library overrides. Ref. T97967. Reviewed By: brecht, JacquesLucke Differential Revision: https://developer.blender.org/D14939
Diffstat (limited to 'source/blender/blenkernel/intern/modifier.c')
-rw-r--r--source/blender/blenkernel/intern/modifier.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 5ffd253be3b..6348d83362e 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -1067,7 +1067,7 @@ void BKE_modifier_check_uuids_unique_and_report(const Object *object)
BLI_gset_free(used_uuids, NULL);
}
-void BKE_modifier_blend_write(BlendWriter *writer, ListBase *modbase)
+void BKE_modifier_blend_write(BlendWriter *writer, const ID *id_owner, ListBase *modbase)
{
if (modbase == NULL) {
return;
@@ -1076,7 +1076,13 @@ void BKE_modifier_blend_write(BlendWriter *writer, ListBase *modbase)
LISTBASE_FOREACH (ModifierData *, md, modbase) {
const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
if (mti == NULL) {
- return;
+ continue;
+ }
+
+ /* If the blendWrite callback is defined, it should handle the whole writing process. */
+ if (mti->blendWrite != NULL) {
+ mti->blendWrite(writer, id_owner, md);
+ continue;
}
BLO_write_struct_by_name(writer, mti->structName, md);
@@ -1162,10 +1168,6 @@ void BKE_modifier_blend_write(BlendWriter *writer, ListBase *modbase)
writestruct(wd, DATA, MFace, collmd->numfaces, collmd->mfaces);
#endif
}
-
- if (mti->blendWrite != NULL) {
- mti->blendWrite(writer, md);
- }
}
}