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.
This commit is contained in:
Bastien Montagne
2020-01-21 19:57:57 +01:00
parent 6c50e82efb
commit 367d60dab1
3 changed files with 12 additions and 3 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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)
{