diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2020-01-21 21:57:57 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2020-01-21 22:10:02 +0300 |
commit | 367d60dab13723a5a2d7a5336af0efa64b3c446d (patch) | |
tree | f984516802ec6948f8b1dd0a52c78b50d4dc3d4e /source/blender | |
parent | 6c50e82efb3e46ef0a2a1b63bd4e1c8a64d559d0 (diff) |
Make ED_object_modifier_add() accept NULL scene parameter.
This data is only used to get current time/frame value, which is never
mandatory to add a modifier.
Needed by incoming fix to support particles modifiers in liboverrides.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 6 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 5 |
3 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index ded38cf562f..244ffb674a4 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3565,7 +3565,9 @@ ModifierData *object_add_particle_system(Main *bmain, Scene *scene, Object *ob, psys->totpart = 0; psys->flag = PSYS_CURRENT; - psys->cfra = BKE_scene_frame_to_ctime(scene, CFRA + 1); + if (scene != NULL) { + psys->cfra = BKE_scene_frame_to_ctime(scene, CFRA + 1); + } DEG_relations_tag_update(bmain); DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index b56403dfb6d..3bbd909800b 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3132,8 +3132,10 @@ SoftBody *sbNew(Scene *scene) sb->inpush = 0.5f; sb->interval = 10; - sb->sfra = scene->r.sfra; - sb->efra = scene->r.efra; + if (scene != NULL) { + sb->sfra = scene->r.sfra; + sb->efra = scene->r.efra; + } sb->colball = 0.49f; sb->balldamp = 0.50f; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 303e53fa5ee..db946b63323 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -127,6 +127,11 @@ static void object_force_modifier_bind_simple_options(Depsgraph *depsgraph, md_eval->mode = mode; } +/** Add a modifier to given object, including relevant extra processing needed by some physics + * types (particles, simulations...). + * + * \param scene is only used to set current frame in some cases, and may be NULL. + */ ModifierData *ED_object_modifier_add( ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type) { |