[Bf-blender-cvs] [5961d6565b0] blenloader-api: update particle system modifier

Jacques Lucke noreply at git.blender.org
Sat Mar 7 19:09:30 CET 2020


Commit: 5961d6565b0cac13184e235f60ce508b2795121c
Author: Jacques Lucke
Date:   Sat Mar 7 19:02:56 2020 +0100
Branches: blenloader-api
https://developer.blender.org/rB5961d6565b0cac13184e235f60ce508b2795121c

update particle system modifier

===================================================================

M	source/blender/blenloader/intern/readfile.c
M	source/blender/modifiers/intern/MOD_particlesystem.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index d3a73a1673f..c1af3f930bb 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5397,15 +5397,6 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb, Object *ob)
       collmd->bvhtree = NULL;
       collmd->tri = NULL;
     }
-    else if (md->type == eModifierType_ParticleSystem) {
-      ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
-
-      psmd->mesh_final = NULL;
-      psmd->mesh_original = NULL;
-      psmd->psys = newdataadr(fd, psmd->psys);
-      psmd->flag &= ~eParticleSystemFlag_psys_updated;
-      psmd->flag |= eParticleSystemFlag_file_loaded;
-    }
     else if (md->type == eModifierType_Explode) {
       ExplodeModifierData *psmd = (ExplodeModifierData *)md;
 
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index c14239f6dab..8151e1c51aa 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -36,6 +36,8 @@
 
 #include "DEG_depsgraph_query.h"
 
+#include "BLO_callback_api.h"
+
 #include "MOD_util.h"
 
 static void initData(ModifierData *md)
@@ -90,6 +92,17 @@ static void requiredDataMask(Object *UNUSED(ob),
   psys_emitter_customdata_mask(psmd->psys, r_cddata_masks);
 }
 
+static void bloRead(BloReader *reader, ModifierData *md)
+{
+  ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
+
+  psmd->mesh_final = NULL;
+  psmd->mesh_original = NULL;
+  BLO_read_update_address(reader, psmd->psys);
+  psmd->flag &= ~eParticleSystemFlag_psys_updated;
+  psmd->flag |= eParticleSystemFlag_file_loaded;
+}
+
 /* saves the current emitter state for a particle system and calculates particles */
 static void deformVerts(ModifierData *md,
                         const ModifierEvalContext *ctx,
@@ -278,5 +291,5 @@ ModifierTypeInfo modifierType_ParticleSystem = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
-    /* bloRead */ NULL,
+    /* bloRead */ bloRead,
 };



More information about the Bf-blender-cvs mailing list